Avoid local variable name `self' in navigation.js

refs #10703
This commit is contained in:
Alexander A. Klimov 2016-09-01 15:49:39 +02:00
parent 0059622bba
commit 0d7f8148de
1 changed files with 12 additions and 12 deletions

View File

@ -108,14 +108,14 @@
var $a = $(this); var $a = $(this);
var href = $a.attr('href'); var href = $a.attr('href');
var $li; var $li;
var self = event.data.self; var _this = event.data.self;
var icinga = self.icinga; var icinga = _this.icinga;
self.hovered = null; _this.hovered = null;
if (href.match(/#/)) { if (href.match(/#/)) {
// ...it may be a menu section without a dedicated link. // ...it may be a menu section without a dedicated link.
// Switch the active menu item: // Switch the active menu item:
self.setActive($a); _this.setActive($a);
$li = $a.closest('li'); $li = $a.closest('li');
if ($li.hasClass('hover')) { if ($li.hasClass('hover')) {
$li.removeClass('hover'); $li.removeClass('hover');
@ -128,7 +128,7 @@
return; return;
} }
} else { } else {
self.setActive($(event.target)); _this.setActive($(event.target));
} }
// update target url of the menu container to the clicked link // update target url of the menu container to the clicked link
var $menu = $('#menu'); var $menu = $('#menu');
@ -276,9 +276,9 @@
var $li = $(this), var $li = $(this),
delay = 800, delay = 800,
self = event.data.self; _this = event.data.self;
self.hovered = null; _this.hovered = null;
if ($li.hasClass('active')) { if ($li.hasClass('active')) {
$li.siblings().removeClass('hover'); $li.siblings().removeClass('hover');
return; return;
@ -315,14 +315,14 @@
$sibling.removeClass('hover'); $sibling.removeClass('hover');
} }
}); });
self.hoverElement($li); _this.hoverElement($li);
}, delay); }, delay);
}; };
Navigation.prototype.leaveSidebar = function (event) { Navigation.prototype.leaveSidebar = function (event) {
var $sidebar = $(this), var $sidebar = $(this),
$li = $sidebar.find('li.hover'), $li = $sidebar.find('li.hover'),
self = event.data.self; _this = event.data.self;
if (! $li.length) { if (! $li.length) {
$('#layout').removeClass('hoveredmenu'); $('#layout').removeClass('hoveredmenu');
return; return;
@ -337,7 +337,7 @@
$li.removeClass('hover'); $li.removeClass('hover');
$('#layout').removeClass('hoveredmenu'); $('#layout').removeClass('hoveredmenu');
}, 500); }, 500);
self.hovered = null; _this.hovered = null;
}; };
Navigation.prototype.hoverElement = function ($li) { Navigation.prototype.hoverElement = function ($li) {
@ -356,7 +356,7 @@
Navigation.prototype.dropdownLeave = function (event) { Navigation.prototype.dropdownLeave = function (event) {
var $li = $(this), var $li = $(this),
self = event.data.self; _this = event.data.self;
setTimeout(function () { setTimeout(function () {
// TODO: make this behave well together with keyboard navigation // TODO: make this behave well together with keyboard navigation
try { try {
@ -365,7 +365,7 @@
} }
} catch(e) { /* Bypass because if IE8 */ } } catch(e) { /* Bypass because if IE8 */ }
}, 300); }, 300);
self.hovered = null; _this.hovered = null;
}; };
Icinga.Behaviors.Navigation = Navigation; Icinga.Behaviors.Navigation = Navigation;