(function (document) {
    'use strict';

    document.addEventListener('DOMContentLoaded', function()
    {
        // Rich Text Editor
        var rte = document.querySelectorAll('[data-type=rte]');

        for (var i = 0; i < rte.length; ++i) {
            new RTE(rte[i]);
        }

        // Toggle
        var toggle = document.querySelectorAll('[data-toggle]');

        for (var i = 0; i < toggle.length; ++i) {
            toggle[i].addEventListener('change', function () {
                var cb = document.querySelectorAll('input[type=checkbox][data-toggle-id=' + this.getAttribute('data-toggle') + ']');

                for (var i = 0; i < cb.length; ++i) {
                    cb[i].click();
                }
            });
        }
    });
})(document);

@@ -138,19 +138,21 @@
         
-var
+const
  rte = d
@@ -202,35 +202,35 @@
 ;%0A%0A        for (
-var
+let
  i = 0; i %3C rte.
@@ -314,18 +314,21 @@
     
-var
+const
  toggle
+s
  = d
@@ -376,35 +376,35 @@
 ;%0A%0A        for (
-var
+let
  i = 0; i %3C togg
@@ -405,16 +405,17 @@
 %3C toggle
+s
 .length;
@@ -438,17 +438,52 @@
     
+let 
 toggle
-%5Bi%5D
+ = toggles%5Bi%5D;%0A%0A            toggle
 .add
@@ -536,19 +536,21 @@
         
-var
+const
  cb = do
@@ -681,11 +681,11 @@
 or (
-var
+let
  i =
@@ -741,14 +741,31 @@
 i%5D.c
-lick()
+hecked = toggle.checked
 ;%0A  

Clean up