From f6f3ea4c8d5396d01021e5aa3916b214d82cdcdf Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 26 Apr 2010 22:55:49 -0700 Subject: [PATCH] fix op auto-quote --- 4chan_x/4chan_x.coffee | 4 ++-- 4chan_x/4chan_x.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/4chan_x/4chan_x.coffee b/4chan_x/4chan_x.coffee index 44e9b1610..4c62ac52b 100644 --- a/4chan_x/4chan_x.coffee +++ b/4chan_x/4chan_x.coffee @@ -455,8 +455,8 @@ quickReply: (e) -> #xx textarea.value += '>>' + this.parentNode.id.match(/\d+$/)[0] + '\n' selection: window.getSelection() - selid: x('ancestor::td', selection.anchorNode)?.id - if selid == x('ancestor::td', this).id + id: x('preceding::span[@id][1]', selection.anchorNode)?.id + if id is this.parentNode.id if selText: selection.toString() textarea.value += ">$selText\n" textarea.focus() diff --git a/4chan_x/4chan_x.js b/4chan_x/4chan_x.js index 7e01eeb2c..46c159765 100644 --- a/4chan_x/4chan_x.js +++ b/4chan_x/4chan_x.js @@ -462,7 +462,7 @@ cursor: pointer; \ } }; quickReply = function quickReply(e) { - var _c, a, clone, div, input, qr, selText, selection, selid, textarea, xpath; + var _c, a, clone, div, input, qr, selText, selection, textarea, xpath; e.preventDefault(); if (!(qr = $('#qr'))) { qr = tag('div'); @@ -506,8 +506,8 @@ cursor: pointer; \ //xx textarea.value += '>>' + this.parentNode.id.match(/\d+$/)[0] + '\n'; selection = window.getSelection(); - selid = (_c = x('ancestor::td', selection.anchorNode)) == undefined ? undefined : _c.id; - selid === x('ancestor::td', this).id ? (selText = selection.toString()) ? textarea.value += (">" + selText + "\n") : null : null; + id = (_c = x('preceding::span[@id][1]', selection.anchorNode)) == undefined ? undefined : _c.id; + id === this.parentNode.id ? (selText = selection.toString()) ? textarea.value += (">" + selText + "\n") : null : null; return textarea.focus(); }; watch = function watch() {