Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3
Conflicts: CHANGELOG.md Gruntfile.js LICENSE lib/$.coffee package.json src/banner.js src/config.coffee src/css/style.css src/features.coffee src/metadata.js
This commit is contained in:
commit
6cc5ac8dd2
@ -1,3 +1,7 @@
|
|||||||
|
mayhemydg:
|
||||||
|
- Minor fixes.
|
||||||
|
- Chrome only: Due to technical limitations, Filter lists and Custom CSS will not by synchronized across devices anymore.
|
||||||
|
|
||||||
seaweedchan:
|
seaweedchan:
|
||||||
- Allow thread watcher to load on catalog
|
- Allow thread watcher to load on catalog
|
||||||
|
|
||||||
@ -69,4 +73,4 @@ zixaphir:
|
|||||||
- Fix unread post count for filtered posts
|
- Fix unread post count for filtered posts
|
||||||
- Fix issues when switching from ihavenoface's fork
|
- Fix issues when switching from ihavenoface's fork
|
||||||
- Fix backlinks not receiving filtered class
|
- Fix backlinks not receiving filtered class
|
||||||
- Fix QR position not saving on refresh
|
- Fix QR position not saving on refresh
|
||||||
35
LICENSE
35
LICENSE
@ -1,11 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.1.0 - 2013-04-25
|
* 4chan X - Version 1.1.0 - 2013-04-26
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
*
|
*
|
||||||
* Appchan X Copyright © 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
|
||||||
* http://zixaphir.github.io/appchan-x/
|
|
||||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* https://github.com/aeosynth/4chan-x
|
* https://github.com/aeosynth/4chan-x
|
||||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
@ -14,12 +12,6 @@
|
|||||||
* http://seaweedchan.github.io/4chan-x/
|
* http://seaweedchan.github.io/4chan-x/
|
||||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||||
* http://ihavenoface.github.io/4chan-x/
|
* http://ihavenoface.github.io/4chan-x/
|
||||||
* OneeChan Copyright © 2011-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
* http://seaweedchan.github.io/oneechan/
|
|
||||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
|
||||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
|
||||||
* Raphael Icons Copyright © 2013 Dmitry Baranovskiy
|
|
||||||
* http://raphaeljs.com/icons/
|
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
@ -70,11 +62,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkify based on:
|
* Contains data from external sources:
|
||||||
* http://downloads.mozdev.org/greasemonkey/linkify.user.js
|
*
|
||||||
* https://github.com/MayhemYDG/LinkifyPlusFork
|
* audio/beep.wav from http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||||
|
* cc-by-nc-3.0
|
||||||
|
*
|
||||||
|
* 4chan/4chan-JS (https://github.com/4chan/4chan-JS)
|
||||||
|
* Copyright (c) 2012-2013, 4chan LLC
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
|
*
|
||||||
|
* Linkify: (http://userscripts.org/scripts/show/1352)
|
||||||
|
* Copyright (c) 2011, Anthony Lieuallen
|
||||||
|
* All rights reserved.
|
||||||
|
* Originally written by Anthony Lieuallen of http://arantius.com/
|
||||||
|
* Licensed for unlimited modification and redistribution as long as
|
||||||
|
* this notice is kept intact.
|
||||||
|
*
|
||||||
|
* license: http://userscripts.org/scripts/review/1352
|
||||||
*
|
*
|
||||||
* Originally written by Anthony Lieuallen of http://arantius.com/
|
|
||||||
* Licensed for unlimited modification and redistribution as long as
|
|
||||||
* this notice is kept intact.
|
|
||||||
*/
|
*/
|
||||||
@ -3,11 +3,7 @@
|
|||||||
// @version 1.1.0
|
// @version 1.1.0
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||||
// @copyright 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
// @copyright 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
|
||||||
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
|
||||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
|
||||||
// @match *://api.4chan.org/*
|
// @match *://api.4chan.org/*
|
||||||
// @match *://boards.4chan.org/*
|
// @match *://boards.4chan.org/*
|
||||||
// @match *://images.4chan.org/*
|
// @match *://images.4chan.org/*
|
||||||
@ -22,13 +18,11 @@
|
|||||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.1.0 - 2013-04-25
|
* 4chan X - Version 1.1.0 - 2013-04-26
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
*
|
*
|
||||||
* Appchan X Copyright © 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
|
||||||
* http://zixaphir.github.io/appchan-x/
|
|
||||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* https://github.com/aeosynth/4chan-x
|
* https://github.com/aeosynth/4chan-x
|
||||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
@ -37,12 +31,6 @@
|
|||||||
* http://seaweedchan.github.io/4chan-x/
|
* http://seaweedchan.github.io/4chan-x/
|
||||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||||
* http://ihavenoface.github.io/4chan-x/
|
* http://ihavenoface.github.io/4chan-x/
|
||||||
* OneeChan Copyright © 2011-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
* http://seaweedchan.github.io/oneechan/
|
|
||||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
|
||||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
|
||||||
* Raphael Icons Copyright © 2013 Dmitry Baranovskiy
|
|
||||||
* http://raphaeljs.com/icons/
|
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
@ -93,13 +81,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkify based on:
|
* Contains data from external sources:
|
||||||
* http://downloads.mozdev.org/greasemonkey/linkify.user.js
|
*
|
||||||
* https://github.com/MayhemYDG/LinkifyPlusFork
|
* audio/beep.wav from http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||||
|
* cc-by-nc-3.0
|
||||||
|
*
|
||||||
|
* 4chan/4chan-JS (https://github.com/4chan/4chan-JS)
|
||||||
|
* Copyright (c) 2012-2013, 4chan LLC
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
|
*
|
||||||
|
* Linkify: (http://userscripts.org/scripts/show/1352)
|
||||||
|
* Copyright (c) 2011, Anthony Lieuallen
|
||||||
|
* All rights reserved.
|
||||||
|
* Originally written by Anthony Lieuallen of http://arantius.com/
|
||||||
|
* Licensed for unlimited modification and redistribution as long as
|
||||||
|
* this notice is kept intact.
|
||||||
|
*
|
||||||
|
* license: http://userscripts.org/scripts/review/1352
|
||||||
*
|
*
|
||||||
* Originally written by Anthony Lieuallen of http://arantius.com/
|
|
||||||
* Licensed for unlimited modification and redistribution as long as
|
|
||||||
* this notice is kept intact.
|
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
@ -639,41 +640,28 @@
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
$.open = (function() {
|
$.open = function(URL) {
|
||||||
if (typeof GM_openInTab !== "undefined" && GM_openInTab !== null) {
|
return window.open(URL, '_blank');
|
||||||
return function(URL) {
|
};
|
||||||
var a;
|
|
||||||
|
|
||||||
a = $.el('a', {
|
|
||||||
href: URL
|
|
||||||
});
|
|
||||||
return GM_openInTab(a.href);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return function(URL) {
|
|
||||||
return window.open(URL, '_blank');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
$.debounce = function(wait, fn) {
|
$.debounce = function(wait, fn) {
|
||||||
var args, exec, that, timeout;
|
var args, exec, lastCall, that, timeout;
|
||||||
|
|
||||||
|
lastCall = 0;
|
||||||
timeout = null;
|
timeout = null;
|
||||||
that = null;
|
that = null;
|
||||||
args = null;
|
args = null;
|
||||||
exec = function() {
|
exec = function() {
|
||||||
fn.apply(that, args);
|
lastCall = Date.now();
|
||||||
return timeout = null;
|
return fn.apply(that, args);
|
||||||
};
|
};
|
||||||
return function() {
|
return function() {
|
||||||
args = arguments;
|
args = arguments;
|
||||||
that = this;
|
that = this;
|
||||||
if (timeout) {
|
if (lastCall < Date.now() - wait) {
|
||||||
clearTimeout(timeout);
|
return exec();
|
||||||
} else {
|
|
||||||
exec();
|
|
||||||
}
|
}
|
||||||
|
clearTimeout(timeout);
|
||||||
return timeout = setTimeout(exec, wait);
|
return timeout = setTimeout(exec, wait);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1459,7 +1447,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
if ((this.data.lastChecked || 0) < now - 12 * $.HOUR) {
|
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
|
||||||
this.data.lastChecked = now;
|
this.data.lastChecked = now;
|
||||||
for (boardID in this.data.boards) {
|
for (boardID in this.data.boards) {
|
||||||
this.ajaxClean(boardID);
|
this.ajaxClean(boardID);
|
||||||
@ -8154,7 +8142,7 @@
|
|||||||
QR.cooldown.auto = false;
|
QR.cooldown.auto = false;
|
||||||
QR.status();
|
QR.status();
|
||||||
return QR.error($.el('span', {
|
return QR.error($.el('span', {
|
||||||
innerHTML: 'Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.'
|
innerHTML: "Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.\n[<a href=\"https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean\" target=_blank>FAQ</a>]"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,11 +3,7 @@
|
|||||||
// @version 1.1.0
|
// @version 1.1.0
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||||
// @copyright 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
// @copyright 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
|
||||||
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
|
||||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
|
||||||
// @match *://api.4chan.org/*
|
// @match *://api.4chan.org/*
|
||||||
// @match *://boards.4chan.org/*
|
// @match *://boards.4chan.org/*
|
||||||
// @match *://images.4chan.org/*
|
// @match *://images.4chan.org/*
|
||||||
|
|||||||
@ -3,11 +3,7 @@
|
|||||||
// @version 1.1.0
|
// @version 1.1.0
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||||
// @copyright 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
// @copyright 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
|
||||||
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
|
||||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
|
||||||
// @match *://api.4chan.org/*
|
// @match *://api.4chan.org/*
|
||||||
// @match *://boards.4chan.org/*
|
// @match *://boards.4chan.org/*
|
||||||
// @match *://images.4chan.org/*
|
// @match *://images.4chan.org/*
|
||||||
@ -22,13 +18,11 @@
|
|||||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.1.0 - 2013-04-25
|
* 4chan X - Version 1.1.0 - 2013-04-26
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
*
|
*
|
||||||
* Appchan X Copyright © 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
|
|
||||||
* http://zixaphir.github.io/appchan-x/
|
|
||||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* https://github.com/aeosynth/4chan-x
|
* https://github.com/aeosynth/4chan-x
|
||||||
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
* 4chan x Copyright © 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
@ -37,12 +31,6 @@
|
|||||||
* http://seaweedchan.github.io/4chan-x/
|
* http://seaweedchan.github.io/4chan-x/
|
||||||
* 4chan x Copyright © 2012-2013 ihavenoface
|
* 4chan x Copyright © 2012-2013 ihavenoface
|
||||||
* http://ihavenoface.github.io/4chan-x/
|
* http://ihavenoface.github.io/4chan-x/
|
||||||
* OneeChan Copyright © 2011-2013 Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
* http://seaweedchan.github.io/oneechan/
|
|
||||||
* 4chan SS Copyright © 2011-2013 Ahodesuka
|
|
||||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
|
||||||
* Raphael Icons Copyright © 2013 Dmitry Baranovskiy
|
|
||||||
* http://raphaeljs.com/icons/
|
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
@ -93,13 +81,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkify based on:
|
* Contains data from external sources:
|
||||||
* http://downloads.mozdev.org/greasemonkey/linkify.user.js
|
*
|
||||||
* https://github.com/MayhemYDG/LinkifyPlusFork
|
* audio/beep.wav from http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||||
|
* cc-by-nc-3.0
|
||||||
|
*
|
||||||
|
* 4chan/4chan-JS (https://github.com/4chan/4chan-JS)
|
||||||
|
* Copyright (c) 2012-2013, 4chan LLC
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
|
*
|
||||||
|
* Linkify: (http://userscripts.org/scripts/show/1352)
|
||||||
|
* Copyright (c) 2011, Anthony Lieuallen
|
||||||
|
* All rights reserved.
|
||||||
|
* Originally written by Anthony Lieuallen of http://arantius.com/
|
||||||
|
* Licensed for unlimited modification and redistribution as long as
|
||||||
|
* this notice is kept intact.
|
||||||
|
*
|
||||||
|
* license: http://userscripts.org/scripts/review/1352
|
||||||
*
|
*
|
||||||
* Originally written by Anthony Lieuallen of http://arantius.com/
|
|
||||||
* Licensed for unlimited modification and redistribution as long as
|
|
||||||
* this notice is kept intact.
|
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
@ -636,41 +637,30 @@
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
$.open = (function() {
|
$.open = function(URL) {
|
||||||
if (typeof GM_openInTab !== "undefined" && GM_openInTab !== null) {
|
return GM_openInTab(($.el('a', {
|
||||||
return function(URL) {
|
href: URL
|
||||||
var a;
|
})).href);
|
||||||
|
};
|
||||||
a = $.el('a', {
|
|
||||||
href: URL
|
|
||||||
});
|
|
||||||
return GM_openInTab(a.href);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return function(URL) {
|
|
||||||
return window.open(URL, '_blank');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
$.debounce = function(wait, fn) {
|
$.debounce = function(wait, fn) {
|
||||||
var args, exec, that, timeout;
|
var args, exec, lastCall, that, timeout;
|
||||||
|
|
||||||
|
lastCall = 0;
|
||||||
timeout = null;
|
timeout = null;
|
||||||
that = null;
|
that = null;
|
||||||
args = null;
|
args = null;
|
||||||
exec = function() {
|
exec = function() {
|
||||||
fn.apply(that, args);
|
lastCall = Date.now();
|
||||||
return timeout = null;
|
return fn.apply(that, args);
|
||||||
};
|
};
|
||||||
return function() {
|
return function() {
|
||||||
args = arguments;
|
args = arguments;
|
||||||
that = this;
|
that = this;
|
||||||
if (timeout) {
|
if (lastCall < Date.now() - wait) {
|
||||||
clearTimeout(timeout);
|
return exec();
|
||||||
} else {
|
|
||||||
exec();
|
|
||||||
}
|
}
|
||||||
|
clearTimeout(timeout);
|
||||||
return timeout = setTimeout(exec, wait);
|
return timeout = setTimeout(exec, wait);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1453,7 +1443,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
if ((this.data.lastChecked || 0) < now - 12 * $.HOUR) {
|
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
|
||||||
this.data.lastChecked = now;
|
this.data.lastChecked = now;
|
||||||
for (boardID in this.data.boards) {
|
for (boardID in this.data.boards) {
|
||||||
this.ajaxClean(boardID);
|
this.ajaxClean(boardID);
|
||||||
@ -8174,7 +8164,7 @@
|
|||||||
QR.cooldown.auto = false;
|
QR.cooldown.auto = false;
|
||||||
QR.status();
|
QR.status();
|
||||||
return QR.error($.el('span', {
|
return QR.error($.el('span', {
|
||||||
innerHTML: 'Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.'
|
innerHTML: "Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.\n[<a href=\"https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean\" target=_blank>FAQ</a>]"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, IDColor, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
|
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
|
||||||
|
|
||||||
Config = {
|
Config = {
|
||||||
main: {
|
main: {
|
||||||
@ -533,41 +533,28 @@
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
$.open = (function() {
|
$.open = function(URL) {
|
||||||
if (typeof GM_openInTab !== "undefined" && GM_openInTab !== null) {
|
return window.open(URL, '_blank');
|
||||||
return function(URL) {
|
};
|
||||||
var a;
|
|
||||||
|
|
||||||
a = $.el('a', {
|
|
||||||
href: URL
|
|
||||||
});
|
|
||||||
return GM_openInTab(a.href);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return function(URL) {
|
|
||||||
return window.open(URL, '_blank');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
$.debounce = function(wait, fn) {
|
$.debounce = function(wait, fn) {
|
||||||
var args, exec, that, timeout;
|
var args, exec, lastCall, that, timeout;
|
||||||
|
|
||||||
|
lastCall = 0;
|
||||||
timeout = null;
|
timeout = null;
|
||||||
that = null;
|
that = null;
|
||||||
args = null;
|
args = null;
|
||||||
exec = function() {
|
exec = function() {
|
||||||
fn.apply(that, args);
|
lastCall = Date.now();
|
||||||
return timeout = null;
|
return fn.apply(that, args);
|
||||||
};
|
};
|
||||||
return function() {
|
return function() {
|
||||||
args = arguments;
|
args = arguments;
|
||||||
that = this;
|
that = this;
|
||||||
if (timeout) {
|
if (lastCall < Date.now() - wait) {
|
||||||
clearTimeout(timeout);
|
return exec();
|
||||||
} else {
|
|
||||||
exec();
|
|
||||||
}
|
}
|
||||||
|
clearTimeout(timeout);
|
||||||
return timeout = setTimeout(exec, wait);
|
return timeout = setTimeout(exec, wait);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -650,12 +637,14 @@
|
|||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.localKeys = ['name', 'uniqueID', 'tripcode', 'capcode', 'email', 'subject', 'comment', 'flag', 'filename', 'dimensions', 'filesize', 'MD5', 'usercss'];
|
||||||
|
|
||||||
$["delete"] = function(keys) {
|
$["delete"] = function(keys) {
|
||||||
return chrome.storage.sync.remove(keys);
|
return chrome.storage.sync.remove(keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.get = function(key, val, cb) {
|
$.get = function(key, val, cb) {
|
||||||
var items;
|
var count, done, items, localItems, syncItems;
|
||||||
|
|
||||||
if (typeof cb === 'function') {
|
if (typeof cb === 'function') {
|
||||||
items = $.item(key, val);
|
items = $.item(key, val);
|
||||||
@ -663,15 +652,69 @@
|
|||||||
items = key;
|
items = key;
|
||||||
cb = val;
|
cb = val;
|
||||||
}
|
}
|
||||||
return chrome.storage.sync.get(items, cb);
|
localItems = null;
|
||||||
|
syncItems = null;
|
||||||
|
for (key in items) {
|
||||||
|
val = items[key];
|
||||||
|
if (__indexOf.call($.localKeys, key) >= 0) {
|
||||||
|
(localItems || (localItems = {}))[key] = val;
|
||||||
|
} else {
|
||||||
|
(syncItems || (syncItems = {}))[key] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items = {};
|
||||||
|
count = 0;
|
||||||
|
done = function(item) {
|
||||||
|
$.extend(items, item);
|
||||||
|
if (!--count) {
|
||||||
|
return cb(items);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (localItems) {
|
||||||
|
count++;
|
||||||
|
chrome.storage.local.get(localItems, done);
|
||||||
|
}
|
||||||
|
if (syncItems) {
|
||||||
|
count++;
|
||||||
|
return chrome.storage.sync.get(syncItems, done);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.set = function(key, val) {
|
$.set = (function() {
|
||||||
var items;
|
var items, localItems, set;
|
||||||
|
|
||||||
items = typeof key === 'string' ? $.item(key, val) : key;
|
items = {};
|
||||||
return chrome.storage.sync.set(items);
|
localItems = {};
|
||||||
};
|
set = $.debounce($.SECOND, function() {
|
||||||
|
var err, key, _i, _len, _ref;
|
||||||
|
|
||||||
|
_ref = $.localKeys;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
key = _ref[_i];
|
||||||
|
if (key in items) {
|
||||||
|
(localItems || (localItems = {}))[key] = items[key];
|
||||||
|
delete items[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
chrome.storage.local.set(localItems);
|
||||||
|
chrome.storage.sync.set(items);
|
||||||
|
items = {};
|
||||||
|
return localItems = {};
|
||||||
|
} catch (_error) {
|
||||||
|
err = _error;
|
||||||
|
return c.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return function(key, val) {
|
||||||
|
if (typeof key === 'string') {
|
||||||
|
items[key] = val;
|
||||||
|
} else {
|
||||||
|
$.extend(items, key);
|
||||||
|
}
|
||||||
|
return set();
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
$$ = function(selector, root) {
|
$$ = function(selector, root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
@ -1317,7 +1360,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
if ((this.data.lastChecked || 0) < now - 12 * $.HOUR) {
|
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
|
||||||
this.data.lastChecked = now;
|
this.data.lastChecked = now;
|
||||||
for (boardID in this.data.boards) {
|
for (boardID in this.data.boards) {
|
||||||
this.ajaxClean(boardID);
|
this.ajaxClean(boardID);
|
||||||
@ -8019,7 +8062,7 @@
|
|||||||
QR.cooldown.auto = false;
|
QR.cooldown.auto = false;
|
||||||
QR.status();
|
QR.status();
|
||||||
return QR.error($.el('span', {
|
return QR.error($.el('span', {
|
||||||
innerHTML: 'Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.'
|
innerHTML: "Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.\n[<a href=\"https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean\" target=_blank>FAQ</a>]"
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
img/changelog/3.2.0/0.png
Normal file
BIN
img/changelog/3.2.0/0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
4475
src/features.coffee
Normal file
4475
src/features.coffee
Normal file
File diff suppressed because it is too large
Load Diff
@ -979,7 +979,10 @@ QR =
|
|||||||
QR.cooldown.auto = false
|
QR.cooldown.auto = false
|
||||||
QR.status()
|
QR.status()
|
||||||
QR.error $.el 'span',
|
QR.error $.el 'span',
|
||||||
innerHTML: 'Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.'
|
innerHTML: """
|
||||||
|
Connection error. You may have been <a href=//www.4chan.org/banned target=_blank>banned</a>.
|
||||||
|
[<a href="https://github.com/MayhemYDG/4chan-x/wiki/FAQ#what-does-connection-error-you-may-have-been-banned-mean" target=_blank>FAQ</a>]
|
||||||
|
"""
|
||||||
opts =
|
opts =
|
||||||
cred: true
|
cred: true
|
||||||
form: $.formData postData
|
form: $.formData postData
|
||||||
|
|||||||
184
src/lib/$.coffee
184
src/lib/$.coffee
@ -47,7 +47,7 @@ $.DAY = 24 * ($.HOUR = 60 * ($.MINUTE = 60 * ($.SECOND = 1000)))
|
|||||||
|
|
||||||
$.id = (id) ->
|
$.id = (id) ->
|
||||||
d.getElementById id
|
d.getElementById id
|
||||||
|
|
||||||
$.ready = (fc) ->
|
$.ready = (fc) ->
|
||||||
if d.readyState in ['interactive', 'complete']
|
if d.readyState in ['interactive', 'complete']
|
||||||
$.queueTask fc
|
$.queueTask fc
|
||||||
@ -56,7 +56,7 @@ $.ready = (fc) ->
|
|||||||
$.off d, 'DOMContentLoaded', cb
|
$.off d, 'DOMContentLoaded', cb
|
||||||
fc()
|
fc()
|
||||||
$.on d, 'DOMContentLoaded', cb
|
$.on d, 'DOMContentLoaded', cb
|
||||||
|
|
||||||
$.formData = (form) ->
|
$.formData = (form) ->
|
||||||
if form instanceof HTMLFormElement
|
if form instanceof HTMLFormElement
|
||||||
return new FormData form
|
return new FormData form
|
||||||
@ -70,7 +70,7 @@ $.formData = (form) ->
|
|||||||
else
|
else
|
||||||
fd.append key, val
|
fd.append key, val
|
||||||
fd
|
fd
|
||||||
|
|
||||||
$.ajax = (url, callbacks, opts={}) ->
|
$.ajax = (url, callbacks, opts={}) ->
|
||||||
{type, cred, headers, upCallbacks, form, sync} = opts
|
{type, cred, headers, upCallbacks, form, sync} = opts
|
||||||
r = new XMLHttpRequest()
|
r = new XMLHttpRequest()
|
||||||
@ -84,7 +84,7 @@ $.ajax = (url, callbacks, opts={}) ->
|
|||||||
r.withCredentials = cred
|
r.withCredentials = cred
|
||||||
r.send form
|
r.send form
|
||||||
r
|
r
|
||||||
|
|
||||||
$.cache = do ->
|
$.cache = do ->
|
||||||
reqs = {}
|
reqs = {}
|
||||||
(url, cb) ->
|
(url, cb) ->
|
||||||
@ -103,7 +103,7 @@ $.cache = do ->
|
|||||||
onerror: rm
|
onerror: rm
|
||||||
req.callbacks = [cb]
|
req.callbacks = [cb]
|
||||||
reqs[url] = req
|
reqs[url] = req
|
||||||
|
|
||||||
$.cb =
|
$.cb =
|
||||||
checked: ->
|
checked: ->
|
||||||
$.set @name, @checked
|
$.set @name, @checked
|
||||||
@ -111,13 +111,13 @@ $.cb =
|
|||||||
value: ->
|
value: ->
|
||||||
$.set @name, @value.trim()
|
$.set @name, @value.trim()
|
||||||
Conf[@name] = @value
|
Conf[@name] = @value
|
||||||
|
|
||||||
$.asap = (test, cb) ->
|
$.asap = (test, cb) ->
|
||||||
if test()
|
if test()
|
||||||
cb()
|
cb()
|
||||||
else
|
else
|
||||||
setTimeout $.asap, 25, test, cb
|
setTimeout $.asap, 25, test, cb
|
||||||
|
|
||||||
$.addStyle = (css, id) ->
|
$.addStyle = (css, id) ->
|
||||||
style = $.el 'style',
|
style = $.el 'style',
|
||||||
id: id
|
id: id
|
||||||
@ -125,47 +125,47 @@ $.addStyle = (css, id) ->
|
|||||||
$.asap (-> d.head), ->
|
$.asap (-> d.head), ->
|
||||||
$.add d.head, style
|
$.add d.head, style
|
||||||
style
|
style
|
||||||
|
|
||||||
$.x = (path, root) ->
|
$.x = (path, root) ->
|
||||||
root or= d.body
|
root or= d.body
|
||||||
# XPathResult.ANY_UNORDERED_NODE_TYPE === 8
|
# XPathResult.ANY_UNORDERED_NODE_TYPE === 8
|
||||||
d.evaluate(path, root, null, 8, null).singleNodeValue
|
d.evaluate(path, root, null, 8, null).singleNodeValue
|
||||||
|
|
||||||
$.X = (path, root) ->
|
$.X = (path, root) ->
|
||||||
root or= d.body
|
root or= d.body
|
||||||
d.evaluate path, root, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
|
d.evaluate path, root, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
|
||||||
|
|
||||||
$.addClass = (el, className) ->
|
$.addClass = (el, className) ->
|
||||||
el.classList.add className
|
el.classList.add className
|
||||||
|
|
||||||
$.rmClass = (el, className) ->
|
$.rmClass = (el, className) ->
|
||||||
el.classList.remove className
|
el.classList.remove className
|
||||||
|
|
||||||
$.toggleClass = (el, className) ->
|
$.toggleClass = (el, className) ->
|
||||||
el.classList.toggle className
|
el.classList.toggle className
|
||||||
|
|
||||||
$.hasClass = (el, className) ->
|
$.hasClass = (el, className) ->
|
||||||
el.classList.contains className
|
el.classList.contains className
|
||||||
|
|
||||||
$.rm = do ->
|
$.rm = do ->
|
||||||
if 'remove' of Element.prototype
|
if 'remove' of Element.prototype
|
||||||
(el) -> el.remove()
|
(el) -> el.remove()
|
||||||
else
|
else
|
||||||
(el) -> el.parentNode?.removeChild el
|
(el) -> el.parentNode?.removeChild el
|
||||||
|
|
||||||
$.rmAll = (root) ->
|
$.rmAll = (root) ->
|
||||||
# jsperf.com/emptify-element
|
# jsperf.com/emptify-element
|
||||||
while node = root.firstChild
|
while node = root.firstChild
|
||||||
# HTMLSelectElement.remove !== Element.remove
|
# HTMLSelectElement.remove !== Element.remove
|
||||||
root.removeChild node
|
root.removeChild node
|
||||||
return
|
return
|
||||||
|
|
||||||
$.tn = (s) ->
|
$.tn = (s) ->
|
||||||
d.createTextNode s
|
d.createTextNode s
|
||||||
|
|
||||||
$.frag = ->
|
$.frag = ->
|
||||||
d.createDocumentFragment()
|
d.createDocumentFragment()
|
||||||
|
|
||||||
$.nodes = (nodes) ->
|
$.nodes = (nodes) ->
|
||||||
unless nodes instanceof Array
|
unless nodes instanceof Array
|
||||||
return nodes
|
return nodes
|
||||||
@ -173,65 +173,64 @@ $.nodes = (nodes) ->
|
|||||||
for node in nodes
|
for node in nodes
|
||||||
frag.appendChild node
|
frag.appendChild node
|
||||||
frag
|
frag
|
||||||
|
|
||||||
$.add = (parent, el) ->
|
$.add = (parent, el) ->
|
||||||
parent.appendChild $.nodes el
|
parent.appendChild $.nodes el
|
||||||
|
|
||||||
$.prepend = (parent, el) ->
|
$.prepend = (parent, el) ->
|
||||||
parent.insertBefore $.nodes(el), parent.firstChild
|
parent.insertBefore $.nodes(el), parent.firstChild
|
||||||
|
|
||||||
$.after = (root, el) ->
|
$.after = (root, el) ->
|
||||||
root.parentNode.insertBefore $.nodes(el), root.nextSibling
|
root.parentNode.insertBefore $.nodes(el), root.nextSibling
|
||||||
|
|
||||||
$.before = (root, el) ->
|
$.before = (root, el) ->
|
||||||
root.parentNode.insertBefore $.nodes(el), root
|
root.parentNode.insertBefore $.nodes(el), root
|
||||||
|
|
||||||
$.replace = (root, el) ->
|
$.replace = (root, el) ->
|
||||||
root.parentNode.replaceChild $.nodes(el), root
|
root.parentNode.replaceChild $.nodes(el), root
|
||||||
|
|
||||||
$.el = (tag, properties) ->
|
$.el = (tag, properties) ->
|
||||||
el = d.createElement tag
|
el = d.createElement tag
|
||||||
$.extend el, properties if properties
|
$.extend el, properties if properties
|
||||||
el
|
el
|
||||||
|
|
||||||
$.on = (el, events, handler) ->
|
$.on = (el, events, handler) ->
|
||||||
for event in events.split ' '
|
for event in events.split ' '
|
||||||
el.addEventListener event, handler, false
|
el.addEventListener event, handler, false
|
||||||
return
|
return
|
||||||
|
|
||||||
$.off = (el, events, handler) ->
|
$.off = (el, events, handler) ->
|
||||||
for event in events.split ' '
|
for event in events.split ' '
|
||||||
el.removeEventListener event, handler, false
|
el.removeEventListener event, handler, false
|
||||||
return
|
return
|
||||||
|
|
||||||
$.event = (event, detail, root=d) ->
|
$.event = (event, detail, root=d) ->
|
||||||
root.dispatchEvent new CustomEvent event, {bubbles: true, detail}
|
root.dispatchEvent new CustomEvent event, {bubbles: true, detail}
|
||||||
|
|
||||||
$.open = do ->
|
$.open = (URL) ->
|
||||||
if GM_openInTab?
|
<% if (type === 'userscript') { %>
|
||||||
(URL) ->
|
# XXX fix GM opening file://// for protocol-less URLs.
|
||||||
# XXX fix GM opening file://// for protocol-less URLs.
|
# https://github.com/greasemonkey/greasemonkey/issues/1719
|
||||||
a = $.el 'a', href: URL
|
GM_openInTab ($.el 'a', href: URL).href
|
||||||
GM_openInTab a.href
|
<% } else { %>
|
||||||
else
|
window.open URL, '_blank'
|
||||||
(URL) -> window.open URL, '_blank'
|
<% } %>
|
||||||
|
|
||||||
$.debounce = (wait, fn) ->
|
$.debounce = (wait, fn) ->
|
||||||
timeout = null
|
lastCall = 0
|
||||||
that = null
|
timeout = null
|
||||||
args = null
|
that = null
|
||||||
exec = ->
|
args = null
|
||||||
|
exec = ->
|
||||||
|
lastCall = Date.now()
|
||||||
fn.apply that, args
|
fn.apply that, args
|
||||||
timeout = null
|
|
||||||
->
|
->
|
||||||
args = arguments
|
args = arguments
|
||||||
that = this
|
that = this
|
||||||
if timeout
|
if lastCall < Date.now() - wait
|
||||||
# stop current reset
|
return exec()
|
||||||
clearTimeout timeout
|
# stop current reset
|
||||||
else
|
clearTimeout timeout
|
||||||
exec()
|
|
||||||
|
|
||||||
# after wait, let next invocation execute immediately
|
# after wait, let next invocation execute immediately
|
||||||
timeout = setTimeout exec, wait
|
timeout = setTimeout exec, wait
|
||||||
|
|
||||||
@ -253,13 +252,13 @@ $.queueTask = do ->
|
|||||||
->
|
->
|
||||||
taskQueue.push arguments
|
taskQueue.push arguments
|
||||||
setTimeout execTask, 0
|
setTimeout execTask, 0
|
||||||
|
|
||||||
$.globalEval = (code) ->
|
$.globalEval = (code) ->
|
||||||
script = $.el 'script',
|
script = $.el 'script',
|
||||||
textContent: code
|
textContent: code
|
||||||
$.add (d.head or doc), script
|
$.add (d.head or doc), script
|
||||||
$.rm script
|
$.rm script
|
||||||
|
|
||||||
$.bytesToString = (size) ->
|
$.bytesToString = (size) ->
|
||||||
unit = 0 # Bytes
|
unit = 0 # Bytes
|
||||||
while size >= 1024
|
while size >= 1024
|
||||||
@ -275,7 +274,7 @@ $.bytesToString = (size) ->
|
|||||||
# Round to an integer otherwise.
|
# Round to an integer otherwise.
|
||||||
Math.round size
|
Math.round size
|
||||||
"#{size} #{['B', 'KB', 'MB', 'GB'][unit]}"
|
"#{size} #{['B', 'KB', 'MB', 'GB'][unit]}"
|
||||||
|
|
||||||
$.minmax = (value, min, max) ->
|
$.minmax = (value, min, max) ->
|
||||||
return (
|
return (
|
||||||
if value < min
|
if value < min
|
||||||
@ -286,7 +285,7 @@ $.minmax = (value, min, max) ->
|
|||||||
else
|
else
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
|
|
||||||
$.syncing = {}
|
$.syncing = {}
|
||||||
|
|
||||||
$.sync = do ->
|
$.sync = do ->
|
||||||
@ -310,26 +309,79 @@ $.item = (key, val) ->
|
|||||||
item[key] = val
|
item[key] = val
|
||||||
item
|
item
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
# https://developer.chrome.com/extensions/storage.html
|
$.localKeys = [
|
||||||
|
# filters
|
||||||
|
'name',
|
||||||
|
'uniqueID',
|
||||||
|
'tripcode',
|
||||||
|
'capcode',
|
||||||
|
'email',
|
||||||
|
'subject',
|
||||||
|
'comment',
|
||||||
|
'flag',
|
||||||
|
'filename',
|
||||||
|
'dimensions',
|
||||||
|
'filesize',
|
||||||
|
'MD5',
|
||||||
|
# custom css
|
||||||
|
'usercss'
|
||||||
|
]
|
||||||
|
|
||||||
|
# https://developer.chrome.com/extensions/storage.html
|
||||||
|
|
||||||
$.delete = (keys) ->
|
$.delete = (keys) ->
|
||||||
chrome.storage.sync.remove keys
|
chrome.storage.sync.remove keys
|
||||||
|
|
||||||
$.get = (key, val, cb) ->
|
$.get = (key, val, cb) ->
|
||||||
if typeof cb is 'function'
|
if typeof cb is 'function'
|
||||||
items = $.item key, val
|
items = $.item key, val
|
||||||
else
|
else
|
||||||
items = key
|
items = key
|
||||||
cb = val
|
cb = val
|
||||||
chrome.storage.sync.get items, cb
|
localItems = null
|
||||||
|
syncItems = null
|
||||||
$.set = (key, val) ->
|
for key, val of items
|
||||||
items = if typeof key is 'string'
|
if key in $.localKeys
|
||||||
$.item key, val
|
(localItems or= {})[key] = val
|
||||||
else
|
else
|
||||||
key
|
(syncItems or= {})[key] = val
|
||||||
chrome.storage.sync.set items
|
|
||||||
|
items = {}
|
||||||
|
count = 0
|
||||||
|
done = (item) ->
|
||||||
|
$.extend items, item
|
||||||
|
cb items unless --count
|
||||||
|
|
||||||
|
if localItems
|
||||||
|
count++
|
||||||
|
chrome.storage.local.get localItems, done
|
||||||
|
if syncItems
|
||||||
|
count++
|
||||||
|
chrome.storage.sync.get syncItems, done
|
||||||
|
$.set = do ->
|
||||||
|
items = {}
|
||||||
|
localItems = {}
|
||||||
|
|
||||||
|
set = $.debounce $.SECOND, ->
|
||||||
|
for key in $.localKeys
|
||||||
|
if key of items
|
||||||
|
(localItems or= {})[key] = items[key]
|
||||||
|
delete items[key]
|
||||||
|
try
|
||||||
|
chrome.storage.local.set localItems
|
||||||
|
chrome.storage.sync.set items
|
||||||
|
items = {}
|
||||||
|
localItems = {}
|
||||||
|
catch err
|
||||||
|
c.error err
|
||||||
|
|
||||||
|
(key, val) ->
|
||||||
|
if typeof key is 'string'
|
||||||
|
items[key] = val
|
||||||
|
else
|
||||||
|
$.extend items, key
|
||||||
|
set()
|
||||||
|
|
||||||
<% } else if (type === 'userjs') { %>
|
<% } else if (type === 'userjs') { %>
|
||||||
do ->
|
do ->
|
||||||
# http://www.opera.com/docs/userjs/specs/#scriptstorage
|
# http://www.opera.com/docs/userjs/specs/#scriptstorage
|
||||||
@ -386,7 +438,7 @@ $.delete = (keys) ->
|
|||||||
localStorage.removeItem key
|
localStorage.removeItem key
|
||||||
GM_deleteValue key
|
GM_deleteValue key
|
||||||
return
|
return
|
||||||
|
|
||||||
$.get = (key, val, cb) ->
|
$.get = (key, val, cb) ->
|
||||||
if typeof cb is 'function'
|
if typeof cb is 'function'
|
||||||
items = $.item key, val
|
items = $.item key, val
|
||||||
@ -398,7 +450,7 @@ $.get = (key, val, cb) ->
|
|||||||
if val = GM_getValue g.NAMESPACE + key
|
if val = GM_getValue g.NAMESPACE + key
|
||||||
items[key] = JSON.parse val
|
items[key] = JSON.parse val
|
||||||
cb items
|
cb items
|
||||||
|
|
||||||
$.set = do ->
|
$.set = do ->
|
||||||
set = (key, val) ->
|
set = (key, val) ->
|
||||||
key = g.NAMESPACE + key
|
key = g.NAMESPACE + key
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class DataBoard
|
|||||||
@deleteIfEmpty {boardID}
|
@deleteIfEmpty {boardID}
|
||||||
|
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
if (@data.lastChecked or 0) < now - 12 * $.HOUR
|
if (@data.lastChecked or 0) < now - 2 * $.HOUR
|
||||||
@data.lastChecked = now
|
@data.lastChecked = now
|
||||||
for boardID of @data.boards
|
for boardID of @data.boards
|
||||||
@ajaxClean boardID
|
@ajaxClean boardID
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* <%= meta.repo %>blob/master/LICENSE
|
* <%= meta.repo %>blob/master/LICENSE
|
||||||
*
|
*
|
||||||
* Appchan X Copyright © 2013-<%= grunt.template.today('yyyy') %> Zixaphir <zixaphirmoxphar@gmail.com>
|
|
||||||
* http://zixaphir.github.io/appchan-x/
|
|
||||||
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
* 4chan x Copyright © 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* https://github.com/aeosynth/4chan-x
|
* https://github.com/aeosynth/4chan-x
|
||||||
* 4chan x Copyright © 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com>
|
* 4chan x Copyright © 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
@ -14,12 +12,6 @@
|
|||||||
* http://seaweedchan.github.io/4chan-x/
|
* http://seaweedchan.github.io/4chan-x/
|
||||||
* 4chan x Copyright © 2012-<%= grunt.template.today('yyyy') %> ihavenoface
|
* 4chan x Copyright © 2012-<%= grunt.template.today('yyyy') %> ihavenoface
|
||||||
* http://ihavenoface.github.io/4chan-x/
|
* http://ihavenoface.github.io/4chan-x/
|
||||||
* OneeChan Copyright © 2011-<%= grunt.template.today('yyyy') %> Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
* http://seaweedchan.github.io/oneechan/
|
|
||||||
* 4chan SS Copyright © 2011-<%= grunt.template.today('yyyy') %> Ahodesuka
|
|
||||||
* https://github.com/ahodesuka/4chan-Style-Script/
|
|
||||||
* Raphael Icons Copyright © <%= grunt.template.today('yyyy') %> Dmitry Baranovskiy
|
|
||||||
* http://raphaeljs.com/icons/
|
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person
|
* Permission is hereby granted, free of charge, to any person
|
||||||
* obtaining a copy of this software and associated documentation
|
* obtaining a copy of this software and associated documentation
|
||||||
@ -70,11 +62,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkify based on:
|
* Contains data from external sources:
|
||||||
* http://downloads.mozdev.org/greasemonkey/linkify.user.js
|
*
|
||||||
* https://github.com/MayhemYDG/LinkifyPlusFork
|
* audio/beep.wav from http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||||
|
* cc-by-nc-3.0
|
||||||
|
*
|
||||||
|
* 4chan/4chan-JS (https://github.com/4chan/4chan-JS)
|
||||||
|
* Copyright (c) 2012-2013, 4chan LLC
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
|
||||||
|
*
|
||||||
|
* Linkify: (http://userscripts.org/scripts/show/1352)
|
||||||
|
* Copyright (c) 2011, Anthony Lieuallen
|
||||||
|
* All rights reserved.
|
||||||
|
* Originally written by Anthony Lieuallen of http://arantius.com/
|
||||||
|
* Licensed for unlimited modification and redistribution as long as
|
||||||
|
* this notice is kept intact.
|
||||||
|
*
|
||||||
|
* license: http://userscripts.org/scripts/review/1352
|
||||||
*
|
*
|
||||||
* Originally written by Anthony Lieuallen of http://arantius.com/
|
|
||||||
* Licensed for unlimited modification and redistribution as long as
|
|
||||||
* this notice is kept intact.
|
|
||||||
*/
|
*/
|
||||||
@ -3,11 +3,7 @@
|
|||||||
// @version <%= version %>
|
// @version <%= version %>
|
||||||
// @namespace <%= name %>
|
// @namespace <%= name %>
|
||||||
// @description <%= description %>
|
// @description <%= description %>
|
||||||
// @copyright 2013-<%= grunt.template.today('yyyy') %> Zixaphir <zixaphirmoxphar@gmail.com>
|
// @license MIT; <%= meta.repo %>blob/<%= meta.mainBranch %>/LICENSE
|
||||||
// @copyright 2013-<%= grunt.template.today('yyyy') %> Jordan Bates <saudrapsmann@gmail.com>
|
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
|
||||||
// @copyright 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com>
|
|
||||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
|
||||||
<%=
|
<%=
|
||||||
meta.matches.map(function(match) {
|
meta.matches.map(function(match) {
|
||||||
return '// @match ' + match;
|
return '// @match ' + match;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user