Merge branch 'v3' of https://github.com/zixaphir/appchan-x
This commit is contained in:
commit
a3da2b3cfc
450
builds/4chan-X.user.js
Executable file → Normal file
450
builds/4chan-X.user.js
Executable file → Normal file
File diff suppressed because one or more lines are too long
450
builds/crx/script.js
Executable file → Normal file
450
builds/crx/script.js
Executable file → Normal file
File diff suppressed because one or more lines are too long
@ -106,22 +106,28 @@ Linkify =
|
|||||||
makeLink: (range) ->
|
makeLink: (range) ->
|
||||||
text = range.toString()
|
text = range.toString()
|
||||||
|
|
||||||
trim = ->
|
# Clean leading brackets, >
|
||||||
range.setEnd range.endContainer, range.endOffset - 1 unless range.endOffset < 1
|
i = 0
|
||||||
text = text.slice 0, -1
|
i++ while /[(\[{<>]/.test text.charAt i
|
||||||
|
|
||||||
# Clean leading brackets
|
if i
|
||||||
if /[(\[{<]/.test text.charAt 0
|
text = text.slice i
|
||||||
text = text.slice 1
|
i-- while range.startOffset + i >= range.startContainer.data.length
|
||||||
unless range.startOffset is range.startContainer.data.length
|
|
||||||
range.setStart range.startContainer, range.startOffset + 1
|
range.setStart range.startContainer, range.startOffset + i if i
|
||||||
|
|
||||||
# Clean hanging brackets, commas, periods
|
# Clean hanging brackets, commas, periods
|
||||||
while /[)\]}>.,]/.test char = text.charAt text.length - 1
|
i = 0
|
||||||
if /[.,]/.test(char) or (text.match /[()\[\]{}<>]/g).length % 2
|
while /[)\]}>.,]/.test char = text.charAt text.length - (1 + i)
|
||||||
trim()
|
break unless /[.,]/.test(char) or (text.match /[()\[\]{}<>]/g).length % 2
|
||||||
continue
|
i++
|
||||||
break
|
|
||||||
|
if i
|
||||||
|
text = text.slice 0, -i
|
||||||
|
i-- while range.endOffset > i
|
||||||
|
|
||||||
|
if i
|
||||||
|
range.setEnd range.endContainer, range.endOffset - i
|
||||||
|
|
||||||
# This is the only piece of code left based on Anthony Lieuallen's Linkify
|
# This is the only piece of code left based on Anthony Lieuallen's Linkify
|
||||||
text =
|
text =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user