Merge branch 'v3'

Conflicts:
	CHANGELOG.md
	LICENSE
	README.md
	builds/appchan-x.user.js
	builds/crx/icon16.png
	builds/crx/icon48.png
	builds/crx/manifest.json
	builds/crx/script.js
	latest.js
	package.json
	src/General/Config.coffee
	src/General/html/Features/QuickReply.html
	src/General/img/icon16.png
	src/General/img/icon48.png
	src/Miscellaneous/Emoji.coffee
	src/Posting/QR.captcha.coffee
	src/Posting/QR.coffee
This commit is contained in:
Zixaphir 2014-02-16 02:17:36 -07:00
commit d11b435134
67 changed files with 13386 additions and 119 deletions

View File

@ -1,5 +1,20 @@
### v2.8.9
*2014-02-09*
**Spittie**
- Add Twitter embedding
- Add .xpi for Firefox Mobile
- Add /biz/
- Add gfycat.com embedding
- Replace some icons with fontawesome
- Add Metro favicons (lel)
- Fix Chrome (aka copy from Appchan)
- Add option to load the captcha when you open a thread
- Add OpenSUSE emoji
- Fix Chrome (Maybe? Hopefully I haven't fucked everything)
- Add fgst.eu
- Add mawa.re
- Fix new captcha
- Add archive.installgentoo.com
- Upload images directly from urls
![Upload from url](src/General/img/changelog/1.3.6.gif)
### v2.8.8
*2014-01-30*

View File

@ -1,16 +1,16 @@
## Reporting bugs and suggestions
Reporting bugs:
Reporting bugs: (note that some of these links refer to Mayhem's 4chan X repo to avoid duplication of information resources. Bugs MUST be filed on [our issue tracker](https://github.com/zixaphir/appchan-x/issues), not Mayhem's)
1. Make sure both your **browser** and **4chan X** are up to date.<br>
1. Make sure both your **browser** and **Appchan X** are up to date.<br>
Only **Chrome**, **Firefox** and **Opera** are supported.<br>
**SRWare Iron**, **Firefox ESR**, **Pale Moon**, **Waterfox**, and other derivatives are not supported, use them at your own risk.
**SRWare Iron**, **Firefox ESR**, **Pale Moon**, **Waterfox**, and other derivatives are not supported, use them at your own risk. This means that issue reports made with these browsers will be ignored unless you're able to duplicate it on a supported browser.
2. Look at the list of [known problems and solutions](https://github.com/MayhemYDG/4chan-x/wiki/FAQ#known-problems).
3. Disable your other extensions & scripts to identify conflicts.
4. If your issue persists, open a [new issue](https://github.com/MayhemYDG/4chan-x/issues) with the following information:
4. If your issue persists, open a [new issue](https://github.com/zixaphir/appchan-x/issues) with the following information:
1. Precise steps to reproduce the problem, with the expected and actual results.
2. [Console errors](https://github.com/MayhemYDG/4chan-x/wiki/FAQ#console-errors), if any.
3. 4chan X version, browser variant, browser version, and Greasemonkey version if you are using it.
3. Appchan X version, browser variant, browser version, and Greasemonkey version if you are using it.
4. Your exported settings. If your settings contains sensible information (e.g. personas), edit the text file manually.
Respect these guidelines:
@ -25,9 +25,9 @@ Respect these guidelines:
- Install [node.js](http://nodejs.org/).
- Install [Grunt's CLI](http://gruntjs.com/) with `npm install -g grunt-cli`.
- Clone 4chan X.
- Clone Appchan X.
- `cd` into it.
- Install/Update 4chan X dependencies with `npm install`.
- Install/Update Appchan X dependencies with `npm install`.
### Build
@ -39,7 +39,7 @@ Respect these guidelines:
- Update the version with `grunt patch`, `grunt minor` or `grunt major`.
- Release with `grunt release`.
Note: this is only used to release new 4chan X versions, and is **not** needed or wanted in pull requests.
Note: this is only used to release new versions, and is **not** needed or wanted in pull requests.
### Contribute

View File

@ -1,5 +1,5 @@
/*
* appchan x - Version 2.8.9 - 2014-02-09
* appchan x - Version 2.8.9 - 2014-02-16
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -1,7 +1,5 @@
# Get Appchan X [HERE](http://zixaphir.github.io/appchan-x/).
## Reporting bugs and suggestions
1. Make sure both your **browser** and **Appchan X** are up to date.
2. Disable your other extensions & scripts to identify conflicts.
3. If your issue persists, open a [new issue](https://github.com/zixaphir/appchan-x/issues) with the following information:
@ -9,16 +7,14 @@
2. Console errors, if any.
3. Browser version.
4. Your exported settings. If your settings contains sensitive information (e.g. personas), edit the text file manually.
## If you have any problems, try resetting your 4chan X settings before calling me a faggot (but feel free to do so)
Open your console with:
- `Ctrl + Shift + J` on Chrome.
- `Ctrl + Shift + K` on Firefox.
- `Ctrl + Shift + O` on Opera.
## Development & Contribution
## Forking
### Get started
- Get started by reading through the [Help link](https://help.github.com/) on how to fork a Github project.
- Click the "Fork" button on this page.
- Install [node.js](http://nodejs.org/).
- Install [Grunt's CLI](http://gruntjs.com/) with `npm install -g grunt-cli`.
- Clone Appchan X.
@ -32,6 +28,6 @@ Open your console with:
### Contribute
- Edit the CoffeeScript sources.
- If the edits affect regular users, edit the changelog.
- Open a pull request.
- See (https://github.com/zixaphir/CONTRIBUTING.md).
Note: this is only used to release new versions, ignore as you see fit.

View File

@ -1,11 +1,11 @@
// ==UserScript==
// @name 4chan X
// @version 1.3.2
// @version 1.3.7
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
// @description Cross-browser userscript for maximum lurking on 4chan.
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
// @license MIT; https://github.com/Spittie/4chan-x/blob/master/LICENSE
// @match *://boards.4chan.org/*
// @match *://sys.4chan.org/*
// @match *://a.4cdn.org/*
@ -15,8 +15,9 @@
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @run-at document-start
// @updateURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.meta.js
// @downloadURL https://github.com/seaweedchan/4chan-x/raw/stable/builds/4chan-X.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// @updateURL https://github.com/Spittie/4chan-x/raw/stable/builds/4chan-X.meta.js
// @downloadURL https://github.com/Spittie/4chan-x/raw/stable/builds/4chan-X.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAF5JREFUeNrtkTESABAQxPD/R6tsE2dUGYUtFJvLDKf93KevHJAjpBorAQWSBIKqFASC4G0pCAkm4GfaEvgYXl0T6HBaE97f0vmnfYHbZOMLZCx9ISdKWwjOWZSC8GYm4SUGwfYgqI4AAAAASUVORK5CYII=
// ==/UserScript==

View File

@ -15,6 +15,7 @@
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @run-at document-start
// @updateURL https://github.com/zixaphir/appchan-x/raw/stable/builds/appchan-x.meta.js
// @downloadURL https://github.com/zixaphir/appchan-x/raw/stable/builds/appchan-x.user.js

File diff suppressed because one or more lines are too long

BIN
builds/crx.crx Normal file

Binary file not shown.

View File

@ -17,6 +17,8 @@
"homepage_url": "http://zixaphir.github.com/appchan-x/",
"minimum_chrome_version": "31",
"permissions": [
"storage"
"storage",
"http://*/",
"https://*/"
]
}

File diff suppressed because one or more lines are too long

BIN
builds/xpi/4chanx.xpi Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,62 @@
function GM_openInTab(_url) {
self.port.emit("GM_openInTab", _url);
return; // Should return the Window object
};
function GM_setValue(_name, _value) {
localStorage[_name] = _value;
return;
};
function GM_getValue(_name, _default) {
if (localStorage[_name] === null && _default === null) return null;
return (localStorage[_name] || _default);
};
function GM_deleteValue(_name) {
localStorage.removeItem(_name);
return;
};
function GM_listValues() {
return Object.keys(localStorage);
};
function GM_setClipboard(_text) {
self.port.emit("GM_setClipboard", _text);
};
//Deprecated
function GM_log(_message) {
console.log(_message);
return;
};
function GM_xmlhttpRequest(_details) {
//Ugly hack? Race condition? Memory leak?
_onload = _details.onload;
_context = _details.context;
self.port.emit("GM_xmlhttpRequest", _details);
};
self.port.on("callback_GM_xmlhttpRequest", function(_response) {
_response.context = _context;
_onload(_response);
});
function GM_addStyle(_css) {
self.port.emit("GM_addStyle", _css);
}
var GM_info = new Object();
GM_info.version = '1.15';
GM_info.scriptWillUpdate = true;
//To do
function GM_registerMenuCommand(_caption, _commandFunc, _accessKey) {
return;
}
self.port.on("load-userscript", function(_script) {
eval(_script);
});

0
builds/xpi/doc/main.md Normal file
View File

BIN
builds/xpi/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

BIN
builds/xpi/icon64.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

82
builds/xpi/lib/main.js Normal file
View File

@ -0,0 +1,82 @@
var data = require("sdk/self").data;
var Request = require("sdk/request").Request;
var tabs = require("sdk/tabs");
var system = require("sdk/system");
if (system.platform !== 'android') {
// Clipboard is not supported on Android
var clipboard = require("sdk/clipboard");
}
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: ["*.4chan.org", "*.4cdn.org"],
contentScriptFile: data.url("greaseshim.js"),
contentScriptWhen: "start",
onAttach: function(worker) {
worker.port.emit("load-userscript", data.load("4chan-X.user.js"));
//GM_openInTab
worker.port.on("GM_openInTab", function(url) {
tabs.open(url);
});
//GM_setClipboard
worker.port.on("GM_setClipboard", function(text) {
if (system.platform !== 'android') {
// Clipboard is not supported on Android
clipboard.set(text);
}
});
//GM_xmlhttpRequest
worker.port.on("GM_xmlhttpRequest", function(details) {
request = new Object();
request.url = details.url;
if (details.headers) {
request.headers = details.headers;
if (details.headers["Content-Type"]) {request.contentType = details.headers["Content-Type"]};
};
if (details.data) {request.content = encodeURIComponent(details.data)};
if (details.overrideMimeType) {request.overrideMimeType = details.overrideMimeType};
request.onComplete = function(response) {
response.finalUrl = details.url;
response.responseText = response.text;
for (var headerName in response.headers) {
_string = headerName + ": " + response.headers[headerName] + " \n";
response.responseHeaders += _string;
}
response.readyState = 4;
worker.port.emit("callback_GM_xmlhttpRequest", response);
}
xhr = Request(request);
switch(details.method){
case "GET":
xhr.get();
break;
case "POST":
xhr.post();
break;
case "HEAD":
xhr.head();
break;
case "PUT":
xhr.put();
break;
default: xhr.get();
}
});
//GM_addStyle
worker.port.on("GM_addStyle", function(css) {
tabs.activeTab.attach({
contentScript: "var style = document.createElement('style');" +
"style.type = 'text/css';" +
"style.innerHTML = '" + css + "';" +
"document.head.appendChild(style);"
});
});
}
});

9
builds/xpi/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "4chanx",
"title": "4chan X",
"id": "72DAF86E-9689-11E3-8BA3-F4B66188709B",
"description": "Adds various features to 4chan.",
"author": "Spittie",
"license": "MIT",
"version": "1.3.7"
}

View File

@ -0,0 +1,12 @@
var main = require("./main");
exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};
exports["test main async"] = function(assert, done) {
assert.pass("async Unit test running!");
done();
};
require("sdk/test").run(exports);

View File

@ -24,8 +24,8 @@ Redirect =
archives: [
name: "Foolz"
boards: ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"]
files: ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"]
boards: ["a", "biz","co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"]
files: ["a", "biz","gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"]
data:
domain: "archive.foolz.us"
http: false
@ -69,7 +69,7 @@ Redirect =
software: "foolfuuka"
,
name: "Love is Over"
boards: ["d", "i"],
boards: ["d", "i"]
files: ["d", "i"]
data:
domain: "loveisover.me"
@ -112,15 +112,15 @@ Redirect =
software: "fuuka"
,
name: "fgts"
boards: ["soc"]
files: ["soc"]
boards: ["r", "soc"]
files: ["r", "soc"]
data:
domain: "fgts.eu"
domain: "fgst.eu"
http: true
https: true
software: "foolfuuka"
,
name: "maware"
name: "maware"
boards: ["t"]
files: ["t"]
data:
@ -137,8 +137,8 @@ Redirect =
software: "foolfuuka"
,
name: "Foolz Beta"
boards: ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"]
boards: ["a", "co", "gd", "jp", "m", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"]
data:
domain: "beta.foolz.us"
http: true

View File

@ -295,6 +295,10 @@ Config =
false
'Position of the QR\'s Dump List.'
]
'Auto-load captcha': [
false
'Automatically load the captcha when you open a thread'
]
'Quote Links':
'Quote Backlinks': [

View File

@ -803,6 +803,7 @@ span.hide-announcement {
}
#qr select,
#dump-button,
#url-button,
.remove,
.captcha-img {
cursor: pointer;
@ -857,6 +858,14 @@ span.hide-announcement {
padding: 1px 0px 2px;
opacity: 0.6;
}
#url-button {
width: 10%;
margin: 0;
margin-right: 4px;
font: 13px sans-serif;
padding: 1px 0px 2px;
opacity: 0.6;
}
.persona .field:not(#dump) {
width: 95px;
min-width: 33.3%;
@ -884,7 +893,7 @@ input.field.tripped:not(:hover):not(:focus) {
min-height: 59px;
min-width: 302px;
}
.captcha-input {
.captcha-input{
width: 100%;
margin: 1px 0 0;
}
@ -961,7 +970,7 @@ input#qr-filename:not(.edit) {
right: 0px;
}
#qr-filerm {
margin-right: 2px;
margin-right: 3px;
z-index: 2;
}
#file-n-submit {

View File

@ -30,6 +30,8 @@
<input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70>
</label>
<span class=description>Spoiler</span>
<a id=url-button><i class="fa">\uf0c1</i></a>
<span class=description>Post from URL</span>
<a id=dump-button title='Dump list'>+</a>
<span class=description>Dump</span>
<a id=qr-filerm href=javascript:; title='Remove file' class=fa>\uf00d</a>
@ -43,4 +45,3 @@
<datalist id="list-name"></datalist>
<datalist id="list-email"></datalist>
<datalist id="list-sub"></datalist>

View File

@ -89,6 +89,7 @@
<option value=Mayhem>Mayhem</option>
<option value=4chanJS>4chanJS</option>
<option value=Original>Original</option>
<option value=Metro>Metro</option>
</select>
<span id=favicon-preview></span>
</fieldset>

BIN
src/General/img/changelog/1.1.18.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/General/img/changelog/1.2.0.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

BIN
src/General/img/emoji/SS-sage.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 565 B

BIN
src/General/img/emoji/arch.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 563 B

BIN
src/General/img/emoji/centos.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 556 B

BIN
src/General/img/emoji/fedora.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 627 B

BIN
src/General/img/emoji/freebsd.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 919 B

BIN
src/General/img/emoji/gentoo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 879 B

BIN
src/General/img/emoji/gnu.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 607 B

BIN
src/General/img/emoji/madotsuki.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 230 B

BIN
src/General/img/emoji/mint.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

BIN
src/General/img/emoji/ponyo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 883 B

BIN
src/General/img/emoji/rabite.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/General/img/emoji/sabayon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 829 B

BIN
src/General/img/emoji/trisquel.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 814 B

BIN
src/General/img/emoji/ubuntu.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

BIN
src/General/img/links/gist.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 667 B

BIN
src/General/img/links/installgentoo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 729 B

BIN
src/General/img/links/liveleak.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 740 B

BIN
src/General/img/links/pastebin.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 839 B

BIN
src/General/img/links/vimeo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 307 B

View File

@ -17,6 +17,8 @@
"homepage_url": "<%= meta.page %>",
"minimum_chrome_version": "<%= meta.min.chrome %>",
"permissions": [
"storage"
"storage",
"http://*/",
"https://*/"
]
}

View File

@ -16,6 +16,7 @@
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @run-at document-start
// @updateURL <%= meta.repo %>raw/stable/builds/<%= meta.files.metajs %>
// @downloadURL <%= meta.repo %>raw/stable/builds/<%= meta.files.userjs %>

View File

@ -284,6 +284,12 @@ Linkify =
el: (a) ->
$.el 'iframe',
src: "http://paste.installgentoo.com/view/embed/#{a.dataset.uid}"
Twitter:
regExp: /.*twitter.com\/(.+\/status\/\d+)/
el: (a) ->
$.el 'iframe',
src: "https://twitframe.com/show?url=https://twitter.com/#{a.dataset.uid}"
LiveLeak:
regExp: /.*(?:liveleak.com\/view.+i=)([0-9a-z_]+)/
@ -334,6 +340,12 @@ Linkify =
div = $.el 'iframe',
src: "http://pastebin.com/embed_iframe.php?i=#{a.dataset.uid}"
gfycat:
regExp: /.*gfycat.com\/(?:iframe\/)?(\S*)/
el: (a) ->
div = $.el 'iframe',
src: "http://gfycat.com/iframe/#{a.dataset.uid}"
SoundCloud:
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/
style: 'height: auto; width: 500px; display: inline-block;'

View File

@ -41,6 +41,14 @@ Favicon =
'<%= grunt.file.read("src/General/img/favicons/Original/unreadNSFW.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Original/unreadNSFWY.png", {encoding: "base64"}) %>'
]
'Metro': [
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadDead.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadDeadY.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadSFW.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadSFWY.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadNSFW.png", {encoding: "base64"}) %>'
'<%= grunt.file.read("src/General/img/favicons/Metro/unreadNSFWY.png", {encoding: "base64"}) %>'
]
}[Conf['favicon']]
f = Favicon
@ -48,9 +56,10 @@ Favicon =
i = 0
while items[i]
items[i] = t + items[i++]
[f.unreadDead, funreadDeadY, f.unreadSFW, f.unreadSFWY, f.unreadNSFW, f.unreadNSFWY] = items
f.update()
update: ->
if @SFW
@unread = @unreadSFW

