diff --git a/widgets/widget_friends.php b/widgets/widget_friends.php
index fc7d7aa9..6b1cf18c 100644
--- a/widgets/widget_friends.php
+++ b/widgets/widget_friends.php
@@ -11,6 +11,11 @@ function friends_widget_args(){
return Array();
}
+function friends_widget_size(){
+ return Array('100%','200px');
+}
+
+
function friends_widget_content(&$a, $conf){
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
@@ -23,12 +28,12 @@ function friends_widget_content(&$a, $conf){
$o = "";
$o .= "";
$o .= _abs_url(contact_block());
diff --git a/widgets/widget_like.php b/widgets/widget_like.php
index b60d2d94..649d4a76 100644
--- a/widgets/widget_like.php
+++ b/widgets/widget_like.php
@@ -11,6 +11,11 @@ function like_widget_args(){
return Array("KEY");
}
+function like_widget_size(){
+ return Array('60px','20px');
+}
+
+
function like_widget_content(&$a, $conf){
$args = explode(",",$_GET['a']);
diff --git a/widgets/widget_like.tpl b/widgets/widget_like.tpl
index e43e7a54..3c26d1da 100644
--- a/widgets/widget_like.tpl
+++ b/widgets/widget_like.tpl
@@ -1,2 +1,3 @@
+
$like
$dislike
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("
"; var_dump($a->argv); die(); if ($a->argv[2]=="cb"){ - header('Access-Control-Allow-Origin: *'); + /*header('Access-Control-Allow-Origin: *');*/ $o .= call_user_func($a->argv[1].'_widget_content',$a, $conf); } else { @@ -126,15 +130,19 @@ function widgets_content(&$a) { } - + + $widget_size = call_user_func($a->argv[1].'_widget_size'); $script = file_get_contents(dirname(__file__)."/widgets.js"); $o .= replace_macros($script, array( '$entrypoint' => $a->get_baseurl()."/widgets/".$a->argv[1]."/cb/", '$key' => $conf['key'], - '$widget_id' => 'f9a_'.$a->argv[1]."_". ceil(microtime(true)*100), + '$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6), '$loader' => $a->get_baseurl()."/images/rotator.gif", '$args' => (isset($_GET['a'])?$_GET['a']:''), + '$width' => $widget_size[0], + '$height' => $widget_size[1], + '$type' => $a->argv[1], ));