Convert browser-dependent code to use $.engine.
This commit is contained in:
parent
8026b0a320
commit
efb896414a
@ -103,7 +103,7 @@ Settings =
|
|||||||
description = arr[1]
|
description = arr[1]
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
<%= html('<label><input type="checkbox" name="${key}">${key}</label><span class="description">: ${description}</span>') %>
|
<%= html('<label><input type="checkbox" name="${key}">${key}</label><span class="description">: ${description}</span>') %>
|
||||||
div.hidden = true if chrome? and key is 'Remember QR Size' # XXX not supported
|
div.hidden = true if $.engine isnt 'gecko' and key is 'Remember QR Size' # XXX not supported
|
||||||
input = $ 'input', div
|
input = $ 'input', div
|
||||||
$.on input, 'change', ->
|
$.on input, 'change', ->
|
||||||
@parentNode.parentNode.dataset.checked = @checked
|
@parentNode.parentNode.dataset.checked = @checked
|
||||||
|
|||||||
@ -83,7 +83,7 @@ ImageCommon =
|
|||||||
$.off video, 'mouseover', handler
|
$.off video, 'mouseover', handler
|
||||||
# Hacky workaround for Firefox forever-loading bug for very short videos
|
# Hacky workaround for Firefox forever-loading bug for very short videos
|
||||||
t = new Date().getTime()
|
t = new Date().getTime()
|
||||||
$.asap (-> chrome? or (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or new Date().getTime() >= t + 1000), ->
|
$.asap (-> $.engine isnt 'gecko' or (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or new Date().getTime() >= t + 1000), ->
|
||||||
video.controls = true
|
video.controls = true
|
||||||
$.on video, 'mouseover', handler
|
$.on video, 'mouseover', handler
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ ImageLoader =
|
|||||||
clone.file.thumb.preload = 'auto' for clone in post.clones
|
clone.file.thumb.preload = 'auto' for clone in post.clones
|
||||||
thumb.preload = 'auto'
|
thumb.preload = 'auto'
|
||||||
# XXX Cloned video elements with poster in Firefox cause momentary display of image loading icon.
|
# XXX Cloned video elements with poster in Firefox cause momentary display of image loading icon.
|
||||||
if !chrome?
|
if $.engine is 'gecko'
|
||||||
$.on thumb, 'loadeddata', -> @removeAttribute 'poster'
|
$.on thumb, 'loadeddata', -> @removeAttribute 'poster'
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -243,6 +243,5 @@ Unread =
|
|||||||
Favicon[if isDead then 'unreadDead' else 'unread']
|
Favicon[if isDead then 'unreadDead' else 'unread']
|
||||||
else
|
else
|
||||||
Favicon[if isDead then 'dead' else 'default']
|
Favicon[if isDead then 'dead' else 'default']
|
||||||
unless chrome?
|
# `favicon.href = href` doesn't work on Firefox.
|
||||||
# `favicon.href = href` doesn't work on Firefox.
|
$.add d.head, Favicon.el
|
||||||
$.add d.head, Favicon.el
|
|
||||||
|
|||||||
@ -202,7 +202,7 @@ QR =
|
|||||||
body: el.textContent
|
body: el.textContent
|
||||||
icon: Favicon.logo
|
icon: Favicon.logo
|
||||||
notif.onclick = -> window.focus()
|
notif.onclick = -> window.focus()
|
||||||
if chrome?
|
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.
|
||||||
notif.onclose = -> notice.close()
|
notif.onclose = -> notice.close()
|
||||||
@ -530,7 +530,7 @@ QR =
|
|||||||
# We don't receive blur events from captcha iframe.
|
# We don't receive blur events from captcha iframe.
|
||||||
$.on d, 'click', QR.focus
|
$.on d, 'click', QR.focus
|
||||||
|
|
||||||
unless chrome?
|
if $.engine is 'gecko'
|
||||||
nodes.pasteArea.hidden = false
|
nodes.pasteArea.hidden = false
|
||||||
new MutationObserver(QR.pasteFF).observe nodes.pasteArea, {childList: true}
|
new MutationObserver(QR.pasteFF).observe nodes.pasteArea, {childList: true}
|
||||||
|
|
||||||
@ -543,8 +543,8 @@ QR =
|
|||||||
event = if node.nodeName is 'SELECT' then 'change' else 'input'
|
event = if node.nodeName is 'SELECT' then 'change' else 'input'
|
||||||
$.on nodes[name], event, save
|
$.on nodes[name], event, save
|
||||||
|
|
||||||
# XXX Chromium treats width and height as min-width and min-height
|
# XXX Blink and WebKit treat width and height of <textarea>s as min-width and min-height
|
||||||
if !chrome? and Conf['Remember QR Size']
|
if $.engine is 'gecko' and Conf['Remember QR Size']
|
||||||
$.get 'QR Size', '', (item) ->
|
$.get 'QR Size', '', (item) ->
|
||||||
nodes.com.style.cssText = item['QR Size']
|
nodes.com.style.cssText = item['QR Size']
|
||||||
$.on nodes.com, 'mouseup', (e) ->
|
$.on nodes.com, 'mouseup', (e) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user