Fix appchan not applying styling to non-board pages.

This commit is contained in:
Zixaphir 2014-03-08 17:18:02 -07:00
parent 1a7d266cc8
commit 93b8e75cd6
7 changed files with 40 additions and 12 deletions

View File

@ -6,6 +6,7 @@
// @namespace zixaphir
// @description The most comprehensive 4chan userscript.
// @license MIT; https://github.com/zixaphir/appchan-x/blob/master/LICENSE
// @match *://*.4chan.org/*
// @match *://boards.4chan.org/*
// @match *://sys.4chan.org/*
// @match *://a.4cdn.org/*

View File

@ -7,6 +7,7 @@
// @namespace zixaphir
// @description The most comprehensive 4chan userscript.
// @license MIT; https://github.com/zixaphir/appchan-x/blob/master/LICENSE
// @match *://*.4chan.org/*
// @match *://boards.4chan.org/*
// @match *://sys.4chan.org/*
// @match *://a.4cdn.org/*
@ -14134,11 +14135,18 @@
}
},
remStyle: function() {
var item, _i, _len, _ref;
_ref = [$('[title="switch"]', d.head), $('[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', d.head), $.id('base-css'), $.id('mobile-css')];
var item, _i, _j, _len, _len1, _ref, _ref1;
_ref = ['[title="switch"]', '[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', '#base-css', '#mobile-css'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
if (item) {
if (item = $(item, d.head)) {
item.disabled = true;
}
}
if (g.VIEW === 'home') {
_ref1 = $$('[rel="stylesheet"], style[type="text/css"]', d.head);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
item = _ref1[_j];
item.disabled = true;
}
}
@ -17698,7 +17706,9 @@
switch (location.hostname) {
case '4chan.org':
case 'www.4chan.org':
g.TYPE = 'sfw';
g.VIEW = 'home';
Main.setThemeString();
Style.init();
return;
case 'a.4cdn.org':

View File

@ -10,7 +10,7 @@
},
"content_scripts": [{
"js": ["script.js"],
"matches": ["*://boards.4chan.org/*","*://sys.4chan.org/*","*://a.4cdn.org/*","*://i.4cdn.org/*"],
"matches": ["*://*.4chan.org/*","*://boards.4chan.org/*","*://sys.4chan.org/*","*://a.4cdn.org/*","*://i.4cdn.org/*"],
"all_frames": true,
"run_at": "document_start"
}],

View File

@ -14153,11 +14153,18 @@
}
},
remStyle: function() {
var item, _i, _len, _ref;
_ref = [$('[title="switch"]', d.head), $('[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', d.head), $.id('base-css'), $.id('mobile-css')];
var item, _i, _j, _len, _len1, _ref, _ref1;
_ref = ['[title="switch"]', '[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', '#base-css', '#mobile-css'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
if (item) {
if (item = $(item, d.head)) {
item.disabled = true;
}
}
if (g.VIEW === 'home') {
_ref1 = $$('[rel="stylesheet"], style[type="text/css"]', d.head);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
item = _ref1[_j];
item.disabled = true;
}
}
@ -17710,7 +17717,9 @@
switch (location.hostname) {
case '4chan.org':
case 'www.4chan.org':
g.TYPE = 'sfw';
g.VIEW = 'home';
Main.setThemeString();
Style.init();
return;
case 'a.4cdn.org':

View File

@ -10,6 +10,7 @@
"buildsPath": "builds/",
"mainBranch": "master",
"matches": [
"*://*.4chan.org/*",
"*://boards.4chan.org/*",
"*://sys.4chan.org/*",
"*://a.4cdn.org/*",

View File

@ -70,7 +70,9 @@ Main =
switch location.hostname
when '4chan.org', 'www.4chan.org'
g.TYPE = 'sfw'
g.VIEW = 'home'
Main.setThemeString()
Style.init()
return
when 'a.4cdn.org'

View File

@ -62,12 +62,17 @@ Style =
remStyle: ->
for item in [
$('[title="switch"]', d.head)
$('[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', d.head)
$.id('base-css')
$.id('mobile-css')
'[title="switch"]'
'[href="//s.4cdn.org/css/yotsubluemobile.540.css"]'
'#base-css'
'#mobile-css'
]
item.disabled = true if item
item.disabled = true if item = $ item, d.head
if g.VIEW is 'home'
for item in $$ '[rel="stylesheet"], style[type="text/css"]', d.head
item.disabled = true
return
generateFilter: (id, values) -> """<%= grunt.file.read('src/General/html/Features/Filters.svg').replace(/>\s+</g, '><') %>"""