diff --git a/README.md b/README.md index bd05310..5aa5616 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,4 @@ Some lines and good tips from [cagrimmett/jekyll-tools](https://github.com/cagri I'm not a developer and this is my first time using jekyll and more broadly github, I hope it is not too dirty. :) -*latest version: v2.2.2* \ No newline at end of file +*latest version: v2.3* \ No newline at end of file diff --git a/assets/scripts/main.min.js b/assets/scripts/main.min.js index 1b5a474..751e4d1 100644 --- a/assets/scripts/main.min.js +++ b/assets/scripts/main.min.js @@ -4,7 +4,7 @@ var q,TIMEOUT_ID=0,activeSidebar=false,wideLayout=true,currentFilter,currentSort,currentSortOrder,currentBookmarks=':not(*)',currentUserID,jsonFeed,userPhotoURL;const allowEmpty=false,disableBodyScroll=bodyScrollLock.disableBodyScroll,enableBodyScroll=bodyScrollLock.enableBodyScroll,jsonFeedUrl='/assets/feeds/recipes.json',firebase_apiKey={{site.firebase_apiKey|jsonify}},firebase_projectId={{site.firebase_projectId|jsonify}},firebase_databaseName={{site.firebase_databaseName|jsonify}},firebase_authDomain=firebase_projectId+'.firebaseapp.com',firebase_databaseURL=firebase_databaseName+'.firebaseio.com',firebase_storageBucket=firebase_projectId+'.appspot.com',signedIn_modalTitle={{site.data.taxonomies.account.signed-in_title|jsonify}},signedIn_modalBody={{site.data.taxonomies.account.signed-in_body|markdownify|jsonify}},signedIn_modalClose={{site.data.taxonomies.account.signed-in_close|jsonify}},login_modalTitle={{site.data.taxonomies.account.login_title|jsonify}},login_modalBody={{site.data.taxonomies.account.login_body|markdownify|jsonify}},login_modalClose={{site.data.taxonomies.account.login_close|jsonify}};$(document).ready(function(){var $1em=parseFloat(getComputedStyle(document.body,null).fontSize);const -$htmlBody=$("html, body"),scrollTopOffset=$1em*6.3,wideLayoutBreakingpoint=$1em*35.5,$searchInput=$("#searchbar__input"),$emptySearch=$("#searchbar__empty-search"),$allMenuItems=$(".filter-button"),$gridContainer=$("#isotopeContent"),$bookmarksFilter=$("#filter-button--bookmarks"),$recipesAll=$("#filter-button--all-recipes"),$sidebar=document.querySelector('#sidebar'),$accountModal=document.querySelector('#account-modal');initiateLazyLoad();var $grid=$($gridContainer).isotope({itemSelector:'.grid-item',getSortData:{name:"[data-name]",date:"[data-date]",rating:"[data-rating]",},percentPosition:true,layoutMode:'fitRows',transitionDuration:0});var $items=$grid.find(".grid-item");$grid.addClass("showOn").isotope("revealItemElements",$items);document.addEventListener('ResizeObserverCompleted',function(){isotopeLayout();});detectHash();initiateFirebase();function initiateFirebase(){var config={apiKey:firebase_apiKey,authDomain:firebase_authDomain,databaseURL:firebase_databaseURL,storageBucket:firebase_storageBucket};firebase.initializeApp(config);} +$htmlBody=$("html, body"),scrollTopOffset=$1em*6.3,wideLayoutBreakingpoint=$1em*35.5,$searchInput=$("#searchbar__input"),$emptySearch=$("#searchbar__empty-search"),$allMenuItems=$(".filter-button"),$gridContainer=$("#isotopeContent"),$bookmarksFilter=$("#filter-button--bookmarks"),$recipesAll=$("#filter-button--all-recipes"),$sidebar=document.querySelector('#sidebar'),$accountModal=document.querySelector('#account-modal');var lazyLoadInstance=new LazyLoad({thresholds:"500% 0px"});var $grid=$($gridContainer).isotope({itemSelector:'.grid-item',getSortData:{name:"[data-name]",date:"[data-date]",rating:"[data-rating]",},percentPosition:true,layoutMode:'fitRows',transitionDuration:0});var $items=$grid.find(".grid-item");$grid.addClass("showOn").isotope("revealItemElements",$items);document.addEventListener('ResizeObserverCompleted',function(){isotopeLayout();});detectHash();initiateFirebase();function initiateFirebase(){var config={apiKey:firebase_apiKey,authDomain:firebase_authDomain,databaseURL:firebase_databaseURL,storageBucket:firebase_storageBucket};firebase.initializeApp(config);} firebase.auth().onAuthStateChanged(function(user){loadFirebaseDatas(user);});getThemePreference();async function initiateLazyLoad(){var lazyLoadInstance=new LazyLoad({elements_selector:".lazy",});} async function isotopeLayout(){$grid.isotope('layout');} async function detectHash(){var URLparam=location.search||"";if(URLparam!==""){getHashParam(URLparam);}else{defaultFilter();defaultSort();}} @@ -23,7 +23,7 @@ function googleSignout(){firebase.auth().signOut().then(function(){console.log(" async function signedIn(){$('body').addClass("signed-in");$('.main-nav__icons--account').css('background-image',"url('"+userPhotoURL+"')");$('.main-nav__icons--account > path').css('display','none');$('.modal-title').html(signedIn_modalTitle);$('.modal-content__body').html(signedIn_modalBody);$('.modal-content__button .modal-off').html(signedIn_modalClose);} async function signedOut(){$('body').removeClass('signed-in');$('.main-nav__icons--account').css('background-image','none');$('.main-nav__icons--account > path').css('display','block');$('.modal-title').html(login_modalTitle);$('.modal-content__body').html(login_modalBody);$('.modal-content__button .modal-off').html(login_modalClose);$('.adminContent').removeClass('active');currentBookmarks=':not(*)';} async function getThemePreference(){currentTheme=localStorage.getItem('theme')?localStorage.getItem('theme'):null;if(currentTheme&¤tTheme==='dark'){$(".theme-switch input[type='checkbox']").prop("checked",true);}} -wideWindowDetector();$(window).resize(function(){wideWindowDetector();});$("#main-nav").on("click","#logo",function(){resetFilter();disableSidebarCondition();});$("#main-nav").on("click","#burger",function(){toggleBurger();});$("#main-nav").on("click","#account",function(){modalON();});$("#filter-button--specials").on("click","a",function(){filterSpecials($(this));});$("#filter-button--categories").on("click","a",function(){filterCategories($(this));});$("#sorting-button-group").on("click","li",function(){sortItems($(this));});$("#searchbar__form").on("click","#searchbar__empty-search",function(){resetFilter();});$(".card__body__controls").on("click",".card__body__controls__bookmark",function(){toggleBookmark($(this));});$(".card__body__controls").on("click",".rating__icons",function(){saveRating($(this));});$("#no-result").on("click","a",function(){resetFilter();});$(".modal-content__button").on("click","#button--signIn",function(){googleSignin();});$(".modal-content__button").on("click","#button--signOut",function(){googleSignout();signedOut();if(currentFilter=="cat=bookmarks"){resetFilter();}});$("#account-modal").on("click",".js-close-modal",function(){modalOFF();if(!currentUserID){resetFilter();}});$("body").on("click","#overlay--sidebar",function(){disableSidebar();});$("body").on("click","#overlay--modal",function(){modalOFF();if(!currentUserID){resetFilter();}});$(".theme-switch").on("change","input[type='checkbox']",function(){switchTheme($(this));});initSearch();$(document).ready(function(){preloadImages();});function loadData(path){return firebase.database().ref(path).once("value");} +wideWindowDetector();$(window).resize(function(){wideWindowDetector();});$("#main-nav").on("click","#logo",function(){resetFilter();disableSidebarCondition();});$("#main-nav").on("click","#burger",function(){toggleBurger();});$("#main-nav").on("click","#account",function(){modalON();});$("#filter-button--specials").on("click","a",function(){filterSpecials($(this));});$("#filter-button--categories").on("click","a",function(){filterCategories($(this));});$("#filter-button--other-filters").on("click","a",function(){filterCategories($(this));});$("#sorting-button-group").on("click","li",function(){sortItems($(this));});$("#searchbar__form").on("click","#searchbar__empty-search",function(){resetFilter();});$(".card__body__controls").on("click",".card__body__controls__bookmark",function(){toggleBookmark($(this));});$(".card__body__controls").on("click",".rating__icons",function(){saveRating($(this));});$("#no-result").on("click","a",function(){resetFilter();});$(".modal-content__button").on("click","#button--signIn",function(){googleSignin();});$(".modal-content__button").on("click","#button--signOut",function(){googleSignout();signedOut();if(currentFilter=="cat=bookmarks"){resetFilter();}});$("#account-modal").on("click",".js-close-modal",function(){modalOFF();if(!currentUserID){resetFilter();}});$("body").on("click","#overlay--sidebar",function(){disableSidebar();});$("body").on("click","#overlay--modal",function(){modalOFF();if(!currentUserID){resetFilter();}});$(".theme-switch").on("change","input[type='checkbox']",function(){switchTheme($(this));});initSearch();$(document).ready(function(){preloadImages();});function loadData(path){return firebase.database().ref(path).once("value");} async function wideWindowDetector(){let newWideLayout=$(window).width()>wideLayoutBreakingpoint;if(newWideLayout!==wideLayout){if(activeSidebar==true){disableSidebar();} wideLayout=!wideLayout;}} async function toggleBurger(){if(activeSidebar==true){disableSidebar();}else{activateSidebar();}}