Merge branch 'v1.12'
This commit is contained in:
commit
ae3debe09d
@ -6,12 +6,6 @@ ImageCommon =
|
||||
$.off video, 'volumechange', Volume.change
|
||||
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) ->
|
||||
ImageCommon.cache = el
|
||||
$.on el, 'error', ImageCommon.cacheError
|
||||
|
||||
@ -146,7 +146,6 @@ ImageExpand =
|
||||
ImageCommon.pause el
|
||||
for eventName, cb of ImageExpand.videoCB
|
||||
$.off el, eventName, cb
|
||||
ImageCommon.rewind file.thumb if Conf['Restart when Opened']
|
||||
delete file.fullImage
|
||||
$.queueTask ->
|
||||
# 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
|
||||
el = file.fullImage = ImageCommon.popCache()
|
||||
$.on el, 'error', ImageExpand.error
|
||||
ImageCommon.rewind el if Conf['Restart when Opened'] and el.id isnt 'ihover'
|
||||
el.removeAttribute 'id'
|
||||
else
|
||||
el = file.fullImage = $.el (if isVideo then 'video' else 'img')
|
||||
|
||||
@ -34,9 +34,6 @@ ImageHover =
|
||||
$.on el, 'error', error
|
||||
el.src = file.url
|
||||
|
||||
if Conf['Restart when Opened']
|
||||
ImageCommon.rewind el
|
||||
ImageCommon.rewind @
|
||||
el.id = 'ihover'
|
||||
$.add Header.hover, el
|
||||
if isVideo
|
||||
|
||||
@ -87,20 +87,6 @@ Banner =
|
||||
for event in ['click', 'keydown', 'blur']
|
||||
$.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 Conf['Persistent Custom Board Titles'] or data.orig is child.textContent
|
||||
Banner.original[className] = child.cloneNode true
|
||||
|
||||
@ -131,19 +131,16 @@ Unread =
|
||||
|
||||
openNotification: (post) ->
|
||||
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",
|
||||
body: post.info.commentDisplay
|
||||
icon: Favicon.logo
|
||||
notif.onclick = ->
|
||||
Header.scrollToIfNeeded post.nodes.root, true
|
||||
# XXX https://github.com/derjanb/tampermonkey/issues/253
|
||||
$.global -> window.focus()
|
||||
notif.onshow = ->
|
||||
setTimeout ->
|
||||
notif.close()
|
||||
, 7 * $.SECOND
|
||||
notif = new Notification "#{post.info.nameBlock} replied to you",
|
||||
body: post.info.commentDisplay
|
||||
icon: Favicon.logo
|
||||
notif.onclick = ->
|
||||
Header.scrollToIfNeeded post.nodes.root, true
|
||||
window.focus()
|
||||
notif.onshow = ->
|
||||
setTimeout ->
|
||||
notif.close()
|
||||
, 7 * $.SECOND
|
||||
|
||||
onUpdate: (e) ->
|
||||
if !e.detail[404]
|
||||
|
||||
@ -206,22 +206,19 @@ QR =
|
||||
unless Header.areNotificationsEnabled
|
||||
alert el.textContent if d.hidden and not QR.cooldown.auto
|
||||
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,
|
||||
body: el.textContent
|
||||
icon: Favicon.logo
|
||||
# XXX https://github.com/derjanb/tampermonkey/issues/253
|
||||
notif.onclick = -> $.global -> window.focus()
|
||||
if $.engine isnt 'gecko'
|
||||
# Firefox automatically closes notifications
|
||||
# so we can't control the onclose properly.
|
||||
notif.onclose = -> notice.close()
|
||||
notif.onshow = ->
|
||||
setTimeout ->
|
||||
notif.onclose = null
|
||||
notif.close()
|
||||
, 7 * $.SECOND
|
||||
notif = new Notification el.textContent,
|
||||
body: el.textContent
|
||||
icon: Favicon.logo
|
||||
notif.onclick = -> window.focus()
|
||||
if $.engine isnt 'gecko'
|
||||
# Firefox automatically closes notifications
|
||||
# so we can't control the onclose properly.
|
||||
notif.onclose = -> notice.close()
|
||||
notif.onshow = ->
|
||||
setTimeout ->
|
||||
notif.onclose = null
|
||||
notif.close()
|
||||
, 7 * $.SECOND
|
||||
|
||||
notifications: []
|
||||
|
||||
@ -489,11 +486,6 @@ QR =
|
||||
if Conf['Show New Thread Option in Threads']
|
||||
$.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"]'
|
||||
if QR.forcedAnon
|
||||
$.addClass QR.nodes.el, 'forced-anon'
|
||||
|
||||
@ -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
|
||||
@ -254,10 +254,6 @@ Config =
|
||||
true
|
||||
'Videos begin playing immediately when opened.'
|
||||
]
|
||||
'Restart when Opened': [
|
||||
false
|
||||
'Restart GIFs and WebMs when you hover over or expand them.'
|
||||
]
|
||||
'Show Controls': [
|
||||
true
|
||||
'Show controls on videos expanded inline.'
|
||||
@ -455,12 +451,6 @@ Config =
|
||||
'Show the option to post a new / different thread from inside a thread.'
|
||||
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': [
|
||||
true
|
||||
'Track progress of file uploads as percentage in submit button.'
|
||||
|
||||
@ -57,12 +57,6 @@ $.ajax = do ->
|
||||
if /\.json$/.test url
|
||||
options.responseType ?= 'json'
|
||||
$.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
|
||||
# connection error or content blocker
|
||||
$.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) ->
|
||||
if el = $ selector, root
|
||||
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 ->
|
||||
if el = $ selector, root
|
||||
observer.disconnect()
|
||||
|
||||
@ -51,21 +51,15 @@ CrossOrigin =
|
||||
i++
|
||||
else
|
||||
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]
|
||||
contentDisposition = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)?[1]
|
||||
contentType = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)?[1]
|
||||
contentDisposition = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)?[1]
|
||||
cb data, contentType, contentDisposition
|
||||
onerror: ->
|
||||
cb null
|
||||
onabort: ->
|
||||
cb null
|
||||
if workaround
|
||||
# XXX https://github.com/infernoboy/JavaScript-Blocker/issues/35
|
||||
options.overrideMimeType = options.mimeType = 'text/plain; charset=x-user-defined'
|
||||
options.overrideMimeType = 'text/plain; charset=x-user-defined'
|
||||
else
|
||||
options.responseType = 'arraybuffer'
|
||||
GM_xmlhttpRequest options
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user