From 163676c5a1fef91eef27fa11ed353790b2ac2c8e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 15 Mar 2013 00:08:40 +0100 Subject: [PATCH] un(Dead) quotelinks when resurrecting. #932 --- 4chan_x.user.js | 23 +++++++++++++++-------- src/main.coffee | 10 ++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e2a7f4e0c..f32e8dc51 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-14 +/* 4chan X Beta - Version 3.0.0 - 2013-03-15 * http://mayhemydg.github.com/4chan-x/ * * Copyright (c) 2009-2011 James Campos @@ -7357,7 +7357,7 @@ }; Post.prototype.resurrect = function() { - var clone, strong, _i, _len, _ref, _results; + var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1; delete this.isDead; delete this.timeOfDeath; $.rmClass(this.nodes.root, 'deleted-post'); @@ -7368,13 +7368,20 @@ $.rm(strong); } if (this.isClone) { - _ref = this.clones; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - clone = _ref[_i]; - _results.push(clone.resurrect()); + return; + } + _ref = this.clones; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + clone = _ref[_i]; + clone.resurrect(); + } + _ref1 = Get.allQuotelinksLinkingTo(this); + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + quotelink = _ref1[_j]; + if ($.hasClass(quotelink, 'deadlink')) { + quotelink.textContent = quotelink.textContent.replace('\u00A0(Dead)', ''); + $.rmClass(quotelink, 'deadlink'); } - return _results; } }; diff --git a/src/main.coffee b/src/main.coffee index 3c85dd717..efed83249 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -197,9 +197,15 @@ class Post strong.textContent = '[File deleted]' else $.rm strong + return if @isClone - for clone in @clones - clone.resurrect() + for clone in @clones + clone.resurrect() + + for quotelink in Get.allQuotelinksLinkingTo @ + if $.hasClass quotelink, 'deadlink' + quotelink.textContent = quotelink.textContent.replace '\u00A0(Dead)', '' + $.rmClass quotelink, 'deadlink' return addClone: (context) -> new Clone @, context