Skip to content

Commit

Permalink
Merge pull request #22343 from hawkeye116477/gh-pages
Browse files Browse the repository at this point in the history
Improve website
  • Loading branch information
xxcriticxx authored Mar 12, 2024
2 parents 0b9d202 + bca5f3f commit d4f2a9e
Show file tree
Hide file tree
Showing 26 changed files with 669 additions and 783 deletions.
495 changes: 0 additions & 495 deletions website/assets/js/bootstrap5-toggle.ecmas.js

This file was deleted.

77 changes: 77 additions & 0 deletions website/assets/js/color.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
* Modified by hawkeye116477
*/

(() => {
'use strict'

const storedTheme = localStorage.getItem('theme');
const oldStoredTheme = localStorage.getItem('darkSwitch');

const getPreferredTheme = () => {
if (oldStoredTheme) {
localStorage.setItem("theme", oldStoredTheme);
localStorage.removeItem("darkSwitch");
return oldStoredTheme;
}
else if (storedTheme) {
return storedTheme;
}
else {
return "auto";
}
}

const setTheme = function (theme) {
if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}

setTheme(getPreferredTheme())

const showActiveTheme = theme => {
const activeSelectors = document.querySelectorAll('.theme-icon-active')
const activeButtons = document.querySelectorAll(`[data-bs-theme-value="${theme}"]`)
if (activeButtons.length > 0) {
const activeIcon = activeButtons[0].querySelector('span')

document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
})

for (let i = 0; i < activeSelectors.length; ++i) {
activeSelectors[i].innerHTML = activeIcon.innerHTML
}

for (let i = 0; i < activeButtons.length; ++i) {
activeButtons[i].classList.add('active')
}
}
}

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
if (storedTheme !== 'light' || storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})

window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())

document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
localStorage.setItem('theme', theme)
setTheme(theme)
showActiveTheme(theme)
})
})
})
})()
69 changes: 0 additions & 69 deletions website/assets/js/dark-mode-switch.js

This file was deleted.

40 changes: 27 additions & 13 deletions website/assets/js/table-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ for (selectObject of selectObjects) {
allValues.push(options.value);
}
}
const url = new URL(location);
var newURL = new URL(document.querySelector("#flTableSettingsURL").value);
if(allValues != "") {
allValues = allValues.toString();
url.searchParams.set(dataAttribute, allValues);
newURL.searchParams.set(dataAttribute, allValues)
if (allValues.includes(",")){
var startDataAttribute = `[data-${dataAttribute}*="`;
var endDataAttribute = '"]';
Expand All @@ -162,9 +162,9 @@ for (selectObject of selectObjects) {
}
}
else {
url.searchParams.delete(dataAttribute);
newURL.searchParams.delete(dataAttribute);
}
history.replaceState(null, '', url.href);
document.querySelector("#flTableSettingsURL").value = newURL.href;
}
}
var allRecords = rows;
Expand Down Expand Up @@ -206,14 +206,10 @@ function scrollPaddingTop(target) {
var faLinks = document.querySelectorAll(".fa-link");
for (var faLink of faLinks) {
faLink.addEventListener('click', function () {
scrollPaddingTop(document.querySelector(decodeURIComponent(this.getAttribute("href"))));
scrollPaddingTop(document.querySelector(this.getAttribute("href")));
});
}
window.addEventListener('load', () => {
var target = document.querySelector(':target');
if (target != null) {
scrollPaddingTop(document.querySelector(':target'));
}
const urlParams = new URLSearchParams(window.location.search);
let key;
var allSelects = document.querySelectorAll(".ddlFilterTableRow");
Expand All @@ -234,15 +230,33 @@ window.addEventListener('load', () => {
searchField.setAttribute("value", key);
searchField.dispatchEvent(new Event('input'));
}
var target = document.querySelector(':target');
if (target != null) {
scrollPaddingTop(document.querySelector(':target'));
}
});


document.querySelector(".light-table-filter").addEventListener('input', function (e) {
const url = new URL(location);
var newURL = new URL(document.querySelector("#flTableSettingsURL").value);
if (this.value != '') {
url.searchParams.set("search", this.value);
newURL.searchParams.set("search", this.value);
} else {
url.searchParams.delete("search");
newURL.searchParams.delete("search");
}
history.replaceState(null, '', url.href);
document.querySelector("#flTableSettingsURL").value = newURL.href;
});

function copyToClipBoard(element) {
var copyText = document.querySelector(element);
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* Copy the text inside the text field */
if (typeof navigator.clipboard != undefined) {
navigator.clipboard.writeText(copyText.value);
}
else {
document.execCommand("copy");
}
}
Loading

0 comments on commit d4f2a9e

Please sign in to comment.