-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctionality.min.js
More file actions
10 lines (10 loc) · 4.95 KB
/
functionality.min.js
File metadata and controls
10 lines (10 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
bodyElement=$("body");$mainElement=$("main");bodyLayoutClass=$("body").attr("class");if(bodyLayoutClass.indexOf("basic-sidebar-left")!==-1){$sidebar=$(".sidebar-left");$side="left";$openSign=">";$closeSign="<";$sidebarToggleButton=$(".btn-sidebar-left")}else if(bodyLayoutClass.indexOf("basic-sidebar-right")!==-1){$sidebar=$(".sidebar-right");$side="right";$openSign="<";$closeSign=">";$sidebarToggleButton=$(".btn-sidebar-right")}
if(bodyLayoutClass.indexOf("basic")===-1){distanceTop=$mainElement.position().top;if(bodyElement.width()<481){$sidebar.css($side,0);$sidebar.css("top",distanceTop)}
$(document).ready(function(){$sidebarToggleButton.css("background-color",$sidebar.css("background-color"));$sidebarToggleButton.css("top",distanceTop+40);if($mainElement.width()<780){$sidebar.toggle();$sidebarToggleButton.closing()}else{$sidebarToggleButton.opening()}
$sidebarToggleButton.click(function(){$sidebar.toggle("fast",function(){if($sidebar.css("display")==="none"){$sidebarToggleButton.closing()}else{$sidebarToggleButton.opening()}})})});$(window).resize(function(){if($sidebar.css("display")==="grid"){if($mainElement.width()<780){$sidebar.css($side,0);$sidebar.css("top",distanceTop);$sidebar.hide();$sidebarToggleButton.closing()}
updateButtonWidth()}})}
function updateButtonWidth(){$sidebarToggleButton.css($side,$sidebar.innerWidth())}
$.fn.closing=function(){this.css($side,0);this.text($openSign);this.attr("aria-pressed","true");$sidebar.attr("aria-expanded","false")};$.fn.opening=function(){this.css($side,$sidebar.innerWidth());this.text($closeSign);this.attr("aria-pressed","false");$sidebar.attr("aria-expanded","true")};$links=$("header.head > nav > ul.links-hover");$navElement=$(".head > nav");$toggleButton=$("#toggle");const mobileMaxWidth=480;$toggleButton.click(function(){$links.toggle();if($links.css("display")==="none"){$links.attr("aria-expanded","false");$toggleButton.attr("aria-pressed","true")}else{$links.attr("aria-expanded","true");$toggleButton.attr("aria-pressed","false")}});$(document).ready(function(){if(bodyElement.width()>mobileMaxWidth){$toggleButton.hide().attr("aria-pressed","false")}else{$links.hide().attr("aria-expanded","false");$navElement.switchClass("flexRow","flexCol");$links.switchClass("flexEnd","flexStart");$links.switchClass("flexRow","flexCol")}});$(window).resize(function(){if(bodyElement.width()<=mobileMaxWidth){$toggleButton.show().attr("aria-pressed","false");$links.hide().attr("aria-expanded","true");$navElement.switchClass("flexRow","flexCol");$links.switchClass("flexEnd","flexStart");$links.switchClass("flexRow","flexCol")}else{$toggleButton.hide().attr("aria-pressed","true");$links.show().attr("aria-expanded","false");$navElement.switchClass("flexCol","flexRow");$links.switchClass("flexStart","flexEnd");$links.switchClass("flexCol","flexRow")}});$.fn.switchClass=function(previous,next){this.removeClass(previous).addClass(next)};$fillClass=$(".fill");height=$(window).height()-($("body").height()-$mainElement.innerHeight());$fillClass.css("min-height",height);if(typeof root==='undefined'){const root=document.querySelector(":root")}
const computedStyles=getComputedStyle(document.documentElement);const originalTextColor=computedStyles.getPropertyValue("--text-color");const originalMainThemeColor=getComputedStyle(document.documentElement).getPropertyValue("--main-theme-color");const originalSecondaryThemeColor=getComputedStyle(document.documentElement).getPropertyValue("--secondary-theme-color");const originalTertiaryThemeColor=getComputedStyle(document.documentElement).getPropertyValue("--tertiary-theme-color");const originalBodyBackground=getComputedStyle(document.documentElement).getPropertyValue("--body-background");let estadoBotaoContrast=0;$(".contrast").click(function(){if(estadoBotaoContrast===0){root.style.setProperty("--text-color","white");root.style.setProperty("--main-theme-color","black");root.style.setProperty("--secondary-theme-color","black");root.style.setProperty("--tertiary-theme-color","black");root.style.setProperty("--body-background","var(--main-theme-color)");estadoBotaoContrast=1}else{root.style.setProperty("--text-color",originalTextColor);root.style.setProperty("--main-theme-color",originalMainThemeColor);root.style.setProperty("--secondary-theme-color",originalSecondaryThemeColor);root.style.setProperty("--tertiary-theme-color",originalTertiaryThemeColor);root.style.setProperty("--body-background",originalBodyBackground);estadoBotaoContrast=0}
if(bodyLayoutClass.indexOf("basic")===-1){$sidebarToggleButton.css("background-color",$sidebar.css("background-color"));$sidebarToggleButton.css("color",$sidebar.css("color"))}});let estadoBotaoMagnify=0;const originalFontSize=getComputedStyle(document.documentElement).getPropertyValue("--font-size");$(".magnify").click(function(){if(estadoBotaoMagnify===0){root.style.setProperty("--font-size"," 25px");estadoBotaoMagnify=1}else{root.style.setProperty("--font-size",originalFontSize);estadoBotaoMagnify=0}
for(let i=0;i<300;i+=10){setTimeout(function(){updateButtonWidth()},i)}})