# HG changeset patch # User hertzhaft # Date 1332502411 -3600 # Node ID 6329b7f8d7f8039cd173b218a911b6d181c90014 # Parent 2d04f160ce09f29afbc29dc1b276a29623f8d10b method for reassigning a button diff -r 2d04f160ce09 -r 6329b7f8d7f8 webapp/src/main/webapp/jquery/jquery.digilib.buttons.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js Fri Mar 23 12:17:15 2012 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.buttons.js Fri Mar 23 12:33:31 2012 +0100 @@ -263,6 +263,7 @@ // export functions fn.createButton = createButton; fn.highlightButtons = highlightButtons; + fn.setButtonAction = setButtonAction; }; // plugin initialization @@ -561,6 +562,17 @@ highlight('zoomin', ! isFullArea(data.zoomArea)); }; + // set standard button "onclick" field to a new action + var setButtonAction = function(buttonName, action) { + var button = buttons[buttonName]; + if (button == null) { + console.log('could not set button action ' + action + + ', button ' + buttonName + ' not available' ); + return; + } + button.onclick = action; + }; + // plugin object with name and init // shared objects filled by digilib on registration var plugin = { diff -r 2d04f160ce09 -r 6329b7f8d7f8 webapp/src/main/webapp/jquery/jquery.digilib.sliders.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js Fri Mar 23 12:17:15 2012 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.sliders.js Fri Mar 23 12:33:31 2012 +0100 @@ -271,25 +271,16 @@ }); }; - - // set standard button "onclick" field to slider action - var setButtonAction = function(buttons, buttonName, action) { - var button = buttons[buttonName]; - if (button == null) { - // normally this means that jquery.digilib.buttons.js was not loaded - console.log('could not attach slider action ' + action - + ', button ' + buttonName + ' not available' ); + // assign button actions to sliders (rotate, brightness, contrast) + var setButtonActions = function () { + if (fn.setButtonAction == null) { + console.debug('sliders: could not assign button actions. Maybe jquery.digilib.buttons.js was not loaded?'); return; } - button.onclick = action; - }; - - // set standard button actions (rotate, brightness, contrast) to slider - var setButtonActions = function (buttons) { - console.debug('sliders: setting button acions. digilib:', digilib); - setButtonAction(buttons, 'brgt', 'tinySliderBrgt'); - setButtonAction(buttons, 'cont', 'tinySliderCont'); - setButtonAction(buttons, 'rot', 'tinySliderRot'); + console.debug('sliders: assign new button actions. digilib:', digilib); + fn.setButtonAction('brgt', 'tinySliderBrgt'); + fn.setButtonAction('cont', 'tinySliderCont'); + fn.setButtonAction('rot', 'tinySliderRot'); }; // plugin installation called by digilib on plugin object.