mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Issue #246 - Remove more of compact mode and newtab junk from Basilisk
This commit is contained in:
parent
769ac1dbfc
commit
5465d68447
10 changed files with 6 additions and 229 deletions
|
|
@ -1040,12 +1040,6 @@ pref("browser.newtabpage.introShown", false);
|
|||
// Toggles the content of 'about:newtab'. Shows the grid when enabled.
|
||||
pref("browser.newtabpage.enabled", true);
|
||||
|
||||
// Toggles the enhanced content of 'about:newtab'. Shows sponsored tiles.
|
||||
sticky_pref("browser.newtabpage.enhanced", false);
|
||||
|
||||
// enables Activity Stream inspired layout
|
||||
pref("browser.newtabpage.compact", false);
|
||||
|
||||
// Disables capturing of page thumbnails
|
||||
pref("browser.pagethumbnails.capturing_disabled", false);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ var gCustomize = {
|
|||
"blank",
|
||||
"button",
|
||||
"classic",
|
||||
"enhanced",
|
||||
"panel",
|
||||
"overlay",
|
||||
"learn"
|
||||
|
|
@ -83,13 +82,10 @@ var gCustomize = {
|
|||
}
|
||||
switch (event.currentTarget.id) {
|
||||
case "newtab-customize-blank":
|
||||
sendAsyncMessage("NewTab:Customize", {enabled: false, enhanced: false});
|
||||
sendAsyncMessage("NewTab:Customize", {enabled: false});
|
||||
break;
|
||||
case "newtab-customize-classic":
|
||||
sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: false});
|
||||
break;
|
||||
case "newtab-customize-enhanced":
|
||||
sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: !gAllPages.enhanced});
|
||||
sendAsyncMessage("NewTab:Customize", {enabled: true});
|
||||
break;
|
||||
case "newtab-customize-learn":
|
||||
this.showLearn();
|
||||
|
|
|
|||
|
|
@ -141,13 +141,9 @@ var gGrid = {
|
|||
|
||||
// Create sites.
|
||||
let numLinks = Math.min(links.length, cells.length);
|
||||
let hasHistoryTiles = false;
|
||||
for (let i = 0; i < numLinks; i++) {
|
||||
if (links[i]) {
|
||||
this.createSite(links[i], cells[i]);
|
||||
if (links[i].type == "history") {
|
||||
hasHistoryTiles = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -156,9 +152,6 @@ var gGrid = {
|
|||
this._gridDefaultContent.nextSibling.remove();
|
||||
}
|
||||
this._node.appendChild(fragment);
|
||||
|
||||
document.getElementById("topsites-heading").textContent =
|
||||
hasHistoryTiles ? "Your Top Sites" : "Top Sites";
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -162,16 +162,6 @@ var gPage = {
|
|||
*/
|
||||
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
||||
gAllPages.unregister(this);
|
||||
// compute page life-span and send telemetry probe: using milli-seconds will leave
|
||||
// many low buckets empty. Instead we use half-second precision to make low end
|
||||
// of histogram linear and not lose the change in user attention
|
||||
let delta = Math.round((Date.now() - this._firstVisibleTime) / 500);
|
||||
if (this._suggestedTilePresent) {
|
||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN_SUGGESTED").add(delta);
|
||||
}
|
||||
else {
|
||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN").add(delta);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -246,32 +236,5 @@ var gPage = {
|
|||
},
|
||||
|
||||
onPageVisibleAndLoaded() {
|
||||
// Send the index of the last visible tile.
|
||||
this.reportLastVisibleTileIndex();
|
||||
},
|
||||
|
||||
reportLastVisibleTileIndex() {
|
||||
let cwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
let rect = cwu.getBoundsWithoutFlushing(gGrid.node);
|
||||
let nodes = cwu.nodesFromRect(rect.left, rect.top, 0, rect.width,
|
||||
rect.height, 0, true, false);
|
||||
|
||||
let i = -1;
|
||||
let lastIndex = -1;
|
||||
let sites = gGrid.sites;
|
||||
|
||||
for (let node of nodes) {
|
||||
if (node.classList && node.classList.contains("newtab-cell")) {
|
||||
if (sites[++i]) {
|
||||
lastIndex = i;
|
||||
if (sites[i].link.targetedSite) {
|
||||
// record that suggested tile is shown to use suggested-tiles-histogram
|
||||
this._suggestedTilePresent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ Site.prototype = {
|
|||
this._updateAttributes(true);
|
||||
let changed = gPinnedLinks.pin(this._link, aIndex);
|
||||
if (changed) {
|
||||
// render site again to remove suggested/sponsored tags
|
||||
// render site again
|
||||
this._render();
|
||||
}
|
||||
return changed;
|
||||
|
|
@ -136,15 +136,6 @@ Site.prototype = {
|
|||
return str;
|
||||
},
|
||||
|
||||
_getSuggestedTileExplanation: function() {
|
||||
let targetedName = `<strong> ${this.link.targetedName} </strong>`;
|
||||
let targetedSite = `<strong> ${this.link.targetedSite} </strong>`;
|
||||
if (this.link.explanation) {
|
||||
return this._newTabString(this.link.explanation, [targetedName, targetedSite]);
|
||||
}
|
||||
return newTabString("suggested.button", [targetedName]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks for and modifies link at campaign end time
|
||||
*/
|
||||
|
|
@ -155,11 +146,8 @@ Site.prototype = {
|
|||
this.link.url = Services.io.newURI(this.url, null, null).resolve("/");
|
||||
// clear supplied images - this triggers thumbnail download for new url
|
||||
delete this.link.imageURI;
|
||||
delete this.link.enhancedImageURI;
|
||||
// remove endTime to avoid further time checks
|
||||
delete this.link.endTime;
|
||||
// clear enhanced-content image that may still exist in preloaded page
|
||||
this._querySelector(".enhanced-content").style.backgroundImage = "";
|
||||
gPinnedLinks.replace(oldUrl, this.link);
|
||||
}
|
||||
},
|
||||
|
|
@ -186,22 +174,6 @@ Site.prototype = {
|
|||
titleNode.style.backgroundColor = this.link.titleBgColor;
|
||||
}
|
||||
|
||||
// remove "suggested" attribute to avoid showing "suggested" tag
|
||||
// after site was pinned or dropped
|
||||
this.node.removeAttribute("suggested");
|
||||
|
||||
if (this.link.targetedSite) {
|
||||
if (this.node.getAttribute("type") != "sponsored") {
|
||||
this._querySelector(".newtab-sponsored").textContent =
|
||||
newTabString("suggested.tag");
|
||||
}
|
||||
|
||||
this.node.setAttribute("suggested", true);
|
||||
let explanation = this._getSuggestedTileExplanation();
|
||||
this._querySelector(".newtab-suggested").innerHTML =
|
||||
`<div class='newtab-suggested-bounds'> ${explanation} </div>`;
|
||||
}
|
||||
|
||||
if (this.isPinned())
|
||||
this._updateAttributes(true);
|
||||
// Capture the page if the thumbnail is missing, which will cause page.js
|
||||
|
|
@ -343,7 +315,7 @@ Site.prototype = {
|
|||
}
|
||||
else if (!pinned && target.classList.contains("newtab-control-pin")) {
|
||||
if (this.pin()) {
|
||||
// suggested link has changed - update rest of the pages
|
||||
// link has changed - update rest of the pages
|
||||
gAllPages.update(gPage);
|
||||
}
|
||||
action = "pin";
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ const gPrefsMap = new Map([
|
|||
["browser.newtabpage.remote.mode", "str"],
|
||||
["browser.newtabpage.remote.version", "str"],
|
||||
["browser.newtabpage.enabled", "bool"],
|
||||
["browser.newtabpage.enhanced", "bool"],
|
||||
["browser.newtabpage.introShown", "bool"],
|
||||
["browser.newtabpage.updateIntroShown", "bool"],
|
||||
["browser.newtabpage.pinned", "str"],
|
||||
|
|
@ -34,7 +33,6 @@ const gPrefsMap = new Map([
|
|||
// prefs that are important for the newtab page
|
||||
const gNewtabPagePrefs = new Set([
|
||||
"browser.newtabpage.enabled",
|
||||
"browser.newtabpage.enhanced",
|
||||
"browser.newtabpage.pinned",
|
||||
"browser.newtabpage.blocked",
|
||||
"browser.newtabpage.introShown",
|
||||
|
|
|
|||
|
|
@ -5,12 +5,9 @@
|
|||
<!-- These strings are used in the about:newtab page -->
|
||||
<!ENTITY newtab.pageTitle "New Tab">
|
||||
<!ENTITY newtab.customize.classic "Show your top sites">
|
||||
<!ENTITY newtab.customize.cog.enhanced "Include suggested sites">
|
||||
<!ENTITY newtab.customize.cog.title2 "NEW TAB CONTROLS">
|
||||
<!ENTITY newtab.customize.cog.learn "Learn about New Tab">
|
||||
<!ENTITY newtab.customize.title "Customize your New Tab page">
|
||||
<!ENTITY newtab.customize.suggested "Show suggested and your top sites">
|
||||
<!ENTITY newtab.customize.topsites "Show your top sites">
|
||||
<!ENTITY newtab.customize.blank2 "Show blank page">
|
||||
<!ENTITY newtab.undo.removedLabel "Thumbnail removed.">
|
||||
<!ENTITY newtab.undo.undoButton "Undo.">
|
||||
|
|
|
|||
|
|
@ -5,42 +5,3 @@
|
|||
newtab.pin=Pin this site at its current position
|
||||
newtab.unpin=Unpin this site
|
||||
newtab.block=Remove this site
|
||||
# LOCALIZATION NOTE(newtab.sponsored.button): This text appears for sponsored
|
||||
# and enhanced tiles on the same line as the tile's title, so prefer short
|
||||
# strings to avoid overlap. This string should be uppercase.
|
||||
newtab.sponsored.button=SPONSORED
|
||||
# LOCALIZATION NOTE(newtab.suggested.button): This text appears for sponsored
|
||||
# and suggested tiles on the same line as the tile's title, so prefer short
|
||||
# strings to avoid overlap. This string should be uppercase.
|
||||
newtab.suggested.tag=SUGGESTED
|
||||
# LOCALIZATION NOTE(newtab.suggested.button): %1$S will be replaced inline by
|
||||
# one of the user's top 100 sites that triggered this suggested tile.
|
||||
# This text appears for suggested tiles under the tile's title, so prefer short
|
||||
# strings to avoid truncating important text.
|
||||
newtab.suggested.button=Suggested for %1$S visitors
|
||||
# LOCALIZATION NOTE(newtab.sponsored.explain): %1$S will be replaced inline by
|
||||
# the (X) block icon. %2$S will be replaced by an active link using string
|
||||
# newtab.learn.link as text.
|
||||
newtab.sponsored.explain=This tile is being shown to you on behalf of a Mozilla partner. You can remove it at any time by clicking the %1$S button. %2$S
|
||||
# LOCALIZATION NOTE(newtab.sponsored.explain2): %1$S will be replaced inline by
|
||||
# the (X) block icon. %2$S will be replaced by an active link using string
|
||||
# newtab.learn.link as text.
|
||||
newtab.sponsored.explain2=This site is suggested to you on behalf of a Mozilla partner. You can remove it at any time by clicking the %1$S button. %2$S
|
||||
# LOCALIZATION NOTE(newtab.suggested.explain): %1$S will be replaced inline by
|
||||
# the (X) block icon. %2$S will be replaced by an active link using string
|
||||
# newtab.learn.link as text.
|
||||
newtab.suggested.explain=This site is suggested to you by Mozilla. You can remove it at any time by clicking the %1$S button. %2$S
|
||||
# LOCALIZATION NOTE(newtab.enhanced.explain): %1$S will be replaced inline by
|
||||
# the gear icon used to customize the new tab window. %2$S will be replaced by
|
||||
# an active link using string newtab.learn.link as text.
|
||||
newtab.enhanced.explain=A Mozilla partner has visually enhanced this tile, replacing the screenshot. You can turn off enhanced tiles by clicking the %1$S button for your preferences. %2$S
|
||||
newtab.intro1.paragraph1=Now when you open New Tab, you’ll also see sites we think might be interesting to you. Some may be suggested by Mozilla or sponsored by one of our partners.
|
||||
# LOCALIZATION NOTE(newtab.intro1.paragraph2): %1$S will be replaced inline by
|
||||
# an active link using string newtab.privacy.link as text. %2$S will be replaced
|
||||
# inline by the gear icon used to customize the new tab window.
|
||||
newtab.intro1.paragraph2=In order to provide this service, some data is automatically sent back to us in accordance with our %1$S. You can turn this off by unchecking the option under the gear icon (%2$S).
|
||||
newtab.learn.link=Learn more…
|
||||
newtab.privacy.link=Privacy Notice
|
||||
newtab.learn.link2=More about New Tab
|
||||
newtab.intro.header.update=New Tab got an update!
|
||||
newtab.intro.gotit=Got it!
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ var AboutNewTab = {
|
|||
|
||||
customize: function(message) {
|
||||
NewTabUtils.allPages.enabled = message.data.enabled;
|
||||
NewTabUtils.allPages.enhanced = message.data.enhanced;
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
|
|
|
|||
|
|
@ -99,19 +99,6 @@
|
|||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* GRID */
|
||||
#topsites-heading {
|
||||
color: #7A7A7A;
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
/* Position the heading such that it doesn't affect how many cells we
|
||||
can fit into the grid. */
|
||||
position: absolute;
|
||||
/* The top margin moves the heading away from the grid.
|
||||
The horizontal margin aligns the heading with the cells. */
|
||||
margin: -1em 10px 0;
|
||||
}
|
||||
|
||||
/* CELLS */
|
||||
.newtab-cell {
|
||||
--cell-corner-radius: 8px;
|
||||
|
|
@ -119,10 +106,6 @@
|
|||
border-radius: var(--cell-corner-radius);
|
||||
}
|
||||
|
||||
body.compact .newtab-cell {
|
||||
--cell-corner-radius: 2px;
|
||||
}
|
||||
|
||||
.newtab-cell:empty {
|
||||
outline: 2px dashed #c1c1c1;
|
||||
outline-offset: -2px;
|
||||
|
|
@ -172,49 +155,16 @@ body.compact .newtab-cell {
|
|||
transition: opacity 100ms ease-out;
|
||||
}
|
||||
|
||||
body.compact .newtab-thumbnail {
|
||||
height: 100%;
|
||||
border-radius: calc(var(--cell-corner-radius) + 1px);
|
||||
outline: 1px solid hsla(0,0%,0%,.1);
|
||||
-moz-outline-radius: var(--cell-corner-radius);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
.newtab-thumbnail.placeholder {
|
||||
color: white;
|
||||
font-size: 85px;
|
||||
line-height: 200%;
|
||||
}
|
||||
|
||||
body.compact .newtab-thumbnail.placeholder {
|
||||
font-size: 45px;
|
||||
}
|
||||
|
||||
.newtab-cell:not([ignorehover]) .newtab-site:hover .newtab-thumbnail.enhanced-content {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.newtab-site[type=affiliate] .newtab-thumbnail,
|
||||
.newtab-site[type=enhanced] .newtab-thumbnail,
|
||||
.newtab-site[type=organic] .newtab-thumbnail,
|
||||
.newtab-site[type=sponsored] .newtab-thumbnail {
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
body.compact .newtab-site[type=affiliate] .newtab-thumbnail {
|
||||
background-position: center 30%;
|
||||
}
|
||||
|
||||
.newtab-site[type=affiliate] .newtab-thumbnail,
|
||||
body:not(.compact) .newtab-site[type=enhanced] .newtab-thumbnail,
|
||||
body:not(.compact) .newtab-site[type=organic] .newtab-thumbnail,
|
||||
body:not(.compact) .newtab-site[type=sponsored] .newtab-thumbnail {
|
||||
background-size: auto;
|
||||
}
|
||||
|
||||
/* TITLES */
|
||||
|
||||
.newtab-title {
|
||||
color: #5c5c5c;
|
||||
background-color: #F2F2F2;
|
||||
font-size: 13px;
|
||||
line-height: 30px;
|
||||
|
|
@ -222,45 +172,13 @@ body:not(.compact) .newtab-site[type=sponsored] .newtab-thumbnail {
|
|||
border-radius: 0 0 var(--cell-corner-radius) var(--cell-corner-radius);
|
||||
}
|
||||
|
||||
body.compact .newtab-title {
|
||||
background-color: hsla(0,0%,100%,.85);
|
||||
font-size: 12px;
|
||||
line-height: 21px;
|
||||
border: 1px solid hsla(0,0%,80%,.8);
|
||||
border-top-color: hsla(0,0%,0%,.1);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
.newtab-title,
|
||||
.newtab-suggested {
|
||||
color: #5c5c5c;
|
||||
}
|
||||
|
||||
body.compact .newtab-title,
|
||||
body.compact .newtab-suggested {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.newtab-suggested[active] {
|
||||
background-color: rgba(51, 51, 51, 0.95);
|
||||
border: 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
body:not(.compact) .newtab-site:hover .newtab-title {
|
||||
.newtab-site:hover .newtab-title {
|
||||
color: white;
|
||||
background-color: #333;
|
||||
border-color: #333;
|
||||
border-top-color: white;
|
||||
}
|
||||
|
||||
body.compact .newtab-site:hover .newtab-title {
|
||||
color: white;
|
||||
background-color: hsla(0,0%,20%,.85);
|
||||
border-color: hsla(0,0%,0%,.8);
|
||||
border-top-color: white;
|
||||
}
|
||||
|
||||
.newtab-site[pinned] .newtab-title {
|
||||
padding-inline-start: 24px;
|
||||
}
|
||||
|
|
@ -302,20 +220,6 @@ body.compact .newtab-site:hover .newtab-title {
|
|||
right: 4px;
|
||||
}
|
||||
|
||||
body.compact .newtab-control {
|
||||
top: -8px;
|
||||
}
|
||||
|
||||
body.compact .newtab-control-pin:dir(ltr),
|
||||
body.compact .newtab-control-block:dir(rtl) {
|
||||
left: -8px;
|
||||
}
|
||||
|
||||
body.compact .newtab-control-block:dir(ltr),
|
||||
body.compact .newtab-control-pin:dir(rtl) {
|
||||
right: -8px;
|
||||
}
|
||||
|
||||
.newtab-control-pin,
|
||||
.newtab-site[pinned] .newtab-control-pin:hover:active {
|
||||
background-image: -moz-image-rect(url(chrome://browser/skin/newtab/controls.svg), 0, 96, 32, 64);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue