diff --git a/4chan_x.user.js b/4chan_x.user.js index c8e8d5bf2..81d151886 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -20,7 +20,7 @@ // @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7 // ==/UserScript== -/* 4chan X Beta - Version 3.0.0 - 2013-03-13 +/* 4chan X Beta - Version 3.0.0 - 2013-03-14 * http://mayhemydg.github.com/4chan-x/ * * Copyright (c) 2009-2011 James Campos @@ -103,6 +103,7 @@ 'Quick Reply': [true, 'All-in-one form to reply, create threads, automate dumping and more.'], 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], 'Auto-Hide QR': [false, 'Automatically hide the quick reply when posting.'], + 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.'], 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'], 'Hide Original Post Form': [true, 'Hide the normal post form.'] @@ -1111,6 +1112,8 @@ a.textContent = "/" + board + "/ - " + a.title; } else if (m = t.match(/-text:"(.+)"$/)) { a.textContent = m[1]; + } else if (board === '@') { + $.addClass(a, 'navSmall'); } return a; } @@ -7003,7 +7006,7 @@ return QR.status(); }, response: function() { - var ban, board, err, h1, persona, post, postID, req, threadID, tmpDoc, _, _base, _ref, _ref1; + var URL, ban, board, err, h1, persona, post, postID, req, threadID, tmpDoc, _, _base, _ref, _ref1; req = QR.req; delete QR.req; post = QR.posts[0]; @@ -7068,9 +7071,16 @@ isReply: !!threadID }); if (threadID === postID) { - $.open("/" + g.BOARD + "/res/" + threadID); + URL = "/" + g.BOARD + "/res/" + threadID; } else if (g.VIEW === 'index' && !QR.cooldown.auto) { - $.open("/" + g.BOARD + "/res/" + threadID + "#p" + postID); + URL = "/" + g.BOARD + "/res/" + threadID + "#p" + postID; + } + if (URL) { + if (Conf['Open Post in New Tab']) { + $.open("/" + g.BOARD + "/res/" + threadID); + } else { + window.location = "/" + g.BOARD + "/res/" + threadID; + } } if (!(Conf['Persistent QR'] || QR.cooldown.auto)) { QR.close(); diff --git a/src/config.coffee b/src/config.coffee index acf651f39..8cc15b35f 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -47,6 +47,7 @@ Config = 'Quick Reply': [true, 'All-in-one form to reply, create threads, automate dumping and more.'] 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] 'Auto-Hide QR': [false, 'Automatically hide the quick reply when posting.'] + 'Open Post in New Tab': [true, 'Open new threads or replies to a thread from the index in a new tab.'] 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Hide Original Post Form': [true, 'Hide the normal post form.'] diff --git a/src/features.coffee b/src/features.coffee index 3de6fbd1e..6caf661e8 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -88,6 +88,8 @@ Header = a.textContent = "/#{board}/ - #{a.title}" else if m = t.match /-text:"(.+)"$/ a.textContent = m[1] + else if board is '@' + $.addClass a, 'navSmall' return a $.tn t $.add list, nodes diff --git a/src/qr.coffee b/src/qr.coffee index 650396c99..626d20a33 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -983,9 +983,14 @@ QR = isReply: !!threadID if threadID is postID # new thread - $.open "/#{g.BOARD}/res/#{threadID}" + URL = "/#{g.BOARD}/res/#{threadID}" else if g.VIEW is 'index' and !QR.cooldown.auto # posting from the index - $.open "/#{g.BOARD}/res/#{threadID}#p#{postID}" + URL = "/#{g.BOARD}/res/#{threadID}#p#{postID}" + if URL + if Conf['Open Post in New Tab'] + $.open "/#{g.BOARD}/res/#{threadID}" + else + window.location = "/#{g.BOARD}/res/#{threadID}" unless Conf['Persistent QR'] or QR.cooldown.auto QR.close()