Disable, don't remove. Should fix #446, for real this time

This might actually be more efficient.
This commit is contained in:
Zixaphir 2013-08-30 15:24:41 -07:00
parent 2cb40a7f75
commit 583a140eab
4 changed files with 26 additions and 67 deletions

View File

@ -1,5 +1,5 @@
/* /*
* appchan x - Version 2.3.8 - 2013-08-25 * appchan x - Version 2.3.8 - 2013-08-30
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -20,7 +20,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.3.8 - 2013-08-25 * appchan x - Version 2.3.8 - 2013-08-30
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12557,30 +12557,19 @@
Style.padding(); Style.padding();
Style.iconPositions(); Style.iconPositions();
if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) { if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) {
$.on(exLink, "click", function() { return $.on(exLink, "click", function() {
return setTimeout(Rice.nodes, 100); return setTimeout(Rice.nodes, 100);
}); });
} }
if (g.VIEW === 'catalog') {
if (!$.id('threads').children.length) {
return setTimeout((function() {
return $.globalEval('fourcat.init(); fourcat.loadCatalog(catalog);');
}), 1000);
}
}
}, },
observe: function() { observe: function() {
var onMutationObserver; var onMutationObserver;
if (window.MutationObserver) { Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper); return Style.observer.observe(d.head, {
return Style.observer.observe(d.head, { childList: true,
childList: true, subtree: true
subtree: true });
});
} else {
return $.on(d.head, 'DOMNodeInserted', Style.wrapper);
}
}, },
wrapper: function() { wrapper: function() {
var first; var first;
@ -12590,11 +12579,7 @@
}; };
Style.remStyle(first); Style.remStyle(first);
if (d.readyState === 'complete') { if (d.readyState === 'complete') {
if (Style.observer) { return Style.observer.disconnect();
return Style.observer.disconnect();
} else {
return $.off(d, 'DOMNodeInserted', Style.wrapper);
}
} }
}, },
remStyle: function(_arg) { remStyle: function(_arg) {
@ -12607,7 +12592,7 @@
if (node.nodeName === 'STYLE' && node.id || !['LINK', 'STYLE'].contains(node.nodeName) || node.rel && (!/stylesheet/.test(node.rel) || /flags.*\.css$/.test(href = node.href) || href.slice(0, 4) === 'data') || /\.typeset/.test(node.textContent)) { if (node.nodeName === 'STYLE' && node.id || !['LINK', 'STYLE'].contains(node.nodeName) || node.rel && (!/stylesheet/.test(node.rel) || /flags.*\.css$/.test(href = node.href) || href.slice(0, 4) === 'data') || /\.typeset/.test(node.textContent)) {
continue; continue;
} }
$.rm(node); node.disabled = true;
} }
}, },
matrix: function(foreground, background) { matrix: function(foreground, background) {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* appchan x - Version 2.3.8 - 2013-08-25 * appchan x - Version 2.3.8 - 2013-08-30
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12551,30 +12551,19 @@
Style.padding(); Style.padding();
Style.iconPositions(); Style.iconPositions();
if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) { if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) {
$.on(exLink, "click", function() { return $.on(exLink, "click", function() {
return setTimeout(Rice.nodes, 100); return setTimeout(Rice.nodes, 100);
}); });
} }
if (g.VIEW === 'catalog') {
if (!$.id('threads').children.length) {
return setTimeout((function() {
return $.globalEval('fourcat.init(); fourcat.loadCatalog(catalog);');
}), 1000);
}
}
}, },
observe: function() { observe: function() {
var onMutationObserver; var onMutationObserver;
if (window.MutationObserver) { Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper); return Style.observer.observe(d.head, {
return Style.observer.observe(d.head, { childList: true,
childList: true, subtree: true
subtree: true });
});
} else {
return $.on(d.head, 'DOMNodeInserted', Style.wrapper);
}
}, },
wrapper: function() { wrapper: function() {
var first; var first;
@ -12584,11 +12573,7 @@
}; };
Style.remStyle(first); Style.remStyle(first);
if (d.readyState === 'complete') { if (d.readyState === 'complete') {
if (Style.observer) { return Style.observer.disconnect();
return Style.observer.disconnect();
} else {
return $.off(d, 'DOMNodeInserted', Style.wrapper);
}
} }
}, },
remStyle: function(_arg) { remStyle: function(_arg) {
@ -12601,7 +12586,7 @@
if (node.nodeName === 'STYLE' && node.id || !['LINK', 'STYLE'].contains(node.nodeName) || node.rel && (!/stylesheet/.test(node.rel) || /flags.*\.css$/.test(href = node.href) || href.slice(0, 4) === 'data') || /\.typeset/.test(node.textContent)) { if (node.nodeName === 'STYLE' && node.id || !['LINK', 'STYLE'].contains(node.nodeName) || node.rel && (!/stylesheet/.test(node.rel) || /flags.*\.css$/.test(href = node.href) || href.slice(0, 4) === 'data') || /\.typeset/.test(node.textContent)) {
continue; continue;
} }
$.rm(node); node.disabled = true;
} }
}, },
matrix: function(foreground, background) { matrix: function(foreground, background) {

View File

@ -67,30 +67,19 @@ Style =
if exLink = $ "#navtopright .exlinksOptionsLink", d.body if exLink = $ "#navtopright .exlinksOptionsLink", d.body
$.on exLink, "click", -> $.on exLink, "click", ->
setTimeout Rice.nodes, 100 setTimeout Rice.nodes, 100
if g.VIEW is 'catalog'
unless $.id('threads').children.length
# Race conditions
setTimeout (-> $.globalEval 'fourcat.init(); fourcat.loadCatalog(catalog);'), 1000
observe: -> observe: ->
if window.MutationObserver Style.observer = new MutationObserver onMutationObserver = Style.wrapper
Style.observer = new MutationObserver onMutationObserver = Style.wrapper Style.observer.observe d.head,
Style.observer.observe d.head, childList: true
childList: true subtree: true
subtree: true
else
$.on d.head, 'DOMNodeInserted', Style.wrapper
wrapper: -> wrapper: ->
first = {addedNodes: d.head.children} first = {addedNodes: d.head.children}
Style.remStyle(first) Style.remStyle first
if d.readyState is 'complete' if d.readyState is 'complete'
if Style.observer Style.observer.disconnect()
Style.observer.disconnect()
else
$.off d, 'DOMNodeInserted', Style.wrapper
remStyle: ({addedNodes}) -> remStyle: ({addedNodes}) ->
i = addedNodes.length i = addedNodes.length
@ -101,7 +90,7 @@ Style =
!['LINK', 'STYLE'].contains(node.nodeName) or !['LINK', 'STYLE'].contains(node.nodeName) or
node.rel and ((!/stylesheet/.test(node.rel) or /flags.*\.css$/.test(href = node.href) or href[..3] is 'data')) or node.rel and ((!/stylesheet/.test(node.rel) or /flags.*\.css$/.test(href = node.href) or href[..3] is 'data')) or
/\.typeset/.test node.textContent /\.typeset/.test node.textContent
$.rm node node.disabled = true
return return
matrix: (foreground, background) -> matrix: (foreground, background) ->