-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor/update/jquery #2022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh-pages
Are you sure you want to change the base?
Refactor/update/jquery #2022
Changes from 1 commit
93a4438
b9a61b2
cb66948
a98da04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,7 @@ $(document).ready(function() { | |
|
||
function onPopState(fn) { | ||
if (window.history && window.history.pushState) { | ||
return $(window).bind('popstate', function(event) { | ||
var section; | ||
return $(window).on('popstate', function () { | ||
initialPop = !popped && location.href === initialURL; | ||
popped = true; | ||
if (initialPop) { | ||
|
@@ -115,7 +114,7 @@ var GitTurns20 = { | |
} else { | ||
let start = 0 | ||
let count = 0 | ||
$("#tagline").click(e => { | ||
$("#tagline").on('click', e => { | ||
if (count === 0 || e.timeStamp > start + count * 1000) { | ||
start = e.timeStamp; | ||
count = 1; | ||
|
@@ -181,20 +180,20 @@ var Search = { | |
}, | ||
|
||
observeFocus: function() { | ||
$('form#search input').focus(function() { | ||
$('form#search input').on('focus', function () { | ||
$(this).parent('form#search').switchClass("", "focus", 200); | ||
}); | ||
$('form#search input').blur(function() { | ||
$('form#search input').on('blur', function () { | ||
Search.resetForm(); | ||
}); | ||
}, | ||
|
||
observeTextEntry: function() { | ||
$('form#search input').keyup(function(e) { | ||
$('form#search input').on('keyup', function () { | ||
Search.runSearch(); | ||
}); | ||
|
||
$('form#search input').keydown(function(e) { | ||
$('form#search input').on('keydown', function (e) { | ||
if ($('#search-results').not(':visible') && e.which != 27) { | ||
$('#search-results').fadeIn(0.2); | ||
Search.highlight(Search.selectedIndex); | ||
|
@@ -220,16 +219,16 @@ var Search = { | |
}, | ||
|
||
observeResultsClicks: function() { | ||
$('#search-results').mousedown(function(e) { | ||
$('#search-results').on('mousedown', function (e) { | ||
e.preventDefault(); | ||
}); | ||
}, | ||
|
||
installKeyboardShortcuts: function() { | ||
$(document).keydown(function(e) { | ||
$(document).on('keydown', function (e) { | ||
if (e.target.tagName.toUpperCase() !== 'INPUT' && ['s', 'S', '/'].includes(e.key)) { | ||
e.preventDefault(); | ||
$('form#search input').focus(); | ||
$('form#search input').trigger('focus'); | ||
} | ||
else if (e.target.tagName.toUpperCase() !== 'INPUT') GitTurns20.keydown(e); | ||
}); | ||
|
@@ -491,7 +490,7 @@ var Forms = { | |
}, | ||
|
||
observeCopyableInputs: function() { | ||
$('input.copyable').click(function() { | ||
$('input.copyable').on('click', function () { | ||
$(this).select(); | ||
}); | ||
} | ||
|
@@ -545,7 +544,7 @@ var Downloads = { | |
}, | ||
|
||
observeGUIOSFilter: function() { | ||
$('a.gui-os-filter').click(function(e) { | ||
$('a.gui-os-filter').on('click', function (e) { | ||
e.preventDefault(); | ||
var os = $(this).attr('data-os'); | ||
|
||
|
@@ -565,7 +564,7 @@ var Downloads = { | |
}, | ||
|
||
observePopState: function() { | ||
onPopState(function() { | ||
onPopState(function () { | ||
Comment on lines
-568
to
+567
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not updating a deprecated function call, but it changes the code style to disagree with the remainder of the file. |
||
Downloads.filterGUIS(); | ||
}); | ||
}, | ||
|
@@ -648,7 +647,7 @@ var DarkMode = { | |
} | ||
button.css("display", "block"); | ||
|
||
button.click(function(e) { | ||
button.on('click', function (e) { | ||
e.preventDefault(); | ||
let theme | ||
if (prefersDarkScheme) { | ||
|
@@ -780,12 +779,12 @@ var PostelizeAnchor = { | |
|
||
// Scroll to Top | ||
$('#scrollToTop').removeClass('no-js'); | ||
$(window).scroll(function() { | ||
$(window).on('scroll', function () { | ||
$(this).scrollTop() > 150 | ||
? $('#scrollToTop').fadeIn() | ||
: $('#scrollToTop').fadeOut(); | ||
}); | ||
$('#scrollToTop').click(function(e) { | ||
$('#scrollToTop').on('click', function (e) { | ||
Comment on lines
-783
to
+787
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see a lot of |
||
e.preventDefault(); | ||
$("html, body").animate({ | ||
scrollTop: 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you find some documentation about this? If so, that would be good information for the commit message.
Also: Does this new call work with the outdated JQuery version that
git-scm.com
currently has? If so, this commit needs to come before the upgrade to the newer JQuery.