Browse Source

remove old dev files

dev
BuildTools 3 years ago
parent
commit
d94ef88113
2 changed files with 0 additions and 75 deletions
  1. +0
    -48
      js/darkMode.js
  2. +0
    -27
      js/load.js

+ 0
- 48
js/darkMode.js View File

@@ -1,48 +0,0 @@
// Returns the color at an index, based on the current theme
function color_at (i) {
return COLORS[isDark ? 'dark' : 'light'][i];
}

// Sets the page's color to match the current theme
function render () {
var savedColors = JSON.parse(localStorage.colors || '[]');
body.className = (isDark ? 'dark' : 'light') + '-mode';

if (isOptionsPage) {
toggle.className = 'icon-' + (isDark ? 'sun' : 'moon');
colorInputs.forEach(function (input, i) {
input.value = savedColors[i] || color_at(i);
});
}
}

// Toggles the theme between 'light-mode' and 'dark-mode'
function toggle_theme () {
localStorage.darkMode = isDark = !isDark;
render();
}

// Color sets for each theme
var COLORS = {
dark: ['#3f3027', '#30273f', '#27303f', '#3f2730'],
light: ['#efe0d7', '#e0d7ef', '#d7e0ef', '#efd7e0'],
};

// Pull the saved theme preference from localStorage
var isDark = JSON.parse(localStorage.darkMode || false);

// DOM
var body = document.body;
var colorInputs = [].slice.call(document.querySelectorAll('.colorwrapper input'));

var isOptionsPage = colorInputs.length;

if (isOptionsPage)
var toggle = document.getElementById('dark-mode').querySelector('span');

// Set the page's color
render();

// Exports
placid.color_at = color_at;
placid.toggle_theme = toggle_theme;

+ 0
- 27
js/load.js View File

@@ -1,27 +0,0 @@
function loadjscssfile(filename, filetype){
if (filetype=="js"){
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
}
else if (filetype=="css"){
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
browser.storage.sync.get("mode", function(result){
switch(result.mode) {
case "light":
loadjscssfile("css/color.css", "css")
break
case "dark":
loadjscssfile("css/color-dark.css", "css")
break
default:
break
}
})

Loading…
Cancel
Save