Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
70 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
formatDate = (milliseconds) -> | ||
# Format date like November 23, 1984 | ||
date = new Date milliseconds | ||
"#{months[date.getMonth()]} #{date.getDate()}, #{date.getFullYear()}" | ||
|
||
buildQuickload = -> | ||
# May load beforehand if comments haven't been opened yet. In that case, make sure | ||
# this doesn't run again | ||
if $("#ableQuick").size() is 0 | ||
if settings.history.length > 0 | ||
# Set up quickload bar | ||
$ul = $ "<ul>" | ||
date = "" | ||
count = 0 | ||
|
||
for value in settings.history | ||
if count++ <= QUICKLOAD_MAX_ITEMS | ||
shortenMatch = ARTICLE_SHORTEN_REGEX.exec(value.url)[FIRST_MATCH] | ||
temp = formatDate value.timestamp | ||
|
||
unless temp is date | ||
date = temp | ||
$ul = $ul.prepend """ | ||
<li> | ||
<h4>#{date}</h4> | ||
<ul></ul> | ||
</li> | ||
""" | ||
|
||
$ul = $("li:first ul", $ul).prepend(""" | ||
<li> | ||
<a href=\"http://reason.com/#{value.url}#comment_#{value.permalink}\"> | ||
#{shortenMatch} (#{value.permalink}) | ||
</a> | ||
</li> | ||
""" | ||
).parent().parent() | ||
|
||
$quickload = $("<div id='ableQuick' class='ableBox'><h3>#{COMMENT_HISTORY}</h3></div>") | ||
.append($ul) | ||
if settings.autohideHistory | ||
$quickload.addClass("ableAutohide") | ||
.hover (-> $ul.slideDown QUICKLOAD_SPEED ), | ||
(-> $ul.slideUp QUICKLOAD_SPEED ) | ||
$("body").append $quickload | ||
class History | ||
@load: -> | ||
@items = [] | ||
chrome.extension.sendRequest method: "history", history: @serialize(), (response) => | ||
Controls.addHistory response.history if Settings.showHistory | ||
|
||
@serialize: -> | ||
href = window.location.href.replace(/\#.*$/, "") | ||
for comment in Post.comments.filter((c) -> c.isMe) | ||
{ | ||
href: href | ||
id: comment.id | ||
timestamp: comment.timestamp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters