Copy more from Zixaphir and Mayhem, proper(?) fix for Chrome

This commit is contained in:
Kabir Sala 2014-02-10 04:45:04 +01:00
parent c9486b00ad
commit a7b2565e5b
11 changed files with 12766 additions and 47 deletions

View File

@ -1980,7 +1980,8 @@
args = bottom ? ['bottom-header', 'top-header', 'bottom', 'after'] : ['top-header', 'bottom-header', 'top', 'add'];
$.addClass(doc, args[0]);
$.rmClass(doc, args[1]);
return Header.bar.parentNode.className = args[2];
Header.bar.parentNode.className = args[2];
return $[args[3]](Header.bar, Header.noticesRoot);
},
toggleBarPosition: function() {
$.cb.checked.call(this);
@ -5486,15 +5487,10 @@
return QR.status();
},
focusin: function() {
return $.addClass(QR.nodes.el, 'has-focus');
return $.addClass(QR.nodes.el, 'focus');
},
focusout: function() {
return $.queueTask(function() {
if ($.x('ancestor::div[@id="qr"]', d.activeElement)) {
return;
}
return $.rmClass(QR.nodes.el, 'has-focus');
});
return $.rmClass(QR.nodes.el, 'focus');
},
hide: function() {
d.activeElement.blur();
@ -5823,8 +5819,6 @@
$.on(elm, 'blur', QR.focusout);
$.on(elm, 'focus', QR.focusin);
}
$.on(dialog, 'focusin', QR.focusin);
$.on(dialog, 'focusout', QR.focusout);
$.on(nodes.autohide, 'change', QR.toggleHide);
$.on(nodes.close, 'click', QR.close);
$.on(nodes.dumpButton, 'click', function() {
@ -6139,12 +6133,6 @@
input: input
};
$.on(input, 'focus', this.setup);
$.on(input, 'focus', function() {
return $.addClass(QR.nodes.el, 'focus');
});
$.on(input, 'blur', function() {
return $.rmClass(QR.nodes.el, 'focus');
});
$.on(input, 'blur', QR.focusout);
$.on(input, 'focus', QR.focusin);
$.addClass(QR.nodes.el, 'has-captcha');

BIN
builds/crx 1/icon128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

BIN
builds/crx 1/icon16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

BIN
builds/crx 1/icon48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View File

@ -0,0 +1,22 @@
{
"name": "4chan X",
"version": "1.3.4",
"manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"content_scripts": [{
"js": ["script.js"],
"matches": ["*://boards.4chan.org/*","*://sys.4chan.org/*","*://a.4cdn.org/*","*://i.4cdn.org/*"],
"all_frames": true,
"run_at": "document_start"
}],
"homepage_url": "http://seaweedchan.github.io/4chan-x/",
"minimum_chrome_version": "31",
"permissions": [
"storage"
]
}

12724
builds/crx 1/script.js Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1990,7 +1990,8 @@
args = bottom ? ['bottom-header', 'top-header', 'bottom', 'after'] : ['top-header', 'bottom-header', 'top', 'add'];
$.addClass(doc, args[0]);
$.rmClass(doc, args[1]);
return Header.bar.parentNode.className = args[2];
Header.bar.parentNode.className = args[2];
return $[args[3]](Header.bar, Header.noticesRoot);
},
toggleBarPosition: function() {
$.cb.checked.call(this);
@ -5490,10 +5491,10 @@
return QR.status();
},
focusin: function() {
return $.addClass(QR.nodes.el, 'has-focus');
return $.addClass(QR.nodes.el, 'focus');
},
focusout: function() {
return $.rmClass(QR.nodes.el, 'has-focus');
return $.rmClass(QR.nodes.el, 'focus');
},
hide: function() {
d.activeElement.blur();
@ -5760,7 +5761,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var check, dialog, event, flagSelector, i, items, key, mimeTypes, name, node, nodes, save, value, _ref;
var check, dialog, elm, event, flagSelector, i, items, key, mimeTypes, name, node, nodes, save, value, _ref;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30> </div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'>×</a><a id=dump-button title='Dump list'>+</a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist> ")
};
@ -5825,8 +5826,12 @@
$.add(nodes.form, nodes.flag);
}
$.on(nodes.filename.parentNode, 'click keydown', QR.openFileInput);
$.on(dialog, 'focusin', QR.focusin);
$.on(dialog, 'focusout', QR.focusout);
items = $$('*', QR.nodes.el);
i = 0;
while (elm = items[i++]) {
$.on(elm, 'blur', QR.focusout);
$.on(elm, 'focus', QR.focusin);
}
$.on(nodes.autohide, 'change', QR.toggleHide);
$.on(nodes.close, 'click', QR.close);
$.on(nodes.dumpButton, 'click', function() {
@ -6130,12 +6135,8 @@
input: input
};
$.on(input, 'focus', this.setup);
$.on(input, 'focus', function() {
return $.addClass(QR.nodes.el, 'focus');
});
$.on(input, 'blur', function() {
return $.rmClass(QR.nodes.el, 'focus');
});
$.on(input, 'blur', QR.focusout);
$.on(input, 'focus', QR.focusin);
$.addClass(QR.nodes.el, 'has-captcha');
$.after(QR.nodes.com.parentNode, [imgContainer, input]);
this.setupObserver = new MutationObserver(this.afterSetup);

View File

@ -330,7 +330,7 @@ Header =
$.addClass doc, args[0]
$.rmClass doc, args[1]
Header.bar.parentNode.className = args[2]
#$[args[3]] Header.bar, Header.notify ##Fix chrome?
$[args[3]] Header.bar, Header.noticesRoot
toggleBarPosition: ->
$.cb.checked.call @

View File

@ -21,14 +21,9 @@ QR.captcha =
input: input
$.on input, 'focus', @setup
$.on input, 'focus', -> $.addClass QR.nodes.el, 'focus'
$.on input, 'blur', -> $.rmClass QR.nodes.el, 'focus'
<% if (type === 'userscript') { %>
# XXX Firefox lacks focusin/focusout support.
$.on input, 'blur', QR.focusout
$.on input, 'focus', QR.focusin
<% } %>
$.addClass QR.nodes.el, 'has-captcha'
$.after QR.nodes.com.parentNode, [imgContainer, input]

View File

@ -114,15 +114,9 @@ QR =
QR.cooldown.auto = false
QR.status()
focusin: ->
$.addClass QR.nodes.el, 'has-focus'
$.addClass QR.nodes.el, 'focus'
focusout: ->
<% if (type === 'crx') { %>
$.rmClass QR.nodes.el, 'has-focus'
<% } else { %>
$.queueTask ->
return if $.x 'ancestor::div[@id="qr"]', d.activeElement
$.rmClass QR.nodes.el, 'has-focus'
<% } %>
$.rmClass QR.nodes.el, 'focus'
hide: ->
d.activeElement.blur()
$.addClass QR.nodes.el, 'autohide'
@ -409,16 +403,11 @@ QR =
$.on nodes.filename.parentNode, 'click keydown', QR.openFileInput
<% if (type === 'userscript') { %>
# XXX Firefox lacks focusin/focusout support.
items = $$ '*', QR.nodes.el
i = 0
while elm = items[i++]
$.on elm, 'blur', QR.focusout
$.on elm, 'focus', QR.focusin
<% } %>
$.on dialog, 'focusin', QR.focusin
$.on dialog, 'focusout', QR.focusout
$.on nodes.autohide, 'change', QR.toggleHide
$.on nodes.close, 'click', QR.close