From 7698ee1fe6bd40108fbe48bb641ea99a5b8f2bef Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Mon, 5 Jul 2010 21:49:41 +0200 Subject: site-media import from lobber with flick theme --- site-media/js/jquery.webstart.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 site-media/js/jquery.webstart.js (limited to 'site-media/js/jquery.webstart.js') 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 -- cgit v1.1