Browse Source

search display

master
rdrew 3 weeks ago
parent
commit
a90045669d
  1. 62
      js/custom.js

62
js/custom.js

@ -1,34 +1,34 @@
(function (Drupal, once) { // (function (Drupal, once) {
Drupal.behaviors.removeTrailingZeros = { // Drupal.behaviors.removeTrailingZeros = {
attach: function (context) { // attach: function (context) {
function processField(id) { // function processField(id) {
var el = document.getElementById(id); // var el = document.getElementById(id);
if (!el) return; // if (!el) return;
//
// If value isn't populated yet, wait and retry once // // If value isn't populated yet, wait and retry once
if (el.value === "") { // if (el.value === "") {
setTimeout(function () { // setTimeout(function () {
processField(id); // processField(id);
}, 100); // }, 100);
return; // return;
} // }
//
var str = el.value.toString().slice(0, -3); // var str = el.value.toString().slice(0, -3);
el.value = parseInt(str, 10); // el.value = parseInt(str, 10);
} // }
//
once("from-slider", "#nouislider-input-from", context).forEach( // once("from-slider", "#nouislider-input-from", context).forEach(
function () { // function () {
processField("nouislider-input-from"); // processField("nouislider-input-from");
} // }
); // );
//
once("to-slider", "#nouislider-input-to", context).forEach(function () { // once("to-slider", "#nouislider-input-to", context).forEach(function () {
processField("nouislider-input-to"); // processField("nouislider-input-to");
}); // });
}, // },
}; // };
})(Drupal, once); // })(Drupal, once);
// (function (Drupal) { // (function (Drupal) {
// window.onload = function () { // window.onload = function () {
// var inputField = document.getElementById("nouislider-input-from"); // var inputField = document.getElementById("nouislider-input-from");

Loading…
Cancel
Save