# HG changeset patch # User hertzhaft # Date 1295220872 -3600 # Node ID a473998de5f89f64d2eb9ace66570d9577026710 # Parent 09167ef1512e897963000c8a5bdd7f5a4a2b9069 'about' window has its own event handler diff -r 09167ef1512e -r a473998de5f8 client/digitallibrary/jquery/jquery.digilib.js --- a/client/digitallibrary/jquery/jquery.digilib.js Sun Jan 16 23:34:29 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Mon Jan 17 00:34:32 2011 +0100 @@ -383,22 +383,20 @@ // let the clicked element know about the digilib context $a.data('digilib', { 'action' : actionName, 'settings' : settings } ); $a.bind('click', function() { - // get the context settings - var data = $(this).data('digilib'); + var $elem = $(this); + // get the context data + var data = $elem.data('digilib'); // find the action for the clicked element var method = data.settings.actions[data.action].onclick; - // find the digilib object with methods - var $root = data.settings.digilibRoot; - // execute as a method + if ($.isArray(method)) { + $elem.digilib.apply(this, method); + } else { + $elem.digilib(method); + }; console.log(method); - if ($.isArray(method)) { - $a.digilib.apply(this, method); - } else { - $a.digilib(method); - }; }); // binding mit closure - //(function(){ var action = buttonSettings.onclick; + //(function(){ var action = actionSettings.onclick; // $a.bind('click', function(){ console.log( action )} ); //})(); $img.attr('src', settings.buttonsImagePath + actionSettings.img); @@ -444,6 +442,12 @@ $logo.attr('src', settings.logoUrl); $link.attr('href', settings.reposUrl); $content.text('Version: ' + settings.version); + // let the element know about the digilib context + $aboutDiv.data('digilib', { 'settings' : settings } ); + $aboutDiv.bind('click', function() { + console.log($(this)); + $(this).digilib('toggleAboutDiv'); + }); }; // returns function for load event of scaler img