Merge branch 'master' of github.com:aeosynth/4chan-x
This commit is contained in:
commit
172f4b6761
@ -60,7 +60,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, Favicon, HOUR, MINUTE, NAMESPACE, Recaptcha, SECOND, Time, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher;
|
var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, VERSION, anonymize, conf, config, cooldown, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
config = {
|
config = {
|
||||||
main: {
|
main: {
|
||||||
@ -73,7 +73,8 @@
|
|||||||
'Comment Expansion': [true, 'Expand too long comments'],
|
'Comment Expansion': [true, 'Expand too long comments'],
|
||||||
'Thread Expansion': [true, 'View all replies'],
|
'Thread Expansion': [true, 'View all replies'],
|
||||||
'Index Navigation': [true, 'Navigate to previous / next thread'],
|
'Index Navigation': [true, 'Navigate to previous / next thread'],
|
||||||
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
'Reply Navigation': [false, 'Navigate to top / bottom of thread'],
|
||||||
|
'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)']
|
||||||
},
|
},
|
||||||
Hiding: {
|
Hiding: {
|
||||||
'Reply Hiding': [true, 'Hide single replies'],
|
'Reply Hiding': [true, 'Hide single replies'],
|
||||||
@ -187,6 +188,7 @@
|
|||||||
}
|
}
|
||||||
})(null, config);
|
})(null, config);
|
||||||
NAMESPACE = 'AEOS.4chan_x.';
|
NAMESPACE = 'AEOS.4chan_x.';
|
||||||
|
VERSION = 'master';
|
||||||
SECOND = 1000;
|
SECOND = 1000;
|
||||||
MINUTE = 60 * SECOND;
|
MINUTE = 60 * SECOND;
|
||||||
HOUR = 60 * MINUTE;
|
HOUR = 60 * MINUTE;
|
||||||
@ -1272,7 +1274,6 @@
|
|||||||
init: function() {
|
init: function() {
|
||||||
var iframe;
|
var iframe;
|
||||||
g.callbacks.push(qr.node);
|
g.callbacks.push(qr.node);
|
||||||
$.bind(window, 'message', qr.message);
|
|
||||||
$.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode);
|
$.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode);
|
||||||
qr.captchaTime = Date.now();
|
qr.captchaTime = Date.now();
|
||||||
qr.spoiler = $('.postarea label') ? '<label> [<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
|
qr.spoiler = $('.postarea label') ? '<label> [<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
|
||||||
@ -1375,11 +1376,10 @@
|
|||||||
$.bind($('#dummy', qr.el), 'keydown', qr.captchaKeydown);
|
$.bind($('#dummy', qr.el), 'keydown', qr.captchaKeydown);
|
||||||
return $.add(d.body, qr.el);
|
return $.add(d.body, qr.el);
|
||||||
},
|
},
|
||||||
message: function(e) {
|
message: function(data) {
|
||||||
var data, duration, fileCount;
|
var duration, fileCount;
|
||||||
$('iframe[name=iframe]').src = 'about:blank';
|
$('iframe[name=iframe]').src = 'about:blank';
|
||||||
fileCount = $('#files', qr.el).childElementCount;
|
fileCount = $('#files', qr.el).childElementCount;
|
||||||
data = e.data;
|
|
||||||
if (data) {
|
if (data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
$.extend($('#error', qr.el), data);
|
$.extend($('#error', qr.el), data);
|
||||||
@ -2832,10 +2832,10 @@
|
|||||||
return $.unbind(window, 'click', firstRun.close);
|
return $.unbind(window, 'click', firstRun.close);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
main = {
|
Main = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var callback, canPost, cutoff, form, hiddenThreads, id, lastChecked, now, op, pathname, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5;
|
var callback, canPost, cutoff, form, hiddenThreads, id, lastChecked, now, op, pathname, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5;
|
||||||
$.unbind(window, 'load', main.init);
|
$.unbind(window, 'load', Main.init);
|
||||||
pathname = location.pathname.substring(1).split('/');
|
pathname = location.pathname.substring(1).split('/');
|
||||||
g.BOARD = pathname[0], temp = pathname[1];
|
g.BOARD = pathname[0], temp = pathname[1];
|
||||||
if (temp === 'res') {
|
if (temp === 'res') {
|
||||||
@ -2855,6 +2855,7 @@
|
|||||||
if (!$('#navtopr')) {
|
if (!$('#navtopr')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$.bind(window, 'message', Main.message);
|
||||||
Favicon.init();
|
Favicon.init();
|
||||||
g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {});
|
g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {});
|
||||||
tzOffset = (new Date()).getTimezoneOffset() / 60;
|
tzOffset = (new Date()).getTimezoneOffset() / 60;
|
||||||
@ -2865,6 +2866,12 @@
|
|||||||
lastChecked = $.get('lastChecked', 0);
|
lastChecked = $.get('lastChecked', 0);
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
if (lastChecked < now - 1 * DAY) {
|
if (lastChecked < now - 1 * DAY) {
|
||||||
|
$.set('lastChecked', now);
|
||||||
|
if (conf['Check for Updates'] && VERSION !== 'master') {
|
||||||
|
$.add(d.head, $.el('script', {
|
||||||
|
src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js'
|
||||||
|
}));
|
||||||
|
}
|
||||||
cutoff = now - 7 * DAY;
|
cutoff = now - 7 * DAY;
|
||||||
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
||||||
for (id in hiddenThreads) {
|
for (id in hiddenThreads) {
|
||||||
@ -2882,9 +2889,8 @@
|
|||||||
}
|
}
|
||||||
$.set("hiddenThreads/" + g.BOARD + "/", hiddenThreads);
|
$.set("hiddenThreads/" + g.BOARD + "/", hiddenThreads);
|
||||||
$.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
|
$.set("hiddenReplies/" + g.BOARD + "/", g.hiddenReplies);
|
||||||
$.set('lastChecked', now);
|
|
||||||
}
|
}
|
||||||
$.addStyle(main.css);
|
$.addStyle(Main.css);
|
||||||
if ((form = $('form[name=post]')) && (canPost = !!$('#recaptcha_response_field'))) {
|
if ((form = $('form[name=post]')) && (canPost = !!$('#recaptcha_response_field'))) {
|
||||||
Recaptcha.init();
|
Recaptcha.init();
|
||||||
if (g.REPLY && conf['Auto Watch Reply'] && conf['Thread Watcher']) {
|
if (g.REPLY && conf['Auto Watch Reply'] && conf['Thread Watcher']) {
|
||||||
@ -3016,6 +3022,17 @@
|
|||||||
return firstRun.init();
|
return firstRun.init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
message: function(e) {
|
||||||
|
var data, origin;
|
||||||
|
origin = e.origin, data = e.data;
|
||||||
|
if (origin === 'http://sys.4chan.org') {
|
||||||
|
return qr.message(data);
|
||||||
|
} else {
|
||||||
|
if (data !== VERSION) {
|
||||||
|
return alert('new version of 4chan x available on github!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
css: '\
|
css: '\
|
||||||
/* dialog styling */\
|
/* dialog styling */\
|
||||||
div.dialog {\
|
div.dialog {\
|
||||||
@ -3226,8 +3243,8 @@
|
|||||||
'
|
'
|
||||||
};
|
};
|
||||||
if (d.body) {
|
if (d.body) {
|
||||||
main.init();
|
Main.init();
|
||||||
} else {
|
} else {
|
||||||
$.bind(window, 'load', main.init);
|
$.bind(window, 'load', Main.init);
|
||||||
}
|
}
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ config =
|
|||||||
'Thread Expansion': [true, 'View all replies']
|
'Thread Expansion': [true, 'View all replies']
|
||||||
'Index Navigation': [true, 'Navigate to previous / next thread']
|
'Index Navigation': [true, 'Navigate to previous / next thread']
|
||||||
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
||||||
|
'Check for Updates': [true, 'Check for updated versions of 4chan x (disabled on master)']
|
||||||
Hiding:
|
Hiding:
|
||||||
'Reply Hiding': [true, 'Hide single replies']
|
'Reply Hiding': [true, 'Hide single replies']
|
||||||
'Thread Hiding': [true, 'Hide entire threads']
|
'Thread Hiding': [true, 'Hide entire threads']
|
||||||
@ -111,6 +112,7 @@ conf = {}
|
|||||||
) null, config
|
) null, config
|
||||||
|
|
||||||
NAMESPACE = 'AEOS.4chan_x.'
|
NAMESPACE = 'AEOS.4chan_x.'
|
||||||
|
VERSION = 'master'
|
||||||
SECOND = 1000
|
SECOND = 1000
|
||||||
MINUTE = 60*SECOND
|
MINUTE = 60*SECOND
|
||||||
HOUR = 60*MINUTE
|
HOUR = 60*MINUTE
|
||||||
@ -969,7 +971,6 @@ qr =
|
|||||||
# email reverts
|
# email reverts
|
||||||
init: ->
|
init: ->
|
||||||
g.callbacks.push qr.node
|
g.callbacks.push qr.node
|
||||||
$.bind window, 'message', qr.message
|
|
||||||
$.bind $('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode
|
$.bind $('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode
|
||||||
qr.captchaTime = Date.now()
|
qr.captchaTime = Date.now()
|
||||||
|
|
||||||
@ -1083,11 +1084,10 @@ qr =
|
|||||||
|
|
||||||
$.add d.body, qr.el
|
$.add d.body, qr.el
|
||||||
|
|
||||||
message: (e) ->
|
message: (data) ->
|
||||||
$('iframe[name=iframe]').src = 'about:blank'
|
$('iframe[name=iframe]').src = 'about:blank'
|
||||||
fileCount = $('#files', qr.el).childElementCount
|
fileCount = $('#files', qr.el).childElementCount
|
||||||
|
|
||||||
{data} = e
|
|
||||||
if data # error message
|
if data # error message
|
||||||
data = JSON.parse data
|
data = JSON.parse data
|
||||||
$.extend $('#error', qr.el), data
|
$.extend $('#error', qr.el), data
|
||||||
@ -2183,9 +2183,9 @@ firstRun =
|
|||||||
$.rm $ '#overlay'
|
$.rm $ '#overlay'
|
||||||
$.unbind window, 'click', firstRun.close
|
$.unbind window, 'click', firstRun.close
|
||||||
|
|
||||||
main =
|
Main =
|
||||||
init: ->
|
init: ->
|
||||||
$.unbind window, 'load', main.init
|
$.unbind window, 'load', Main.init
|
||||||
pathname = location.pathname.substring(1).split('/')
|
pathname = location.pathname.substring(1).split('/')
|
||||||
[g.BOARD, temp] = pathname
|
[g.BOARD, temp] = pathname
|
||||||
if temp is 'res'
|
if temp is 'res'
|
||||||
@ -2203,6 +2203,7 @@ main =
|
|||||||
if not $ '#navtopr'
|
if not $ '#navtopr'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
$.bind window, 'message', Main.message
|
||||||
Favicon.init()
|
Favicon.init()
|
||||||
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
||||||
tzOffset = (new Date()).getTimezoneOffset() / 60
|
tzOffset = (new Date()).getTimezoneOffset() / 60
|
||||||
@ -2213,6 +2214,11 @@ main =
|
|||||||
lastChecked = $.get 'lastChecked', 0
|
lastChecked = $.get 'lastChecked', 0
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
if lastChecked < now - 1*DAY
|
if lastChecked < now - 1*DAY
|
||||||
|
$.set 'lastChecked', now
|
||||||
|
|
||||||
|
if conf['Check for Updates'] and VERSION isnt 'master'
|
||||||
|
$.add d.head, $.el 'script', src: 'https://raw.github.com/aeosynth/4chan-x/stable/latest.js'
|
||||||
|
|
||||||
cutoff = now - 7*DAY
|
cutoff = now - 7*DAY
|
||||||
hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {}
|
hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {}
|
||||||
|
|
||||||
@ -2226,9 +2232,8 @@ main =
|
|||||||
|
|
||||||
$.set "hiddenThreads/#{g.BOARD}/", hiddenThreads
|
$.set "hiddenThreads/#{g.BOARD}/", hiddenThreads
|
||||||
$.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies
|
$.set "hiddenReplies/#{g.BOARD}/", g.hiddenReplies
|
||||||
$.set 'lastChecked', now
|
|
||||||
|
|
||||||
$.addStyle main.css
|
$.addStyle Main.css
|
||||||
|
|
||||||
#recaptcha may be blocked, eg by noscript
|
#recaptcha may be blocked, eg by noscript
|
||||||
if (form = $ 'form[name=post]') and (canPost = !!$ '#recaptcha_response_field')
|
if (form = $ 'form[name=post]') and (canPost = !!$ '#recaptcha_response_field')
|
||||||
@ -2348,6 +2353,14 @@ main =
|
|||||||
unless $.get 'firstrun'
|
unless $.get 'firstrun'
|
||||||
firstRun.init()
|
firstRun.init()
|
||||||
|
|
||||||
|
message: (e) ->
|
||||||
|
{origin, data} = e
|
||||||
|
if origin is 'http://sys.4chan.org'
|
||||||
|
qr.message data
|
||||||
|
else
|
||||||
|
if data isnt VERSION
|
||||||
|
alert 'new version of 4chan x available on github!'
|
||||||
|
|
||||||
css: '
|
css: '
|
||||||
/* dialog styling */
|
/* dialog styling */
|
||||||
div.dialog {
|
div.dialog {
|
||||||
@ -2559,6 +2572,6 @@ main =
|
|||||||
|
|
||||||
#XXX Opera will load early if script is saved w/o .user
|
#XXX Opera will load early if script is saved w/o .user
|
||||||
if d.body
|
if d.body
|
||||||
main.init()
|
Main.init()
|
||||||
else
|
else
|
||||||
$.bind window, 'load', main.init
|
$.bind window, 'load', Main.init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user