changeset 8251:fb9550946c26

js: use strict ... and fix the problems it points out "use strict" gives stricter checks, both statically and at runtime. The strictness tightens up the code and prevents some kinds of problems. The <script> tag addition might not be pretty, but has consistently been added with: sed -i 's,<script>$,&'"'"'use strict'"'"';,g' `hg loc '*.html'`
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 17 Feb 2020 17:49:45 +0100
parents 1f3e993156e4
children c7e67b87fd1b
files kallithea/public/fontello/demo.html kallithea/public/js/codemirror_loadmode.js kallithea/public/js/graph.js kallithea/templates/admin/admin.html kallithea/templates/admin/admin_log.html kallithea/templates/admin/auth/auth_settings.html kallithea/templates/admin/gists/edit.html kallithea/templates/admin/gists/new.html kallithea/templates/admin/my_account/my_account_api_keys.html kallithea/templates/admin/my_account/my_account_repos.html kallithea/templates/admin/my_account/my_account_watched.html kallithea/templates/admin/repo_groups/repo_group_add.html kallithea/templates/admin/repo_groups/repo_group_edit_perms.html kallithea/templates/admin/repo_groups/repo_group_edit_settings.html kallithea/templates/admin/repo_groups/repo_groups.html kallithea/templates/admin/repos/repo_add_base.html kallithea/templates/admin/repos/repo_creating.html kallithea/templates/admin/repos/repo_edit_advanced.html kallithea/templates/admin/repos/repo_edit_permissions.html kallithea/templates/admin/repos/repo_edit_settings.html kallithea/templates/admin/repos/repos.html kallithea/templates/admin/settings/settings_hooks.html kallithea/templates/admin/settings/settings_vcs.html kallithea/templates/admin/user_groups/user_group_add.html kallithea/templates/admin/user_groups/user_group_edit_perms.html kallithea/templates/admin/user_groups/user_group_edit_settings.html kallithea/templates/admin/user_groups/user_groups.html kallithea/templates/admin/users/user_add.html kallithea/templates/admin/users/user_edit_api_keys.html kallithea/templates/admin/users/users.html kallithea/templates/base/base.html kallithea/templates/base/flash_msg.html kallithea/templates/base/perms_summary.html kallithea/templates/base/root.html kallithea/templates/changelog/changelog.html kallithea/templates/changelog/changelog_table.html kallithea/templates/changeset/changeset.html kallithea/templates/changeset/changeset_file_comment.html kallithea/templates/changeset/diff_block.html kallithea/templates/compare/compare_cs.html kallithea/templates/compare/compare_diff.html kallithea/templates/files/diff_2way.html kallithea/templates/files/files.html kallithea/templates/files/files_add.html kallithea/templates/files/files_browser.html kallithea/templates/files/files_edit.html kallithea/templates/followers/followers.html kallithea/templates/forks/fork.html kallithea/templates/forks/forks.html kallithea/templates/index_base.html kallithea/templates/journal/journal.html kallithea/templates/login.html kallithea/templates/password_reset.html kallithea/templates/pullrequests/pullrequest.html kallithea/templates/pullrequests/pullrequest_show.html kallithea/templates/register.html kallithea/templates/summary/statistics.html kallithea/templates/summary/summary.html
diffstat 58 files changed, 105 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/fontello/demo.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/public/fontello/demo.html	Mon Feb 17 17:49:45 2020 +0100
@@ -276,7 +276,7 @@
     }
      </style>
     <link rel="stylesheet" href="css/animation.css"><!--[if IE 7]><link rel="stylesheet" href="css/kallithea-ie7.css"><![endif]-->
