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.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -20,7 +20,7 @@
// ==/UserScript==
/*
* appchan x - Version 2.3.8 - 2013-08-25
* appchan x - Version 2.3.8 - 2013-08-30
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12557,30 +12557,19 @@
Style.padding();
Style.iconPositions();
if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) {
$.on(exLink, "click", function() {
return $.on(exLink, "click", function() {
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() {
var onMutationObserver;
if (window.MutationObserver) {
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
return Style.observer.observe(d.head, {
childList: true,
subtree: true
});
} else {
return $.on(d.head, 'DOMNodeInserted', Style.wrapper);
}
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
return Style.observer.observe(d.head, {
childList: true,
subtree: true
});
},
wrapper: function() {
var first;
@ -12590,11 +12579,7 @@
};
Style.remStyle(first);
if (d.readyState === 'complete') {
if (Style.observer) {
return Style.observer.disconnect();
} else {
return $.off(d, 'DOMNodeInserted', Style.wrapper);
}
return Style.observer.disconnect();
}
},
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)) {
continue;
}
$.rm(node);
node.disabled = true;
}
},
matrix: function(foreground, background) {

View File

@ -1,6 +1,6 @@
// 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.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -12551,30 +12551,19 @@
Style.padding();
Style.iconPositions();
if (exLink = $("#navtopright .exlinksOptionsLink", d.body)) {
$.on(exLink, "click", function() {
return $.on(exLink, "click", function() {
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() {
var onMutationObserver;
if (window.MutationObserver) {
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
return Style.observer.observe(d.head, {
childList: true,
subtree: true
});
} else {
return $.on(d.head, 'DOMNodeInserted', Style.wrapper);
}
Style.observer = new MutationObserver(onMutationObserver = Style.wrapper);
return Style.observer.observe(d.head, {
childList: true,
subtree: true
});
},
wrapper: function() {
var first;
@ -12584,11 +12573,7 @@
};
Style.remStyle(first);
if (d.readyState === 'complete') {
if (Style.observer) {
return Style.observer.disconnect();
} else {
return $.off(d, 'DOMNodeInserted', Style.wrapper);
}
return Style.observer.disconnect();
}
},
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)) {
continue;
}
$.rm(node);
node.disabled = true;
}
},
matrix: function(foreground, background) {

View File

@ -67,30 +67,19 @@ Style =
if exLink = $ "#navtopright .exlinksOptionsLink", d.body
$.on exLink, "click", ->
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: ->
if window.MutationObserver
Style.observer = new MutationObserver onMutationObserver = Style.wrapper
Style.observer.observe d.head,
childList: true
subtree: true
else
$.on d.head, 'DOMNodeInserted', Style.wrapper
Style.observer = new MutationObserver onMutationObserver = Style.wrapper
Style.observer.observe d.head,
childList: true
subtree: true
wrapper: ->
first = {addedNodes: d.head.children}
Style.remStyle(first)
Style.remStyle first
if d.readyState is 'complete'
if Style.observer
Style.observer.disconnect()
else
$.off d, 'DOMNodeInserted', Style.wrapper
Style.observer.disconnect()
remStyle: ({addedNodes}) ->
i = addedNodes.length
@ -101,7 +90,7 @@ Style =
!['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
/\.typeset/.test node.textContent
$.rm node
node.disabled = true
return
matrix: (foreground, background) ->