From 8ad7677eebf1c6395c9d1412d88a002b8efc6dd5 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Fri, 10 Jan 2014 14:10:18 -0700 Subject: [PATCH] Title magic? --- builds/4chan-X.user.js | 10 +++++++++- builds/crx/script.js | 10 +++++++++- src/General/Navigate.coffee | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index b3b22c039..c06671ccb 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -12046,6 +12046,9 @@ var err, notice, req; $.rmClass(Index.button, 'fa-spin'); req = Navigate.req, notice = Navigate.notice; + if (notice != null) { + notice.close(); + } delete Navigate.req; delete Navigate.notice; if (e.type === 'abort') { @@ -12070,7 +12073,7 @@ } }, parse: function(data) { - var OP, board, errors, makePost, obj, post, posts, thread, threadRoot, _i, _len; + var OP, board, comment, errors, makePost, obj, post, posts, subject, thread, threadRoot, title, _i, _len, _ref; board = g.BOARD; Navigate.threadRoot = threadRoot = Build.thread(board, OP = data.shift(), true); thread = new Thread(OP.no, board); @@ -12092,6 +12095,11 @@ } }; makePost($('.opContainer', threadRoot)); + _ref = posts[0].info, subject = _ref.subject, comment = _ref.comment; + title = "/" + g.BOARD.ID + "/ - " + (subject || comment); + if (title.length > 100) { + title = title.slice(0, 100); + } for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; post = Build.postFromObject(obj, board); diff --git a/builds/crx/script.js b/builds/crx/script.js index d191d84fc..8ce53019c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12035,6 +12035,9 @@ var err, notice, req; $.rmClass(Index.button, 'fa-spin'); req = Navigate.req, notice = Navigate.notice; + if (notice != null) { + notice.close(); + } delete Navigate.req; delete Navigate.notice; if (e.type === 'abort') { @@ -12059,7 +12062,7 @@ } }, parse: function(data) { - var OP, board, errors, makePost, obj, post, posts, thread, threadRoot, _i, _len; + var OP, board, comment, errors, makePost, obj, post, posts, subject, thread, threadRoot, title, _i, _len, _ref; board = g.BOARD; Navigate.threadRoot = threadRoot = Build.thread(board, OP = data.shift(), true); thread = new Thread(OP.no, board); @@ -12081,6 +12084,11 @@ } }; makePost($('.opContainer', threadRoot)); + _ref = posts[0].info, subject = _ref.subject, comment = _ref.comment; + title = "/" + g.BOARD.ID + "/ - " + (subject || comment); + if (title.length > 100) { + title = title.slice(0, 100); + } for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; post = Build.postFromObject(obj, board); diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 86e9290fc..9d6882540 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -195,6 +195,7 @@ Navigate = load: (e) -> $.rmClass Index.button, 'fa-spin' {req, notice} = Navigate + notice?.close() delete Navigate.req delete Navigate.notice @@ -237,6 +238,10 @@ Navigate = makePost $('.opContainer', threadRoot) + {subject, comment} = posts[0].info + title = "/#{g.BOARD.ID}/ - #{subject or comment}" + title = title[...100] if title.length > 100 + for obj in data post = Build.postFromObject obj, board makePost post