Fix catalog link, fix Index on catalog.

It should have never ran on catalog, honestly.
This commit is contained in:
Zixaphir 2014-01-12 19:21:21 -07:00
parent 678e4d1116
commit 2c6a26ca89
4 changed files with 21 additions and 18 deletions

View File

@ -2155,7 +2155,7 @@
Index = {
init: function() {
var anchorEntry, input, label, modeEntry, name, refNavEntry, repliesEntry, sortEntry, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
if (g.BOARD.ID === 'f') {
if (g.BOARD.ID === 'f' || g.VIEW === 'catalog') {
return;
}
this.button = $.el('a', {
@ -2290,6 +2290,9 @@
$.on(this.searchInput, 'input', this.onSearchInput);
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
$.on($('#returnlink', this.navLinks), 'click', Navigate.navigate);
$.on($('#cataloglink', this.navLinks), 'click', function() {
return window.location = "//boards.4chan.org/" + g.BOARD + "/catalog";
});
if (g.VIEW === 'index') {
this.update();
}
@ -12102,13 +12105,13 @@
if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) {
return;
}
if (e) {
e.preventDefault();
}
path = this.pathname;
if (this.hash) {
path += this.hash;
}
if (e) {
e.preventDefault();
}
if (this.id !== 'popState') {
history.pushState(null, '', path);
}

View File

@ -2165,7 +2165,7 @@
Index = {
init: function() {
var anchorEntry, input, label, modeEntry, name, refNavEntry, repliesEntry, sortEntry, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
if (g.BOARD.ID === 'f') {
if (g.BOARD.ID === 'f' || g.VIEW === 'catalog') {
return;
}
this.button = $.el('a', {
@ -2300,6 +2300,9 @@
$.on(this.searchInput, 'input', this.onSearchInput);
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
$.on($('#returnlink', this.navLinks), 'click', Navigate.navigate);
$.on($('#cataloglink', this.navLinks), 'click', function() {
return window.location = "//boards.4chan.org/" + g.BOARD + "/catalog";
});
if (g.VIEW === 'index') {
this.update();
}
@ -12091,13 +12094,13 @@
if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) {
return;
}
if (e) {
e.preventDefault();
}
path = this.pathname;
if (this.hash) {
path += this.hash;
}
if (e) {
e.preventDefault();
}
if (this.id !== 'popState') {
history.pushState(null, '', path);
}

View File

@ -1,6 +1,6 @@
Index =
init: ->
return if g.BOARD.ID is 'f'
return if g.BOARD.ID is 'f' or g.VIEW is 'catalog'
@button = $.el 'a',
className: 'index-refresh-shortcut fa fa-refresh'
@ -83,7 +83,10 @@ Index =
$.on @pagelist, 'click', @cb.pageNav
$.on @searchInput, 'input', @onSearchInput
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
$.on $('#returnlink', @navLinks), 'click', Navigate.navigate
$.on $('#returnlink', @navLinks), 'click', Navigate.navigate
$.on $('#cataloglink', @navLinks), 'click', ->
window.location = "//boards.4chan.org/#{g.BOARD}/catalog"
@update() if g.VIEW is 'index'
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->

View File

@ -4,8 +4,7 @@ Navigate =
return if g.VIEW is 'catalog' or g.BOARD.ID is 'f'
# blink/webkit throw a popstate on page load. Not what we want.
$.ready ->
$.on window, 'popstate', Navigate.popstate
$.ready -> $.on window, 'popstate', Navigate.popstate
Thread.callbacks.push
name: 'Navigate'
@ -27,10 +26,8 @@ Navigate =
$.on postlink, 'click', Navigate.navigate
return unless Conf['Quote Hash Navigation']
for hashlink in $$ '.hashlink', @nodes.comment
$.on hashlink, 'click', Navigate.navigate
return
clean: ->
@ -79,9 +76,7 @@ Navigate =
errors.push
message: "Failed to reconnect feature #{name}."
error: err
Main.handleErrors errors if errors
return
ready: (name, feature, condition) ->
@ -92,7 +87,6 @@ Navigate =
message: "Quote Threading Failed."
error: err
]
Main.handleErrors error if error
QR.generatePostableThreadsList()
@ -188,11 +182,11 @@ Navigate =
[boardID, view, threadID] = path
return if view is 'catalog' or 'f' in [boardID, g.BOARD.ID]
e.preventDefault() if e
path = @pathname
path += @hash if @hash
e.preventDefault() if e
history.pushState null, '', path unless @id is 'popState'
Navigate.path = @pathname