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 // @namespace zixaphir
// @description The most comprehensive 4chan userscript. // @description The most comprehensive 4chan userscript.
// @license MIT; https://github.com/zixaphir/appchan-x/blob/master/LICENSE // @license MIT; https://github.com/zixaphir/appchan-x/blob/master/LICENSE
// @match *://*.4chan.org/*
// @match *://boards.4chan.org/* // @match *://boards.4chan.org/*
// @match *://sys.4chan.org/* // @match *://sys.4chan.org/*
// @match *://a.4cdn.org/* // @match *://a.4cdn.org/*

View File

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

View File

@ -10,7 +10,7 @@
}, },
"content_scripts": [{ "content_scripts": [{
"js": ["script.js"], "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, "all_frames": true,
"run_at": "document_start" "run_at": "document_start"
}], }],

View File

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

View File

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

View File

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

View File

@ -62,12 +62,17 @@ Style =
remStyle: -> remStyle: ->
for item in [ for item in [
$('[title="switch"]', d.head) '[title="switch"]'
$('[href="//s.4cdn.org/css/yotsubluemobile.540.css"]', d.head) '[href="//s.4cdn.org/css/yotsubluemobile.540.css"]'
$.id('base-css') '#base-css'
$.id('mobile-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 return
generateFilter: (id, values) -> """<%= grunt.file.read('src/General/html/Features/Filters.svg').replace(/>\s+</g, '><') %>""" generateFilter: (id, values) -> """<%= grunt.file.read('src/General/html/Features/Filters.svg').replace(/>\s+</g, '><') %>"""