-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged develop into master for release.
- Loading branch information
Showing
157 changed files
with
6,912 additions
and
5,448 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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {disableButtonOnSubmit} from './submit_button_disable'; | ||
|
||
disableButtonOnSubmit(); |
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
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
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 |
---|---|---|
@@ -0,0 +1,136 @@ | ||
let move = require('move-js'); | ||
|
||
const scrollBarWidths = 40; | ||
const wrapper = document.getElementsByClassName("wrapper-nav")[0]; | ||
const lastNavLink = document.getElementsByClassName("last-nav-link")[0]; | ||
|
||
const scrollerRight = document.getElementsByClassName("scroller-right")[0]; | ||
const scrollerLeft = document.getElementsByClassName("scroller-left")[0]; | ||
|
||
const list = document.querySelectorAll(".list"); | ||
|
||
let btnTriggered = false; | ||
|
||
let widthOfList = function() { | ||
let itemsWidth = 0; | ||
|
||
const listLinks = document.querySelectorAll(".list a"); | ||
|
||
listLinks.forEach((el) => { | ||
let itemWidth = getOuterWidth(el); | ||
itemsWidth += itemWidth; | ||
}); | ||
|
||
return itemsWidth; | ||
}; | ||
|
||
let widthOfHidden = function(w) { | ||
const wrapperHelper = document.getElementsByClassName("wrapper-nav")[0]; | ||
|
||
w = (!w) ? 0 : w; | ||
|
||
oW = getOuterWidth(wrapperHelper) - w; | ||
|
||
let ww = parseFloat((0 - oW).toFixed(3)); | ||
|
||
let hw = (oW - widthOfList() - getLeftPosition()) - scrollBarWidths; | ||
|
||
let rp = document.body.clientWidth - (getOuterLeft(lastNavLink) + getOuterWidth(lastNavLink)) - w; | ||
|
||
if (ww > hw) { | ||
//return ww; | ||
return (rp > ww ? rp : ww); | ||
} | ||
else { | ||
//return hw; | ||
return (rp > hw ? rp : hw); | ||
} | ||
}; | ||
|
||
let getLeftPosition = function() { | ||
let ww = 0 - getOuterWidth(wrapper); | ||
let lp = getOuterLeft(list[0]); | ||
|
||
if (ww > lp) { | ||
return ww; | ||
} | ||
else { | ||
return lp; | ||
} | ||
}; | ||
|
||
let reAdjust = function() { | ||
let rp = document.body.clientWidth - (getOuterLeft(lastNavLink) + getOuterWidth(lastNavLink)); | ||
|
||
if (getOuterWidth(wrapper) < widthOfList() && (rp < 0)) { | ||
scrollerRight.style.cssText = 'display: flex'; | ||
} | ||
else { | ||
scrollerRight.style.display = 'none'; | ||
} | ||
|
||
if (getLeftPosition() < 0) { | ||
scrollerLeft.style.cssText = 'display: flex'; | ||
} | ||
else { | ||
scrollerLeft.style.display = 'none'; | ||
} | ||
|
||
btnTriggered = false; | ||
} | ||
|
||
window.addEventListener('resize', function(event) { | ||
reAdjust(); | ||
}, true); | ||
|
||
scrollerRight.addEventListener("click", function() { | ||
if (btnTriggered) return; | ||
|
||
btnTriggered = true; | ||
|
||
fade(scrollerLeft); | ||
unfade(scrollerRight); | ||
|
||
let wR = getOuterWidth(scrollerRight); | ||
|
||
move(document.querySelectorAll(".list")[0]).add("left", +widthOfHidden(wR), 200).end().then(x=> { | ||
reAdjust(); | ||
}); | ||
}); | ||
|
||
scrollerLeft.addEventListener("click", function() { | ||
if (btnTriggered) return; | ||
|
||
btnTriggered = true; | ||
|
||
fade(scrollerRight); | ||
unfade(scrollerLeft); | ||
|
||
let wL = getOuterWidth(scrollerLeft); | ||
|
||
move(document.querySelectorAll(".list")[0]).add("left", -getLeftPosition() + wL, 200).end().then(()=> { | ||
reAdjust(); | ||
}); | ||
}); | ||
|
||
let getOuterLeft = function(elem) { | ||
return elem.getBoundingClientRect().left; | ||
} | ||
|
||
let getOuterWidth = function(elem) { | ||
return parseFloat(window.getComputedStyle(elem).width); | ||
} | ||
|
||
function fade(elem) { | ||
elem.style.display = "none"; | ||
elem.style.transition="opacity 0.6s"; | ||
elem.style.opacity=0; | ||
} | ||
|
||
function unfade(elem) { | ||
elem.style.display = "block"; | ||
elem.style.transition="opacity 0.6s"; | ||
elem.style.opacity=1; | ||
} | ||
|
||
reAdjust(); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export function disableButtonOnSubmit() { | ||
const forms = document.getElementsByTagName("form"); | ||
|
||
for (const form of forms) { | ||
form.addEventListener("submit", disableButtons); | ||
} | ||
} | ||
|
||
function disableButtons() | ||
{ | ||
Array | ||
.from(document.getElementsByTagName("button")) | ||
.forEach(b => { | ||
b.classList.add('disabled') | ||
b.classList.add('u-pointer-events-none') | ||
}); | ||
} |
Oops, something went wrong.