]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Realtime/realtimeupdate.js
Merge branch '0.8.x' of git://gitorious.org/~brion/statusnet/brion-fixes into 0.8.x
[quix0rs-gnu-social.git] / plugins / Realtime / realtimeupdate.js
index b2c8bb56d665bd583ccd1d472e5cd9b1976b3f25..a31565177fe3f1b04646de996f92904fd0dcbc9b 100644 (file)
@@ -10,10 +10,10 @@ RealtimeUpdate = {
 
      init: function(userid, replyurl, favorurl, deleteurl)
      {
-          RealtimeUpdate._userid = userid;
-          RealtimeUpdate._replyurl = replyurl;
-          RealtimeUpdate._favorurl = favorurl;
-          RealtimeUpdate._deleteurl = deleteurl;
+        RealtimeUpdate._userid = userid;
+        RealtimeUpdate._replyurl = replyurl;
+        RealtimeUpdate._favorurl = favorurl;
+        RealtimeUpdate._deleteurl = deleteurl;
      },
 
      receive: function(data)
@@ -21,7 +21,7 @@ RealtimeUpdate = {
           id = data.id;
 
           // Don't add it if it already exists
-
+          //
           if ($("#notice-"+id).length > 0) {
                return;
           }
@@ -55,14 +55,14 @@ RealtimeUpdate = {
                "</a> "+
                "<span class=\"source\">"+
                "from "+
-               "<span class=\"device\">+source+</span>"+ // may have a link
+                "<span class=\"device\">"+source+"</span>"+ // may have a link
                "</span>";
           if (data['in_reply_to_status_id']) {
                ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>";
           }
 
           ni = ni+"</div>"+
-               "<div class=\"notice-options\">";
+            "<div class=\"notice-options\">";
 
           if (RealtimeUpdate._userid != 0) {
                var input = $("form#form_notice fieldset input#token");
@@ -84,12 +84,12 @@ RealtimeUpdate = {
           var ff;
 
           ff = "<form id=\"favor-"+id+"\" class=\"form_favor\" method=\"post\" action=\""+RealtimeUpdate._favorurl+"\">"+
-               "<fieldset>"+
+                "<fieldset>"+
                "<legend>Favor this notice</legend>"+
                "<input name=\"token-"+id+"\" type=\"hidden\" id=\"token-"+id+"\" value=\""+session_key+"\"/>"+
                "<input name=\"notice\" type=\"hidden\" id=\"notice-n"+id+"\" value=\""+id+"\"/>"+
                "<input type=\"submit\" id=\"favor-submit-"+id+"\" name=\"favor-submit-"+id+"\" class=\"submit\" value=\"Favor\" title=\"Favor this notice\"/>"+
-               "</fieldset>"+
+                "</fieldset>"+
                "</form>";
           return ff;
      },
@@ -99,7 +99,7 @@ RealtimeUpdate = {
           var rl;
           rl = "<a class=\"notice_reply\" href=\""+RealtimeUpdate._replyurl+"?replyto="+nickname+"\" title=\"Reply to this notice\">Reply <span class=\"notice_id\">"+id+"</span></a>";
           return rl;
-     },
+        },
 
      makeDeleteLink: function(id)
      {
@@ -110,4 +110,38 @@ RealtimeUpdate = {
 
           return dl;
      },
+
+     addPopup: function(url, timeline, iconurl)
+     {
+         $('#content').prepend('<button id="realtime_timeline" title="Realtime window">Realtime</button>');
+         $('#realtime_timeline').css({
+             'margin':'0 0 18px 0',
+             'background':'transparent url('+ iconurl + ') no-repeat 0% 30%',
+             'padding':'0 0 0 20px',
+             'display':'block',
+             'float':'right',
+             'border':'none',
+             'cursor':'pointer',
+             'color':$("a").css("color"),
+             'font-weight':'bold',
+             'font-size':'1em'
+         });
+         $('#realtime_timeline').click(function() {
+             window.open(url,
+                         timeline,
+                         'toolbar=no,resizable=yes,scrollbars=yes,status=yes');
+             return false;
+         });
+     },
+
+     initPopupWindow: function()
+     {
+         window.resizeTo(575, 640);
+         $('address').hide();
+         $('#content').css({'width':'92%'});
+     }
 }
+