From 799c953b30ba31abf839b4d3caf18d12d98788e9 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 14 Jun 2022 00:26:59 +0200 Subject: [PATCH] Remove code no longer needed --- src/csui/res/css/uwui-base.scss | 13 --- src/ext/lib/uwui/PlayerUI.js | 125 --------------------------- src/ext/lib/uwui/UI.js | 7 ++ src/ext/lib/video-data/PlayerData.ts | 9 -- src/res/css/uwui-base.scss | 53 +----------- 5 files changed, 9 insertions(+), 198 deletions(-) delete mode 100644 src/ext/lib/uwui/PlayerUI.js diff --git a/src/csui/res/css/uwui-base.scss b/src/csui/res/css/uwui-base.scss index 27dc6f4..f6ed172 100644 --- a/src/csui/res/css/uwui-base.scss +++ b/src/csui/res/css/uwui-base.scss @@ -2,20 +2,7 @@ @import 'colors.scss'; @import 'common.scss'; -* { - font-family: 'Overpass'; -} - .uw-ultrawidify-container-root { - // here's the defaults: - // all: initial; - // * { - // all: unset; - // } - - // here's things that we don't want as defaults - // (must come after the all: declaration, otherwise - // all: declaration overrides everything.) // we put our UI _over_ site's player: z-index: 999999; diff --git a/src/ext/lib/uwui/PlayerUI.js b/src/ext/lib/uwui/PlayerUI.js deleted file mode 100644 index 0cdd433..0000000 --- a/src/ext/lib/uwui/PlayerUI.js +++ /dev/null @@ -1,125 +0,0 @@ -import UI from './UI'; -import VuexWebExtensions from 'vuex-webextensions'; -import PlayerUiComponent from '../../../csui/PlayerUiBase.vue'; - -if (process.env.CHANNEL !== 'stable'){ - console.info("Loading: PlayerUi"); -} - -/** - * Class that handles in-player UI - */ -class PlayerUi extends UI { - - /** - * Creates new in-player UI for ultrawidify - * @param {*} playerElement PlayerUI will be created as a child of this element - * @param {*} settings Extension settings (instanceof Settings) - */ - constructor ( - playerElement, - settings, - eventBus, - videoData - ) { - super( - 'ultrawidifyUi', - PlayerUi.getStoreConfig(), - PlayerUi.getUiConfig(playerElement), - PlayerUi.getCommsConfig(), - { eventBus, videoData } - ); - - this.settings = settings; - } - - //#region constructor helpers - // we will move some things out of the constructor in order to keep things clean - static getStoreConfig() { - // NOTE: these are sample values and can be deleted. Currently, they're commented out - // so we won't have to look up the documentation in order to get them working - return { - plugins: [ - VuexWebExtensions({ - persistentStates: [ - 'showUi', - 'resizerDebugData', - 'playerDebugData', - ], - }), - ], - state: { - showUi: true, - }, - mutations: { - 'uw-toggle-ui'(state) { - state['showUi'] = !state['showUi']; - }, - 'uw-set-ui-visible'(state, payload) { - state['showUi'] = payload; - }, - 'uw-set-player-debug-data'(state, payload) { - state['playerDebugData'] = payload; - }, - 'uw-set-resizer-debug-data'(state, payload) { - state['resizerDebugData'] = payload; - }, - }, - actions: { - 'uw-set-ui-visible'({commit}, payload) { - console.log('action!', commit, payload); - commit('uw-set-ui-visible', payload); - }, - 'uw-toggle-ui'({commit}) { - commit('uw-toggle-ui'); - }, - 'uw-set-player-debug-data'({commit}, payload) { - commit('uw-set-player-debug-data', payload); - }, - 'uw-set-resizer-debug-data'({commit}, payload) { - commit('uw-set-resizer-debug-data', payload); - }, - } - }; - } - - static getUiConfig(playerElement) { - return { - parentElement: playerElement, - component: PlayerUiComponent - } - } - - static getCommsConfig() { - // NOTE: these are sample values and can be deleted. Currently, they're commented out - // so we won't have to look up the documentation in order to get them working - return { - handlers: { - // 'show-notification': [(message) => this.showNotification(message)], - } - } - } - //#endregion - - //#region lifecycle - replace(playerElement) { - try { - super.replace(PlayerUi.getUiConfig(playerElement)); - } catch (e) { - this.logger.log('error', 'Couldn\'t replace player element for ui. Error:', e); - } - } - //#endregion - - //#region debug methods - updateDebugInfo(component, data) { - this.vuexStore?.dispatch(`uw-set-${component}-debug-data`, data); - } - //#endregion -} - -if (process.env.CHANNEL !== 'stable'){ - console.info("PlayerUi loaded"); -} - -export default PlayerUi; diff --git a/src/ext/lib/uwui/UI.js b/src/ext/lib/uwui/UI.js index f3eedb4..651f517 100644 --- a/src/ext/lib/uwui/UI.js +++ b/src/ext/lib/uwui/UI.js @@ -29,6 +29,13 @@ class UI { } rootDiv.setAttribute('id', uwid); rootDiv.classList.add('uw-ultrawidify-container-root'); + rootDiv.style.width = "100%"; + rootDiv.style.height = "100%"; + rootDiv.style.position = "absolute"; + rootDiv.style.zIndex = "1000"; + rootDiv.style.border = 0; + rootDiv.style.top = 0; + // rootDiv.style.pointerEvents = 'none'; if (this.uiConfig?.parentElement) { this.uiConfig.parentElement.appendChild(rootDiv); diff --git a/src/ext/lib/video-data/PlayerData.ts b/src/ext/lib/video-data/PlayerData.ts index ee5c18f..6ed9aeb 100644 --- a/src/ext/lib/video-data/PlayerData.ts +++ b/src/ext/lib/video-data/PlayerData.ts @@ -654,15 +654,6 @@ class PlayerData { showNotification(notificationId) { // this.notificationService?.showNotification(notificationId); } - - /** - * NOTE: this method needs to be deleted once Edge gets its shit together. - */ - showEdgeNotification() { - // if (BrowserDetect.isEdgeUA && !this.settings.active.mutedNotifications?.browserSpecific?.edge?.brokenDrm?.[window.hostname]) { - // this.ui = new PlayerUi(this.element, this.settings); - // } - } } if (process.env.CHANNEL !== 'stable'){ diff --git a/src/res/css/uwui-base.scss b/src/res/css/uwui-base.scss index 60e1263..abdae89 100644 --- a/src/res/css/uwui-base.scss +++ b/src/res/css/uwui-base.scss @@ -1,15 +1,8 @@ .uw-ultrawidify-container-root { - - // here's the defaults: - all: initial; - * { - all: unset; - } - // here's things that we don't want as defaults // (must come after the all: declaration, otherwise // all: declaration overrides everything.) - + // we put our UI _over_ site's player: z-index: 999999; position: absolute; @@ -23,46 +16,4 @@ // we are click-through by default: pointer-events: none; - - // defaults for some common elements: - p,h1,h2,h3,h4,h5,h6,div { - display: block; - } - h1,h2,h3,h4,h5,h6,b { - font-weight: bold; - } - h1 { - font-size: 2rem; - margin: .5rem 0; - } - h2 { - font-size: 1.69em; - margin: .42rem 0; - } - h3 { - font-size: 1.42rem; - margin: .25rem 0; - } - ul, ol { - display: block; - list-style: disc outside none; - margin: 1em 0; - padding: 0 0 0 40px; - } - ol { - list-style-type: decimal; - } - ul ul, ol ul { - list-style-type: circle; - // list-style-position: inside; - margin-left: 15px; - } - ol ol, ul ol { - list-style-type: lower-latin; - // list-style-position: inside; - margin-left: 15px; - } - li { - display: list-item; - } -} \ No newline at end of file +}