Make $.open depend on the build target.

This commit is contained in:
Nicolas Stepien 2013-04-26 02:34:57 +02:00
parent 5c79d5bb4d
commit 11b51df975

View File

@ -138,14 +138,13 @@ $.off = (el, events, handler) ->
return
$.event = (event, detail, root=d) ->
root.dispatchEvent new CustomEvent event, {bubbles: true, detail}
$.open = do ->
if GM_openInTab?
(URL) ->
# XXX fix GM opening file://// for protocol-less URLs.
a = $.el 'a', href: URL
GM_openInTab a.href
else
(URL) -> window.open URL, '_blank'
<% if (type === 'userscript') { %>
# XXX fix GM opening file://// for protocol-less URLs.
# https://github.com/greasemonkey/greasemonkey/issues/1719
$.open = (URL) -> GM_openInTab ($.el 'a', href: URL).href
<% } else { %>
$.open = (URL) -> window.open URL, '_blank'
<% } %>
$.debounce = (wait, fn) ->
lastCall = 0
timeout = null