|
|
@@ -395,11 +395,14 @@ function close_slider_listener(ev) {
|
|
|
}
|
|
|
// </slider>
|
|
|
|
|
|
-// overwrites the href attribute from the url input
|
|
|
+// updates href from the input value, with optional prefix/encoding
|
|
|
function updateHref(ev) {
|
|
|
const urlField = document.getElementById(this.getAttribute('data-input'));
|
|
|
- const url = urlField.value;
|
|
|
- if (url.length > 0) {
|
|
|
+ const rawUrl = urlField.value;
|
|
|
+ const prefix = this.getAttribute('data-prefix') || '';
|
|
|
+ const shouldEncode = this.getAttribute('data-encode') === '1';
|
|
|
+ const url = prefix + (shouldEncode ? encodeURIComponent(rawUrl) : rawUrl);
|
|
|
+ if (rawUrl.length > 0) {
|
|
|
this.href = url;
|
|
|
return true;
|
|
|
} else {
|