Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/phuix/PHUIXAutocomplete.js
Show First 20 Lines • Show All 629 Lines • ▼ Show 20 Lines | _autocomplete: function() { | ||||
return false; | return false; | ||||
} | } | ||||
ref = result.autocomplete; | ref = result.autocomplete; | ||||
if (!ref || !ref.length) { | if (!ref || !ref.length) { | ||||
return false; | return false; | ||||
} | } | ||||
// If this is an emoji with variants, pick a random variant. | |||||
if (this._getSpec().emoji) { | |||||
var variants = ref.split(' '); | |||||
ref = variants[Math.floor(Math.random() * variants.length)]; | |||||
} | |||||
// If the user types a string like "@username:" (with a trailing colon), | // If the user types a string like "@username:" (with a trailing colon), | ||||
// then presses tab or return to pick the completion, don't destroy the | // then presses tab or return to pick the completion, don't destroy the | ||||
// trailing character. | // trailing character. | ||||
var suffixes = this._getSuffixes(); | var suffixes = this._getSuffixes(); | ||||
var value = this._value; | var value = this._value; | ||||
var found_suffix = false; | var found_suffix = false; | ||||
for (var ii = 0; ii < suffixes.length; ii++) { | for (var ii = 0; ii < suffixes.length; ii++) { | ||||
var last = value.substring(value.length - suffixes[ii].length); | var last = value.substring(value.length - suffixes[ii].length); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |