Remove some accidental cruft left from incorrectly merging

Fix some QR bugs, remove references to the 'catalog' g.VIEW
And actually put in QuoteMarkers
This commit is contained in:
Zixaphir 2014-03-02 18:59:35 -07:00
parent 19800bd0d9
commit a4ead91d65
11 changed files with 42 additions and 551 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.4.1 - 2014-03-01
* 4chan X - Version 1.4.1 - 2014-03-02
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -304,9 +304,7 @@ Main =
['Quote Inlining', QuoteInline]
['Quote Previewing', QuotePreview]
['Quote Backlinks', QuoteBacklink]
['Mark Quotes of You', QuoteYou]
['Mark OP Quotes', QuoteOP]
['Mark Cross-thread Quotes', QuoteCT]
['Quote Markers', QuoteMarkers]
['Anonymize', Anonymize]
['Time Formatting', Time]
['Relative Post Dates', RelativeDates]

View File

@ -889,7 +889,7 @@ span.hide-announcement {
:root.hide-original-post-form #postForm,
:root.hide-original-post-form .postingMode,
:root.hide-original-post-form #togglePostForm,
#qr.autohide:not(.has-focus):not(:hover) > form,
#qr.autohide:not(.focus):not(:hover) > form,
.thread #qr select[data-name=thread],
#file-n-submit:not(.has-file) #qr-filerm {
display: none;

View File

@ -1,6 +1,5 @@
ImageLoader =
init: ->
return if g.VIEW is 'catalog'
return unless Conf["Image Prefetching"] or Conf["Replace JPG"] or Conf["Replace PNG"] or Conf["Replace GIF"]
Post.callbacks.push

View File

@ -1,24 +1,6 @@
Linkify =
init: ->
return if g.VIEW is 'catalog' or not Conf['Linkify']
@regString = ///(
# http, magnet, ftp, etc
(https?|mailto|git|magnet|ftp|irc):(
[a-z\d%/]
)
|
# This should account for virtually all links posted without http:
[-a-z\d]+[.](
aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|[a-z]{2}
)(/|(?!.))
|
# IPv4 Addresses
[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}
|
# E-mails
[-\w\d.@]+@[a-z\d.-]+\.[a-z\d]
)///i
return if !Conf['Linkify']
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
@ -94,6 +76,24 @@ Linkify =
return
regString: ///(
# http, magnet, ftp, etc
(https?|mailto|git|magnet|ftp|irc):(
[a-z\d%/]
)
|
# This should account for virtually all links posted without http:
[-a-z\d]+[.](
aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|[a-z]{2}
)(/|(?!.))
|
# IPv4 Addresses
[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}
|
# E-mails
[-\w\d.@]+@[a-z\d.-]+\.[a-z\d]
)///i
makeRange: (startNode, endNode, startOffset, endOffset) ->
range = document.createRange();
range.setStart startNode, startOffset

View File

@ -14,6 +14,7 @@ QR =
textContent: 'QR'
title: 'Quick Reply'
href: 'javascript:;'
$.on sc, 'click', ->
if Conf['Persistent QR'] or !QR.nodes or QR.nodes.el.hidden
$.event 'CloseMenu'
@ -31,12 +32,6 @@ QR =
$.ready @initReady
if Conf['Persistent QR']
unless g.BOARD.ID is 'f' and g.VIEW is 'index'
$.on d, '4chanXInitFinished', @persist
else
$.ready @persist
Post.callbacks.push
name: 'Quick Reply'
cb: @node
@ -72,9 +67,6 @@ QR =
$.on d, 'drop', QR.dropFile
$.on d, 'dragstart dragend', QR.drag
{
catalog: ->
QR.open() if Conf["Persistent QR"]
QR.hide() if Conf['Auto Hide QR']
index: ->
$.on d, 'IndexRefresh', QR.generatePostableThreadsList
thread: ->
@ -83,7 +75,7 @@ QR =
return unless Conf['Persistent QR']
QR.open()
QR.hide() if Conf['Auto-Hide QR'] or g.VIEW is 'index' and Conf['Index Mode'] is 'catalog'
QR.hide() if Conf['Auto-Hide QR']
statusCheck: ->
if g.DEAD
@ -99,7 +91,7 @@ QR =
persist: ->
return unless QR.postingIsEnabled
QR.open()
QR.hide() if Conf['Auto Hide QR'] or g.VIEW is 'catalog'
QR.hide() if Conf['Auto Hide QR']
open: ->
if QR.nodes
@ -113,6 +105,7 @@ QR =
Main.handleErrors
message: 'Quick Reply dialog creation crashed.'
error: err
close: ->
if QR.req
QR.abort()

View File

@ -1,25 +0,0 @@
QuoteCT =
init: ->
return if g.VIEW is 'catalog' or !Conf['Mark Cross-thread Quotes']
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
# \u00A0 is nbsp
@text = '\u00A0(Cross-thread)'
Post.callbacks.push
name: 'Mark Cross-thread Quotes'
cb: @node
node: ->
# Stop there if it's a clone of a post in the same thread.
return if @isClone and @thread is @context.thread
{board, thread} = if @isClone then @context else @
for quotelink in @nodes.quotelinks
{boardID, threadID} = Get.postDataFromLink quotelink
continue unless threadID # deadlink
if @isClone
quotelink.textContent = quotelink.textContent.replace QuoteCT.text, ''
if boardID is board.ID and threadID isnt thread.ID
$.add quotelink, $.tn QuoteCT.text
return

View File

@ -1,36 +0,0 @@
QuoteOP =
init: ->
return if g.VIEW is 'catalog' or !Conf['Mark OP Quotes']
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
# \u00A0 is nbsp
@text = '\u00A0(OP)'
Post.callbacks.push
name: 'Mark OP Quotes'
cb: @node
node: ->
# Stop there if it's a clone of a post in the same thread.
return if @isClone and @thread is @context.thread
# Stop there if there's no quotes in that post.
return unless (quotes = @quotes).length
{quotelinks} = @nodes
# rm (OP) from cross-thread quotes.
if @isClone and @thread.fullID in quotes
i = 0
while quotelink = quotelinks[i++]
quotelink.textContent = quotelink.textContent.replace QuoteOP.text, ''
{fullID} = (if @isClone then @context else @).thread
# add (OP) to quotes quoting this context's OP.
return unless fullID in quotes
i = 0
while quotelink = quotelinks[i++]
{boardID, postID} = Get.postDataFromLink quotelink
if "#{boardID}.#{postID}" is fullID
$.add quotelink, $.tn QuoteOP.text
return

View File

@ -1,64 +0,0 @@
QuoteYou =
init: ->
return unless g.VIEW isnt 'catalog' and Conf['Mark Quotes of You'] and Conf['Quick Reply']
if Conf['Highlight Own Posts']
$.addClass doc, 'highlight-own'
if Conf['Highlight Posts Quoting You']
$.addClass doc, 'highlight-you'
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
# \u00A0 is nbsp
@text = '\u00A0(You)'
Post.callbacks.push
name: 'Mark Quotes of You'
cb: @node
node: ->
return if @isClone
if QR.db.get {boardID: @board.ID, threadID: @thread.ID, postID: @ID}
$.addClass @nodes.root, 'yourPost'
# Stop there if there's no quotes in that post.
return unless @quotes.length
for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
$.add quotelink, $.tn QuoteYou.text
$.addClass quotelink, 'you'
$.addClass @nodes.root, 'quotesYou'
return
cb:
seek: (type) ->
return unless Conf['Mark Quotes of You'] and Conf['Quick Reply']
$.rmClass highlight, 'highlight' if highlight = $ '.highlight'
unless QuoteYou.lastRead
unless post = QuoteYou.lastRead = $ '.quotesYou'
new Notice 'warning', 'No posts are currently quoting you, loser.', 20
return
return if QuoteYou.cb.scroll post
else
post = QuoteYou.lastRead
str = "#{type}::div[contains(@class,'quotesYou')]"
while post = (result = $.X(str, post)).snapshotItem(if type is 'preceding' then result.snapshotLength - 1 else 0)
return if QuoteYou.cb.scroll post
posts = $$ '.quotesYou'
QuoteYou.cb.scroll posts[if type is 'following' then 0 else posts.length - 1]
scroll: (post) ->
if Get.postFromRoot(post).isHidden
return false
else
QuoteYou.lastRead = post
window.location = "##{post.id}"
Header.scrollToPost post
$.addClass $('.post', post), 'highlight'
return true