summaryrefslogtreecommitdiff
path: root/site-media/js/jquery.webstart.js
diff options
context:
space:
mode:
Diffstat (limited to 'site-media/js/jquery.webstart.js')
-rw-r--r--site-media/js/jquery.webstart.js37
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