only disable stylesheets on Applicable pages

This commit is contained in:
wholelotofhs 2014-11-20 14:50:01 -05:00
parent 7ac1ccf448
commit 8fa14518e2

View File

@ -4,17 +4,21 @@
var disableStyleSheet = function () { var disableStyleSheet = function () {
var disableStyles = localStorage['disablestylesheet'] ? true : false; var disableStyles = localStorage['disablestylesheet'] ? true : false;
var i = 0 if(active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || active_page == 'catalog')
while(i<document.styleSheets.length) { {
var protAndHost = window.location.protocol + '//' + window.location.host var i = 0
if(document.styleSheets[i].href == protAndHost + $('link[id="stylesheet"]').attr('href')) while(i<document.styleSheets.length) {
{ var protAndHost = window.location.protocol + '//' + window.location.host
var sheet = i if(document.styleSheets[i].href == protAndHost + $('link[id="stylesheet"]').attr('href'))
break {
var sheet = i
document.styleSheets[sheet].disabled = disableStyles
break
}
i++
} }
i++ }
};
document.styleSheets[sheet].disabled = disableStyles;
if (window.Options && Options.get_tab('general')){ if (window.Options && Options.get_tab('general')){
element = '#disablestyle' element = '#disablestyle'
event = 'change' event = 'change'
@ -29,7 +33,7 @@ var disableStyleSheet = function () {
localStorage.disablestylesheet = true; localStorage.disablestylesheet = true;
} }
disableStyles =! disableStyles; disableStyles =! disableStyles;
document.styleSheets[sheet].disabled = disableStyles; if(active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || active_page == 'catalog') document.styleSheets[sheet].disabled = disableStyles;
}) })
} }
$(document).ready(disableStyleSheet()); $(document).ready(disableStyleSheet());