From 153248b48230a342648577480e36224eaee85535 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 14:39:59 -0400 Subject: Added the Autocomplete plugin --- plugins/Autocomplete/AutocompletePlugin.php | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/Autocomplete/AutocompletePlugin.php (limited to 'plugins/Autocomplete/AutocompletePlugin.php') diff --git a/plugins/Autocomplete/AutocompletePlugin.php b/plugins/Autocomplete/AutocompletePlugin.php new file mode 100644 index 000000000..ddb0dea32 --- /dev/null +++ b/plugins/Autocomplete/AutocompletePlugin.php @@ -0,0 +1,58 @@ +. + * + * @category Plugin + * @package Laconica + * @author Craig Andrews + * @copyright 2009 Craig Andrews http://candrews.integralblue.com + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +class AutocompletePlugin extends Plugin +{ + function __construct() + { + parent::__construct(); + } + + function onEndShowScripts($action){ + $js_string = << +var current_user = { screen_name: 'CANDREWS', id: '1' }; + +EOT; + $action->raw($js_string); + $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); + $action->script('plugins/Autocomplete/Autocomplete.js'); + } + + function onEndShowLaconicaStyles($action) + { + $action->cssLink('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.css'); + } + +} +?> -- cgit v1.2.3-54-g00ecf From 380c48662673d64214e64766f38014c6057d3142 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 15:19:33 -0400 Subject: I had my user info hardcoded... oops. --- plugins/Autocomplete/AutocompletePlugin.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'plugins/Autocomplete/AutocompletePlugin.php') diff --git a/plugins/Autocomplete/AutocompletePlugin.php b/plugins/Autocomplete/AutocompletePlugin.php index ddb0dea32..58b6a84ca 100644 --- a/plugins/Autocomplete/AutocompletePlugin.php +++ b/plugins/Autocomplete/AutocompletePlugin.php @@ -39,19 +39,24 @@ class AutocompletePlugin extends Plugin } function onEndShowScripts($action){ - $js_string = << -var current_user = { screen_name: 'CANDREWS', id: '1' }; +var current_user = { id: '$current_user->id' }; EOT; - $action->raw($js_string); - $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); - $action->script('plugins/Autocomplete/Autocomplete.js'); + $action->raw($js_string); + $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); + $action->script('plugins/Autocomplete/Autocomplete.js'); + } } function onEndShowLaconicaStyles($action) { - $action->cssLink('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.css'); + if (common_logged_in()) { + $action->cssLink('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.css'); + } } } -- cgit v1.2.3-54-g00ecf