[#1074] Make Language Specific Favicons Optional

- adds noDocSpecificIcon property to app settings
- adds option to user Settings page
- updates setFaviconForDoc method to return early when setting is active
pull/2422/head
Aoibhe Wilson 3 weeks ago
parent e0fdbc2812
commit 5add0f9b62

@ -16,6 +16,7 @@ app.Settings = class Settings {
"autoInstall",
"spaceScroll",
"spaceTimeout",
"noDocSpecificIcon",
];
static INTERNAL_KEYS = ["count", "schema", "version", "news"];
@ -38,6 +39,7 @@ app.Settings = class Settings {
theme: "auto",
spaceScroll: 1,
spaceTimeout: 0.5,
noDocSpecificIcon: false,
};
constructor() {

@ -19,7 +19,7 @@ const withImage = function (url, action) {
};
this.setFaviconForDoc = function (doc) {
if (currentSlug === doc.slug) {
if (currentSlug === doc.slug || app.settings.get("noDocSpecificIcon")) {
return;
}

@ -66,6 +66,12 @@ app.templates.settingsPage = (settings) => `\
}>Enable tracking cookies
<small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small>
</label>
<label class="_settings-label _hide-on-mobile">
<input type="checkbox" form="settings" name="noDocSpecificIcon"${
settings.noDocSpecificIcon ? " checked" : ""
}>Disable Language-specific Doc Favicons
<small>With this checked, we will display the default DevDocs icon for all pages.</small>
</label>
</div>
</div>

@ -20,6 +20,7 @@ app.views.SettingsPage = class SettingsPage extends app.View {
settings.analyticsConsent = app.settings.get("analyticsConsent");
settings.spaceScroll = app.settings.get("spaceScroll");
settings.spaceTimeout = app.settings.get("spaceTimeout");
settings.noDocSpecificIcon = app.settings.get("noDocSpecificIcon");
settings.autoSupported = app.settings.autoSupported;
for (var layout of app.Settings.LAYOUTS) {
settings[layout] = app.settings.hasLayout(layout);

Loading…
Cancel
Save