var selectLocation = ["Canada", "China", "France", "Germany"]; var selectLocation2 = ["China"]; $(function() { $(".dropdown").mouseover(function () { $(this).addClass("open"); }); $(".dropdown").mouseleave(function(){ $(this).removeClass("open"); }) var selectDisciplines = [" Masterplanning"," Architecture"," Interiors", "Lighting"," Landscape"," AV & Acoustics"," MEP"," Art work & Accessories"," Graphics & Signage"," Branding"," Furniture, Lighting"]; var newestList = window.localStorage.getItem("newestList") var resentlist = window.localStorage.getItem("resentlist") var trendinglist = [ "Interior", "Architecture", "Masterplanning", "Lighting", "Landscape", "Acoustics", "MEP", "Art work & Accessories", ] if(newestList==null){ newestList=[...selectDisciplines] window.localStorage.setItem("newestList", JSON.stringify(newestList)) }else{ newestList = JSON.parse(newestList) } addlistNewest(".newest-list-pro",newestList) addlistBtn(".trendinglist", trendinglist) if (resentlist) { resentlist = JSON.parse(resentlist) addlistBtn(".resentlist", resentlist) } else { resentlist = [] } $(".newest-list-pro").on("click", '.newest-item-x', function() { var name=$(this).parent().find(".query").text() var k2=newestList.indexOf(name) if (k2 != -1) { newestList.splice(k2, 1) } window.localStorage.setItem("newestList", JSON.stringify(newestList)) $(this).parent().remove() }) $(".search-item").on("click", '.querybtnli', function() { var value = $(this).text() $(".landingpage_search").val(value); $(".querybtn").click() }) $(".querybtn").click(function() { resentlistAdd($(".landingpage_search").val()) }) $(".querybtn2").click(function() { resentlistAdd($(".landingpage_search").val()) }) function resentlistAdd(name) { if (name) { var k = resentlist.indexOf(name) var k2=newestList.indexOf(name) if (k != -1) { resentlist.splice(k, 1) } if (k2 != -1) { newestList.splice(k2, 1) } var i = resentlist.unshift(name) newestList.unshift(name) var num = 4 if (i > num) { resentlist = resentlist.slice(0, num) } window.localStorage.setItem("resentlist", JSON.stringify(resentlist)) window.localStorage.setItem("newestList", JSON.stringify(newestList)) } addlistNewest(".newest-list-pro",newestList) addlistBtn(".resentlist", resentlist) $("#project-photo-row").empty(); $.getJSON("../../assets/js/landingpage_photos.json", function(data) { data = data.sort(() => { return Math.random() > 0.5 ? -1 : 1 }) const tmphtml = template("flow-photos", { photos: data }); $("#project-photo-row").append(tmphtml); }); } addlistSelect(".selectDisciplines", selectDisciplines) addlistSelect(".selectLocation", selectLocation) function addlistNewest(name, list) { $(name).empty() list.forEach(function(item) { var btn = $('