Modernize match scripts

Change-Id: Iea50c72d0ec1421d50ec4a4b7e7189f31caf934c
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 3cc7512..9c4dfb1 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -1,5 +1,7 @@
 define(['match/corpusByMatch','match/attachement','util'], function (cbmClass, attClass) {
 
+  "use strict";
+
   // Localization values
   const loc   = KorAP.Locale;
   loc.METADATA = loc.METADATA || 'Metadata';
@@ -13,16 +15,17 @@
       return Object.create(this)._init(match, fields);
     },
 
+
     /**
      * Initialize object
      */
     _init : function (match, fields) {
       this._match = match;
       this._fields = fields;
-      // this.opened = false;
       return this;
     },
 
+
     /**
      * Get match object
      */
@@ -30,6 +33,7 @@
       return this._match;
     },
 
+
     /**
      * Create match reference view.
      */
@@ -40,42 +44,40 @@
       if (this._fields === null)
         return;
 
-      var metaDL = document.createElement('dl');
+      const metaDL = document.createElement('dl');
       metaDL.classList.add("flex");
 
       this._element = metaDL;
 
-      let fields = this._fields;
+      const fields = this._fields;
 
       // Copy original array position to object
       // before sorting by key title
-      let posInMetaArray = {};
+      const posInMetaArray = {};
       fields.forEach((f,i) => posInMetaArray[f["key"]] = i);
 
-      
       // TODO: Meta fields should be separated
+
       // Sort all meta keys alphabetically
       Object.keys(posInMetaArray).sort().forEach(function(k) {
         let field = fields[posInMetaArray[k]]; // This is the object
 
+        let metaL, dt, metaDescr, metaDD, att;
+
         // Ignore internal IDs
         if (k !== "UID" &&
             k !== "corpusID" &&
             k !== "docID" &&
             k !== "textID" &&
-            /*
-              k !== "corpusSigle" &&
-              k !== "docSigle" &&
-            */
             k !== "layerInfos") {
 
-          const metaL = document.createElement('div');
+          metaL = document.createElement('div');
           
-          const dt = metaL.addE('dt');
+          dt = metaL.addE('dt');
           dt.addT(k);
           dt.setAttribute("title", k);
           
-          let metaDescr = field["value"];
+          metaDescr = field["value"];
           metaDD = metaL.addE('dd');
           metaDD.setAttribute('data-type', field["type"]);
 
@@ -83,7 +85,7 @@
         	  metaDD.classList.add("metakeyvalues");
             metaDescr.forEach(function(md) {
               if (field["type"] === 'type:attachement') {
-                let att = attClass.create(md);
+                att = attClass.create(md);
                 if (att)
         	        metaDD.addE('div').appendChild(att.inline());
               }
@@ -94,9 +96,9 @@
           }
           else{
             if (field["type"] === 'type:attachement') {
-              let att = attClass.create(field["value"]);
+              att = attClass.create(field["value"]);
               if (att)
-              metaDD.appendChild(att.inline());
+                metaDD.appendChild(att.inline());
             }
             else {
               metaDD.addT(field["value"]);