Time to stop being silly.
This commit is contained in:
parent
80884e2bde
commit
ce6e317c98
@ -336,15 +336,6 @@
|
||||
return this.indexOf(string) > -1;
|
||||
};
|
||||
|
||||
Array.prototype.add = function(object, position) {
|
||||
var keep;
|
||||
|
||||
keep = this.slice(position);
|
||||
this.length = position;
|
||||
this.push(object);
|
||||
return this.pushArrays(keep);
|
||||
};
|
||||
|
||||
Array.prototype.contains = function(object) {
|
||||
return this.indexOf(object) > -1;
|
||||
};
|
||||
@ -361,27 +352,6 @@
|
||||
return i;
|
||||
};
|
||||
|
||||
Array.prototype.pushArrays = function() {
|
||||
var arg, args, _i, _len;
|
||||
|
||||
args = arguments;
|
||||
for (_i = 0, _len = args.length; _i < _len; _i++) {
|
||||
arg = args[_i];
|
||||
this.push.apply(this, arg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Array.prototype.remove = function(object) {
|
||||
var index;
|
||||
|
||||
if ((index = this.indexOf(object)) > -1) {
|
||||
return this.splice(index, 1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
$ = function(selector, root) {
|
||||
if (root == null) {
|
||||
root = d.body;
|
||||
@ -3683,7 +3653,7 @@
|
||||
if (Conf['Quote Inlining']) {
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
frag.pushArrays(QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
frag.push.apply(frag, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
}
|
||||
}
|
||||
$.add(container, frag);
|
||||
@ -7992,17 +7962,28 @@
|
||||
height = doc.clientHeight;
|
||||
posts = Unread.posts;
|
||||
i = 0;
|
||||
while (post = posts[i++]) {
|
||||
while (post = posts[i]) {
|
||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||
if (bottom < height) {
|
||||
ID = post.ID;
|
||||
posts.remove(post);
|
||||
if (bottom > height) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
ID = post.ID;
|
||||
if (Conf['Quote Threading']) {
|
||||
posts.splice(i, 1);
|
||||
continue;
|
||||
} else {
|
||||
posts.splice(0, i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!ID) {
|
||||
return;
|
||||
}
|
||||
Unread.lastReadPost = ID;
|
||||
if (Unread.lastReadPost < ID || !Unread.lastReadPost) {
|
||||
Unread.lastReadPost = ID;
|
||||
}
|
||||
Unread.saveLastReadPost();
|
||||
Unread.readArray(Unread.postsQuotingYou);
|
||||
return Unread.update();
|
||||
|
||||
@ -317,15 +317,6 @@
|
||||
return this.indexOf(string) > -1;
|
||||
};
|
||||
|
||||
Array.prototype.add = function(object, position) {
|
||||
var keep;
|
||||
|
||||
keep = this.slice(position);
|
||||
this.length = position;
|
||||
this.push(object);
|
||||
return this.pushArrays(keep);
|
||||
};
|
||||
|
||||
Array.prototype.contains = function(object) {
|
||||
return this.indexOf(object) > -1;
|
||||
};
|
||||
@ -342,27 +333,6 @@
|
||||
return i;
|
||||
};
|
||||
|
||||
Array.prototype.pushArrays = function() {
|
||||
var arg, args, _i, _len;
|
||||
|
||||
args = arguments;
|
||||
for (_i = 0, _len = args.length; _i < _len; _i++) {
|
||||
arg = args[_i];
|
||||
this.push.apply(this, arg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Array.prototype.remove = function(object) {
|
||||
var index;
|
||||
|
||||
if ((index = this.indexOf(object)) > -1) {
|
||||
return this.splice(index, 1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
$ = function(selector, root) {
|
||||
if (root == null) {
|
||||
root = d.body;
|
||||
@ -3688,7 +3658,7 @@
|
||||
if (Conf['Quote Inlining']) {
|
||||
$.on(link, 'click', QuoteInline.toggle);
|
||||
if (Conf['Quote Hash Navigation']) {
|
||||
frag.pushArrays(QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
frag.push.apply(frag, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')));
|
||||
}
|
||||
}
|
||||
$.add(container, frag);
|
||||
@ -7973,17 +7943,28 @@
|
||||
height = doc.clientHeight;
|
||||
posts = Unread.posts;
|
||||
i = 0;
|
||||
while (post = posts[i++]) {
|
||||
while (post = posts[i]) {
|
||||
bottom = post.nodes.root.getBoundingClientRect().bottom;
|
||||
if (bottom < height) {
|
||||
ID = post.ID;
|
||||
posts.remove(post);
|
||||
if (bottom > height) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
ID = post.ID;
|
||||
if (Conf['Quote Threading']) {
|
||||
posts.splice(i, 1);
|
||||
continue;
|
||||
} else {
|
||||
posts.splice(0, i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!ID) {
|
||||
return;
|
||||
}
|
||||
Unread.lastReadPost = ID;
|
||||
if (Unread.lastReadPost < ID || !Unread.lastReadPost) {
|
||||
Unread.lastReadPost = ID;
|
||||
}
|
||||
Unread.saveLastReadPost();
|
||||
Unread.readArray(Unread.postsQuotingYou);
|
||||
return Unread.update();
|
||||
|
||||
@ -4,12 +4,6 @@ String::capitalize = ->
|
||||
String::contains = (string) ->
|
||||
@indexOf(string) > -1
|
||||
|
||||
Array::add = (object, position) ->
|
||||
keep = @slice position
|
||||
@length = position
|
||||
@push object
|
||||
@pushArrays keep
|
||||
|
||||
Array::contains = (object) ->
|
||||
@indexOf(object) > -1
|
||||
|
||||
@ -19,18 +13,6 @@ Array::indexOf = (object) ->
|
||||
return i if @[i] is object
|
||||
return i
|
||||
|
||||
Array::pushArrays = ->
|
||||
args = arguments
|
||||
for arg in args
|
||||
@push.apply @, arg
|
||||
return @
|
||||
|
||||
Array::remove = (object) ->
|
||||
if (index = @indexOf object) > -1
|
||||
@splice index, 1
|
||||
else
|
||||
false
|
||||
|
||||
# loosely follows the jquery api:
|
||||
# http://api.jquery.com/
|
||||
# not chainable
|
||||
|
||||
@ -121,14 +121,23 @@ Unread =
|
||||
{posts} = Unread
|
||||
i = 0
|
||||
|
||||
while post = posts[i++]
|
||||
while post = posts[i]
|
||||
{bottom} = post.nodes.root.getBoundingClientRect()
|
||||
if (bottom < height) # post is completely read
|
||||
{ID} = post
|
||||
posts.remove post
|
||||
if bottom > height # post isnt completely read
|
||||
i++
|
||||
continue
|
||||
|
||||
{ID} = post
|
||||
if Conf['Quote Threading']
|
||||
posts.splice i, 1
|
||||
continue
|
||||
else
|
||||
posts.splice 0, i
|
||||
break
|
||||
i++
|
||||
return unless ID
|
||||
|
||||
Unread.lastReadPost = ID
|
||||
Unread.lastReadPost = ID if Unread.lastReadPost < ID or !Unread.lastReadPost
|
||||
Unread.saveLastReadPost()
|
||||
Unread.readArray Unread.postsQuotingYou
|
||||
Unread.update()
|
||||
|
||||
@ -41,7 +41,7 @@ QuoteBacklink =
|
||||
$.on link, 'mouseover', QuotePreview.mouseover
|
||||
if Conf['Quote Inlining']
|
||||
$.on link, 'click', QuoteInline.toggle
|
||||
frag.pushArrays QuoteInline.qiQuote link, $.hasClass link, 'filtered' if Conf['Quote Hash Navigation']
|
||||
frag.push.apply frag, QuoteInline.qiQuote link, $.hasClass link, 'filtered' if Conf['Quote Hash Navigation']
|
||||
$.add container, frag
|
||||
return
|
||||
secondNode: ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user