X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FAutocomplete%2FAutocompletePlugin.php;h=0d3fdfc91dceab86f73c52ff39bddd96aef8021a;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=620b5e7b06a0e5aeb5ff408ba657f905bf06ddfc;hpb=b2abae433de8ae625fc0420eb78ee74479f6e9b9;p=quix0rs-gnu-social.git diff --git a/plugins/Autocomplete/AutocompletePlugin.php b/plugins/Autocomplete/AutocompletePlugin.php index 620b5e7b06..0d3fdfc91d 100644 --- a/plugins/Autocomplete/AutocompletePlugin.php +++ b/plugins/Autocomplete/AutocompletePlugin.php @@ -39,45 +39,28 @@ class AutocompletePlugin extends Plugin parent::__construct(); } - function onAutoload($cls) - { - switch ($cls) - { - case 'AutocompleteAction': - require_once(INSTALLDIR.'/plugins/Autocomplete/autocomplete.php'); - return false; - } - } - - function onEndShowScripts($action){ + function onEndShowScripts(Action $action){ if (common_logged_in()) { - $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'); - $action->script('plugins/Autocomplete/Autocomplete.js'); + $action->element('span', array('id' => 'autocomplete-api', + 'data-url' => common_local_url('autocomplete'))); + $action->script($this->path('js/autocomplete.go.js')); } } - function onEndShowStatusNetStyles($action) + function onRouterInitialized(URLMapper $m) { - if (common_logged_in()) { - $action->cssLink('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.css'); - } - } - - function onRouterInitialized($m) - { - if (common_logged_in()) { - $m->connect('plugins/Autocomplete/autocomplete.json', array('action'=>'autocomplete')); - } + $m->connect('main/autocomplete/suggest', array('action'=>'autocomplete')); } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'Autocomplete', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Craig Andrews', 'homepage' => 'http://status.net/wiki/Plugin:Autocomplete', 'rawdescription' => - _m('The autocomplete plugin allows users to autocomplete screen names in @ replies. When an "@" is typed into the notice text area, an autocomplete box is displayed populated with the user\'s friend\' screen names.')); + // TRANS: Plugin description. + _m('The autocomplete plugin adds autocompletion for @ replies.')); return true; } }