]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.8.x' of git@gitorious.org:statusnet/mainline into 0.8.x
authorSarven Capadisli <csarven@status.net>
Wed, 4 Nov 2009 09:25:16 +0000 (09:25 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 4 Nov 2009 09:25:16 +0000 (09:25 +0000)
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/jquery.getUrlParam.js [deleted file]
plugins/Realtime/realtimeupdate.js

index 0f0d0f9f42309b134298220d3fc1d148e3ae2ed7..0c7c1240c3f7bb24031e7db82cdc33c7acbb8c04 100644 (file)
@@ -230,6 +230,7 @@ class RealtimePlugin extends Plugin
         }
 
         $action->showContentBlock();
+        $action->showScripts();
         $action->elementEnd('body');
         return false; // No default processing
     }
@@ -239,13 +240,13 @@ class RealtimePlugin extends Plugin
         // FIXME: this code should be abstracted to a neutral third
         // party, like Notice::asJson(). I'm not sure of the ethics
         // of refactoring from within a plugin, so I'm just abusing
-        // the TwitterApiAction method. Don't do this unless you're me!
+        // the ApiAction method. Don't do this unless you're me!
 
-        require_once(INSTALLDIR.'/lib/twitterapi.php');
+        require_once(INSTALLDIR.'/lib/api.php');
 
-        $act = new TwitterApiAction('/dev/null');
+        $act = new ApiAction('/dev/null');
 
-        $arr = $act->twitter_status_array($notice, true);
+        $arr = $act->twitterStatusArray($notice, true);
         $arr['url'] = $notice->bestUrl();
         $arr['html'] = htmlspecialchars($notice->rendered);
         $arr['source'] = htmlspecialchars($arr['source']);
diff --git a/plugins/Realtime/jquery.getUrlParam.js b/plugins/Realtime/jquery.getUrlParam.js
deleted file mode 100644 (file)
index e8f73eb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (c) 2006-2007 Mathias Bank (http://www.mathias-bank.de)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- * 
- * Version 2.1
- * 
- * Thanks to 
- * Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
- * Tom Leonard for some improvements
- * 
- */
-jQuery.fn.extend({
-/**
-* Returns get parameters.
-*
-* If the desired param does not exist, null will be returned
-*
-* To get the document params:
-* @example value = $(document).getUrlParam("paramName");
-* 
-* To get the params of a html-attribut (uses src attribute)
-* @example value = $('#imgLink').getUrlParam("paramName");
-*/ 
- getUrlParam: function(strParamName){
-         strParamName = escape(unescape(strParamName));
-         
-         var returnVal = new Array();
-         var qString = null;
-         
-         if ($(this).attr("nodeName")=="#document") {
-               //document-handler
-               
-               if (window.location.search.search(strParamName) > -1 ){
-                       
-                       qString = window.location.search.substr(1,window.location.search.length).split("&");
-               }
-                       
-         } else if ($(this).attr("src")!="undefined") {
-               
-               var strHref = $(this).attr("src")
-               if ( strHref.indexOf("?") > -1 ){
-               var strQueryString = strHref.substr(strHref.indexOf("?")+1);
-                       qString = strQueryString.split("&");
-               }
-         } else if ($(this).attr("href")!="undefined") {
-               
-               var strHref = $(this).attr("href")
-               if ( strHref.indexOf("?") > -1 ){
-               var strQueryString = strHref.substr(strHref.indexOf("?")+1);
-                       qString = strQueryString.split("&");
-               }
-         } else {
-               return null;
-         }
-               
-         
-         if (qString==null) return null;
-         
-         
-         for (var i=0;i<qString.length; i++){
-                       if (escape(unescape(qString[i].split("=")[0])) == strParamName){
-                               returnVal.push(qString[i].split("=")[1]);
-                       }
-                       
-         }
-         
-         
-         if (returnVal.length==0) return null;
-         else if (returnVal.length==1) return returnVal[0];
-         else return returnVal;
-       }
-});
\ No newline at end of file
index 4cd68a816b2bde0fc2d2a9cbeb424accd747a4fd..e82b4dbfbbab64332fe7cb798feca87a7b1d51ca 100644 (file)
@@ -1,5 +1,31 @@
-// add a notice encoded as JSON into the current timeline
-//
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2008, StatusNet, Inc.
+ *
+ * Add a notice encoded as JSON into the current timeline
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Plugin
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @copyright 2009 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://status.net/
+ */
+
 // TODO: i18n
 
 RealtimeUpdate = {
@@ -7,6 +33,7 @@ RealtimeUpdate = {
      _replyurl: '',
      _favorurl: '',
      _deleteurl: '',
+     _updatecounter: 0,
 
      init: function(userid, replyurl, favorurl, deleteurl)
      {
@@ -15,6 +42,8 @@ RealtimeUpdate = {
         RealtimeUpdate._favorurl = favorurl;
         RealtimeUpdate._deleteurl = deleteurl;
 
+        DT = document.title;
+
         $(window).blur(function() {
           $('#notices_primary .notice').css({
             'border-top-color':$('#notices_primary .notice:last').css('border-top-color'),
@@ -25,24 +54,33 @@ RealtimeUpdate = {
             'border-top-color':'#AAAAAA',
             'border-top-style':'solid'
           });
+
+          RealtimeUpdate._updatecounter = 0;
+          document.title = DT;
+
+          return false;
         });
      },
 
      receive: function(data)
      {
-          id = data.id;
-
-          // Don't add it if it already exists
-          //
-          if ($("#notice-"+id).length > 0) {
-               return;
-          }
-
-          var noticeItem = RealtimeUpdate.makeNoticeItem(data);
-          $("#notices_primary .notices").prepend(noticeItem);
-          $("#notices_primary .notice:first").css({display:"none"});
-          $("#notices_primary .notice:first").fadeIn(1000);
-          NoticeReply();
+          setTimeout(function() {
+              id = data.id;
+
+              // Don't add it if it already exists
+              if ($("#notice-"+id).length > 0) {
+                   return;
+              }
+
+              var noticeItem = RealtimeUpdate.makeNoticeItem(data);
+              $("#notices_primary .notices").prepend(noticeItem);
+              $("#notices_primary .notice:first").css({display:"none"});
+              $("#notices_primary .notice:first").fadeIn(1000);
+              NoticeReply();
+
+              RealtimeUpdate._updatecounter += 1;
+              document.title = '('+RealtimeUpdate._updatecounter+') ' + DT;
+          }, 500);
      },
 
      makeNoticeItem: function(data)
@@ -125,14 +163,17 @@ RealtimeUpdate = {
 
      addPopup: function(url, timeline, iconurl)
      {
-         $('#content').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
+         $('#notices_primary').css({'position':'relative'});
+         $('#notices_primary').prepend('<button id="realtime_timeline" title="Pop up in a window">Pop up</button>');
 
          $('#realtime_timeline').css({
-             'margin':'0 0 18px 0',
+             'margin':'0 0 11px 0',
              'background':'transparent url('+ iconurl + ') no-repeat 0% 30%',
              'padding':'0 0 0 20px',
              'display':'block',
-             'float':'right',
+             'position':'absolute',
+             'top':'-20px',
+             'right':'0',
              'border':'none',
              'cursor':'pointer',
              'color':$("a").css("color"),