Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
style: format code with Prettier and StandardJS
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in e23f01a according to the output
from Prettier and StandardJS.

Details: #343
  • Loading branch information
deepsource-autofix[bot] authored Aug 15, 2024
1 parent e23f01a commit cca202e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions docs/star.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
const wordElement = document.getElementById("random-word");
//Fetch a random word for page title and downloads
async function fetchRandomWord() {
const wordElement = document.getElementById('random-word')
// Fetch a random word for page title and downloads
async function fetchRandomWord () {
try {
const response = await fetch("https://random-word-api.herokuapp.com/word");
const data = await response.json();
const response = await fetch('https://random-word-api.herokuapp.com/word')
const data = await response.json()

document.title = "SLF — " + data; // Set the page title to the random word
document.title = 'SLF — ' + data // Set the page title to the random word
} catch (error) {
console.error("Error fetching word:", error);
console.error('Error fetching word:', error)
}
}

// Call the function to fetch a random word on page load
fetchRandomWord();
fetchRandomWord()
// prettier-ignore
{
document.getElementById("udate").innerHTML = document.getElementById("udate").innerHTML + document.lastModified;
document.getElementById('udate').innerHTML = document.getElementById('udate').innerHTML + document.lastModified
}
// Fetch last modified date and apply it to the udate element that is on some
// pages.

// Defined the copyToClipboard function, that is used on some pages
function copyToClipboard(text) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge.
document.body.appendChild(textarea);
textarea.select();
function copyToClipboard (text) {
const textarea = document.createElement('textarea')
textarea.textContent = text
textarea.style.position = 'fixed' // Prevent scrolling to bottom of page in MS Edge.
document.body.appendChild(textarea)
textarea.select()
try {
return document.execCommand("copy"); // Security exception may be thrown by some browsers.
return document.execCommand('copy') // Security exception may be thrown by some browsers.
} catch (ex) {
console.warn("Copy to clipboard failed.", ex);
return false;
console.warn('Copy to clipboard failed.', ex)
return false
} finally {
document.body.removeChild(textarea);
document.body.removeChild(textarea)
}
}

0 comments on commit cca202e

Please sign in to comment.