JavaScript formatting fixes

This commit is contained in:
Dennis Reimann 2021-02-23 09:51:25 +01:00
parent 32370545cb
commit 4bcc18fb41
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0

View file

@ -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;
}