changeset 8259:54d75eb32509

eslint: fix "is assigned a value but never used"
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 16 Feb 2020 03:23:21 +0100
parents fd92fe65a2ab
children a75f3e12583a
files kallithea/public/js/base.js kallithea/public/js/graph.js kallithea/templates/admin/my_account/my_account_repos.html kallithea/templates/admin/my_account/my_account_watched.html kallithea/templates/admin/repo_groups/repo_groups.html kallithea/templates/admin/repos/repos.html kallithea/templates/admin/user_groups/user_groups.html kallithea/templates/admin/users/users.html kallithea/templates/base/perms_summary.html kallithea/templates/index_base.html kallithea/templates/summary/statistics.html
diffstat 11 files changed, 14 insertions(+), 147 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/base.js	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/public/js/base.js	Sun Feb 16 03:23:21 2020 +0100
@@ -281,10 +281,6 @@
         return str_format;
     })();
 
-    var vsprintf = function(fmt, argv) {
-        argv.unshift(fmt);
-        return sprintf.apply(null, argv);
-    };
     return {
         'url': function(route_name, params) {
             var result = route_name;
@@ -335,21 +331,6 @@
 })();
 
 
-/* Invoke all functions in callbacks */
-var _run_callbacks = function(callbacks){
-    if (callbacks !== undefined){
-        var _l = callbacks.length;
-        for (var i=0;i<_l;i++){
-            var func = callbacks[i];
-            if(typeof(func)=='function'){
-                try{
-                    func();
-                }catch (err){}
-            }
-        }
-    }
-}
-
 /**
  * turns objects into GET query string
  */
@@ -534,61 +515,6 @@
 
 
 /**
- * Quick filter widget
- *
- * @param target: filter input target
- * @param nodes: list of nodes in html we want to filter.
- * @param display_element function that takes current node from nodes and
- *    does hide or show based on the node
- */
-var q_filter = (function() {
-    var _namespace = {};
-    var namespace = function (target) {
-        if (!(target in _namespace)) {
-            _namespace[target] = {};
-        }
-        return _namespace[target];
-    };
-    return function (target, $nodes, display_element) {
-        var $q_filter_field = $('#' + target);
-        var F = namespace(target);
-
-        $q_filter_field.keyup(function () {
-            clearTimeout(F.filterTimeout);
-            F.filterTimeout = setTimeout(F.updateFilter, 600);
-        });
-
-        F.filterTimeout = null;
-
-        F.updateFilter = function () {
-            // Reset timeout
-            F.filterTimeout = null;
-
-            var obsolete = [];
-
-            var req = $q_filter_field.val().toLowerCase();
-
-            var showing = 0;
-            $nodes.each(function () {
-                var n = this;
-                var target_element = display_element(n);
-                if (req && n.innerHTML.toLowerCase().indexOf(req) == -1) {
-                    $(target_element).hide();
-                }
-                else {
-                    $(target_element).show();
-                    showing += 1;
-                }
-            });
-
-            $('#repo_count').html(showing);
-            /* FIXME: don't hardcode */
-        }
-    }
-})();
-
-
-/**
  * Comment handling
  */
 
@@ -973,8 +899,8 @@
         var from = _getIdentNode(s.anchorNode);
         var till = _getIdentNode(s.focusNode);
 
-        var f_int = parseInt(from.id.replace('L',''));
-        var t_int = parseInt(till.id.replace('L',''));
+        //var f_int = parseInt(from.id.replace('L',''));
+        //var t_int = parseInt(till.id.replace('L',''));
 
         var yoffset = 35;
         var ranges = [parseInt(from.id.replace('L','')), parseInt(till.id.replace('L',''))];
@@ -1008,44 +934,6 @@
  * Autocomplete functionality
  */
 
-// Custom search function for the DataSource of users
-var autocompleteMatchUsers = function (sQuery, myUsers) {
-    // Case insensitive matching
-    var query = sQuery.toLowerCase();
-    var i = 0;
-    var l = myUsers.length;
-    var matches = [];
-
-    // Match against each name of each contact
-    for (; i < l; i++) {
-        var contact = myUsers[i];
-        if (((contact.fname+"").toLowerCase().indexOf(query) > -1) ||
-             ((contact.lname+"").toLowerCase().indexOf(query) > -1) ||
-             ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) {
-            matches[matches.length] = contact;
-        }
-    }
-    return matches;
-};
-
-// Custom search function for the DataSource of userGroups
-var autocompleteMatchGroups = function (sQuery, myGroups) {
-    // Case insensitive matching
-    var query = sQuery.toLowerCase();
-    var i = 0;
-    var l = myGroups.length;
-    var matches = [];
-
-    // Match against each name of each group
-    for (; i < l; i++) {
-        var matched_group = myGroups[i];
-        if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
-            matches[matches.length] = matched_group;
-        }
-    }
-    return matches;
-};
-
 // Highlight the snippet if it is found in the full text, while escaping any existing markup.
 // Snippet must be lowercased already.
 function autocompleteHighlightMatch(full, snippet) {
@@ -1210,24 +1098,6 @@
 }
 
 
