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 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? # XXX fix GM opening file://// for protocol-less URLs.
(URL) -> # https://github.com/greasemonkey/greasemonkey/issues/1719
# XXX fix GM opening file://// for protocol-less URLs. $.open = (URL) -> GM_openInTab ($.el 'a', href: URL).href
a = $.el 'a', href: URL <% } else { %>
GM_openInTab a.href $.open = (URL) -> window.open URL, '_blank'
else <% } %>
(URL) -> window.open URL, '_blank'
$.debounce = (wait, fn) -> $.debounce = (wait, fn) ->
lastCall = 0 lastCall = 0
timeout = null timeout = null