This repository was archived by the owner on Jan 16, 2026. It is now read-only.
Conversation
vfonic
suggested changes
Nov 16, 2016
| item.addClass('current'); | ||
|
|
||
| // CURRENT | ||
| var similarElements = getElementsOfSameClass(before); |
Contributor
There was a problem hiding this comment.
You can achieve similar functionality with:
var elementClasses = before.attr('class');
var similarElements = before.siblings(`[class="${elementClasses}"]`);|
|
||
| function updateProgressIndicator(before, after, opts) { | ||
| // if we're the first entry in the batch | ||
| before = $(before); |
Contributor
There was a problem hiding this comment.
It might be better to create new variables instead reusing existing ones.
var $before = $(before);| before.addClass('processed'); | ||
|
|
||
| var allProcessed = true; | ||
| similarElements.each(function () { |
Contributor
There was a problem hiding this comment.
According to jQuery documentation:
.hasClass( className )
Description: Determine whether any of the matched elements are assigned the given class.
...you can just do:
if (!similarElements.hasClass('processed')) {
(...)
}
Contributor
There was a problem hiding this comment.
Or as a one-liner:
var allProcessed = !similarElements.hasClass('processed');| function getMenuItemCorrespondingTo(path) { | ||
| var item = false; | ||
| $.each($('.list-group .list-group-item a'), function() { | ||
| if ($(this).attr('href').substring(1) == path) { |
Contributor
There was a problem hiding this comment.
This whole function can also be a one-liner:
return $(`.list-group .list-group-item a[href="/${path}"]`);| var path = before.find('.path').attr('name'); | ||
| var item = getMenuItemCorrespondingTo(path); | ||
|
|
||
| item.addClass('checked'); |
Contributor
There was a problem hiding this comment.
I usually add is- or has- prefix to boolean class names:
is-checked
It makes it a tiny little bit cleaner IMO.
Use left/right arrow keys for changing to next/prev gallery slide
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Started work on improving the slideshow template, but ran out of time before properly addressing the progress indicator work. Ought to add keyboard controls too, for easy full-screen navigation.