From dff156a88b36ea4f501373ed2f2b827669aec91c Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 18 Sep 2016 15:13:14 +0200 Subject: [PATCH] FIXED: gestion des regexp --- js/lib/form-builder-min.js | 2 +- js/lib/form-builder.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/js/lib/form-builder-min.js b/js/lib/form-builder-min.js index a5a9734..5e9d333 100644 --- a/js/lib/form-builder-min.js +++ b/js/lib/form-builder-min.js @@ -4,6 +4,6 @@ FormBuilder.prototype.add_definition=function(a){for(var b in a)this.defs_object FormBuilder.prototype.attach=function(a){if(!(a instanceof Element)&&null==this.parent_element)return!1;this.parent_element=a instanceof Element?a:this.parent_element};FormBuilder.formatFormObject=function(a,b){if(a.hasOwnProperty("children"))for(var g in a.children)a.children[g].parent=a,FormBuilder.formatFormObject(a.children[g],b);return a}; FormBuilder.fetchNodeDefinition=function(a,b){var g,c;r=FormBuilder.regex.reg_in_key;if("undefined"!=typeof b&&b.hasOwnProperty(a))return{def:b[a]};for(g in b)if(r.test(g)&&(c=new RegExp(g.slice(1,-1)),c.test(a))){matches={};for(c=1;cc;c++)matches["$"+c]=RegExp["$"+c];return{def:b[g],scope:matches}}return{}}; FormBuilder.replaceStatements=function(a,b,g){a=a instanceof Object?a:{};b=b instanceof Object?JSON.parse(JSON.stringify(b)):{};var c,f,e,h;if(a.hasOwnProperty("scope")&&a.scope instanceof Object)for(c in a.scope)b[c]=a.scope[c];if(a.hasOwnProperty("node")&&"string"==typeof a.node&&(f=FormBuilder.fetchNodeDefinition(a.node,g),f.hasOwnProperty("def")&&(a.node_link=JSON.parse(JSON.stringify(f.def)),f.hasOwnProperty("scope"))))for(c in f.scope)b[c]=f.scope[c];a.received=b;for(c in a)if("string"==typeof a[c]){f= -FormBuilder.regex.arr_out_set;var d=[];(e=f.exec(a[c]))&&d.push(e[1]);for(e in d)b.hasOwnProperty(d[e])||(b[d[e]]=[]),a[c]=b[d[e]];if(!(0=f.lastIndex);)h=f.lastIndex,d.push(e[1]);for(e in d)b.hasOwnProperty(d[e])||(b[d[e]]=""),f=new RegExp("{$"+d[e][1]+"}","g"),a[c]=a[c].replace(f,b[d[e]]);if(!(0=f.lastIndex);)h=f.lastIndex,d.push(e[1]);for(e in d)b.hasOwnProperty(d[e])||(b[d[e]]=""),f=new RegExp("{\\$"+d[e][1]+"}","g"),console.log(f),a[c]=a[c].replace(f,b[d[e]]);if(!(0