diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php index 70f5ab85fe..22f791e2fc 100644 --- a/plugins/Comet/CometPlugin.php +++ b/plugins/Comet/CometPlugin.php @@ -27,12 +27,10 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; - /** * Plugin to do realtime updates using Comet * @@ -64,10 +62,10 @@ class CometPlugin extends RealtimePlugin { $scripts = parent::_getScripts(); - $ours = array('jquery.comet.js', 'cometupdate.js'); + $ours = array('js/jquery.comet.js', 'js/cometupdate.js'); foreach ($ours as $script) { - $scripts[] = 'plugins/Comet/'.$script; + $scripts[] = $this->path($script); } return $scripts; @@ -81,7 +79,7 @@ class CometPlugin extends RealtimePlugin function _connect() { - require_once INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php'; + require_once INSTALLDIR.'/plugins/Comet/extlib/Bayeux/Bayeux.class.php'; // Bayeux? Comet? Huh? These terms confuse me $this->bay = new Bayeux($this->server, $this->user, $this->password); } diff --git a/plugins/Comet/bayeux.class.inc.php b/plugins/Comet/extlib/Bayeux/Bayeux.class.php similarity index 100% rename from plugins/Comet/bayeux.class.inc.php rename to plugins/Comet/extlib/Bayeux/Bayeux.class.php diff --git a/plugins/Comet/cometupdate.js b/plugins/Comet/js/cometupdate.js similarity index 100% rename from plugins/Comet/cometupdate.js rename to plugins/Comet/js/cometupdate.js diff --git a/plugins/Comet/jquery.comet.js b/plugins/Comet/js/jquery.comet.js similarity index 100% rename from plugins/Comet/jquery.comet.js rename to plugins/Comet/js/jquery.comet.js diff --git a/plugins/LinkPreview/LinkPreviewPlugin.php b/plugins/LinkPreview/LinkPreviewPlugin.php index 301076ec94..0a1d6d0da8 100644 --- a/plugins/LinkPreview/LinkPreviewPlugin.php +++ b/plugins/LinkPreview/LinkPreviewPlugin.php @@ -52,12 +52,7 @@ class LinkPreviewPlugin extends Plugin { $user = common_current_user(); if ($user && common_config('attachments', 'process_links')) { - if (common_config('site', 'minify')) { - $js = 'linkpreview.min.js'; - } else { - $js = 'linkpreview.js'; - } - $action->script($this->path($js)); + $action->script($this->path('js/linkpreview.js')); $data = json_encode(array( 'api' => common_local_url('oembedproxy'), 'width' => common_config('attachments', 'thumbwidth'), diff --git a/plugins/LinkPreview/linkpreview.js b/plugins/LinkPreview/js/linkpreview.js similarity index 100% rename from plugins/LinkPreview/linkpreview.js rename to plugins/LinkPreview/js/linkpreview.js diff --git a/plugins/LinkPreview/linkpreview.min.js b/plugins/LinkPreview/linkpreview.min.js deleted file mode 100644 index 99af83913e..0000000000 --- a/plugins/LinkPreview/linkpreview.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var b={api:"https://noembed.com/embed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;hf.length){for(h=f.length;hg.length){for(h=g.length;h')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})(); \ No newline at end of file diff --git a/plugins/Meteor/MeteorPlugin.php b/plugins/Meteor/MeteorPlugin.php index d65fe3f0e5..b495fcddd9 100644 --- a/plugins/Meteor/MeteorPlugin.php +++ b/plugins/Meteor/MeteorPlugin.php @@ -27,12 +27,10 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; - /** * Plugin to do realtime updates using Meteor * @@ -96,7 +94,7 @@ class MeteorPlugin extends RealtimePlugin } else { $scripts[] = 'http://'.$this->webserver.(($this->webport == 80) ? '':':'.$this->webport).'/meteor.js'; } - $scripts[] = $this->path('meteorupdater.min.js'); + $scripts[] = $this->path('js/meteorupdater.js'); return $scripts; } diff --git a/plugins/Meteor/meteorupdater.js b/plugins/Meteor/js/meteorupdater.js similarity index 100% rename from plugins/Meteor/meteorupdater.js rename to plugins/Meteor/js/meteorupdater.js diff --git a/plugins/Meteor/meteorupdater.min.js b/plugins/Meteor/meteorupdater.min.js deleted file mode 100644 index 61928ab4f2..0000000000 --- a/plugins/Meteor/meteorupdater.min.js +++ /dev/null @@ -1 +0,0 @@ -var MeteorUpdater=function(){return{init:function(c,a,b){Meteor.callbacks.process=function(d){RealtimeUpdate.receive(JSON.parse(d))};Meteor.host=c;Meteor.port=a;Meteor.joinChannel(b,0);Meteor.connect()}}}(); \ No newline at end of file diff --git a/plugins/Orbited/OrbitedPlugin.php b/plugins/Orbited/OrbitedPlugin.php index 6ae394b61d..6267b38f7e 100644 --- a/plugins/Orbited/OrbitedPlugin.php +++ b/plugins/Orbited/OrbitedPlugin.php @@ -27,12 +27,10 @@ * @link http://laconi.ca/ */ -if (!defined('LACONICA')) { +if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/plugins/Realtime/RealtimePlugin.php'; - /** * Plugin to do realtime updates using Orbited + STOMP * @@ -76,9 +74,9 @@ class OrbitedPlugin extends RealtimePlugin $root = 'http://'.$server.(($port == 80) ? '':':'.$port); $scripts[] = $root.'/static/Orbited.js'; - $scripts[] = 'plugins/Orbited/orbitedextra.js'; + $scripts[] = $this->path('js/orbitedextra.js'); $scripts[] = $root.'/static/protocols/stomp/stomp.js'; - $scripts[] = 'plugins/Orbited/orbitedupdater.js'; + $scripts[] = $this->path('js/orbitedupdater.js'); return $scripts; } diff --git a/plugins/Orbited/orbitedextra.js b/plugins/Orbited/js/orbitedextra.js similarity index 100% rename from plugins/Orbited/orbitedextra.js rename to plugins/Orbited/js/orbitedextra.js diff --git a/plugins/Orbited/orbitedupdater.js b/plugins/Orbited/js/orbitedupdater.js similarity index 100% rename from plugins/Orbited/orbitedupdater.js rename to plugins/Orbited/js/orbitedupdater.js diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 958716fa76..138ed4dc7a 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -142,7 +142,7 @@ class RealtimePlugin extends Plugin public function onEndShowStylesheets(Action $action) { - $action->cssLink(Plugin::staticPath('Realtime', 'realtimeupdate.css'), + $action->cssLink($this->path('css/realtimeupdate.css'), null, 'screen, projection, tv'); return true; @@ -391,12 +391,7 @@ class RealtimePlugin extends Plugin function _getScripts() { - if (common_config('site', 'minify')) { - $js = 'realtimeupdate.min.js'; - } else { - $js = 'realtimeupdate.js'; - } - return array(Plugin::staticPath('Realtime', $js)); + return array($this->path('js/realtimeupdate.js')); } /** diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/css/realtimeupdate.css similarity index 100% rename from plugins/Realtime/realtimeupdate.css rename to plugins/Realtime/css/realtimeupdate.css diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/js/realtimeupdate.js similarity index 100% rename from plugins/Realtime/realtimeupdate.js rename to plugins/Realtime/js/realtimeupdate.js diff --git a/plugins/Realtime/realtimeupdate.min.js b/plugins/Realtime/realtimeupdate.min.js deleted file mode 100644 index ad3fb97a76..0000000000 --- a/plugins/Realtime/realtimeupdate.min.js +++ /dev/null @@ -1 +0,0 @@ -RealtimeUpdate={_userid:0,_showurl:"",_keepaliveurl:"",_closeurl:"",_updatecounter:0,_maxnotices:50,_windowhasfocus:true,_documenttitle:"",_paused:false,_queuedNotices:[],init:function(a,b){RealtimeUpdate._userid=a;RealtimeUpdate._showurl=b;RealtimeUpdate._documenttitle=document.title;$(window).bind("focus",function(){RealtimeUpdate._windowhasfocus=true;RealtimeUpdate._updatecounter=0;RealtimeUpdate.removeWindowCounter()});$(window).bind("blur",function(){$("#notices_primary .notice").removeClass("mark-top");$("#notices_primary .notice:first").addClass("mark-top");RealtimeUpdate._windowhasfocus=false;return false})},receive:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}if(RealtimeUpdate._paused===false){RealtimeUpdate.purgeLastNoticeItem();RealtimeUpdate.insertNoticeItem(a)}else{RealtimeUpdate._queuedNotices.push(a);RealtimeUpdate.updateQueuedCounter()}RealtimeUpdate.updateWindowCounter()},insertNoticeItem:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}RealtimeUpdate.makeNoticeItem(a,function(b){if(RealtimeUpdate.isNoticeVisible(a.id)){return}var c=$(b).attr("id");var d=$("#notices_primary .notices:first");var j=true;var e=d.hasClass("threaded-notices");if(e&&a.in_reply_to_status_id){var g=$("#notice-"+a.in_reply_to_status_id);if(g.length==0){}else{var h=g.closest(".notices");if(h.hasClass("threaded-replies")){g=h.closest(".notice")}d=g.find(".threaded-replies");if(d.length==0){d=$('
    ');g.append(d);SN.U.NoticeInlineReplyPlaceholder(g)}j=false}}var i=$(b);if(j){d.prepend(i)}else{var f=d.find("li.notice-reply-placeholder");if(f.length>0){i.insertBefore(f)}else{i.appendTo(d)}}i.css({display:"none"}).fadeIn(1000);SN.U.NoticeReplyTo($("#"+c));SN.U.NoticeWithAttachment($("#"+c))})},isNoticeVisible:function(a){return($("#notice-"+a).length>0)},purgeLastNoticeItem:function(){if($("#notices_primary .notice").length>RealtimeUpdate._maxnotices){$("#notices_primary .notice:last").remove()}},updateWindowCounter:function(){if(RealtimeUpdate._windowhasfocus===false){RealtimeUpdate._updatecounter+=1;document.title="("+RealtimeUpdate._updatecounter+") "+RealtimeUpdate._documenttitle}},removeWindowCounter:function(){document.title=RealtimeUpdate._documenttitle},makeNoticeItem:function(b,c){var a=RealtimeUpdate._showurl.replace("0000000000",b.id);$.get(a,{ajax:1},function(f,h,g){var e=$("li.notice:first",f);if(e.length){var d=document._importNode(e[0],true);c(d)}})},makeFavoriteForm:function(c,b){var a;a='
    Favor this notice
    ';return a},makeReplyLink:function(c,a){var b;b='Reply '+c+"";return b},makeRepeatForm:function(c,b){var a;a='
    Repeat this notice?
    ';return a},makeDeleteLink:function(c){var b,a;a=RealtimeUpdate._deleteurl.replace("0000000000",c);b='Delete';return b},initActions:function(a,c,d,b,e){$("#notices_primary").prepend('
    ');RealtimeUpdate._pluginPath=d;RealtimeUpdate._keepaliveurl=b;RealtimeUpdate._closeurl=e;$(window).unload(function(){$.ajax({type:"POST",url:RealtimeUpdate._closeurl})});setInterval(function(){$.ajax({type:"POST",url:RealtimeUpdate._keepaliveurl})},15*60*1000);RealtimeUpdate.initPlayPause();RealtimeUpdate.initAddPopup(a,c,RealtimeUpdate._pluginPath)},initPlayPause:function(){if(typeof(localStorage)=="undefined"){RealtimeUpdate.showPause()}else{if(localStorage.getItem("RealtimeUpdate_paused")==="true"){RealtimeUpdate.showPlay()}else{RealtimeUpdate.showPause()}}},showPause:function(){RealtimeUpdate.setPause(false);RealtimeUpdate.showQueuedNotices();RealtimeUpdate.addNoticesHover();$("#realtime_playpause").remove();$("#realtime_actions").prepend('
  • ');$("#realtime_pause").text(SN.msg("realtime_pause")).attr("title",SN.msg("realtime_pause_tooltip")).bind("click",function(){RealtimeUpdate.removeNoticesHover();RealtimeUpdate.showPlay();return false})},showPlay:function(){RealtimeUpdate.setPause(true);$("#realtime_playpause").remove();$("#realtime_actions").prepend('
  • ');$("#realtime_play").text(SN.msg("realtime_play")).attr("title",SN.msg("realtime_play_tooltip")).bind("click",function(){RealtimeUpdate.showPause();return false})},setPause:function(a){RealtimeUpdate._paused=a;if(typeof(localStorage)!="undefined"){localStorage.setItem("RealtimeUpdate_paused",RealtimeUpdate._paused)}},showQueuedNotices:function(){$.each(RealtimeUpdate._queuedNotices,function(a,b){RealtimeUpdate.insertNoticeItem(b)});RealtimeUpdate._queuedNotices=[];RealtimeUpdate.removeQueuedCounter()},updateQueuedCounter:function(){$("#realtime_playpause #queued_counter").html("("+RealtimeUpdate._queuedNotices.length+")")},removeQueuedCounter:function(){$("#realtime_playpause #queued_counter").empty()},addNoticesHover:function(){$("#notices_primary .notices").hover(function(){if(RealtimeUpdate._paused===false){RealtimeUpdate.showPlay()}},function(){if(RealtimeUpdate._paused===true){RealtimeUpdate.showPause()}})},removeNoticesHover:function(){$("#notices_primary .notices").unbind()},initAddPopup:function(a,b,c){$("#realtime_timeline").append('');$("#realtime_popup").text(SN.msg("realtime_popup")).attr("title",SN.msg("realtime_popup_tooltip")).bind("click",function(){window.open(a,"","toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550");return false})},initPopupWindow:function(){$(".notices .entry-title a, .notices .entry-content a").bind("click",function(){window.open(this.href,"");return false});$("#showstream .entity_profile").css({width:"69%"})}}; \ No newline at end of file