From 362ca2fe63cdad8f83aa2608c3e67c34ccff3898 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Fri, 11 Mar 2011 15:27:51 +0000 Subject: [PATCH] issue 154: added attach/detach applet API functions. The applet is attached with cross-browser compatibility (object tag for IEs and embed tag for Gecko/Webkit) git-svn-id: https://beef.googlecode.com/svn/trunk@785 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/beefjs/dom.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/beefjs/dom.js b/modules/beefjs/dom.js index fe03a5509..48a00645c 100644 --- a/modules/beefjs/dom.js +++ b/modules/beefjs/dom.js @@ -148,7 +148,40 @@ beef.dom = { $j(this).attr('href', url).click(function() { return true; }); } }).length; - } + }, + + /** + * @params: {String} id: reference identifier to the applet. + * @params: {String} code: name of the class to be loaded. For example, beef.class. + * @params: {String} archive: the jar that contains the code. + * example usage in code: + * beef.dom.attachApplet('appletId', 'SuperMario3D.class', 'http://127.0.0.1:3000/ui/public/images/target.jar'); + */ + attachApplet: function(id, code, archive){ + var content = null; + if(beef.browser.isIE()){ + content = "" + + " " + + "" + + "" + + ""; + }else{ // if the hooked browser is not IE, then use the embed tag + content = "" + + "" + + ""; + } + $j('body').append(content); + }, + + /** + * @params: {String} id: reference identifier to the applet. + */ + detachApplet: function(id){ + $j('#' + id + '').detach(); + } };