1 changed files with 31 additions and 31 deletions
@ -1,31 +1,31 @@
|
||||
(function (Drupal, once) { |
||||
Drupal.behaviors.removeTrailingZeros = { |
||||
attach: function (context) { |
||||
function processField(id) { |
||||
var el = document.getElementById(id); |
||||
if (!el) return; |
||||
|
||||
// If value isn't populated yet, wait and retry once
|
||||
if (el.value === "") { |
||||
setTimeout(function () { |
||||
processField(id); |
||||
}, 100); |
||||
return; |
||||
} |
||||
|
||||
var str = el.value.toString().slice(0, -3); |
||||
el.value = parseInt(str, 10); |
||||
} |
||||
|
||||
once("from-slider", "#nouislider-input-from", context).forEach( |
||||
function () { |
||||
processField("nouislider-input-from"); |
||||
} |
||||
); |
||||
|
||||
once("to-slider", "#nouislider-input-to", context).forEach(function () { |
||||
processField("nouislider-input-to"); |
||||
}); |
||||
}, |
||||
}; |
||||
})(Drupal, once); |
||||
// (function (Drupal, once) {
|
||||
// Drupal.behaviors.removeTrailingZeros = {
|
||||
// attach: function (context) {
|
||||
// function processField(id) {
|
||||
// var el = document.getElementById(id);
|
||||
// if (!el) return;
|
||||
//
|
||||
// // If value isn't populated yet, wait and retry once
|
||||
// if (el.value === "") {
|
||||
// setTimeout(function () {
|
||||
// processField(id);
|
||||
// }, 100);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var str = el.value.toString().slice(0, -3);
|
||||
// el.value = parseInt(str, 10);
|
||||
// }
|
||||
//
|
||||
// once("from-slider", "#nouislider-input-from", context).forEach(
|
||||
// function () {
|
||||
// processField("nouislider-input-from");
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// once("to-slider", "#nouislider-input-to", context).forEach(function () {
|
||||
// processField("nouislider-input-to");
|
||||
// });
|
||||
// },
|
||||
// };
|
||||
// })(Drupal, once);
|
||||
|
||||
Loading…
Reference in new issue