Skip to content

Commit 7940e91

Browse files
author
meow
committed
single quotes
1 parent 577a235 commit 7940e91

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

assets/js/handlers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@
152152
let focused_tag = document.activeElement.tagName.toLowerCase();
153153
const allowed = /^(button|checkbox|file|radio|submit)$/;
154154

155-
if (focused_tag === "textarea") return;
156-
if (focused_tag === "input") {
155+
if (focused_tag === 'textarea') return;
156+
if (focused_tag === 'input') {
157157
let focused_type = document.activeElement.type.toLowerCase();
158158
if (!focused_type.match(allowed)) return;
159159
}
160160

161161
// Focus search bar on '/'
162-
if (event.key === "/") {
162+
if (event.key === '/') {
163163
document.getElementById('searchbox').focus();
164164
event.preventDefault();
165165
}

assets/js/player.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ embed_url.searchParams.delete('v');
3939
var short_url = location.origin + '/' + video_data.id + embed_url.search;
4040
embed_url = location.origin + '/embed/' + video_data.id + embed_url.search;
4141

42-
var save_player_pos_key = "save_player_pos";
42+
var save_player_pos_key = 'save_player_pos';
4343

4444
videojs.Vhs.xhr.beforeRequest = function(options) {
4545
if (options.uri.indexOf('videoplayback') === -1 && options.uri.indexOf('local=true') === -1) {
@@ -112,8 +112,8 @@ var shareOptions = {
112112
description: player_data.description,
113113
image: player_data.thumbnail,
114114
get embedCode() {
115-
return "<iframe id='ivplayer' width='640' height='360' src='" +
116-
addCurrentTimeToURL(embed_url) + "' style='border:none;'></iframe>";
115+
return '<iframe id="ivplayer" width="640" height="360" src="' +
116+
addCurrentTimeToURL(embed_url) + '" style="border:none;"></iframe>';
117117
}
118118
};
119119

@@ -138,57 +138,57 @@ if (location.pathname.startsWith('/embed/')) {
138138
// Detection code taken from https://stackoverflow.com/a/20293441
139139

140140
function isMobile() {
141-
try{ document.createEvent("TouchEvent"); return true; }
141+
try{ document.createEvent('TouchEvent'); return true; }
142142
catch(e){ return false; }
143143
}
144144

145145
if (isMobile()) {
146146
player.mobileUi();
147147

148-
buttons = ["playToggle", "volumePanel", "captionsButton"];
148+
buttons = ['playToggle', 'volumePanel', 'captionsButton'];
149149

150-
if (video_data.params.quality !== 'dash') buttons.push("qualitySelector");
150+
if (video_data.params.quality !== 'dash') buttons.push('qualitySelector');
151151

152152
// Create new control bar object for operation buttons
153-
const ControlBar = videojs.getComponent("controlBar");
153+
const ControlBar = videojs.getComponent('controlBar');
154154
let operations_bar = new ControlBar(player, {
155155
children: [],
156156
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
157157
});
158158
buttons.slice(1).forEach(function (child) {operations_bar.addChild(child);});
159159

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

164164
operations_bar_element = operations_bar.el();
165-
operations_bar_element.className += " mobile-operations-bar";
165+
operations_bar_element.className += ' mobile-operations-bar';
166166
player.addChild(operations_bar);
167167

168168
// Playback menu doesn't work when it's initialized outside of the primary control bar
169-
playback_element = document.getElementsByClassName("vjs-playback-rate")[0];
169+
playback_element = document.getElementsByClassName('vjs-playback-rate')[0];
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", function () {
174-
share_element = document.getElementsByClassName("vjs-share-control")[0];
173+
player.one('playing', function () {
174+
share_element = document.getElementsByClassName('vjs-share-control')[0];
175175
operations_bar_element.append(share_element);
176176

177177
if (video_data.params.quality === 'dash') {
178-
http_source_selector = document.getElementsByClassName("vjs-http-source-selector vjs-menu-button")[0];
178+
http_source_selector = document.getElementsByClassName('vjs-http-source-selector vjs-menu-button')[0];
179179
operations_bar_element.append(http_source_selector);
180180
}
181181
});
182182
}
183183

184184
// Enable VR video support
185185
if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
186-
player.crossOrigin("anonymous");
186+
player.crossOrigin('anonymous');
187187
switch (video_data.projection_type) {
188-
case "EQUIRECTANGULAR":
189-
player.vr({projection: "equirectangular"});
190-
default: // Should only be "MESH" but we'll use this as a fallback.
191-
player.vr({projection: "EAC"});
188+
case 'EQUIRECTANGULAR':
189+
player.vr({projection: 'equirectangular'});
190+
default: // Should only be 'MESH' but we'll use this as a fallback.
191+
player.vr({projection: 'EAC'});
192192
}
193193
}
194194

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

228228
return (value.length >= 1)
229-
? value[0].substring((name + "=").length, value[0].length)
229+
? value[0].substring((name + '=').length, value[0].length)
230230
: null;
231231
}
232232

233233
/**
234-
* Method for updating the "PREFS" cookie (or creating it if missing)
234+
* Method for updating the 'PREFS' cookie (or creating it if missing)
235235
*
236236
* @param {number} newVolume New volume defined (null if unchanged)
237237
* @param {number} newSpeed New speed defined (null if unchanged)
@@ -291,7 +291,7 @@ if (video_data.premiere_timestamp && Math.round(new Date() / 1000) < video_data.
291291

292292
if (video_data.params.save_player_pos) {
293293
const url = new URL(location);
294-
const hasTimeParam = url.searchParams.has("t");
294+
const hasTimeParam = url.searchParams.has('t');
295295
const remeberedTime = get_video_time();
296296
let lastUpdated = 0;
297297

@@ -307,7 +307,7 @@ if (video_data.params.save_player_pos) {
307307
}
308308
};
309309

310-
player.on("timeupdate", updateTime);
310+
player.on('timeupdate', updateTime);
311311
}
312312
else remove_all_video_times();
313313

@@ -334,16 +334,16 @@ if (video_data.params.autoplay) {
334334
if (!video_data.params.listen && video_data.params.quality === 'dash') {
335335
player.httpSourceSelector();
336336

337-
if (video_data.params.quality_dash !== "auto") {
337+
if (video_data.params.quality_dash !== 'auto') {
338338
player.ready(function () {
339-
player.on("loadedmetadata", function () {
339+
player.on('loadedmetadata', function () {
340340
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) {
343-
case "best":
343+
case 'best':
344344
targetQualityLevel = qualityLevels.length - 1;
345345
break;
346-
case "worst":
346+
case 'worst':
347347
targetQualityLevel = 0;
348348
break;
349349
default:
@@ -734,7 +734,7 @@ window.addEventListener('keydown', function (e) {
734734
};
735735

736736
player.on('mousewheel', mouseScroll);
737-
player.on("DOMMouseScroll", mouseScroll);
737+
player.on('DOMMouseScroll', mouseScroll);
738738
}());
739739

740740
// Since videojs-share can sometimes be blocked, we defer it until last
@@ -750,7 +750,7 @@ if (player_data.preferred_caption_found) {
750750
}
751751

752752
// Safari audio double duration fix
753-
if (navigator.vendor === "Apple Computer, Inc." && video_data.params.listen) {
753+
if (navigator.vendor === 'Apple Computer, Inc.' && video_data.params.listen) {
754754
player.on('loadedmetadata', function () {
755755
player.on('timeupdate', function () {
756756
if (player.remainingTime() < player.duration() / 2 && player.remainingTime() >= 2) {
@@ -761,17 +761,17 @@ if (navigator.vendor === "Apple Computer, Inc." && video_data.params.listen) {
761761
}
762762

763763
// Watch on Invidious link
764-
if (window.location.pathname.startsWith("/embed/")) {
764+
if (window.location.pathname.startsWith('/embed/')) {
765765
const Button = videojs.getComponent('Button');
766766
let watch_on_invidious_button = new Button(player);
767767

768768
// Create hyperlink for current instance
769-
redirect_element = document.createElement("a");
770-
redirect_element.setAttribute("href", `//${window.location.host}/watch?v=${window.location.pathname.replace("/embed/","")}`);
771-
redirect_element.appendChild(document.createTextNode("Invidious"));
769+
redirect_element = document.createElement('a');
770+
redirect_element.setAttribute('href', `//${window.location.host}/watch?v=${window.location.pathname.replace('/embed/','')}`);
771+
redirect_element.appendChild(document.createTextNode('Invidious'));
772772

773773
watch_on_invidious_button.el().appendChild(redirect_element);
774-
watch_on_invidious_button.addClass("watch-on-invidious");
774+
watch_on_invidious_button.addClass('watch-on-invidious');
775775

776776
cb = player.getChild('ControlBar');
777777
cb.addChild(watch_on_invidious_button);

assets/js/themes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var toggle_theme = document.getElementById('toggle_theme');
33
toggle_theme.href = 'javascript:void(0);';
44

55
toggle_theme.addEventListener('click', function () {
6-
var dark_mode = document.body.classList.contains("light-theme");
6+
var dark_mode = document.body.classList.contains('light-theme');
77

88
var url = '/toggle_theme?redirect=false';
99
var xhr = new XMLHttpRequest();
@@ -49,9 +49,9 @@ function scheme_switch (e) {
4949
}
5050
} catch {}
5151
if (e.matches) {
52-
if (e.media.includes("dark")) {
52+
if (e.media.includes('dark')) {
5353
set_mode(true);
54-
} else if (e.media.includes("light")) {
54+
} else if (e.media.includes('light')) {
5555
set_mode(false);
5656
}
5757
}

0 commit comments

Comments
 (0)