Merge branch 'v1.12'

This commit is contained in:
ccd0 2016-06-13 01:55:03 -07:00
commit ae3debe09d
10 changed files with 26 additions and 107 deletions

View File

@ -6,12 +6,6 @@ ImageCommon =
$.off video, 'volumechange', Volume.change $.off video, 'volumechange', Volume.change
video.muted = true video.muted = true
rewind: (el) ->
if el.nodeName is 'VIDEO'
el.currentTime = 0 if el.readyState >= el.HAVE_METADATA
else if /\.gif$/.test el.src
$.queueTask -> el.src = el.src
pushCache: (el) -> pushCache: (el) ->
ImageCommon.cache = el ImageCommon.cache = el
$.on el, 'error', ImageCommon.cacheError $.on el, 'error', ImageCommon.cacheError

View File

@ -146,7 +146,6 @@ ImageExpand =
ImageCommon.pause el ImageCommon.pause el
for eventName, cb of ImageExpand.videoCB for eventName, cb of ImageExpand.videoCB
$.off el, eventName, cb $.off el, eventName, cb
ImageCommon.rewind file.thumb if Conf['Restart when Opened']
delete file.fullImage delete file.fullImage
$.queueTask -> $.queueTask ->
# XXX Work around Chrome/Chromium not firing mouseover on the thumbnail. # XXX Work around Chrome/Chromium not firing mouseover on the thumbnail.
@ -169,7 +168,6 @@ ImageExpand =
else if ImageCommon.cache?.dataset.fullID is post.fullID else if ImageCommon.cache?.dataset.fullID is post.fullID
el = file.fullImage = ImageCommon.popCache() el = file.fullImage = ImageCommon.popCache()
$.on el, 'error', ImageExpand.error $.on el, 'error', ImageExpand.error
ImageCommon.rewind el if Conf['Restart when Opened'] and el.id isnt 'ihover'
el.removeAttribute 'id' el.removeAttribute 'id'
else else
el = file.fullImage = $.el (if isVideo then 'video' else 'img') el = file.fullImage = $.el (if isVideo then 'video' else 'img')

View File

@ -34,9 +34,6 @@ ImageHover =
$.on el, 'error', error $.on el, 'error', error
el.src = file.url el.src = file.url
if Conf['Restart when Opened']
ImageCommon.rewind el
ImageCommon.rewind @
el.id = 'ihover' el.id = 'ihover'
$.add Header.hover, el $.add Header.hover, el
if isVideo if isVideo

View File

@ -87,20 +87,6 @@ Banner =
for event in ['click', 'keydown', 'blur'] for event in ['click', 'keydown', 'blur']
$.on child, event, Banner.cb[event] $.on child, event, Banner.cb[event]
# XXX Migrate old settings.
string = "#{g.BOARD}.#{className}"
string2 = "#{string}.orig"
items = {}
items[string] = ''
items[string2] = child.textContent
$.get items, (items) ->
if items[string]
Banner.db.set
boardID: g.BOARD.ID
threadID: className
val: {title: items[string], orig: items[string2]}
$.delete [string, string2]
if data = Banner.db.get {boardID: g.BOARD.ID, threadID: className} if data = Banner.db.get {boardID: g.BOARD.ID, threadID: className}
if Conf['Persistent Custom Board Titles'] or data.orig is child.textContent if Conf['Persistent Custom Board Titles'] or data.orig is child.textContent
Banner.original[className] = child.cloneNode true Banner.original[className] = child.cloneNode true

View File

@ -131,15 +131,12 @@ Unread =
openNotification: (post) -> openNotification: (post) ->
return unless Header.areNotificationsEnabled return unless Header.areNotificationsEnabled
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey)
try
notif = new Notification "#{post.info.nameBlock} replied to you", notif = new Notification "#{post.info.nameBlock} replied to you",
body: post.info.commentDisplay body: post.info.commentDisplay
icon: Favicon.logo icon: Favicon.logo
notif.onclick = -> notif.onclick = ->
Header.scrollToIfNeeded post.nodes.root, true Header.scrollToIfNeeded post.nodes.root, true
# XXX https://github.com/derjanb/tampermonkey/issues/253 window.focus()
$.global -> window.focus()
notif.onshow = -> notif.onshow = ->
setTimeout -> setTimeout ->
notif.close() notif.close()

View File

