comparison client/digitallibrary/jquery/jquery.digilib.js @ 630:89d9ac6199a3 jquery

small fixes
author robcast
date Tue, 18 Jan 2011 22:50:03 +0100
parents 6b24ad042d7b
children 95c33992981a
comparison
equal deleted inserted replaced
629:6b24ad042d7b 630:89d9ac6199a3
162 'ww' : 1.0, 162 'ww' : 1.0,
163 'wh' : 1.0, 163 'wh' : 1.0,
164 'wx' : 0.0, 164 'wx' : 0.0,
165 'wy' : 0.0, 165 'wy' : 0.0,
166 'ws' : 1.0, 166 'ws' : 1.0,
167 'pn' : 1,
167 // mode of operation. 168 // mode of operation.
168 // fullscreen: takes parameters from page URL, keeps state in page URL 169 // fullscreen: takes parameters from page URL, keeps state in page URL
169 // embedded: takes parameters from Javascript options, keeps state inside object 170 // embedded: takes parameters from Javascript options, keeps state inside object
170 'interactionMode' : 'fullscreen', 171 'interactionMode' : 'fullscreen',
171 // actions 172 // actions
286 } 287 }
287 }; 288 };
288 289
289 // sets a key to a value (relative values with +/- if relative=true) 290 // sets a key to a value (relative values with +/- if relative=true)
290 var setNumValue = function(settings, key, value) { 291 var setNumValue = function(settings, key, value) {
291 // TODO: type and error checking
292 if (settings[key] == null) return null;
293 var sign = value.substring(0,1); 292 var sign = value.substring(0,1);
294 if (sign === '+' || sign === '-') { 293 if (sign === '+' || sign === '-') {
295 settings[key] = parseFloat(settings[key]) + parseFloat(value); 294 if (settings[key] == null) {
295 // this doesn't make much sense but still...
296 settings[key] = 0;
297 }
298 settings[key] = parseFloat(settings[key]) + parseFloat(value);
296 } else { 299 } else {
297 settings[key] = value; 300 settings[key] = value;
298 } 301 }
299 return settings[key]; 302 return settings[key];
300 }; 303 };
301 304
302 // returns parameters from page url 305 // returns parameters from page url
303 var parseQueryParams = function() { 306 var parseQueryParams = function() {
304 return parseQueryString(window.location.search.slice(1)); 307 return parseQueryString(window.location.search.slice(1));
305 }; 308 };
518 $elem.digilib(method); 521 $elem.digilib(method);
519 }; 522 };
520 } 523 }
521 })()); 524 })());
522 $img.attr('src', settings.buttonsImagePath + actionSettings.img); 525 $img.attr('src', settings.buttonsImagePath + actionSettings.img);
523 }; 526 }
524 } 527 }
525 return $buttonsDiv; 528 return $buttonsDiv;
526 }; 529 };
527 530
528 // creates HTML structure for the bird's eye view in elem 531 // creates HTML structure for the bird's eye view in elem
636 } 639 }
637 }; 640 };
638 641
639 // auxiliary function to crop senseless precision 642 // auxiliary function to crop senseless precision
640 var cropFloat = function (x) { 643 var cropFloat = function (x) {
641 return parseInt(10000 * x) / 10000; 644 return parseInt(10000 * x, 10) / 10000;
642 }; 645 };
643 646
644 // hook plugin into jquery 647 // hook plugin into jquery
645 $.fn.digilib = function(method) { 648 $.fn.digilib = function(method) {
646 if (methods[method]) { 649 if (methods[method]) {