Merge branch 'f0ckdev' into 'master'

autism™

See merge request !41
This commit is contained in:
Flummi 2016-11-17 06:01:19 +00:00
commit a85e018d33
5 changed files with 92 additions and 136 deletions

View File

@ -1,5 +1,5 @@
var load = false; var load = false;
$(()=>{ $(()=>{
$(window).scroll(()=>{ $(window).scroll(()=>{
if($(window).scrollTop() + $(window).height() >= $(document).height() - 130 && !load) { if($(window).scrollTop() + $(window).height() >= $(document).height() - 130 && !load) {
load = true; load = true;
@ -14,4 +14,4 @@
}); });
} }
}); });
}); });

View File

@ -1,4 +1,4 @@
function arrowKeys(e) { function arrowKeys(e) {
switch(e.keyCode) { switch(e.keyCode) {
case 39: case 39:
var prev = document.getElementById('prev'); var prev = document.getElementById('prev');
@ -9,10 +9,10 @@
if(next) next.click(); if(next) next.click();
break; break;
} }
} }
if(document.readyState == 'complete' || document.readyState == 'loaded') if(document.readyState == 'complete' || document.readyState == 'loaded')
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
else { else {
if(/Chrome/i.test(navigator.userAgent)) if(/Chrome/i.test(navigator.userAgent))
window.addEventListener('load', function () { window.addEventListener('load', function () {
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
@ -21,9 +21,6 @@
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
}); });
} }
if(x = document.getElementById("player"))
var x = document.getElementById("player");
if(x) {
x.volume = 0.3; x.volume = 0.3;
}

View File

@ -1,5 +1,4 @@
/* Thanks to StephenLynx, I modified his Theme Changer from the Penumbra Lynx Frontend for the Lynxchan Software https://gitgud.io/LynxChan/LynxChan and reused it to make f0ck a nicer place. */ /* Thanks to StephenLynx, I modified his Theme Changer from the Penumbra Lynx Frontend for the Lynxchan Software https://gitgud.io/LynxChan/LynxChan and reused it to make f0ck a nicer place. */
var themes = [ { var themes = [ {
file : 'cyber.css', file : 'cyber.css',
label : 'Cyber', label : 'Cyber',
@ -13,109 +12,69 @@ var themes = [ {
label : 'TERM', label : 'TERM',
id : 'TERM' id : 'TERM'
}]; }];
var customCss; var customCss;
var addedTheme; var addedTheme;
function updateCss() { function updateCss() {
if (addedTheme) { if (addedTheme) {
addedTheme.parentNode.removeChild(addedTheme); addedTheme.parentNode.removeChild(addedTheme);
addedTheme = null; addedTheme = null;
} }
for (var i = 0; i < themes.length; i++) { for (var i = 0; i < themes.length; i++) {
var theme = themes[i]; var theme = themes[i];
if (theme.id === localStorage.selectedTheme) { if (theme.id === localStorage.selectedTheme) {
addedTheme = theme.element; addedTheme = theme.element;
document.head.insertBefore(theme.element, customCss); document.head.insertBefore(theme.element, customCss);
} }
} }
} }
for (var i = 0; i < document.head.children.length; i++) {
for (var i = 0; i < document.head.children.length; i++) {
var element = document.head.children[i]; var element = document.head.children[i];
if (element.rel === 'stylesheet' && element.href.indexOf('/custom.css') > -1) {
if (element.rel === 'stylesheet'
&& element.href.indexOf('/custom.css') > -1) {
customCss = element; customCss = element;
break; break;
} }
}
} for (var i = 0; i < themes.length; i++) {
for (var i = 0; i < themes.length; i++) {
themes[i].element = document.createElement('link'); themes[i].element = document.createElement('link');
themes[i].element.type = 'text/css'; themes[i].element.type = 'text/css';
themes[i].element.rel = 'stylesheet'; themes[i].element.rel = 'stylesheet';
themes[i].element.href = './s/' + themes[i].file; themes[i].element.href = './s/' + themes[i].file;
} }
updateCss();
updateCss(); var postingLink = document.getElementById('themes');
if (postingLink) {
var postingLink = document.getElementById('themes');
if (postingLink) {
var divider = document.createElement('span'); var divider = document.createElement('span');
divider.innerHTML = ''; divider.innerHTML = '';
var referenceNode = postingLink.nextSibling; var referenceNode = postingLink.nextSibling;
postingLink.parentNode.insertBefore(divider, referenceNode); postingLink.parentNode.insertBefore(divider, referenceNode);
var themeSelector = document.createElement('select'); var themeSelector = document.createElement('select');
themeSelector.id = 'themeSelector'; themeSelector.id = 'themeSelector';
var vanillaOption = document.createElement('option'); var vanillaOption = document.createElement('option');
vanillaOption.innerHTML = 'Default'; vanillaOption.innerHTML = 'Default';
themeSelector.appendChild(vanillaOption); themeSelector.appendChild(vanillaOption);
for (i = 0; i < themes.length; i++) { for (i = 0; i < themes.length; i++) {
var theme = themes[i]; var theme = themes[i];
var themeOption = document.createElement('option'); var themeOption = document.createElement('option');
themeOption.innerHTML = theme.label; themeOption.innerHTML = theme.label;
if (theme.id === localStorage.selectedTheme) { if (theme.id === localStorage.selectedTheme) {
themeOption.selected = true; themeOption.selected = true;
} }
themeSelector.appendChild(themeOption); themeSelector.appendChild(themeOption);
} }
themeSelector.onchange = function() { themeSelector.onchange = function() {
if (!themeSelector.selectedIndex) { if (!themeSelector.selectedIndex) {
if (localStorage.selectedTheme) { if (localStorage.selectedTheme) {
delete localStorage.selectedTheme; delete localStorage.selectedTheme;
updateCss(); updateCss();
} }
return; return;
} }
var selectedTheme = themes[themeSelector.selectedIndex - 1]; var selectedTheme = themes[themeSelector.selectedIndex - 1];
if (selectedTheme.id === localStorage.selectedTheme) { if (selectedTheme.id === localStorage.selectedTheme) {
return; return;
} }
localStorage.selectedTheme = selectedTheme.id; localStorage.selectedTheme = selectedTheme.id;
updateCss(); updateCss();
}; };
postingLink.parentNode.insertBefore(themeSelector, referenceNode); postingLink.parentNode.insertBefore(themeSelector, referenceNode);
}
}