Kill each clones when we kill a post too.
This commit is contained in:
parent
9136d7f643
commit
5dd3cc38d0
@ -20,7 +20,7 @@
|
|||||||
// @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7
|
// @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/* 4chan X Alpha - Version 3.0.0 - 2013-02-15
|
/* 4chan X Alpha - Version 3.0.0 - 2013-02-16
|
||||||
* http://mayhemydg.github.com/4chan-x/
|
* http://mayhemydg.github.com/4chan-x/
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
@ -3364,7 +3364,7 @@
|
|||||||
var markStale, setOwnTimeout, update;
|
var markStale, setOwnTimeout, update;
|
||||||
setOwnTimeout = function(diff) {
|
setOwnTimeout = function(diff) {
|
||||||
var delay;
|
var delay;
|
||||||
delay = diff >= $.DAY ? diff % $.DAY : diff >= $.HOUR ? diff % $.HOUR : diff >= $.MINUTE ? diff % $.MINUTE : diff % $.SECOND;
|
delay = diff < $.MINUTE ? diff % $.SECOND : diff < $.HOUR ? diff % $.MINUTE : diff < $.DAY ? diff % $.HOUR : diff % $.DAY;
|
||||||
return setTimeout(markStale, delay);
|
return setTimeout(markStale, delay);
|
||||||
};
|
};
|
||||||
update = function(now) {
|
update = function(now) {
|
||||||
@ -5285,34 +5285,40 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.kill = function(img) {
|
Post.prototype.kill = function(file, now) {
|
||||||
var now, quotelink, strong, _i, _len, _ref;
|
var clone, quotelink, strong, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
now = new Date();
|
now || (now = new Date());
|
||||||
if (this.file && !this.file.isDead) {
|
if (file) {
|
||||||
this.file.isDead = true;
|
this.file.isDead = true;
|
||||||
this.file.timeOfDeath = now;
|
this.file.timeOfDeath = now;
|
||||||
$.after($('input', this.nodes.info), $.el('strong', {
|
$.addClass(this.nodes.root, 'deleted-file');
|
||||||
className: 'warning',
|
|
||||||
textContent: '[File deleted]'
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
if (img) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.isDead = true;
|
|
||||||
this.timeOfDeath = now;
|
|
||||||
$.addClass(this.nodes.root, 'dead');
|
|
||||||
if (strong = $('strong.warning', this.nodes.info)) {
|
|
||||||
strong.textContent = '[Deleted]';
|
|
||||||
} else {
|
} else {
|
||||||
$.after($('input', this.nodes.info), $.el('strong', {
|
this.isDead = true;
|
||||||
|
this.timeOfDeath = now;
|
||||||
|
$.addClass(this.nodes.root, 'deleted-post');
|
||||||
|
}
|
||||||
|
if (!(strong = $('strong.warning', this.nodes.info))) {
|
||||||
|
strong = $.el('strong', {
|
||||||
className: 'warning',
|
className: 'warning',
|
||||||
textContent: '[Deleted]'
|
textContent: '[Deleted]'
|
||||||
}));
|
});
|
||||||
|
$.after($('input', this.nodes.info), strong);
|
||||||
}
|
}
|
||||||
_ref = Get.allQuotelinksLinkingTo(this);
|
strong.textContent = file ? '[File deleted]' : '[Deleted]';
|
||||||
|
if (this.isClone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_ref = this.clones;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quotelink = _ref[_i];
|
clone = _ref[_i];
|
||||||
|
clone.kill(file, now);
|
||||||
|
}
|
||||||
|
if (file) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_ref1 = Get.allQuotelinksLinkingTo(this);
|
||||||
|
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||||
|
quotelink = _ref1[_j];
|
||||||
if ($.hasClass(quotelink, 'deadlink')) {
|
if ($.hasClass(quotelink, 'deadlink')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2079,14 +2079,14 @@ RelativeDates =
|
|||||||
# re-add `update()` to the stale list later.
|
# re-add `update()` to the stale list later.
|
||||||
setUpdate: (post) ->
|
setUpdate: (post) ->
|
||||||
setOwnTimeout = (diff) ->
|
setOwnTimeout = (diff) ->
|
||||||
delay = if diff >= $.DAY
|
delay = if diff < $.MINUTE
|
||||||
diff % $.DAY
|
|
||||||
else if diff >= $.HOUR
|
|
||||||
diff % $.HOUR
|
|
||||||
else if diff >= $.MINUTE
|
|
||||||
diff % $.MINUTE
|
|
||||||
else
|
|
||||||
diff % $.SECOND
|
diff % $.SECOND
|
||||||
|
else if diff < $.HOUR
|
||||||
|
diff % $.MINUTE
|
||||||
|
else if diff < $.DAY
|
||||||
|
diff % $.HOUR
|
||||||
|
else
|
||||||
|
diff % $.DAY
|
||||||
setTimeout markStale, delay
|
setTimeout markStale, delay
|
||||||
|
|
||||||
update = (now) ->
|
update = (now) ->
|
||||||
|
|||||||
@ -145,25 +145,29 @@ class Post
|
|||||||
g.posts["#{board}.#{@}"] = thread.posts[@] = board.posts[@] = @
|
g.posts["#{board}.#{@}"] = thread.posts[@] = board.posts[@] = @
|
||||||
@kill() if that.isArchived
|
@kill() if that.isArchived
|
||||||
|
|
||||||
kill: (img) ->
|
kill: (file, now) ->
|
||||||
now = new Date()
|
now or= new Date()
|
||||||
if @file and !@file.isDead
|
if file
|
||||||
@file.isDead = true
|
@file.isDead = true
|
||||||
@file.timeOfDeath = now
|
@file.timeOfDeath = now
|
||||||
$.after $('input', @nodes.info), $.el 'strong',
|
$.addClass @nodes.root, 'deleted-file'
|
||||||
className: 'warning'
|
|
||||||
textContent: '[File deleted]'
|
|
||||||
return if img
|
|
||||||
@isDead = true
|
|
||||||
@timeOfDeath = now
|
|
||||||
$.addClass @nodes.root, 'dead'
|
|
||||||
if strong = $ 'strong.warning', @nodes.info
|
|
||||||
strong.textContent = '[Deleted]'
|
|
||||||
else
|
else
|
||||||
$.after $('input', @nodes.info), $.el 'strong',
|
@isDead = true
|
||||||
className: 'warning'
|
@timeOfDeath = now
|
||||||
textContent: '[Deleted]'
|
$.addClass @nodes.root, 'deleted-post'
|
||||||
|
|
||||||
|
unless strong = $ 'strong.warning', @nodes.info
|
||||||
|
strong = $.el 'strong',
|
||||||
|
className: 'warning'
|
||||||
|
textContent: '[Deleted]'
|
||||||
|
$.after $('input', @nodes.info), strong
|
||||||
|
strong.textContent = if file then '[File deleted]' else '[Deleted]'
|
||||||
|
|
||||||
|
return if @isClone
|
||||||
|
for clone in @clones
|
||||||
|
clone.kill file, now
|
||||||
|
|
||||||
|
return if file
|
||||||
# Get quotelinks/backlinks to this post
|
# Get quotelinks/backlinks to this post
|
||||||
# and paint them (Dead).
|
# and paint them (Dead).
|
||||||
for quotelink in Get.allQuotelinksLinkingTo @
|
for quotelink in Get.allQuotelinksLinkingTo @
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user