Bladeren bron

added comment to explain iife

Skylsmoi 8 jaren geleden
bovenliggende
commit
efdeac29f2

+ 2 - 1
tracim/tracim/templates/user_workspace_widgets.mak Bestand weergeven

@@ -147,10 +147,11 @@
147 147
 </%def>
148 148
 
149 149
 <%def name="TREEVIEW(dom_id, selected_id='', uniq_workspace='0')">
150
-    <% get_root_url = tg.url("/workspaces/treeview_root", dict(current_id=selected_id)) %>
150
+    ## <% get_root_url = tg.url("/workspaces/treeview_root", dict(current_id=selected_id)) %>
151 151
     <div id='sidebarleft_menu'></div>
152 152
     <script src="${tg.url('/assets/js/sidebarleft.js')}"></script>
153 153
     <script>
154
+      // (function () { })() is equivalent to window.onload (http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the)
154 155
       (function () {
155 156
         sidebarLeft(document.getElementById('sidebarleft_menu'), '/', '?current_id=${selected_id}')
156 157
       })()

+ 1 - 0
tracim/tracim/templates/widgets/left_menu.mak Bestand weergeven

@@ -6,6 +6,7 @@
6 6
     <div id="sidebarleft_menu"></div>
7 7
     <script src="${tg.url('/assets/js/sidebarleft.js')}"></script>
8 8
     <script>
9
+      // (function () { })() is equivalent to window.onload (http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the)
9 10
       (function () {
10 11
         sidebarLeft(document.getElementById('sidebarleft_menu'), '/')
11 12
       })()