Skip to content

Commit 3e25579

Browse files
ahornaceVladimir Kotal
authored andcommitted
Fix jslint warnings
1 parent 4aec999 commit 3e25579

File tree

4 files changed

+560
-593
lines changed

4 files changed

+560
-593
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/Scripts.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ public String toHtml() {
112112
SCRIPTS.put("tablesorter-parsers", new FileScript("js/tablesorter-parsers-0.0.1.min.js", 13));
113113
SCRIPTS.put("tablesorter-parsers" + DEBUG_SUFFIX, new FileScript("js/tablesorter-parsers-0.0.1.js", 13));
114114
SCRIPTS.put("searchable-option-list", new FileScript("js/searchable-option-list-2.0.7.min.js", 14));
115-
SCRIPTS.put("utils", new FileScript("js/utils-0.0.31.min.js", 15));
116-
SCRIPTS.put("utils" + DEBUG_SUFFIX, new FileScript("js/utils-0.0.31.js", 15));
117-
SCRIPTS.put("repos", new FileScript("js/repos-0.0.1.min.js", 20));
118-
SCRIPTS.put("repos" + DEBUG_SUFFIX, new FileScript("js/repos-0.0.1.js", 20));
119-
SCRIPTS.put("diff", new FileScript("js/diff-0.0.3.min.js", 20));
120-
SCRIPTS.put("diff" + DEBUG_SUFFIX, new FileScript("js/diff-0.0.3.js", 20));
115+
SCRIPTS.put("utils", new FileScript("js/utils-0.0.32.min.js", 15));
116+
SCRIPTS.put("utils" + DEBUG_SUFFIX, new FileScript("js/utils-0.0.32.js", 15));
117+
SCRIPTS.put("repos", new FileScript("js/repos-0.0.2.min.js", 20));
118+
SCRIPTS.put("repos" + DEBUG_SUFFIX, new FileScript("js/repos-0.0.2.js", 20));
119+
SCRIPTS.put("diff", new FileScript("js/diff-0.0.4.min.js", 20));
120+
SCRIPTS.put("diff" + DEBUG_SUFFIX, new FileScript("js/diff-0.0.4.js", 20));
121121
SCRIPTS.put("jquery-caret", new FileScript("js/jquery.caret-1.5.2.min.js", 25));
122122
}
123123

opengrok-web/src/main/webapp/js/diff-0.0.3.js renamed to opengrok-web/src/main/webapp/js/diff-0.0.4.js

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/* global textInputHasFocus */
2121

2222
/*
23-
* Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
23+
* Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
2424
*/
2525

