Merge branch 'v3'

Conflicts:
	LICENSE
	builds/appchan-x.user.js
	builds/crx/script.js
This commit is contained in:
Zixaphir 2014-03-08 16:18:59 -07:00
commit d4d4604e4a
6 changed files with 70 additions and 65 deletions

View File

@ -1,5 +1,5 @@
/*
* appchan x - Version 2.8.13 - 2014-03-07
* appchan x - Version 2.8.13 - 2014-03-08
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -24,7 +24,7 @@
// ==/UserScript==
/*
* appchan x - Version 2.8.13 - 2014-03-07
* appchan x - Version 2.8.13 - 2014-03-08
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -4757,6 +4757,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>&nbsp;<time id=\"index-last-refresh\" title=\"Last index refresh\">...</time><span id=\"hidden-label\" hidden>&nbsp;&mdash; <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);
@ -4773,12 +4774,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();
@ -4962,18 +4960,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 appchan 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;
@ -5223,7 +5225,9 @@
} else {
strong = $.el('strong');
}
a = pagesRoot.children[pageNum];
if (!(a = pagesRoot.children[pageNum])) {
return;
}
$.before(a, strong);
return $.add(strong, a);
},
@ -16375,9 +16379,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;
@ -16385,6 +16386,9 @@
if (e) {
e.preventDefault();
}
if (Index.isSearching) {
Index.clearSearch();
}
Navigate.title = function() {};
delete Index.pageNum;
$.rmAll(Header.hover);
@ -16395,7 +16399,7 @@
view = 'index';
}
path = this.pathname;
if (this.hash) {
if (this.hash && view === 'thread') {
path += this.hash;
}
if (this.id !== 'popState') {
@ -17628,8 +17632,7 @@
}
})();
if (g.VIEW === 'catalog') {
$.ready(Index.addCatalogSwitch);
return;
return $.ready(Index.catalogSwitch);
}
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* appchan x - Version 2.8.13 - 2014-03-07
* appchan x - Version 2.8.13 - 2014-03-08
*
* Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -4816,6 +4816,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>&nbsp;<time id=\"index-last-refresh\" title=\"Last index refresh\">...</time><span id=\"hidden-label\" hidden>&nbsp;&mdash; <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);
@ -4832,12 +4833,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();
@ -5021,18 +5019,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 appchan 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;
@ -5282,7 +5284,9 @@
} else {
strong = $.el('strong');
}
a = pagesRoot.children[pageNum];
if (!(a = pagesRoot.children[pageNum])) {
return;
}
$.before(a, strong);
return $.add(strong, a);
},
@ -16395,9 +16399,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;
@ -16405,6 +16406,9 @@
if (e) {
e.preventDefault();
}
if (Index.isSearching) {
Index.clearSearch();
}
Navigate.title = function() {};
delete Index.pageNum;
$.rmAll(Header.hover);
@ -16415,7 +16419,7 @@
view = 'index';
}
path = this.pathname;
if (this.hash) {
if (this.hash && view === 'thread') {
path += this.hash;
}
if (this.id !== 'popState') {
@ -17640,8 +17644,7 @@
}
})();
if (g.VIEW === 'catalog') {
$.ready(Index.addCatalogSwitch);
return;
return $.ready(Index.catalogSwitch);
}
if (g.VIEW === 'thread') {
g.THREADID = +pathname[3];

View File

@ -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

View File

@ -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]

View File

@ -158,12 +158,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
@ -176,7 +176,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