Release 4chan X v1.11.23.0.
This commit is contained in:
parent
96ba5f10ca
commit
96884b82b6
@ -2,6 +2,13 @@
|
||||
|
||||
Sometimes the changelog has notes (not comprehensive) acknowledging people's work. This does not mean the changes are their fault, only that their code was used. All changes to the script are chosen by and the fault of the maintainer (ccd0).
|
||||
|
||||
### v1.11.23
|
||||
|
||||
**v1.11.23.0** *(2016-01-24)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.23.0/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||
- Based on v1.11.22.4.
|
||||
- Show warnings when running multiple copies of 4chan X or the page doesn't load completely.
|
||||
- Minor bugfixes.
|
||||
|
||||
### v1.11.22
|
||||
|
||||
**v1.11.22.4** *(2016-01-23)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.4/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.22.4/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X beta
|
||||
// @version 1.11.22.4
|
||||
// @version 1.11.23.0
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X beta
|
||||
// @version 1.11.22.4
|
||||
// @version 1.11.23.0
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -434,7 +434,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.11.22.4',
|
||||
VERSION: '1.11.23.0',
|
||||
NAMESPACE: '4chan X.',
|
||||
boards: {}
|
||||
};
|
||||
@ -602,7 +602,7 @@
|
||||
if (req = reqs[url]) {
|
||||
if (req.readyState === 4) {
|
||||
$.queueTask(function() {
|
||||
return cb.call(req, req.evt);
|
||||
return cb.call(req, req.evt, true);
|
||||
});
|
||||
} else {
|
||||
req.callbacks.push(cb);
|
||||
@ -622,13 +622,16 @@
|
||||
}
|
||||
$.on(req, 'load', function(e) {
|
||||
var k, len1, ref;
|
||||
this.evt = e;
|
||||
ref = this.callbacks;
|
||||
for (k = 0, len1 = ref.length; k < len1; k++) {
|
||||
cb = ref[k];
|
||||
cb.call(this, e);
|
||||
$.queueTask((function(_this) {
|
||||
return function() {
|
||||
return cb.call(_this, e, false);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
this.evt = e;
|
||||
this.cached = true;
|
||||
return delete this.callbacks;
|
||||
});
|
||||
$.on(req, 'abort error', rm);
|
||||
@ -2326,8 +2329,8 @@
|
||||
this.root.textContent = "Loading post No." + this.postID + "...";
|
||||
if (this.threadID) {
|
||||
$.cache("//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json", (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return function(e, isCached) {
|
||||
return _this.fetchedPost(e.target, isCached);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
@ -2358,7 +2361,7 @@
|
||||
return $.event('PostsInserted');
|
||||
};
|
||||
|
||||
Fetcher.prototype.fetchedPost = function(req) {
|
||||
Fetcher.prototype.fetchedPost = function(req, isCached) {
|
||||
var api, board, k, len1, post, posts, status, thread;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
@ -2382,14 +2385,14 @@
|
||||
}
|
||||
}
|
||||
if (post.no !== this.postID) {
|
||||
if (req.cached) {
|
||||
if (isCached) {
|
||||
api = "//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json";
|
||||
$.cleanCache(function(url) {
|
||||
return url === api;
|
||||
});
|
||||
$.cache(api, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return _this.fetchedPost(e.target, false);
|
||||
};
|
||||
})(this));
|
||||
return;
|
||||
@ -2424,7 +2427,7 @@
|
||||
if (/^https:\/\//.test(url) || location.protocol === 'http:') {
|
||||
$.cache(url, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.parseArchivedPost(e.target.response, url);
|
||||
return _this.parseArchivedPost(e.target.response, url, archive);
|
||||
};
|
||||
})(this), {
|
||||
responseType: 'json',
|
||||
@ -2445,7 +2448,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
return _this.parseArchivedPost(response, url);
|
||||
return _this.parseArchivedPost(response, url, archive);
|
||||
};
|
||||
})(this));
|
||||
return true;
|
||||
@ -2453,12 +2456,17 @@
|
||||
return false;
|
||||
};
|
||||
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url) {
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url, archive) {
|
||||
var board, comment, greentext, i, j, key, o, post, ref, ref1, text, text2, thread, val;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
return;
|
||||
}
|
||||
if (data == null) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = "Error fetching Post No." + this.postID + " from " + archive.name + ".";
|
||||
return;
|
||||
}
|
||||
if (data.error) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = data.error;
|
||||
@ -2741,11 +2749,11 @@
|
||||
a.className = 'current';
|
||||
}
|
||||
Main.ready(function() {
|
||||
var oldFooter;
|
||||
if (oldFooter = $.id('boardNavDesktopFoot')) {
|
||||
var absbot, oldFooter;
|
||||
if ((oldFooter = $.id('boardNavDesktopFoot'))) {
|
||||
return $.replace($('.boardList', oldFooter), Header.bottomBoardList);
|
||||
} else {
|
||||
$.before($.id('absbot'), footer);
|
||||
} else if ((absbot = $.id('absbot'))) {
|
||||
$.before(absbot, footer);
|
||||
return $.globalEval('window.cloneTopNav = function() {};');
|
||||
}
|
||||
});
|
||||
@ -3256,12 +3264,12 @@
|
||||
|
||||
Index = {
|
||||
showHiddenThreads: false,
|
||||
changed: {},
|
||||
init: function() {
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, refNavEntry, repliesEntry, select;
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
|
||||
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
this.board = "" + g.BOARD;
|
||||
CatalogThread.callbacks.push({
|
||||
name: 'Catalog Features',
|
||||
cb: this.catalogNode
|
||||
@ -3271,10 +3279,10 @@
|
||||
Conf['Index Mode'] = (ref2 = history.state) != null ? ref2.mode : void 0;
|
||||
}
|
||||
this.currentPage = this.getCurrentPage();
|
||||
this.pushState({
|
||||
command: (ref3 = location.href.match(/#(.*)/)) != null ? ref3[1] : void 0,
|
||||
replace: true
|
||||
});
|
||||
this.processHash();
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
this.button = $.el('a', {
|
||||
className: 'index-refresh-shortcut fa fa-refresh',
|
||||
title: 'Refresh',
|
||||
@ -3300,9 +3308,9 @@
|
||||
pinEntry.el.title = 'Move watched threads to the start of the index.';
|
||||
anchorEntry.el.title = 'Move hidden threads to the end of the index.';
|
||||
refNavEntry.el.title = 'Refresh index when navigating through pages.';
|
||||
ref4 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref4.length; k < len1; k++) {
|
||||
label = ref4[k];
|
||||
ref3 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref3.length; k < len1; k++) {
|
||||
label = ref3[k];
|
||||
input = label.el.firstChild;
|
||||
name = input.name;
|
||||
$.on(input, 'change', $.cb.checked);
|
||||
@ -3322,69 +3330,59 @@
|
||||
order: 100,
|
||||
subEntries: [repliesEntry, pinEntry, anchorEntry, refNavEntry]
|
||||
});
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
this.root = $.el('div', {
|
||||
className: 'board'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
this.navLinks = $.el('div', {
|
||||
className: 'navLinks'
|
||||
className: 'navLinks json-index'
|
||||
});
|
||||
$.extend(this.navLinks, {
|
||||
innerHTML: "<span class=\"brackets-wrap indexlink\"><a href=\"#index\">Index</a></span> <span class=\"brackets-wrap cataloglink\"><a href=\"#catalog\">Catalog</a></span> <span class=\"brackets-wrap archlistlink\"><a href=\"./archive\">Archive</a></span> <span class=\"brackets-wrap bottomlink\"><a href=\"#bottom\">Bottom</a></span> <span class=\"brackets-wrap\" id=\"index-last-refresh\"><a href=\"javascript:;\"><time title=\"Last index refresh\">...</time></a></span> <input type=\"search\" id=\"index-search\" class=\"field\" placeholder=\"Search\"><a id=\"index-search-clear\" href=\"javascript:;\" title=\"Clear search\">×</a><span id=\"hidden-label\" hidden> — <span id=\"hidden-count\"></span> <span id=\"hidden-toggle\">[<a href=\"javascript:;\">Show</a>]</span></span><select id=\"index-mode\" name=\"Index Mode\"><option disabled>Index Mode</option><option value=\"paged\">Paged</option><option value=\"infinite\">Infinite scrolling</option><option value=\"all pages\">All threads</option><option value=\"catalog\">Catalog</option></select><select id=\"index-sort\" name=\"Index Sort\"><option disabled>Index Sort</option><option value=\"bump\">Bump order</option><option value=\"lastreply\">Last reply</option><option value=\"birth\">Creation date</option><option value=\"replycount\">Reply count</option><option value=\"filecount\">File count</option></select><select id=\"index-size\" name=\"Index Size\"><option disabled>Image Size</option><option value=\"small\">Small</option><option value=\"large\">Large</option></select>"
|
||||
});
|
||||
$('.cataloglink a', this.navLinks).href = CatalogLinks.catalog();
|
||||
if ((ref5 = g.BOARD.ID) === 'b' || ref5 === 'trash') {
|
||||
if ((ref4 = g.BOARD.ID) === 'b' || ref4 === 'trash') {
|
||||
$('.archlistlink', this.navLinks).hidden = true;
|
||||
}
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.setupSearch();
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
this.hideLabel = $('#hidden-label', this.navLinks);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
this.selectMode = $('#index-mode', this.navLinks);
|
||||
this.selectSort = $('#index-sort', this.navLinks);
|
||||
this.selectSize = $('#index-size', this.navLinks);
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
$.on(this.selectMode, 'change', this.cb.mode);
|
||||
ref6 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref6.length; q < len2; q++) {
|
||||
select = ref6[q];
|
||||
ref5 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref5.length; q < len2; q++) {
|
||||
select = ref5[q];
|
||||
select.value = Conf[select.name];
|
||||
$.on(select, 'change', $.cb.value);
|
||||
}
|
||||
$.on(this.selectSort, 'change', this.cb.sort);
|
||||
$.on(this.selectSize, 'change', this.cb.size);
|
||||
this.update();
|
||||
$.asap((function() {
|
||||
return $('title + *', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
this.root = $.el('div', {
|
||||
className: 'board json-index'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist json-index'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
this.update(true);
|
||||
$.onExists(doc, 'title + *', function() {
|
||||
return d.title = d.title.replace(/\ -\ Page\ \d+/, '');
|
||||
});
|
||||
$.asap((function() {
|
||||
return $('.board > .thread > .postContainer', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
var board, el, len3, len4, ref7, ref8, threadRoot, topNavPos, u, v;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
$.onExists(doc, '.board > .thread > .postContainer, .board + *', function() {
|
||||
var board, el, len3, len4, ref6, ref7, threadRoot, topNavPos, u, v;
|
||||
Index.hat = $('.board > .thread > img:first-child');
|
||||
if (Index.hat) {
|
||||
if (Index.nodes) {
|
||||
ref7 = Index.nodes;
|
||||
for (u = 0, len3 = ref7.length; u < len3; u++) {
|
||||
threadRoot = ref7[u];
|
||||
ref6 = Index.nodes;
|
||||
for (u = 0, len3 = ref6.length; u < len3; u++) {
|
||||
threadRoot = ref6[u];
|
||||
$.prepend(threadRoot, Index.hat.cloneNode(false));
|
||||
}
|
||||
}
|
||||
@ -3397,9 +3395,9 @@
|
||||
try {
|
||||
d.implementation.createDocument(null, null, null).appendChild(board);
|
||||
} catch (_error) {}
|
||||
ref8 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref8.length; v < len4; v++) {
|
||||
el = ref8[v];
|
||||
ref7 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref7.length; v < len4; v++) {
|
||||
el = ref7[v];
|
||||
$.rm(el);
|
||||
}
|
||||
$.rm($.id('ctrl-top'));
|
||||
@ -3407,17 +3405,10 @@
|
||||
$.before(topNavPos, $.el('hr'));
|
||||
return $.before(topNavPos, Index.navLinks);
|
||||
});
|
||||
return $.asap((function() {
|
||||
return $('.pagelist', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
return Main.ready(function() {
|
||||
var pagelist;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if (pagelist = $('.pagelist')) {
|
||||
if ((pagelist = $('.pagelist'))) {
|
||||
$.replace(pagelist, Index.pagelist);
|
||||
} else {
|
||||
$.after($.id('delform'), Index.pagelist);
|
||||
}
|
||||
return $.rmClass(doc, 'index-loading');
|
||||
});
|
||||
@ -3428,7 +3419,7 @@
|
||||
return;
|
||||
}
|
||||
if (Index.pageNum == null) {
|
||||
Index.pageNum = Index.getCurrentPage();
|
||||
Index.pageNum = Index.currentPage;
|
||||
}
|
||||
pageNum = ++Index.pageNum;
|
||||
if (pageNum > Index.pagesNum) {
|
||||
@ -3546,9 +3537,10 @@
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
mode: mode
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
sort: function() {
|
||||
Index.sort();
|
||||
@ -3575,32 +3567,19 @@
|
||||
return Index.buildIndex();
|
||||
},
|
||||
popstate: function(e) {
|
||||
var mode, page, ref, ref1, searched, state;
|
||||
var mode, page, ref, searched;
|
||||
if (e != null ? e.state : void 0) {
|
||||
ref = e.state, searched = ref.searched, mode = ref.mode;
|
||||
state = {};
|
||||
if (Index.search !== searched) {
|
||||
state.search = Index.search = searched;
|
||||
}
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
state.mode = mode;
|
||||
Index.saveMode(mode);
|
||||
}
|
||||
page = Index.getCurrentPage();
|
||||
if (Index.currentPage !== page) {
|
||||
state.page = Index.currentPage = page;
|
||||
}
|
||||
if ((state.search != null) || (state.mode != null) || (state.page != null)) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
} else {
|
||||
state = Index.pushState({
|
||||
command: (ref1 = location.href.match(/#(.*)/)) != null ? ref1[1] : void 0,
|
||||
replace: true,
|
||||
scroll: true
|
||||
Index.setState({
|
||||
search: searched,
|
||||
mode: mode,
|
||||
page: page
|
||||
});
|
||||
if (state.command) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad'](state);
|
||||
return Index.pageLoad(false);
|
||||
} else {
|
||||
if (Index.processHash()) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad']();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3627,120 +3606,117 @@
|
||||
return Index.userPageNav(+a.pathname.split(/\/+/)[2] || 1);
|
||||
},
|
||||
refreshFront: function() {
|
||||
return Index.update(Index.pushState({
|
||||
page: 1,
|
||||
scroll: true
|
||||
}));
|
||||
Index.pushState({
|
||||
page: 1
|
||||
});
|
||||
return Index.update();
|
||||
}
|
||||
},
|
||||
scrollToIndex: function() {
|
||||
return Header.scrollToIfNeeded(Index.navLinks);
|
||||
},
|
||||
getCurrentPage: function() {
|
||||
var ref;
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
return 1;
|
||||
} else {
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
}
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
},
|
||||
userPageNav: function(page) {
|
||||
var state;
|
||||
state = Index.pushState({
|
||||
page: page,
|
||||
scroll: true
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
if (Conf['Refreshed Navigation']) {
|
||||
return Index.update(state);
|
||||
return Index.update();
|
||||
} else {
|
||||
if (state.page) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
return Index.pageLoad();
|
||||
}
|
||||
},
|
||||
pushState: function(state) {
|
||||
var command, hash, mode, page, pageBeforeSearch, pathname, ref, search;
|
||||
pathname = location.pathname, hash = location.hash;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if (state.command != null) {
|
||||
command = state.command;
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
hash = '';
|
||||
} else {
|
||||
delete state.command;
|
||||
}
|
||||
processHash: function() {
|
||||
var command, hash, ref, state;
|
||||
hash = ((ref = location.href.match(/#.*/)) != null ? ref[0] : void 0) || '';
|
||||
command = hash.slice(1);
|
||||
state = {
|
||||
replace: true
|
||||
};
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
} else {
|
||||
state.hash = hash;
|
||||
}
|
||||
if (state.search != null) {
|
||||
search = state.search;
|
||||
Index.pushState(state);
|
||||
return state.hash == null;
|
||||
},
|
||||
pushState: function(state) {
|
||||
var hash, pageBeforeSearch, pathname, ref, replace, search;
|
||||
search = state.search, hash = state.hash, replace = state.replace;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
state.page = search ? 1 : pageBeforeSearch || 1;
|
||||
if (!search) {
|
||||
pageBeforeSearch = void 0;
|
||||
} else if (!Index.search) {
|
||||
pageBeforeSearch = Index.currentPage;
|
||||
}
|
||||
Index.search = search;
|
||||
}
|
||||
if (state.mode != null) {
|
||||
mode = state.mode;
|
||||
if (mode === Conf['Index Mode']) {
|
||||
delete state.mode;
|
||||
}
|
||||
Index.saveMode(mode);
|
||||
if (mode === 'all pages' || mode === 'catalog') {
|
||||
state.page = 1;
|
||||
}
|
||||
hash = '';
|
||||
}
|
||||
if (state.page != null) {
|
||||
page = state.page;
|
||||
if (page === Index.currentPage) {
|
||||
delete state.page;
|
||||
}
|
||||
Index.currentPage = page;
|
||||
pathname = page === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + page;
|
||||
hash = '';
|
||||
}
|
||||
history[state.replace ? 'replaceState' : 'pushState']({
|
||||
Index.setState(state);
|
||||
pathname = Index.currentPage === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + Index.currentPage;
|
||||
hash || (hash = '');
|
||||
return history[replace ? 'replaceState' : 'pushState']({
|
||||
mode: Conf['Index Mode'],
|
||||
searched: Index.search,
|
||||
oldpage: pageBeforeSearch
|
||||
}, '', location.protocol + "//" + location.host + pathname + hash);
|
||||
return state;
|
||||
},
|
||||
saveMode: function(mode) {
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
setState: function(arg) {
|
||||
var mode, page, ref, search;
|
||||
search = arg.search, mode = arg.mode, page = arg.page;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
Index.changed.search = true;
|
||||
Index.search = search;
|
||||
}
|
||||
if ((mode != null) && mode !== Conf['Index Mode']) {
|
||||
Index.changed.mode = true;
|
||||
Conf['Index Mode'] = mode;
|
||||
$.set('Index Mode', mode);
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
}
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
return $.set('Previous Index Mode', mode);
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
page = 1;
|
||||
}
|
||||
if ((page != null) && page !== Index.currentPage) {
|
||||
Index.changed.page = true;
|
||||
return Index.currentPage = page;
|
||||
}
|
||||
},
|
||||
pageLoad: function(arg) {
|
||||
var mode, scroll, search, sort;
|
||||
sort = arg.sort, search = arg.search, mode = arg.mode, scroll = arg.scroll;
|
||||
if (sort || (search != null)) {
|
||||
pageLoad: function(scroll) {
|
||||
var mode, page, ref, search, threads;
|
||||
if (scroll == null) {
|
||||
scroll = true;
|
||||
}
|
||||
ref = Index.changed, threads = ref.threads, search = ref.search, mode = ref.mode, page = ref.page;
|
||||
if (threads || search) {
|
||||
Index.sort();
|
||||
Index.buildPagelist();
|
||||
}
|
||||
if (search != null) {
|
||||
if (search) {
|
||||
Index.setupSearch();
|
||||
}
|
||||
if (mode != null) {
|
||||
if (mode) {
|
||||
Index.applyMode();
|
||||
}
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
if (scroll) {
|
||||
return Index.scrollToIndex();
|
||||
if (threads || search || mode || page) {
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
}
|
||||
if (scroll) {
|
||||
Index.scrollToIndex();
|
||||
}
|
||||
return Index.changed = {};
|
||||
},
|
||||
applyMode: function() {
|
||||
var k, len1, mode, ref;
|
||||
@ -3783,7 +3759,7 @@
|
||||
},
|
||||
setPage: function() {
|
||||
var a, href, maxPageNum, next, pageNum, pagesRoot, prev, strong;
|
||||
pageNum = Index.getCurrentPage();
|
||||
pageNum = Index.currentPage;
|
||||
maxPageNum = Index.getMaxPageNum();
|
||||
pagesRoot = $('.pages', Index.pagelist);
|
||||
prev = pagesRoot.previousSibling.firstChild;
|
||||
@ -3828,7 +3804,7 @@
|
||||
Index.hideLabel.hidden = false;
|
||||
return $('#hidden-count', Index.navLinks).textContent = hiddenCount === 1 ? '1 hidden thread' : hiddenCount + " hidden threads";
|
||||
},
|
||||
update: function(state) {
|
||||
update: function(firstTime) {
|
||||
var now, ref, ref1;
|
||||
if ((ref = Index.req) != null) {
|
||||
ref.abort();
|
||||
@ -3848,16 +3824,18 @@
|
||||
}), 3 * $.SECOND - (Date.now() - now));
|
||||
});
|
||||
}
|
||||
if (!firstTime && d.readyState !== 'loading' && !$('.board + *')) {
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
|
||||
onloadend: function(e) {
|
||||
return Index.load(e, state);
|
||||
}
|
||||
onloadend: Index.load
|
||||
}, {
|
||||
whenModified: 'Index'
|
||||
});
|
||||
return $.addClass(Index.button, 'fa-spin');
|
||||
},
|
||||
load: function(e, state) {
|
||||
load: function(e) {
|
||||
var err, nTimeout, notice, ref, req, timeEl;
|
||||
$.rmClass(Index.button, 'fa-spin');
|
||||
req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout;
|
||||
@ -3885,9 +3863,9 @@
|
||||
}
|
||||
try {
|
||||
if (req.status === 200) {
|
||||
Index.parse(req.response, state);
|
||||
} else if (req.status === 304 && (state != null)) {
|
||||
Index.pageLoad(state);
|
||||
Index.parse(req.response);
|
||||
} else if (req.status === 304) {
|
||||
Index.pageLoad();
|
||||
}
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
@ -3912,18 +3890,16 @@
|
||||
}
|
||||
timeEl = $('#index-last-refresh time', Index.navLinks);
|
||||
timeEl.dataset.utc = Date.parse(req.getResponseHeader('Last-Modified'));
|
||||
RelativeDates.update(timeEl);
|
||||
return Index.scrollToIndex();
|
||||
return RelativeDates.update(timeEl);
|
||||
},
|
||||
parse: function(pages, state) {
|
||||
parse: function(pages) {
|
||||
$.cleanCache(function(url) {
|
||||
return /^\/\/a\.4cdn\.org\//.test(url);
|
||||
});
|
||||
Index.parseThreadList(pages);
|
||||
Index.buildThreads();
|
||||
state || (state = {});
|
||||
state.sort = true;
|
||||
return Index.pageLoad(state);
|
||||
Index.changed.threads = true;
|
||||
return Index.pageLoad();
|
||||
},
|
||||
parseThreadList: function(pages) {
|
||||
Index.pagesNum = pages.length;
|
||||
@ -4140,14 +4116,15 @@
|
||||
i++;
|
||||
}
|
||||
page = Math.floor(i / Index.threadsNumPerPage) + 1;
|
||||
if (page !== Index.getCurrentPage()) {
|
||||
if (page !== Index.currentPage) {
|
||||
Index.currentPage = page;
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
Index.setPage();
|
||||
}
|
||||
}
|
||||
nodes = Index.buildSinglePage(Index.getCurrentPage());
|
||||
nodes = Index.buildSinglePage(Index.currentPage);
|
||||
}
|
||||
delete Index.pageNum;
|
||||
$.rmAll(Index.root);
|
||||
@ -4190,10 +4167,8 @@
|
||||
Index.onSearchInput();
|
||||
return Index.searchInput.focus();
|
||||
},
|
||||
setupSearch: function(noUpdate) {
|
||||
if (!noUpdate) {
|
||||
Index.searchInput.value = Index.search;
|
||||
}
|
||||
setupSearch: function() {
|
||||
Index.searchInput.value = Index.search;
|
||||
if (Index.search) {
|
||||
return Index.searchInput.dataset.searching = 1;
|
||||
} else {
|
||||
@ -4206,10 +4181,11 @@
|
||||
if (search === Index.search) {
|
||||
return;
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
search: search,
|
||||
replace: !!search === !!Index.search
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
querySearch: function(query) {
|
||||
var keywords;
|
||||
@ -6335,7 +6311,7 @@
|
||||
}
|
||||
},
|
||||
process: function(link, clone) {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.getAttribute('href')[0] === '#') {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.pathname === location.pathname && link.host === location.host && link.protocol === location.protocol) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
@ -6619,7 +6595,10 @@
|
||||
return $.asap((function() {
|
||||
return !Conf['Thread Updater'] || $('.navLinksBot > .updatelink');
|
||||
}), function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
}
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
@ -7029,7 +7008,7 @@
|
||||
}
|
||||
},
|
||||
initReady: function() {
|
||||
var link, linkBot, origToggle;
|
||||
var link, linkBot, navLinksBot, origToggle;
|
||||
$.off(d, '4chanXInitFinished', this.initReady);
|
||||
QR.postingIsEnabled = !!$.id('postForm');
|
||||
if (!QR.postingIsEnabled) {
|
||||
@ -7057,7 +7036,9 @@
|
||||
QR.open();
|
||||
return QR.nodes.com.focus();
|
||||
});
|
||||
$.prepend($('.navLinksBot'), linkBot);
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
$.prepend(navLinksBot, linkBot);
|
||||
}
|
||||
}
|
||||
origToggle = $.id('togglePostFormLink');
|
||||
$.before(origToggle, link);
|
||||
@ -12503,7 +12484,6 @@
|
||||
});
|
||||
$.add(a, range.extractContents());
|
||||
range.insertNode(a);
|
||||
range.detach();
|
||||
return a;
|
||||
}
|
||||
};
|
||||
@ -13168,7 +13148,10 @@
|
||||
innerHTML: "<a href=\"javascript:;\">Update</a>"
|
||||
});
|
||||
Main.ready(function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), updateLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), updateLink]);
|
||||
}
|
||||
});
|
||||
$.on(updateLink.firstElementChild, 'click', this.update);
|
||||
subEntries = [];
|
||||
@ -15644,7 +15627,15 @@
|
||||
});
|
||||
}
|
||||
return Main.ready(function() {
|
||||
return $.globalEval('(function() {\n window.clickable_ids = false;\n var nodes = document.querySelectorAll(\'.posteruid, .capcode\');\n for (var i = 0; i < nodes.length; i++) {\n nodes[i].removeEventListener("click", window.idClick, false);\n }\n window.removeEventListener("message", Report.onMessage, false);\n})();');
|
||||
return $.global(function() {
|
||||
var k, len1, node, ref1;
|
||||
window.clickable_ids = false;
|
||||
ref1 = document.querySelectorAll('.posteruid, .capcode');
|
||||
for (k = 0, len1 = ref1.length; k < len1; k++) {
|
||||
node = ref1[k];
|
||||
node.removeEventListener('click', window.idClick, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
code: function() {
|
||||
@ -17650,6 +17641,14 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.on(d, '4chanXInitFinished', function() {
|
||||
if (Main.expectInitFinished) {
|
||||
return delete Main.expectInitFinished;
|
||||
} else {
|
||||
new Notice('error', 'Error: Multiple copies of 4chan X are enabled.');
|
||||
return $.addClass(doc, 'tainted');
|
||||
}
|
||||
});
|
||||
flatten = function(parent, obj) {
|
||||
var key, val;
|
||||
if (obj instanceof Array) {
|
||||
@ -17814,7 +17813,7 @@
|
||||
},
|
||||
initStyle: function() {
|
||||
var keyboard, ref;
|
||||
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if ((ref = $('link[href*=mobile]', d.head)) != null) {
|
||||
@ -17876,7 +17875,7 @@
|
||||
});
|
||||
},
|
||||
initReady: function() {
|
||||
var ref, ref1;
|
||||
var msg, ref, ref1, ref2;
|
||||
if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) {
|
||||
ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() {
|
||||
if (Conf['404 Redirect']) {
|
||||
@ -17892,15 +17891,25 @@
|
||||
if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') {
|
||||
return;
|
||||
}
|
||||
if (((ref2 = g.VIEW) === 'index' || ref2 === 'thread') && !$('.board + *')) {
|
||||
msg = $.el('div', {
|
||||
innerHTML: "The page didn't load completely.<br>Some features may not work unless you <a href=\"javascript:;\">reload</a>."
|
||||
});
|
||||
$.on($('a', msg), 'click', function() {
|
||||
return location.reload();
|
||||
});
|
||||
new Notice('warning', msg);
|
||||
}
|
||||
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) {
|
||||
return Main.initThread();
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
initThread: function() {
|
||||
var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads;
|
||||
if (board = $('.board')) {
|
||||
if ((board = $('.board'))) {
|
||||
threads = [];
|
||||
posts = [];
|
||||
ref = $$('.board > .thread', board);
|
||||
@ -17911,17 +17920,19 @@
|
||||
ref1 = $$('.thread > .postContainer', threadRoot);
|
||||
for (q = 0, len2 = ref1.length; q < len2; q++) {
|
||||
postRoot = ref1[q];
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
if ($('.postMessage', postRoot)) {
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17941,9 +17952,11 @@
|
||||
post = posts[u];
|
||||
QuoteThreading.insert(post);
|
||||
}
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
});
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
@ -18034,7 +18047,7 @@
|
||||
details = details.replace(/file:\/{3}.+\//g, '');
|
||||
url = "https://gitreports.com/issue/ccd0/4chan-x?issue_title=" + (encodeURIComponent(title)) + "&details=" + (encodeURIComponent(details));
|
||||
return {
|
||||
innerHTML: " [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]"
|
||||
innerHTML: "<span class=\"report-error\"> [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]</span>"
|
||||
};
|
||||
},
|
||||
isThisPageLegit: function() {
|
||||
@ -19139,6 +19152,9 @@
|
||||
".message a {\n" +
|
||||
" text-decoration: underline;\n" +
|
||||
"}\n" +
|
||||
":root.tainted .report-error {\n" +
|
||||
" display: none;\n" +
|
||||
"}\n" +
|
||||
"/* Settings */\n" +
|
||||
":root.fourchan-x body {\n" +
|
||||
" -moz-box-sizing: border-box;\n" +
|
||||
@ -19328,9 +19344,9 @@
|
||||
" overflow: hidden;\n" +
|
||||
"}\n" +
|
||||
"/* Index */\n" +
|
||||
":root.index-loading .navLinks,\n" +
|
||||
":root.index-loading .board,\n" +
|
||||
":root.index-loading .pagelist,\n" +
|
||||
":root.index-loading .navLinks:not(.json-index),\n" +
|
||||
":root.index-loading .board:not(.json-index),\n" +
|
||||
":root.index-loading .pagelist:not(.json-index),\n" +
|
||||
":root.infinite-mode .pagelist,\n" +
|
||||
":root.all-pages-mode .pagelist,\n" +
|
||||
":root.catalog-mode .pagelist,\n" +
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.11.22.4
|
||||
// @version 1.11.23.0
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -434,7 +434,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.11.22.4',
|
||||
VERSION: '1.11.23.0',
|
||||
NAMESPACE: '4chan X.',
|
||||
boards: {}
|
||||
};
|
||||
@ -602,7 +602,7 @@
|
||||
if (req = reqs[url]) {
|
||||
if (req.readyState === 4) {
|
||||
$.queueTask(function() {
|
||||
return cb.call(req, req.evt);
|
||||
return cb.call(req, req.evt, true);
|
||||
});
|
||||
} else {
|
||||
req.callbacks.push(cb);
|
||||
@ -622,13 +622,16 @@
|
||||
}
|
||||
$.on(req, 'load', function(e) {
|
||||
var k, len1, ref;
|
||||
this.evt = e;
|
||||
ref = this.callbacks;
|
||||
for (k = 0, len1 = ref.length; k < len1; k++) {
|
||||
cb = ref[k];
|
||||
cb.call(this, e);
|
||||
$.queueTask((function(_this) {
|
||||
return function() {
|
||||
return cb.call(_this, e, false);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
this.evt = e;
|
||||
this.cached = true;
|
||||
return delete this.callbacks;
|
||||
});
|
||||
$.on(req, 'abort error', rm);
|
||||
@ -2326,8 +2329,8 @@
|
||||
this.root.textContent = "Loading post No." + this.postID + "...";
|
||||
if (this.threadID) {
|
||||
$.cache("//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json", (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return function(e, isCached) {
|
||||
return _this.fetchedPost(e.target, isCached);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
@ -2358,7 +2361,7 @@
|
||||
return $.event('PostsInserted');
|
||||
};
|
||||
|
||||
Fetcher.prototype.fetchedPost = function(req) {
|
||||
Fetcher.prototype.fetchedPost = function(req, isCached) {
|
||||
var api, board, k, len1, post, posts, status, thread;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
@ -2382,14 +2385,14 @@
|
||||
}
|
||||
}
|
||||
if (post.no !== this.postID) {
|
||||
if (req.cached) {
|
||||
if (isCached) {
|
||||
api = "//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json";
|
||||
$.cleanCache(function(url) {
|
||||
return url === api;
|
||||
});
|
||||
$.cache(api, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return _this.fetchedPost(e.target, false);
|
||||
};
|
||||
})(this));
|
||||
return;
|
||||
@ -2424,7 +2427,7 @@
|
||||
if (/^https:\/\//.test(url) || location.protocol === 'http:') {
|
||||
$.cache(url, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.parseArchivedPost(e.target.response, url);
|
||||
return _this.parseArchivedPost(e.target.response, url, archive);
|
||||
};
|
||||
})(this), {
|
||||
responseType: 'json',
|
||||
@ -2445,7 +2448,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
return _this.parseArchivedPost(response, url);
|
||||
return _this.parseArchivedPost(response, url, archive);
|
||||
};
|
||||
})(this));
|
||||
return true;
|
||||
@ -2453,12 +2456,17 @@
|
||||
return false;
|
||||
};
|
||||
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url) {
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url, archive) {
|
||||
var board, comment, greentext, i, j, key, o, post, ref, ref1, text, text2, thread, val;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
return;
|
||||
}
|
||||
if (data == null) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = "Error fetching Post No." + this.postID + " from " + archive.name + ".";
|
||||
return;
|
||||
}
|
||||
if (data.error) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = data.error;
|
||||
@ -2741,11 +2749,11 @@
|
||||
a.className = 'current';
|
||||
}
|
||||
Main.ready(function() {
|
||||
var oldFooter;
|
||||
if (oldFooter = $.id('boardNavDesktopFoot')) {
|
||||
var absbot, oldFooter;
|
||||
if ((oldFooter = $.id('boardNavDesktopFoot'))) {
|
||||
return $.replace($('.boardList', oldFooter), Header.bottomBoardList);
|
||||
} else {
|
||||
$.before($.id('absbot'), footer);
|
||||
} else if ((absbot = $.id('absbot'))) {
|
||||
$.before(absbot, footer);
|
||||
return $.globalEval('window.cloneTopNav = function() {};');
|
||||
}
|
||||
});
|
||||
@ -3256,12 +3264,12 @@
|
||||
|
||||
Index = {
|
||||
showHiddenThreads: false,
|
||||
changed: {},
|
||||
init: function() {
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, refNavEntry, repliesEntry, select;
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
|
||||
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
this.board = "" + g.BOARD;
|
||||
CatalogThread.callbacks.push({
|
||||
name: 'Catalog Features',
|
||||
cb: this.catalogNode
|
||||
@ -3271,10 +3279,10 @@
|
||||
Conf['Index Mode'] = (ref2 = history.state) != null ? ref2.mode : void 0;
|
||||
}
|
||||
this.currentPage = this.getCurrentPage();
|
||||
this.pushState({
|
||||
command: (ref3 = location.href.match(/#(.*)/)) != null ? ref3[1] : void 0,
|
||||
replace: true
|
||||
});
|
||||
this.processHash();
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
this.button = $.el('a', {
|
||||
className: 'index-refresh-shortcut fa fa-refresh',
|
||||
title: 'Refresh',
|
||||
@ -3300,9 +3308,9 @@
|
||||
pinEntry.el.title = 'Move watched threads to the start of the index.';
|
||||
anchorEntry.el.title = 'Move hidden threads to the end of the index.';
|
||||
refNavEntry.el.title = 'Refresh index when navigating through pages.';
|
||||
ref4 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref4.length; k < len1; k++) {
|
||||
label = ref4[k];
|
||||
ref3 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref3.length; k < len1; k++) {
|
||||
label = ref3[k];
|
||||
input = label.el.firstChild;
|
||||
name = input.name;
|
||||
$.on(input, 'change', $.cb.checked);
|
||||
@ -3322,69 +3330,59 @@
|
||||
order: 100,
|
||||
subEntries: [repliesEntry, pinEntry, anchorEntry, refNavEntry]
|
||||
});
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
this.root = $.el('div', {
|
||||
className: 'board'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
this.navLinks = $.el('div', {
|
||||
className: 'navLinks'
|
||||
className: 'navLinks json-index'
|
||||
});
|
||||
$.extend(this.navLinks, {
|
||||
innerHTML: "<span class=\"brackets-wrap indexlink\"><a href=\"#index\">Index</a></span> <span class=\"brackets-wrap cataloglink\"><a href=\"#catalog\">Catalog</a></span> <span class=\"brackets-wrap archlistlink\"><a href=\"./archive\">Archive</a></span> <span class=\"brackets-wrap bottomlink\"><a href=\"#bottom\">Bottom</a></span> <span class=\"brackets-wrap\" id=\"index-last-refresh\"><a href=\"javascript:;\"><time title=\"Last index refresh\">...</time></a></span> <input type=\"search\" id=\"index-search\" class=\"field\" placeholder=\"Search\"><a id=\"index-search-clear\" href=\"javascript:;\" title=\"Clear search\">×</a><span id=\"hidden-label\" hidden> — <span id=\"hidden-count\"></span> <span id=\"hidden-toggle\">[<a href=\"javascript:;\">Show</a>]</span></span><select id=\"index-mode\" name=\"Index Mode\"><option disabled>Index Mode</option><option value=\"paged\">Paged</option><option value=\"infinite\">Infinite scrolling</option><option value=\"all pages\">All threads</option><option value=\"catalog\">Catalog</option></select><select id=\"index-sort\" name=\"Index Sort\"><option disabled>Index Sort</option><option value=\"bump\">Bump order</option><option value=\"lastreply\">Last reply</option><option value=\"birth\">Creation date</option><option value=\"replycount\">Reply count</option><option value=\"filecount\">File count</option></select><select id=\"index-size\" name=\"Index Size\"><option disabled>Image Size</option><option value=\"small\">Small</option><option value=\"large\">Large</option></select>"
|
||||
});
|
||||
$('.cataloglink a', this.navLinks).href = CatalogLinks.catalog();
|
||||
if ((ref5 = g.BOARD.ID) === 'b' || ref5 === 'trash') {
|
||||
if ((ref4 = g.BOARD.ID) === 'b' || ref4 === 'trash') {
|
||||
$('.archlistlink', this.navLinks).hidden = true;
|
||||
}
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.setupSearch();
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
this.hideLabel = $('#hidden-label', this.navLinks);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
this.selectMode = $('#index-mode', this.navLinks);
|
||||
this.selectSort = $('#index-sort', this.navLinks);
|
||||
this.selectSize = $('#index-size', this.navLinks);
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
$.on(this.selectMode, 'change', this.cb.mode);
|
||||
ref6 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref6.length; q < len2; q++) {
|
||||
select = ref6[q];
|
||||
ref5 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref5.length; q < len2; q++) {
|
||||
select = ref5[q];
|
||||
select.value = Conf[select.name];
|
||||
$.on(select, 'change', $.cb.value);
|
||||
}
|
||||
$.on(this.selectSort, 'change', this.cb.sort);
|
||||
$.on(this.selectSize, 'change', this.cb.size);
|
||||
this.update();
|
||||
$.asap((function() {
|
||||
return $('title + *', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
this.root = $.el('div', {
|
||||
className: 'board json-index'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist json-index'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
this.update(true);
|
||||
$.onExists(doc, 'title + *', function() {
|
||||
return d.title = d.title.replace(/\ -\ Page\ \d+/, '');
|
||||
});
|
||||
$.asap((function() {
|
||||
return $('.board > .thread > .postContainer', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
var board, el, len3, len4, ref7, ref8, threadRoot, topNavPos, u, v;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
$.onExists(doc, '.board > .thread > .postContainer, .board + *', function() {
|
||||
var board, el, len3, len4, ref6, ref7, threadRoot, topNavPos, u, v;
|
||||
Index.hat = $('.board > .thread > img:first-child');
|
||||
if (Index.hat) {
|
||||
if (Index.nodes) {
|
||||
ref7 = Index.nodes;
|
||||
for (u = 0, len3 = ref7.length; u < len3; u++) {
|
||||
threadRoot = ref7[u];
|
||||
ref6 = Index.nodes;
|
||||
for (u = 0, len3 = ref6.length; u < len3; u++) {
|
||||
threadRoot = ref6[u];
|
||||
$.prepend(threadRoot, Index.hat.cloneNode(false));
|
||||
}
|
||||
}
|
||||
@ -3397,9 +3395,9 @@
|
||||
try {
|
||||
d.implementation.createDocument(null, null, null).appendChild(board);
|
||||
} catch (_error) {}
|
||||
ref8 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref8.length; v < len4; v++) {
|
||||
el = ref8[v];
|
||||
ref7 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref7.length; v < len4; v++) {
|
||||
el = ref7[v];
|
||||
$.rm(el);
|
||||
}
|
||||
$.rm($.id('ctrl-top'));
|
||||
@ -3407,17 +3405,10 @@
|
||||
$.before(topNavPos, $.el('hr'));
|
||||
return $.before(topNavPos, Index.navLinks);
|
||||
});
|
||||
return $.asap((function() {
|
||||
return $('.pagelist', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
return Main.ready(function() {
|
||||
var pagelist;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if (pagelist = $('.pagelist')) {
|
||||
if ((pagelist = $('.pagelist'))) {
|
||||
$.replace(pagelist, Index.pagelist);
|
||||
} else {
|
||||
$.after($.id('delform'), Index.pagelist);
|
||||
}
|
||||
return $.rmClass(doc, 'index-loading');
|
||||
});
|
||||
@ -3428,7 +3419,7 @@
|
||||
return;
|
||||
}
|
||||
if (Index.pageNum == null) {
|
||||
Index.pageNum = Index.getCurrentPage();
|
||||
Index.pageNum = Index.currentPage;
|
||||
}
|
||||
pageNum = ++Index.pageNum;
|
||||
if (pageNum > Index.pagesNum) {
|
||||
@ -3546,9 +3537,10 @@
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
mode: mode
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
sort: function() {
|
||||
Index.sort();
|
||||
@ -3575,32 +3567,19 @@
|
||||
return Index.buildIndex();
|
||||
},
|
||||
popstate: function(e) {
|
||||
var mode, page, ref, ref1, searched, state;
|
||||
var mode, page, ref, searched;
|
||||
if (e != null ? e.state : void 0) {
|
||||
ref = e.state, searched = ref.searched, mode = ref.mode;
|
||||
state = {};
|
||||
if (Index.search !== searched) {
|
||||
state.search = Index.search = searched;
|
||||
}
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
state.mode = mode;
|
||||
Index.saveMode(mode);
|
||||
}
|
||||
page = Index.getCurrentPage();
|
||||
if (Index.currentPage !== page) {
|
||||
state.page = Index.currentPage = page;
|
||||
}
|
||||
if ((state.search != null) || (state.mode != null) || (state.page != null)) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
} else {
|
||||
state = Index.pushState({
|
||||
command: (ref1 = location.href.match(/#(.*)/)) != null ? ref1[1] : void 0,
|
||||
replace: true,
|
||||
scroll: true
|
||||
Index.setState({
|
||||
search: searched,
|
||||
mode: mode,
|
||||
page: page
|
||||
});
|
||||
if (state.command) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad'](state);
|
||||
return Index.pageLoad(false);
|
||||
} else {
|
||||
if (Index.processHash()) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad']();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3627,120 +3606,117 @@
|
||||
return Index.userPageNav(+a.pathname.split(/\/+/)[2] || 1);
|
||||
},
|
||||
refreshFront: function() {
|
||||
return Index.update(Index.pushState({
|
||||
page: 1,
|
||||
scroll: true
|
||||
}));
|
||||
Index.pushState({
|
||||
page: 1
|
||||
});
|
||||
return Index.update();
|
||||
}
|
||||
},
|
||||
scrollToIndex: function() {
|
||||
return Header.scrollToIfNeeded(Index.navLinks);
|
||||
},
|
||||
getCurrentPage: function() {
|
||||
var ref;
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
return 1;
|
||||
} else {
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
}
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
},
|
||||
userPageNav: function(page) {
|
||||
var state;
|
||||
state = Index.pushState({
|
||||
page: page,
|
||||
scroll: true
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
if (Conf['Refreshed Navigation']) {
|
||||
return Index.update(state);
|
||||
return Index.update();
|
||||
} else {
|
||||
if (state.page) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
return Index.pageLoad();
|
||||
}
|
||||
},
|
||||
pushState: function(state) {
|
||||
var command, hash, mode, page, pageBeforeSearch, pathname, ref, search;
|
||||
pathname = location.pathname, hash = location.hash;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if (state.command != null) {
|
||||
command = state.command;
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
hash = '';
|
||||
} else {
|
||||
delete state.command;
|
||||
}
|
||||
processHash: function() {
|
||||
var command, hash, ref, state;
|
||||
hash = ((ref = location.href.match(/#.*/)) != null ? ref[0] : void 0) || '';
|
||||
command = hash.slice(1);
|
||||
state = {
|
||||
replace: true
|
||||
};
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
} else {
|
||||
state.hash = hash;
|
||||
}
|
||||
if (state.search != null) {
|
||||
search = state.search;
|
||||
Index.pushState(state);
|
||||
return state.hash == null;
|
||||
},
|
||||
pushState: function(state) {
|
||||
var hash, pageBeforeSearch, pathname, ref, replace, search;
|
||||
search = state.search, hash = state.hash, replace = state.replace;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
state.page = search ? 1 : pageBeforeSearch || 1;
|
||||
if (!search) {
|
||||
pageBeforeSearch = void 0;
|
||||
} else if (!Index.search) {
|
||||
pageBeforeSearch = Index.currentPage;
|
||||
}
|
||||
Index.search = search;
|
||||
}
|
||||
if (state.mode != null) {
|
||||
mode = state.mode;
|
||||
if (mode === Conf['Index Mode']) {
|
||||
delete state.mode;
|
||||
}
|
||||
Index.saveMode(mode);
|
||||
if (mode === 'all pages' || mode === 'catalog') {
|
||||
state.page = 1;
|
||||
}
|
||||
hash = '';
|
||||
}
|
||||
if (state.page != null) {
|
||||
page = state.page;
|
||||
if (page === Index.currentPage) {
|
||||
delete state.page;
|
||||
}
|
||||
Index.currentPage = page;
|
||||
pathname = page === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + page;
|
||||
hash = '';
|
||||
}
|
||||
history[state.replace ? 'replaceState' : 'pushState']({
|
||||
Index.setState(state);
|
||||
pathname = Index.currentPage === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + Index.currentPage;
|
||||
hash || (hash = '');
|
||||
return history[replace ? 'replaceState' : 'pushState']({
|
||||
mode: Conf['Index Mode'],
|
||||
searched: Index.search,
|
||||
oldpage: pageBeforeSearch
|
||||
}, '', location.protocol + "//" + location.host + pathname + hash);
|
||||
return state;
|
||||
},
|
||||
saveMode: function(mode) {
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
setState: function(arg) {
|
||||
var mode, page, ref, search;
|
||||
search = arg.search, mode = arg.mode, page = arg.page;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
Index.changed.search = true;
|
||||
Index.search = search;
|
||||
}
|
||||
if ((mode != null) && mode !== Conf['Index Mode']) {
|
||||
Index.changed.mode = true;
|
||||
Conf['Index Mode'] = mode;
|
||||
$.set('Index Mode', mode);
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
}
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
return $.set('Previous Index Mode', mode);
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
page = 1;
|
||||
}
|
||||
if ((page != null) && page !== Index.currentPage) {
|
||||
Index.changed.page = true;
|
||||
return Index.currentPage = page;
|
||||
}
|
||||
},
|
||||
pageLoad: function(arg) {
|
||||
var mode, scroll, search, sort;
|
||||
sort = arg.sort, search = arg.search, mode = arg.mode, scroll = arg.scroll;
|
||||
if (sort || (search != null)) {
|
||||
pageLoad: function(scroll) {
|
||||
var mode, page, ref, search, threads;
|
||||
if (scroll == null) {
|
||||
scroll = true;
|
||||
}
|
||||
ref = Index.changed, threads = ref.threads, search = ref.search, mode = ref.mode, page = ref.page;
|
||||
if (threads || search) {
|
||||
Index.sort();
|
||||
Index.buildPagelist();
|
||||
}
|
||||
if (search != null) {
|
||||
if (search) {
|
||||
Index.setupSearch();
|
||||
}
|
||||
if (mode != null) {
|
||||
if (mode) {
|
||||
Index.applyMode();
|
||||
}
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
if (scroll) {
|
||||
return Index.scrollToIndex();
|
||||
if (threads || search || mode || page) {
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
}
|
||||
if (scroll) {
|
||||
Index.scrollToIndex();
|
||||
}
|
||||
return Index.changed = {};
|
||||
},
|
||||
applyMode: function() {
|
||||
var k, len1, mode, ref;
|
||||
@ -3783,7 +3759,7 @@
|
||||
},
|
||||
setPage: function() {
|
||||
var a, href, maxPageNum, next, pageNum, pagesRoot, prev, strong;
|
||||
pageNum = Index.getCurrentPage();
|
||||
pageNum = Index.currentPage;
|
||||
maxPageNum = Index.getMaxPageNum();
|
||||
pagesRoot = $('.pages', Index.pagelist);
|
||||
prev = pagesRoot.previousSibling.firstChild;
|
||||
@ -3828,7 +3804,7 @@
|
||||
Index.hideLabel.hidden = false;
|
||||
return $('#hidden-count', Index.navLinks).textContent = hiddenCount === 1 ? '1 hidden thread' : hiddenCount + " hidden threads";
|
||||
},
|
||||
update: function(state) {
|
||||
update: function(firstTime) {
|
||||
var now, ref, ref1;
|
||||
if ((ref = Index.req) != null) {
|
||||
ref.abort();
|
||||
@ -3848,16 +3824,18 @@
|
||||
}), 3 * $.SECOND - (Date.now() - now));
|
||||
});
|
||||
}
|
||||
if (!firstTime && d.readyState !== 'loading' && !$('.board + *')) {
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
|
||||
onloadend: function(e) {
|
||||
return Index.load(e, state);
|
||||
}
|
||||
onloadend: Index.load
|
||||
}, {
|
||||
whenModified: 'Index'
|
||||
});
|
||||
return $.addClass(Index.button, 'fa-spin');
|
||||
},
|
||||
load: function(e, state) {
|
||||
load: function(e) {
|
||||
var err, nTimeout, notice, ref, req, timeEl;
|
||||
$.rmClass(Index.button, 'fa-spin');
|
||||
req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout;
|
||||
@ -3885,9 +3863,9 @@
|
||||
}
|
||||
try {
|
||||
if (req.status === 200) {
|
||||
Index.parse(req.response, state);
|
||||
} else if (req.status === 304 && (state != null)) {
|
||||
Index.pageLoad(state);
|
||||
Index.parse(req.response);
|
||||
} else if (req.status === 304) {
|
||||
Index.pageLoad();
|
||||
}
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
@ -3912,18 +3890,16 @@
|
||||
}
|
||||
timeEl = $('#index-last-refresh time', Index.navLinks);
|
||||
timeEl.dataset.utc = Date.parse(req.getResponseHeader('Last-Modified'));
|
||||
RelativeDates.update(timeEl);
|
||||
return Index.scrollToIndex();
|
||||
return RelativeDates.update(timeEl);
|
||||
},
|
||||
parse: function(pages, state) {
|
||||
parse: function(pages) {
|
||||
$.cleanCache(function(url) {
|
||||
return /^\/\/a\.4cdn\.org\//.test(url);
|
||||
});
|
||||
Index.parseThreadList(pages);
|
||||
Index.buildThreads();
|
||||
state || (state = {});
|
||||
state.sort = true;
|
||||
return Index.pageLoad(state);
|
||||
Index.changed.threads = true;
|
||||
return Index.pageLoad();
|
||||
},
|
||||
parseThreadList: function(pages) {
|
||||
Index.pagesNum = pages.length;
|
||||
@ -4140,14 +4116,15 @@
|
||||
i++;
|
||||
}
|
||||
page = Math.floor(i / Index.threadsNumPerPage) + 1;
|
||||
if (page !== Index.getCurrentPage()) {
|
||||
if (page !== Index.currentPage) {
|
||||
Index.currentPage = page;
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
Index.setPage();
|
||||
}
|
||||
}
|
||||
nodes = Index.buildSinglePage(Index.getCurrentPage());
|
||||
nodes = Index.buildSinglePage(Index.currentPage);
|
||||
}
|
||||
delete Index.pageNum;
|
||||
$.rmAll(Index.root);
|
||||
@ -4190,10 +4167,8 @@
|
||||
Index.onSearchInput();
|
||||
return Index.searchInput.focus();
|
||||
},
|
||||
setupSearch: function(noUpdate) {
|
||||
if (!noUpdate) {
|
||||
Index.searchInput.value = Index.search;
|
||||
}
|
||||
setupSearch: function() {
|
||||
Index.searchInput.value = Index.search;
|
||||
if (Index.search) {
|
||||
return Index.searchInput.dataset.searching = 1;
|
||||
} else {
|
||||
@ -4206,10 +4181,11 @@
|
||||
if (search === Index.search) {
|
||||
return;
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
search: search,
|
||||
replace: !!search === !!Index.search
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
querySearch: function(query) {
|
||||
var keywords;
|
||||
@ -6335,7 +6311,7 @@
|
||||
}
|
||||
},
|
||||
process: function(link, clone) {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.getAttribute('href')[0] === '#') {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.pathname === location.pathname && link.host === location.host && link.protocol === location.protocol) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
@ -6619,7 +6595,10 @@
|
||||
return $.asap((function() {
|
||||
return !Conf['Thread Updater'] || $('.navLinksBot > .updatelink');
|
||||
}), function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
}
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
@ -7029,7 +7008,7 @@
|
||||
}
|
||||
},
|
||||
initReady: function() {
|
||||
var link, linkBot, origToggle;
|
||||
var link, linkBot, navLinksBot, origToggle;
|
||||
$.off(d, '4chanXInitFinished', this.initReady);
|
||||
QR.postingIsEnabled = !!$.id('postForm');
|
||||
if (!QR.postingIsEnabled) {
|
||||
@ -7057,7 +7036,9 @@
|
||||
QR.open();
|
||||
return QR.nodes.com.focus();
|
||||
});
|
||||
$.prepend($('.navLinksBot'), linkBot);
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
$.prepend(navLinksBot, linkBot);
|
||||
}
|
||||
}
|
||||
origToggle = $.id('togglePostFormLink');
|
||||
$.before(origToggle, link);
|
||||
@ -12503,7 +12484,6 @@
|
||||
});
|
||||
$.add(a, range.extractContents());
|
||||
range.insertNode(a);
|
||||
range.detach();
|
||||
return a;
|
||||
}
|
||||
};
|
||||
@ -13168,7 +13148,10 @@
|
||||
innerHTML: "<a href=\"javascript:;\">Update</a>"
|
||||
});
|
||||
Main.ready(function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), updateLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), updateLink]);
|
||||
}
|
||||
});
|
||||
$.on(updateLink.firstElementChild, 'click', this.update);
|
||||
subEntries = [];
|
||||
@ -15644,7 +15627,15 @@
|
||||
});
|
||||
}
|
||||
return Main.ready(function() {
|
||||
return $.globalEval('(function() {\n window.clickable_ids = false;\n var nodes = document.querySelectorAll(\'.posteruid, .capcode\');\n for (var i = 0; i < nodes.length; i++) {\n nodes[i].removeEventListener("click", window.idClick, false);\n }\n window.removeEventListener("message", Report.onMessage, false);\n})();');
|
||||
return $.global(function() {
|
||||
var k, len1, node, ref1;
|
||||
window.clickable_ids = false;
|
||||
ref1 = document.querySelectorAll('.posteruid, .capcode');
|
||||
for (k = 0, len1 = ref1.length; k < len1; k++) {
|
||||
node = ref1[k];
|
||||
node.removeEventListener('click', window.idClick, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
code: function() {
|
||||
@ -17650,6 +17641,14 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.on(d, '4chanXInitFinished', function() {
|
||||
if (Main.expectInitFinished) {
|
||||
return delete Main.expectInitFinished;
|
||||
} else {
|
||||
new Notice('error', 'Error: Multiple copies of 4chan X are enabled.');
|
||||
return $.addClass(doc, 'tainted');
|
||||
}
|
||||
});
|
||||
flatten = function(parent, obj) {
|
||||
var key, val;
|
||||
if (obj instanceof Array) {
|
||||
@ -17814,7 +17813,7 @@
|
||||
},
|
||||
initStyle: function() {
|
||||
var keyboard, ref;
|
||||
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if ((ref = $('link[href*=mobile]', d.head)) != null) {
|
||||
@ -17876,7 +17875,7 @@
|
||||
});
|
||||
},
|
||||
initReady: function() {
|
||||
var ref, ref1;
|
||||
var msg, ref, ref1, ref2;
|
||||
if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) {
|
||||
ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() {
|
||||
if (Conf['404 Redirect']) {
|
||||
@ -17892,15 +17891,25 @@
|
||||
if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') {
|
||||
return;
|
||||
}
|
||||
if (((ref2 = g.VIEW) === 'index' || ref2 === 'thread') && !$('.board + *')) {
|
||||
msg = $.el('div', {
|
||||
innerHTML: "The page didn't load completely.<br>Some features may not work unless you <a href=\"javascript:;\">reload</a>."
|
||||
});
|
||||
$.on($('a', msg), 'click', function() {
|
||||
return location.reload();
|
||||
});
|
||||
new Notice('warning', msg);
|
||||
}
|
||||
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) {
|
||||
return Main.initThread();
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
initThread: function() {
|
||||
var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads;
|
||||
if (board = $('.board')) {
|
||||
if ((board = $('.board'))) {
|
||||
threads = [];
|
||||
posts = [];
|
||||
ref = $$('.board > .thread', board);
|
||||
@ -17911,17 +17920,19 @@
|
||||
ref1 = $$('.thread > .postContainer', threadRoot);
|
||||
for (q = 0, len2 = ref1.length; q < len2; q++) {
|
||||
postRoot = ref1[q];
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
if ($('.postMessage', postRoot)) {
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17941,9 +17952,11 @@
|
||||
post = posts[u];
|
||||
QuoteThreading.insert(post);
|
||||
}
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
});
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
@ -18034,7 +18047,7 @@
|
||||
details = details.replace(/file:\/{3}.+\//g, '');
|
||||
url = "https://gitreports.com/issue/ccd0/4chan-x?issue_title=" + (encodeURIComponent(title)) + "&details=" + (encodeURIComponent(details));
|
||||
return {
|
||||
innerHTML: " [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]"
|
||||
innerHTML: "<span class=\"report-error\"> [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]</span>"
|
||||
};
|
||||
},
|
||||
isThisPageLegit: function() {
|
||||
@ -19139,6 +19152,9 @@
|
||||
".message a {\n" +
|
||||
" text-decoration: underline;\n" +
|
||||
"}\n" +
|
||||
":root.tainted .report-error {\n" +
|
||||
" display: none;\n" +
|
||||
"}\n" +
|
||||
"/* Settings */\n" +
|
||||
":root.fourchan-x body {\n" +
|
||||
" -moz-box-sizing: border-box;\n" +
|
||||
@ -19328,9 +19344,9 @@
|
||||
" overflow: hidden;\n" +
|
||||
"}\n" +
|
||||
"/* Index */\n" +
|
||||
":root.index-loading .navLinks,\n" +
|
||||
":root.index-loading .board,\n" +
|
||||
":root.index-loading .pagelist,\n" +
|
||||
":root.index-loading .navLinks:not(.json-index),\n" +
|
||||
":root.index-loading .board:not(.json-index),\n" +
|
||||
":root.index-loading .pagelist:not(.json-index),\n" +
|
||||
":root.infinite-mode .pagelist,\n" +
|
||||
":root.all-pages-mode .pagelist,\n" +
|
||||
":root.catalog-mode .pagelist,\n" +
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.11.22.4
|
||||
// @version 1.11.23.0
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Generated by CoffeeScript
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.11.22.4
|
||||
// @version 1.11.23.0
|
||||
// @minGMVer 1.14
|
||||
// @minFFVer 26
|
||||
// @namespace 4chan-X
|
||||
@ -434,7 +434,7 @@
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '1.11.22.4',
|
||||
VERSION: '1.11.23.0',
|
||||
NAMESPACE: '4chan X.',
|
||||
boards: {}
|
||||
};
|
||||
@ -602,7 +602,7 @@
|
||||
if (req = reqs[url]) {
|
||||
if (req.readyState === 4) {
|
||||
$.queueTask(function() {
|
||||
return cb.call(req, req.evt);
|
||||
return cb.call(req, req.evt, true);
|
||||
});
|
||||
} else {
|
||||
req.callbacks.push(cb);
|
||||
@ -622,13 +622,16 @@
|
||||
}
|
||||
$.on(req, 'load', function(e) {
|
||||
var k, len1, ref;
|
||||
this.evt = e;
|
||||
ref = this.callbacks;
|
||||
for (k = 0, len1 = ref.length; k < len1; k++) {
|
||||
cb = ref[k];
|
||||
cb.call(this, e);
|
||||
$.queueTask((function(_this) {
|
||||
return function() {
|
||||
return cb.call(_this, e, false);
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
this.evt = e;
|
||||
this.cached = true;
|
||||
return delete this.callbacks;
|
||||
});
|
||||
$.on(req, 'abort error', rm);
|
||||
@ -2326,8 +2329,8 @@
|
||||
this.root.textContent = "Loading post No." + this.postID + "...";
|
||||
if (this.threadID) {
|
||||
$.cache("//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json", (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return function(e, isCached) {
|
||||
return _this.fetchedPost(e.target, isCached);
|
||||
};
|
||||
})(this));
|
||||
} else {
|
||||
@ -2358,7 +2361,7 @@
|
||||
return $.event('PostsInserted');
|
||||
};
|
||||
|
||||
Fetcher.prototype.fetchedPost = function(req) {
|
||||
Fetcher.prototype.fetchedPost = function(req, isCached) {
|
||||
var api, board, k, len1, post, posts, status, thread;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
@ -2382,14 +2385,14 @@
|
||||
}
|
||||
}
|
||||
if (post.no !== this.postID) {
|
||||
if (req.cached) {
|
||||
if (isCached) {
|
||||
api = "//a.4cdn.org/" + this.boardID + "/thread/" + this.threadID + ".json";
|
||||
$.cleanCache(function(url) {
|
||||
return url === api;
|
||||
});
|
||||
$.cache(api, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.fetchedPost(e.target);
|
||||
return _this.fetchedPost(e.target, false);
|
||||
};
|
||||
})(this));
|
||||
return;
|
||||
@ -2424,7 +2427,7 @@
|
||||
if (/^https:\/\//.test(url) || location.protocol === 'http:') {
|
||||
$.cache(url, (function(_this) {
|
||||
return function(e) {
|
||||
return _this.parseArchivedPost(e.target.response, url);
|
||||
return _this.parseArchivedPost(e.target.response, url, archive);
|
||||
};
|
||||
})(this), {
|
||||
responseType: 'json',
|
||||
@ -2445,7 +2448,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
return _this.parseArchivedPost(response, url);
|
||||
return _this.parseArchivedPost(response, url, archive);
|
||||
};
|
||||
})(this));
|
||||
return true;
|
||||
@ -2453,12 +2456,17 @@
|
||||
return false;
|
||||
};
|
||||
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url) {
|
||||
Fetcher.prototype.parseArchivedPost = function(data, url, archive) {
|
||||
var board, comment, greentext, i, j, key, o, post, ref, ref1, text, text2, thread, val;
|
||||
if (post = g.posts[this.boardID + "." + this.postID]) {
|
||||
this.insert(post);
|
||||
return;
|
||||
}
|
||||
if (data == null) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = "Error fetching Post No." + this.postID + " from " + archive.name + ".";
|
||||
return;
|
||||
}
|
||||
if (data.error) {
|
||||
$.addClass(this.root, 'warning');
|
||||
this.root.textContent = data.error;
|
||||
@ -2741,11 +2749,11 @@
|
||||
a.className = 'current';
|
||||
}
|
||||
Main.ready(function() {
|
||||
var oldFooter;
|
||||
if (oldFooter = $.id('boardNavDesktopFoot')) {
|
||||
var absbot, oldFooter;
|
||||
if ((oldFooter = $.id('boardNavDesktopFoot'))) {
|
||||
return $.replace($('.boardList', oldFooter), Header.bottomBoardList);
|
||||
} else {
|
||||
$.before($.id('absbot'), footer);
|
||||
} else if ((absbot = $.id('absbot'))) {
|
||||
$.before(absbot, footer);
|
||||
return $.globalEval('window.cloneTopNav = function() {};');
|
||||
}
|
||||
});
|
||||
@ -3256,12 +3264,12 @@
|
||||
|
||||
Index = {
|
||||
showHiddenThreads: false,
|
||||
changed: {},
|
||||
init: function() {
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, ref6, refNavEntry, repliesEntry, select;
|
||||
var anchorEntry, input, k, label, len1, len2, name, pinEntry, q, ref, ref1, ref2, ref3, ref4, ref5, refNavEntry, repliesEntry, select;
|
||||
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation'] || g.VIEW !== 'index') {
|
||||
return;
|
||||
}
|
||||
this.board = "" + g.BOARD;
|
||||
CatalogThread.callbacks.push({
|
||||
name: 'Catalog Features',
|
||||
cb: this.catalogNode
|
||||
@ -3271,10 +3279,10 @@
|
||||
Conf['Index Mode'] = (ref2 = history.state) != null ? ref2.mode : void 0;
|
||||
}
|
||||
this.currentPage = this.getCurrentPage();
|
||||
this.pushState({
|
||||
command: (ref3 = location.href.match(/#(.*)/)) != null ? ref3[1] : void 0,
|
||||
replace: true
|
||||
});
|
||||
this.processHash();
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
this.button = $.el('a', {
|
||||
className: 'index-refresh-shortcut fa fa-refresh',
|
||||
title: 'Refresh',
|
||||
@ -3300,9 +3308,9 @@
|
||||
pinEntry.el.title = 'Move watched threads to the start of the index.';
|
||||
anchorEntry.el.title = 'Move hidden threads to the end of the index.';
|
||||
refNavEntry.el.title = 'Refresh index when navigating through pages.';
|
||||
ref4 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref4.length; k < len1; k++) {
|
||||
label = ref4[k];
|
||||
ref3 = [repliesEntry, pinEntry, anchorEntry, refNavEntry];
|
||||
for (k = 0, len1 = ref3.length; k < len1; k++) {
|
||||
label = ref3[k];
|
||||
input = label.el.firstChild;
|
||||
name = input.name;
|
||||
$.on(input, 'change', $.cb.checked);
|
||||
@ -3322,69 +3330,59 @@
|
||||
order: 100,
|
||||
subEntries: [repliesEntry, pinEntry, anchorEntry, refNavEntry]
|
||||
});
|
||||
$.addClass(doc, 'index-loading', (Conf['Index Mode'].replace(/\ /g, '-')) + "-mode");
|
||||
this.root = $.el('div', {
|
||||
className: 'board'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
this.navLinks = $.el('div', {
|
||||
className: 'navLinks'
|
||||
className: 'navLinks json-index'
|
||||
});
|
||||
$.extend(this.navLinks, {
|
||||
innerHTML: "<span class=\"brackets-wrap indexlink\"><a href=\"#index\">Index</a></span> <span class=\"brackets-wrap cataloglink\"><a href=\"#catalog\">Catalog</a></span> <span class=\"brackets-wrap archlistlink\"><a href=\"./archive\">Archive</a></span> <span class=\"brackets-wrap bottomlink\"><a href=\"#bottom\">Bottom</a></span> <span class=\"brackets-wrap\" id=\"index-last-refresh\"><a href=\"javascript:;\"><time title=\"Last index refresh\">...</time></a></span> <input type=\"search\" id=\"index-search\" class=\"field\" placeholder=\"Search\"><a id=\"index-search-clear\" href=\"javascript:;\" title=\"Clear search\">×</a><span id=\"hidden-label\" hidden> — <span id=\"hidden-count\"></span> <span id=\"hidden-toggle\">[<a href=\"javascript:;\">Show</a>]</span></span><select id=\"index-mode\" name=\"Index Mode\"><option disabled>Index Mode</option><option value=\"paged\">Paged</option><option value=\"infinite\">Infinite scrolling</option><option value=\"all pages\">All threads</option><option value=\"catalog\">Catalog</option></select><select id=\"index-sort\" name=\"Index Sort\"><option disabled>Index Sort</option><option value=\"bump\">Bump order</option><option value=\"lastreply\">Last reply</option><option value=\"birth\">Creation date</option><option value=\"replycount\">Reply count</option><option value=\"filecount\">File count</option></select><select id=\"index-size\" name=\"Index Size\"><option disabled>Image Size</option><option value=\"small\">Small</option><option value=\"large\">Large</option></select>"
|
||||
});
|
||||
$('.cataloglink a', this.navLinks).href = CatalogLinks.catalog();
|
||||
if ((ref5 = g.BOARD.ID) === 'b' || ref5 === 'trash') {
|
||||
if ((ref4 = g.BOARD.ID) === 'b' || ref4 === 'trash') {
|
||||
$('.archlistlink', this.navLinks).hidden = true;
|
||||
}
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.setupSearch();
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
this.hideLabel = $('#hidden-label', this.navLinks);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
this.selectMode = $('#index-mode', this.navLinks);
|
||||
this.selectSort = $('#index-sort', this.navLinks);
|
||||
this.selectSize = $('#index-size', this.navLinks);
|
||||
$.on(window, 'popstate', this.cb.popstate);
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-last-refresh a', this.navLinks), 'click', this.cb.refreshFront);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
|
||||
$.on(this.selectMode, 'change', this.cb.mode);
|
||||
ref6 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref6.length; q < len2; q++) {
|
||||
select = ref6[q];
|
||||
ref5 = [this.selectMode, this.selectSort, this.selectSize];
|
||||
for (q = 0, len2 = ref5.length; q < len2; q++) {
|
||||
select = ref5[q];
|
||||
select.value = Conf[select.name];
|
||||
$.on(select, 'change', $.cb.value);
|
||||
}
|
||||
$.on(this.selectSort, 'change', this.cb.sort);
|
||||
$.on(this.selectSize, 'change', this.cb.size);
|
||||
this.update();
|
||||
$.asap((function() {
|
||||
return $('title + *', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
this.root = $.el('div', {
|
||||
className: 'board json-index'
|
||||
});
|
||||
this.cb.size();
|
||||
this.pagelist = $.el('div', {
|
||||
className: 'pagelist json-index'
|
||||
});
|
||||
$.extend(this.pagelist, {
|
||||
innerHTML: "<div class=\"prev\"><a><button disabled>Previous</button></a></div><div class=\"pages\"></div><div class=\"next\"><a><button disabled>Next</button></a></div><div class=\"pages cataloglink\"><a href=\"./catalog\">Catalog</a></div>"
|
||||
});
|
||||
$('.cataloglink a', this.pagelist).href = CatalogLinks.catalog();
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
this.update(true);
|
||||
$.onExists(doc, 'title + *', function() {
|
||||
return d.title = d.title.replace(/\ -\ Page\ \d+/, '');
|
||||
});
|
||||
$.asap((function() {
|
||||
return $('.board > .thread > .postContainer', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
var board, el, len3, len4, ref7, ref8, threadRoot, topNavPos, u, v;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
$.onExists(doc, '.board > .thread > .postContainer, .board + *', function() {
|
||||
var board, el, len3, len4, ref6, ref7, threadRoot, topNavPos, u, v;
|
||||
Index.hat = $('.board > .thread > img:first-child');
|
||||
if (Index.hat) {
|
||||
if (Index.nodes) {
|
||||
ref7 = Index.nodes;
|
||||
for (u = 0, len3 = ref7.length; u < len3; u++) {
|
||||
threadRoot = ref7[u];
|
||||
ref6 = Index.nodes;
|
||||
for (u = 0, len3 = ref6.length; u < len3; u++) {
|
||||
threadRoot = ref6[u];
|
||||
$.prepend(threadRoot, Index.hat.cloneNode(false));
|
||||
}
|
||||
}
|
||||
@ -3397,9 +3395,9 @@
|
||||
try {
|
||||
d.implementation.createDocument(null, null, null).appendChild(board);
|
||||
} catch (_error) {}
|
||||
ref8 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref8.length; v < len4; v++) {
|
||||
el = ref8[v];
|
||||
ref7 = $$('.navLinks');
|
||||
for (v = 0, len4 = ref7.length; v < len4; v++) {
|
||||
el = ref7[v];
|
||||
$.rm(el);
|
||||
}
|
||||
$.rm($.id('ctrl-top'));
|
||||
@ -3407,17 +3405,10 @@
|
||||
$.before(topNavPos, $.el('hr'));
|
||||
return $.before(topNavPos, Index.navLinks);
|
||||
});
|
||||
return $.asap((function() {
|
||||
return $('.pagelist', doc) || d.readyState !== 'loading';
|
||||
}), function() {
|
||||
return Main.ready(function() {
|
||||
var pagelist;
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if (pagelist = $('.pagelist')) {
|
||||
if ((pagelist = $('.pagelist'))) {
|
||||
$.replace(pagelist, Index.pagelist);
|
||||
} else {
|
||||
$.after($.id('delform'), Index.pagelist);
|
||||
}
|
||||
return $.rmClass(doc, 'index-loading');
|
||||
});
|
||||
@ -3428,7 +3419,7 @@
|
||||
return;
|
||||
}
|
||||
if (Index.pageNum == null) {
|
||||
Index.pageNum = Index.getCurrentPage();
|
||||
Index.pageNum = Index.currentPage;
|
||||
}
|
||||
pageNum = ++Index.pageNum;
|
||||
if (pageNum > Index.pagesNum) {
|
||||
@ -3546,9 +3537,10 @@
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
mode: mode
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
sort: function() {
|
||||
Index.sort();
|
||||
@ -3575,32 +3567,19 @@
|
||||
return Index.buildIndex();
|
||||
},
|
||||
popstate: function(e) {
|
||||
var mode, page, ref, ref1, searched, state;
|
||||
var mode, page, ref, searched;
|
||||
if (e != null ? e.state : void 0) {
|
||||
ref = e.state, searched = ref.searched, mode = ref.mode;
|
||||
state = {};
|
||||
if (Index.search !== searched) {
|
||||
state.search = Index.search = searched;
|
||||
}
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
state.mode = mode;
|
||||
Index.saveMode(mode);
|
||||
}
|
||||
page = Index.getCurrentPage();
|
||||
if (Index.currentPage !== page) {
|
||||
state.page = Index.currentPage = page;
|
||||
}
|
||||
if ((state.search != null) || (state.mode != null) || (state.page != null)) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
} else {
|
||||
state = Index.pushState({
|
||||
command: (ref1 = location.href.match(/#(.*)/)) != null ? ref1[1] : void 0,
|
||||
replace: true,
|
||||
scroll: true
|
||||
Index.setState({
|
||||
search: searched,
|
||||
mode: mode,
|
||||
page: page
|
||||
});
|
||||
if (state.command) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad'](state);
|
||||
return Index.pageLoad(false);
|
||||
} else {
|
||||
if (Index.processHash()) {
|
||||
return Index[Conf['Refreshed Navigation'] ? 'update' : 'pageLoad']();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -3627,120 +3606,117 @@
|
||||
return Index.userPageNav(+a.pathname.split(/\/+/)[2] || 1);
|
||||
},
|
||||
refreshFront: function() {
|
||||
return Index.update(Index.pushState({
|
||||
page: 1,
|
||||
scroll: true
|
||||
}));
|
||||
Index.pushState({
|
||||
page: 1
|
||||
});
|
||||
return Index.update();
|
||||
}
|
||||
},
|
||||
scrollToIndex: function() {
|
||||
return Header.scrollToIfNeeded(Index.navLinks);
|
||||
},
|
||||
getCurrentPage: function() {
|
||||
var ref;
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
return 1;
|
||||
} else {
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
}
|
||||
return +window.location.pathname.split(/\/+/)[2] || 1;
|
||||
},
|
||||
userPageNav: function(page) {
|
||||
var state;
|
||||
state = Index.pushState({
|
||||
page: page,
|
||||
scroll: true
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
if (Conf['Refreshed Navigation']) {
|
||||
return Index.update(state);
|
||||
return Index.update();
|
||||
} else {
|
||||
if (state.page) {
|
||||
return Index.pageLoad(state);
|
||||
}
|
||||
return Index.pageLoad();
|
||||
}
|
||||
},
|
||||
pushState: function(state) {
|
||||
var command, hash, mode, page, pageBeforeSearch, pathname, ref, search;
|
||||
pathname = location.pathname, hash = location.hash;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if (state.command != null) {
|
||||
command = state.command;
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
hash = '';
|
||||
} else {
|
||||
delete state.command;
|
||||
}
|
||||
processHash: function() {
|
||||
var command, hash, ref, state;
|
||||
hash = ((ref = location.href.match(/#.*/)) != null ? ref[0] : void 0) || '';
|
||||
command = hash.slice(1);
|
||||
state = {
|
||||
replace: true
|
||||
};
|
||||
if (command === 'paged' || command === 'infinite' || command === 'all-pages' || command === 'catalog') {
|
||||
state.mode = command.replace(/-/g, ' ');
|
||||
} else if (command === 'index') {
|
||||
state.mode = Conf['Previous Index Mode'];
|
||||
state.page = 1;
|
||||
} else if (/^s=/.test(command)) {
|
||||
state.search = decodeURIComponent(command.slice(2)).replace(/\+/g, ' ').trim();
|
||||
} else {
|
||||
state.hash = hash;
|
||||
}
|
||||
if (state.search != null) {
|
||||
search = state.search;
|
||||
Index.pushState(state);
|
||||
return state.hash == null;
|
||||
},
|
||||
pushState: function(state) {
|
||||
var hash, pageBeforeSearch, pathname, ref, replace, search;
|
||||
search = state.search, hash = state.hash, replace = state.replace;
|
||||
pageBeforeSearch = (ref = history.state) != null ? ref.oldpage : void 0;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
state.page = search ? 1 : pageBeforeSearch || 1;
|
||||
if (!search) {
|
||||
pageBeforeSearch = void 0;
|
||||
} else if (!Index.search) {
|
||||
pageBeforeSearch = Index.currentPage;
|
||||
}
|
||||
Index.search = search;
|
||||
}
|
||||
if (state.mode != null) {
|
||||
mode = state.mode;
|
||||
if (mode === Conf['Index Mode']) {
|
||||
delete state.mode;
|
||||
}
|
||||
Index.saveMode(mode);
|
||||
if (mode === 'all pages' || mode === 'catalog') {
|
||||
state.page = 1;
|
||||
}
|
||||
hash = '';
|
||||
}
|
||||
if (state.page != null) {
|
||||
page = state.page;
|
||||
if (page === Index.currentPage) {
|
||||
delete state.page;
|
||||
}
|
||||
Index.currentPage = page;
|
||||
pathname = page === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + page;
|
||||
hash = '';
|
||||
}
|
||||
history[state.replace ? 'replaceState' : 'pushState']({
|
||||
Index.setState(state);
|
||||
pathname = Index.currentPage === 1 ? "/" + g.BOARD + "/" : "/" + g.BOARD + "/" + Index.currentPage;
|
||||
hash || (hash = '');
|
||||
return history[replace ? 'replaceState' : 'pushState']({
|
||||
mode: Conf['Index Mode'],
|
||||
searched: Index.search,
|
||||
oldpage: pageBeforeSearch
|
||||
}, '', location.protocol + "//" + location.host + pathname + hash);
|
||||
return state;
|
||||
},
|
||||
saveMode: function(mode) {
|
||||
if (Conf['Index Mode'] !== mode) {
|
||||
setState: function(arg) {
|
||||
var mode, page, ref, search;
|
||||
search = arg.search, mode = arg.mode, page = arg.page;
|
||||
if ((search != null) && search !== Index.search) {
|
||||
Index.changed.search = true;
|
||||
Index.search = search;
|
||||
}
|
||||
if ((mode != null) && mode !== Conf['Index Mode']) {
|
||||
Index.changed.mode = true;
|
||||
Conf['Index Mode'] = mode;
|
||||
$.set('Index Mode', mode);
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
$.set('Previous Index Mode', mode);
|
||||
}
|
||||
}
|
||||
if (!(mode === 'catalog' || Conf['Previous Index Mode'] === mode)) {
|
||||
Conf['Previous Index Mode'] = mode;
|
||||
return $.set('Previous Index Mode', mode);
|
||||
if ((ref = Conf['Index Mode']) === 'all pages' || ref === 'catalog') {
|
||||
page = 1;
|
||||
}
|
||||
if ((page != null) && page !== Index.currentPage) {
|
||||
Index.changed.page = true;
|
||||
return Index.currentPage = page;
|
||||
}
|
||||
},
|
||||
pageLoad: function(arg) {
|
||||
var mode, scroll, search, sort;
|
||||
sort = arg.sort, search = arg.search, mode = arg.mode, scroll = arg.scroll;
|
||||
if (sort || (search != null)) {
|
||||
pageLoad: function(scroll) {
|
||||
var mode, page, ref, search, threads;
|
||||
if (scroll == null) {
|
||||
scroll = true;
|
||||
}
|
||||
ref = Index.changed, threads = ref.threads, search = ref.search, mode = ref.mode, page = ref.page;
|
||||
if (threads || search) {
|
||||
Index.sort();
|
||||
Index.buildPagelist();
|
||||
}
|
||||
if (search != null) {
|
||||
if (search) {
|
||||
Index.setupSearch();
|
||||
}
|
||||
if (mode != null) {
|
||||
if (mode) {
|
||||
Index.applyMode();
|
||||
}
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
if (scroll) {
|
||||
return Index.scrollToIndex();
|
||||
if (threads || search || mode || page) {
|
||||
Index.buildIndex();
|
||||
Index.setPage();
|
||||
}
|
||||
if (scroll) {
|
||||
Index.scrollToIndex();
|
||||
}
|
||||
return Index.changed = {};
|
||||
},
|
||||
applyMode: function() {
|
||||
var k, len1, mode, ref;
|
||||
@ -3783,7 +3759,7 @@
|
||||
},
|
||||
setPage: function() {
|
||||
var a, href, maxPageNum, next, pageNum, pagesRoot, prev, strong;
|
||||
pageNum = Index.getCurrentPage();
|
||||
pageNum = Index.currentPage;
|
||||
maxPageNum = Index.getMaxPageNum();
|
||||
pagesRoot = $('.pages', Index.pagelist);
|
||||
prev = pagesRoot.previousSibling.firstChild;
|
||||
@ -3828,7 +3804,7 @@
|
||||
Index.hideLabel.hidden = false;
|
||||
return $('#hidden-count', Index.navLinks).textContent = hiddenCount === 1 ? '1 hidden thread' : hiddenCount + " hidden threads";
|
||||
},
|
||||
update: function(state) {
|
||||
update: function(firstTime) {
|
||||
var now, ref, ref1;
|
||||
if ((ref = Index.req) != null) {
|
||||
ref.abort();
|
||||
@ -3848,16 +3824,18 @@
|
||||
}), 3 * $.SECOND - (Date.now() - now));
|
||||
});
|
||||
}
|
||||
if (!firstTime && d.readyState !== 'loading' && !$('.board + *')) {
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD + "/catalog.json", {
|
||||
onloadend: function(e) {
|
||||
return Index.load(e, state);
|
||||
}
|
||||
onloadend: Index.load
|
||||
}, {
|
||||
whenModified: 'Index'
|
||||
});
|
||||
return $.addClass(Index.button, 'fa-spin');
|
||||
},
|
||||
load: function(e, state) {
|
||||
load: function(e) {
|
||||
var err, nTimeout, notice, ref, req, timeEl;
|
||||
$.rmClass(Index.button, 'fa-spin');
|
||||
req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout;
|
||||
@ -3885,9 +3863,9 @@
|
||||
}
|
||||
try {
|
||||
if (req.status === 200) {
|
||||
Index.parse(req.response, state);
|
||||
} else if (req.status === 304 && (state != null)) {
|
||||
Index.pageLoad(state);
|
||||
Index.parse(req.response);
|
||||
} else if (req.status === 304) {
|
||||
Index.pageLoad();
|
||||
}
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
@ -3912,18 +3890,16 @@
|
||||
}
|
||||
timeEl = $('#index-last-refresh time', Index.navLinks);
|
||||
timeEl.dataset.utc = Date.parse(req.getResponseHeader('Last-Modified'));
|
||||
RelativeDates.update(timeEl);
|
||||
return Index.scrollToIndex();
|
||||
return RelativeDates.update(timeEl);
|
||||
},
|
||||
parse: function(pages, state) {
|
||||
parse: function(pages) {
|
||||
$.cleanCache(function(url) {
|
||||
return /^\/\/a\.4cdn\.org\//.test(url);
|
||||
});
|
||||
Index.parseThreadList(pages);
|
||||
Index.buildThreads();
|
||||
state || (state = {});
|
||||
state.sort = true;
|
||||
return Index.pageLoad(state);
|
||||
Index.changed.threads = true;
|
||||
return Index.pageLoad();
|
||||
},
|
||||
parseThreadList: function(pages) {
|
||||
Index.pagesNum = pages.length;
|
||||
@ -4140,14 +4116,15 @@
|
||||
i++;
|
||||
}
|
||||
page = Math.floor(i / Index.threadsNumPerPage) + 1;
|
||||
if (page !== Index.getCurrentPage()) {
|
||||
if (page !== Index.currentPage) {
|
||||
Index.currentPage = page;
|
||||
Index.pushState({
|
||||
page: page
|
||||
});
|
||||
Index.setPage();
|
||||
}
|
||||
}
|
||||
nodes = Index.buildSinglePage(Index.getCurrentPage());
|
||||
nodes = Index.buildSinglePage(Index.currentPage);
|
||||
}
|
||||
delete Index.pageNum;
|
||||
$.rmAll(Index.root);
|
||||
@ -4190,10 +4167,8 @@
|
||||
Index.onSearchInput();
|
||||
return Index.searchInput.focus();
|
||||
},
|
||||
setupSearch: function(noUpdate) {
|
||||
if (!noUpdate) {
|
||||
Index.searchInput.value = Index.search;
|
||||
}
|
||||
setupSearch: function() {
|
||||
Index.searchInput.value = Index.search;
|
||||
if (Index.search) {
|
||||
return Index.searchInput.dataset.searching = 1;
|
||||
} else {
|
||||
@ -4206,10 +4181,11 @@
|
||||
if (search === Index.search) {
|
||||
return;
|
||||
}
|
||||
return Index.pageLoad(Index.pushState({
|
||||
Index.pushState({
|
||||
search: search,
|
||||
replace: !!search === !!Index.search
|
||||
}));
|
||||
});
|
||||
return Index.pageLoad(false);
|
||||
},
|
||||
querySearch: function(query) {
|
||||
var keywords;
|
||||
@ -6335,7 +6311,7 @@
|
||||
}
|
||||
},
|
||||
process: function(link, clone) {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.getAttribute('href')[0] === '#') {
|
||||
if (Conf['Inline Cross-thread Quotes Only'] && link.pathname === location.pathname && link.host === location.host && link.protocol === location.protocol) {
|
||||
return;
|
||||
}
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
@ -6619,7 +6595,10 @@
|
||||
return $.asap((function() {
|
||||
return !Conf['Thread Updater'] || $('.navLinksBot > .updatelink');
|
||||
}), function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), QuoteThreading.threadNewLink]);
|
||||
}
|
||||
});
|
||||
},
|
||||
node: function() {
|
||||
@ -7029,7 +7008,7 @@
|
||||
}
|
||||
},
|
||||
initReady: function() {
|
||||
var link, linkBot, origToggle;
|
||||
var link, linkBot, navLinksBot, origToggle;
|
||||
$.off(d, '4chanXInitFinished', this.initReady);
|
||||
QR.postingIsEnabled = !!$.id('postForm');
|
||||
if (!QR.postingIsEnabled) {
|
||||
@ -7057,7 +7036,9 @@
|
||||
QR.open();
|
||||
return QR.nodes.com.focus();
|
||||
});
|
||||
$.prepend($('.navLinksBot'), linkBot);
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
$.prepend(navLinksBot, linkBot);
|
||||
}
|
||||
}
|
||||
origToggle = $.id('togglePostFormLink');
|
||||
$.before(origToggle, link);
|
||||
@ -12503,7 +12484,6 @@
|
||||
});
|
||||
$.add(a, range.extractContents());
|
||||
range.insertNode(a);
|
||||
range.detach();
|
||||
return a;
|
||||
}
|
||||
};
|
||||
@ -13168,7 +13148,10 @@
|
||||
innerHTML: "<a href=\"javascript:;\">Update</a>"
|
||||
});
|
||||
Main.ready(function() {
|
||||
return $.add($('.navLinksBot'), [$.tn(' '), updateLink]);
|
||||
var navLinksBot;
|
||||
if ((navLinksBot = $('.navLinksBot'))) {
|
||||
return $.add(navLinksBot, [$.tn(' '), updateLink]);
|
||||
}
|
||||
});
|
||||
$.on(updateLink.firstElementChild, 'click', this.update);
|
||||
subEntries = [];
|
||||
@ -15644,7 +15627,15 @@
|
||||
});
|
||||
}
|
||||
return Main.ready(function() {
|
||||
return $.globalEval('(function() {\n window.clickable_ids = false;\n var nodes = document.querySelectorAll(\'.posteruid, .capcode\');\n for (var i = 0; i < nodes.length; i++) {\n nodes[i].removeEventListener("click", window.idClick, false);\n }\n window.removeEventListener("message", Report.onMessage, false);\n})();');
|
||||
return $.global(function() {
|
||||
var k, len1, node, ref1;
|
||||
window.clickable_ids = false;
|
||||
ref1 = document.querySelectorAll('.posteruid, .capcode');
|
||||
for (k = 0, len1 = ref1.length; k < len1; k++) {
|
||||
node = ref1[k];
|
||||
node.removeEventListener('click', window.idClick, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
code: function() {
|
||||
@ -17650,6 +17641,14 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.on(d, '4chanXInitFinished', function() {
|
||||
if (Main.expectInitFinished) {
|
||||
return delete Main.expectInitFinished;
|
||||
} else {
|
||||
new Notice('error', 'Error: Multiple copies of 4chan X are enabled.');
|
||||
return $.addClass(doc, 'tainted');
|
||||
}
|
||||
});
|
||||
flatten = function(parent, obj) {
|
||||
var key, val;
|
||||
if (obj instanceof Array) {
|
||||
@ -17814,7 +17813,7 @@
|
||||
},
|
||||
initStyle: function() {
|
||||
var keyboard, ref;
|
||||
if (!Main.isThisPageLegit() || $.hasClass(doc, 'fourchan-x')) {
|
||||
if (!Main.isThisPageLegit()) {
|
||||
return;
|
||||
}
|
||||
if ((ref = $('link[href*=mobile]', d.head)) != null) {
|
||||
@ -17876,7 +17875,7 @@
|
||||
});
|
||||
},
|
||||
initReady: function() {
|
||||
var ref, ref1;
|
||||
var msg, ref, ref1, ref2;
|
||||
if (g.VIEW === 'thread' && (((ref = d.title) === '4chan - Temporarily Offline' || ref === '4chan - 404 Not Found') || ($('.board') && !$('.opContainer')))) {
|
||||
ThreadWatcher.set404(g.BOARD.ID, g.THREADID, function() {
|
||||
if (Conf['404 Redirect']) {
|
||||
@ -17892,15 +17891,25 @@
|
||||
if ((ref1 = d.title) === '4chan - Temporarily Offline' || ref1 === '4chan - 404 Not Found') {
|
||||
return;
|
||||
}
|
||||
if (((ref2 = g.VIEW) === 'index' || ref2 === 'thread') && !$('.board + *')) {
|
||||
msg = $.el('div', {
|
||||
innerHTML: "The page didn't load completely.<br>Some features may not work unless you <a href=\"javascript:;\">reload</a>."
|
||||
});
|
||||
$.on($('a', msg), 'click', function() {
|
||||
return location.reload();
|
||||
});
|
||||
new Notice('warning', msg);
|
||||
}
|
||||
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) {
|
||||
return Main.initThread();
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
initThread: function() {
|
||||
var board, err, errors, k, len1, len2, m, postRoot, posts, q, ref, ref1, scriptData, thread, threadRoot, threads;
|
||||
if (board = $('.board')) {
|
||||
if ((board = $('.board'))) {
|
||||
threads = [];
|
||||
posts = [];
|
||||
ref = $$('.board > .thread', board);
|
||||
@ -17911,17 +17920,19 @@
|
||||
ref1 = $$('.thread > .postContainer', threadRoot);
|
||||
for (q = 0, len2 = ref1.length; q < len2; q++) {
|
||||
postRoot = ref1[q];
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
if ($('.postMessage', postRoot)) {
|
||||
try {
|
||||
posts.push(new Post(postRoot, thread, g.BOARD));
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
errors.push({
|
||||
message: "Parsing of Post No." + (postRoot.id.match(/\d+/)) + " failed. Post will be skipped.",
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17941,9 +17952,11 @@
|
||||
post = posts[u];
|
||||
QuoteThreading.insert(post);
|
||||
}
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
});
|
||||
} else {
|
||||
Main.expectInitFinished = true;
|
||||
return $.event('4chanXInitFinished');
|
||||
}
|
||||
},
|
||||
@ -18034,7 +18047,7 @@
|
||||
details = details.replace(/file:\/{3}.+\//g, '');
|
||||
url = "https://gitreports.com/issue/ccd0/4chan-x?issue_title=" + (encodeURIComponent(title)) + "&details=" + (encodeURIComponent(details));
|
||||
return {
|
||||
innerHTML: " [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]"
|
||||
innerHTML: "<span class=\"report-error\"> [<a href=\"" + E(url) + "\" target=\"_blank\">report</a>]</span>"
|
||||
};
|
||||
},
|
||||
isThisPageLegit: function() {
|
||||
@ -19139,6 +19152,9 @@
|
||||
".message a {\n" +
|
||||
" text-decoration: underline;\n" +
|
||||
"}\n" +
|
||||
":root.tainted .report-error {\n" +
|
||||
" display: none;\n" +
|
||||
"}\n" +
|
||||
"/* Settings */\n" +
|
||||
":root.fourchan-x body {\n" +
|
||||
" -moz-box-sizing: border-box;\n" +
|
||||
@ -19328,9 +19344,9 @@
|
||||
" overflow: hidden;\n" +
|
||||
"}\n" +
|
||||
"/* Index */\n" +
|
||||
":root.index-loading .navLinks,\n" +
|
||||
":root.index-loading .board,\n" +
|
||||
":root.index-loading .pagelist,\n" +
|
||||
":root.index-loading .navLinks:not(.json-index),\n" +
|
||||
":root.index-loading .board:not(.json-index),\n" +
|
||||
":root.index-loading .pagelist:not(.json-index),\n" +
|
||||
":root.infinite-mode .pagelist,\n" +
|
||||
":root.all-pages-mode .pagelist,\n" +
|
||||
":root.catalog-mode .pagelist,\n" +
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.22.4' />
|
||||
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.11.23.0' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.11.22.4' />
|
||||
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.11.23.0' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "1.11.22.4",
|
||||
"date": "2016-01-24T05:47:35.520Z"
|
||||
"version": "1.11.23.0",
|
||||
"date": "2016-01-25T04:51:14.827Z"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user