|
@@ -382,6 +382,65 @@ $('.sec-00__close').click(function(){
|
|
|
});
|
|
|
|
|
|
// search
|
|
|
+const imageSearch = document.querySelector('.image-search');
|
|
|
+const imagesSelect = document.querySelectorAll('#pills-img-tab select');
|
|
|
+
|
|
|
+imageSearch.addEventListener("click", function() {
|
|
|
+ searchQueryStr(imagesSelect, 'photos');
|
|
|
+})
|
|
|
+
|
|
|
+const newsSearch = document.querySelector('.news-search');
|
|
|
+const newsSelect = document.querySelectorAll('#pills-news-tab select');
|
|
|
+
|
|
|
+newsSearch.addEventListener("click", function() {
|
|
|
+ searchQueryStr(newsSelect, 'builder');
|
|
|
+});
|
|
|
+
|
|
|
+const caseSearch= document.querySelector('.case-search');
|
|
|
+const caseSelect = document.querySelectorAll('#pills-case-tab select');
|
|
|
+
|
|
|
+caseSearch.addEventListener("click", function() {
|
|
|
+ let query = ''
|
|
|
+ let str = 'https://hhh.com.tw/cases/lists/1-page/new-sort/';
|
|
|
+ if($('#case-shui').val() == '風水') {
|
|
|
+ caseSelect.forEach((item, i) => {
|
|
|
+ if(i < 2) {
|
|
|
+ if(item.value !== ''){
|
|
|
+ query += `/${item.value}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ str = `https://hhh.com.tw/cases/lists${query}/風水-keyword/1-page/`;
|
|
|
+ window.open(str);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ caseSelect.forEach((item, i) => {
|
|
|
+ if(item.value !== ''){
|
|
|
+ query += `/${item.value}`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ str = `https://hhh.com.tw/cases/lists${query}/1-page/`;
|
|
|
+ window.open(str);
|
|
|
+})
|
|
|
+
|
|
|
+const designerSearch = document.querySelector('.designer-search');
|
|
|
+const designerSelect = document.querySelectorAll('#pills-designer-tab select');
|
|
|
+
|
|
|
+designerSearch.addEventListener("click", function() {
|
|
|
+ searchQueryStr(designerSelect, 'designers');
|
|
|
+})
|
|
|
+
|
|
|
+function searchQueryStr(block, link){
|
|
|
+ let query = ''
|
|
|
+ let str = `https://hhh.com.tw/${link}/lists/1-page/`;
|
|
|
+ block.forEach((item, i) => {
|
|
|
+ if(item.value !== ''){
|
|
|
+ query += `/${item.value}`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ str = `https://hhh.com.tw/${link}/lists${query}/1-page/`;
|
|
|
+ window.location.href = str;
|
|
|
+}
|
|
|
|
|
|
const searchBtn = document.querySelector('.dropbox__searchBar__submit');
|
|
|
const searchBar = document.querySelector('.dropbox__searchBar__input');
|
|
@@ -417,7 +476,31 @@ document.addEventListener('lazybeforeunveil', function(e){
|
|
|
});
|
|
|
|
|
|
// city result
|
|
|
-
|
|
|
+let cityResult;
|
|
|
+$.ajax({
|
|
|
+ method: "GET",
|
|
|
+ url: "../json/taiwan_districts.json",
|
|
|
+ dataType: "json",
|
|
|
+}).done(function (msg) {
|
|
|
+ cityResult = [...msg];
|
|
|
+ let str = '';
|
|
|
+ for(let i = 0; i < cityResult.length; i++){
|
|
|
+ str += `<option value="${cityResult[i]['zip']}-city">${cityResult[i]['name']}</option>`;
|
|
|
+ }
|
|
|
+ $('#designer-city').html(`<option value="" selected="selected" disabled>所在縣市</option>${str}`);
|
|
|
+ $('#designer-city').on('change', function() {
|
|
|
+ let selected = $(this).val().split('-')[0];
|
|
|
+ let countyStr = '';
|
|
|
+ for(let i = 0; i < cityResult.length; i++){
|
|
|
+ if(cityResult[i]['zip'] == selected) {
|
|
|
+ for(let j = 0; j < cityResult[i]['districts'].length; j++){
|
|
|
+ countyStr += `<option value="${cityResult[i]['districts'][j]['zip']}-county">${cityResult[i]['districts'][j]['name']}</option>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#designer-country').html(`<option value="" selected="selected" disabled>所在地區</option>${countyStr}`);
|
|
|
+ });
|
|
|
+});
|
|
|
|
|
|
//jQuery time
|
|
|
var current_fs, next_fs, previous_fs; //fieldsets
|