Added all Files
This commit is contained in:
commit
9fe8dfec49
81 changed files with 1135 additions and 0 deletions
54
script.js
Normal file
54
script.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
function randomBackground(backgrounds) {
|
||||
let background = selectRandom(backgrounds);
|
||||
console.log("Choosen random background image:", background);
|
||||
|
||||
document.getElementById("background").style.backgroundImage = "url(backgrounds/" + background + ")";
|
||||
let div_height = document.getElementById("background").offsetHeight;
|
||||
let half_div_height = (0 - div_height) / 2;
|
||||
document.getElementById("background").style.backgroundPosition = "0% " + half_div_height.toString() + "px";
|
||||
}
|
||||
|
||||
function selectRandom(array) {
|
||||
let choosen = array[Math.floor(Math.random() * array.length)];
|
||||
return choosen;
|
||||
}
|
||||
|
||||
function copyText(text) {
|
||||
try {
|
||||
navigator.clipboard.writeText(text);
|
||||
console.log('Content copied to clipboard: "' + text + '"');
|
||||
} catch (error) {
|
||||
console.error('Failed to copy "' + text + '":', error);
|
||||
}
|
||||
}
|
||||
|
||||
function strBetweenStrings(startStr, endStr, str) {
|
||||
pos = str.indexOf(startStr) + startStr.length;
|
||||
return str.substring(pos, str.indexOf(endStr, pos));
|
||||
}
|
||||
|
||||
function getStringOfPageContent(url, callbackFunction) {
|
||||
$.get(url, function(data) {
|
||||
callbackFunction(data);
|
||||
});
|
||||
};
|
||||
|
||||
function getFilesInFolder(pageContent) { // Needs auto file indexing
|
||||
// console.log(pageContent);
|
||||
let contentArray = pageContent.split("\n");
|
||||
|
||||
let files = [];
|
||||
|
||||
for (let line in contentArray) {
|
||||
if (contentArray[line].includes("<li>")) {
|
||||
files.push(strBetweenStrings('"', '"', contentArray[line]));
|
||||
}
|
||||
}
|
||||
|
||||
files.shift();
|
||||
// console.log(files);
|
||||
|
||||
return files;
|
||||
};
|
||||
|
||||
// getStringOfPageContent("backgrounds", getFilesInFolder)
|
Loading…
Add table
Add a link
Reference in a new issue