Merge branch 'v3'

This commit is contained in:
Zixaphir 2014-01-11 21:03:55 -07:00
commit 9a5a4cc03c
3 changed files with 80 additions and 48 deletions

View File

@ -15633,14 +15633,13 @@
};
Navigate = {
path: window.location.pathname,
init: function() {
if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') {
return;
}
({
ready: function() {
return $.on(window, 'popstate', Navigate.popstate);
}
$.ready(function() {
return $.on(window, 'popstate', Navigate.popstate);
});
Thread.callbacks.push({
name: 'Navigate',
@ -15660,12 +15659,20 @@
return $.on(replyLink, 'click', Navigate.navigate);
},
post: function() {
var postLink;
var hashlink, postlink, _i, _len, _ref;
if (g.VIEW === 'thread' && this.thread.ID === g.THREADID) {
return;
}
postLink = $('a[title="Highlight this post"]', this.nodes.info);
return $.on(postLink, 'click', Navigate.navigate);
postlink = $('a[title="Highlight this post"]', this.nodes.info);
$.on(postlink, 'click', Navigate.navigate);
if (!Conf['Quote Hash Navigation']) {
return;
}
_ref = $$('.hashlink', this.nodes.comment);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
hashlink = _ref[_i];
$.on(hashlink, 'click', Navigate.navigate);
}
},
clean: function() {
var posts, threads;
@ -15833,13 +15840,12 @@
return $('.boardTitle').textContent = d.title = "/" + board + "/ - " + title;
},
navigate: function(e) {
var boardID, hash, onload, pageNum, path, threadID, view;
var boardID, onload, pageNum, path, threadID, view;
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) {
return;
}
$.addClass(Index.button, 'fa-spin');
path = this.pathname.split('/');
hash = this.hash;
if (path[0] === '') {
path.shift();
}
@ -15847,12 +15853,17 @@
if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) {
return;
}
path = this.pathname;
if (this.hash) {
path += this.hash;
}
if (e) {
e.preventDefault();
}
if (this.id !== 'popState') {
history.pushState(null, '', this.pathname);
history.pushState(null, '', path);
}
Navigate.path = this.pathname;
if (threadID) {
view = 'thread';
} else {
@ -15871,14 +15882,10 @@
} else {
Navigate.updateBoard(boardID);
}
if (Conf['Index Mode'] === 'paged' && pageNum) {
return Index.update(pageNum);
} else {
return Index.update();
}
return Index.update(pageNum);
} else {
onload = function(e) {
return Navigate.load(e, hash);
return Navigate.load(e);
};
Navigate.req = $.ajax("//a.4cdn.org/" + boardID + "/res/" + threadID + ".json", {
onabort: onload,
@ -15956,7 +15963,8 @@
Main.callbackNodes(Thread, [thread]);
Main.callbackNodes(Post, posts);
Navigate.ready('Quote Threading', QuoteThreading.force, Conf['Quote Threading']);
return Navigate.buildThread();
Navigate.buildThread();
return Header.hashScroll.call(window);
},
buildThread: function() {
var board;
@ -15971,6 +15979,9 @@
},
popstate: function() {
var a;
if (window.location.pathname === Navigate.path) {
return;
}
a = $.el('a', {
href: window.location,
id: 'popState'

View File

@ -15629,14 +15629,13 @@
};
Navigate = {
path: window.location.pathname,
init: function() {
if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') {
return;
}
({
ready: function() {
return $.on(window, 'popstate', Navigate.popstate);
}
$.ready(function() {
return $.on(window, 'popstate', Navigate.popstate);
});
Thread.callbacks.push({
name: 'Navigate',
@ -15656,12 +15655,20 @@
return $.on(replyLink, 'click', Navigate.navigate);
},
post: function() {
var postLink;
var hashlink, postlink, _i, _len, _ref;
if (g.VIEW === 'thread' && this.thread.ID === g.THREADID) {
return;
}
postLink = $('a[title="Highlight this post"]', this.nodes.info);
return $.on(postLink, 'click', Navigate.navigate);
postlink = $('a[title="Highlight this post"]', this.nodes.info);
$.on(postlink, 'click', Navigate.navigate);
if (!Conf['Quote Hash Navigation']) {
return;
}
_ref = $$('.hashlink', this.nodes.comment);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
hashlink = _ref[_i];
$.on(hashlink, 'click', Navigate.navigate);
}
},
clean: function() {
var posts, threads;
@ -15829,13 +15836,12 @@
return $('.boardTitle').textContent = d.title = "/" + board + "/ - " + title;
},
navigate: function(e) {
var boardID, hash, onload, pageNum, path, threadID, view;
var boardID, onload, pageNum, path, threadID, view;
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) {
return;
}
$.addClass(Index.button, 'fa-spin');
path = this.pathname.split('/');
hash = this.hash;
if (path[0] === '') {
path.shift();
}
@ -15843,12 +15849,17 @@
if (view === 'catalog' || ('f' === boardID || 'f' === g.BOARD.ID)) {
return;
}
path = this.pathname;
if (this.hash) {
path += this.hash;
}
if (e) {
e.preventDefault();
}
if (this.id !== 'popState') {
history.pushState(null, '', this.pathname);
history.pushState(null, '', path);
}
Navigate.path = this.pathname;
if (threadID) {
view = 'thread';
} else {
@ -15867,14 +15878,10 @@
} else {
Navigate.updateBoard(boardID);
}
if (Conf['Index Mode'] === 'paged' && pageNum) {
return Index.update(pageNum);
} else {
return Index.update();
}
return Index.update(pageNum);
} else {
onload = function(e) {
return Navigate.load(e, hash);
return Navigate.load(e);
};
Navigate.req = $.ajax("//a.4cdn.org/" + boardID + "/res/" + threadID + ".json", {
onabort: onload,
@ -15952,7 +15959,8 @@
Main.callbackNodes(Thread, [thread]);
Main.callbackNodes(Post, posts);
Navigate.ready('Quote Threading', QuoteThreading.force, Conf['Quote Threading']);
return Navigate.buildThread();
Navigate.buildThread();
return Header.hashScroll.call(window);
},
buildThread: function() {
var board;
@ -15967,6 +15975,9 @@
},
popstate: function() {
var a;
if (window.location.pathname === Navigate.path) {
return;
}
a = $.el('a', {
href: window.location,
id: 'popState'

View File

@ -1,9 +1,10 @@
Navigate =
path: window.location.pathname
init: ->
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: ->
$.ready ->
$.on window, 'popstate', Navigate.popstate
Thread.callbacks.push
@ -22,8 +23,15 @@ Navigate =
post: ->
# We don't need to reload the thread inside the thread
return if g.VIEW is 'thread' and @thread.ID is g.THREADID
postLink = $ 'a[title="Highlight this post"]', @nodes.info
$.on postLink, 'click', Navigate.navigate
postlink = $ 'a[title="Highlight this post"]', @nodes.info
$.on postlink, 'click', Navigate.navigate
return unless Conf['Quote Hash Navigation']
for hashlink in $$ '.hashlink', @nodes.comment
$.on hashlink, 'click', Navigate.navigate
return
clean: ->
{posts, threads} = g
@ -125,7 +133,7 @@ Navigate =
error: err
]
return false
return unless board
Navigate.updateTitle board
@ -139,7 +147,7 @@ Navigate =
['ws', 'Yotsuba B New']
else
['nws', 'Yotsuba New']
$.globalEval "var style_group = '#{style[1]}'"
mainStyleSheet = $ 'link[title=switch]', d.head
@ -174,14 +182,17 @@ Navigate =
$.addClass Index.button, 'fa-spin'
path = @pathname.split '/'
hash = @hash
path.shift() if path[0] is ''
[boardID, view, threadID] = path
return if view is 'catalog' or 'f' in [boardID, g.BOARD.ID]
path = @pathname
path += @hash if @hash
e.preventDefault() if e
history.pushState null, '', @pathname unless @id is 'popState'
history.pushState null, '', path unless @id is 'popState'
Navigate.path = @pathname
if threadID
view = 'thread'
@ -201,14 +212,11 @@ Navigate =
else
Navigate.updateBoard boardID
if Conf['Index Mode'] is 'paged' and pageNum
Index.update pageNum
else
Index.update()
Index.update pageNum
# Moving from index to thread or thread to thread
else
onload = (e) -> Navigate.load e, hash
onload = (e) -> Navigate.load e
Navigate.req = $.ajax "//a.4cdn.org/#{boardID}/res/#{threadID}.json",
onabort: onload
onloadend: onload
@ -277,6 +285,7 @@ Navigate =
Navigate.ready 'Quote Threading', QuoteThreading.force, Conf['Quote Threading']
Navigate.buildThread()
Header.hashScroll.call window
buildThread: ->
board = $ '.board'
@ -288,7 +297,8 @@ Navigate =
Unread.read()
Unread.update()
popstate: ->
popstate: ->
return if window.location.pathname is Navigate.path
a = $.el 'a',
href: window.location
id: 'popState'