summaryrefslogtreecommitdiff
path: root/plugins/Mapstraction/MapstractionPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Mapstraction/MapstractionPlugin.php')
-rw-r--r--plugins/Mapstraction/MapstractionPlugin.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php
index c4f9cd77d..ba7827151 100644
--- a/plugins/Mapstraction/MapstractionPlugin.php
+++ b/plugins/Mapstraction/MapstractionPlugin.php
@@ -112,6 +112,11 @@ class MapstractionPlugin extends Plugin
{
$actionName = $action->trimmed('action');
+ if (!in_array($actionName,
+ array('showstream', 'all', 'usermap', 'allmap'))) {
+ return true;
+ }
+
switch ($this->provider)
{
case 'cloudmade':
@@ -143,9 +148,20 @@ class MapstractionPlugin extends Plugin
$action->script(common_path('plugins/Mapstraction/usermap.js'));
- $action->elementStart('script', array('type' => 'text/javascript'));
- $action->raw(sprintf('var _provider = "%s";', $this->provider));
- $action->elementEnd('script');
+ $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); ' .
+ ' console.log(notices); ' .
+ ' showMapstraction($("#map_canvas"), notices); '.
+ '});');
+ }
return true;
}