diff --git a/ml_lme/resources/menu.js b/ml_lme/resources/menu.js index 7a599ef..5fc6753 100644 --- a/ml_lme/resources/menu.js +++ b/ml_lme/resources/menu.js @@ -10,9 +10,10 @@ engine.on('updateModSetting', function (_name, _value) { } }); -// Modified from original `inp` types -function inp_toggle_mod(_obj) { +// Modified from original `inp` types, because I have no js knowledge to hook stuff +function inp_toggle_mod(_obj, _callbackName) { this.obj = _obj; + this.callbackName = _callbackName; this.value = _obj.getAttribute('data-current'); this.name = _obj.id; this.type = _obj.getAttribute('data-type'); @@ -30,7 +31,7 @@ function inp_toggle_mod(_obj) { self.obj.classList.add("checked"); } - engine.call('MelonMod_LME_Call_InpToggle', self.name, self.value); + engine.call(self.callbackName, self.name, self.value); } _obj.addEventListener('mousedown', this.mouseDown); @@ -57,8 +58,9 @@ function inp_toggle_mod(_obj) { } } -function inp_slider_mod(_obj) { +function inp_slider_mod(_obj, _callbackName) { this.obj = _obj; + this.callbackName = _callbackName; this.minValue = parseFloat(_obj.getAttribute('data-min')); this.maxValue = parseFloat(_obj.getAttribute('data-max')); this.percent = 0; @@ -67,7 +69,6 @@ function inp_slider_mod(_obj) { this.name = _obj.id; this.type = _obj.getAttribute('data-type'); this.caption = _obj.getAttribute('data-caption'); - this.continuousUpdate = _obj.getAttribute('data-continuousUpdate'); var self = this; @@ -100,10 +101,8 @@ function inp_slider_mod(_obj) { self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); self.valueLabel.innerHTML = self.caption + self.value; - if (_write === true || self.continuousUpdate == 'true') { - engine.call('MelonMod_LME_Call_InpSlider', self.name, "" + self.value); - self.displayImperial(); - } + engine.call(self.callbackName, self.name, "" + self.value); + self.displayImperial(); } } @@ -148,8 +147,9 @@ function inp_slider_mod(_obj) { } } -function inp_dropdown_mod(_obj) { +function inp_dropdown_mod(_obj, _callbackName) { this.obj = _obj; + this.callbackName = _callbackName; this.value = _obj.getAttribute('data-current'); this.options = _obj.getAttribute('data-options').split(','); this.name = _obj.id; @@ -166,7 +166,7 @@ function inp_dropdown_mod(_obj) { self.valueElement.innerHTML = _e.target.getAttribute('data-value'); self.globalClose(); - engine.call('MelonMod_LME_Call_InpDropdown', self.name, self.value); + engine.call(self.callbackName, self.name, self.value); } this.openClick = function (_e) { @@ -256,84 +256,84 @@ function inp_dropdown_mod(_obj) {