Skip to content

Commit

Permalink
Apply standard strict Prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Nov 4, 2023
1 parent ab034ff commit 428620a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
11 changes: 4 additions & 7 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -15,7 +16,3 @@ overrides:
- files: '*.css'
options:
printWidth: 120
singleQuote: false
- files: '*.js'
options:
singleQuote: true
75 changes: 39 additions & 36 deletions assets/static/js/custom_scripts.js
Original file line number Diff line number Diff line change
@@ -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);
}
})
})()
});
})();

0 comments on commit 428620a

Please sign in to comment.