diff --git a/4chan_x.user.js b/4chan_x.user.js index a0b6d1bd1..23ef34fec 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -919,10 +919,12 @@ }; Post.prototype.rmClone = function(index) { - var i, _i, _ref; + var clone, _i, _len, _ref; this.clones.splice(index, 1); - for (i = _i = index, _ref = this.clones.length; index <= _ref ? _i < _ref : _i > _ref; i = index <= _ref ? ++_i : --_i) { - this.clones[i].nodes.root.setAttribute('data-clone', i); + _ref = this.clones.slice(index); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + clone = _ref[_i]; + clone.nodes.root.setAttribute('data-clone', index++); } }; diff --git a/script.coffee b/script.coffee index d76499a1b..dbfc0df97 100644 --- a/script.coffee +++ b/script.coffee @@ -718,8 +718,8 @@ class Post new Clone @, context rmClone: (index) -> @clones.splice index, 1 - for i in [index...@clones.length] - @clones[i].nodes.root.setAttribute 'data-clone', i + for clone in @clones[index..] + clone.nodes.root.setAttribute 'data-clone', index++ return class Clone extends Post