comparison client/digitallibrary/jquery/jquery.digilib.js @ 611:1b6202aba26e jquery

work on button creation (reinstated jquery-test)
author robcast
date Fri, 14 Jan 2011 15:21:15 +0100
parents cd9f657d49fa
children fb94f1b74d59
comparison
equal deleted inserted replaced
610:cd9f657d49fa 611:1b6202aba26e
150 // path to button images 150 // path to button images
151 'buttonsImagePath' : 'img/buttons/', 151 'buttonsImagePath' : 'img/buttons/',
152 // button groups 152 // button groups
153 'buttonsStandard' : ["reference","zoomin","zoomout","zoomarea","zoomfull","pagewidth","back","fwd","page","bird","SEP","help","reset","options"], 153 'buttonsStandard' : ["reference","zoomin","zoomout","zoomarea","zoomfull","pagewidth","back","fwd","page","bird","SEP","help","reset","options"],
154 'buttonsSpecial' : ["mark","delmark","hmir","vmir","rot","brgt","cont","rgb","quality","size","calibrationx","scale","SEP","options"], 154 'buttonsSpecial' : ["mark","delmark","hmir","vmir","rot","brgt","cont","rgb","quality","size","calibrationx","scale","SEP","options"],
155 'buttonsCustom' : [], 155 'buttonsCustom' : []
156 }; 156 };
157 157
158 // parameters from the query string 158 // parameters from the query string
159 var queryParams = {}; 159 var queryParams = {};
160 160
188 settings : elemSettings 188 settings : elemSettings
189 }); 189 });
190 } 190 }
191 // create HTML structure 191 // create HTML structure
192 setupScalerDiv($elem, elemSettings); 192 setupScalerDiv($elem, elemSettings);
193 setupButtons($elem, elemSettings, 'buttonsStandard');
193 }); 194 });
194 }, 195 },
195 196
196 // clean up digilib 197 // clean up digilib
197 destroy : function() { 198 destroy : function() {
297 $buttonDiv = $elem.append('<div class="buttons"/>'); 298 $buttonDiv = $elem.append('<div class="buttons"/>');
298 var buttonNames = settings[buttonGroup]; 299 var buttonNames = settings[buttonGroup];
299 for (var i = 0; i < buttonNames.length; i++) { 300 for (var i = 0; i < buttonNames.length; i++) {
300 var buttonName = buttonNames[i]; 301 var buttonName = buttonNames[i];
301 var buttonConfig = settings.buttons[buttonName]; 302 var buttonConfig = settings.buttons[buttonName];
302 var $button = buttondiv.append('<div class="button"/>'); 303 var $button = $buttonDiv.append('<div class="button"/>');
303 $button 304 $button.addClass('digilib-button-' + buttonName);
304 .attr('id', 'digilib-button-' + buttonName) 305 var $link = $button.append('<a/>');
305 .bind('click', function(){ buttonConfig.onclick }) 306 $link.bind('click', buttonConfig.onclick)
306 .append('<a/>') 307 .attr('title', buttonConfig.toolTip );
307 .attr('title', buttonConfig.toolTip ) 308 var $img = $link.append('<img class="button"/>');
308 .append('<img class="button"/>') 309 $img.attr('src', settings.buttonsImagePath + buttonConfig.img);
309 .attr('src', settings.buttonsImagePath + buttonConfig.img); 310 };
310 }; 311 }
311 }
312 return $buttonDiv; 312 return $buttonDiv;
313 }
314 }; 313 };
315 314
316 // hook plugin into jquery 315 // hook plugin into jquery
317 $.fn.digilib = function(method) { 316 $.fn.digilib = function(method) {
318 if (methods[method]) { 317 if (methods[method]) {