summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete/AutocompletePlugin.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-09-13 21:44:17 -0400
committerCraig Andrews <candrews@integralblue.com>2009-09-13 21:44:17 -0400
commit4a19c292fb444dca840591a5ccec960d63ab57b8 (patch)
treefc21eb71901191c8b6ff9433410fcf87bc93bcb8 /plugins/Autocomplete/AutocompletePlugin.php
parentbb48698416c1a2ae5a173eb3735c16c587a6e611 (diff)
Make a new REST service for the autocomplete plugin, significantly reducing the size of the responses. Also enables caching in the browser.
Diffstat (limited to 'plugins/Autocomplete/AutocompletePlugin.php')
-rw-r--r--plugins/Autocomplete/AutocompletePlugin.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/Autocomplete/AutocompletePlugin.php b/plugins/Autocomplete/AutocompletePlugin.php
index b75397270..baaec73c1 100644
--- a/plugins/Autocomplete/AutocompletePlugin.php
+++ b/plugins/Autocomplete/AutocompletePlugin.php
@@ -31,6 +31,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php');
+
class AutocompletePlugin extends Plugin
{
function __construct()
@@ -40,13 +42,6 @@ class AutocompletePlugin extends Plugin
function onEndShowScripts($action){
if (common_logged_in()) {
- $current_user = common_current_user();
- $js_string = <<<EOT
-<script type="text/javascript">
-var current_user = { id: '$current_user->id' };
-</script>
-EOT;
- $action->raw($js_string);
$action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js');
$action->script('plugins/Autocomplete/Autocomplete.js');
}
@@ -59,5 +54,12 @@ EOT;
}
}
+ function onRouterInitialized($m)
+ {
+ if (common_logged_in()) {
+ $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete'));
+ }
+ }
+
}
?>