[1074] Make Language Specific Favicon Optional
Unified · Split
| @@ -46,7 +46,7 @@ docker run --name devdocs -d -p 9292:9292 devdocs · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app. |
| 48 | 48 | |
| 49 | −DevDocs requires Ruby 3.3.0 (defined in [`Gemfile`](./Gemfile)), libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands: | |
| 49 | +DevDocs requires Ruby 3.4.1 (defined in [`Gemfile`](./Gemfile)), libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands: | |
| 50 | 50 | |
| 51 | 51 | ```sh |
| 52 | 52 | git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs |
| @@ -16,6 +16,7 @@ app.Settings = class Settings { · 15 unmodified lines | ||
| 16 | 16 | "autoInstall", |
| 17 | 17 | "spaceScroll", |
| 18 | 18 | "spaceTimeout", |
| 19 | + "noDocSpecificIcon", | |
| 19 | 20 | ]; |
| 20 | 21 | |
| 21 | 22 | static INTERNAL_KEYS = ["count", "schema", "version", "news"]; |
| @@ -38,6 +39,7 @@ app.Settings = class Settings { · 16 unmodified lines | ||
| 38 | 39 | theme: "auto", |
| 39 | 40 | spaceScroll: 1, |
| 40 | 41 | spaceTimeout: 0.5, |
| 42 | + noDocSpecificIcon: false, | |
| 41 | 43 | }; |
| 42 | 44 | |
| 43 | 45 | constructor() { |
| @@ -19,7 +19,7 @@ const withImage = function (url, action) { · 18 unmodified lines | ||
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | this.setFaviconForDoc = function (doc) { |
| 22 | − if (currentSlug === doc.slug) { | |
| 22 | + if (currentSlug === doc.slug || app.settings.get("noDocSpecificIcon")) { | |
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
| @@ -66,6 +66,12 @@ app.templates.settingsPage = (settings) => `\ · 65 unmodified lines | ||
| 66 | 66 | }>Enable tracking cookies |
| 67 | 67 | <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small> |
| 68 | 68 | </label> |
| 69 | + <label class="_settings-label _hide-on-mobile"> | |
| 70 | + <input type="checkbox" form="settings" name="noDocSpecificIcon"${ | |
| 71 | + settings.noDocSpecificIcon ? " checked" : "" | |
| 72 | + }>Disable Language-specific Doc Favicons | |
| 73 | + <small>With this checked, we will display the default DevDocs icon for all pages.</small> | |
| 74 | + </label> | |
| 69 | 75 | </div> |
| 70 | 76 | </div> |
| 71 | 77 | |
| @@ -20,6 +20,7 @@ app.views.SettingsPage = class SettingsPage extends app.View { · 19 unmodified lines | ||
| 20 | 20 | settings.analyticsConsent = app.settings.get("analyticsConsent"); |
| 21 | 21 | settings.spaceScroll = app.settings.get("spaceScroll"); |
| 22 | 22 | settings.spaceTimeout = app.settings.get("spaceTimeout"); |
| 23 | + settings.noDocSpecificIcon = app.settings.get("noDocSpecificIcon"); | |
| 23 | 24 | settings.autoSupported = app.settings.autoSupported; |
| 24 | 25 | for (var layout of app.Settings.LAYOUTS) { |
| 25 | 26 | settings[layout] = app.settings.hasLayout(layout); |