|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
var LunarDate = {
|
|
|
|
|
/** unfetch */
|
|
|
|
|
self.fetch||(self.fetch=function(e,n){return n=n||{},new Promise(function(t,s){var r=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:function(){return Promise.resolve(r.responseText)},json:function(){return Promise.resolve(JSON.parse(r.responseText))},blob:function(){return Promise.resolve(new Blob([r.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var c in r.open(n.method||"get",e,!0),r.onload=function(){r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+","+t:t}),t(a())},r.onerror=s,r.withCredentials="include"==n.credentials,n.headers)r.setRequestHeader(c,n.headers[c]);r.send(n.body||null)})});
|
|
|
|
|
|
|
|
|
|
var LunarDate = {
|
|
|
|
|
madd: new Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334),
|
|
|
|
|
HsString: '甲乙丙丁戊己庚辛壬癸',
|
|
|
|
|
EbString: '子丑寅卯辰巳午未申酉戌亥',
|
|
|
|
@ -198,26 +201,51 @@ function dozodiacsearch() {
|
|
|
|
|
//获取到的年份-1900的基数,与12求余
|
|
|
|
|
var remainder = (lunarYear - 1900) % 12;
|
|
|
|
|
//根据求余的数确定生肖
|
|
|
|
|
zodiacList = [
|
|
|
|
|
rat, ox, tiger, rabbit, dragon, snake,
|
|
|
|
|
horse, goat, monkey, rooster, dog, pig
|
|
|
|
|
];
|
|
|
|
|
var zodiac = zodiacList[remainder];
|
|
|
|
|
document.getElementById('zodiacYear').innerText = 'Your Luck in 2021';
|
|
|
|
|
document.getElementById('zodiacName').innerText = zodiac.name;
|
|
|
|
|
document.getElementById('zodiacLuckyNumbers').innerText = zodiac.luckyNumbers;
|
|
|
|
|
document.getElementById('zodiacLuckyColors').innerText = zodiac.luckyColors;
|
|
|
|
|
//直接读取数据库数据,2021-12-10 zp
|
|
|
|
|
fetch("https://www.chinahighlights.com/guide-use.php/travelguide/getzodiac/")
|
|
|
|
|
.then(function(response){
|
|
|
|
|
//console.log(response.json());
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
return response.json();
|
|
|
|
|
} else {
|
|
|
|
|
var error = new Error(response.statusText);
|
|
|
|
|
error.response = response;
|
|
|
|
|
return Promise.reject(error);
|
|
|
|
|
}
|
|
|
|
|
}).then(function(data){
|
|
|
|
|
if (data.length>0){
|
|
|
|
|
var zodiac = data[remainder-1];
|
|
|
|
|
document.getElementById('zodiacName').innerText = zodiac.LNY_SX;
|
|
|
|
|
document.getElementById('Personality').innerText = zodiac.LNY_Characters;
|
|
|
|
|
document.getElementById('zodiacLuckyNumbers').innerText = zodiac.LNY_LuckyNumber;
|
|
|
|
|
document.getElementById('zodiacLuckyColors').innerText = zodiac.LNY_LuckyColor;
|
|
|
|
|
document.getElementById('zodiacLuckyFlowers').innerText = zodiac.LNY_LuckyFlower;
|
|
|
|
|
document.getElementById('idzodiac').style.display = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// zodiacList = [
|
|
|
|
|
// rat, ox, tiger, rabbit, dragon, snake,
|
|
|
|
|
// horse, goat, monkey, rooster, dog, pig
|
|
|
|
|
// ];
|
|
|
|
|
// var zodiac = zodiacList[remainder];
|
|
|
|
|
// document.getElementById('zodiacYear').innerText = 'Your Luck in 2021';
|
|
|
|
|
// document.getElementById('zodiacName').innerText = zodiac.name;
|
|
|
|
|
// document.getElementById('zodiacLuckyNumbers').innerText = zodiac.luckyNumbers;
|
|
|
|
|
// document.getElementById('zodiacLuckyColors').innerText = zodiac.luckyColors;
|
|
|
|
|
|
|
|
|
|
document.getElementById('zodiacWork').setAttribute("src", zodiac.work);
|
|
|
|
|
document.getElementById('zodiacWealth').setAttribute("src", zodiac.wealth);
|
|
|
|
|
document.getElementById('zodiacLove').setAttribute("src", zodiac.love);
|
|
|
|
|
document.getElementById('zodiacHealth').setAttribute("src", zodiac.health);
|
|
|
|
|
// document.getElementById('zodiacWork').setAttribute("src", zodiac.work);
|
|
|
|
|
// document.getElementById('zodiacWealth').setAttribute("src", zodiac.wealth);
|
|
|
|
|
// document.getElementById('zodiacLove').setAttribute("src", zodiac.love);
|
|
|
|
|
// document.getElementById('zodiacHealth').setAttribute("src", zodiac.health);
|
|
|
|
|
|
|
|
|
|
var zodiacLink = document.getElementById('zodiacHealth');
|
|
|
|
|
zodiacLink.setAttribute(
|
|
|
|
|
"href",
|
|
|
|
|
"//www.chinahighlights.com/travelguide/chinese-zodiac/" +
|
|
|
|
|
zodiac.name.toLowerCase() + ".htm");
|
|
|
|
|
zodiacLink.innerText = 'More about zodiac "' + zodiac.name + '"';
|
|
|
|
|
document.getElementById('idzodiac').style.display = '';
|
|
|
|
|
// var zodiacLink = document.getElementById('zodiacHealth');
|
|
|
|
|
// zodiacLink.setAttribute(
|
|
|
|
|
// "href",
|
|
|
|
|
// "//www.chinahighlights.com/travelguide/chinese-zodiac/" +
|
|
|
|
|
// zodiac.name.toLowerCase() + ".htm");
|
|
|
|
|
// zodiacLink.innerText = 'More about zodiac "' + zodiac.name + '"';
|
|
|
|
|
// document.getElementById('idzodiac').style.display = '';
|
|
|
|
|
}
|
|
|
|
|