comparison client/digitallibrary/jquery/jquery.digilib.js @ 783:16cff012d7c1 jquery

put plugins reference into plugin object. put geom into fn object for plugins.
author robcast
date Fri, 18 Feb 2011 09:44:42 +0100
parents 29de7131a5a8
children 966d5c938b4c
comparison
equal deleted inserted replaced
782:c1b94091b336 783:16cff012d7c1
264 // init: digilib initialization 264 // init: digilib initialization
265 init : function(options) { 265 init : function(options) {
266 // import geometry classes 266 // import geometry classes
267 if (plugins.geometry == null) { 267 if (plugins.geometry == null) {
268 $.error("jquery.digilib.geometry plugin not found!"); 268 $.error("jquery.digilib.geometry plugin not found!");
269 // last straw: old version
269 geom = dlGeometry(); 270 geom = dlGeometry();
270 } else { 271 } else {
271 geom = plugins.geometry.init(); 272 geom = plugins.geometry.init();
272 } 273 }
273 FULL_AREA = geom.rectangle(0, 0, 1, 1); 274 FULL_AREA = geom.rectangle(0, 0, 1, 1);
321 elemSettings = $.extend({}, settings, params); 322 elemSettings = $.extend({}, settings, params);
322 data = { 323 data = {
323 $elem : $elem, 324 $elem : $elem,
324 settings : elemSettings, 325 settings : elemSettings,
325 queryParams : params, 326 queryParams : params,
327 // TODO: move plugins reference out of data
326 plugins : plugins 328 plugins : plugins
327 }; 329 };
328 // store in data element 330 // store in data element
329 $elem.data('digilib', data); 331 $elem.data('digilib', data);
330 } 332 }
358 var p = plugins[n]; 360 var p = plugins[n];
359 // share common objects 361 // share common objects
360 p.buttons = buttons; 362 p.buttons = buttons;
361 p.actions = actions; 363 p.actions = actions;
362 p.fn = fn; 364 p.fn = fn;
365 p.plugins = plugins;
363 // and init 366 // and init
364 p.init(data); 367 p.init(data);
365 } 368 }
366 // get image info from server if needed 369 // get image info from server if needed
367 if (data.scaleMode === 'pixel' || data.scaleMode === 'size') { 370 if (data.scaleMode === 'pixel' || data.scaleMode === 'size') {
1775 console.error = logFunction('_error'); 1778 console.error = logFunction('_error');
1776 } 1779 }
1777 1780
1778 // functions to export to plugins 1781 // functions to export to plugins
1779 fn = { 1782 fn = {
1783 geom : geom,
1780 parseQueryString : parseQueryString, 1784 parseQueryString : parseQueryString,
1781 getScalerUrl : getScalerUrl, 1785 getScalerUrl : getScalerUrl,
1782 getParamString : getParamString, 1786 getParamString : getParamString,
1783 getDigilibUrl : getDigilibUrl, 1787 getDigilibUrl : getDigilibUrl,
1784 unpackParams : unpackParams, 1788 unpackParams : unpackParams,