Merge branch 'master' of github.com:MayhemYDG/4chan-x into qr
Conflicts: 4chan_x.user.js script.coffee
This commit is contained in:
commit
13085d3061
179
4chan_x.user.js
179
4chan_x.user.js
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan x
|
// @name 4chan x
|
||||||
// @version 2.24.0
|
// @version 2.24.2
|
||||||
// @namespace aeosynth
|
// @namespace aeosynth
|
||||||
// @description Adds various features.
|
// @description Adds various features.
|
||||||
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
|
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
|
||||||
* http://mayhemydg.github.com/4chan-x/
|
* http://mayhemydg.github.com/4chan-x/
|
||||||
* 4chan X 2.24.0
|
* 4chan X 2.24.2
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
NAMESPACE = '4chan_x.';
|
NAMESPACE = '4chan_x.';
|
||||||
|
|
||||||
VERSION = '2.24.0';
|
VERSION = '2.24.2';
|
||||||
|
|
||||||
SECOND = 1000;
|
SECOND = 1000;
|
||||||
|
|
||||||
@ -304,7 +304,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.extend($, {
|
$.extend($, {
|
||||||
onLoad: function(fc) {
|
ready: function(fc) {
|
||||||
var cb;
|
var cb;
|
||||||
if (/interactive|complete/.test(d.readyState)) return fc();
|
if (/interactive|complete/.test(d.readyState)) return fc();
|
||||||
cb = function() {
|
cb = function() {
|
||||||
@ -464,54 +464,44 @@
|
|||||||
|
|
||||||
$.cache.requests = {};
|
$.cache.requests = {};
|
||||||
|
|
||||||
if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) {
|
$.extend($, typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null ? {
|
||||||
$.extend($, {
|
"delete": function(name) {
|
||||||
"delete": function(name) {
|
name = NAMESPACE + name;
|
||||||
name = NAMESPACE + name;
|
return GM_deleteValue(name);
|
||||||
return GM_deleteValue(name);
|
},
|
||||||
},
|
get: function(name, defaultValue) {
|
||||||
get: function(name, defaultValue) {
|
var value;
|
||||||
var value;
|
name = NAMESPACE + name;
|
||||||
name = NAMESPACE + name;
|
if (value = GM_getValue(name)) {
|
||||||
if (value = GM_getValue(name)) {
|
return JSON.parse(value);
|
||||||
return JSON.parse(value);
|
} else {
|
||||||
} else {
|
return defaultValue;
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openInTab: function(url) {
|
|
||||||
return GM_openInTab(url);
|
|
||||||
},
|
|
||||||
set: function(name, value) {
|
|
||||||
name = NAMESPACE + name;
|
|
||||||
localStorage[name] = JSON.stringify(value);
|
|
||||||
return GM_setValue(name, JSON.stringify(value));
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
} else {
|
set: function(name, value) {
|
||||||
$.extend($, {
|
name = NAMESPACE + name;
|
||||||
"delete": function(name) {
|
localStorage[name] = JSON.stringify(value);
|
||||||
name = NAMESPACE + name;
|
return GM_setValue(name, JSON.stringify(value));
|
||||||
return delete localStorage[name];
|
}
|
||||||
},
|
} : {
|
||||||
get: function(name, defaultValue) {
|
"delete": function(name) {
|
||||||
var value;
|
name = NAMESPACE + name;
|
||||||
name = NAMESPACE + name;
|
return delete localStorage[name];
|
||||||
if (value = localStorage[name]) {
|
},
|
||||||
return JSON.parse(value);
|
get: function(name, defaultValue) {
|
||||||
} else {
|
var value;
|
||||||
return defaultValue;
|
name = NAMESPACE + name;
|
||||||
}
|
if (value = localStorage[name]) {
|
||||||
},
|
return JSON.parse(value);
|
||||||
openInTab: function(url) {
|
} else {
|
||||||
return window.open(url, "_blank");
|
return defaultValue;
|
||||||
},
|
|
||||||
set: function(name, value) {
|
|
||||||
name = NAMESPACE + name;
|
|
||||||
return localStorage[name] = JSON.stringify(value);
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
}
|
set: function(name, value) {
|
||||||
|
name = NAMESPACE + name;
|
||||||
|
return localStorage[name] = JSON.stringify(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for (key in conf) {
|
for (key in conf) {
|
||||||
val = conf[key];
|
val = conf[key];
|
||||||
@ -1067,11 +1057,12 @@
|
|||||||
return $('textarea', qr.el).focus();
|
return $('textarea', qr.el).focus();
|
||||||
},
|
},
|
||||||
open: function(thread, tab) {
|
open: function(thread, tab) {
|
||||||
var id, url;
|
var id, open, url;
|
||||||
id = thread.firstChild.id;
|
id = thread.firstChild.id;
|
||||||
url = "http://boards.4chan.org/" + g.BOARD + "/res/" + id;
|
url = "http://boards.4chan.org/" + g.BOARD + "/res/" + id;
|
||||||
if (tab) {
|
if (tab) {
|
||||||
return $.openInTab(url);
|
open = GM_openInTab || window.open;
|
||||||
|
return open(url, "_blank");
|
||||||
} else {
|
} else {
|
||||||
return location.href = url;
|
return location.href = url;
|
||||||
}
|
}
|
||||||
@ -1410,12 +1401,12 @@
|
|||||||
$.on(a, 'click', options.dialog);
|
$.on(a, 'click', options.dialog);
|
||||||
$.replace(home, a);
|
$.replace(home, a);
|
||||||
if (!$.get('firstrun')) {
|
if (!$.get('firstrun')) {
|
||||||
options.dialog();
|
$.set('firstrun', true);
|
||||||
return $.set('firstrun', true);
|
return options.dialog();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, option, overlay, ta, time, ul, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5;
|
var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
|
||||||
dialog = $.el('div', {
|
dialog = $.el('div', {
|
||||||
id: 'options',
|
id: 'options',
|
||||||
className: 'reply dialog',
|
className: 'reply dialog',
|
||||||
@ -1476,11 +1467,11 @@
|
|||||||
<div class=error><code>Unread Count</code> is disabled.</div>\
|
<div class=error><code>Unread Count</code> is disabled.</div>\
|
||||||
Unread favicons<br>\
|
Unread favicons<br>\
|
||||||
<select name=favicon>\
|
<select name=favicon>\
|
||||||
<option>ferongr</option>\
|
<option value=ferongr>ferongr</option>\
|
||||||
<option>xat-</option>\
|
<option value=xat->xat-</option>\
|
||||||
<option>Mayhem</option>\
|
<option value=Mayhem>Mayhem</option>\
|
||||||
<option>Original</option>\
|
<option value=Original>Original</option>\
|
||||||
<option>None</option>\
|
<option value=None>None</option>\
|
||||||
</select>\
|
</select>\
|
||||||
<span></span>\
|
<span></span>\
|
||||||
</div>\
|
</div>\
|
||||||
@ -1553,27 +1544,20 @@
|
|||||||
$.on(time, 'keyup', $.cb.value);
|
$.on(time, 'keyup', $.cb.value);
|
||||||
$.on(time, 'keyup', options.time);
|
$.on(time, 'keyup', options.time);
|
||||||
favicon = $('select', dialog);
|
favicon = $('select', dialog);
|
||||||
_ref3 = favicon.options;
|
favicon.value = conf['favicon'];
|
||||||
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
|
|
||||||
option = _ref3[_j];
|
|
||||||
if (option.textContent === conf['favicon']) {
|
|
||||||
option.selected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.on(favicon, 'change', $.cb.value);
|
$.on(favicon, 'change', $.cb.value);
|
||||||
$.on(favicon, 'change', options.favicon);
|
$.on(favicon, 'change', options.favicon);
|
||||||
_ref4 = $$('#keybinds_tab + div input', dialog);
|
_ref3 = $$('#keybinds_tab + div input', dialog);
|
||||||
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
|
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
|
||||||
input = _ref4[_k];
|
input = _ref3[_j];
|
||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
input.value = conf[input.name];
|
input.value = conf[input.name];
|
||||||
$.on(input, 'keydown', options.keybind);
|
$.on(input, 'keydown', options.keybind);
|
||||||
}
|
}
|
||||||
indicators = {};
|
indicators = {};
|
||||||
_ref5 = $$('.error', dialog);
|
_ref4 = $$('.error', dialog);
|
||||||
for (_l = 0, _len4 = _ref5.length; _l < _len4; _l++) {
|
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
|
||||||
indicator = _ref5[_l];
|
indicator = _ref4[_k];
|
||||||
key = indicator.firstChild.textContent;
|
key = indicator.firstChild.textContent;
|
||||||
indicator.hidden = conf[key];
|
indicator.hidden = conf[key];
|
||||||
indicators[key] = indicator;
|
indicators[key] = indicator;
|
||||||
@ -2553,7 +2537,7 @@
|
|||||||
threadStats.postcountEl.textContent = ++threadStats.posts;
|
threadStats.postcountEl.textContent = ++threadStats.posts;
|
||||||
if ($('img[md5]', root)) {
|
if ($('img[md5]', root)) {
|
||||||
threadStats.imagecountEl.textContent = ++threadStats.images;
|
threadStats.imagecountEl.textContent = ++threadStats.images;
|
||||||
if (threadStats.images > 150) {
|
if (threadStats.images > 151) {
|
||||||
return threadStats.imagecountEl.className = 'error';
|
return threadStats.imagecountEl.className = 'error';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2562,11 +2546,11 @@
|
|||||||
|
|
||||||
unread = {
|
unread = {
|
||||||
init: function() {
|
init: function() {
|
||||||
unread.replies = [];
|
|
||||||
d.title = '(0) ' + d.title;
|
d.title = '(0) ' + d.title;
|
||||||
$.on(window, 'scroll', unread.scroll);
|
$.on(window, 'scroll', unread.scroll);
|
||||||
return g.callbacks.push(unread.node);
|
return g.callbacks.push(unread.node);
|
||||||
},
|
},
|
||||||
|
replies: [],
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
if (root.hidden || root.className) return;
|
if (root.hidden || root.className) return;
|
||||||
unread.replies.push(root);
|
unread.replies.push(root);
|
||||||
@ -2859,21 +2843,14 @@
|
|||||||
if (!thumb.hidden) return imgExpand.expand(thumb);
|
if (!thumb.hidden) return imgExpand.expand(thumb);
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var controls, form, imageType, option, select, _i, _len, _ref;
|
var controls, form, imageType, select;
|
||||||
controls = $.el('div', {
|
controls = $.el('div', {
|
||||||
id: 'imgControls',
|
id: 'imgControls',
|
||||||
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit height</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
innerHTML: "<select id=imageType name=imageType><option value=full>Full</option><option value='fit width'>Fit Width</option><option value='fit height'>Fit Height</option value='fit screen'><option value='fit screen'>Fit Screen</option></select><label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
});
|
});
|
||||||
imageType = $.get('imageType', 'full');
|
imageType = $.get('imageType', 'full');
|
||||||
select = $('select', controls);
|
select = $('select', controls);
|
||||||
_ref = select.options;
|
select.value = imageType;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
option = _ref[_i];
|
|
||||||
if (option.textContent === imageType) {
|
|
||||||
option.selected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
imgExpand.cb.typeChange.call(select);
|
imgExpand.cb.typeChange.call(select);
|
||||||
$.on(select, 'change', $.cb.value);
|
$.on(select, 'change', $.cb.value);
|
||||||
$.on(select, 'change', imgExpand.cb.typeChange);
|
$.on(select, 'change', imgExpand.cb.typeChange);
|
||||||
@ -2898,22 +2875,20 @@
|
|||||||
g.PAGENUM = parseInt(temp) || 0;
|
g.PAGENUM = parseInt(temp) || 0;
|
||||||
}
|
}
|
||||||
if (location.hostname === 'sys.4chan.org') {
|
if (location.hostname === 'sys.4chan.org') {
|
||||||
$.onLoad(qr.sys);
|
$.ready(qr.sys);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (location.hostname === 'images.4chan.org') {
|
if (location.hostname === 'images.4chan.org') {
|
||||||
if (conf['404 Redirect']) {
|
$.ready(function() {
|
||||||
$.onLoad(function() {
|
if (d.title === '4chan - 404') return redirect.init();
|
||||||
if (d.title === '4chan - 404') return redirect.init();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.onLoad(options.init);
|
$.ready(options.init);
|
||||||
$.on(window, 'message', Main.message);
|
$.on(window, 'message', Main.message);
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
|
if (conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * HOUR) {
|
||||||
$.onLoad(function() {
|
$.ready(function() {
|
||||||
return $.add(d.head, $.el('script', {
|
return $.add(d.head, $.el('script', {
|
||||||
src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
||||||
}));
|
}));
|
||||||
@ -2945,15 +2920,16 @@
|
|||||||
if (conf['Sauce']) sauce.init();
|
if (conf['Sauce']) sauce.init();
|
||||||
if (conf['Image Auto-Gif']) imgGif.init();
|
if (conf['Image Auto-Gif']) imgGif.init();
|
||||||
if (conf['Image Hover']) imgHover.init();
|
if (conf['Image Hover']) imgHover.init();
|
||||||
|
if (conf['Reveal Spoilers']) revealSpoilers.init();
|
||||||
if (conf['Report Button']) reportButton.init();
|
if (conf['Report Button']) reportButton.init();
|
||||||
if (conf['Quote Inline']) quoteInline.init();
|
if (conf['Quote Inline']) quoteInline.init();
|
||||||
if (conf['Quote Preview']) quotePreview.init();
|
if (conf['Quote Preview']) quotePreview.init();
|
||||||
if (conf['Quote Backlinks']) quoteBacklink.init();
|
if (conf['Quote Backlinks']) quoteBacklink.init();
|
||||||
if (conf['Indicate OP quote']) quoteOP.init();
|
if (conf['Indicate OP quote']) quoteOP.init();
|
||||||
if (conf['Indicate Cross-thread Quotes']) quoteDR.init();
|
if (conf['Indicate Cross-thread Quotes']) quoteDR.init();
|
||||||
return $.onLoad(Main.onLoad);
|
return $.ready(Main.ready);
|
||||||
},
|
},
|
||||||
onLoad: function() {
|
ready: function() {
|
||||||
var callback, node, nodes, _i, _j, _len, _len2, _ref;
|
var callback, node, nodes, _i, _j, _len, _len2, _ref;
|
||||||
if (conf['404 Redirect'] && d.title === '4chan - 404') {
|
if (conf['404 Redirect'] && d.title === '4chan - 404') {
|
||||||
redirect.init();
|
redirect.init();
|
||||||
@ -2966,19 +2942,19 @@
|
|||||||
Favicon.init();
|
Favicon.init();
|
||||||
if (conf['Quick Reply']) qr.init();
|
if (conf['Quick Reply']) qr.init();
|
||||||
if (conf['Image Expansion']) imgExpand.init();
|
if (conf['Image Expansion']) imgExpand.init();
|
||||||
if (conf['Reveal Spoilers'] && $('.postarea label')) revealSpoilers.init();
|
|
||||||
if (conf['Thread Watcher']) watcher.init();
|
if (conf['Thread Watcher']) watcher.init();
|
||||||
if (conf['Keybinds']) keybinds.init();
|
if (conf['Keybinds']) keybinds.init();
|
||||||
if (conf['Reply Navigation'] || conf['Index Navigation']) nav.init();
|
|
||||||
if (g.REPLY) {
|
if (g.REPLY) {
|
||||||
if (conf['Thread Updater']) updater.init();
|
if (conf['Thread Updater']) updater.init();
|
||||||
if (conf['Thread Stats']) threadStats.init();
|
if (conf['Thread Stats']) threadStats.init();
|
||||||
|
if (conf['Reply Navigation']) nav.init();
|
||||||
if (conf['Post in Title']) titlePost.init();
|
if (conf['Post in Title']) titlePost.init();
|
||||||
if (conf['Unread Count']) unread.init();
|
if (conf['Unread Count']) unread.init();
|
||||||
} else {
|
} else {
|
||||||
if (conf['Thread Hiding']) threadHiding.init();
|
if (conf['Thread Hiding']) threadHiding.init();
|
||||||
if (conf['Thread Expansion']) expandThread.init();
|
if (conf['Thread Expansion']) expandThread.init();
|
||||||
if (conf['Comment Expansion']) expandComment.init();
|
if (conf['Comment Expansion']) expandComment.init();
|
||||||
|
if (conf['Index Navigation']) nav.init();
|
||||||
}
|
}
|
||||||
nodes = $$('.op, a + table');
|
nodes = $$('.op, a + table');
|
||||||
_ref = g.callbacks;
|
_ref = g.callbacks;
|
||||||
@ -3020,10 +2996,10 @@
|
|||||||
},
|
},
|
||||||
css: '\
|
css: '\
|
||||||
/* dialog styling */\
|
/* dialog styling */\
|
||||||
div.dialog {\
|
.dialog {\
|
||||||
border: 1px solid;\
|
border: 1px solid rgba(0,0,0,.25);\
|
||||||
}\
|
}\
|
||||||
div.dialog > div.move {\
|
.move {\
|
||||||
cursor: move;\
|
cursor: move;\
|
||||||
}\
|
}\
|
||||||
label, a, .favicon {\
|
label, a, .favicon {\
|
||||||
@ -3093,6 +3069,7 @@
|
|||||||
bottom: 0;\
|
bottom: 0;\
|
||||||
text-align: center;\
|
text-align: center;\
|
||||||
background: rgba(0,0,0,.5);\
|
background: rgba(0,0,0,.5);\
|
||||||
|
z-index: 1;\
|
||||||
}\
|
}\
|
||||||
#overlay::after {\
|
#overlay::after {\
|
||||||
content: "";\
|
content: "";\
|
||||||
|
|||||||
2
Cakefile
2
Cakefile
@ -2,7 +2,7 @@
|
|||||||
{exec} = require 'child_process'
|
{exec} = require 'child_process'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
|
|
||||||
VERSION = '2.24.0'
|
VERSION = '2.24.2'
|
||||||
|
|
||||||
HEADER = """
|
HEADER = """
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
|
|||||||
@ -1,5 +1,14 @@
|
|||||||
master
|
master
|
||||||
|
|
||||||
|
2.24.2
|
||||||
|
- mayhem
|
||||||
|
fix options popping up everytime a page loads
|
||||||
|
|
||||||
|
2.24.1
|
||||||
|
- mayhem
|
||||||
|
fix Open thread in new tab keybind for Safari with Ninjakit
|
||||||
|
fix Index/Reply Navigation working in both cases when only one is enabled
|
||||||
|
|
||||||
2.24.0
|
2.24.0
|
||||||
- mayhem
|
- mayhem
|
||||||
redirect 404'd pictures to archives when possible
|
redirect 404'd pictures to archives when possible
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
postMessage({version:'2.24.0'},'*');
|
postMessage({version:'2.24.2'},'*');
|
||||||
|
|||||||
@ -121,7 +121,7 @@ conf = {}
|
|||||||
) null, config
|
) null, config
|
||||||
|
|
||||||
NAMESPACE = '4chan_x.'
|
NAMESPACE = '4chan_x.'
|
||||||
VERSION = '2.24.0'
|
VERSION = '2.24.2'
|
||||||
SECOND = 1000
|
SECOND = 1000
|
||||||
MINUTE = 60*SECOND
|
MINUTE = 60*SECOND
|
||||||
HOUR = 60*MINUTE
|
HOUR = 60*MINUTE
|
||||||
@ -221,7 +221,7 @@ $.extend = (object, properties) ->
|
|||||||
object
|
object
|
||||||
|
|
||||||
$.extend $,
|
$.extend $,
|
||||||
onLoad: (fc) ->
|
ready: (fc) ->
|
||||||
if /interactive|complete/.test d.readyState
|
if /interactive|complete/.test d.readyState
|
||||||
return fc()
|
return fc()
|
||||||
cb = ->
|
cb = ->
|
||||||
@ -353,8 +353,8 @@ $.extend $,
|
|||||||
|
|
||||||
$.cache.requests = {}
|
$.cache.requests = {}
|
||||||
|
|
||||||
if GM_deleteValue?
|
$.extend $,
|
||||||
$.extend $,
|
if GM_deleteValue?
|
||||||
delete: (name) ->
|
delete: (name) ->
|
||||||
name = NAMESPACE + name
|
name = NAMESPACE + name
|
||||||
GM_deleteValue name
|
GM_deleteValue name
|
||||||
@ -364,15 +364,12 @@ if GM_deleteValue?
|
|||||||
JSON.parse value
|
JSON.parse value
|
||||||
else
|
else
|
||||||
defaultValue
|
defaultValue
|
||||||
openInTab: (url) ->
|
|
||||||
GM_openInTab url
|
|
||||||
set: (name, value) ->
|
set: (name, value) ->
|
||||||
name = NAMESPACE + name
|
name = NAMESPACE + name
|
||||||
# for `storage` events
|
# for `storage` events
|
||||||
localStorage[name] = JSON.stringify value
|
localStorage[name] = JSON.stringify value
|
||||||
GM_setValue name, JSON.stringify value
|
GM_setValue name, JSON.stringify value
|
||||||
else
|
else
|
||||||
$.extend $,
|
|
||||||
delete: (name) ->
|
delete: (name) ->
|
||||||
name = NAMESPACE + name
|
name = NAMESPACE + name
|
||||||
delete localStorage[name]
|
delete localStorage[name]
|
||||||
@ -382,8 +379,6 @@ else
|
|||||||
JSON.parse value
|
JSON.parse value
|
||||||
else
|
else
|
||||||
defaultValue
|
defaultValue
|
||||||
openInTab: (url) ->
|
|
||||||
window.open url, "_blank"
|
|
||||||
set: (name, value) ->
|
set: (name, value) ->
|
||||||
name = NAMESPACE + name
|
name = NAMESPACE + name
|
||||||
localStorage[name] = JSON.stringify value
|
localStorage[name] = JSON.stringify value
|
||||||
@ -761,7 +756,8 @@ keybinds =
|
|||||||
id = thread.firstChild.id
|
id = thread.firstChild.id
|
||||||
url = "http://boards.4chan.org/#{g.BOARD}/res/#{id}"
|
url = "http://boards.4chan.org/#{g.BOARD}/res/#{id}"
|
||||||
if tab
|
if tab
|
||||||
$.openInTab url
|
open = GM_openInTab or window.open
|
||||||
|
open url, "_blank"
|
||||||
else
|
else
|
||||||
location.href = url
|
location.href = url
|
||||||
|
|
||||||
@ -1146,8 +1142,8 @@ options =
|
|||||||
$.on a, 'click', options.dialog
|
$.on a, 'click', options.dialog
|
||||||
$.replace home, a
|
$.replace home, a
|
||||||
unless $.get 'firstrun'
|
unless $.get 'firstrun'
|
||||||
options.dialog()
|
|
||||||
$.set 'firstrun', true
|
$.set 'firstrun', true
|
||||||
|
options.dialog()
|
||||||
|
|
||||||
dialog: ->
|
dialog: ->
|
||||||
dialog = $.el 'div'
|
dialog = $.el 'div'
|
||||||
@ -1210,11 +1206,11 @@ options =
|
|||||||
<div class=error><code>Unread Count</code> is disabled.</div>
|
<div class=error><code>Unread Count</code> is disabled.</div>
|
||||||
Unread favicons<br>
|
Unread favicons<br>
|
||||||
<select name=favicon>
|
<select name=favicon>
|
||||||
<option>ferongr</option>
|
<option value=ferongr>ferongr</option>
|
||||||
<option>xat-</option>
|
<option value=xat->xat-</option>
|
||||||
<option>Mayhem</option>
|
<option value=Mayhem>Mayhem</option>
|
||||||
<option>Original</option>
|
<option value=Original>Original</option>
|
||||||
<option>None</option>
|
<option value=None>None</option>
|
||||||
</select>
|
</select>
|
||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
@ -1282,10 +1278,7 @@ options =
|
|||||||
$.on time, 'keyup', $.cb.value
|
$.on time, 'keyup', $.cb.value
|
||||||
$.on time, 'keyup', options.time
|
$.on time, 'keyup', options.time
|
||||||
favicon = $ 'select', dialog
|
favicon = $ 'select', dialog
|
||||||
for option in favicon.options
|
favicon.value = conf['favicon']
|
||||||
if option.textContent is conf['favicon']
|
|
||||||
option.selected = true
|
|
||||||
break
|
|
||||||
$.on favicon, 'change', $.cb.value
|
$.on favicon, 'change', $.cb.value
|
||||||
$.on favicon, 'change', options.favicon
|
$.on favicon, 'change', options.favicon
|
||||||
|
|
||||||
@ -2031,16 +2024,17 @@ threadStats =
|
|||||||
threadStats.postcountEl.textContent = ++threadStats.posts
|
threadStats.postcountEl.textContent = ++threadStats.posts
|
||||||
if $ 'img[md5]', root
|
if $ 'img[md5]', root
|
||||||
threadStats.imagecountEl.textContent = ++threadStats.images
|
threadStats.imagecountEl.textContent = ++threadStats.images
|
||||||
if threadStats.images > 150
|
if threadStats.images > 151
|
||||||
threadStats.imagecountEl.className = 'error'
|
threadStats.imagecountEl.className = 'error'
|
||||||
|
|
||||||
unread =
|
unread =
|
||||||
init: ->
|
init: ->
|
||||||
unread.replies = []
|
|
||||||
d.title = '(0) ' + d.title
|
d.title = '(0) ' + d.title
|
||||||
$.on window, 'scroll', unread.scroll
|
$.on window, 'scroll', unread.scroll
|
||||||
g.callbacks.push unread.node
|
g.callbacks.push unread.node
|
||||||
|
|
||||||
|
replies: []
|
||||||
|
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
return if root.hidden or root.className
|
return if root.hidden or root.className
|
||||||
unread.replies.push root
|
unread.replies.push root
|
||||||
@ -2128,7 +2122,6 @@ Favicon =
|
|||||||
redirect =
|
redirect =
|
||||||
init: ->
|
init: ->
|
||||||
url =
|
url =
|
||||||
# waiting for https://github.com/FoOlRulez/FoOlFuuka/issues/11
|
|
||||||
if location.hostname is 'images.4chan.org'
|
if location.hostname is 'images.4chan.org'
|
||||||
redirect.image g.BOARD, location.pathname.split('/')[3]
|
redirect.image g.BOARD, location.pathname.split('/')[3]
|
||||||
else if /^\d+$/.test g.THREAD_ID
|
else if /^\d+$/.test g.THREAD_ID
|
||||||
@ -2260,14 +2253,10 @@ imgExpand =
|
|||||||
controls = $.el 'div',
|
controls = $.el 'div',
|
||||||
id: 'imgControls'
|
id: 'imgControls'
|
||||||
innerHTML:
|
innerHTML:
|
||||||
"<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit height</option><option>fit screen</option></select>
|
"<select id=imageType name=imageType><option value=full>Full</option><option value='fit width'>Fit Width</option><option value='fit height'>Fit Height</option value='fit screen'><option value='fit screen'>Fit Screen</option></select><label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
<label>Expand Images<input type=checkbox id=imageExpand></label>"
|
|
||||||
imageType = $.get 'imageType', 'full'
|
imageType = $.get 'imageType', 'full'
|
||||||
select = $ 'select', controls
|
select = $ 'select', controls
|
||||||
for option in select.options
|
select.value = imageType
|
||||||
if option.textContent is imageType
|
|
||||||
option.selected = true
|
|
||||||
break
|
|
||||||
imgExpand.cb.typeChange.call select
|
imgExpand.cb.typeChange.call select
|
||||||
$.on select, 'change', $.cb.value
|
$.on select, 'change', $.cb.value
|
||||||
$.on select, 'change', imgExpand.cb.typeChange
|
$.on select, 'change', imgExpand.cb.typeChange
|
||||||
@ -2290,20 +2279,19 @@ Main =
|
|||||||
g.PAGENUM = parseInt(temp) or 0
|
g.PAGENUM = parseInt(temp) or 0
|
||||||
|
|
||||||
if location.hostname is 'sys.4chan.org'
|
if location.hostname is 'sys.4chan.org'
|
||||||
$.onLoad qr.sys
|
$.ready qr.sys
|
||||||
return
|
return
|
||||||
if location.hostname is 'images.4chan.org'
|
if location.hostname is 'images.4chan.org'
|
||||||
if conf['404 Redirect']
|
$.ready -> redirect.init() if d.title is '4chan - 404'
|
||||||
$.onLoad -> redirect.init() if d.title is '4chan - 404'
|
|
||||||
return
|
return
|
||||||
|
|
||||||
$.onLoad options.init
|
$.ready options.init
|
||||||
|
|
||||||
$.on window, 'message', Main.message
|
$.on window, 'message', Main.message
|
||||||
|
|
||||||
now = Date.now()
|
now = Date.now()
|
||||||
if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR
|
if conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*HOUR
|
||||||
$.onLoad -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
$.ready -> $.add d.head, $.el 'script', src: 'https://raw.github.com/mayhemydg/4chan-x/master/latest.js'
|
||||||
$.set 'lastUpdate', now
|
$.set 'lastUpdate', now
|
||||||
|
|
||||||
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {}
|
||||||
@ -2350,6 +2338,9 @@ Main =
|
|||||||
if conf['Image Hover']
|
if conf['Image Hover']
|
||||||
imgHover.init()
|
imgHover.init()
|
||||||
|
|
||||||
|
if conf['Reveal Spoilers']
|
||||||
|
revealSpoilers.init()
|
||||||
|
|
||||||
if conf['Report Button']
|
if conf['Report Button']
|
||||||
reportButton.init()
|
reportButton.init()
|
||||||
|
|
||||||
@ -2369,9 +2360,9 @@ Main =
|
|||||||
quoteDR.init()
|
quoteDR.init()
|
||||||
|
|
||||||
|
|
||||||
$.onLoad Main.onLoad
|
$.ready Main.ready
|
||||||
|
|
||||||
onLoad: ->
|
ready: ->
|
||||||
if conf['404 Redirect'] and d.title is '4chan - 404'
|
if conf['404 Redirect'] and d.title is '4chan - 404'
|
||||||
redirect.init()
|
redirect.init()
|
||||||
return
|
return
|
||||||
@ -2389,18 +2380,12 @@ Main =
|
|||||||
if conf['Image Expansion']
|
if conf['Image Expansion']
|
||||||
imgExpand.init()
|
imgExpand.init()
|
||||||
|
|
||||||
if conf['Reveal Spoilers'] and $('.postarea label')
|
|
||||||
revealSpoilers.init()
|
|
||||||
|
|
||||||
if conf['Thread Watcher']
|
if conf['Thread Watcher']
|
||||||
watcher.init()
|
watcher.init()
|
||||||
|
|
||||||
if conf['Keybinds']
|
if conf['Keybinds']
|
||||||
keybinds.init()
|
keybinds.init()
|
||||||
|
|
||||||
if conf['Reply Navigation'] or conf['Index Navigation']
|
|
||||||
nav.init()
|
|
||||||
|
|
||||||
if g.REPLY
|
if g.REPLY
|
||||||
if conf['Thread Updater']
|
if conf['Thread Updater']
|
||||||
updater.init()
|
updater.init()
|
||||||
@ -2408,6 +2393,9 @@ Main =
|
|||||||
if conf['Thread Stats']
|
if conf['Thread Stats']
|
||||||
threadStats.init()
|
threadStats.init()
|
||||||
|
|
||||||
|
if conf['Reply Navigation']
|
||||||
|
nav.init()
|
||||||
|
|
||||||
if conf['Post in Title']
|
if conf['Post in Title']
|
||||||
titlePost.init()
|
titlePost.init()
|
||||||
|
|
||||||
@ -2424,6 +2412,9 @@ Main =
|
|||||||
if conf['Comment Expansion']
|
if conf['Comment Expansion']
|
||||||
expandComment.init()
|
expandComment.init()
|
||||||
|
|
||||||
|
if conf['Index Navigation']
|
||||||
|
nav.init()
|
||||||
|
|
||||||
|
|
||||||
nodes = $$ '.op, a + table'
|
nodes = $$ '.op, a + table'
|
||||||
for callback in g.callbacks
|
for callback in g.callbacks
|
||||||
@ -2450,10 +2441,10 @@ Main =
|
|||||||
|
|
||||||
css: '
|
css: '
|
||||||
/* dialog styling */
|
/* dialog styling */
|
||||||
div.dialog {
|
.dialog {
|
||||||
border: 1px solid;
|
border: 1px solid rgba(0,0,0,.25);
|
||||||
}
|
}
|
||||||
div.dialog > div.move {
|
.move {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
label, a, .favicon {
|
label, a, .favicon {
|
||||||
@ -2523,6 +2514,7 @@ Main =
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: rgba(0,0,0,.5);
|
background: rgba(0,0,0,.5);
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
#overlay::after {
|
#overlay::after {
|
||||||
content: "";
|
content: "";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user