diff --git a/menu/satus.js b/menu/satus.js index e08520741..560ef33b2 100644 --- a/menu/satus.js +++ b/menu/satus.js @@ -244,13 +244,13 @@ satus.isset = function(target, is_object) { --------------------------------------------------------------*/ satus.isFunction =function(target){return typeof target ==='function';}; -satus.isArray =function(t){if(Array.isArray(t)) {return true;}else{return false;}}; -satus.isString =function(t){if(typeof t ==='string') {return true;}else{return false;}}; -satus.isNumber =function(t){if(typeof t ==='number'&&isNaN(t)===false){return true;}else{return false;}}; -satus.isObject =function(t){return t instanceof Object && t !==null;}; -satus.isElement =function(t){return t instanceof Element || t instanceof HTMLDocument;}; -satus.isNodeList =function(t){return t instanceof NodeList;}; -satus.isBoolean =function(t){return t ===false || t ===true;}; +satus.isArray = Array.isArray; +satus.isString = function(t) { return typeof t ==='string'; }; +satus.isNumber = function(t) { return (typeof t ==='number' && !isNaN(t)); }; +satus.isObject = function(t) { return (t instanceof Object && t !== null); }; +satus.isElement = function(t) { return (t instanceof Element || t instanceof HTMLDocument); }; +satus.isNodeList = function(t) { return t instanceof NodeList; }; +satus.isBoolean = function(t) { return (t === false || t === true); }; /*---LOG------------------------------------------------------*/ satus.log =function(){console.log.apply(null, arguments);}; @@ -1388,9 +1388,7 @@ satus.components.textField = function(component, skeleton) { handler = component.syntax.handlers[component.syntax.current], value = component.value || ''; - for (var i = this.childNodes.length - 1; i > -1; i--) { - this.childNodes[i].remove(); - } + satus.empty(this); if (handler) { handler(value, this); @@ -1399,10 +1397,10 @@ satus.components.textField = function(component, skeleton) { } if (value.length === 0) { - var placeholder = component.placeholder; + let placeholder = component.placeholder; if (typeof placeholder === 'function') { - placeholder = component.placeholder(); + placeholder = placeholder(); } else { placeholder = satus.locale.get(placeholder); } @@ -1504,9 +1502,9 @@ satus.components.textField = function(component, skeleton) { }); component.addEventListener('render', function() { - component.lineNumbers.update(); - component.pre.update(); - component.cursor.update(); + this.lineNumbers.update(); + this.pre.update(); + this.cursor.update(); }); if (skeleton.on?.blur) { @@ -1788,17 +1786,14 @@ satus.components.layers = function(component, skeleton) { --------------------------------------------------------------*/ satus.components.list = function(component, skeleton) { - for (var i = 0, l = skeleton.items.length; i < l; i++) { - var li = component.createChildElement('div', 'item'), - item = skeleton.items[i]; - - for (var j = 0, k = item.length; j < k; j++) { - var child = item[j]; + for (const item of skeleton.items) { + const li = component.createChildElement('div', 'item'); + for (const child of item) { if (satus.isObject(child)) { satus.render(child, li); } else { - var span = li.createChildElement('span'); + const span = li.createChildElement('span'); span.textContent = satus.locale.get(child); } @@ -2125,7 +2120,7 @@ satus.components.slider = function(component, skeleton) { --------------------------------------------------------------*/ satus.components.tabs = function(component, skeleton) { - var tabs = skeleton.items, + let tabs = skeleton.items, value = skeleton.value; if (satus.isFunction(tabs)) { @@ -2136,12 +2131,11 @@ satus.components.tabs = function(component, skeleton) { value = value(); } - for (var i = 0, l = tabs.length; i < l; i++) { - var tab = tabs[i], - button = component.createChildElement('button'); + for (const tab of tabs) { + const button = component.createChildElement('button'); button.addEventListener('click', function() { - var component = this.parentNode, + const component = this.parentNode, index = satus.elementIndex(this); component.value = index; @@ -2420,7 +2414,7 @@ satus.components.shortcut = function(component, skeleton) { component.render(component.valueElement); - satus.storage.remove(component.storage.key); + satus.storage.remove(); this.parentNode.parentNode.parentNode.close(); @@ -3218,9 +3212,7 @@ satus.user.device.connection = function() { --------------------------------------------------------------*/ satus.search = function(query, object, callback) { - var elements = ['switch', 'select', 'slider', 'shortcut', 'radio', 'color-picker', 'label', 'button'], - threads = 0, - results = {}, + const included = ['switch', 'select', 'slider', 'shortcut', 'radio', 'color-picker', 'label', 'button'], excluded = [ 'baseProvider', 'layersProvider', @@ -3231,19 +3223,19 @@ satus.search = function(query, object, callback) { 'parentElement', 'rendered' ]; + let threads = 0, + results = {}; query = query.toLowerCase(); function parse(items, parent) { threads++; - for (const key in items) { + for (const [key, item] of Object.entries(items)) { if (!excluded.includes(key)) { - var item = items[key]; - if (item.component && item.text // list of elements we allow search on - && elements.includes(item.component) + && included.includes(item.component) // only pass buttons whose parents are variant: 'card' or special case 'appearance' (this one abuses variant tag for CSS) && (item.component != 'button' || item.parentObject?.variant == "card" || item.parentObject?.variant == "appearance") // try to match query against localized description, fallback on component name @@ -3252,12 +3244,10 @@ satus.search = function(query, object, callback) { results[key] = Object.assign({}, item); } - if ( - satus.isObject(item) && - !satus.isArray(item) && - !satus.isElement(item) && - !satus.isFunction(item) - ) { + if (satus.isObject(item) + && !satus.isArray(item) + && !satus.isElement(item) + && !satus.isFunction(item)) { parse(item, items); } } diff --git a/menu/skeleton-parts/appearance.js b/menu/skeleton-parts/appearance.js index d26b237d8..15112a4a8 100644 --- a/menu/skeleton-parts/appearance.js +++ b/menu/skeleton-parts/appearance.js @@ -800,8 +800,8 @@ extension.skeleton.main.layers.section.appearance.on.click.sidebar = { text: "collapsed", value: "collapsed" }, { - text: 'Hide_the_tabs_only', - value: "hidetabs" + text: 'Hide_the_tabs_only', + value: "hidetabs" }], tags: "right", on: { diff --git a/menu/skeleton-parts/player.js b/menu/skeleton-parts/player.js index 2a1ec6486..11a7c7c22 100644 --- a/menu/skeleton-parts/player.js +++ b/menu/skeleton-parts/player.js @@ -619,31 +619,9 @@ extension.skeleton.main.layers.section.player.on.click = { subtitles_window_color: { component: 'select', text: 'windowColor', - options: [{ - text: 'white', - value: '#fff' - }, { - text: 'yellow', - value: '#ff0' - }, { - text: 'green', - value: '#0f0' - }, { - text: 'cyan', - value: '#0ff' - }, { - text: 'blue', - value: '#00f' - }, { - text: 'magenta', - value: '#f0f' - }, { - text: 'red', - value: '#f00' - }, { - text: 'black', - value: '#000' - }] + options: function () { + return extension.skeleton.main.layers.section.player.on.click.section_1.subtitles.on.click.subtitles_background_color.options; + } }, subtitles_window_opacity: { component: 'slider', @@ -1063,28 +1041,28 @@ extension.skeleton.main.layers.section.player.on.click = { component: 'section', variant: 'card', title: 'extraButtonsBelowThePlayer', - below_player_screenshot: { - component: 'switch', - text: 'screenshot', - value: true - }, - below_player_pip: { - component: 'switch', - text: 'pictureInPicture', - value: true - }, - below_player_loop: { - component: 'switch', - text: 'loop', - value: true - } - }, - player_hide_controls_options: { - component: "button", - text: "hidePlayerControlsBarButtons", - on: { - click: 'main.layers.section.appearance.on.click.player.on.click.player_hide_controls_options.on.click' - } - }, - } + below_player_screenshot: { + component: 'switch', + text: 'screenshot', + value: true + }, + below_player_pip: { + component: 'switch', + text: 'pictureInPicture', + value: true + }, + below_player_loop: { + component: 'switch', + text: 'loop', + value: true + } + }, + player_hide_controls_options: { + component: "button", + text: "hidePlayerControlsBarButtons", + on: { + click: 'main.layers.section.appearance.on.click.player.on.click.player_hide_controls_options.on.click' + } + }, + } }; diff --git a/menu/skeleton-parts/settings.js b/menu/skeleton-parts/settings.js index d436e6612..484eab3b1 100644 --- a/menu/skeleton-parts/settings.js +++ b/menu/skeleton-parts/settings.js @@ -175,7 +175,6 @@ extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.firstSectio layer_animation_scale: { component: 'select', text: 'layerAnimationScale', - value: 0, options: [{ text: '0x', value: 0 @@ -231,96 +230,96 @@ extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.secondSecti component: 'section', variant: 'card', languages: [ -{value: 'default', text: 'default'}, -{value: "ko", text: "한국어"}, -{value: "en", text: "English"}, -{value: "en-IN", text: "English (India)"}, -{value: "en-GB", text: "English (UK)"}, -{value: "en-US", text: "English (US)"}, -{value: "ja", text: "日本語"}, -{value: "ru", text: "Русский"}, -{value: "pt", text: "Português (Brasil)"}, -{value: "pt-PT", text: "Português"}, -{value: "es-419", text: "Español (Latinoamérica)"}, -{value: "es", text: "Español (España)"}, -{value: "es-US", text: "Español (US)"}, -{value: "fr", text: "Français"}, -{value: "fr-CA", text: "Français (Canada)"}, -{value: "de", text: "Deutsch"}, -{value: "pl", text: "Polski"}, -{value: "zh-CN", text: "中文 (简体)"}, -{value: "zh-TW", text: "中文 (繁體)"}, -{value: "zh-HK", text: "中文 (香港)"}, -{value: "fil", text: "Filipino"}, -{value: "af", text: "Afrikaans"}, -{value: "az", text: "Azərbaycan"}, -{value: "id", text: "Bahasa Indonesia"}, -{value: "ms", text: "Bahasa Malaysia"}, -{value: "bs", text: "Bosanski"}, -{value: "ca", text: "Català"}, -{value: "cs", text: "Čeština"}, -{value: "da", text: "Dansk"}, -{value: "et", text: "Eesti"}, -{value: "eu", text: "Euskara"}, -{value: "gl", text: "Galego"}, -{value: "hr", text: "Hrvatski"}, -{value: "zu", text: "IsiZulu"}, -{value: "is", text: "Íslenska"}, -{value: "it", text: "Italiano"}, -{value: "sw", text: "Kiswahili"}, -{value: "lv", text: "Latviešu valoda"}, -{value: "lt", text: "Lietuvių"}, -{value: "hu", text: "Magyar"}, -{value: "nl", text: "Nederlands"}, -{value: "no", text: "Norsk"}, -{value: "nb-NO", text: "Norwegian Bokmål (not yet selectable on YouTube)"}, -{value: "uz", text: "O‘zbek"}, -{value: "ro", text: "Română"}, -{value: "sq", text: "Shqip"}, -{value: "sk", text: "Slovenčina"}, -{value: "sl", text: "Slovenščina"}, -{value: "sr-Latn", text: "Srpski"}, -{value: "fi", text: "Suomi"}, -{value: "sv", text: "Svenska"}, -{value: "vi", text: "Tiếng Việt"}, -{value: "tr", text: "Türkçe"}, -{value: "be", text: "Беларуская"}, -{value: "bg", text: "Български"}, -{value: "ky", text: "Кыргызча"}, -{value: "kk", text: "Қазақ Тілі"}, -{value: "mk", text: "Македонски"}, -{value: "mn", text: "Монгол"}, -{value: "sr", text: "Српски"}, -{value: "uk", text: "Українська"}, -{value: "el", text: "Ελληνικά"}, -{value: "hy", text: "Հայերեն"}, -{value: "iw", text: "עברית"}, -{value: "ur", text: "اردو"}, -{value: "ar", text: "العربية"}, -{value: "fa", text: "فارسی"}, -{value: "fa-IR", text: "Iranian Persian (not yet selectable on YouTube)"}, -{value: "ne", text: "नेपाली"}, -{value: "mr", text: "मराठी"}, -{value: "hi", text: "हिन्दी"}, -{value: "bn", text: "বাংলা"}, -{value: "pa", text: "ਪੰਜਾਬੀ"}, -{value: "gu", text: "ગુજરાતી"}, -{value: "ta", text: "தமிழ்"}, -{value: "te", text: "తెలుగు"}, -{value: "kn", text: "ಕನ್ನಡ"}, -{value: "ml", text: "മലയാളം"}, -{value: "si", text: "සිංහල"}, -{value: "th", text: "ภาษาไทย"}, -{value: "lo", text: "ລາວ"}, -{value: "my", text: "ဗမာ"}, -{value: "ka", text: "ქართული"}, -{value: "am", text: "አማርኛ"}, -{value: "km", text: "ខ្មែរ"}, -{value: "zh-CN", text: "中文 (简体)"}, -{value: "zh-TW", text: "中文 (繁體)"}, -{value: "zh-HK", text: "中文 (香港)"}, -{value: "ko", text: "한국어"} -], + {value: 'default', text: 'default'}, + {value: "ko", text: "한국어"}, + {value: "en", text: "English"}, + {value: "en-IN", text: "English (India)"}, + {value: "en-GB", text: "English (UK)"}, + {value: "en-US", text: "English (US)"}, + {value: "ja", text: "日本語"}, + {value: "ru", text: "Русский"}, + {value: "pt", text: "Português (Brasil)"}, + {value: "pt-PT", text: "Português"}, + {value: "es-419", text: "Español (Latinoamérica)"}, + {value: "es", text: "Español (España)"}, + {value: "es-US", text: "Español (US)"}, + {value: "fr", text: "Français"}, + {value: "fr-CA", text: "Français (Canada)"}, + {value: "de", text: "Deutsch"}, + {value: "pl", text: "Polski"}, + {value: "zh-CN", text: "中文 (简体)"}, + {value: "zh-TW", text: "中文 (繁體)"}, + {value: "zh-HK", text: "中文 (香港)"}, + {value: "fil", text: "Filipino"}, + {value: "af", text: "Afrikaans"}, + {value: "az", text: "Azərbaycan"}, + {value: "id", text: "Bahasa Indonesia"}, + {value: "ms", text: "Bahasa Malaysia"}, + {value: "bs", text: "Bosanski"}, + {value: "ca", text: "Català"}, + {value: "cs", text: "Čeština"}, + {value: "da", text: "Dansk"}, + {value: "et", text: "Eesti"}, + {value: "eu", text: "Euskara"}, + {value: "gl", text: "Galego"}, + {value: "hr", text: "Hrvatski"}, + {value: "zu", text: "IsiZulu"}, + {value: "is", text: "Íslenska"}, + {value: "it", text: "Italiano"}, + {value: "sw", text: "Kiswahili"}, + {value: "lv", text: "Latviešu valoda"}, + {value: "lt", text: "Lietuvių"}, + {value: "hu", text: "Magyar"}, + {value: "nl", text: "Nederlands"}, + {value: "no", text: "Norsk"}, + {value: "nb-NO", text: "Norwegian Bokmål (not yet selectable on YouTube)"}, + {value: "uz", text: "O‘zbek"}, + {value: "ro", text: "Română"}, + {value: "sq", text: "Shqip"}, + {value: "sk", text: "Slovenčina"}, + {value: "sl", text: "Slovenščina"}, + {value: "sr-Latn", text: "Srpski"}, + {value: "fi", text: "Suomi"}, + {value: "sv", text: "Svenska"}, + {value: "vi", text: "Tiếng Việt"}, + {value: "tr", text: "Türkçe"}, + {value: "be", text: "Беларуская"}, + {value: "bg", text: "Български"}, + {value: "ky", text: "Кыргызча"}, + {value: "kk", text: "Қазақ Тілі"}, + {value: "mk", text: "Македонски"}, + {value: "mn", text: "Монгол"}, + {value: "sr", text: "Српски"}, + {value: "uk", text: "Українська"}, + {value: "el", text: "Ελληνικά"}, + {value: "hy", text: "Հայերեն"}, + {value: "iw", text: "עברית"}, + {value: "ur", text: "اردو"}, + {value: "ar", text: "العربية"}, + {value: "fa", text: "فارسی"}, + {value: "fa-IR", text: "Iranian Persian (not yet selectable on YouTube)"}, + {value: "ne", text: "नेपाली"}, + {value: "mr", text: "मराठी"}, + {value: "hi", text: "हिन्दी"}, + {value: "bn", text: "বাংলা"}, + {value: "pa", text: "ਪੰਜਾਬੀ"}, + {value: "gu", text: "ગુજરાતી"}, + {value: "ta", text: "தமிழ்"}, + {value: "te", text: "తెలుగు"}, + {value: "kn", text: "ಕನ್ನಡ"}, + {value: "ml", text: "മലയാളം"}, + {value: "si", text: "සිංහල"}, + {value: "th", text: "ภาษาไทย"}, + {value: "lo", text: "ລາວ"}, + {value: "my", text: "ဗမာ"}, + {value: "ka", text: "ქართული"}, + {value: "am", text: "አማርኛ"}, + {value: "km", text: "ខ្មែរ"}, + {value: "zh-CN", text: "中文 (简体)"}, + {value: "zh-TW", text: "中文 (繁體)"}, + {value: "zh-HK", text: "中文 (香港)"}, + {value: "ko", text: "한국어"} + ], improvedtube: { component: 'select', text: 'improvedtubeLanguage', @@ -338,7 +337,7 @@ extension.skeleton.header.sectionEnd.menu.on.click.settings.on.click.secondSecti }, on: { change: function (event) { - if (event.target.value === 'disabled') { + if (event.target.value === 'default') { satus.storage.remove('youtube_language'); } } diff --git a/menu/skeleton.js b/menu/skeleton.js index 8b346d4c0..19c6ec188 100644 --- a/menu/skeleton.js +++ b/menu/skeleton.js @@ -238,6 +238,14 @@ extension.skeleton.main = { return 'home'; } - }, "frame": { component: 'iframe', class: 'frame', attr: { 'src': 'https://improvedtube.com/wishes', 'style': 'border: none; bottom: 0px; overflow: hidden; width:326px; position:absolute; height:212px; left:-6px !important' } } + }, + frame: { + component: 'iframe', + class: 'frame', + attr: { + 'src': 'https://improvedtube.com/wishes', + 'style': 'border: none; bottom: 0px; overflow: hidden; width:326px; position: absolute; height:212px; left:-6px !important' + } + } } };