Clean Dark theme code

pull/1/head
yflory 4 years ago
parent 4ce311216f
commit 49a844125c

@ -119,13 +119,13 @@ define([
}); });
var doXHR = lessEngine.FileManager.prototype.doXHR; var doXHR = lessEngine.FileManager.prototype.doXHR;
lessEngine.FileManager.prototype.doXHR = function (url, type, callback, errback) { lessEngine.FileManager.prototype.doXHR = function (url, type, callback, errback) {
console.error(url, COLORTHEME); // XXX //console.error(url, COLORTHEME);
var col = false; var col = false;
var _url = url; var _url = url;
if (url === COLORTHEME) { if (url === COLORTHEME) {
col = true; col = true;
url = getColorthemeURL(); url = getColorthemeURL();
console.warn(url); //console.warn(url);
} }
url = fixURL(url); url = fixURL(url);
var cached = tempCache[_url]; var cached = tempCache[_url];
@ -137,7 +137,7 @@ define([
cached = tempCache[_url] = { queue: [ callback ], res: undefined }; cached = tempCache[_url] = { queue: [ callback ], res: undefined };
return doXHR(url, type, function (text, lastModified) { return doXHR(url, type, function (text, lastModified) {
if (col) { if (col) {
console.warn(text, lastModified); //console.warn(text, lastModified);
if (getColortheme() === "custom") { if (getColortheme() === "custom") {
// XXX COLOR: append custom theme here // XXX COLOR: append custom theme here
var custom = [ var custom = [

@ -14,7 +14,6 @@ try {
var os = isDarkOS() ? 'dark' : 'light'; var os = isDarkOS() ? 'dark' : 'light';
var key = 'CRYPTPAD_STORE|colortheme'; var key = 'CRYPTPAD_STORE|colortheme';
window.CryptPad_theme = localStorage[key] || os; window.CryptPad_theme = localStorage[key] || os;
console.error(localStorage[key], os);
if (!localStorage[key]) { if (!localStorage[key]) {
// We're using OS theme, check if we need to change // We're using OS theme, check if we need to change
if (os !== localStorage[key+'_default']) { if (os !== localStorage[key+'_default']) {
@ -28,17 +27,6 @@ try {
s.innerHTML = 'body { background: black; }'; s.innerHTML = 'body { background: black; }';
document.body.appendChild(s); document.body.appendChild(s);
} }
//localStorage[key] = theme;
// If the wrong theme is built, flush it
/* XXX flush cache when change
if (theme !== built) {
console.warn('New theme, flush cache');
Object.keys(localStorage).forEach(function (k) {
if (k.indexOf('CRYPTPAD_CACHE|') !== 0 && k.indexOf('LESS_CACHE') !== 0) { return; }
delete localStorage[k];
});
}
*/
} catch (e) { console.error(e); } } catch (e) { console.error(e); }
})(); })();

@ -9,7 +9,6 @@ try {
s.innerHTML = 'body { background: black; }'; s.innerHTML = 'body { background: black; }';
document.body.appendChild(s); document.body.appendChild(s);
} }
console.error(theme, os);
} catch (e) { console.error(e); } } catch (e) { console.error(e); }
})(); })();

@ -423,7 +423,7 @@ define([
makeBlock('colortheme', function (cb) { makeBlock('colortheme', function (cb) {
var theme = window.cryptpadStore.store['colortheme'] || 'default'; var theme = window.cryptpadStore.store['colortheme'] || 'default';
var os = window.cryptpadStore.store['colortheme_default'] || 'light'; var os = window.cryptpadStore.store['colortheme_default'] || 'light';
var values = ['default', 'light', 'dark', 'custom']; var values = ['default', 'light', 'dark'/*, 'custom'*/];
var defaultTheme = Messages['settings_colortheme_'+os]; var defaultTheme = Messages['settings_colortheme_'+os];
var opts = h('div.cp-settings-radio-container', [ var opts = h('div.cp-settings-radio-container', [

Loading…
Cancel
Save