From 432702dd41f7820a8be94be739ce04dc84334881 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 19 May 2011 16:08:30 +0200 Subject: [PATCH 1/2] Highlight quoted post during quote preview. close #81 --- 4chan_x.js | 4 ++++ script.coffee | 3 +++ 2 files changed, 7 insertions(+) diff --git a/4chan_x.js b/4chan_x.js index e245129bc..725b0cd79 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1837,6 +1837,10 @@ qp = $('#qp'); if (el = d.getElementById(id)) { qp.innerHTML = el.innerHTML; + if (el.className === 'reply') { + el.className = 'replyhl'; + this.setAttribute('onmouseout', "document.getElementById(" + id + ").className='reply'; this.removeAttribute('onmouseout');"); + } } else { qp.innerHTML = "Loading " + id + "..."; threadID = this.pathname.split('/').pop(); diff --git a/script.coffee b/script.coffee index 9b526ddff..033ce39f6 100644 --- a/script.coffee +++ b/script.coffee @@ -1457,6 +1457,9 @@ quotePreview = qp = $ '#qp' if el = d.getElementById id qp.innerHTML = el.innerHTML + if el.className is 'reply' + el.className = 'replyhl' + @setAttribute 'onmouseout', "document.getElementById(#{id}).className='reply'; this.removeAttribute('onmouseout');" else qp.innerHTML = "Loading #{id}..." threadID = @pathname.split('/').pop() From 373f9c293902c37a0670c93ab274578226f71388 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 19 May 2011 21:15:06 +0200 Subject: [PATCH 2/2] Better highlighting. --- 4chan_x.js | 19 +++++++++++-------- script.coffee | 15 +++++++++------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 725b0cd79..9642f7ab5 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1707,6 +1707,7 @@ $.bind(link, 'mouseover', quotePreview.mouseover); $.bind(link, 'mousemove', ui.hover); $.bind(link, 'mouseout', ui.hoverend); + $.bind(link, 'mouseout', quotePreview.mouseout); } if ($.config('Quote Inline')) { $.bind(link, 'click', quoteInline.toggle); @@ -1825,10 +1826,14 @@ quote = _ref[_i]; $.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mousemove', ui.hover); - _results.push($.bind(quote, 'mouseout', ui.hoverend)); + $.bind(quote, 'mouseout', ui.hoverend); + _results.push($.bind(quote, 'mouseout', quotePreview.mouseout)); } return _results; }, + mouseout: function() { + return $.removeClass(d.getElementById(this.hash.slice(1)), 'qphl'); + }, mouseover: function(e) { var el, id, qp, req, threadID; if (!(id = this.hash.slice(1))) { @@ -1837,10 +1842,7 @@ qp = $('#qp'); if (el = d.getElementById(id)) { qp.innerHTML = el.innerHTML; - if (el.className === 'reply') { - el.className = 'replyhl'; - this.setAttribute('onmouseout', "document.getElementById(" + id + ").className='reply'; this.removeAttribute('onmouseout');"); - } + $.addClass(el, 'qphl'); } else { qp.innerHTML = "Loading " + id + "..."; threadID = this.pathname.split('/').pop(); @@ -2460,13 +2462,11 @@ }\ \ #navlinks {\ + font-size: 16px;\ position: fixed;\ top: 25px;\ right: 5px;\ }\ - #navlinks {\ - font-size: 16px;\ - }\ \ #options {\ position: fixed;\ @@ -2566,6 +2566,9 @@ #qp input {\ display: none;\ }\ + .qphl {\ + outline: 2px solid rgba(216, 94, 49, .7);\ + }\ ' }; main.init(); diff --git a/script.coffee b/script.coffee index 033ce39f6..dc17fd857 100644 --- a/script.coffee +++ b/script.coffee @@ -1374,6 +1374,7 @@ quoteBacklink = $.bind link, 'mouseover', quotePreview.mouseover $.bind link, 'mousemove', ui.hover $.bind link, 'mouseout', ui.hoverend + $.bind link, 'mouseout', quotePreview.mouseout if $.config 'Quote Inline' $.bind link, 'click', quoteInline.toggle $.before $('td > br, blockquote', el), link @@ -1452,14 +1453,15 @@ quotePreview = $.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mousemove', ui.hover $.bind quote, 'mouseout', ui.hoverend + $.bind quote, 'mouseout', quotePreview.mouseout + mouseout: -> + $.removeClass d.getElementById(@hash[1..]), 'qphl' mouseover: (e) -> return unless id = @hash[1..] qp = $ '#qp' if el = d.getElementById id qp.innerHTML = el.innerHTML - if el.className is 'reply' - el.className = 'replyhl' - @setAttribute 'onmouseout', "document.getElementById(#{id}).className='reply'; this.removeAttribute('onmouseout');" + $.addClass el, 'qphl' else qp.innerHTML = "Loading #{id}..." threadID = @pathname.split('/').pop() @@ -1923,13 +1925,11 @@ main = } #navlinks { + font-size: 16px; position: fixed; top: 25px; right: 5px; } - #navlinks { - font-size: 16px; - } #options { position: fixed; @@ -2029,6 +2029,9 @@ main = #qp input { display: none; } + .qphl { + outline: 2px solid rgba(216, 94, 49, .7); + } ' main.init()