diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-05-11 17:04:41 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-05-13 09:04:43 +0200 |
commit | 55fd53ecbd45e1ef28e576edc943cf11b9326cb5 (patch) | |
tree | 013784b57626b7258964d05a5d82fd2e37d26bf2 /addon/widgets/widgets.js | |
parent | 9f05b71018c5e99e76ae5697472a5493ac01db5a (diff) | |
download | volse-hubzilla-55fd53ecbd45e1ef28e576edc943cf11b9326cb5.tar.gz volse-hubzilla-55fd53ecbd45e1ef28e576edc943cf11b9326cb5.tar.bz2 volse-hubzilla-55fd53ecbd45e1ef28e576edc943cf11b9326cb5.zip |
More work on widgets addon
Diffstat (limited to 'addon/widgets/widgets.js')
-rw-r--r-- | addon/widgets/widgets.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/addon/widgets/widgets.js b/addon/widgets/widgets.js index 7a6cdeb0a..45d36c4d7 100644 --- a/addon/widgets/widgets.js +++ b/addon/widgets/widgets.js @@ -2,10 +2,11 @@ * @author Fabio Comuni */ -var f9a_widget = { +var f9a_widget_$widget_id = { entrypoint : "$entrypoint", key : "$key", widgetid: "$widget_id", + argstr: "$args", xmlhttp : null, getXHRObj : function(){ @@ -22,6 +23,7 @@ var f9a_widget = { if (args===null) args = new Array(); args['k']=this.key; args['s']=window.location; + args['a']=this.argstr; var urlencodedargs = new Array(); for(k in args){ urlencodedargs.push( encodeURIComponent(k)+"="+encodeURIComponent(args[k]) ); } @@ -29,20 +31,21 @@ var f9a_widget = { this.xmlhttp.open("GET", url ,true); this.xmlhttp.send(); + this.xmlhttp.obj = this; this.xmlhttp.onreadystatechange=function(){ if (this.readyState==4){ if (this.status==200) { - cb(this.responseText); + cb(this.obj, this.responseText); } else { - document.getElementById(f9a_widget.widgetid).innerHTML="Error loading widget."; + document.getElementById(this.obj.widgetid).innerHTML="Error loading widget."; } } } }, - requestcb: function(responseText) { - document.getElementById(f9a_widget.widgetid).innerHTML=responseText; + requestcb: function(obj, responseText) { + document.getElementById(obj.widgetid).innerHTML=responseText; }, load : function (){ @@ -53,7 +56,7 @@ var f9a_widget = { }; (function() { - f9a_widget.load(); + f9a_widget_$widget_id.load(); })(); document.writeln("<div id='$widget_id' class='f9k_widget'>"); |