static/kelmu.js
function() {

        var events;
        var button;

        if (window.kelmu.data[id].settings.step && !stepButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.step);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            stepButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalStep = events.click[0].handler;
              events.click[0].handler = forwardAndSkip;
            } else {
              button.click(forwardAndSkip);
            }
          }
        }

        if (window.kelmu.data[id].settings.redo && !redoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.redo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            redoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalRedo = events.click[0].handler;
              events.click[0].handler = redo;
            } else {
              button.click(redo);
            }
          }
        }

        if (window.kelmu.data[id].settings.undo && !undoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.undo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            undoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalUndo = events.click[0].handler;
              events.click[0].handler = undo;
            } else {
              button.click(undo);
            }
          }
        }

        if (window.kelmu.data[id].settings.begin && !beginButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.begin);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            beginButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalBegin = events.click[0].handler;
              events.click[0].handler = begin;
            } else {
              button.click(begin);
            }
          }
        }

      }
function() {

        var events;
        var button;

        if (window.kelmu.data[id].settings.step && !stepButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.step);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            stepButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalStep = events.click[0].handler;
              events.click[0].handler = forwardAndSkip;
            } else {
              button.click(forwardAndSkip);
            }
          }
        }

        if (window.kelmu.data[id].settings.redo && !redoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.redo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            redoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalRedo = events.click[0].handler;
              events.click[0].handler = redo;
            } else {
              button.click(redo);
            }
          }
        }

        if (window.kelmu.data[id].settings.undo && !undoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.undo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            undoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalUndo = events.click[0].handler;
              events.click[0].handler = undo;
            } else {
              button.click(undo);
            }
          }
        }

        if (window.kelmu.data[id].settings.begin && !beginButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.begin);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            beginButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalBegin = events.click[0].handler;
              events.click[0].handler = begin;
            } else {
              button.click(begin);
            }
          }
        }

      }
function ( ) { var events ; var button ; if ( window . kelmu . data [ id ] . settings . step && ! stepButtonInitialized ) { button = element . find ( window . kelmu . data [ id ] . settings . step ) ; if ( button . length > 0 ) { events = $ . _data ( button [ 0 ] , 'events' ) ; stepButtonInitialized = true ; if ( events && events . click && events . click . length > 0 ) { originalStep = events . click [ 0 ] . handler ; events . click [ 0 ] . handler = forwardAndSkip ; } else { button . click ( forwardAndSkip ) ; } } } if ( window . kelmu . data [ id ] . settings . redo && ! redoButtonInitialized ) { button = element . find ( window . kelmu . data [ id ] . settings . redo ) ; if ( button . length > 0 ) { events = $ . _data ( button [ 0 ] , 'events' ) ; redoButtonInitialized = true ; if ( events && events . click && events . click . length > 0 ) { originalRedo = events . click [ 0 ] . handler ; events . click [ 0 ] . handler = redo ; } else { button . click ( redo ) ; } } } if ( window . kelmu . data [ id ] . settings . undo && ! undoButtonInitialized ) { button = element . find ( window . kelmu . data [ id ] . settings . undo ) ; if ( button . length > 0 ) { events = $ . _data ( button [ 0 ] , 'events' ) ; undoButtonInitialized = true ; if ( events && events . click && events . click . length > 0 ) { originalUndo = events . click [ 0 ] . handler ; events . click [ 0 ] . handler = undo ; } else { button . click ( undo ) ; } } } if ( window . kelmu . data [ id ] . settings . begin && ! beginButtonInitialized ) { button = element . find ( window . kelmu . data [ id ] . settings . begin ) ; if ( button . length > 0 ) { events = $ . _data ( button [ 0 ] , 'events' ) ; beginButtonInitialized = true ; if ( events && events . click && events . click . length > 0 ) { originalBegin = events . click [ 0 ] . handler ; events . click [ 0 ] . handler = begin ; } else { button . click ( begin ) ; } } } }
Initializes the buttons and sets proxies to take over the original click handlers.
Initializes the buttons and sets proxies to take over the original click handlers .