View File

@ -7,16 +7,19 @@ QR.captcha =
imgContainer = $.el 'div',
className: 'captcha-img'
title: 'Reload reCAPTCHA'
innerHTML: '<img>'
innerHTML: '<div><img></div>'
hidden: true
input = $.el 'input',
className: 'captcha-input field'
title: 'Verification'
placeholder: 'Focus to load reCAPTCHA'
autocomplete: 'off'
spellcheck: false
tabIndex: 45
@nodes =
img: imgContainer.firstChild
img: $ 'img', imgContainer
input: input
$.on input, 'focus', @setup
@ -26,13 +29,14 @@ QR.captcha =
$.addClass QR.nodes.el, 'has-captcha'
$.after QR.nodes.com.parentNode, [imgContainer, input]
@setupObserver = new MutationObserver @afterSetup
@setupObserver.observe container, childList: true
@setup() if Conf['Auto-load captcha']
@afterSetup() # reCAPTCHA might have loaded before the QR.
setup: ->
$.globalEval 'loadRecaptcha()'
setup: -> $.globalEval 'loadRecaptcha()'
afterSetup: ->
return unless challenge = $.id 'recaptcha_challenge_field_holder'
@ -45,7 +49,7 @@ QR.captcha =
$.off window, 'captcha:timeout', setLifetime
{img, input} = QR.captcha.nodes
img.parentNode.hidden = false
img.parentNode.parentNode.hidden = false
$.off input, 'focus', QR.captcha.setup
$.on input, 'keydown', QR.captcha.keydown.bind QR.captcha
$.on img.parentNode, 'click', QR.captcha.reload.bind QR.captcha
@ -90,6 +94,7 @@ QR.captcha =
$.set 'captchas', @captchas
clear: ->
return unless @captchas.length
now = Date.now()
for captcha, i in @captchas
break if captcha.timeout > now
@ -109,7 +114,7 @@ QR.captcha =
@clear()
count: ->
count = @captchas.length
count = if @captchas then @captchas.length else 0
@nodes.input.placeholder = switch count
when 0
'Verification (Shift + Enter to cache)'

