Get rid of $.engine.
This commit is contained in:
parent
59df1a3e07
commit
be68f4c78a
@ -16,7 +16,6 @@ $.extend $,
|
||||
MINUTE: 1000 * 60
|
||||
HOUR : 1000 * 60 * 60
|
||||
DAY : 1000 * 60 * 60 * 24
|
||||
engine: '<% if (type === 'crx') { %>webkit<% } else if (type === 'userjs') { %>presto<% } else { %>gecko<% } %>'
|
||||
id: (id) ->
|
||||
d.getElementById id
|
||||
ready: (fc) ->
|
||||
|
||||
@ -167,7 +167,7 @@ Header =
|
||||
unless Conf['Bottom header']
|
||||
headRect = Header.toggle.getBoundingClientRect()
|
||||
top += - headRect.top - headRect.height
|
||||
(if $.engine is 'webkit' then d.body else doc).scrollTop += top
|
||||
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop += top
|
||||
toggleBarVisibility: (e) ->
|
||||
return if e.type is 'mousedown' and e.button isnt 0 # not LMB
|
||||
hide = if @nodeName is 'INPUT'
|
||||
@ -439,13 +439,14 @@ Settings =
|
||||
download: "<%= meta.name %> v#{g.VERSION}-#{now}.json"
|
||||
href: "data:application/json;base64,#{btoa unescape encodeURIComponent JSON.stringify data, null, 2}"
|
||||
target: '_blank'
|
||||
if $.engine isnt 'gecko'
|
||||
a.click()
|
||||
return
|
||||
<% if (type === 'userscript') { %>
|
||||
# XXX Firefox won't let us download automatically.
|
||||
p = $ '.imp-exp-result', Settings.dialog
|
||||
$.rmAll p
|
||||
$.add p, a
|
||||
<% } else { %>
|
||||
a.click()
|
||||
<% } %>
|
||||
import: ->
|
||||
@nextElementSibling.click()
|
||||
onImport: ->
|
||||
@ -1695,11 +1696,15 @@ DeleteLink =
|
||||
|
||||
DownloadLink =
|
||||
init: ->
|
||||
<% if (type === 'userscript') { %>
|
||||
# Firefox won't let us download cross-domain content.
|
||||
return
|
||||
<% } %>
|
||||
return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Download Link']
|
||||
|
||||
# Firefox won't let us download cross-domain content.
|
||||
# Test for download feature support.
|
||||
return if $.engine is 'gecko' or $.el('a').download is undefined
|
||||
return unless 'download' of $.el 'a'
|
||||
|
||||
a = $.el 'a',
|
||||
className: 'download-link'
|
||||
textContent: 'Download file'
|
||||
@ -3305,7 +3310,7 @@ ImageExpand =
|
||||
unless Conf['Bottom header']
|
||||
headRect = Header.toggle.getBoundingClientRect()
|
||||
top += - headRect.top - headRect.height
|
||||
root = if $.engine is 'webkit' then d.body else doc
|
||||
root = <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>
|
||||
root.scrollTop += top if rect.top < 0
|
||||
root.scrollLeft = 0 if rect.left < 0
|
||||
|
||||
@ -3347,7 +3352,7 @@ ImageExpand =
|
||||
$.addClass post.nodes.root, 'expanded-image'
|
||||
$.rmClass post.file.thumb, 'expanding'
|
||||
return unless prev.top + prev.height <= 0
|
||||
root = if $.engine is 'webkit' then d.body else doc
|
||||
root = <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>
|
||||
curr = post.nodes.root.getBoundingClientRect()
|
||||
root.scrollTop += curr.height - prev.height + curr.top - prev.top
|
||||
|
||||
@ -4206,7 +4211,7 @@ ThreadUpdater =
|
||||
$.add ThreadUpdater.root, nodes
|
||||
if scroll
|
||||
if Conf['Bottom Scroll']
|
||||
(if $.engine is 'webkit' then d.body else doc).scrollTop = d.body.clientHeight
|
||||
<% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight
|
||||
else
|
||||
Header.scrollToPost nodes[0]
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ Main =
|
||||
return unless Main.isThisPageLegit()
|
||||
# disable the mobile layout
|
||||
$('link[href*=mobile]', d.head)?.disabled = true
|
||||
$.addClass doc, $.engine
|
||||
$.addClass doc, '<% if (type === 'crx') { %>webkit<% } else if (type === 'userjs') { %>presto<% } else { %>gecko<% } %>'
|
||||
$.addClass doc, 'fourchan-x'
|
||||
$.addStyle Main.css
|
||||
|
||||
|
||||
@ -28,8 +28,9 @@ QR =
|
||||
QR.nodes.com.focus()
|
||||
Header.addShortcut sc
|
||||
|
||||
if $.engine is 'webkit'
|
||||
$.on d, 'paste', QR.paste
|
||||
<% if (type === 'crx') { %>
|
||||
$.on d, 'paste', QR.paste
|
||||
<% } %>
|
||||
$.on d, 'dragover', QR.dragOver
|
||||
$.on d, 'drop', QR.dropFile
|
||||
$.on d, 'dragstart dragend', QR.drag
|
||||
@ -781,7 +782,10 @@ QR =
|
||||
# Add empty mimeType to avoid errors with URLs selected in Window's file dialog.
|
||||
QR.mimeTypes.push ''
|
||||
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value
|
||||
nodes.fileInput.accept = "text/*, #{mimeTypes}" if $.engine isnt 'presto' # Opera's accept attribute is fucked up
|
||||
<% if (type !== 'userjs') { %>
|
||||
# Opera's accept attribute is fucked up
|
||||
nodes.fileInput.accept = "text/*, #{mimeTypes}"
|
||||
<% } %>
|
||||
|
||||
QR.spoiler = !!$ 'input[name=spoiler]'
|
||||
nodes.spoiler.hidden = !QR.spoiler
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user