-// Set caret at the given position in the input element
-function _setCaretPosition($inputElement, caretPos) {
-    $inputElement.each(function(){
-        if(this.createTextRange) { // IE
-            var range = this.createTextRange();
-            range.move('character', caretPos);
-            range.select();
-        }
-        else if(this.selectionStart) { // other recent browsers
-            this.focus();
-            this.setSelectionRange(caretPos, caretPos);
-        }
-        else // last resort - very old browser
-            this.focus();
-    });
-}
-
-
 function addReviewMember(id,fname,lname,nname,gravatar_link,gravatar_size){
     var displayname = nname;
     if ((fname != "") && (lname != "")) {
--- a/kallithea/public/js/graph.js	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/public/js/graph.js	Sun Feb 16 03:23:21 2020 +0100
@@ -109,9 +109,9 @@
 			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 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)
--- a/kallithea/templates/admin/my_account/my_account_repos.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/my_account/my_account_repos.html	Sun Feb 16 03:23:21 2020 +0100
@@ -6,7 +6,7 @@
 
 <script>'use strict';
   var data = ${h.js(c.data)};
-  var myDataTable = $("#datatable_list_wrap").DataTable({
+  $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "raw_name", "visible": false, searchable: false},
--- a/kallithea/templates/admin/my_account/my_account_watched.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/my_account/my_account_watched.html	Sun Feb 16 03:23:21 2020 +0100
@@ -6,7 +6,7 @@
 
 <script>'use strict';
   var data = ${h.js(c.data)};
-  var myDataTable = $("#datatable_list_wrap").DataTable({
+  $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "raw_name", "visible": false, searchable: false},
--- a/kallithea/templates/admin/repo_groups/repo_groups.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/repo_groups/repo_groups.html	Sun Feb 16 03:23:21 2020 +0100
@@ -32,7 +32,7 @@
 </div>
 <script>'use strict';
   var data = ${h.js(c.data)};
-  var myDataTable = $("#datatable_list_wrap").DataTable({
+  $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "raw_name", visible: false, searchable: false},
--- a/kallithea/templates/admin/repos/repos.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/repos/repos.html	Sun Feb 16 03:23:21 2020 +0100
@@ -31,7 +31,7 @@
 </div>
 <script>'use strict';
   var data = ${h.js(c.data)};
-  var myDataTable = $("#datatable_list_wrap").DataTable({
+  $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "raw_name", visible: false, searchable: false},
--- a/kallithea/templates/admin/user_groups/user_groups.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/user_groups/user_groups.html	Sun Feb 16 03:23:21 2020 +0100
@@ -31,7 +31,7 @@
 </div>
 <script>'use strict';
     var data = ${h.js(c.data)};
-    var $dataTable = $("#datatable_list_wrap").DataTable({
+    $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "raw_name", visible: false, searchable: false},
--- a/kallithea/templates/admin/users/users.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/admin/users/users.html	Sun Feb 16 03:23:21 2020 +0100
@@ -30,7 +30,7 @@
 
 <script>'use strict';
     var data = ${h.js(c.data)};
-    var $dataTable = $("#datatable_list_wrap").DataTable({
+    $("#datatable_list_wrap").DataTable({
         data: data.records,
         columns: [
             {data: "gravatar", sortable: false, searchable: false},
--- a/kallithea/templates/base/perms_summary.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/base/perms_summary.html	Sun Feb 16 03:23:21 2020 +0100
@@ -111,7 +111,7 @@
         function update_show($checkbox){
             var section = $checkbox.data('section');
 
-            var elems = $('.filter_' + section).each(function(){
+            $('.filter_' + section).each(function(){
                 var perm_type = $checkbox.data('perm_type');
                 var checked = $checkbox.prop('checked');
                 if(checked){
--- a/kallithea/templates/index_base.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/index_base.html	Sun Feb 16 03:23:21 2020 +0100
@@ -45,8 +45,8 @@
     </div>
 
       <script>'use strict';
-        var data = ${h.js(c.data)},
-            $dataTable = $("#repos_list_wrap").DataTable({
+        var data = ${h.js(c.data)};
+        $("#repos_list_wrap").DataTable({
                 data: data.records,
                 columns: [
                     {data: "raw_name", visible: false, searchable: false},
--- a/kallithea/templates/summary/statistics.html	Fri Jan 10 00:34:22 2020 +0100
+++ b/kallithea/templates/summary/statistics.html	Sun Feb 16 03:23:21 2020 +0100
@@ -252,10 +252,7 @@
 
         var data = [];
         var new_dataset = {};
-        var keys = [];
-        var max_commits = 0;
         for(var key in dataset){
-
             for(var ds in dataset[key].data){
                 let commit_data = dataset[key].data[ds];
                 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){