X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=widgets%2Fwidgets.js;h=f7b7ac9e9aa39955cea0fcd9ae2b8175d2972dff;hb=14c09c1bbba1324bd03f58d6af123ba53b29070c;hp=e6382d711d8ab403346fb16eb1ae908c3e7c40ed;hpb=6b11074c7cf1aae5c139d9d649bc55da6e46b572;p=friendica-addons.git diff --git a/widgets/widgets.js b/widgets/widgets.js index e6382d71..f7b7ac9e 100644 --- a/widgets/widgets.js +++ b/widgets/widgets.js @@ -1,26 +1,16 @@ /** * @author Fabio Comuni */ - var f9a_widget_$widget_id = { + width: "$width", + height: "$height", entrypoint : "$entrypoint", key : "$key", widgetid: "$widget_id", argstr: "$args", - xmlhttp : null, - - getXHRObj : function(){ - if (window.XMLHttpRequest) { - // code for IE7+, Firefox, Chrome, Opera, Safari - this.xmlhttp = new XMLHttpRequest(); - } else { - // code for IE6, IE5 - this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - }, - - dorequest : function(args, cb) { - if (args===null) args = new Array(); + + load : function() { + var args = new Array(); args['k']=this.key; args['s']=window.location.href; args['a']=this.argstr; @@ -31,36 +21,17 @@ var f9a_widget_$widget_id = { } var url = this.entrypoint + "?"+ urlencodedargs.join("&"); - 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.obj, this.responseText); - } else { - document.getElementById(this.obj.widgetid).innerHTML="Error loading widget."; - } - } - } - - }, - - requestcb: function(obj, responseText) { - document.getElementById(obj.widgetid).innerHTML=responseText; - }, - - load : function (){ - this.getXHRObj(); - this.dorequest(null, this.requestcb); + console.log(this.widgetid); + console.log(document.getElementById(this.widgetid)); + document.getElementById(this.widgetid).innerHTML = ''; } }; +document.writeln("
"); (function() { f9a_widget_$widget_id.load(); })(); -document.writeln(" ");