Skip to content

Commit

Permalink
hide downloads.shelf since Chrome 117
Browse files Browse the repository at this point in the history
  • Loading branch information
gdh1995 committed Oct 15, 2023
1 parent ea71a30 commit b35de8a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 deletions.
1 change: 0 additions & 1 deletion background/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ export const executeScript_ = <Args extends (number | boolean | null)[]>(tabId:
OnChrome && Build.MinCVer < BrowserVer.MinInjectImmediatelyInMV3 && CurCVer_ < BrowserVer.MinInjectImmediatelyInMV3
&& delete toRun.injectImmediately
browser_.scripting.executeScript(toRun, callback || runtimeError_)
return
} else {
const toRun: chrome.tabs.InjectDetails = frameId >= 0 ? { frameId } : { allFrames: true, matchAboutBlank: true }
toRun.runAt = "document_start"
Expand Down
6 changes: 4 additions & 2 deletions background/help_dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ const commandGroups_: {
, "clearContentSettings", 1
, "copyWindowInfo", 1, "$format=\"${title}: ${url}\", join:true/string, decoded"
, "captureTab"
, "toggleWindow", "$states=\"normal maximized\""
, "toggleWindow", "$states=\"normal,maximized\""
],
misc: [
"showHelp"
Expand All @@ -388,7 +388,9 @@ const commandGroups_: {
}

if (OnChrome) {
(commandGroups_.misc as Writable<typeof commandGroups_.misc>).push("closeDownloadBar")
(commandGroups_.misc as Writable<typeof commandGroups_.misc>).push("closeDownloadBar", 1)
Build.MinCVer < BrowserVer.MinNoDownloadBubbleFlag && CurCVer_ < BrowserVer.MinNoDownloadBubbleFlag
&& (commandGroups_.misc as Writable<typeof commandGroups_.misc>).pop()
}

if (OnFirefox || OnChrome && IsEdg_) {
Expand Down
6 changes: 4 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var Tasks = {
}
var btypes = getBuildItem("BTypes");
const has_wordsRe = btypes & BrowserType.Chrome && getBuildItem("MinCVer") <
59 /* min(MinSelExtendForwardOnlySkipWhitespaces, MinEnsuredUnicodePropertyEscapesInRegExp) */
/* min(MinSelExtendForwardOnlySkipWhitespaces, MinEnsuredUnicodePropertyEscapesInRegExp) */ 59
|| btypes & BrowserType.Firefox && !getBuildItem("NativeWordMoveOnFirefox")
&& getBuildItem("MinFFVer") < /* FirefoxBrowserVer.MinEnsuredUnicodePropertyEscapesInRegExp */ 78
if (!has_wordsRe) {
Expand Down Expand Up @@ -327,6 +327,8 @@ var Tasks = {
optional = optional.filter(i => {
return !i.includes("chrome:") && i !== "downloads.shelf" && i !== "contentSettings"
})
} else if (optional && minVer >= /* MinNoDownloadBubbleFlag */ 117) {
optional = optional.filter(i => i !== "downloads.shelf")
}
if (!getBuildItem("OnBrowserNativePages")) {
optional = optional.filter(i => { return !i.includes("chrome:") })
Expand Down Expand Up @@ -526,7 +528,7 @@ gulp.task("locally", function(done) {
compilerOptions = loadValidCompilerOptions("scripts/gulp.tsconfig.json");
createBuildConfigCache();
var old_has_polyfill = has_polyfill;
has_polyfill = getBuildItem("MinCVer") < 43 /* MinSafe$String$$StartsWith */;
has_polyfill = getBuildItem("MinCVer") < /* MinSafe$String$$StartsWith */ 43
if (has_polyfill != old_has_polyfill) {
CompileTasks.front[0][1] = has_polyfill ? POLYFILL_FILE : "!" + POLYFILL_FILE;
CompileTasks.lib.length = 1;
Expand Down
8 changes: 6 additions & 2 deletions pages/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,12 @@ label:active {
padding-left: 22px;
text-indent: -22px;
}
.optional-permission:first-of-type:not(.single) {
margin-top: -4px;
#optionalPermissions.has-many {
position: relative;
top: -4px;
}
#optionalPermissionsHelp.has-many {
top: 0;
}
/* Ids and classes for rendering exclusionRules */
#exclusionRules {
Expand Down
2 changes: 1 addition & 1 deletion pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
</label>
</template>
</td>
<td class="help"><div class="help-inner">
<td class="help"><div id="optionalPermissionsHelp" class="help-inner">
<div data-i="103_3">Check to enable some features on this computer.</div>
<div id="navPermissionTip" style="display: none;"><span data-i="103_4">Some permissions
can only be granted or revoked on</span>
Expand Down
13 changes: 8 additions & 5 deletions pages/options_permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class OptionalPermissionsOption_ extends Option_<"nextPatterns"> {
if (!item) { continue }
item.previous_ = 0
const box = item.element_.parentElement as Element as EnsuredMountedHTMLElement
if (!err) { return TextOption_.showError_("", void 0, box) }
if (!err) { TextOption_.showError_("", void 0, box); continue }
let msg = (err && err.message || JSON.stringify(err)) + ""
if (name.startsWith("chrome://") && msg.includes("Only permissions specified in the manifest")) {
if (name.startsWith("chrome:")) {
Expand Down Expand Up @@ -208,12 +208,13 @@ const initOptionalPermissions = (): void => {
}
}
node.lastElementChild.textContent = i18nName + suffix
if (optional_permissions.length === 1 || optional_permissions.length === 2 && pageLangs_ === "en") {
node.classList.add("single")
}
fragment.appendChild(node)
shownItem.element_ = checkbox
}
if (!(optional_permissions.length === 1 || optional_permissions.length === 2 && pageLangs_ === "en")) {
$("#optionalPermissionsHelp").classList.add("has-many")
container.classList.add("has-many")
}
container.appendChild(fragment)
delayBinding_(container, "input", onInput, true)
gotoCrSC && delayBinding_(gotoCrSC, "click", onCrUrlClick, true)
Expand Down Expand Up @@ -269,7 +270,9 @@ const onCrUrlClick = (e: EventToPrevent): void => {
}

if (!OnEdge) {
const ignored: Array<kBrowserPermission | RegExpOne> = OnFirefox ? [kShelf] : ["downloads"]
const ignored: Array<kBrowserPermission | RegExpOne> = OnFirefox || OnChrome
&& (Build.MinCVer >= BrowserVer.MinNoDownloadBubbleFlag || CurCVer_ > BrowserVer.MinNoDownloadBubbleFlag - 1)
? [kShelf] : ["downloads"]
OnChrome || ignored.push(<RegExpOne> /^chrome:/, "contentSettings")
OnChrome && IsEdg_ && Build.OnBrowserNativePages && ignored.push(kNTP)
OnFirefox || ignored.push("cookies")
Expand Down
2 changes: 2 additions & 0 deletions typings/compatibility.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ declare const enum BrowserVer {
Min$AbortSignal$$timeout = 103, // even if LEGACY; since 100 if EXP
MinEnsured$Element$$role = 103, // even if LEGACY; since 68 if EXP
MinMV3FaviconAPI = 104,
Min$downloads$$setUiOptions = 105, // require `downloads.ui`
MinURLPatternWith$ignoreCase = 107, // even if EXP or LEGACY
MinMaybePopoverWith$popovershow = 109, // if EXP; use popovershow/popoverhide instead of toggle
MinBgWorkerAliveIfOnlyAnyAction = 110,
Expand All @@ -611,6 +612,7 @@ declare const enum BrowserVer {
MinNoOverflowOverlay = 114, // even if EXP or LEGACY
MinMaybeMouseenter$composed$IsFalse = 115, // if EXP
MinMouseenter$composed$IsFalse = 116, // said in https://chromestatus.com/features#milestone%3D116
MinNoDownloadBubbleFlag = 117,
MinNo$TimerType$$Fake = 999,
assumedVer = 998,
}
Expand Down

0 comments on commit b35de8a

Please sign in to comment.