Phase out vanilla catalog
This commit is contained in:
parent
e4c8bd7ee6
commit
cf1a4c1cc4
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-07
|
||||
* 4chan X - Version 1.4.1 - 2014-03-08
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-07
|
||||
* 4chan X - Version 1.4.1 - 2014-03-08
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
@ -2639,6 +2639,7 @@
|
||||
innerHTML: "<span class=brackets-wrap id=returnlink><a href=.././>Return</a></span> <span class=brackets-wrap id=bottomlink><a href=\"#bottom\">Bottom</a></span> <span id=\"index-menu\"><input type=\"search\" id=\"index-search\" class=\"field\" placeholder=\"Search\"><a id=\"index-search-clear\" class=\"fa fa-times-circle\" href=\"javascript:;\"></a> <time id=\"index-last-refresh\" title=\"Last index refresh\">...</time><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></span>"
|
||||
});
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.searchTest();
|
||||
this.hideLabel = $('#hidden-label', this.navLinks);
|
||||
this.selectMode = $('#index-mode', this.navLinks);
|
||||
this.selectSort = $('#index-sort', this.navLinks);
|
||||
@ -2655,12 +2656,9 @@
|
||||
$.on(this.selectMode, 'change', this.cb.mode);
|
||||
$.on(this.selectSort, 'change', this.cb.sort);
|
||||
$.on(this.selectSize, 'change', this.cb.size);
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.currentPage = this.getCurrentPage();
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
$.on($('#returnlink a', this.navLinks), 'click', Navigate.navigate);
|
||||
if (g.VIEW === 'index') {
|
||||
this.update();
|
||||
@ -2844,18 +2842,22 @@
|
||||
types[(i + 1) % types.length].selected = true;
|
||||
return $.event('change', null, Index.selectSort);
|
||||
},
|
||||
addCatalogSwitch: function() {
|
||||
var a;
|
||||
a = $.el('a', {
|
||||
href: 'javascript:;',
|
||||
textContent: 'Switch to 4chan X\'s catalog',
|
||||
className: 'btn-wrap'
|
||||
});
|
||||
$.on(a, 'click', function() {
|
||||
$.set('Index Mode', 'catalog');
|
||||
return window.location = './';
|
||||
});
|
||||
return $.add($.id('info'), a);
|
||||
catalogSwitch: function() {
|
||||
var hash;
|
||||
$.set('Index Mode', 'catalog');
|
||||
hash = window.location.hash;
|
||||
return window.location = './' + hash;
|
||||
},
|
||||
searchTest: function() {
|
||||
var hash, match;
|
||||
if (!(hash = window.location.hash)) {
|
||||
return;
|
||||
}
|
||||
if (!(match = hash.match(/s=([\w]+)/))) {
|
||||
return;
|
||||
}
|
||||
this.searchInput.value = match[1];
|
||||
return $.on(d, '4chanXInitFinished', this.onSearchInput);
|
||||
},
|
||||
setupNavLinks: function() {
|
||||
var el, _i, _len, _ref;
|
||||
@ -3105,7 +3107,9 @@
|
||||
} else {
|
||||
strong = $.el('strong');
|
||||
}
|
||||
a = pagesRoot.children[pageNum];
|
||||
if (!(a = pagesRoot.children[pageNum])) {
|
||||
return;
|
||||
}
|
||||
$.before(a, strong);
|
||||
return $.add(strong, a);
|
||||
},
|
||||
@ -12763,9 +12767,6 @@
|
||||
return;
|
||||
}
|
||||
$.addClass(Index.button, 'fa-spin');
|
||||
if (Index.isSearching) {
|
||||
Index.clearSearch();
|
||||
}
|
||||
_ref = this.pathname.split('/'), _ = _ref[0], boardID = _ref[1], view = _ref[2], threadID = _ref[3];
|
||||
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
||||
return;
|
||||
@ -12773,6 +12774,9 @@
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (Index.isSearching) {
|
||||
Index.clearSearch();
|
||||
}
|
||||
Navigate.title = function() {};
|
||||
delete Index.pageNum;
|
||||
$.rmAll(Header.hover);
|
||||
@ -12783,7 +12787,7 @@
|
||||
view = 'index';
|
||||
}
|
||||
path = this.pathname;
|
||||
if (this.hash) {
|
||||
if (this.hash && view === 'thread') {
|
||||
path += this.hash;
|
||||
}
|
||||
if (this.id !== 'popState') {
|
||||
@ -13534,8 +13538,7 @@
|
||||
}
|
||||
})();
|
||||
if (g.VIEW === 'catalog') {
|
||||
$.ready(Index.addCatalogSwitch);
|
||||
return;
|
||||
return $.ready(Index.catalogSwitch);
|
||||
}
|
||||
if (g.VIEW === 'thread') {
|
||||
g.THREADID = +pathname[3];
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* 4chan X - Version 1.4.1 - 2014-03-07
|
||||
* 4chan X - Version 1.4.1 - 2014-03-08
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||
@ -2698,6 +2698,7 @@
|
||||
innerHTML: "<span class=brackets-wrap id=returnlink><a href=.././>Return</a></span> <span class=brackets-wrap id=bottomlink><a href=\"#bottom\">Bottom</a></span> <span id=\"index-menu\"><input type=\"search\" id=\"index-search\" class=\"field\" placeholder=\"Search\"><a id=\"index-search-clear\" class=\"fa fa-times-circle\" href=\"javascript:;\"></a> <time id=\"index-last-refresh\" title=\"Last index refresh\">...</time><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></span>"
|
||||
});
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.searchTest();
|
||||
this.hideLabel = $('#hidden-label', this.navLinks);
|
||||
this.selectMode = $('#index-mode', this.navLinks);
|
||||
this.selectSort = $('#index-sort', this.navLinks);
|
||||
@ -2714,12 +2715,9 @@
|
||||
$.on(this.selectMode, 'change', this.cb.mode);
|
||||
$.on(this.selectSort, 'change', this.cb.sort);
|
||||
$.on(this.selectSize, 'change', this.cb.size);
|
||||
this.searchInput = $('#index-search', this.navLinks);
|
||||
this.currentPage = this.getCurrentPage();
|
||||
$.on(d, 'scroll', Index.scroll);
|
||||
$.on(this.pagelist, 'click', this.cb.pageNav);
|
||||
$.on(this.searchInput, 'input', this.onSearchInput);
|
||||
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
|
||||
$.on($('#returnlink a', this.navLinks), 'click', Navigate.navigate);
|
||||
if (g.VIEW === 'index') {
|
||||
this.update();
|
||||
@ -2903,18 +2901,22 @@
|
||||
types[(i + 1) % types.length].selected = true;
|
||||
return $.event('change', null, Index.selectSort);
|
||||
},
|
||||
addCatalogSwitch: function() {
|
||||
var a;
|
||||
a = $.el('a', {
|
||||
href: 'javascript:;',
|
||||
textContent: 'Switch to 4chan X\'s catalog',
|
||||
className: 'btn-wrap'
|
||||
});
|
||||
$.on(a, 'click', function() {
|
||||
$.set('Index Mode', 'catalog');
|
||||
return window.location = './';
|
||||
});
|
||||
return $.add($.id('info'), a);
|
||||
catalogSwitch: function() {
|
||||
var hash;
|
||||
$.set('Index Mode', 'catalog');
|
||||
hash = window.location.hash;
|
||||
return window.location = './' + hash;
|
||||
},
|
||||
searchTest: function() {
|
||||
var hash, match;
|
||||
if (!(hash = window.location.hash)) {
|
||||
return;
|
||||
}
|
||||
if (!(match = hash.match(/s=([\w]+)/))) {
|
||||
return;
|
||||
}
|
||||
this.searchInput.value = match[1];
|
||||
return $.on(d, '4chanXInitFinished', this.onSearchInput);
|
||||
},
|
||||
setupNavLinks: function() {
|
||||
var el, _i, _len, _ref;
|
||||
@ -3164,7 +3166,9 @@
|
||||
} else {
|
||||
strong = $.el('strong');
|
||||
}
|
||||
a = pagesRoot.children[pageNum];
|
||||
if (!(a = pagesRoot.children[pageNum])) {
|
||||
return;
|
||||
}
|
||||
$.before(a, strong);
|
||||
return $.add(strong, a);
|
||||
},
|
||||
@ -12777,9 +12781,6 @@
|
||||
return;
|
||||
}
|
||||
$.addClass(Index.button, 'fa-spin');
|
||||
if (Index.isSearching) {
|
||||
Index.clearSearch();
|
||||
}
|
||||
_ref = this.pathname.split('/'), _ = _ref[0], boardID = _ref[1], view = _ref[2], threadID = _ref[3];
|
||||
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
||||
return;
|
||||
@ -12787,6 +12788,9 @@
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (Index.isSearching) {
|
||||
Index.clearSearch();
|
||||
}
|
||||
Navigate.title = function() {};
|
||||
delete Index.pageNum;
|
||||
$.rmAll(Header.hover);
|
||||
@ -12797,7 +12801,7 @@
|
||||
view = 'index';
|
||||
}
|
||||
path = this.pathname;
|
||||
if (this.hash) {
|
||||
if (this.hash && view === 'thread') {
|
||||
path += this.hash;
|
||||
}
|
||||
if (this.id !== 'popState') {
|
||||
@ -13546,8 +13550,7 @@
|
||||
}
|
||||
})();
|
||||
if (g.VIEW === 'catalog') {
|
||||
$.ready(Index.addCatalogSwitch);
|
||||
return;
|
||||
return $.ready(Index.catalogSwitch);
|
||||
}
|
||||
if (g.VIEW === 'thread') {
|
||||
g.THREADID = +pathname[3];
|
||||
|
||||
@ -95,6 +95,9 @@ Index =
|
||||
innerHTML: <%= importHTML('Features/Index-navlinks') %>
|
||||
|
||||
@searchInput = $ '#index-search', @navLinks
|
||||
|
||||
@searchTest()
|
||||
|
||||
@hideLabel = $ '#hidden-label', @navLinks
|
||||
@selectMode = $ '#index-mode', @navLinks
|
||||
@selectSort = $ '#index-sort', @navLinks
|
||||
@ -109,14 +112,10 @@ Index =
|
||||
$.on @selectSort, 'change', @cb.sort
|
||||
$.on @selectSize, 'change', @cb.size
|
||||
|
||||
@searchInput = $ '#index-search', @navLinks
|
||||
|
||||
@currentPage = @getCurrentPage()
|
||||
|
||||
$.on d, 'scroll', Index.scroll
|
||||
$.on @pagelist, 'click', @cb.pageNav
|
||||
$.on @searchInput, 'input', @onSearchInput
|
||||
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
||||
$.on $('#returnlink a', @navLinks), 'click', Navigate.navigate
|
||||
|
||||
if g.VIEW is 'index'
|
||||
@ -254,15 +253,16 @@ Index =
|
||||
types[(i + 1) % types.length].selected = true
|
||||
$.event 'change', null, Index.selectSort
|
||||
|
||||
addCatalogSwitch: ->
|
||||
a = $.el 'a',
|
||||
href: 'javascript:;'
|
||||
textContent: 'Switch to <%= meta.name %>\'s catalog'
|
||||
className: 'btn-wrap'
|
||||
$.on a, 'click', ->
|
||||
$.set 'Index Mode', 'catalog'
|
||||
window.location = './'
|
||||
$.add $.id('info'), a
|
||||
catalogSwitch: ->
|
||||
$.set 'Index Mode', 'catalog'
|
||||
{hash} = window.location
|
||||
window.location = './' + hash
|
||||
|
||||
searchTest: ->
|
||||
return unless hash = window.location.hash
|
||||
return unless match = hash.match /s=([\w]+)/
|
||||
@searchInput.value = match[1]
|
||||
$.on d, '4chanXInitFinished', @onSearchInput
|
||||
|
||||
setupNavLinks: ->
|
||||
for el in $$ '.navLinks.desktop > a'
|
||||
@ -456,7 +456,7 @@ Index =
|
||||
$.replace strong, strong.firstChild
|
||||
else
|
||||
strong = $.el 'strong'
|
||||
a = pagesRoot.children[pageNum]
|
||||
return unless a = pagesRoot.children[pageNum] # If coming in from a Navigate.navigate, this could break.
|
||||
$.before a, strong
|
||||
$.add strong, a
|
||||
|
||||
|
||||
@ -15,8 +15,7 @@ Main =
|
||||
else
|
||||
'index'
|
||||
if g.VIEW is 'catalog'
|
||||
$.ready Index.addCatalogSwitch
|
||||
return
|
||||
return $.ready Index.catalogSwitch
|
||||
if g.VIEW is 'thread'
|
||||
g.THREADID = +pathname[3]
|
||||
|
||||
|
||||
@ -165,12 +165,12 @@ Navigate =
|
||||
return
|
||||
|
||||
$.addClass Index.button, 'fa-spin'
|
||||
Index.clearSearch() if Index.isSearching
|
||||
|
||||
[_, boardID, view, threadID] = @pathname.split '/'
|
||||
|
||||
return if 'f' in [boardID, g.BOARD.ID]
|
||||
e.preventDefault() if e
|
||||
Index.clearSearch() if Index.isSearching
|
||||
Navigate.title = -> return
|
||||
|
||||
delete Index.pageNum
|
||||
@ -183,7 +183,7 @@ Navigate =
|
||||
view = 'index' # path is "/boardID/". See the problem?
|
||||
|
||||
path = @pathname
|
||||
path += @hash if @hash
|
||||
path += @hash if @hash and view is 'thread'
|
||||
|
||||
history.pushState null, '', path unless @id is 'popState'
|
||||
Navigate.path = @pathname
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user