Files
MeDBia/videodb/templates/elegant/js/Autocompleter.js
Malin f55c91276e feat: add videodb media index with Docker stack
- Add videodb PHP/MySQL media collection manager (Blu-ray, DVD, CD)
- Dockerfile: PHP 8.1 + Apache with GD/mysqli/exif extensions
- docker-compose.yml: app on port 6761 + MySQL 8.0 with health checks
- docker-entrypoint.sh: auto-generates config.inc.php from env vars,
  waits for MySQL, initializes DB schema idempotently
- init-db.php: CLI schema installer using app's own prefix_query() logic
- Persistent volumes for DB, cache, and cover images

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 09:49:52 +02:00

43 lines
1.4 KiB
JavaScript

/**
* Enhanced Ajax.Autocompleter with support for parameters array and custom completion code
*/
Ajax.Autocompleter2 = Class.create(Autocompleter.Base, {
initialize: function(element, update, url, options) {
this.baseInitialize(element, update, options);
this.options.asynchronous = true;
this.options.onComplete = this.onComplete.bind(this);
this.options.defaultParams = this.options.parameters || null;
this.url = url;
},
// allow parameters array
getUpdatedChoices: function() {
this.startIndicator();
var entry = encodeURIComponent(this.options.paramName) + '=' +
encodeURIComponent(this.getToken());
this.options.parameters = this.options.callback ?
this.options.callback(this.element, entry) : entry;
if(this.options.defaultParams) {
// if defaultParams is a string, keep as is and don't convert
var defaultParams = Object.isString(this.options.defaultParams) ? this.options.defaultParams : Object.toQueryString(this.options.defaultParams);
this.options.parameters += '&' + defaultParams;
}
new Ajax.Request(this.url, this.options);
},
// allow custom completion code
onComplete: function(request) {
if (this.options.updateContent) {
this.options.updateContent(request);
this.stopIndicator();
}
else this.updateChoices(request.responseText);
}
});