diff --git a/js/components/BasePicker.js b/js/components/BasePicker.js index dd01ed3a..1a452d0a 100644 --- a/js/components/BasePicker.js +++ b/js/components/BasePicker.js @@ -7,7 +7,8 @@ class BasePicker this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; this.picker = null; this.input_element = null; diff --git a/js/components/barcodescanner.js b/js/components/barcodescanner.js index 6f821bea..96864d8e 100644 --- a/js/components/barcodescanner.js +++ b/js/components/barcodescanner.js @@ -8,7 +8,8 @@ class barcodescanner this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; // init component this.LiveVideoSizeAdjusted = false; diff --git a/js/components/batterycard.js b/js/components/batterycard.js index e1867e88..321b2ae7 100644 --- a/js/components/batterycard.js +++ b/js/components/batterycard.js @@ -9,7 +9,7 @@ class batterycard this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; \n\tthis.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; } Refresh(batteryId) diff --git a/js/components/calendarcard.js b/js/components/calendarcard.js index 6457d9af..9ec73e00 100644 --- a/js/components/calendarcard.js +++ b/js/components/calendarcard.js @@ -6,7 +6,7 @@ class calendarcard this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; \n\tthis.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; this.$('#calendar').datetimepicker( { diff --git a/js/components/chorecard.js b/js/components/chorecard.js index a4eecaaa..16bc725e 100644 --- a/js/components/chorecard.js +++ b/js/components/chorecard.js @@ -9,7 +9,7 @@ class chorecard this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; \n\tthis.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; } Refresh(choreId) diff --git a/js/components/datetimepicker.js b/js/components/datetimepicker.js index dd4dcecf..7d1f6807 100644 --- a/js/components/datetimepicker.js +++ b/js/components/datetimepicker.js @@ -9,7 +9,8 @@ class datetimepicker this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; this.basename = basename; diff --git a/js/components/numberpicker.js b/js/components/numberpicker.js index 2a0a4373..d05017d5 100644 --- a/js/components/numberpicker.js +++ b/js/components/numberpicker.js @@ -6,7 +6,8 @@ class numberpicker this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; var self = this; this.$(".numberpicker-down-button").unbind('click').on("click", () => self.valueDownHandler(this)); diff --git a/js/components/productamountpicker.js b/js/components/productamountpicker.js index 219652c0..1c3b5179 100644 --- a/js/components/productamountpicker.js +++ b/js/components/productamountpicker.js @@ -6,7 +6,8 @@ class productamountpicker this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; Grocy.Use("numberpicker"); this.AllowAnyQuEnabled = false; diff --git a/js/components/productcard.js b/js/components/productcard.js index 3cb0cedb..e0b2532a 100644 --- a/js/components/productcard.js +++ b/js/components/productcard.js @@ -10,7 +10,8 @@ class productcard this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; this.PriceHistoryChart = null; var self = this; diff --git a/js/components/userfieldsform.js b/js/components/userfieldsform.js index e6b43834..08d65454 100644 --- a/js/components/userfieldsform.js +++ b/js/components/userfieldsform.js @@ -11,7 +11,8 @@ class userfieldsform this.scopeSelector = scopeSelector; this.scope = scopeSelector != null ? $(scopeSelector) : $(document); - this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $; + var jScope = this.scope; + this.$ = scopeSelector != null ? (selector) => jScope.find(selector) : $; this.$(".userfield-link").keyup(); diff --git a/js/helpers/frontend.js b/js/helpers/frontend.js index 1ed4bed2..e1c20378 100644 --- a/js/helpers/frontend.js +++ b/js/helpers/frontend.js @@ -5,10 +5,11 @@ class GrocyFrontendHelpers { this.Grocy = Grocy; this.Api = Api; + var self = this; if (scope != null) { - this.$scope = $(scope).find; this.scope = $(scope); + this.$scope = (selector) => self.scope.find(selector); this.scopeSelector = scope; } else