This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from BrainBuzzer/master
[ci] Add JSLint
- Loading branch information
Showing
6 changed files
with
47 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
(function($) { | ||
$(document).ready(function() { | ||
(function ($) { | ||
'use strict'; | ||
$(document).ready(function () { | ||
var p = $('.field-receive_url p, .field-receive_url > div > div'), | ||
value = window.location.origin + p.text(); | ||
p.html('<input readonly id="id_receive_url" type="text" class="vTextField readonly" value="'+ value +'">'); | ||
p.html('<input readonly id="id_receive_url" type="text" class="vTextField readonly" value="' + value + '">'); | ||
var field = $('#id_receive_url'); | ||
field.click(function(){ | ||
field.click(function () { | ||
$(this).select(); | ||
}); | ||
}); | ||
})(django.jQuery); | ||
}(django.jQuery)); |
14 changes: 7 additions & 7 deletions
14
django_netjsongraph/static/netjsongraph/js/strategy-switcher.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
(function($) { | ||
$(document).ready(function() { | ||
(function ($) { | ||
'use strict'; | ||
$(document).ready(function () { | ||
var strategy = $('#id_strategy'), | ||
fetchRows = $('#id_url').parents('.form-row'), | ||
receiveRows = $('#id_key, #id_expiration_time, #id_receive_url').parents('.form-row'); | ||
strategy.change(function(e){ | ||
if (strategy.val() == 'fetch'){ | ||
strategy.change(function (e) { | ||
if (strategy.val() === 'fetch') { | ||
fetchRows.show(); | ||
receiveRows.hide(); | ||
} | ||
else{ | ||
} else { | ||
fetchRows.hide(); | ||
receiveRows.show(); | ||
} | ||
}); | ||
strategy.trigger('change'); | ||
}); | ||
})(django.jQuery); | ||
}(django.jQuery)); |
11 changes: 6 additions & 5 deletions
11
django_netjsongraph/static/netjsongraph/js/topology-history.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
django.jQuery(function($) { | ||
django.jQuery(function ($) { | ||
'use strict'; | ||
var overlay = $('.djnjg-overlay'), | ||
body = $('body'), | ||
inner = overlay.find('.inner'), | ||
visualizeUrl = $('.visualizelink').attr('data-url'); | ||
|
||
var openOverlay = function() { | ||
var disableArrowKeys = function (e) { | ||
var ar = [37, 38, 39, 40]; | ||
if ($.inArray(e.keyCode, ar) >= 0) { | ||
e.preventDefault(); | ||
} | ||
}; | ||
|
||
var openOverlay = function () { | ||
// show overlay | ||
window.__njg_el__ = '.djnjg-overlay .inner'; | ||
$.get(visualizeUrl, function(html) { | ||
$.get(visualizeUrl, function (html) { | ||
overlay.show(); | ||
inner.html(html); | ||
body.css('overflow', 'hidden'); | ||
inner.css('overflow', 'hidden'); | ||
overlay.find('.close').click(function(e){ | ||
overlay.find('.close').click(function (e) { | ||
e.preventDefault(); | ||
closeOverlay(); | ||
}) | ||
}) | ||
}); | ||
}); | ||
$(document).keydown(disableArrowKeys); | ||
}; | ||
|
||
var closeOverlay = function () { | ||
$(document).unbind('keydown', disableArrowKeys); | ||
inner.html(''); | ||
overlay.hide() | ||
overlay.hide(); | ||
body.attr('style', ''); | ||
}; | ||
|
||
$('.visualizelink').click(function(e){ | ||
$('.visualizelink').click(function (e) { | ||
openOverlay(); | ||
}); | ||
|
||
$(document).keyup(function(e) { | ||
$(document).keyup(function (e) { | ||
// ALT+P | ||
if (e.altKey && e.which == 80) { | ||
if (e.altKey && e.which === 80) { | ||
// unfocus any active input before proceeding | ||
$(document.activeElement).trigger('blur'); | ||
// corresonding raw value before proceding | ||
setTimeout(openOverlay, 15); | ||
} | ||
// ESC | ||
else if (!e.ctrlKey && e.which == 27) { | ||
} else if (!e.ctrlKey && e.which === 27) { | ||
// ESC | ||
closeOverlay(); | ||
} | ||
}); | ||
|
||
var disableArrowKeys = function(e) { | ||
var ar = new Array(37, 38, 39, 40); | ||
if ($.inArray(e.keyCode, ar)>=0){ | ||
e.preventDefault(); | ||
} | ||
} | ||
}); |