|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797 |
- //全局的年月日,适用于任何时候获取今天的年月日。(很重要)
- var sev_m, sev_y, sev_d, active = 3;
- // mySwiper.destroy(deleteInstance, cleanupStyles)
- var mySwiper = null;
-
- var yl = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- var swiperHtml = $('#swiperBox').html();
- //判断农历
- var LunarDate = {
- madd: new Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334),
- HsString: '甲乙丙丁戊己庚辛壬癸',
- EbString: '子丑寅卯辰巳午未申酉戌亥',
- NumString: "一二三四五六七八九十",
- MonString: "正二三四五六七八九十冬腊",
- CalendarData: new Array(0xA4B, 0x5164B, 0x6A5, 0x6D4, 0x415B5, 0x2B6, 0x957, 0x2092F, 0x497, 0x60C96, 0xD4A,
- 0xEA5, 0x50DA9, 0x5AD, 0x2B6, 0x3126E, 0x92E, 0x7192D, 0xC95, 0xD4A, 0x61B4A, 0xB55, 0x56A, 0x4155B,
- 0x25D, 0x92D, 0x2192B, 0xA95, 0x71695, 0x6CA, 0xB55, 0x50AB5, 0x4DA, 0xA5B, 0x30A57, 0x52B, 0x8152A,
- 0xE95, 0x6AA, 0x615AA, 0xAB5, 0x4B6, 0x414AE, 0xA57, 0x526, 0x31D26, 0xD95, 0x70B55, 0x56A, 0x96D,
- 0x5095D, 0x4AD, 0xA4D, 0x41A4D, 0xD25, 0x81AA5, 0xB54, 0xB6A, 0x612DA, 0x95B, 0x49B, 0x41497, 0xA4B,
- 0xA164B, 0x6A5, 0x6D4, 0x615B4, 0xAB6, 0x957, 0x5092F, 0x497, 0x64B, 0x30D4A, 0xEA5, 0x80D65, 0x5AC,
- 0xAB6, 0x5126D, 0x92E, 0xC96, 0x41A95, 0xD4A, 0xDA5, 0x20B55, 0x56A, 0x7155B, 0x25D, 0x92D, 0x5192B,
- 0xA95, 0xB4A, 0x416AA, 0xAD5, 0x90AB5, 0x4BA, 0xA5B, 0x60A57, 0x52B, 0xA93, 0x40E95),
- Year: null,
- Month: null,
- Day: null,
- TheDate: null,
- GetBit: function (m, n) {
- return (m >> n) & 1;
- },
- e2c: function () {
- this.TheDate = (arguments.length != 3) ? new Date() : new Date(arguments[0], arguments[1], arguments[
- 2]);
- var total, m, n, k;
- var isEnd = false;
- var tmp = this.TheDate.getFullYear();
- total = (tmp - 1921) * 365 + Math.floor((tmp - 1921) / 4) + this.madd[this.TheDate.getMonth()] + this
- .TheDate.getDate() - 38;
- if (this.TheDate.getYear() % 4 == 0 && this.TheDate.getMonth() > 1) {
- total++;
- }
- for (m = 0; ; m++) {
- k = (this.CalendarData[m] < 0xfff) ? 11 : 12;
- for (n = k; n >= 0; n--) {
- if (total <= 29 + this.GetBit(this.CalendarData[m], n)) {
- isEnd = true;
- break;
- }
- total = total - 29 - this.GetBit(this.CalendarData[m], n);
- }
- if (isEnd)
- break;
- }
- this.Year = 1921 + m;
- this.Month = k - n + 1;
- this.Day = total;
- if (k == 12) {
- if (this.Month == Math.floor(this.CalendarData[m] / 0x10000) + 1) {
- this.Month = 1 - this.Month;
- }
- if (this.Month > Math.floor(this.CalendarData[m] / 0x10000) + 1) {
- this.Month--;
- }
- }
- },
- GetcDateString: function (tip) {
- if (tip == 1) {
- var ts = (this.Day < 11) ? "初" : ((this.Day < 20) ? "十" : ((this.Day < 30) ? "廿" : "三十"));
- if (this.Day % 10 != 0 || this.Day == 10) {
- ts += this.NumString.charAt((this.Day - 1) % 10);
- }
- return ts;
- }
- var tmp = "";
- if (this.Month < 1) {
- tmp += this.MonString.charAt(-this.Month - 1);
- } else {
- tmp += this.MonString.charAt(this.Month - 1);
- }
- tmp += "月";
- tmp += (this.Day < 11) ? "初" : ((this.Day < 20) ? "十" : ((this.Day < 30) ? "廿" : "三十"));
- if (this.Day % 10 != 0 || this.Day == 10) {
- tmp += this.NumString.charAt((this.Day - 1) % 10);
- }
-
- return tmp;
- },
- GetLunarDay: function (solarYear, solarMonth, solarDay) {
- if (solarYear < 1921 || solarYear > 2020) {
- return "";
- } else {
- solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
- this.e2c(solarYear, solarMonth, solarDay);
- return this.GetcDateString(0);
- }
- },
- GetLunarDayDetail: function (solarYear, solarMonth, solarDay) {
- if (solarYear < 1921 || solarYear > 2020) {
- return "";
- } else {
- solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
- this.e2c(solarYear, solarMonth, solarDay);
- return this.GetcDateString(1);
- }
- }
- };
-
- $(function () {
-
- $(".prorup").on("click", function () {
- $(".prorup").hide();
- $(".jie").hide();
- $(".layer").hide();
- });
-
- $(".jqclass").click(function () {
- var riziss = $(this).attr('data');
- var srt = riziss.split("-");
- $(".prorup").hide();
- $(".layer").hide();
- jump(srt[0], srt[1], srt[2]);
- $(".jie").hide();
- });
-
- });
-
- function jump(yyyy, mm, dd) {
- sev_y = parseInt(yyyy);
- sev_m = parseInt(mm);
- sev_d = parseInt(dd);
-
- active = 3;
- var globledate = new Date(yyyy, parseInt(mm) - 1, parseInt(dd));
- //var nowweak = globledate.getDay();
- var y = globledate.getFullYear();
- var m = globledate.getMonth() + 1;
- var d = globledate.getDate();
- //console.log("globledate:",y,m,d);
-
- var sev_m_tmp = m;
- var sev_y_tmp = y;
- var sev_d_tmp = d;
- var nowweak = new Date(y, m - 1, 1).getDay();
- if (nowweak == 7) nowweak = 0;
- get_first(nowweak, y, m, d, "d3");
-
- m = m + 1;
- if (m > 12) {
- m = 1;
- y += 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d4");
-
- m = sev_m - 1;
- if (m < 1) {
- m = 12;
- y = sev_y - 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d2");
-
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- $(".covers").hide();
- mySwiper.slideTo(2, 500, false);
- click_sev();
-
- }
-
- function click_sev() {
- $("#d3").find("td").each(function () {
- if ($(this).attr("data_y") == sev_y && $(this).attr("data_m") == sev_m && $(this).attr("data_d") ==
- sev_d) {
- $(this).click();
- }
- });
- }
-
- function get_first(a, b, c, d, e) {
- var str = '<tr>';
- if ((c - 2) < 0) {
- var ldays = 31;
- var lm = 12;
- var lb = b - 1;
- } else {
- var ldays = yl[c - 2];
- var lm = c - 1;
- var lb = b;
- }
-
- if (c == 12) {
- var xdays = 31;
- var xm = 1;
- var xb = b + 1;
- } else {
- var xdays = yl[c];
- var xm = c + 1;
- var xb = b;
- }
-
- if (ldays == 28) {
- if ((lb % 4 == 0 && lb % 100 != 0) || (lb % 100 == 0 && lb % 400 == 0)) {
- ldays = 29;
- }
- }
-
- if (xdays == 28) {
- if ((xb % 4 == 0 && xb % 100 != 0) || (xb % 100 == 0 && xb % 400 == 0)) {
- xdays = 29;
- }
- }
- var dd;
- if (yl[c - 1] == 28) {
- if ((b % 4 == 0 && b % 100 != 0) || (b % 100 == 0 && b % 400 == 0)) {
- dd = 29;
- } else {
- dd = 28;
- }
- } else {
- dd = yl[c - 1];
- }
-
- var num = 1;
-
- for (var i = a; i > 0; i--) {
- var bday = ldays - i + 1;
- var ly = LunarDate.GetLunarDayDetail(lb, lm, bday);
-
- //修改
- var jqs = getjqs(lb, lm, bday);
- var ss = '';
- if (jqs) {
- //ly加状态
- if (jqs.state == 1) {
- ss = 'active yellow';
- } else if (jqs.state == 2) {
- ss = 'active green';
- } else if (jqs.state == 3) {
- ss = 'active blue';
- }
-
- numI = '<font color="">' + numI;
- }
- var jd = "";
- var hb = lb + "-" + lm + "-" + bday;
- str += ' <td data_y="' + lb + '" data_m="' + lm + '" data_d="' + bday + '" class="list not_this js_up ' + ss +
- '"><i>' + bday + '</i>' + jd + '</td>';
- // str += ' <td data_y="' + lb + '" data_m="' + lm + '" data_d="' + bday + '" class="list not_this js_up"><i></i>' + jd + '</td>';
- if (num % 7 == 0) {
- str += '</tr><tr>';
- }
- num++;
- }
- // 动态写入日期
- for (var i = 1; i <= dd; i++) {
- var bday = ldays - i + 1;
- var ly = LunarDate.GetLunarDayDetail(b, c, i);
- var numI = i
- var jqs = getjqs(b, c, i);
- //console.log(jqs)
- //修改
- var ss = '';
- if (jqs) {
- //ly加状态
- if (jqs.state == 1) {
- // console.log(b, c, i)
- ss = 'active yellow';
- } else if (jqs.state == 2) {
- ss = 'active green';
- } else if (jqs.state == 3) {
- ss = 'active blue';
- }
-
- numI = '<font color="">' + numI;
- }
- var jd = "";
- var hb = b + "-" + c + "-" + i;
- if (new Date().getDate() == i && b == new Date().getFullYear() && c == (new Date().getMonth() + 1)) {
- str += ' <td data_y="' + b + '" data_m="' + c + '" data_d="' + i + '" class="list today ' + ss +
- '"><i>' + numI + '</i>' + jd + '</td>';
- // console.log(numI)
- } else {
- str += ' <td data_y="' + b + '" data_m="' + c + '" data_d="' + i + '" class="list ' + ss + '"><i>' +
- numI + '</i>' + jd + '</td>';
- //console.log(jd)
- }
-
- if (num % 7 == 0) {
- str += '</tr><tr>';
- }
- num++;
- }
-
- //插入季节
- var last = 42 - a - dd;
- if (last <= 6) {
-
- for (var i = 1; i <= last; i++) {
- var ly = LunarDate.GetLunarDayDetail(xb, xm, i);
- var jd = "";
- var hb = xb + "-" + xm + "-" + i;
- str += ' <td data_y="' + xb + '" data_m="' + xm + '" data_d="' + i +
- '" class="list not_this js_down"><i>' + i + '</i>' + jd + '</td>';
- if (num % 7 == 0) {
- str += '</tr><tr>';
- }
- num++;
- }
- }
- if (str.substring(str.length - 4, str.length) == "<tr>") {
- str = str.substring(0, str.length - 4);
- }
- // console.log(document.getElementById(e))
- document.getElementById(e).innerHTML = str;
-
- bind_click(e);
- }
-
- function bind_click(a) {
- // console.log(a)
- $("#" + a).find("td").unbind("click");
- $("#" + a).find("td").each(function () {
- if ($(this).hasClass('not_this')) {
- $(this).click(function () {
- jump($(this).attr('data_y'), $(this).attr('data_m'), $(this).attr('data_d'));
- });
- } else {
- $(this).click(function () {
- set_top($(this));
- });
- }
- });
- }
-
- function set_top(a) {
- if (!a) {
- var weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'];
- var data = new Date();
- var weekk = weeks[data.getDay() - 1];
- var yue = LunarDate.GetLunarDay(data.getFullYear(), data.getMonth() + 1, data.getDate());
- var shu = data.getDate();
- document.getElementById("top_shu").innerHTML = shu;
- sev_d = parseInt(shu);
- document.getElementById("top_week").innerHTML = weekk;
- document.getElementById("top_yue").innerHTML = yue;
- } else {
- var weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
- var y = a.attr("data_y");
- var m = parseInt(a.attr("data_m")) - 1;
- if (m < 0) m = 11;
- var d = parseInt(a.attr("data_d"));
- var weekk = weeks[new Date(y, m, d).getDay()];
- var ms = parseInt(a.attr("data_m"));
- var yue = LunarDate.GetLunarDay(y, ms, d);
- document.getElementById("top_shu").innerHTML = d;
- sev_d = parseInt(d);
- document.getElementById("top_week").innerHTML = weekk;
- document.getElementById("top_yue").innerHTML = yue;
- $(".xuanzhong").removeClass('xuanzhong');
- a.addClass("xuanzhong");
- }
- // console.log(d,weekk,yue)
- }
-
- $('.date').on('click', function () {
-
- $('.tc').show();
- $('.tc-innner').show();
-
- tc();
-
- });
-
- var e = 1;
-
- function tc() {
- var b, c, d;
- var myDate = new Date();
-
- if (e == 0) {
- b = myDate.getFullYear() - 2000;
- c = myDate.getMonth();
- d = myDate.getDate() - 1;
-
- } else {
- b = sev_y - 2000;
- c = sev_m - 1;
- d = sev_d - 1;
-
-
- }
- e = 1;
- var mySwiper = new Swiper('.swiper-container2', {
- direction: 'vertical',
- initialSlide: b,
- slidesPerView: 'auto',
- roundLengths: true,
- centeredSlides: true,
-
- watchSlidesProgress: true,
- watchSlidesVisibility: true,
-
- freeMode: true,
- freeModeMomentumRatio: 1,
- freeModeSticky: true,
- onTouchMove: function (swiper) {
- var b1 = $('.year').children('.swiper-slide-active').html();
- $('.i-year').html(b1);
- },
- onSlideChangeEnd: function (swiper) {
- var b1 = $('.year').children('.swiper-slide-active').html();
- $('.i-year').html(b1);
- },
-
-
- });
- var mySwiper = new Swiper('.swiper-container3', {
- direction: 'vertical',
- initialSlide: c,
- slidesPerView: 'auto',
- roundLengths: true,
- centeredSlides: true,
-
- watchSlidesProgress: true,
- watchSlidesVisibility: true,
-
- freeMode: true,
- freeModeMomentumRatio: 1,
- freeModeSticky: true,
- onTouchMove: function (swiper) {
- var b1 = $('.month').children('.swiper-slide-active').html();
- $('.i-month').html(b1);
- },
- onSlideChangeEnd: function (swiper) {
- var b1 = $('.month').children('.swiper-slide-active').html();
- $('.i-month').html(b1);
- },
-
-
- });
- var mySwiper = new Swiper('.swiper-container4', {
- direction: 'vertical',
- initialSlide: d,
- slidesPerView: 'auto',
- roundLengths: true,
- centeredSlides: true,
-
- watchSlidesProgress: true,
- watchSlidesVisibility: true,
-
- freeMode: true,
- freeModeMomentumRatio: 1,
- freeModeSticky: true,
- onTouchMove: function (swiper) {
- var b1 = $('.date').children('.swiper-slide-active').html();
- $('.i-date').html(b1);
- },
- onSlideChangeEnd: function (swiper) {
- var b1 = $('.date').children('.swiper-slide-active').html();
- $('.i-date').html(b1);
- },
-
- });
- };
-
- $('.tc-bot-left').click(function () {
- e = 0;
- tc();
- });
- $('.tc-bot-right').click(function () {
- $('.tc').hide();
- $('.tc-innner').hide();
- var yyyy = parseInt($('.year').children('.swiper-slide-active').html());
- var mm = parseInt($('.month').children('.swiper-slide-active').html());
- var dd = parseInt($('.date').children('.swiper-slide-active').html());
- if (mm != sev_m || yyyy != sev_y || dd != sev_d) {
- jump(yyyy, mm, dd);
-
- };
-
-
-
- });
- $(".tc").on("click", function () {
- $(".tc-innner").hide();
- $(this).hide();
- });
- //判断时间
- function getjqs(yyyy, mm, dd) {
- var solarTerms = "";
- $.each(dataK, function (i, n) {
- if (yyyy == n.y && mm == n.m && dd == n.d) {
- solarTerms = n;
- }
- })
- return solarTerms;
- }
- //日历初始化
- function calenderInit(LunarDate) {
- if (mySwiper) {
- mySwiper.destroy();
- $('#swiperBox').html(swiperHtml)
- }
- mySwiper = new Swiper('.swiper-container', {
- initialSlide: 1,
- loop: true,
- speed: 400,
- followFinger: false,
- prevButton: '.js_prev',
- nextButton: '.js_next',
- onSlideChangeStart: function (swiper) {
- //swiper.params.allowSwipeToPrev = false;
- swiper.lockSwipes();
-
- },
-
- onSlideChangeEnd: function (swiper) {
- var nows = $(".swiper-slide-active").find("table").attr("id");
- // console.log(active,nows);
-
- if (nows == 'now2')
- return;
- nows = parseInt(nows.substr(1, 1));
-
- if (nows == active)
- return;
- if (active == 4 && nows == 5) {
- var fors = 1;
-
- sev_m++;
- if (sev_m > 12) {
- sev_m = 1;
- sev_y++;
- }
- var nowweak = new Date(sev_y, sev_m - 1, 1).getDay();
- get_first(nowweak, sev_y, sev_m, 0, "d2");
-
- var lastm = sev_m - 1;
- var lasty = sev_y;
- if (lastm < 1) {
- lastm = 12;
- lasty--;
- }
-
- var nm = sev_m + 1;
- var ny = sev_y;
- if (nm > 12) {
- nm = 1;
- ny++;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- var lastweek = new Date(lasty, lastm - 1, 1).getDay();
- get_first(lastweek, lasty, lastm, 0, "d" + fors);
- get_first(nowweak, ny, nm, 0, "d3");
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 5;
- } else if (active == 2 && nows == 1) {
- var fors = 5;
-
- var nextweak = new Date(sev_y, sev_m - 1, 1).getDay();
- get_first(nextweak, sev_y, sev_m, 0, "d" + fors);
- sev_m--;
- if (sev_m < 1) {
- sev_m = 12;
- sev_y--;
- }
- var nowweak = new Date(sev_y, sev_m - 1, 1).getDay();
- get_first(nowweak, sev_y, sev_m, 0, "d4");
-
- var nm = sev_m - 1;
- var ny = sev_y;
- if (nm < 1) {
- nm = 12;
- ny--;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- //get_first(nowweak, ny, nm, 0, "d4");
- get_first(nowweak, ny, nm, 0, "d3");
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 1;
- } else if (active == 5 && nows == 3) {
- var fors = 4;
-
- var lastm = sev_m;
- var lasty = sev_y;
-
- sev_m++;
- if (sev_m > 12) {
- sev_m = 1;
- sev_y++;
- }
-
- var nm = sev_m + 1;
- var ny = sev_y;
- if (nm > 12) {
- nm = 1;
- ny++;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- var nowweak = new Date(lasty, lastm - 1, 1).getDay();
- get_first(nowweak, lasty, lastm, 0, "d2");
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 3;
- } else if (active == 1 && nows == 3) {
- var fors = 2;
-
- var lastm = sev_m;
- var lasty = sev_y;
-
- sev_m--;
- if (sev_m < 1) {
- sev_m = 12;
- sev_y--;
- }
-
- var nm = sev_m - 1;
- var ny = sev_y;
- if (nm < 1) {
- nm = 12;
- ny--;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- var nowweak = new Date(lasty, lastm - 1, 1).getDay();
- get_first(nowweak, lasty, lastm, 0, "d4");
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 3;
- } else if (active == 1 && nows == 5) {
- var fors = 3;
-
- var lastm = sev_m;
- var lasty = sev_y;
-
- sev_m++;
- if (sev_m > 12) {
- sev_m = 1;
- sev_y++;
- }
-
- var nm = sev_m + 1;
- var ny = sev_y;
- if (nm > 12) {
- nm = 1;
- ny++;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 5;
- } else if (active == 5 && nows == 1) {
- var fors = 3;
-
-
- sev_m--;
- if (sev_m < 1) {
- sev_m = 12;
- sev_y--;
- }
- var lastm = sev_m;
- var lasty = sev_y;
-
- var nm = sev_m - 1;
- var ny = sev_y;
- if (nm < 1) {
- nm = 12;
- ny--;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- var lastweak = new Date(lasty, sev_m - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- get_first(lastweak, lasty, sev_m, 0, "d4");
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = 1;
- } else if (active > nows) {
- var fors = nows - 1;
- if (fors < 1)
- fors = 5;
-
- sev_m--;
- if (sev_m < 1) {
- sev_m = 12;
- sev_y--;
- }
-
- var nm = sev_m - 1;
- var ny = sev_y;
- if (nm < 1) {
- nm = 12;
- ny--;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = nows;
- } else if (active < nows) {
- var fors = nows + 1;
- if (fors > 5)
- fors = 1;
-
- sev_m++;
- if (sev_m > 12) {
- sev_m = 1;
- sev_y++;
- }
-
- var nm = sev_m + 1;
- var ny = sev_y;
- if (nm > 12) {
- nm = 1;
- ny++;
- }
- var nowweak = new Date(ny, nm - 1, 1).getDay();
- get_first(nowweak, ny, nm, 0, "d" + fors);
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- active = nows;
- }
- var trLength = $("#d" + nows).find("tr").length;
- if (trLength == 6) {
- $(".swiper-container").css("paddingBottom", ".45rem");
- } else {
- $(".swiper-container").css("paddingBottom", "");
-
- }
- swiper.unlockSwipes();
- }
-
- })
- $("#now3").attr("id", "d1");
- $("#now1").attr("id", "d2");
- $("#now2").attr("id", "d3");
- $("#now3").attr("id", "d4");
- $("#now1").attr("id", "d5");
- var globledate = new Date();
- var y = globledate.getFullYear();
- var m = globledate.getMonth() + 1;
- var d = globledate.getDate();
- sev_m = m;
- sev_y = y;
- sev_d = d;
- var nowweak = new Date(y, m - 1, 1).getDay();
- if (nowweak == 7) nowweak = 0;
- get_first(nowweak, y, m, d, "d3");
- set_top(0);
-
- m = m + 1;
- if (m > 12) {
- m = 1;
- y += 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d4");
-
- m = sev_m - 1;
- if (m < 1) {
- m = 12;
- y = sev_y - 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d2");
-
- $("#ymym").html(sev_y + "年" + sev_m + "月");
-
- $(".js_jin").click(function () {
- active = 3;
- var globledate = new Date();
- var y = globledate.getFullYear();
- var m = globledate.getMonth() + 1;
- var d = globledate.getDate();
- sev_m = m;
- sev_y = y;
- sev_d = d;
- var nowweak = new Date(y, m - 1, 1).getDay();
- if (nowweak == 7) nowweak = 0;
- get_first(nowweak, y, m, d, "d3");
- set_top(0);
-
- m = m + 1;
- if (m > 12) {
- m = 1;
- y += 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d4");
-
- m = sev_m - 1;
- if (m < 1) {
- m = 12;
- y = sev_y - 1;
- }
- nowweak = new Date(y, m - 1, 1).getDay();
- get_first(nowweak, y, m, 0, "d2");
-
- $("#ymym").html(sev_y + "年" + sev_m + "月");
- mySwiper.slideTo(2, 500, false);
- });
- mySwiper.unlockSwipes();
- }
|