From 4bcc18fb4143aa689f9e1a10c1df22cd95bb8fc8 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Tue, 23 Feb 2021 09:51:25 +0100 Subject: [PATCH] JavaScript formatting fixes --- BTCPayServer/Views/Apps/TemplateEditor.cshtml | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/BTCPayServer/Views/Apps/TemplateEditor.cshtml b/BTCPayServer/Views/Apps/TemplateEditor.cshtml index 214a12438..054d32e4d 100644 --- a/BTCPayServer/Views/Apps/TemplateEditor.cshtml +++ b/BTCPayServer/Views/Apps/TemplateEditor.cshtml @@ -162,30 +162,29 @@ $(function() { }, getImage: function(item){ return { - "background-image" : "url('"+(this.unEscapeKey(item.image) || "/img/img-placeholder.svg") +"')", + "background-image" : "url('" + (this.unEscapeKey(item.image) || "/img/img-placeholder.svg") +"')", "opacity": item.image? 1: 0.5 } }, - getInputElement : function(){ return $("#"+this.elementId); }, + getInputElement : function(){ return $("#" + this.elementId); }, getModalElement : function(){ return $("#product-modal"); }, loadYml: function(){ var result = []; var template = this.getInputElement().val().trim(); - var lines = []; var items = template.split("\n"); + for (var i = 0; i < items.length; i++) { - if(items[i] === ""){ + if (items[i] === ""){ continue; } - if(items[i].startsWith(" ")){ + if (items[i].startsWith(" ")){ lines[lines.length-1]+=items[i] + "\n"; - }else{ - + } else { lines.push(items[i] + "\n"); } - } - + } + // Split products from the template for (var kl in lines) { var line = lines[kl], product = line.split("\n"), goingThroughMethods = false, @@ -198,9 +197,9 @@ $(function() { if (kp == 0) { id = productProperty.replace(":", ""); } - if(productProperty.startsWith("-") && goingThroughMethods){ + if (productProperty.startsWith("-") && goingThroughMethods) { paymentMethods.push(productProperty.substr(1)); - }else{ + } else { goingThroughMethods = false; }