Merge branch 'v1.12'
This commit is contained in:
commit
ae3debe09d
@ -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
|
||||||
|
|||||||
@ -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')
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -131,19 +131,16 @@ Unread =
|
|||||||
|
|
||||||
openNotification: (post) ->
|
openNotification: (post) ->
|
||||||
return unless Header.areNotificationsEnabled
|
return unless Header.areNotificationsEnabled
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey)
|
notif = new Notification "#{post.info.nameBlock} replied to you",
|
||||||
try
|
body: post.info.commentDisplay
|
||||||
notif = new Notification "#{post.info.nameBlock} replied to you",
|
icon: Favicon.logo
|
||||||
body: post.info.commentDisplay
|
notif.onclick = ->
|
||||||
icon: Favicon.logo
|
Header.scrollToIfNeeded post.nodes.root, true
|
||||||
notif.onclick = ->
|
window.focus()
|
||||||
Header.scrollToIfNeeded post.nodes.root, true
|
notif.onshow = ->
|
||||||
# XXX https://github.com/derjanb/tampermonkey/issues/253
|
setTimeout ->
|
||||||
$.global -> window.focus()
|
notif.close()
|
||||||
notif.onshow = ->
|
, 7 * $.SECOND
|
||||||
setTimeout ->
|
|
||||||
notif.close()
|
|
||||||
, 7 * $.SECOND
|
|
||||||
|
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
if !e.detail[404]
|
if !e.detail[404]
|
||||||
|
|||||||
@ -206,22 +206,19 @@ 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)
|
notif = new Notification el.textContent,
|
||||||
try
|
body: el.textContent
|
||||||
notif = new Notification el.textContent,
|
icon: Favicon.logo
|
||||||
body: el.textContent
|
notif.onclick = -> window.focus()
|
||||||
icon: Favicon.logo
|
if $.engine isnt 'gecko'
|
||||||
# XXX https://github.com/derjanb/tampermonkey/issues/253
|
# Firefox automatically closes notifications
|
||||||
notif.onclick = -> $.global -> window.focus()
|
# so we can't control the onclose properly.
|
||||||
if $.engine isnt 'gecko'
|
notif.onclose = -> notice.close()
|
||||||
# Firefox automatically closes notifications
|
notif.onshow = ->
|
||||||
# so we can't control the onclose properly.
|
setTimeout ->
|
||||||
notif.onclose = -> notice.close()
|
notif.onclose = null
|
||||||
notif.onshow = ->
|
notif.close()
|
||||||
setTimeout ->
|
, 7 * $.SECOND
|
||||||
notif.onclose = null
|
|
||||||
notif.close()
|
|
||||||
, 7 * $.SECOND
|
|
||||||
|
|
||||||
notifications: []
|
notifications: []
|
||||||
|
|
||||||
@ -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'
|
||||||
|
|||||||
@ -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
|
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.'
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -51,21 +51,15 @@ CrossOrigin =
|
|||||||
i++
|
i++
|
||||||
else
|
else
|
||||||
data = new Uint8Array xhr.response
|
data = new Uint8Array xhr.response
|
||||||
if typeof xhr.responseHeaders is 'object'
|
contentType = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)?[1]
|
||||||
# XXX https://github.com/infernoboy/JavaScript-Blocker/issues/35
|
contentDisposition = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)?[1]
|
||||||
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]
|
|
||||||
cb data, contentType, contentDisposition
|
cb data, contentType, contentDisposition
|
||||||
onerror: ->
|
onerror: ->
|
||||||
cb null
|
cb null
|
||||||
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user