function onEndShowScripts(Action $action)
 {
     $action->inlineScript('var infinite_scroll_on_next_only = ' . ($this->on_next_only ? 'true' : 'false') . ';');
     $action->inlineScript('var ajax_loader_url = "' . $this->path('ajax-loader.gif') . '";');
     $action->script($this->path('jquery.infinitescroll.js'));
     $action->script($this->path('infinitescroll.js'));
 }
 function onEndShowScripts(Action $action)
 {
     if ($this->isSocial()) {
         $action->script($this->path('js/jquery.details.min.js'));
         $action->script($this->path('js/ol.js'));
         $action->script($this->path('js/chartist.min.js'));
         $action->script($this->path('js/sa.js'));
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Load JS at runtime if we're logged in.
  *
  * @param Action $action
  * @return boolean hook result
  */
 function onEndShowScripts($action)
 {
     $user = common_current_user();
     if ($user) {
         $action->script($this->path('modplus.js'));
     }
     return true;
 }
 /**
  * Link in a JavaScript script for the whitelist invite form
  *
  * @param Action $action Action being shown
  *
  * @return boolean hook flag
  */
 function onEndShowStatusNetScripts($action)
 {
     $name = $action->arg('action');
     if ($name == 'invite') {
         $action->script($this->getPath() . '/js/whitelistinvite.js');
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * Load JS at runtime if we're logged in.
  *
  * @param Action $action
  * @return boolean hook result
  */
 function onEndShowScripts($action)
 {
     $user = common_current_user();
     if ($user && common_config('attachments', 'process_links')) {
         $action->script($this->path('linkpreview.min.js'));
         $data = json_encode(array('api' => common_local_url('oembedproxy'), 'width' => common_config('attachments', 'thumbwidth'), 'height' => common_config('attachments', 'thumbheight')));
         $action->inlineScript('$(function() {SN.Init.LinkPreview && SN.Init.LinkPreview(' . $data . ');})');
     }
     return true;
 }
 /**
  * Hook for adding extra JavaScript
  *
  * This makes sure our scripts get loaded for map-related pages
  *
  * @param Action $action Action object for the page
  *
  * @return boolean event handler return
  */
 function onEndShowScripts($action)
 {
     $actionName = $action->trimmed('action');
     if (!in_array($actionName, array('showstream', 'all', 'usermap', 'allmap'))) {
         return true;
     }
     switch ($this->provider) {
         case 'cloudmade':
             $action->script('http://tile.cloudmade.com/wml/0.2/web-maps-lite.js');
             break;
         case 'google':
             $action->script(sprintf('http://maps.google.com/maps?file=api&v=2&sensor=false&key=%s', urlencode($this->apikey)));
             break;
         case 'microsoft':
             $action->script((GNUsocial::isHTTPS() ? 'https' : 'http') + '://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6');
             break;
         case 'openlayers':
             // Use our included stripped & minified OpenLayers.
             $action->script($this->path('OpenLayers/OpenLayers.js'));
             break;
         case 'yahoo':
             $action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s', urlencode($this->apikey)));
             break;
         case 'geocommons':
             // don't support this yet
         // don't support this yet
         default:
             return true;
     }
     $action->script(sprintf('%s?(%s)', $this->path('js/mxn.js'), $this->provider));
     $action->script($this->path('usermap.js'));
     $action->inlineScript(sprintf('var _provider = "%s";', $this->provider));
     // usermap and allmap handle this themselves
     if (in_array($actionName, array('showstream', 'all'))) {
         $action->inlineScript('$(document).ready(function() { ' . ' var user = null; ' . ($actionName == 'showstream' ? ' user = scrapeUser(); ' : '') . ' var notices = scrapeNotices(user); ' . ' var canvas = $("#map_canvas")[0]; ' . ' if (typeof(canvas) != "undefined") { showMapstraction(canvas, notices); } ' . '});');
     }
     return true;
 }
Exemplo n.º 7
0
 /**
  * Output the bits of JavaScript code to show Adsense
  *
  * @param Action  $action Action being shown
  * @param integer $width  Width of the block
  * @param integer $height Height of the block
  * @param string  $slot   Slot identifier
  *
  * @return void
  */
 protected function showAdsenseCode($action, $width, $height, $slot)
 {
     $code = 'google_ad_client = "' . $this->client . '"; ';
     $code .= 'google_ad_slot = "' . $slot . '"; ';
     $code .= 'google_ad_width = ' . $width . '; ';
     $code .= 'google_ad_height = ' . $height . '; ';
     $action->inlineScript($code);
     $action->script($this->adScript);
 }
 /**
  * adds javascript to do same thing on input textarea
  *
  * @param Action $action
  */
 function onEndShowScripts($action)
 {
     if (common_logged_in()) {
         $action->script('plugins/DirectionDetector/jquery.DirectionDetector.js');
     }
 }
Exemplo n.º 9
0
 /**
  * Load JS at runtime.
  *
  * @param Action $action
  * @return boolean hook result
  */
 function onEndShowScripts(Action $action)
 {
     $action->script($this->path('js/modplus.js'));
     return true;
 }
Exemplo n.º 10
0
 /**
  * adds javascript to do same thing on input textarea
  *
  * @param Action $action
  */
 function onEndShowScripts($action)
 {
     if (common_logged_in()) {
         $action->script($this->path('jquery.DirectionDetector.js'));
     }
 }
Exemplo n.º 11
0
 /**
  * Hook for adding extra JavaScript
  *
  * This makes sure our scripts get loaded for map-related pages
  *
  * @param Action $action Action object for the page
  *
  * @return boolean event handler return
  */
 function onEndShowScripts($action)
 {
     $actionName = $action->trimmed('action');
     if (!in_array($actionName, array('showstream', 'all', 'usermap', 'allmap'))) {
         return true;
     }
     switch ($this->provider) {
         case 'cloudmade':
             $action->script('http://tile.cloudmade.com/wml/0.2/web-maps-lite.js');
             break;
         case 'google':
             $action->script(sprintf('http://maps.google.com/maps?file=api&v=2&sensor=false&key=%s', urlencode($this->apikey)));
             break;
         case 'microsoft':
             $action->script('http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6');
             break;
         case 'openlayers':
             // XXX: is this not nice...?
             $action->script('http://openlayers.org/api/OpenLayers.js');
             break;
         case 'yahoo':
             $action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s', urlencode($this->apikey)));
             break;
         case 'geocommons':
             // don't support this yet
         // don't support this yet
         default:
             return true;
     }
     $action->script(sprintf('%s?(%s)', common_path('plugins/Mapstraction/js/mxn.js'), $this->provider));
     $action->script(common_path('plugins/Mapstraction/usermap.js'));
     $action->inlineScript(sprintf('var _provider = "%s";', $this->provider));
     // usermap and allmap handle this themselves
     if (in_array($actionName, array('showstream', 'all'))) {
         $action->inlineScript('$(document).ready(function() { ' . ' var user = null; ' . ($actionName == 'showstream' ? ' user = scrapeUser(); ' : '') . ' var notices = scrapeNotices(user); ' . ' showMapstraction($("#map_canvas"), notices); ' . '});');
     }
     return true;
 }