Make $.open depend on the build target.
This commit is contained in:
parent
5c79d5bb4d
commit
11b51df975
13
lib/$.coffee
13
lib/$.coffee
@ -138,14 +138,13 @@ $.off = (el, events, handler) ->
|
|||||||
return
|
return
|
||||||
$.event = (event, detail, root=d) ->
|
$.event = (event, detail, root=d) ->
|
||||||
root.dispatchEvent new CustomEvent event, {bubbles: true, detail}
|
root.dispatchEvent new CustomEvent event, {bubbles: true, detail}
|
||||||
$.open = do ->
|
<% if (type === 'userscript') { %>
|
||||||
if GM_openInTab?
|
|
||||||
(URL) ->
|
|
||||||
# XXX fix GM opening file://// for protocol-less URLs.
|
# XXX fix GM opening file://// for protocol-less URLs.
|
||||||
a = $.el 'a', href: URL
|
# https://github.com/greasemonkey/greasemonkey/issues/1719
|
||||||
GM_openInTab a.href
|
$.open = (URL) -> GM_openInTab ($.el 'a', href: URL).href
|
||||||
else
|
<% } else { %>
|
||||||
(URL) -> window.open URL, '_blank'
|
$.open = (URL) -> window.open URL, '_blank'
|
||||||
|
<% } %>
|
||||||
$.debounce = (wait, fn) ->
|
$.debounce = (wait, fn) ->
|
||||||
lastCall = 0
|
lastCall = 0
|
||||||
timeout = null
|
timeout = null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user