]> git.mxchange.org Git - friendica-addons.git/blob - widgets/widgets.js
Fixed Language files to reflect plugin name
[friendica-addons.git] / widgets / widgets.js
1 /**
2  * @author Fabio Comuni
3  */
4 var f9a_widget_$widget_id = {
5         width: "$width",
6         height: "$height",
7         entrypoint : "$entrypoint",
8         key     : "$key",
9         widgetid: "$widget_id",
10         argstr: "$args",
11
12         load : function() {
13                 var args = new Array();
14                 args['k']=this.key;
15                 args['s']=window.location.href;
16                 args['a']=this.argstr;
17                 var urlencodedargs = new Array();
18                 for(k in args){ 
19                         if (typeof args[k] != 'function')
20                                 urlencodedargs.push( encodeURIComponent(k)+"="+encodeURIComponent(args[k]) );
21                  }
22                 var url = this.entrypoint + "?"+ urlencodedargs.join("&");
23
24                 console.log(this.widgetid);
25                 console.log(document.getElementById(this.widgetid));
26                 document.getElementById(this.widgetid).innerHTML = '<iframe style="border:0px; width: '+this.width+'; height:'+this.height+'" src="'+url+'"></iframe>';
27         }
28
29 };
30
31 document.writeln("<div id='$widget_id' class='f9k_widget $type'>");
32 document.writeln("<img id='$widget_id_ld' src='$loader'>");
33 document.writeln("</div>");
34 (function() {
35         f9a_widget_$widget_id.load();   
36 })();
37