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;
if(active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || active_page == 'catalog')
{
var i = 0 var i = 0
while(i<document.styleSheets.length) { while(i<document.styleSheets.length) {
var protAndHost = window.location.protocol + '//' + window.location.host var protAndHost = window.location.protocol + '//' + window.location.host
if(document.styleSheets[i].href == protAndHost + $('link[id="stylesheet"]').attr('href')) if(document.styleSheets[i].href == protAndHost + $('link[id="stylesheet"]').attr('href'))
{ {
var sheet = i var sheet = i
document.styleSheets[sheet].disabled = disableStyles
break 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());