mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-27 07:48:29 +00:00
Lint js and css files
This commit is contained in:
parent
3b31d4881a
commit
b5053aa8eb
@ -83,8 +83,8 @@ body a.channel-owner {
|
||||
|
||||
.creator-heart-container {
|
||||
display: inline-block;
|
||||
padding: 0px 7px 6px 0px;
|
||||
margin: 0px -7px -4px 0px;
|
||||
padding: 0 7px 6px 0;
|
||||
margin: 0 -7px -4px 0;
|
||||
}
|
||||
|
||||
.creator-heart {
|
||||
@ -98,7 +98,7 @@ body a.channel-owner {
|
||||
.creator-heart-background-hearted {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
padding: 0px;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@ -142,6 +142,12 @@ div {
|
||||
animation: spin 2s linear infinite;
|
||||
}
|
||||
|
||||
@media screen and (prefers-reduced-motion: reduce) {
|
||||
.loading {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
.playlist-restricted {
|
||||
height: 20em;
|
||||
padding-right: 10px;
|
||||
|
@ -207,9 +207,9 @@ ul.vjs-menu-content::-webkit-scrollbar {
|
||||
}
|
||||
|
||||
.video-js .vjs-time-divider {
|
||||
min-width: 0px;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
min-width: 0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.video-js .vjs-poster {
|
||||
|
@ -202,7 +202,7 @@ window.helpers = window.helpers || {
|
||||
if (localStorageIsUsable) {
|
||||
return {
|
||||
get: function (key) {
|
||||
let storageItem = localStorage.getItem(key)
|
||||
let storageItem = localStorage.getItem(key);
|
||||
if (!storageItem) return;
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(storageItem));
|
||||
@ -212,7 +212,7 @@ window.helpers = window.helpers || {
|
||||
}
|
||||
},
|
||||
set: function (key, value) {
|
||||
let encoded_value = encodeURIComponent(JSON.stringify(value))
|
||||
let encoded_value = encodeURIComponent(JSON.stringify(value));
|
||||
localStorage.setItem(key, encoded_value);
|
||||
},
|
||||
remove: function (key) { localStorage.removeItem(key); }
|
||||
|
@ -4,7 +4,7 @@ var spinnerHTML = '<h3 style="text-align:center"><div class="loading"><i class="
|
||||
var spinnerHTMLwithHR = spinnerHTML + '<hr>';
|
||||
|
||||
String.prototype.supplant = function (o) {
|
||||
return this.replace(/{([^{}]*)}/g, function (a, b) {
|
||||
return this.replace(/\{([^{}]*)\}/g, function (a, b) {
|
||||
var r = o[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
});
|
||||
@ -58,14 +58,14 @@ function get_youtube_comments() {
|
||||
var fallback = comments.innerHTML;
|
||||
comments.innerHTML = spinnerHTML;
|
||||
|
||||
var baseUrl = video_data.base_url || '/api/v1/comments/'+ video_data.id
|
||||
var baseUrl = video_data.base_url || '/api/v1/comments/'+ video_data.id;
|
||||
var url = baseUrl +
|
||||
'?format=html' +
|
||||
'&hl=' + video_data.preferences.locale +
|
||||
'&thin_mode=' + video_data.preferences.thin_mode;
|
||||
|
||||
if (video_data.ucid) {
|
||||
url += '&ucid=' + video_data.ucid
|
||||
url += '&ucid=' + video_data.ucid;
|
||||
}
|
||||
|
||||
var onNon200 = function (xhr) { comments.innerHTML = fallback; };
|
||||
@ -81,17 +81,17 @@ function get_youtube_comments() {
|
||||
{commentsText} \
|
||||
</h3> \
|
||||
<b> \
|
||||
'
|
||||
';
|
||||
if (video_data.support_reddit) {
|
||||
commentInnerHtml += ' <a href="javascript:void(0)" data-comments="reddit"> \
|
||||
{redditComments} \
|
||||
</a> \
|
||||
'
|
||||
';
|
||||
}
|
||||
commentInnerHtml += ' </b> \
|
||||
</div> \
|
||||
<div>{contentHtml}</div> \
|
||||
<hr>'
|
||||
<hr>';
|
||||
commentInnerHtml = commentInnerHtml.supplant({
|
||||
contentHtml: response.contentHtml,
|
||||
redditComments: video_data.reddit_comments_text,
|
||||
@ -125,7 +125,7 @@ function get_youtube_replies(target, load_more, load_replies) {
|
||||
var body = target.parentNode.parentNode;
|
||||
var fallback = body.innerHTML;
|
||||
body.innerHTML = spinnerHTML;
|
||||
var baseUrl = video_data.base_url || '/api/v1/comments/'+ video_data.id
|
||||
var baseUrl = video_data.base_url || '/api/v1/comments/'+ video_data.id;
|
||||
var url = baseUrl +
|
||||
'?format=html' +
|
||||
'&hl=' + video_data.preferences.locale +
|
||||
@ -133,7 +133,7 @@ function get_youtube_replies(target, load_more, load_replies) {
|
||||
'&continuation=' + continuation;
|
||||
|
||||
if (video_data.ucid) {
|
||||
url += '&ucid=' + video_data.ucid
|
||||
url += '&ucid=' + video_data.ucid;
|
||||
}
|
||||
if (load_replies) url += '&action=action_get_comment_replies';
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
el.onclick = function () { remove_subscription(el); };
|
||||
});
|
||||
document.querySelectorAll('[data-onclick="notification_requestPermission"]').forEach(function (el) {
|
||||
// eslint-disable-next-line compat/compat
|
||||
el.onclick = function () { Notification.requestPermission(); };
|
||||
});
|
||||
|
||||
@ -132,7 +133,7 @@
|
||||
|
||||
// Ignore shortcuts if any text input is focused
|
||||
let focused_tag = document.activeElement.tagName.toLowerCase();
|
||||
const allowed = /^(button|checkbox|file|radio|submit)$/;
|
||||
const allowed = /^(?:button|checkbox|file|radio|submit)$/;
|
||||
|
||||
if (focused_tag === 'textarea') return;
|
||||
if (focused_tag === 'input') {
|
||||
|
@ -188,8 +188,12 @@ if (location.pathname.startsWith('/embed/')) {
|
||||
// Detection code taken from https://stackoverflow.com/a/20293441
|
||||
|
||||
function isMobile() {
|
||||
try{ document.createEvent('TouchEvent'); return true; }
|
||||
catch(e){ return false; }
|
||||
try {
|
||||
document.createEvent('TouchEvent');
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMobile()) {
|
||||
@ -307,7 +311,7 @@ function updateCookie(newVolume, newSpeed) {
|
||||
var date = new Date();
|
||||
date.setFullYear(date.getFullYear() + 2);
|
||||
|
||||
var ipRegex = /^((\d+\.){3}\d+|[\dA-Fa-f]*:[\d:A-Fa-f]*:[\d:A-Fa-f]+)$/;
|
||||
var ipRegex = /^(?:(?:\d+\.){3}\d+|[\dA-F]*:[\dA-F]*:[\d:A-F]+)$/i;
|
||||
var domainUsed = location.hostname;
|
||||
|
||||
// Fix for a bug in FF where the leading dot in the FQDN is not ignored
|
||||
@ -362,8 +366,9 @@ if (video_data.params.save_player_pos) {
|
||||
lastUpdated = time;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
remove_all_video_times();
|
||||
}
|
||||
else remove_all_video_times();
|
||||
|
||||
if (video_data.params.autoplay) {
|
||||
var bpb = player.getChild('bigPlayButton');
|
||||
@ -593,20 +598,20 @@ addEventListener('keydown', function (e) {
|
||||
return;
|
||||
}
|
||||
// See https://github.com/ctd1500/videojs-hotkeys/blob/bb4a158b2e214ccab87c2e7b95f42bc45c6bfd87/videojs.hotkeys.js#L310-L313
|
||||
const isPlayerFocused = false
|
||||
|| e.target === document.querySelector('.video-js')
|
||||
|| e.target === document.querySelector('.vjs-tech')
|
||||
|| e.target === document.querySelector('.iframeblocker')
|
||||
|| e.target === document.querySelector('.vjs-control-bar')
|
||||
const isPlayerFocused = false ||
|
||||
e.target === document.querySelector('.video-js') ||
|
||||
e.target === document.querySelector('.vjs-tech') ||
|
||||
e.target === document.querySelector('.iframeblocker') ||
|
||||
e.target === document.querySelector('.vjs-control-bar')
|
||||
;
|
||||
let action = null;
|
||||
|
||||
const code = e.keyCode;
|
||||
const decoratedKey =
|
||||
e.key
|
||||
+ (e.altKey ? '+alt' : '')
|
||||
+ (e.ctrlKey ? '+ctrl' : '')
|
||||
+ (e.metaKey ? '+meta' : '')
|
||||
e.key +
|
||||
(e.altKey ? '+alt' : '') +
|
||||
(e.ctrlKey ? '+ctrl' : '') +
|
||||
(e.metaKey ? '+meta' : '')
|
||||
;
|
||||
switch (decoratedKey) {
|
||||
case ' ':
|
||||
|
@ -152,7 +152,7 @@ function get_reddit_comments() {
|
||||
comments.children[0].children[0].children[0].onclick = toggle_comments;
|
||||
comments.children[0].children[1].children[0].onclick = swap_comments;
|
||||
},
|
||||
onNon200: onNon200, // declared above
|
||||
onNon200: onNon200 // declared above
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user