Skip to content

Commit 577a235

Browse files
author
meow
committed
convert arrow functions
1 parent 38ef0b1 commit 577a235

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

assets/js/handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
}
145145

146146
// Handle keypresses
147-
window.addEventListener('keydown', (event) => {
147+
window.addEventListener('keydown', function (event) {
148148
// Ignore modifier keys
149149
if (event.ctrlKey || event.metaKey) return;
150150

assets/js/player.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ var shareOptions = {
117117
}
118118
};
119119

120-
const storage = (() => {
120+
const storage = (function () {
121121
try { if (localStorage.length !== -1) return localStorage; }
122122
catch (e) { console.info('No storage available: ' + e); }
123123

@@ -155,11 +155,11 @@ if (isMobile()) {
155155
children: [],
156156
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
157157
});
158-
buttons.slice(1).forEach(child => operations_bar.addChild(child));
158+
buttons.slice(1).forEach(function (child) {operations_bar.addChild(child);});
159159

160160
// Remove operation buttons from primary control bar
161161
primary_control_bar = player.getChild("controlBar");
162-
buttons.forEach(child => primary_control_bar.removeChild(child));
162+
buttons.forEach(function (child) {primary_control_bar.removeChild(child);});
163163

164164
operations_bar_element = operations_bar.el();
165165
operations_bar_element.className += " mobile-operations-bar";
@@ -170,7 +170,7 @@ if (isMobile()) {
170170
operations_bar_element.append(playback_element);
171171

172172
// The share and http source selector element can't be fetched till the players ready.
173-
player.one("playing", () => {
173+
player.one("playing", function () {
174174
share_element = document.getElementsByClassName("vjs-share-control")[0];
175175
operations_bar_element.append(share_element);
176176

@@ -223,7 +223,7 @@ player.playbackRate(video_data.params.speed);
223223
* @returns cookieValue
224224
*/
225225
function getCookieValue(name) {
226-
var value = document.cookie.split(";").filter(item => item.includes(name + "="));
226+
var value = document.cookie.split(";").filter(function (item) {return item.includes(name + "=");});
227227

228228
return (value.length >= 1)
229229
? value[0].substring((name + "=").length, value[0].length)
@@ -297,7 +297,7 @@ if (video_data.params.save_player_pos) {
297297

298298
if(!hasTimeParam) set_seconds_after_start(remeberedTime);
299299

300-
const updateTime = () => {
300+
const updateTime = function () {
301301
const raw = player.currentTime();
302302
const time = Math.floor(raw);
303303

@@ -317,13 +317,13 @@ if (video_data.params.autoplay) {
317317

318318
player.ready(function () {
319319
new Promise(function (resolve, reject) {
320-
setTimeout(() => resolve(1), 1);
320+
setTimeout(function () {resolve(1);}, 1);
321321
}).then(function (result) {
322322
var promise = player.play();
323323

324324
if (promise !== undefined) {
325-
promise.then(_ => {
326-
}).catch(error => {
325+
promise.then(function () {
326+
}).catch(function (error) {
327327
bpb.show();
328328
});
329329
}
@@ -335,9 +335,9 @@ if (!video_data.params.listen && video_data.params.quality === 'dash') {
335335
player.httpSourceSelector();
336336

337337
if (video_data.params.quality_dash !== "auto") {
338-
player.ready(() => {
339-
player.on("loadedmetadata", () => {
340-
const qualityLevels = Array.from(player.qualityLevels()).sort((a, b) => a.height - b.height);
338+
player.ready(function () {
339+
player.on("loadedmetadata", function () {
340+
const qualityLevels = Array.from(player.qualityLevels()).sort(function (a, b) {return a.height - b.height;});
341341
let targetQualityLevel;
342342
switch (video_data.params.quality_dash) {
343343
case "best":
@@ -391,9 +391,9 @@ if (!video_data.params.listen && video_data.params.annotations) {
391391
}
392392
}
393393
}
394-
}
394+
};
395395

396-
window.addEventListener('__ar_annotation_click', e => {
396+
window.addEventListener('__ar_annotation_click', function (e) {
397397
const { url, target, seconds } = e.detail;
398398
var path = new URL(url);
399399

@@ -584,7 +584,7 @@ function increase_playback_rate(steps) {
584584
player.playbackRate(options.playbackRates[newIndex]);
585585
}
586586

587-
window.addEventListener('keydown', e => {
587+
window.addEventListener('keydown', function (e) {
588588
if (e.target.tagName.toLowerCase() === 'input') {
589589
// Ignore input when focus is on certain elements, e.g. form fields.
590590
return;
@@ -744,7 +744,7 @@ if (player.share) {
744744

745745
// show the preferred caption by default
746746
if (player_data.preferred_caption_found) {
747-
player.ready(() => {
747+
player.ready(function () {
748748
player.textTracks()[1].mode = 'showing';
749749
});
750750
}

0 commit comments

Comments
 (0)