Lint js and css files

This commit is contained in:
ChunkyProgrammer 2023-12-19 18:27:43 -05:00
parent 3b31d4881a
commit b5053aa8eb
7 changed files with 61 additions and 49 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -147,7 +147,7 @@ window.helpers = window.helpers || {
* @param {callbackXhrError} [callbacks.onError]
* @param {callbackXhrError} [callbacks.onTotalFail] - if failed after all retries
*/
xhr: function(method, url, options, callbacks) {
xhr: function(method, url, options, callbacks) {
if (!options.retries || options.retries <= 1) {
helpers._xhr(method, url, options, callbacks);
return;
@ -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); }

View File

@ -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"> \
';
if (video_data.support_reddit) {
commentInnerHtml += ' <a href="javascript:void(0)" data-comments="reddit"> \
{redditComments} \
</a> \
'
}
commentInnerHtml += ' </b> \
';
}
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';

View File

@ -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') {

View File

@ -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()) {
@ -203,8 +207,8 @@ if (isMobile()) {
// Create new control bar object for operation buttons
const ControlBar = videojs.getComponent('controlBar');
let operations_bar = new ControlBar(player, {
children: [],
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
children: [],
playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]
});
buttons.slice(1).forEach(function (child) {operations_bar.addChild(child);});
@ -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');
@ -427,8 +432,8 @@ if (!video_data.params.listen && video_data.params.annotations) {
addEventListener('load', function (e) {
addEventListener('__ar_annotation_click', function (e) {
const url = e.detail.url,
target = e.detail.target,
seconds = e.detail.seconds;
target = e.detail.target,
seconds = e.detail.seconds;
var path = new URL(url);
if (path.href.startsWith('https://www.youtube.com/watch?') && seconds) {
@ -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 ' ':

View File

@ -142,17 +142,17 @@ function get_reddit_comments() {
</div> \
<div>{contentHtml}</div> \
<hr>'.supplant({
title: response.title,
youtubeCommentsText: video_data.youtube_comments_text,
redditPermalinkText: video_data.reddit_permalink_text,
permalink: response.permalink,
contentHtml: response.contentHtml
});
title: response.title,
youtubeCommentsText: video_data.youtube_comments_text,
redditPermalinkText: video_data.reddit_permalink_text,
permalink: response.permalink,
contentHtml: response.contentHtml
});
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
});
}