@ -206,13 +206,10 @@ QR =
unless Header.areNotificationsEnabled unless Header.areNotificationsEnabled
alert el.textContent if d.hidden and not QR.cooldown.auto alert el.textContent if d.hidden and not QR.cooldown.auto
else if d.hidden or not (focusOverride or d.hasFocus()) else if d.hidden or not (focusOverride or d.hasFocus())
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey)
try
notif = new Notification el.textContent, notif = new Notification el.textContent,
body: el.textContent body: el.textContent
icon: Favicon.logo icon: Favicon.logo
# XXX https://github.com/derjanb/tampermonkey/issues/253 notif.onclick = -> window.focus()
notif.onclick = -> $.global -> window.focus()
if $.engine isnt 'gecko' if $.engine isnt 'gecko'
# Firefox automatically closes notifications # Firefox automatically closes notifications
# so we can't control the onclose properly. # so we can't control the onclose properly.
@ -489,11 +486,6 @@ QR =
if Conf['Show New Thread Option in Threads'] if Conf['Show New Thread Option in Threads']
$.addClass QR.nodes.el, 'show-new-thread-option' $.addClass QR.nodes.el, 'show-new-thread-option'
if Conf['Show Name and Subject']
$.addClass QR.nodes.name, 'force-show'
$.addClass QR.nodes.sub, 'force-show'
QR.nodes.email.placeholder = 'E-mail'
QR.forcedAnon = !!$ 'form[name="post"] input[name="name"][type="hidden"]' QR.forcedAnon = !!$ 'form[name="post"] input[name="name"][type="hidden"]'
if QR.forcedAnon if QR.forcedAnon
$.addClass QR.nodes.el, 'forced-anon' $.addClass QR.nodes.el, 'forced-anon'

View File

@ -1,18 +0,0 @@
class ShimSet
constructor: ->
@elements = {}
@size = 0
has: (value) ->
value of @elements
add: (value) ->
return if @elements[value]
@elements[value] = true
@size++
delete: (value) ->
return unless @elements[value]
delete @elements[value]
@size--
window.Set = ShimSet unless 'Set' of window
return ShimSet

View File

@ -254,10 +254,6 @@ Config =
true true
'Videos begin playing immediately when opened.' 'Videos begin playing immediately when opened.'
] ]
'Restart when Opened': [
false
'Restart GIFs and WebMs when you hover over or expand them.'
]
'Show Controls': [ 'Show Controls': [
true true
'Show controls on videos expanded inline.' 'Show controls on videos expanded inline.'
@ -455,12 +451,6 @@ Config =
'Show the option to post a new / different thread from inside a thread.' 'Show the option to post a new / different thread from inside a thread.'
1 1
] ]
# XXX This has been migrated to Name Sync and will be removed from 4chan X in a future version.
'Show Name and Subject': [
false
'Show the classic name, email, and subject fields in the QR, even when 4chan doesn\'t use them all.'
1
]
'Show Upload Progress': [ 'Show Upload Progress': [
true true
'Track progress of file uploads as percentage in submit button.' 'Track progress of file uploads as percentage in submit button.'

View File

@ -57,12 +57,6 @@ $.ajax = do ->
if /\.json$/.test url if /\.json$/.test url
options.responseType ?= 'json' options.responseType ?= 'json'
$.extend r, options $.extend r, options
# XXX https://code.google.com/p/chromium/issues/detail?id=119256 (Maxthon is still on Chromium 30)
if options.responseType is 'json' and r.responseType isnt 'json' and delete r.response
Object.defineProperty r, 'response',
configurable: true
enumerable: true
get: -> return JSON.parse r.responseText
$.extend r.upload, upCallbacks $.extend r.upload, upCallbacks
# connection error or content blocker # connection error or content blocker
$.on r, 'error', -> c.error "4chan X failed to load: #{url}" unless r.status $.on r, 'error', -> c.error "4chan X failed to load: #{url}" unless r.status
@ -119,11 +113,6 @@ $.asap = (test, cb) ->
$.onExists = (root, selector, cb) -> $.onExists = (root, selector, cb) ->
if el = $ selector, root if el = $ selector, root
return cb el return cb el
# XXX Edge doesn't notify MutationObservers of nodes added as document loads.
if $.engine is 'edge' and d.readyState is 'loading'
$.asap (-> d.readyState isnt 'loading' or $ selector, root), ->
$.onExists root, selector, cb
return
observer = new MutationObserver -> observer = new MutationObserver ->
if el = $ selector, root if el = $ selector, root
observer.disconnect() observer.disconnect()

View File

@ -51,11 +51,6 @@ CrossOrigin =
i++ i++
else else
data = new Uint8Array xhr.response data = new Uint8Array xhr.response
if typeof xhr.responseHeaders is 'object'
# XXX https://github.com/infernoboy/JavaScript-Blocker/issues/35
contentType = xhr.responseHeaders['Content-Type']
contentDisposition = xhr.responseHeaders['Content-Disposition']
else
contentType = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)?[1] contentType = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)?[1]
contentDisposition = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)?[1] contentDisposition = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)?[1]
cb data, contentType, contentDisposition cb data, contentType, contentDisposition
@ -64,8 +59,7 @@ CrossOrigin =
onabort: -> onabort: ->
cb null cb null
if workaround if workaround
# XXX https://github.com/infernoboy/JavaScript-Blocker/issues/35 options.overrideMimeType = 'text/plain; charset=x-user-defined'
options.overrideMimeType = options.mimeType = 'text/plain; charset=x-user-defined'
else else
options.responseType = 'arraybuffer' options.responseType = 'arraybuffer'
GM_xmlhttpRequest options GM_xmlhttpRequest options