X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=widgets%2Fwidgets.js;h=f7b7ac9e9aa39955cea0fcd9ae2b8175d2972dff;hb=858758e92c5d8c1c41e188284fea53ae50fb0855;hp=e6382d711d8ab403346fb16eb1ae908c3e7c40ed;hpb=255685c17698530da9e252e013c4ef1f1b048b7d;p=friendica-addons.git diff --git a/widgets/widgets.js b/widgets/widgets.js old mode 100644 new mode 100755 index e6382d71..f7b7ac9e --- 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("
"); +document.writeln(""); +document.writeln("
"); (function() { f9a_widget_$widget_id.load(); })(); -document.writeln("
"); -document.writeln(""); -document.writeln("
");