166 lines
9.3 KiB
Diff
166 lines
9.3 KiB
Diff
From 181212c498f1971e577ed053e3c6615a6ffda5ab Mon Sep 17 00:00:00 2001
|
|
From: tanyulong <tanyulong@kylinos.cn>
|
|
Date: Wed, 8 Sep 2021 18:10:23 +0800
|
|
Subject: [PATCH] Fixes an issue with a year jump exception
|
|
|
|
---
|
|
plugin-calendar/html/index-mon.js | 12 ++++++++++++
|
|
plugin-calendar/html/index-solar-cn-mon.js | 12 ++++++++++++
|
|
plugin-calendar/html/index-solar-cn.js | 12 ++++++++++++
|
|
plugin-calendar/html/index-solar-en-mon.js | 12 ++++++++++++
|
|
plugin-calendar/html/index-solar-en.js | 12 ++++++++++++
|
|
plugin-calendar/html/index.js | 15 +++++++++++++--
|
|
6 files changed, 73 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/plugin-calendar/html/index-mon.js b/plugin-calendar/html/index-mon.js
|
|
index 5e3d493..2f023c8 100755
|
|
--- a/plugin-calendar/html/index-mon.js
|
|
+++ b/plugin-calendar/html/index-mon.js
|
|
@@ -1141,6 +1141,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
diff --git a/plugin-calendar/html/index-solar-cn-mon.js b/plugin-calendar/html/index-solar-cn-mon.js
|
|
index c1ffc5d..41fd1e0 100755
|
|
--- a/plugin-calendar/html/index-solar-cn-mon.js
|
|
+++ b/plugin-calendar/html/index-solar-cn-mon.js
|
|
@@ -824,6 +824,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
diff --git a/plugin-calendar/html/index-solar-cn.js b/plugin-calendar/html/index-solar-cn.js
|
|
index 8da433e..ff15715 100755
|
|
--- a/plugin-calendar/html/index-solar-cn.js
|
|
+++ b/plugin-calendar/html/index-solar-cn.js
|
|
@@ -820,6 +820,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
diff --git a/plugin-calendar/html/index-solar-en-mon.js b/plugin-calendar/html/index-solar-en-mon.js
|
|
index 61f9882..0968ca0 100755
|
|
--- a/plugin-calendar/html/index-solar-en-mon.js
|
|
+++ b/plugin-calendar/html/index-solar-en-mon.js
|
|
@@ -819,6 +819,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
diff --git a/plugin-calendar/html/index-solar-en.js b/plugin-calendar/html/index-solar-en.js
|
|
index 5cdee19..f599a51 100755
|
|
--- a/plugin-calendar/html/index-solar-en.js
|
|
+++ b/plugin-calendar/html/index-solar-en.js
|
|
@@ -818,6 +818,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
diff --git a/plugin-calendar/html/index.js b/plugin-calendar/html/index.js
|
|
index 61dbd10..4f8dcd2 100755
|
|
--- a/plugin-calendar/html/index.js
|
|
+++ b/plugin-calendar/html/index.js
|
|
@@ -724,8 +724,7 @@ window.onload = function () {
|
|
if(document.getElementById('year_div').className ==='visible_div')
|
|
{
|
|
var li = document.getElementById('year_div');
|
|
- if(this.id === 'go_prev_month')
|
|
- {
|
|
+ if(this.id === 'go_prev_month') {
|
|
year = year -16;
|
|
year_selector.value = year + '年';
|
|
// selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
@@ -1121,6 +1120,18 @@ function popup_div(event) {
|
|
div.className = 'visible_div';
|
|
document.getElementById('month_div').className = 'hidden_div';
|
|
calendar.style.display = "none";
|
|
+ year = parseInt(year_selector.value);
|
|
+ var li = document.getElementById('year_div');
|
|
+ year_selector.value = year + '年';
|
|
+ // selected_date_div.innerHTML = year_selector.value + month_selector.value;
|
|
+ for (var index = 0; index < 16; index++) {
|
|
+
|
|
+ // li.children[0].children[index].innerHTML = '<br />';
|
|
+ var currentYear = year + index;
|
|
+ //li.children[0].children[index].innerHTML= '<br />' + curretYear + '年';
|
|
+ li.children[0].children[index].innerHTML ='<span class="year_month_grid">'+ currentYear+ '年' + '</span>';
|
|
+ li.children[0].children[index].addEventListener('click', new_month_selected); // new year implies new month
|
|
+ }
|
|
} else {
|
|
div.className = 'hidden_div';
|
|
calendar.style.display = "";
|
|
--
|
|
2.27.0
|
|
|