diff --git a/js/lib/html-builder-min.js b/js/lib/html-builder-min.js
new file mode 100644
index 0000000..85092fe
--- /dev/null
+++ b/js/lib/html-builder-min.js
@@ -0,0 +1 @@
+function HTMLBuilder(){}HTMLBuilder.prototype={layout:null,default_params:{},setLayout:function(a){this.layout=a},build:function(a){var b=this.layout,c;for(c in a){var d=new RegExp("@"+c,"g");console.log(d);b=b.replace(d,a[c])}return b}};
diff --git a/js/lib/html-builder.js b/js/lib/html-builder.js
new file mode 100644
index 0000000..fe48f25
--- /dev/null
+++ b/js/lib/html-builder.js
@@ -0,0 +1,30 @@
+function HTMLBuilder(){}
+
+
+HTMLBuilder.prototype = {
+ layout: null,
+ default_params: {},
+
+ /* [1] Définit le layout (texte HTML à utiliser)
+ =========================================================*/
+ // Les variables sont entrées en '@nomvariable' dans la chaine
+ setLayout: function(layout){ this.layout = layout; },
+
+ /* [2] Construction renvoie le contenu avec les paramètres remplacés
+ =========================================================*/
+ build: function(parameters){
+ // Contiendra le résultat
+ var render = this.layout;
+
+ for( var name in parameters ){
+ // Contiendra l'expression régulière pour remplacer le paramètre
+ var regex = new RegExp('@'+name, 'g');
+ console.log(regex);
+
+ render = render.replace(regex, parameters[name]);
+ }
+
+ return render;
+ }
+
+};
diff --git a/view.php b/view.php
index a8f6061..c4e9666 100755
--- a/view.php
+++ b/view.php
@@ -26,6 +26,7 @@
+
diff --git a/view/js/input-min.js b/view/js/input-min.js
index 2aaecab..63a0033 100644
--- a/view/js/input-min.js
+++ b/view/js/input-min.js
@@ -1,5 +1,5 @@
-function newContactHTMLBuilder(a,b,c,d){var e=document.createElement("h4");e.dataset.icon="p";e.className="new-contact";a=" ";a+=" ";a+=" ";a+=" ";a+="";e.innerHTML=a;return e}var ficheRelationHTML="";function updateListener(a,b,c,d){a.removeEventListener(b,c);d.addEventListener(b,c);return d}var ic=new inputChecker,FormDeflaterP={tags:["input"],attr:["data-name"]},importCallLog=$('input#call_log-import[type="file"]'),contactDeflaters=[];
-function contactForms(){var a=$$("h4.new-contact");contactDeflaters=[];for(var b=0;b ",contactBuilderLayout=contactBuilderLayout+" ",contactBuilderLayout=contactBuilderLayout+" ",contactBuilderLayout=contactBuilderLayout+" ",
+contactBuilderLayout=contactBuilderLayout+"";contactBuilder.setLayout(contactBuilderLayout);function newContactHTMLBuilder(b,a,c,d){var e=document.createElement("h4");e.dataset.icon="p";e.className="new-contact";e.innerHTML=contactBuilder.build({number:"string"!=typeof b?"":b,username:"string"!=typeof a?"":a,firstname:"string"!=typeof c?"":c,lastname:"string"!=typeof d?"":d});return e}var ficheRelationHTML="";
+function updateListener(b,a,c,d){b.removeEventListener(a,c);d.addEventListener(a,c);return d}var ic=new inputChecker,FormDeflaterP={tags:["input"],attr:["data-name"]},importCallLog=$('input#call_log-import[type="file"]'),contactDeflaters=[];function contactForms(){var b=$$("h4.new-contact");contactDeflaters=[];for(var a=0;a ";
+contactBuilderLayout += " ";
+contactBuilderLayout += " ";
+contactBuilderLayout += "";
+contactBuilder.setLayout(contactBuilderLayout);
+
/* (1) Contiendra le formulaire d'ajout de contact (numéro, pseudo, prénom, nom, submit) */
function newContactHTMLBuilder(number, username, firstname, lastname){
var root = document.createElement('h4');
root.dataset.icon = 'p';
root.className = 'new-contact';
- var contentHTML = " ";
-
- contentHTML += " ";
-
- contentHTML += " ";
-
- contentHTML += " ";
-
- contentHTML += "";
-
- root.innerHTML = contentHTML;
+ root.innerHTML = contactBuilder.build({
+ number: (typeof number != 'string') ? '' : number,
+ username: (typeof username != 'string') ? '' : username,
+ firstname: (typeof firstname != 'string') ? '' : firstname,
+ lastname: (typeof lastname != 'string') ? '' : lastname
+ });
return root;
}