theme and switcher changes to set main stylesheets to alt when overridden, so that extra rules can be added not just color

merge-requests/208/head
fatchan 5 years ago
parent 514ea1bbc3
commit 3785582a8a
  1. 2
      gulp/res/css/style.css
  2. 4
      gulp/res/css/themes/lain.css
  3. 3
      gulp/res/css/themes/yotsuba b.css
  4. 2
      gulp/res/js/post.js
  5. 6
      gulp/res/js/theme.js
  6. 2
      views/mixins/post.pug

@ -398,7 +398,7 @@ td, th {
.post-container, #float .post-container, .stickynav, .pages, .toggle-summary, .catalog-tile, .modal, #livetext, #threadstats {
background: var(--post-color);
border-width: 1px;/*0 1px 1px 0;*/
border-width: 0 1px 1px 0;
border-style: solid;
border-color: var(--post-outline-color);
}

@ -28,4 +28,6 @@
--title-color: #d70000;
--greentext-color: #B8D962;
}
.post-container, #float .post-container, .stickynav, .pages, .toggle-summary, .catalog-tile, .modal, #livetext, #threadstats {
border-width: 1px;
}

@ -28,6 +28,3 @@
--title-color: #d70000;
--greentext-color: green;
}
.post-container, #float .post-container, .stickynav, .pages, .toggle-summary, .catalog-tile, .modal, #livetext, #threadstats {
border-width: 0 1px 1px 0;
}

@ -64,7 +64,7 @@ pug_html = pug_html + "\u003Cspan" + (" class=\"user-id\""+pug_attr("style", pug
}
pug_html = pug_html + "\u003C\u002Flabel\u003E\u003Cspan class=\"post-links\"\u003E\u003Ca" + (" class=\"noselect no-decoration\""+pug_attr("href", `${postURL}#${post.postId}`, true, false)) + "\u003ENo.\u003C\u002Fa\u003E\u003Cspan class=\"post-quoters\"\u003E\u003Ca" + (" class=\"no-decoration\""+pug_attr("href", `${postURL}#postform`, true, false)) + "\u003E" + (pug_escape(null == (pug_interp = post.postId) ? "" : pug_interp)) + "\u003C\u002Fa\u003E";
if (!post.thread) {
pug_html = pug_html + " \u003Cspan\u003E\u003Ca" + (pug_attr("href", `${postURL}#postform`, true, false)) + "\u003E[Reply]\u003C\u002Fa\u003E\u003C\u002Fspan\u003E";
pug_html = pug_html + " \u003Cspan class=\"noselect\"\u003E\u003Ca" + (pug_attr("href", `${postURL}#postform`, true, false)) + "\u003E[Reply]\u003C\u002Fa\u003E\u003C\u002Fspan\u003E";
}
pug_html = pug_html + "\u003C\u002Fspan\u003E \u003Cselect class=\"jsonly postmenu\"\u003E\u003Coption\u003EHide\u003C\u002Foption\u003E";
if (post.userId) {

@ -1,4 +1,4 @@
function changeTheme(e, type) {
async function changeTheme(e, type) {
//is this the initial load, or an event from changing theme dropdown
if (!type) {
type = this.id === 'theme-changer' ? 'theme' : 'codetheme';
@ -12,7 +12,10 @@ function changeTheme(e, type) {
setLocalStorage(type, theme);
//check for theme style tag
let tempLink = document.getElementById(`custom${type}`);
let defaultLink = document.getElementById(type);
if (theme === 'default') {
defaultLink.rel = 'stylesheet';
await new Promise(resolve => { setTimeout(resolve, 100) });//ew
if (tempLink) {
//remove theme style tag if we switching to default
tempLink.remove();
@ -31,6 +34,7 @@ function changeTheme(e, type) {
//if we have the css in localstorage, set it (prevents FOUC)
tempLink.innerHTML = css;
}
defaultLink.rel = 'alternate stylesheet';
//then createa new link rel=stylesheet, and load the css
const themeLink = document.createElement('link');
themeLink.rel = 'stylesheet';

@ -45,7 +45,7 @@ mixin post(post, truncate, manage=false, globalmanage=false, ban=false)
a.no-decoration(href=`${postURL}#postform`) #{post.postId}
if !post.thread
|
span: a(href=`${postURL}#postform`) [Reply]
span.noselect: a(href=`${postURL}#postform`) [Reply]
|
select.jsonly.postmenu
option Hide

Loading…
Cancel
Save