From a5463ac53ef0442632b2a7876b2e09b266c23227 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 27 Jul 2014 13:38:27 -0700 Subject: [PATCH] implement #773 --- builds/appchan-x.user.js | 5 ++++- builds/crx/script.js | 5 ++++- src/General/Header.coffee | 2 ++ src/General/Index.coffee | 2 +- src/General/Navigate.coffee | 6 +++--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 80ef6493c..cb99008b7 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -4324,6 +4324,9 @@ textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1], className: 'external' }); + if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) { + a.className += ' current'; + } return a; } board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0]; @@ -5005,7 +5008,7 @@ if (!(hash = window.location.hash)) { return false; } - if (!(match = hash.match(/s=([\w]+)/))) { + if (!(match = hash.match(/s=([\w\s\n]+)/))) { return false; } this.searchInput.value = match[1]; diff --git a/builds/crx/script.js b/builds/crx/script.js index 68f78f205..6d9865d44 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4378,6 +4378,9 @@ textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1], className: 'external' }); + if (a.hostname === 'boards.4chan.org' && a.pathname.split('/')[1] === g.BOARD.ID) { + a.className += ' current'; + } return a; } board = /^current/.test(t) ? g.BOARD.ID : t.match(/^[^-]+/)[0]; @@ -5059,7 +5062,7 @@ if (!(hash = window.location.hash)) { return false; } - if (!(match = hash.match(/s=([\w]+)/))) { + if (!(match = hash.match(/s=([\w\s\n]+)/))) { return false; } this.searchInput.value = match[1]; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 5c78c06bc..31a1a796c 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -162,6 +162,8 @@ Header = href: (t.match(/\,"(.+)"/) || [null, '+'])[1] textContent: (t.match(/-text:"(.+)"\,/) || [null, '+'])[1] className: 'external' + if a.hostname is 'boards.4chan.org' and a.pathname.split('/')[1] is g.BOARD.ID + a.className += ' current' return a board = if /^current/.test t diff --git a/src/General/Index.coffee b/src/General/Index.coffee index e9da351a9..fc74e2599 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -288,7 +288,7 @@ Index = searchTest: (init) -> return false unless hash = window.location.hash - return false unless match = hash.match /s=([\w]+)/ + return false unless match = hash.match /s=([\w\s\n]+)/ @searchInput.value = match[1] if init $.on d, '4chanXInitFinished', Index.onSearchInput diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 219571948..cb1847a6b 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -5,7 +5,7 @@ Navigate = <% if (type === 'crx') { %> # blink/webkit throw a popstate on page load. Not what we want. - popstateHack = -> + popstateHack = -> $.off window, 'popstate', popstateHack $.on window, 'popstate', Navigate.popstate @@ -189,7 +189,7 @@ Navigate = $.set 'Index Sort', Conf['Index Sort'] = Index.selectSort.value = indexSort Index.cb.sort() result = true - + return result navigate: (e) -> @@ -237,7 +237,7 @@ Navigate = if @id is 'popState' Navigate.path = window.location else - Navigate.pushState path + Navigate.pushState path Navigate.setMode @