-    <script>
+    <script>'use strict';
       function toggleCodes(on) {
         var obj = document.getElementById('icons');
       
--- a/kallithea/public/js/codemirror_loadmode.js	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/public/js/codemirror_loadmode.js	Mon Feb 17 17:49:45 2020 +0100
@@ -1,3 +1,5 @@
+'use strict';
+
 (function() {
   var loading = {};
   function splitCallback(cont, n) {
--- a/kallithea/public/js/graph.js	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/public/js/graph.js	Mon Feb 17 17:49:45 2020 +0100
@@ -1,3 +1,5 @@
+'use strict';
+
 // branch_renderer.js - Rendering of branch DAGs on the client side
 //
 // Copyright 2010 Marcin Kuzminski <marcin AT python-works DOT com>
@@ -102,15 +104,15 @@
 			var next = document.getElementById(row_id_prefix+(idx+1));
 			var extra = 0;
 
-			cur = data[i];
-			node = cur[0];
-			in_l = cur[1];
-			closing = cur[2];
-			obsolete_node = cur[3];
-			bumped_node = cur[4];
-			divergent_node = cur[5];
-			extinct_node = cur[6];
-			unstable_node = cur[7];
+			const cur = data[i];
+			const node = cur[0];
+			const in_l = cur[1];
+			const closing = cur[2];
+			const obsolete_node = cur[3];
+			const bumped_node = cur[4];
+			const divergent_node = cur[5];
+			const extinct_node = cur[6];
+			const unstable_node = cur[7];
 
 			// center dots on the first element in a td (not necessarily the first one, but there must be one)
 			var firstincell = $(row).find('td>*:visible')[0];
@@ -119,20 +121,20 @@
 			var nextY = Math.floor((next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + nextFirstincell.offsetTop + nextFirstincell.offsetHeight/2);
 
 			for (var j in in_l) {
-				line = in_l[j];
-				start = line[0];
-				end = line[1];
-				color = line[2];
-				obsolete_line = line[3];
+				const line = in_l[j];
+				const start = line[0];
+				const end = line[1];
+				const color = line[2];
+				const obsolete_line = line[3];
 
-				x = Math.floor(base_x - box_size * start);
+				const x = Math.floor(base_x - box_size * start);
 
 				// figure out if this is a dead-end;
 				// we want to fade away this line
 				var dead_end = true;
 				if (next != null) {
-					nextdata = data[i+1];
-					next_l = nextdata[1];
+					const nextdata = data[i+1];
+					const next_l = nextdata[1];
 					for (var k=0; k < next_l.length; ++k) {
 						if (next_l[k][0] == end) {
 							dead_end = false;
@@ -192,10 +194,10 @@
 				this.ctx.setLineDash([]); // reset the dashed line, if any
 			}
 
-			column = node[0];
-			color = node[1];
+			const column = node[0];
+			const color = node[1];
 
-			x = Math.floor(base_x - box_size * column);
+			const x = Math.floor(base_x - box_size * column);
 
 			this.setColor(color, 0.25, 0.75);
 			if(unstable_node)
@@ -203,7 +205,7 @@
 				this.ctx.fillStyle = 'rgb(255, 0, 0)';
 			}
 
-			r = this.dot_radius
+			let r = this.dot_radius
 			if (obsolete_node)
 			{
 				this.ctx.beginPath();
--- a/kallithea/templates/admin/admin.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/admin.html	Mon Feb 17 17:49:45 2020 +0100
@@ -27,7 +27,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
 $(document).ready(function() {
   $('#j_filter').click(function(){
     var $jfilter = $('#j_filter');
--- a/kallithea/templates/admin/admin_log.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/admin_log.html	Mon Feb 17 17:49:45 2020 +0100
@@ -37,7 +37,7 @@
     %endfor
 </table>
 
-<script>
+<script>'use strict';
   $(document).ready(function(){
     var $user_log = $('#user_log');
     $user_log.on('click','.pager_link',function(e){
--- a/kallithea/templates/admin/auth/auth_settings.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/auth/auth_settings.html	Mon Feb 17 17:49:45 2020 +0100
@@ -105,7 +105,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
     $('.toggle-plugin').click(function(e){
         var $auth_plugins_input = $('#auth_plugins');
         var notEmpty = function(element, index, array) {
--- a/kallithea/templates/admin/gists/edit.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/gists/edit.html	Mon Feb 17 17:49:45 2020 +0100
@@ -35,7 +35,7 @@
               ${(h.HTML(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload new version.'))
                              % {'here': h.link_to(_('here'),h.url('edit_gist', gist_id=c.gist.gist_access_id))})}
             </div>
-            <script>
+            <script>'use strict';
             if (typeof jQuery != 'undefined') {
                 $(".alert").alert();
             }
@@ -79,7 +79,7 @@
                 </div>
 
                 ## dynamic edit box.
-                <script>
+                <script>'use strict';
                     $(document).ready(function(){
                         var myCodeMirror = initCodeMirror(${h.js('editor_' + h.FID('f',file.path))}, ${h.jshtml(request.script_name)}, '');
 
@@ -146,7 +146,7 @@
             <a class="btn btn-default" href="${h.url('gist', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
             </div>
           ${h.end_form()}
-          <script>
+          <script>'use strict';
               $('#update').on('click', function(e){
                   e.preventDefault();
 
--- a/kallithea/templates/admin/gists/new.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/gists/new.html	Mon Feb 17 17:49:45 2020 +0100
@@ -55,7 +55,7 @@
             ${h.reset('reset',_('Reset'),class_="btn btn-default btn-xs")}
             </div>
           ${h.end_form()}
-          <script>
+          <script>'use strict';
             $(document).ready(function(){
                 var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, '');
 
--- a/kallithea/templates/admin/my_account/my_account_api_keys.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/my_account/my_account_api_keys.html	Mon Feb 17 17:49:45 2020 +0100
@@ -90,7 +90,7 @@
 ''')}</p>
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $("#lifetime").select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/admin/my_account/my_account_repos.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/my_account/my_account_repos.html	Mon Feb 17 17:49:45 2020 +0100
@@ -4,7 +4,7 @@
     <table class="table" id="datatable_list_wrap" width="100%"></table>
 </div>
 
-<script>
+<script>'use strict';
   var data = ${h.js(c.data)};
   var myDataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/admin/my_account/my_account_watched.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/my_account/my_account_watched.html	Mon Feb 17 17:49:45 2020 +0100
@@ -4,7 +4,7 @@
     <table class="table" id="datatable_list_wrap" width="100%"></table>
 </div>
 
-<script>
+<script>'use strict';
   var data = ${h.js(c.data)};
   var myDataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/admin/repo_groups/repo_group_add.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repo_groups/repo_group_add.html	Mon Feb 17 17:49:45 2020 +0100
@@ -61,7 +61,7 @@
     </div>
     ${h.end_form()}
 </div>
-<script>
+<script>'use strict';
     $(document).ready(function(){
         var setCopyPermsOption = function(group_val){
             if(group_val != "-1"){
--- a/kallithea/templates/admin/repo_groups/repo_group_edit_perms.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repo_groups/repo_group_edit_perms.html	Mon Feb 17 17:49:45 2020 +0100
@@ -102,9 +102,9 @@
 </div>
 ${h.end_form()}
 
-<script>
+<script>'use strict';
     function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
-        url = ${h.jshtml(h.url('edit_repo_group_perms_delete', group_name=c.repo_group.group_name))};
+        let url = ${h.jshtml(h.url('edit_repo_group_perms_delete', group_name=c.repo_group.group_name))};
         var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
         if (confirm(revoke_msg)){
             var recursive = $('input[name=recursive]:checked').val();
--- a/kallithea/templates/admin/repo_groups/repo_group_edit_settings.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repo_groups/repo_group_edit_settings.html	Mon Feb 17 17:49:45 2020 +0100
@@ -41,7 +41,7 @@
 </div>
 ${h.end_form()}
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $("#parent_group_id").select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/admin/repo_groups/repo_groups.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repo_groups/repo_groups.html	Mon Feb 17 17:49:45 2020 +0100
@@ -30,7 +30,7 @@
         <table class="table" id="datatable_list_wrap" width="100%"></table>
     </div>
 </div>
-<script>
+<script>'use strict';
   var data = ${h.js(c.data)};
   var myDataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/admin/repos/repo_add_base.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repo_add_base.html	Mon Feb 17 17:49:45 2020 +0100
@@ -65,7 +65,7 @@
             </div>
         </div>
 </div>
-<script>
+<script>'use strict';
     $(document).ready(function(){
         var setCopyPermsOption = function(group_val){
             if(group_val != "-1"){
--- a/kallithea/templates/admin/repos/repo_creating.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repo_creating.html	Mon Feb 17 17:49:45 2020 +0100
@@ -42,7 +42,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
 (function worker() {
   $.ajax({
     url: ${h.js(h.url('repo_check_home', repo_name=c.repo_name, repo=c.repo, task_id=c.task_id))},
--- a/kallithea/templates/admin/repos/repo_edit_advanced.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repo_edit_advanced.html	Mon Feb 17 17:49:45 2020 +0100
@@ -9,7 +9,7 @@
 </div>
 ${h.end_form()}
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $("#id_fork_of").select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/admin/repos/repo_edit_permissions.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repo_edit_permissions.html	Mon Feb 17 17:49:45 2020 +0100
@@ -87,9 +87,9 @@
 </div>
 ${h.end_form()}
 
-<script>
+<script>'use strict';
     function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
-        url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
+        let url = ${h.js(h.url('edit_repo_perms_revoke',repo_name=c.repo_name))};
         var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
         if (confirm(revoke_msg)){
             ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
--- a/kallithea/templates/admin/repos/repo_edit_settings.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repo_edit_settings.html	Mon Feb 17 17:49:45 2020 +0100
@@ -103,7 +103,7 @@
     </div>
     ${h.end_form()}
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $('#repo_landing_rev').select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/admin/repos/repos.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/repos/repos.html	Mon Feb 17 17:49:45 2020 +0100
@@ -29,7 +29,7 @@
     </div>
 
 </div>
-<script>
+<script>'use strict';
   var data = ${h.js(c.data)};
   var myDataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/admin/settings/settings_hooks.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/settings/settings_hooks.html	Mon Feb 17 17:49:45 2020 +0100
@@ -50,7 +50,7 @@
 ${h.end_form()}
 % endif
 
-<script>
+<script>'use strict';
 function delete_hook(hook_id, field_id) {
     var sUrl = ${h.js(h.url('admin_settings_hooks_delete'))};
     var success = function (o) {
--- a/kallithea/templates/admin/settings/settings_vcs.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/settings/settings_vcs.html	Mon Feb 17 17:49:45 2020 +0100
@@ -69,7 +69,7 @@
     </div>
     ${h.end_form()}
 
-    <script>
+    <script>'use strict';
         $(document).ready(function(){
             $('#path_unlock').on('click', function(e){
                 $('#path_unlock_icon').removeClass('icon-lock');
--- a/kallithea/templates/admin/user_groups/user_group_add.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/user_groups/user_group_add.html	Mon Feb 17 17:49:45 2020 +0100
@@ -52,7 +52,7 @@
     ${h.end_form()}
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $('#users_group_name').focus();
     });
--- a/kallithea/templates/admin/user_groups/user_group_edit_perms.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/user_groups/user_group_edit_perms.html	Mon Feb 17 17:49:45 2020 +0100
@@ -92,9 +92,9 @@
 </div>
 ${h.end_form()}
 
-<script>
+<script>'use strict';
     function ajaxActionRevoke(obj_id, obj_type, field_id, obj_name) {
-        url = ${h.js(h.url('edit_user_group_perms_delete', id=c.user_group.users_group_id))};
+        let url = ${h.js(h.url('edit_user_group_perms_delete', id=c.user_group.users_group_id))};
         var revoke_msg = _TM['Confirm to revoke permission for {0}: {1} ?'].format(obj_type.replace('_', ' '), obj_name);
         if (confirm(revoke_msg)){
             ajaxActionRevokePermission(url, obj_id, obj_type, field_id);
--- a/kallithea/templates/admin/user_groups/user_group_edit_settings.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/user_groups/user_group_edit_settings.html	Mon Feb 17 17:49:45 2020 +0100
@@ -48,6 +48,6 @@
                 </div>
     </div>
 ${h.end_form()}
-<script>
+<script>'use strict';
   MultiSelectWidget('users_group_members','available_members','edit_users_group');
 </script>
--- a/kallithea/templates/admin/user_groups/user_groups.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/user_groups/user_groups.html	Mon Feb 17 17:49:45 2020 +0100
@@ -29,7 +29,7 @@
         <table class="table" id="datatable_list_wrap" width="100%"></table>
     </div>
 </div>
-<script>
+<script>'use strict';
     var data = ${h.js(c.data)};
     var $dataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/admin/users/user_add.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/users/user_add.html	Mon Feb 17 17:49:45 2020 +0100
@@ -84,7 +84,7 @@
     ${h.end_form()}
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $('#username').focus();
     });
--- a/kallithea/templates/admin/users/user_edit_api_keys.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/users/user_edit_api_keys.html	Mon Feb 17 17:49:45 2020 +0100
@@ -77,7 +77,7 @@
     ${h.end_form()}
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $("#lifetime").select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/admin/users/users.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/admin/users/users.html	Mon Feb 17 17:49:45 2020 +0100
@@ -28,7 +28,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
     var data = ${h.js(c.data)};
     var $dataTable = $("#datatable_list_wrap").DataTable({
         data: data.records,
--- a/kallithea/templates/base/base.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/base/base.html	Mon Feb 17 17:49:45 2020 +0100
@@ -177,7 +177,7 @@
     </div>
     </div>
   </nav>
-  <script>
+  <script>'use strict';
     $(document).ready(function() {
       var bcache = {};
 
@@ -399,7 +399,7 @@
     </li>
   </ul>
 
-    <script>
+    <script>'use strict';
         $(document).ready(function(){
             var visual_show_public_icon = ${h.js(c.visual.show_public_icon)};
             var cache = {}
@@ -527,7 +527,7 @@
         </div>
     </div>
 
-    <script>
+    <script>'use strict';
       $(document).ready(function(){
           activate_parent_child_links();
       });
--- a/kallithea/templates/base/flash_msg.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/base/flash_msg.html	Mon Feb 17 17:49:45 2020 +0100
@@ -9,7 +9,7 @@
             </div>
         % endfor
     % endif
-    <script>
+    <script>'use strict';
     if (typeof jQuery != 'undefined') {
         $(".alert").alert();
     }
--- a/kallithea/templates/base/perms_summary.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/base/perms_summary.html	Mon Feb 17 17:49:45 2020 +0100
@@ -97,7 +97,7 @@
         %endif
      %endfor
 </div>
-<script>
+<script>'use strict';
     $(document).ready(function(){
         var show_empty = function(section){
             var visible = $('.section_{0} tr.perm_row:visible'.format(section)).length;
--- a/kallithea/templates/base/root.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/base/root.html	Mon Feb 17 17:49:45 2020 +0100
@@ -21,7 +21,7 @@
         <%block name="css_extra"/>
 
         ## JAVASCRIPT ##
-        <script>
+        <script>'use strict';
             ## JS translations map
             var TRANSLATION_MAP = {
                 'Cancel': ${h.jshtml(_("Cancel"))},
@@ -77,7 +77,7 @@
         <script src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
         ## EXTRA FOR JS
         <%block name="js_extra"/>
-        <script>
+        <script>'use strict';
             $(document).ready(function(){
               tooltip_activate();
               show_more_event();
--- a/kallithea/templates/changelog/changelog.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/changelog/changelog.html	Mon Feb 17 17:49:45 2020 +0100
@@ -81,7 +81,7 @@
                 ${c.cs_pagination.pager()}
 
         <script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
-        <script>
+        <script>'use strict';
             var jsdata = ${h.js(c.jsdata)};
             var graph = new BranchRenderer('graph_canvas', 'graph_content', 'chg_');
 
--- a/kallithea/templates/changelog/changelog_table.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/changelog/changelog_table.html	Mon Feb 17 17:49:45 2020 +0100
@@ -110,7 +110,7 @@
     </tbody>
     </table>
 
-<script>
+<script>'use strict';
   $(document).ready(function() {
     $('#changesets .expand_commit').on('click',function(e){
       $(this).next('.mid').find('.message > div').toggleClass('hidden');
--- a/kallithea/templates/changeset/changeset.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/changeset/changeset.html	Mon Feb 17 17:49:45 2020 +0100
@@ -22,7 +22,7 @@
   <div class="panel-heading clearfix">
     ${self.breadcrumbs()}
   </div>
-  <script>
+  <script>'use strict';
     AJAX_COMMENT_URL = ${h.js(url('changeset_comment',repo_name=c.repo_name,revision=c.changeset.raw_id))};
     AJAX_COMMENT_DELETE_URL = ${h.js(url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
   </script>
@@ -184,7 +184,7 @@
     </div>
 
     ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
-    <script>
+    <script>'use strict';
       $(document).ready(function(){
           $('.code-difftable').on('click', '.add-bubble', function(e){
               show_comment_form($(this));
--- a/kallithea/templates/changeset/changeset_file_comment.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/changeset/changeset_file_comment.html	Mon Feb 17 17:49:45 2020 +0100
@@ -192,7 +192,7 @@
   </div>
 </div>
 
-<script>
+<script>'use strict';
 
 $(document).ready(function () {
 
--- a/kallithea/templates/changeset/diff_block.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Mon Feb 17 17:49:45 2020 +0100
@@ -96,7 +96,7 @@
 </%def>
 
 <%def name="diff_block_js()">
-<script>
+<script>'use strict';
 $(document).ready(function(){
     $('.btn-image-diff-show').click(function(e){
         $('.btn-image-diff-show').hide();
--- a/kallithea/templates/compare/compare_cs.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/compare/compare_cs.html	Mon Feb 17 17:49:45 2020 +0100
@@ -66,7 +66,7 @@
 <script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
 %endif
 
-<script>
+<script>'use strict';
     var jsdata = ${h.js(c.jsdata)};
     var graph = new BranchRenderer('graph_canvas', 'graph_content_pr', 'chg_');
 
--- a/kallithea/templates/compare/compare_diff.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/compare/compare_diff.html	Mon Feb 17 17:49:45 2020 +0100
@@ -98,7 +98,7 @@
     </div>
 
 </div>
-    <script>
+    <script>'use strict';
 
    $(document).ready(function(){
     var cache = {};
--- a/kallithea/templates/files/diff_2way.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/files/diff_2way.html	Mon Feb 17 17:49:45 2020 +0100
@@ -60,7 +60,7 @@
         </div>
     </div>
 
-<script>
+<script>'use strict';
 var orig1_url = ${h.jshtml(h.url('files_raw_home',repo_name=c.repo_name,f_path=c.node1.path,revision=c.cs1.raw_id))};
 var orig2_url = ${h.jshtml(h.url('files_raw_home',repo_name=c.repo_name,f_path=c.node2.path,revision=c.cs2.raw_id))};
 
--- a/kallithea/templates/files/files.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/files/files.html	Mon Feb 17 17:49:45 2020 +0100
@@ -36,7 +36,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
 var CACHE = {};
 var CACHE_EXPIRE = 5*60*1000; //cache for 5*60s
 //used to construct links from the search list
@@ -125,16 +125,16 @@
     }
 
     function highlight_lines(lines){
-        for(pos in lines){
+        for(let pos in lines){
           $('#L'+lines[pos]).css('background-color','#FFFFBE');
         }
     }
-    page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
+    let page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
     if (page_highlights.length == 2){
-       highlight_ranges  = page_highlights[1].split(",");
+       let highlight_ranges  = page_highlights[1].split(",");
 
        var h_lines = [];
-       for (pos in highlight_ranges){
+       for (let pos in highlight_ranges){
             var _range = highlight_ranges[pos].split('-');
             if(_range.length == 2){
                 var start = parseInt(_range[0]);
--- a/kallithea/templates/files/files_add.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/files/files_add.html	Mon Feb 17 17:49:45 2020 +0100
@@ -70,7 +70,7 @@
               </div>
             </div>
             ${h.end_form()}
-            <script>
+            <script>'use strict';
                 $(document).ready(function(){
                     var reset_url = ${h.jshtml(h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))};
                     var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, reset_url);
--- a/kallithea/templates/files/files_browser.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/files/files_browser.html	Mon Feb 17 17:49:45 2020 +0100
@@ -109,7 +109,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         // init node filter if we pass GET param ?search=1
         var search_GET = ${h.js(request.GET.get('search',''))};
--- a/kallithea/templates/files/files_edit.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/files/files_edit.html	Mon Feb 17 17:49:45 2020 +0100
@@ -77,7 +77,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         var reset_url = ${h.jshtml(h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path))};
         var myCodeMirror = initCodeMirror('editor', ${h.jshtml(request.script_name)}, reset_url);
--- a/kallithea/templates/followers/followers.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/followers/followers.html	Mon Feb 17 17:49:45 2020 +0100
@@ -25,7 +25,7 @@
         </div>
     </div>
 </div>
-<script>
+<script>'use strict';
   $(document).ready(function(){
     var $followers = $('#followers');
     $followers.on('click','.pager_link',function(e){
--- a/kallithea/templates/forks/fork.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/forks/fork.html	Mon Feb 17 17:49:45 2020 +0100
@@ -88,7 +88,7 @@
     </div>
     ${h.end_form()}
 </div>
-<script>
+<script>'use strict';
     $(document).ready(function(){
         $("#repo_group").select2({
             'dropdownAutoWidth': true
--- a/kallithea/templates/forks/forks.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/forks/forks.html	Mon Feb 17 17:49:45 2020 +0100
@@ -25,7 +25,7 @@
         </div>
     </div>
 </div>
-<script>
+<script>'use strict';
   $(document).ready(function(){
       var $forks = $('#forks');
       $forks.on('click','.pager_link',function(e){
--- a/kallithea/templates/index_base.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/index_base.html	Mon Feb 17 17:49:45 2020 +0100
@@ -44,7 +44,7 @@
         </div>
     </div>
 
-      <script>
+      <script>'use strict';
         var data = ${h.js(c.data)},
             $dataTable = $("#repos_list_wrap").DataTable({
                 data: data.records,
--- a/kallithea/templates/journal/journal.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/journal/journal.html	Mon Feb 17 17:49:45 2020 +0100
@@ -41,7 +41,7 @@
         </div>
     </div>
 
-<script>
+<script>'use strict';
 
     $('#j_filter').click(function(){
         var $jfilter = $('#j_filter');
@@ -72,7 +72,7 @@
 
 </script>
 
-<script>
+<script>'use strict';
     $(document).ready(function(){
         var $journal = $('#journal');
         $journal.on('click','.pager_link',function(e){
--- a/kallithea/templates/login.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/login.html	Mon Feb 17 17:49:45 2020 +0100
@@ -64,7 +64,7 @@
             </div>
         </div>
         ${h.end_form()}
-        <script>
+        <script>'use strict';
         $(document).ready(function(){
             $('#username').focus();
         });
--- a/kallithea/templates/password_reset.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/password_reset.html	Mon Feb 17 17:49:45 2020 +0100
@@ -53,7 +53,7 @@
                 </div>
         </div>
         ${h.end_form()}
-        <script>
+        <script>'use strict';
          $(document).ready(function(){
             $('#email').focus();
          });
--- a/kallithea/templates/pullrequests/pullrequest.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/pullrequests/pullrequest.html	Mon Feb 17 17:49:45 2020 +0100
@@ -92,7 +92,7 @@
 </div>
 
 <script src="${h.url('/js/graph.js', ver=c.kallithea_version)}"></script>
-<script>
+<script>'use strict';
   pyroutes.register('pullrequest_repo_info', ${h.js(url('pullrequest_repo_info',repo_name='%(repo_name)s'))}, ['repo_name']);
 
   var pendingajax = undefined;
@@ -162,7 +162,7 @@
           '__other_ref_name__': other_ref[2]
       }; // gather the org/other ref and repo here
 
-      for (k in rev_data){
+      for (let k in rev_data){
           url = url.replace(k,rev_data[k]);
       }
 
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Mon Feb 17 17:49:45 2020 +0100
@@ -312,7 +312,7 @@
             </div>
         </div>
     </div>
-    <script>
+    <script>'use strict';
     // TODO: switch this to pyroutes
     AJAX_COMMENT_URL = ${h.js(url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id))};
     AJAX_COMMENT_DELETE_URL = ${h.js(url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__'))};
@@ -343,7 +343,7 @@
     ## main comment form and it status
     ${comment.comments(change_status=c.allowed_to_change_status)}
 
-    <script>
+    <script>'use strict';
       $(document).ready(function(){
           PullRequestAutoComplete($('#user'));
           SimpleUserAutoComplete($('#owner'));
--- a/kallithea/templates/register.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/register.html	Mon Feb 17 17:49:45 2020 +0100
@@ -90,7 +90,7 @@
                 </div>
         </div>
         ${h.end_form()}
-        <script>
+        <script>'use strict';
         $(document).ready(function(){
             $('#username').focus();
         });
--- a/kallithea/templates/summary/statistics.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/summary/statistics.html	Mon Feb 17 17:49:45 2020 +0100
@@ -51,7 +51,7 @@
     </div>
 </div>
 
-<script>
+<script>'use strict';
 var data = ${h.js(c.trending_languages)};
 var total = 0;
 var tbl = document.createElement('table');
@@ -103,7 +103,7 @@
     if(cnt == 3){
         var show_more = document.createElement('tr');
         var td = document.createElement('td');
-        lnk = document.createElement('a');
+        let lnk = document.createElement('a');
 
         lnk.href='#';
         lnk.innerHTML = ${h.jshtml(_('Show more'))};
@@ -118,7 +118,7 @@
 }
 
 </script>
-<script>
+<script>'use strict';
 
 /**
  * Plots summary graph
@@ -260,7 +260,7 @@
         for(var key in dataset){
 
             for(var ds in dataset[key].data){
-                commit_data = dataset[key].data[ds];
+                let commit_data = dataset[key].data[ds];
                 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
                     if(new_dataset[key] === undefined){
                         new_dataset[key] = {data:[],label:key};
@@ -288,7 +288,7 @@
     * redraw using new checkbox data
     */
     function plotchoiced(e){
-        args = e.data;
+        let args = e.data;
         var cur_data = args[0];
         var cur_ranges = args[1];
 
--- a/kallithea/templates/summary/summary.html	Mon Feb 17 17:14:12 2020 +0100
+++ b/kallithea/templates/summary/summary.html	Mon Feb 17 17:49:45 2020 +0100
@@ -27,7 +27,7 @@
   <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
   <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
 
-  <script>
+  <script>'use strict';
   redirect_hash_branch = function(){
     var branch = window.location.hash.replace(/^#(.*)/, '$1');
     if (branch){
@@ -238,7 +238,7 @@
 </div>
 %endif
 
-<script>
+<script>'use strict';
 $(document).ready(function(){
     $('#clone-url input').click(function(e){
         if($(this).hasClass('selected')){
@@ -309,7 +309,7 @@
     $('#download_options').change(function(e){
        var new_cs = e.added
 
-       for(k in tmpl_links){
+       for(let k in tmpl_links){
            var s = $('#'+k+'_link');
            if(s){
              var title_tmpl = ${h.jshtml(_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__'))};
@@ -334,7 +334,7 @@
 </script>
 
 %if c.show_stats:
-<script>
+<script>'use strict';
 $(document).ready(function(){
     var data = ${h.js(c.trending_languages)};
     var total = 0;
@@ -393,7 +393,7 @@
         if(cnt == 3){
             var show_more = document.createElement('tr');
             var td = document.createElement('td');
-            lnk = document.createElement('a');
+            let lnk = document.createElement('a');
 
             lnk.href='#';
             lnk.innerHTML = ${h.jshtml(_('Show more'))};