static/kelmu.editor.js
function() {

      var data = window.kelmu.data[id];
      var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];

      editor.find('.kelmu-editor-pane').remove();

      var soundEditor = $('<div></div>').addClass('kelmu-sound-editor').addClass('kelmu-editor-pane');
      soundEditor.appendTo(editor);

      soundEditor.append($('<h4>Sound</h4>').css('margin', '15px 0px'));

      idCounter += 1;

      // Set the current values
      addComponent('URL:', soundEditor, 'kelmu-sound-url', elemData.sound, 'text', true);

      // Move cursor to end
      soundEditor.find('.kelmu-sound-url').focus();
      var val = soundEditor.find('.kelmu-sound-url').val();
      soundEditor.find('.kelmu-sound-url').val('').val(val);

      var buttonContainer = $('<div></div>').appendTo(soundEditor);

      // Save the modified properties
      var saveButton = function() {
        elemData.sound = soundEditor.find('.kelmu-sound-url').val();
        window.kelmu.data[id].actions.update();
        updateView(true, true);
        notifyModifications();
      };

      soundEditor.find('input').keyup(saveButton);

      createRemoveButton().click(function(e) {
        e.preventDefault();

        var soundControl = container.find('.kelmu-sound-control');
        soundControl.hide();

        // If there are sounds for this animation, show the mute control
        Object.keys(window.kelmu.data[id].definitions || {}).forEach(function(substeps) {
          window.kelmu.data[id].definitions[substeps].forEach(function(substep) {
            substep.forEach(function(step) {
              if (step.sound !== undefined) {
                soundControl.show();
              }
            });
          });
        });

      }).appendTo(buttonContainer);

      // Play the sound
      $('<button></button>').text('Play').addClass('btn').appendTo(buttonContainer).click(function(e) {
        e.preventDefault();
        var sound = $('<audio></audio>').attr('src', soundEditor.find('.kelmu-sound-url').val());
        container.append(sound);
        sound[0].play();
      });

    }
function() {

      var data = window.kelmu.data[id];
      var elemData = data.definitions['step' + data.stepNumber][data.subStepNumber][data.selectedElementNumber];

      editor.find('.kelmu-editor-pane').remove();

      var soundEditor = $('<div></div>').addClass('kelmu-sound-editor').addClass('kelmu-editor-pane');
      soundEditor.appendTo(editor);

      soundEditor.append($('<h4>Sound</h4>').css('margin', '15px 0px'));

      idCounter += 1;

      // Set the current values
      addComponent('URL:', soundEditor, 'kelmu-sound-url', elemData.sound, 'text', true);

      // Move cursor to end
      soundEditor.find('.kelmu-sound-url').focus();
      var val = soundEditor.find('.kelmu-sound-url').val();
      soundEditor.find('.kelmu-sound-url').val('').val(val);

      var buttonContainer = $('<div></div>').appendTo(soundEditor);

      // Save the modified properties
      var saveButton = function() {
        elemData.sound = soundEditor.find('.kelmu-sound-url').val();
        window.kelmu.data[id].actions.update();
        updateView(true, true);
        notifyModifications();
      };

      soundEditor.find('input').keyup(saveButton);

      createRemoveButton().click(function(e) {
        e.preventDefault();

        var soundControl = container.find('.kelmu-sound-control');
        soundControl.hide();

        // If there are sounds for this animation, show the mute control
        Object.keys(window.kelmu.data[id].definitions || {}).forEach(function(substeps) {
          window.kelmu.data[id].definitions[substeps].forEach(function(substep) {
            substep.forEach(function(step) {
              if (step.sound !== undefined) {
                soundControl.show();
              }
            });
          });
        });

      }).appendTo(buttonContainer);

      // Play the sound
      $('<button></button>').text('Play').addClass('btn').appendTo(buttonContainer).click(function(e) {
        e.preventDefault();
        var sound = $('<audio></audio>').attr('src', soundEditor.find('.kelmu-sound-url').val());
        container.append(sound);
        sound[0].play();
      });

    }
function ( ) { var data = window . kelmu . data [ id ] ; var elemData = data . definitions [ 'step' + data . stepNumber ] [ data . subStepNumber ] [ data . selectedElementNumber ] ; editor . find ( '.kelmu-editor-pane' ) . remove ( ) ; var soundEditor = $ ( '<div></div>' ) . addClass ( 'kelmu-sound-editor' ) . addClass ( 'kelmu-editor-pane' ) ; soundEditor . appendTo ( editor ) ; soundEditor . append ( $ ( '<h4>Sound</h4>' ) . css ( 'margin' , '15px 0px' ) ) ; idCounter += 1 ; // Set the current values addComponent ( 'URL:' , soundEditor , 'kelmu-sound-url' , elemData . sound , 'text' , true ) ; // Move cursor to end soundEditor . find ( '.kelmu-sound-url' ) . focus ( ) ; var val = soundEditor . find ( '.kelmu-sound-url' ) . val ( ) ; soundEditor . find ( '.kelmu-sound-url' ) . val ( '' ) . val ( val ) ; var buttonContainer = $ ( '<div></div>' ) . appendTo ( soundEditor ) ; // Save the modified properties var saveButton = function ( ) { elemData . sound = soundEditor . find ( '.kelmu-sound-url' ) . val ( ) ; window . kelmu . data [ id ] . actions . update ( ) ; updateView ( true , true ) ; notifyModifications ( ) ; } ; soundEditor . find ( 'input' ) . keyup ( saveButton ) ; createRemoveButton ( ) . click ( function ( e ) { e . preventDefault ( ) ; var soundControl = container . find ( '.kelmu-sound-control' ) ; soundControl . hide ( ) ; // If there are sounds for this animation, show the mute control Object . keys ( window . kelmu . data [ id ] . definitions || { } ) . forEach ( function ( substeps ) { window . kelmu . data [ id ] . definitions [ substeps ] . forEach ( function ( substep ) { substep . forEach ( function ( step ) { if ( step . sound !== undefined ) { soundControl . show ( ) ; } } ) ; } ) ; } ) ; } ) . appendTo ( buttonContainer ) ; // Play the sound $ ( '<button></button>' ) . text ( 'Play' ) . addClass ( 'btn' ) . appendTo ( buttonContainer ) . click ( function ( e ) { e . preventDefault ( ) ; var sound = $ ( '<audio></audio>' ) . attr ( 'src' , soundEditor . find ( '.kelmu-sound-url' ) . val ( ) ) ; container . append ( sound ) ; sound [ 0 ] . play ( ) ; } ) ; }
Creates the action editor pane for the selected sound.
Creates the action editor pane for the selected sound .