-
Notifications
You must be signed in to change notification settings - Fork 356
Template improvements #394
base: master
Are you sure you want to change the base?
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -33,8 +33,8 @@ | |
| margin-top: 60px; | ||
| } | ||
|
|
||
| .prev span:before, | ||
| .next span:before { | ||
| .prev span::before, | ||
| .next span::before { | ||
| font-size: 35px; | ||
| padding: 10px; | ||
| display: block; | ||
|
|
@@ -43,28 +43,38 @@ | |
| display: block; | ||
| } | ||
|
|
||
| .prev span:before { | ||
| .prev span::before { | ||
| content:"\f0d9"; | ||
| } | ||
| .next span:before { | ||
| .next span::before { | ||
| content:"\f0da"; | ||
| } | ||
| .list-group-item.checked a:after { | ||
| color: #23e343; | ||
| } | ||
|
|
||
| .list-group-item a span { | ||
| word-wrap: break-word; | ||
| width: 95%; | ||
| display: block; | ||
| } | ||
| .list-group-item a:after { | ||
| .list-group-item a::after { | ||
| content:"\f00c"; | ||
| font-family: "FontAwesome"; | ||
| color: #eae6e6; | ||
| position: absolute; | ||
| right: 10px; | ||
| top: 10px; | ||
| } | ||
|
|
||
| .list-group-item.current a::after { | ||
| color: #E1AB2F; | ||
| font-weight: bold; | ||
| content: "---"; | ||
| } | ||
| .list-group-item.checked a::after { | ||
| color: #23e343; | ||
| content:"\f00c"; | ||
| font-weight: normal; | ||
| } | ||
|
|
||
| .checked a { | ||
| color: #000; | ||
| } | ||
|
|
@@ -79,7 +89,7 @@ | |
| margin-left: 20px; | ||
| } | ||
|
|
||
| .compare:before { | ||
| .compare::before { | ||
| font-family: "FontAwesome"; | ||
| content:"\f0c5"; | ||
| font-size: 30px; | ||
|
|
@@ -149,22 +159,59 @@ | |
| } | ||
| } | ||
|
|
||
| function updateProgressIndicator(before, after, opts) { | ||
| // if we're the first entry in the batch | ||
| before = $(before); | ||
| after = $(after); | ||
|
|
||
| // NEXT | ||
| $('.current').removeClass('current'); | ||
| var path = after.find('.path').attr('name'); | ||
| var item = getMenuItemCorrespondingTo(path); | ||
| item.addClass('current'); | ||
|
|
||
| // CURRENT | ||
| var similarElements = getElementsOfSameClass(before); | ||
|
Contributor
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. You can achieve similar functionality with: var elementClasses = before.attr('class');
var similarElements = before.siblings(`[class="${elementClasses}"]`); |
||
| before.addClass('processed'); | ||
|
|
||
| var allProcessed = true; | ||
| similarElements.each(function () { | ||
|
Contributor
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. According to jQuery documentation:
...you can just do: if (!similarElements.hasClass('processed')) {
(...)
}
Contributor
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. Or as a one-liner: var allProcessed = !similarElements.hasClass('processed'); |
||
| if ( !$(this).hasClass('processed') ) { | ||
| allProcessed = false; | ||
| } | ||
| }); | ||
|
|
||
| if (allProcessed) { | ||
| var path = before.find('.path').attr('name'); | ||
| var item = getMenuItemCorrespondingTo(path); | ||
|
|
||
| item.addClass('checked'); | ||
|
Contributor
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 usually add |
||
| } | ||
| } | ||
|
|
||
| function getElementsOfSameClass(element) { | ||
| var classNamesOfElement = element.attr('class').split(/\s+/), | ||
| similarElements = element.parent().find('.' + classNamesOfElement.join('.')); | ||
| return similarElements; | ||
| } | ||
|
|
||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use
Contributor
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. This whole function can also be a one-liner: return $(`.list-group .list-group-item a[href="/${path}"]`); |
||
| item = $(this).parent(); | ||
| } | ||
| }) | ||
| return item; | ||
| } | ||
|
|
||
| // http://jquery.malsup.com/cycle/options.html | ||
| $('.slideshow').cycle({ | ||
| fx: 'cover', | ||
| prev: '.prev', | ||
| next: '.next', | ||
| speed: 300, | ||
| before: function (curr, next, opts) { | ||
| $('.current').removeClass('current'); | ||
| var path = $(next).find('.path').attr('name'); | ||
| $.each($('.list-group .list-group-item a'), function() { | ||
| if ($(this).attr('href').substring(1) == path) { | ||
| $(this).parent().addClass('checked'); | ||
| $(this).parent().addClass('current'); | ||
| } | ||
| }) | ||
| }, | ||
| before: updateProgressIndicator, | ||
| after: function () { | ||
| if (fullscreen) { | ||
| $('.compare-modal').remove(); | ||
|
|
||
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.
It might be better to create new variables instead reusing existing ones.