Revert upvotes.

Revert "Remove default upvote text."
This reverts commit 754a1bc1e98f89b56f0374d1483b720ca2f997d7.

Revert "Fix text insertion bug."
This reverts commit 9bb2476a2c23185a6d62a86bdaf74a0fd8aaf6c2.

Revert "Merge remote-tracking branch 'upvotes/upvotes' into bstable"
This reverts commit 8d2d4b056be75d03adb51a103737e5eb70a2dfe1, reversing
changes made to 8850ac9df623cf8c5e4fb3e1c3737086842c6aca.
This commit is contained in:
ccd0 2016-04-02 02:19:01 -07:00
parent 14a81213a1
commit a68236efa3
4 changed files with 0 additions and 117 deletions

View File

@ -576,10 +576,6 @@ Config =
false
'Thread conversations'
]
'Upvotes': [
true
'Upvote posts.'
]
imageExpansion:
'Fit width': [
@ -1020,5 +1016,3 @@ Config =
pruneReplies:
'Prune Replies': false
'Max Replies': 1000
upvoteText: ''

View File

@ -431,7 +431,6 @@ Main =
['Edit Link', QR.oekaki.menu]
['Download Link', DownloadLink]
['Archive Link', ArchiveLink]
['Upvotes', Upvotes]
['Quote Inlining', QuoteInline]
['Quote Previewing', QuotePreview]
['Quote Backlinks', QuoteBacklink]

View File

@ -1,102 +0,0 @@
Upvotes =
count: {}
text: '\u305D\u3046\u3060\u306D'
regexp: ///
(?:^>.*\n)+
(?:
i
|top
|holy
|shit
|ay*
|oh?
|omg
|god
|jesus
|christ
|fuck
|fukken
|fucking?
|\s
|[.,-]
)*
(?:
\u305D\u3046\u3060\u306D
|this(?!\ )
|\+1
|upvote(?!\ )d?
|under[\ -]?rated
|\/thread
|10\/10
|(?:lol|kek|lel|lmao)(?:'?d|[.!]?$)
|(?:ha)+[.!]?$
|saved
|nice(?!\ )
|my\ sides
)
(?=\b|\W|$)
///gmi
init: ->
return unless g.VIEW in ['thread', 'index'] and Conf['Upvotes']
Post.callbacks.push
name: 'Upvotes'
cb: @node
node: ->
return if @isFetchedQuote or @origin?.isFetchedQuote
if @isClone
@nodes.vote = $ '.upvote', @nodes.info
$.on @nodes.vote, 'click', Upvotes.vote
return
a = $.el 'a',
className: 'upvote'
href: 'javascript:;'
textContent: '+'
$.add @nodes.info, a
@nodes.vote = a
$.on a, 'click', Upvotes.vote
return unless g.VIEW is 'thread'
Upvotes.count[@fullID] = 0
quotes = {}
for context in @info.comment.match(Upvotes.regexp) or []
for quote in context.match(/>>\d+/g) or []
quotes[quote[2..]] = true
for quote of quotes
Upvotes.increment "#{g.BOARD}.#{quote}"
increment: (fullID) ->
return unless fullID of Upvotes.count
count = ++Upvotes.count[fullID]
post = g.posts[fullID]
for post in [post, post.clones...]
post.nodes.vote.textContent = "#{Upvotes.text}x#{count}"
return
vote: ->
return unless QR.postingIsEnabled
$.off QR.nodes.com, 'input', Upvotes.setText if QR.nodes
QR.quote.call @
{com} = QR.nodes
text = "#{Conf['upvoteText']}\n"
pos = com.selectionStart
Upvotes.context = com.value[...pos]
com.value = com.value[...pos] + text + com.value[pos..]
pos += text.length
com.setSelectionRange pos, pos
$.event 'input', null, com
Upvotes.post = $.id 'selected'
$.on com, 'input', Upvotes.setText
setText: ->
{context} = Upvotes
if $.id('selected') is Upvotes.post and @value[...context.length] is context
Conf['upvoteText'] = @value[context.length..].split('\n')[0]
$.set 'upvoteText', Conf['upvoteText']
else
$.off @, 'input', Upvotes.setText

View File

@ -2086,11 +2086,3 @@ grunt.file.expand('src/Linkification/icons/*.png').map(function(file) {
:root.gallery-open.fixed #header-bar:not(.autohide) #shortcuts .fa::before {
visibility: hidden;
}
/* Upvotes */
.upvote {
margin: 0 4px;
}
.post .menu-button:not(:last-of-type) {
margin-right: -4px;
}