From 428620ac82cab437a12709c5f33126348eeeafb0 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Thu, 26 Oct 2023 23:53:59 -0500 Subject: [PATCH] Apply standard strict Prettier config --- .prettierrc.yaml | 11 ++--- assets/static/js/custom_scripts.js | 75 ++++++++++++++++-------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.prettierrc.yaml b/.prettierrc.yaml index e7b8861..3a613f3 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,10 +1,11 @@ # Configuration file for Prettier -printWidth: 120 +printWidth: 80 tabWidth: 2 useTabs: false -semi: false -trailingComma: 'none' +semi: true +singleQuote: false +trailingComma: 'es5' bracketSpacing: false arrowParens: 'always' proseWrap: 'preserve' @@ -15,7 +16,3 @@ overrides: - files: '*.css' options: printWidth: 120 - singleQuote: false -- files: '*.js' - options: - singleQuote: true diff --git a/assets/static/js/custom_scripts.js b/assets/static/js/custom_scripts.js index d651d79..5b454ae 100644 --- a/assets/static/js/custom_scripts.js +++ b/assets/static/js/custom_scripts.js @@ -1,81 +1,84 @@ // Custom scripts for the Spyder website -;(function () { - 'use strict' +(function () { + "use strict"; /* Top-level variables */ var buttonData = { win: { - text: 'Download for Windows', - icon: ['fab', 'fa-windows'], - url: 'https://github.com/spyder-ide/spyder/releases/latest/download/Spyder_64bit_full.exe' + text: "Download for Windows", + icon: ["fab", "fa-windows"], + url: "https://github.com/spyder-ide/spyder/releases/latest/download/Spyder_64bit_full.exe", }, mac: { - text: 'Download for macOS', - icon: ['fab', 'fa-apple'], - url: 'https://github.com/spyder-ide/spyder/releases/latest/download/Spyder.dmg' + text: "Download for macOS", + icon: ["fab", "fa-apple"], + url: "https://github.com/spyder-ide/spyder/releases/latest/download/Spyder.dmg", }, linux: { - text: 'Download for Linux (Anaconda)', - icon: ['fab', 'fa-linux'], - url: 'https://www.anaconda.com/download/' + text: "Download for Linux (Anaconda)", + icon: ["fab", "fa-linux"], + url: "https://www.anaconda.com/download/", }, other: { - text: 'Download Spyder', - icon: ['fas', 'fa-download'], - url: 'https://github.com/spyder-ide/spyder/releases/latest' - } - } + text: "Download Spyder", + icon: ["fas", "fa-download"], + url: "https://github.com/spyder-ide/spyder/releases/latest", + }, + }; /* Helper functions */ // Get the key corresponding to the current desktop operating system function getOSName() { - var platform = navigator.platform + var platform = navigator.platform; if (!platform) { - return 'other' + return "other"; } - if (platform.indexOf('Win') === 0) { - return 'win' + if (platform.indexOf("Win") === 0) { + return "win"; } - if (platform.indexOf('Mac') === 0) { - return 'mac' + if (platform.indexOf("Mac") === 0) { + return "mac"; } if ( - (platform.indexOf('Linux') === 0 || platform.indexOf('X11') === 0) && + (platform.indexOf("Linux") === 0 || platform.indexOf("X11") === 0) && !platform.match(/android/i) && !navigator.userAgent.match(/android/i) ) { - return 'linux' + return "linux"; } - return 'other' + return "other"; } // Get the button data corresponding to the current OS function getButtonData() { - var osName = getOSName() - return buttonData[osName] + var osName = getOSName(); + return buttonData[osName]; } /* Main functions */ // Setup download button based on current OS function setupDownloadButton(downloadButton) { - var buttonData = getButtonData() - downloadButton.href = buttonData.url - downloadButton.getElementsByClassName('download-text')[0].textContent = buttonData.text + var buttonData = getButtonData(); + downloadButton.href = buttonData.url; + downloadButton.getElementsByClassName("download-text")[0].textContent = + buttonData.text; for (var i = 0; i < buttonData.icon.length; i++) { - downloadButton.getElementsByClassName('download-os-icon')[0].classList.add(buttonData.icon[i]) + downloadButton + .getElementsByClassName("download-os-icon")[0] + .classList.add(buttonData.icon[i]); } } /* Fire events */ // On initial DOM ready, set up the tour and the version dropdown - document.addEventListener('DOMContentLoaded', function () { - var downloadButton = document.getElementById('download-button-button') + document.addEventListener("DOMContentLoaded", function () { + var downloadButton = document.getElementById("download-button-button"); if (downloadButton) { - setupDownloadButton(downloadButton) + setupDownloadButton(downloadButton); } - }) -})() + }); +})();