2626
/*
@@ -34,18 +34,19 @@
3434
*/
3535
(function (window, $window) {
3636
if (!$window || typeof $window.create !== 'function') {
37-
console.log('The diffWindow plugin requires $.window plugin')
37+
console.log('The diffWindow plugin requires $.window plugin');
3838
return;
3939
}
4040

4141
var diffWindow = function () {
4242
this.init = function (options, context) {
43-
return $.diffWindow = $window.create(options = $.extend({
43+
$.diffWindow = $window.create($.extend({
4444
title: 'Diff jumper',
4545
draggable: false,
4646
init: function ($window) {
47-
var $prev, $next
48-
var that = this
47+
var $prev;
48+
var $next;
49+
var that = this;
4950

5051
// set initial position by the toggle button
5152
that.options.$toggleButton.each(function () {
@@ -66,7 +67,7 @@
6667
left: $(this).offset().left + $(this).outerWidth(),
6768
opacity: 0
6869
}, that.options.animationDuration, function () {
69-
that.$window.hide()
70+
that.$window.hide();
7071
$(this).data("animation-in-progress", null);
7172
});
7273
$(this).data("animation-in-progress", "hiding");
@@ -78,17 +79,17 @@
7879
opacity: 1
7980
}, that.options.animationDuration, function () {
8081
$(this).data("animation-in-progress", null);
81-
})
82+
});
8283
$(this).data("animation-in-progress", "showing");
8384
}
84-
return false
85+
return false;
8586
});
8687

87-
var $controls = $("<div class=\"pull-right\">")
88-
.append($prev = $("<a href='#' class='prev' title='Jump to previous chunk (shortcut b)'><< Previous</a>"))
89-
.append("<span class=\"pull-rigt\"> | </span>")
90-
.append($next = $("<a href='#' class='next' title='Jump to next chunk (shortcut n)'>Next >></a>"))
91-
.append($("<div class=\"clearfix\">"))
88+
var $controls = $('<div class="pull-right">').
89+
append($prev = $('<a href="#" class="prev" title="Jump to previous chunk (shortcut b)"><< Previous</a>')).
90+
append('<span class="pull-rigt"> | </span>').
91+
append($next = $('<a href="#" class="next" title="Jump to next chunk (shortcut n)">Next >></a>')).
92+
append($('<div class="clearfix">'));
9293

9394
$next.click(function (e) {
9495
that.nextHandler.apply(that, [e]);
@@ -105,47 +106,47 @@
105106
that.options.$toggleButton.outerWidth(),
106107
opacity: 0
107108
}, that.options.animationDuration, function () {
108-
that.$window.hide()
109+
that.$window.hide();
109110
that.options.$toggleButton.data("animation-in-progress", null);
110111
});
111112
that.options.$toggleButton.data("animation-in-progress", "hiding");
112113
});
113114

114-
return $window
115-
.attr('id', 'diff_win')
116-
.addClass('diff-window')
117-
.addClass('diff_navigation_style')
118-
.css({
115+
return $window.
116+
attr('id', 'diff_win').
117+
addClass('diff-window').
118+
addClass('diff_navigation_style').
119+
css({
119120
top: '150px',
120121
right: '20px',
121-
'min-width': '300px'})
122-
.body()
123-
.append($controls)
124-
.append(this.$summary)
125-
.append(this.$progress)
126-
.window()
122+
'min-width': '300px'}).
123+
body().
124+
append($controls).
125+
append(this.$summary).
126+
append(this.$progress).
127+
window();
127128
},
128129
load: function ($window) {
129-
var that = this
130+
var that = this;
130131
$(document).keypress(function (e) {
131132
if (textInputHasFocus()) {
132133
return true;
133134
}
134-
var key = e.keyCode || e.which
135+
var key = e.keyCode || e.which;
135136
switch (key) {
136137
case 110: // n
137-
that.nextHandler(e)
138+
that.nextHandler(e);
138139
break;
139140
case 98: // b
140-
that.prevHandler(e)
141+
that.prevHandler(e);
141142
break;
142143
default:
143144
}
144145
});
145146
},
146147
update: function (data) {
147148
var index = this.currentIndex < 0 ? 1 : (this.currentIndex + 1);
148-
this.$summary.text(index + "/" + this.$changes.length + " chunks")
149+
this.$summary.text(index + "/" + this.$changes.length + " chunks");
149150
}
150151
}, options || {
151152
/*
@@ -172,26 +173,26 @@
172173
$progress: $('<div>').css('text-align', 'center'),
173174
$summary: $('<div>'),
174175
initChanges: function () {
175-
if (this.$changes.length)
176+
if (this.$changes.length) {
176177
return;
178+
}
177179
// is diff in table (udiff/sdiff) or just html text (new/old diff)?
178-
var isTable = this.options.$parent.find("table").length > 0
180+
var isTable = this.options.$parent.find("table").length > 0;
179181
// get all changes
180182
this.$changes = isTable ? this.options.$parent.find(this.options.chunkSelector) :
181-
this.options.$parent.find(this.options.addSelector + "," + this.options.delSelector)
183+
this.options.$parent.find(this.options.addSelector + "," + this.options.delSelector);
182184
this.$window.update();
183185
},
184186
progress: function (str) {
185-
var $span = $("<p>" + str + "</p>")
186-
.animate({opacity: "0.2"}, 1000)
187+
var $span = $("<p>" + str + "</p>").animate({opacity: "0.2"}, 1000);
187188
$span.hide('fast', function () {
188189
$span.remove();
189190
});
190-
this.$progress.html($span)
191+
this.$progress.html($span);
191192
},
192193
scrollTop: function ($el) {
193194
if (this.options.scrollTop) {
194-
this.options.scrollTop($el)
195+
this.options.scrollTop($el);
195196
} else {
196197
$('html, body').stop().animate({
197198
scrollTop: $el.position().top - this.options.$parent.offset().top
@@ -200,39 +201,40 @@
200201
return this;
201202
},
202203
prevHandler: function (e) {
203-
e.preventDefault()
204+
e.preventDefault();
204205
this.initChanges();
205-
var $current = $(this.$changes[this.currentIndex - 1])
206+
var $current = $(this.$changes[this.currentIndex - 1]);
206207

207208
if (!$current.length) {
208-
this.$window.error("No previous chunk!")
209-
return false
209+
this.$window.error("No previous chunk!");
210+
return false;
210211
}
211212

212213
this.currentIndex--;
213-
this.progress("Going to chunk " + (this.currentIndex + 1) + "/" + this.$changes.length)
214+
this.progress("Going to chunk " + (this.currentIndex + 1) + "/" + this.$changes.length);
214215
this.scrollTop($current);
215216
this.$window.update();
216-
return false
217+
return false;
217218
},
218219
nextHandler: function (e) {
219-
e.preventDefault()
220+
e.preventDefault();
220221
this.initChanges();
221-
var $current = $(this.$changes[this.currentIndex + 1])
222+
var $current = $(this.$changes[this.currentIndex + 1]);
222223
if (!$current.length) {
223-
this.$window.error("No next chunk!")
224-
return false
224+
this.$window.error("No next chunk!");
225+
return false;
225226
}
226227
this.currentIndex++;
227-
this.progress("Going to chunk " + (this.currentIndex + 1) + "/" + this.$changes.length)
228+
this.progress("Going to chunk " + (this.currentIndex + 1) + "/" + this.$changes.length);
228229
this.scrollTop($current);
229-
this.$window.update()
230-
return false
231-
},
230+
this.$window.update();
231+
return false;
232+
}
232233
}, context || {}));
233-
}
234+
return $.diffWindow;
235+
};
234236
};
235-
$.diffWindow = new ($.extend(diffWindow, $.diffWindow ? $.diffWindow : {}));
237+
$.diffWindow = new ($.extend(diffWindow, $.diffWindow ? $.diffWindow : {}))();
236238
}(window, $.window));
237239

238240
// Code to be called when the DOM for diff.jsp is ready.

opengrok-web/src/main/webapp/js/repos-0.0.1.js renamed to opengrok-web/src/main/webapp/js/repos-0.0.2.js

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
2222
*/
2323

2424
/*
2525
* This file contains JavaScript code used by repos.jspf.
2626
*/
2727

2828
(function ($) {
29-
var accordion = function ($parent, options) {
29+
var Accordion = function ($parent, options) {
3030
var inner = {
3131
initialized: false,
3232
options: {},
@@ -39,7 +39,7 @@
3939
var decision = inner.$panels.filter(":visible").length === inner.$panels.length;
4040
return {
4141
hide: decision ? inner.options.showAllSelector : inner.options.hideAllSelector,
42-
show: decision ? inner.options.hideAllSelector : inner.options.showAllSelector,
42+
show: decision ? inner.options.hideAllSelector : inner.options.showAllSelector
4343
};
4444
},
4545
init: function () {
@@ -48,51 +48,51 @@
4848
inner.options.parent.find(".panel-heading-accordion").click(function (e) {
4949
$(this).parent().find(".panel-body-accordion").each(function () {
5050
if ($(this).data("accordion-visible")) {
51-
$(this).hide()
52-
.data("accordion-visible", false)
53-
.parent()
54-
.find(".panel-heading-accordion .fold")
55-
.removeClass('fold-up')
56-
.addClass('fold-down')
51+
$(this).hide().
52+
data("accordion-visible", false).
53+
parent().
54+
find(".panel-heading-accordion .fold").
55+
removeClass('fold-up').
56+
addClass('fold-down');
5757
} else {
58-
$(this).show()
59-
.data("accordion-visible", true)
60-
.parent()
61-
.find(".panel-heading-accordion .fold")
62-
.removeClass('fold-down')
63-
.addClass('fold-up')
58+
$(this).show().
59+
data("accordion-visible", true).
60+
parent().
61+
find(".panel-heading-accordion .fold").
62+
removeClass('fold-down').
63+
addClass('fold-up');
6464
}
6565
});
6666

6767
var btn = inner.determineButtonsVisibility();
6868
inner.options.parent.find(btn.hide).hide();
6969
inner.options.parent.find(btn.show).show();
70-
return false
70+
return false;
7171
});
7272

7373
inner.options.parent.find(inner.options.showAllSelector).click(function (e) {
74-
inner.$panels
75-
.data("accordion-visible", true)
76-
.show()
77-
.parent()
78-
.find(".panel-heading-accordion .fold")
79-
.removeClass('fold-down')
80-
.addClass('fold-up')
81-
inner.options.parent.find(inner.options.hideAllSelector).show()
82-
inner.options.parent.find(inner.options.showAllSelector).hide()
74+
inner.$panels.
75+
data("accordion-visible", true).
76+
show().
77+
parent().
78+
find(".panel-heading-accordion .fold").
79+
removeClass('fold-down').
80+
addClass('fold-up');
81+
inner.options.parent.find(inner.options.hideAllSelector).show();
82+
inner.options.parent.find(inner.options.showAllSelector).hide();
8383
return false;
8484
});
8585

8686
inner.options.parent.find(inner.options.hideAllSelector).click(function (e) {
87-
inner.$panels
88-
.data("accordion-visible", false)
89-
.hide()
90-
.parent()
91-
.find(".panel-heading-accordion .fold")
92-
.removeClass('fold-up')
93-
.addClass('fold-down')
94-
inner.options.parent.find(inner.options.hideAllSelector).hide()
95-
inner.options.parent.find(inner.options.showAllSelector).show()
87+
inner.$panels.
88+
data("accordion-visible", false).
89+
hide().
90+
parent().
91+
find(".panel-heading-accordion .fold").
92+
removeClass('fold-up').
93+
addClass('fold-down');
94+
inner.options.parent.find(inner.options.hideAllSelector).hide();
95+
inner.options.parent.find(inner.options.showAllSelector).show();
9696
return false;
9797
});
9898

@@ -103,20 +103,21 @@
103103

104104
inner.initialized = true;
105105
}
106-
}
106+
};
107107

108108
var init = (function ($parent, options) {
109-
if (inner.initialized)
110-
return
111-
inner.options = $.extend({}, {parent: $parent}, inner.defaults, options)
109+
if (inner.initialized) {
110+
return;
111+
}
112+
inner.options = $.extend({}, {parent: $parent}, inner.defaults, options);
112113
inner.init();
113114
})($parent, options);
114115
};
115116

116117
$.fn.accordion = function (options) {
117118
return this.each(function () {
118-
options = options || {}
119-
new accordion($(this), options);
119+
options = options || {};
120+
return new Accordion($(this), options);
120121
});
121122
};
122123
})(jQuery);
@@ -127,14 +128,14 @@ $(document).ready(function () {
127128
$(".projects").accordion();
128129

129130
$(".projects_select_all").click(function (e) {
130-
$("#project .name")
131+
$("#project .name");
131132

132133
if (!e.ctrlKey) {
133-
$("#project").searchableOptionList().deselectAll()
134+
$("#project").searchableOptionList().deselectAll();
134135
}
135136
$(this).closest('.panel').find('.name').each(function(){
136-
$("#project").searchableOptionList().selectAll($(this).text())
137-
})
137+
$("#project").searchableOptionList().selectAll($(this).text());
138+
});
138139

139140
return false;
140141
});

0 commit comments

Comments
 (0)