Don't affect 404/error pages.

This commit is contained in:
Nicolas Stepien 2013-02-17 20:15:25 +01:00
parent a20d9f7e8b
commit bbd96ad959
5 changed files with 30 additions and 18 deletions

View File

@ -97,7 +97,7 @@
'Auto Watch Reply': [false, 'Automatically watch threads you reply to.'] 'Auto Watch Reply': [false, 'Automatically watch threads you reply to.']
}, },
Posting: { Posting: {
'Quick Reply': [true, 'WMD.'], 'Quick Reply': [true, 'Weapon of mass destruction.'],
'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'],
'Auto Hide QR': [false, 'Automatically hide the quick reply when posting.'], 'Auto Hide QR': [false, 'Automatically hide the quick reply when posting.'],
'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'],
@ -1020,6 +1020,9 @@
$.asap((function() { $.asap((function() {
return d.body; return d.body;
}), function() { }), function() {
if ($('link[href*="favicon-status.ico"]', d.head)) {
return;
}
return $.prepend(d.body, Header.headerEl); return $.prepend(d.body, Header.headerEl);
}); });
return $.asap((function() { return $.asap((function() {
@ -4738,15 +4741,9 @@
$.on(d, 'dragover', QR.dragOver); $.on(d, 'dragover', QR.dragOver);
$.on(d, 'drop', QR.dropFile); $.on(d, 'drop', QR.dropFile);
$.on(d, 'dragstart dragend', QR.drag); $.on(d, 'dragstart dragend', QR.drag);
$.on(d, '4chanXInitFinished', function() { if (Conf['Persistent QR']) {
if (!Conf['Persistent QR']) { $.on(d, '4chanXInitFinished', QR.persist);
return; }
}
QR.open();
if (Conf['Auto Hide QR']) {
return QR.hide();
}
});
$.on(d, 'ThreadUpdate', function() { $.on(d, 'ThreadUpdate', function() {
if (g.DEAD) { if (g.DEAD) {
return QR.abort(); return QR.abort();
@ -4762,6 +4759,12 @@
node: function() { node: function() {
return $.on($('a[title="Quote this post"]', this.nodes.info), 'click', QR.quote); return $.on($('a[title="Quote this post"]', this.nodes.info), 'click', QR.quote);
}, },
persist: function() {
QR.open();
if (Conf['Auto Hide QR']) {
return QR.hide();
}
},
open: function() { open: function() {
if (QR.el) { if (QR.el) {
QR.el.hidden = false; QR.el.hidden = false;
@ -6091,6 +6094,9 @@
}, },
initStyle: function() { initStyle: function() {
var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref; var MutationObserver, mainStyleSheet, observer, setStyle, style, styleSheets, _ref;
if ($('link[href*="favicon-status.ico"]', d.head)) {
return;
}
if ((_ref = $('link[href*=mobile]', d.head)) != null) { if ((_ref = $('link[href*=mobile]', d.head)) != null) {
_ref.disabled = true; _ref.disabled = true;
} }

View File

@ -42,7 +42,7 @@ Config =
'Auto Watch': [true, 'Automatically watch threads you start.'] 'Auto Watch': [true, 'Automatically watch threads you start.']
'Auto Watch Reply': [false, 'Automatically watch threads you reply to.'] 'Auto Watch Reply': [false, 'Automatically watch threads you reply to.']
Posting: Posting:
'Quick Reply': [true, 'WMD.'] 'Quick Reply': [true, 'Weapon of mass destruction.']
'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.']
'Auto Hide QR': [false, 'Automatically hide the quick reply when posting.'] 'Auto Hide QR': [false, 'Automatically hide the quick reply when posting.']
'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.']

View File

@ -46,6 +46,9 @@ Header =
order: 105 order: 105
$.asap (-> d.body), -> $.asap (-> d.body), ->
if $ 'link[href*="favicon-status.ico"]', d.head
# 404 error page or similar.
return
$.prepend d.body, Header.headerEl $.prepend d.body, Header.headerEl
$.asap (-> $.id 'boardNavDesktop'), @setBoardList $.asap (-> $.id 'boardNavDesktop'), @setBoardList

View File

@ -350,6 +350,9 @@ Main =
$.ready Main.initReady $.ready Main.initReady
initStyle: -> initStyle: ->
if $ 'link[href*="favicon-status.ico"]', d.head
# 404 error page or similar.
return
# disable the mobile layout # disable the mobile layout
$('link[href*=mobile]', d.head)?.disabled = true $('link[href*=mobile]', d.head)?.disabled = true
$.addClass doc, $.engine $.addClass doc, $.engine

View File

@ -25,13 +25,10 @@ QR =
el: link el: link
order: 10 order: 10
$.on d, 'dragover', QR.dragOver $.on d, 'dragover', QR.dragOver
$.on d, 'drop', QR.dropFile $.on d, 'drop', QR.dropFile
$.on d, 'dragstart dragend', QR.drag $.on d, 'dragstart dragend', QR.drag
$.on d, '4chanXInitFinished', -> $.on d, '4chanXInitFinished', QR.persist if Conf['Persistent QR']
return unless Conf['Persistent QR']
QR.open()
QR.hide() if Conf['Auto Hide QR']
$.on d, 'ThreadUpdate', -> $.on d, 'ThreadUpdate', ->
if g.DEAD if g.DEAD
QR.abort() QR.abort()
@ -45,6 +42,9 @@ QR =
node: -> node: ->
$.on $('a[title="Quote this post"]', @nodes.info), 'click', QR.quote $.on $('a[title="Quote this post"]', @nodes.info), 'click', QR.quote
persist: ->
QR.open()
QR.hide() if Conf['Auto Hide QR']
open: -> open: ->
if QR.el if QR.el
QR.el.hidden = false QR.el.hidden = false