diff --git a/btfl.less b/btfl.less index e534de2..bca6a45 100644 --- a/btfl.less +++ b/btfl.less @@ -6,6 +6,7 @@ @import "src/hide"; @import "src/show"; @import "src/dimmer"; +@import "src/mobile"; @import "src/profile"; @import "src/people"; @import "src/fixes"; diff --git a/js/bg.js b/js/bg.js index 6a1a112..cc93929 100644 --- a/js/bg.js +++ b/js/bg.js @@ -4,15 +4,27 @@ */ // Disable CSP -function onHeaders(det) { - for (var i = 0; i < det.responseHeaders.length; i++) { - if (det.responseHeaders[i].name.toLowerCase() == 'content-security-policy' - || det.responseHeaders[i].name.toLowerCase() == 'content-security-policy-report-only' - ) det.responseHeaders[i].value = ''; - } - return { responseHeaders: det.responseHeaders }; -} - chrome.webRequest.onHeadersReceived.addListener( - onHeaders, {urls: ['']}, ['blocking', 'responseHeaders'] + function(det) { + for (let head of det.responseHeaders) { + let n = head.name.toLowerCase(); + if (n == 'content-security-policy' || n == 'content-security-policy-report-only' + ) head.value = ''; + } + return { responseHeaders: det.responseHeaders }; + }, + {urls: ['']}, ['blocking', 'responseHeaders'] ); + +chrome.webRequest.onBeforeSendHeaders.addListener( + function(det) { + for (let head of det.requestHeaders) { + let n = head.name.toLowerCase(); + if (n == 'user-agent') + head.value = 'DisKort/1.0 (Linux) Firefox/99.0'; + } + return { requestHeaders: det.requestHeaders }; + }, + {urls: ['']}, ['blocking', 'requestHeaders'] +); + diff --git a/src/fixes.less b/src/fixes.less index 0274c6d..0fda714 100644 --- a/src/fixes.less +++ b/src/fixes.less @@ -38,3 +38,26 @@ div[class*="templatesList-"] { // fix tempates list (it was removed) height: 128px; } + +// Fix positioning +div[class^="toolsContainer-"] { // in settings + position: fixed !important; + right: 21px; + padding: 0; + margin-top: 60px; + border-radius: 16px; + + & > div { + position: unset !important; + + div[class^="container"] > * { + background-color: var(--background-nested-floating); + } + } +} + +div[class^="contentContainer-"] div[class*="stickyHeader-"] { + padding-left: 0; + padding-right: 0; + margin: 0; +} diff --git a/src/hide.less b/src/hide.less index 21f2896..a912051 100644 --- a/src/hide.less +++ b/src/hide.less @@ -53,6 +53,7 @@ div[class^="welcomeCTA-"], // wave to say hi on server div[role="separator"]:not([id$="new-messages-bar"]), // aren't needed // Profile +[class^="botTagVerified-"], [class^="bannerContainer-"], [class*="banner-"], @@ -61,13 +62,6 @@ div[class^="keybind-"], // true must know it! [class*="socialLink-"], // in change log div[class^="socialLinks-"], // in settings at bottom - // Tabs - div[aria-controls*="nitro"], - div[aria-controls="library-inventory-tab"], - div[aria-controls="subscriptions-tab"], - div[aria-controls="billing-tab"], - div[aria-controls^="hypesquad"], - // Member list [class^="membersGroup-"], // groups (roles) diff --git a/src/mobile.less b/src/mobile.less index a3d14d1..92e03f7 100644 --- a/src/mobile.less +++ b/src/mobile.less @@ -12,7 +12,6 @@ [class^="layer-"] { padding: 0; margin: auto; } [class^="layer-"] > [class^="container-"], [class^="standardSidebarView-"] { overflow-x: scroll; } - [class^="base-"], [class^="contentRegion-"] { min-width: 200%; } [class^="content-"] [class^="sidebar"] { width: calc(50% - 8px - 72px); } [class^="chat-"] { width: 100%; } [class^="tools"] { position: unset !important; } @@ -44,8 +43,16 @@ [class^="member-"], #channels li, div[class^="tabBarItem-"] { - margin-top: 16px; - padding: 0 8px; + margin-top: 8px; + padding: 0 12px; font-size: 11pt; } + + [class^="base-"], + [class^="contentRegion-"], + div[class^="sidebarRegion-"], // all in settings + { + width: 200%; + min-width: 200%; + } } diff --git a/src/profile.less b/src/profile.less index f27cd7f..428eda3 100644 --- a/src/profile.less +++ b/src/profile.less @@ -3,10 +3,12 @@ * Zlib License */ + div[class^="userInfo-"] { // settings - padding-top: 48px; justify-content: left; + padding-top: 24px; + height: 56px; button { margin-left: 32px; @@ -14,7 +16,9 @@ div[class^="userInfo-"] { } div[class^="avatar-"] { - top: 32px; + top: 0; + border-radius: 0 !important; + border-bottom-right-radius: 50% !important; } } diff --git a/src/settings.less b/src/settings.less new file mode 100644 index 0000000..3062c3e --- /dev/null +++ b/src/settings.less @@ -0,0 +1,83 @@ +/** DisKort + * (c) Er2 2022 + * Zlib License + */ + +// New sidebar in settings +div[class^="standardSidebarView-"] { + flex-direction: column; + + div[class^="sidebarRegion-"] { + overflow: auto hidden; + scrollbar-width: thin; + background: var(--background-secondary); // bugfix + flex-basis: unset; // bugfix to normalize height + + div[class^="header-"], + div[class^="separator-"] + { display: none; } + + & > div { + overflow: auto hidden !important; + justify-content: left; + max-width: 100%; + + & > nav { + padding: 0; + & > div { + flex-direction: row; + height: @tab-height; + } + } + } + } + + div[class^="contentRegion-"] { + overflow-y: auto; + scrollbar-width: thin; + + * { + max-width: 100%; + } + } +} + +div[aria-controls*="nitro"], +div[aria-controls="library-inventory-tab"], +div[aria-controls="subscriptions-tab"], +div[aria-controls="billing-tab"], +div[aria-controls="keybinds-tab"], +div[aria-controls="game-activity-tab"], +div[aria-controls^="hypesquad"], +{ + display: none; +} + +#connections-tab div[class^="children-"] { + flex-direction: row; + div[class^="accountList-"] { + margin-right: @div-width; + height: 100%; // decreases height? 0_0 + } + div[class^="connectionList-"] { + width: 100%; + } +} + +#notifications-tab div[class^="children"] { + div:nth-child(6) + { display: none; } +} + +div[class^="accountProfileCard-"] { + div[class^="field-"]:nth-child(1) { + height: 0; + div[class^="constrainedRow-"] { + display: none; + } + button { + top: -48pt; + left: 60vh; + } + } +} diff --git a/src/style.less b/src/style.less index b4c9e6e..f7afcdf 100644 --- a/src/style.less +++ b/src/style.less @@ -7,6 +7,9 @@ @rounder: 16px; @roundest: 24px; // text area +@div-width: (@rounder / 2); +@tab-height: 40px; + // Round // UI elements div[class^="tabBarItem-"], @@ -69,7 +72,7 @@ // Movement div[class^="sidebar-"] { - margin-right: (@rounder / 2); + margin-right: @div-width; } div[class^="radioBar-"] { @@ -96,12 +99,12 @@ div[class^="radioBar-"] { border-top-right-radius: @r !important; } -div[class^="tabBarItem-"], -div[class^="auditLog"] div[class^="headerExpanded-"] -{ .bottom-border(); } - -div[class^="auditLog-"] div[class^="changeDetails-"] -{ .top-border(); } +div[class^="auditLog"] { + div[class^="headerExpanded-"] + { .bottom-border(); } + div[class^="changeDetails-"] + { .top-border(); } +} [class*="embed-"], div[class^="messagesWrapper-"] @@ -121,10 +124,17 @@ section div[class^="children-"] { justify-content: center; } // tabs +div[class^="side-"] div[role="tab"], div[class^="tabBarItem-"] { + .bottom-border(); + margin: 0; + margin-top: 8px; margin-right: 16px; padding: 4px 8px; - margin-top: 16px; +} + +div[class^="tabBar-"] { + height: @tab-height; } [role="tab"][class*="selected-"], @@ -180,3 +190,5 @@ div[class^="channelTextArea-"] { } } } + +@import "settings";