changeset 852:4658ec2f9565 jquery

why not use coords attribute for coords?
author hertzhaft
date Mon, 07 Mar 2011 09:54:36 +0100
parents 5922c444cd11
children 2c401f68d577
files client/digitallibrary/jquery/jquery-test-embedded.html client/digitallibrary/jquery/jquery-test-full.html client/digitallibrary/jquery/jquery.digilib.css client/digitallibrary/jquery/jquery.digilib.regions.js
diffstat 4 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery-test-embedded.html	Mon Mar 07 09:30:55 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-test-embedded.html	Mon Mar 07 09:54:36 2011 +0100
@@ -66,8 +66,8 @@
                 var opts = {
                     interactionMode : 'embedded',
                     scalerBaseUrl : 'http://digilib.biblhertz.it/digilib04/servlet/Scaler',
-                    showRegionNumbers : true,
-                    autoRegionLinks : false
+                    showRegionNumbers : false,
+                    autoRegionLinks : true
                     };
                 var $div = $('div.digilib');
                 $div.digilib(opts);
@@ -99,9 +99,9 @@
                     <div id="digilib-3" class="digilib">
                         <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/FransHals-WillemVanHeythuysen" />
                         <div class="keep regioncontent">
-                            <a href="http://www.mpiwg-berlin.mpg.de" rel="area:0.1/0.1/0.4/0.1">MPI fuer Wissenschaftsgeschichte</a>
-                            <a href="http://www.biblhertz.it" rel="area:0.5/0.8/0.4/0.1">Bibliotheca Hertziana</a>
-                            <a rel="area:0.3/0.5/0.15/0.1" />
+                            <a href="http://www.mpiwg-berlin.mpg.de" coords="0.1,0.1,0.4,0.1">MPI fuer Wissenschaftsgeschichte</a>
+                            <a href="http://www.biblhertz.it" coords="0.5,0.8,0.4,0.1">Bibliotheca Hertziana</a>
+                            <a coords="0.3,0.5,0.15,0.1" />
                         </div>
                     </div>
                 </td>
--- a/client/digitallibrary/jquery/jquery-test-full.html	Mon Mar 07 09:30:55 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-test-full.html	Mon Mar 07 09:54:36 2011 +0100
@@ -84,11 +84,11 @@
 
         <div id="digilib-1" class="digilib">
             <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/FransHals-WillemVanHeythuysen" />
-            <div class="keep regioncontent">
-                <a href="http://www.mpiwg-berlin.mpg.de" rel="area:0.1/0.1/0.4/0.1">MPI fuer Wissenschaftsgeschichte</a>
-                <a href="http://www.biblhertz.it" rel="area:0.5/0.8/0.4/0.1">Bibliotheca Hertziana</a>
-                <a rel="area:0.3/0.5/0.15/0.1" />
-            </div>
+                        <div class="keep regioncontent">
+                            <a href="http://www.mpiwg-berlin.mpg.de" coords="0.1,0.1,0.4,0.1">MPI fuer Wissenschaftsgeschichte</a>
+                            <a href="http://www.biblhertz.it" coords="0.5,0.8,0.4,0.1">Bibliotheca Hertziana</a>
+                            <a coords="0.3,0.5,0.15,0.1" />
+                        </div>
         </div>
         <div id="debug">DEBUG</div>
     </body>
--- a/client/digitallibrary/jquery/jquery.digilib.css	Mon Mar 07 09:30:55 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.css	Mon Mar 07 09:54:36 2011 +0100
@@ -68,13 +68,13 @@
 
 div.region {
     color: white;
-    font-size: 80%;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+    font-size: 11px;
 }
 
 div.region a.regionnumber {
     color: white;
     text-decoration: none;
-	font-family: Verdana, Arial, Helvetica, sans-serif;
 	font-weight: bold;
 	font-size: 11px;
 	text-align: center;
--- a/client/digitallibrary/jquery/jquery.digilib.regions.js	Mon Mar 07 09:30:55 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.regions.js	Mon Mar 07 09:54:36 2011 +0100
@@ -239,10 +239,9 @@
         console.debug("createRegionsFromHTML. elems: ", $content);
         $content.each(function(index, a) {
             var $a = $(a); 
-            // the "rel" attribute contains the region coords
-            var rel = $a.attr('rel');
-            var area = rel.replace(/^area:/i, '');
-            var pos = area.split("/", 4);
+            // the "coords" attribute contains the region coords (0..1)
+            var coords = $a.attr('coords');
+            var pos = coords.split(",", 4);
             var rect = geom.rectangle(pos[0], pos[1], pos[2], pos[3]);
             regions.push(rect);
             // create the div
@@ -300,10 +299,10 @@
         var rg = data.settings.rg;
         if (rg == null) return;
         var regions = data.regions;
-        var rs = rg.split(",");
+        var rs = rg.split(";");
         for (var i = 0; i < rs.length; i++) {
             var r = rs[i];
-            var pos = r.split("/", 4);
+            var pos = r.split(",", 4);
             var rect = geom.rectangle(pos[0], pos[1], pos[2], pos[3]);
             regions.push(rect);
             }
@@ -320,14 +319,14 @@
         for (var i = 0; i < regions.length; i++) {
             region = regions[i];
             if (i) {
-                rg += ',';
+                rg += ';';
             }
             rg += [
                 fn.cropFloatStr(region.x), 
                 fn.cropFloatStr(region.y),
                 fn.cropFloatStr(region.width),
                 fn.cropFloatStr(region.height)
-                ].join('/');
+                ].join(',');
         }
         data.settings.rg = rg;
     };