Merge branch 'master' of github.com:aeosynth/4chan-x

This commit is contained in:
James Campos 2011-09-21 13:49:17 -07:00
commit b042de4bf2
4 changed files with 26 additions and 25 deletions

View File

@ -6,6 +6,7 @@
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @include http://boards.4chan.org/* // @include http://boards.4chan.org/*
// @include http://sys.4chan.org/* // @include http://sys.4chan.org/*
// @run-at document-start
// @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png // @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png
// ==/UserScript== // ==/UserScript==
@ -60,7 +61,7 @@
*/ */
(function() { (function() {
var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, 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, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, pathname, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, temp, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher;
var __slice = Array.prototype.slice; var __slice = Array.prototype.slice;
config = { config = {
main: { main: {
@ -501,6 +502,14 @@
val = conf[key]; val = conf[key];
conf[key] = $.get(key, val); conf[key] = $.get(key, val);
} }
pathname = location.pathname.substring(1).split('/');
g.BOARD = pathname[0], temp = pathname[1];
if (temp === 'res') {
g.REPLY = temp;
g.THREAD_ID = pathname[2];
} else {
g.PAGENUM = parseInt(temp) || 0;
}
$$ = function(selector, root) { $$ = function(selector, root) {
if (root == null) { if (root == null) {
root = d.body; root = d.body;
@ -595,7 +604,7 @@
} }
}, },
toggle: function(thread) { toggle: function(thread) {
var a, backlink, num, pathname, prev, table, threadID, _i, _len, _ref, _ref2, _results; var a, backlink, num, prev, table, threadID, _i, _len, _ref, _ref2, _results;
threadID = thread.firstChild.id; threadID = thread.firstChild.id;
pathname = "/" + g.BOARD + "/res/" + threadID; pathname = "/" + g.BOARD + "/res/" + threadID;
a = $('a.omittedposts', thread); a = $('a.omittedposts', thread);
@ -2198,7 +2207,7 @@
}); });
}, },
toggle: function(e) { toggle: function(e) {
var el, hidden, id, inline, inlined, pathname, root, table, threadID, _i, _len, _ref; var el, hidden, id, inline, inlined, root, table, threadID, _i, _len, _ref;
if (e.shiftKey || e.altKey || e.ctrlKey || e.button !== 0) { if (e.shiftKey || e.altKey || e.ctrlKey || e.button !== 0) {
return; return;
} }
@ -2769,16 +2778,7 @@
}; };
Main = { Main = {
init: function() { init: function() {
var callback, cutoff, 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, cutoff, hiddenThreads, id, lastChecked, now, op, table, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5;
$.unbind(window, 'load', Main.init);
pathname = location.pathname.substring(1).split('/');
g.BOARD = pathname[0], temp = pathname[1];
if (temp === 'res') {
g.REPLY = temp;
g.THREAD_ID = pathname[2];
} else {
g.PAGENUM = parseInt(temp) || 0;
}
if (location.hostname === 'sys.4chan.org') { if (location.hostname === 'sys.4chan.org') {
QR.sys(); QR.sys();
return; return;
@ -3164,6 +3164,6 @@
if (d.body) { if (d.body) {
Main.init(); Main.init();
} else { } else {
$.bind(window, 'load', Main.init); $.bind(document, 'DOMContentLoaded', Main.init);
} }
}).call(this); }).call(this);

View File

@ -11,6 +11,7 @@ HEADER = """
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @include http://boards.4chan.org/* // @include http://boards.4chan.org/*
// @include http://sys.4chan.org/* // @include http://sys.4chan.org/*
// @run-at document-start
// @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png // @icon https://raw.github.com/aeosynth/4chan-x/gh-pages/favicon.png
// ==/UserScript== // ==/UserScript==

View File

@ -1,4 +1,6 @@
master master
- mayhem
initiate 4chan X earlier
2.20.1 2.20.1
- mayhem - mayhem

View File

@ -363,6 +363,14 @@ else
for key, val of conf for key, val of conf
conf[key] = $.get key, val conf[key] = $.get key, val
pathname = location.pathname.substring(1).split('/')
[g.BOARD, temp] = pathname
if temp is 'res'
g.REPLY = temp
g.THREAD_ID = pathname[2]
else
g.PAGENUM = parseInt(temp) or 0
$$ = (selector, root=d.body) -> $$ = (selector, root=d.body) ->
Array::slice.call root.querySelectorAll selector Array::slice.call root.querySelectorAll selector
@ -2117,15 +2125,6 @@ firstRun =
Main = Main =
init: -> init: ->
$.unbind window, 'load', Main.init
pathname = location.pathname.substring(1).split('/')
[g.BOARD, temp] = pathname
if temp is 'res'
g.REPLY = temp
g.THREAD_ID = pathname[2]
else
g.PAGENUM = parseInt(temp) or 0
if location.hostname is 'sys.4chan.org' if location.hostname is 'sys.4chan.org'
QR.sys() QR.sys()
return return
@ -2493,8 +2492,7 @@ Main =
} }
' '
#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 document, 'DOMContentLoaded', Main.init