Bug 34613: Replace onclick attributes in midiplayer.js

This patch replaces the onclick attributes in midiplayer.js
with Javascript click handlers.

To test:
0. Apply patch
1. Clear browser cache (it may be necessary to go into the
   Network tab and explicitly disable cache)
2. Add 031 subfields 2gopnu to Default framework
3. Create a catalogue record with a 031 like follows:
2: pe
g: G-2
o: 4/4
p: 4bB''C2bE/2F4GbB/'bB2''C4D/F2.bE/4GG2bB/4'''C2C4''bB/4bE2G4bB/4bE2.F/
n: xFCGD
4. Enable the following sysprefs:
   OPACShowMusicalInscripts
   OPACPlayMusicalInscripts
5. Go to OPAC record view and click "Play this sample"
6. Play with the "Pause/Start" and "Stop" buttons
7. If the buttons work, it means the patch worked

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2023-08-25 01:26:01 +00:00 committed by Tomas Cohen Arazi
parent 8eb27c40e6
commit a4bdd27fd9
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -377,13 +377,19 @@ function runConversion() {
};
// Create the player
var play_button = $("<a class=\"icon play\" id=\"midiPlayer_play\"></a>");
play_button.on("click",play);
var pause_button = $("<a class=\"icon pause\" id=\"midiPlayer_pause\"></a>");
pause_button.on("click",pause);
var stop_button = $("<a class=\"icon stop\" id=\"midiPlayer_stop\"></a>");
stop_button.on("click",stop);
this.append("<div id=\"midiPlayer_div\"></div>");
$("#midiPlayer_div").append("<div id=\"midiPlayer_playingTime\">0:00</div>")
.append("<div id=\"midiPlayer_bar\"><div id=\"midiPlayer_progress\"></div></div>")
.append("<div id=\"midiPlayer_totalTime\">0:00</div>")
.append("<a class=\"icon play\" id=\"midiPlayer_play\" onclick=\"play()\"></a>")
.append("<a class=\"icon pause\" id=\"midiPlayer_pause\" onclick=\"pause()\"></a>")
.append("<a class=\"icon stop\" id=\"midiPlayer_stop\" onclick=\"stop()\"></a>");
.append(play_button)
.append(pause_button)
.append(stop_button);
$("#midiPlayer_div").css("width", options.width + 200);
$("#midiPlayer_bar").css("width", options.width);
@ -436,4 +442,4 @@ function runConversion() {
return;
};
}
(jQuery));
(jQuery));