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