View File

@ -112,11 +112,8 @@ QR =
QR.cooldown.auto = false
QR.status()
focusin: ->
$.addClass QR.nodes.el, 'focus'
focusout: ->
$.rmClass QR.nodes.el, 'focus'
focusin: -> $.addClass QR.nodes.el, 'focus'
focusout: -> $.rmClass QR.nodes.el, 'focus'
hide: ->
d.activeElement.blur()
@ -271,6 +268,69 @@ QR =
QR.open()
QR.handleFiles files
$.addClass QR.nodes.el, 'dump'
handleBlob: (blob) ->
return if blob.type is null
QR.error "Unsupported file type."
return unless blob.type in QR.mimeTypes
QR.error "Unsupported file type."
QR.handleFiles([blob])
handleUrl: ->
url = prompt("Insert an url:")
return if url is null
<% if (type === 'crx') { %>
xhr = new XMLHttpRequest();
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = (e) ->
if @readyState is @DONE && xhr.status is 200
urlBlob = new Blob([@response], {type : @getResponseHeader('content-type')})
urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length)
QR.handleBlob(urlBlob)
return
else
QR.error "Can't load image."
return
xhr.onerror = (e) ->
QR.error "Can't load image."
return
xhr.send()
return
<% } %>
<% if (type === 'userscript') { %>
GM_xmlhttpRequest {
method: "GET",
url: url,
overrideMimeType: "text/plain; charset=x-user-defined",
onload: (xhr) ->
r = xhr.responseText
data = new Uint8Array(r.length)
i = 0
while i < r.length
data[i] = r.charCodeAt(i)
i++
#QUALITY coding at work
header = xhr.responseHeaders
start = header.indexOf("Content-Type: ") + 14
end = header.substr(start, header.length).indexOf("\n") - 1
mime = header.substr(start, end)
return if mime is null
urlBlob = new Blob([data], {type: mime})
urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length)
QR.handleBlob(urlBlob)
return
onerror: (xhr) ->
QR.error "Can't load image."
}
return
<% } %>
handleFiles: (files) ->
if @ isnt QR # file input
@ -349,6 +409,7 @@ QR =
close: '.close'
form: 'form'
dumpButton: '#dump-button'
urlButton: '#url-button'
name: '[data-name=name]'
email: '[data-name=email]'
sub: '[data-name=sub]'
@ -419,6 +480,7 @@ QR =
$.on nodes.autohide, 'change', QR.toggleHide
$.on nodes.close, 'click', QR.close
$.on nodes.dumpButton, 'click', -> nodes.el.classList.toggle 'dump'
$.on nodes.urlButton, 'click', QR.handleUrl
$.on nodes.addPost, 'click', -> new QR.post true
$.on nodes.form, 'submit', QR.submit
$.on nodes.filename, 'blur', -> $.rmClass @, 'edit'

View File

@ -266,4 +266,4 @@ QR.post = class
(if oldIndex < newIndex then $.after else $.before) @, el
post = QR.posts.splice(oldIndex, 1)[0]
QR.posts.splice newIndex, 0, post
QR.status()
QR.status()