diff options
author | Leif Johansson <leifj@sunet.se> | 2010-07-05 21:49:41 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2010-07-05 21:49:41 +0200 |
commit | 7698ee1fe6bd40108fbe48bb641ea99a5b8f2bef (patch) | |
tree | bae9828fa7715a6cbe32013954fb2e8a761e9e11 /site-media/js/jquery.webstart.js | |
parent | 8f7f4ff3a35ddeacea7d5530c7dc3c296907ab67 (diff) |
site-media import from lobber with flick theme
Diffstat (limited to 'site-media/js/jquery.webstart.js')
-rw-r--r-- | site-media/js/jquery.webstart.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/site-media/js/jquery.webstart.js b/site-media/js/jquery.webstart.js new file mode 100644 index 0000000..80761c5 --- /dev/null +++ b/site-media/js/jquery.webstart.js @@ -0,0 +1,37 @@ +/* + * jQuery.webstart + * + * Written by Leif Johansson (leifj@nordu.net) + * + * Licensed under BSD + * Requires http://java.com/js/deployJava.js + */ + +String.prototype.startsWith = function(str) {return (this.match("^"+str)==str)} + +jQuery.fn.webstart = function(options) { + if (typeof(options.minVersion) == "undefined") + options.minVersion = "1.6.0"; + + this.each(function() { + var jnlp = options.jnlp; + if (!jnlp.startsWith("http")) { + var dir = location.href.substring(0,location.href.lastIndexOf('/')+1); + jnlp = dir+jnlp + } + + if (deployJava.returnPage == null) { + deployJava.returnPage = jnlp; + } + + $(this).click(function() { + if (!deployJava.isWebStartInstalled(options.minVersion)) { + if (deployJava.installLatestJRE()) { + if (deployJava.launch(jnlp)) {} + } + } else { + if (deployJava.launch(jnlp)) {} + } + }); + }); +}
\ No newline at end of file |