Mercurial > hg > digilib-old
comparison client/digitallibrary/jquery/jquery.digilib.js @ 619:a473998de5f8 jquery
'about' window has its own event handler
author | hertzhaft |
---|---|
date | Mon, 17 Jan 2011 00:34:32 +0100 |
parents | 09167ef1512e |
children | 533b06116a48 5f3564a21a9c |
comparison
equal
deleted
inserted
replaced
618:09167ef1512e | 619:a473998de5f8 |
---|---|
381 $button.attr('title', actionSettings.tooltip); | 381 $button.attr('title', actionSettings.tooltip); |
382 $button.addClass('button-' + actionName); | 382 $button.addClass('button-' + actionName); |
383 // let the clicked <a> element know about the digilib context | 383 // let the clicked <a> element know about the digilib context |
384 $a.data('digilib', { 'action' : actionName, 'settings' : settings } ); | 384 $a.data('digilib', { 'action' : actionName, 'settings' : settings } ); |
385 $a.bind('click', function() { | 385 $a.bind('click', function() { |
386 // get the context settings | 386 var $elem = $(this); |
387 var data = $(this).data('digilib'); | 387 // get the context data |
388 var data = $elem.data('digilib'); | |
388 // find the action for the clicked element | 389 // find the action for the clicked element |
389 var method = data.settings.actions[data.action].onclick; | 390 var method = data.settings.actions[data.action].onclick; |
390 // find the digilib object with methods | 391 if ($.isArray(method)) { |
391 var $root = data.settings.digilibRoot; | 392 $elem.digilib.apply(this, method); |
392 // execute as a method | 393 } else { |
394 $elem.digilib(method); | |
395 }; | |
393 console.log(method); | 396 console.log(method); |
394 if ($.isArray(method)) { | |
395 $a.digilib.apply(this, method); | |
396 } else { | |
397 $a.digilib(method); | |
398 }; | |
399 }); | 397 }); |
400 // binding mit closure | 398 // binding mit closure |
401 //(function(){ var action = buttonSettings.onclick; | 399 //(function(){ var action = actionSettings.onclick; |
402 // $a.bind('click', function(){ console.log( action )} ); | 400 // $a.bind('click', function(){ console.log( action )} ); |
403 //})(); | 401 //})(); |
404 $img.attr('src', settings.buttonsImagePath + actionSettings.img); | 402 $img.attr('src', settings.buttonsImagePath + actionSettings.img); |
405 }; | 403 }; |
406 } | 404 } |
442 $aboutDiv.append($content); | 440 $aboutDiv.append($content); |
443 $link.append($logo); | 441 $link.append($logo); |
444 $logo.attr('src', settings.logoUrl); | 442 $logo.attr('src', settings.logoUrl); |
445 $link.attr('href', settings.reposUrl); | 443 $link.attr('href', settings.reposUrl); |
446 $content.text('Version: ' + settings.version); | 444 $content.text('Version: ' + settings.version); |
445 // let the element know about the digilib context | |
446 $aboutDiv.data('digilib', { 'settings' : settings } ); | |
447 $aboutDiv.bind('click', function() { | |
448 console.log($(this)); | |
449 $(this).digilib('toggleAboutDiv'); | |
450 }); | |
447 }; | 451 }; |
448 | 452 |
449 // returns function for load event of scaler img | 453 // returns function for load event of scaler img |
450 var scalerImgLoadedFn = function(settings) { | 454 var scalerImgLoadedFn = function(settings) { |
451 return function() { | 455 return function() { |