1const bernKey = "bernLastValidatedDate"; 2const rewarningIntervalMonth = 6; 3const rewarningIntervalSeconds = 86400; 4const cautionMessage = "æ¥å¸¸çæ´»ã§å ãããã¨ãå¤ãã§ããï¼"; 5 6const preRetrieval = () => { 7 const frm = document.getElementById("rsvform"); 8 frm.submit(); 9}; 10 11const settings = [ 12 { 13 id: "rsvsearch", message: cautionMessage, cautionFor: "ã¯ã", 14 preY: null, hrefY: "./#notice", preN: preRetrieval, hrefN: "" 15 },/*ããããã¼ã¸ç©ºå®¤æ¤ç´¢*/ 16 { 17 id: "rsvvacant", message: cautionMessage, cautionFor: "ã¯ã", 18 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/r.asp" 19 },/*nav-menu--ç©ºå®¤ç¶æ³--pc*/ 20 { 21 id: "rsvbook", message: cautionMessage, cautionFor: "ã¯ã", 22 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp" 23 },/*nav-menu--宿æ³ãã©ã³--pc*/ 24 { 25 id: "sp-rsvvacant", message: cautionMessage, cautionFor: "ã¯ã", 26 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/r.asp" 27 },/*nav-menu--ç©ºå®¤ç¶æ³--sp*/ 28 { 29 id: "sp-rsvbook", message: cautionMessage, cautionFor: "ã¯ã", 30 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp" 31 },/*nav-menu--宿æ³ãã©ã³--sp*/ 32 { 33 id: "rsvcasual", message: cautionMessage, cautionFor: "ã¯ã", 34 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O58" 35 },/*ã«ã¸ã¥ã¢ã«ã³ã¼ã¹*/ 36 { 37 id: "rsvfull", message: cautionMessage, cautionFor: "ã¯ã", 38 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O6" 39 },/*ãã¾ããã³ã¼ã¹*/ 40 { 41 id: "rsvtongue", message: cautionMessage, cautionFor: "ã¯ã", 42 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O9" 43 },/*ã¿ã³ã·ãã¥ã¼*/ 44 { 45 id: "rsvbouillabaisse", message: cautionMessage, cautionFor: "ã¯ã", 46 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O8" 47 },/*ãã¤ã¤ãã¼ã¹*/ 48 { 49 id: "rsvsteak", message: cautionMessage, cautionFor: "ã¯ã", 50 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O56" 51 },/*ã¹ãã¼ã*/ 52 { 53 id: "rsvcheese", message: cautionMessage, cautionFor: "ã¯ã", 54 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O7" 55 },/*ãã¼ãºãã©ã³ãã¥*/ 56 { 57 id: "rsvpaella", message: cautionMessage, cautionFor: "ã¯ã", 58 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?O36" 59 },/*ãã¨ãªã¢*/ 60 { 61 id: "rsvtwin", message: cautionMessage, cautionFor: "ã¯ã", 62 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?L2" 63 },/*ãã¤ã³ã«ã¼ã */ 64 { 65 id: "rsvtriple", message: cautionMessage, cautionFor: "ã¯ã", 66 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?L9" 67 },/*ããªãã«ã«ã¼ã */ 68 { 69 id: "rsvdeluxe", message: cautionMessage, cautionFor: "ã¯ã", 70 preY: null, hrefY: "../#notice", preN: null, hrefN: "https://www.tenawan.ne.jp/lodgment/rec/004/634/pl.asp?L10" 71 },/*ãã©ãã¯ã¹ãã¤ã³ã«ã¼ã */ 72]; 73 74const okCheck = () => { 75 const strLastDate = JSON.parse(localStorage.getItem(bernKey)); 76 if (!strLastDate) return false; 77 const lastDate = new Date(strLastDate); 78 const currentDate = new Date(); 79 return (currentDate.getTime() - lastDate.getTime() < rewarningIntervalSeconds*1000); 80 // return (currentDate.getTime() - lastDate.getTime() < rewarningIntervalMonth*30*24*60*60*1000); 81}; 82const okSave = () => { 83 localStorage.setItem(bernKey, JSON.stringify(new Date())); 84}; 85 86const doSet = ({ id, message, cautionFor, preY, hrefY, preN, hrefN }) => { 87 const [hrefCaution, hrefTransition] = (cautionFor == "ã¯ã" ?[hrefY, hrefN] : [hrefN, hrefY]); 88 const [preCaution, preTransition] = (cautionFor == "ã¯ã" ? [preY,preN] : [preN, preY]); 89 const element = document.getElementById(id); 90 if (element == null) return; 91 const onClick = async (event) => { 92 if (okCheck()) { 93 okSave(); 94 if (preTransition) preTransition(); 95 if (hrefTransition) window.location.href = hrefTransition; 96 } else { 97 const ret = await getChoiceWithDialog(message, "ã¯ã", "ããã"); 98 switch (ret) { 99 case null: 100 break; 101 case cautionFor: 102 if (preCaution) preCaution(); 103 if (hrefCaution) window.location.href = hrefCaution; 104 break; 105 default: 106 okSave(); 107 if (preTransition) preTransition(); 108 if (hrefTransition) window.location.href = hrefTransition; 109 break; 110 };
111 const nav = document.getElementById("drawer-nav"); 112 if (nav){ 113 nav.setAttribute("aria-hidden","true"); 114 } 115 }; 116 }; 117 element.addEventListener('click', onClick); 118}; 119 120const removeKey = () => { 121 localStorage.removeItem(bernKey); 122}; 123 124const getChoiceWithDialog = (message, ...buttonCaptions) => { 125 return new Promise( 126 (resolve, reject) => { 127 const dialog = document.createElement("dialog"); 128 const p = document.createElement("p"); 129 p.innerHTML = message; 130 dialog.appendChild(p); 131 132 const div = document.createElement("div"); 133 div.style.display = "flex"; 134 buttonCaptions.forEach((caption) => { 135 const button = document.createElement("button"); 136 button.innerHTML = caption; 137 button.addEventListener("click", event => {dialog.close(); resolve(caption); }); 138 div.appendChild(button); 139 }); 140 dialog.appendChild(div); 141 document.body.appendChild(dialog); 142 143 dialog.addEventListener("close", event => {dialog.remove(); resolve(null); }); 144 dialog.showModal(); 145 } 146 ); 147}; 148 149const makeSelectYM = () => { 150 const selectym = document.getElementById("selectym"); 151 if (selectym == null) return; 152 153 const date = new Date(); 154 let year = date.getFullYear(); 155 const thismonth = date.getMonth() + 1; 156 for (let i = 0, month = thismonth; i < 6; i++) { 157 const op = document.createElement("option"); 158 op.setAttribute("value", (year - 2000) * 100 + month); if 159 (month == thismonth) op.setAttribute("selected", ""); 160 op.innerText = year + "å¹´" + month + "æ"; 161 month++; if (month == 13) { month = 1; year++; }; 162 selectym.append(op); 163 }; 164}; 165 166const makeSelectD = () => { 167 const selectd = document.getElementById("selectd"); 168 if (selectd == null) return; 169 const date = new Date(); 170 const today = date.getDate(); 171 const lastday = 31; 172 for (let i = 1; i <= lastday; i++) { 173 const op = document.createElement("option"); 174 op.setAttribute("value", i); 175 if (i == today) 176 op.setAttribute("selected", ""); 177 op.innerText = i + "æ¥"; 178 selectd.append(op); 179 }; 180}; 181 182const init = () => { 183 settings.forEach(doSet); 184 makeSelectYM(); 185 makeSelectD(); 186}; 187 188document.addEventListener('DOMContentLoaded', init);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.