蔡英文總統任期趴數程式,乃自2016年05月20日起算,以計算蔡英文總統任期已完成的趴數。此程式修改自國祚程式,特此聲明。
<font face="Microsoft YaHei" size=7><b>
<script language="javascript">
var Today = new Date();
var Timezone = (Today.getTimezoneOffset() + 480) / 1440;
var delta, deltaYear, deltaMonth, deltaDay, indexMonth, indexQuantity;
var MonthQuantity = new Array(12, 12, 12, 12, 12);
var ROC = new Array(49);
initialize(ROC);
for (indexMonth = ROC.length; indexMonth >= 0; indexMonth--) {
delta = Today - ROC[indexMonth] + 86400000;
if (delta >= 0) {
deltaYear = 0;
deltaDay = Math.round(delta / 86400000 + Timezone - 0.4999999999);
for (indexQuantity = 0; indexQuantity < MonthQuantity.length; indexQuantity++) {
if (indexMonth - MonthQuantity[indexQuantity] >= 0) {
indexMonth -= MonthQuantity[indexQuantity];
deltaYear++;
} else {
deltaMonth = indexMonth;
break;
}
}
break;
}
}
var deltaPresent = Number(Math.round((deltaYear + (deltaMonth + deltaDay / ((ROC[deltaMonth + 1]
- ROC[deltaMonth]) / 86400000)) / 12) / 4 * 100 * 100000) / 100000);
var str = "蔡英文總統任期趴數:" + deltaPresent + "%";
document.write(str);
<!------------------------------------------------------------------------------------------------------------------>
function Number(deltaData) {
var NUM_2, NUM_1, NUM_0, NUM_M1, NUM_M2, NUM_M3, M_Number, deltaNumber;
var NUM = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
NUM_2 = Math.floor(deltaData / Math.pow(10, 2));
NUM_1 = Math.floor((deltaData - NUM_2 * Math.pow(10, 2)) / Math.pow(10, 1));
NUM_0 = Math.floor(deltaData - NUM_2 * Math.pow(10, 2) - NUM_1 * Math.pow(10, 1));
M_Number = deltaData - NUM_2 * Math.pow(10, 2) - NUM_1 * Math.pow(10, 1) - NUM_0;
NUM_M1 = Math.floor(M_Number * 10);
NUM_M2 = Math.floor((M_Number - NUM_M1 * 0.1) * 100);
NUM_M3 = Math.floor((M_Number - NUM_M1 * 0.1 - NUM_M2 * 0.01) * 1000);
if (NUM_2 >= 1) {
deltaNumber = NUM[NUM_2] + NUM[NUM_1] + NUM[NUM_0];
} else {
if (NUM_1 >= 1) {
deltaNumber = NUM[NUM_1] + NUM[NUM_0];
} else {
deltaNumber = NUM[NUM_0];
}
}
deltaNumber = deltaNumber + "﹒" + NUM[NUM_M1] + NUM[NUM_M2] + NUM[NUM_M3];
return deltaNumber;
}
<!------------------------------------------------------------------------------------------------------------------>
function initialize(NewMonth) {
var indexj = 7, indexk;
NewMonth[ 0] = new Date(2016, 4,20);
NewMonth[ 1] = new Date(2016, 5,20);
NewMonth[ 2] = new Date(2016, 6,20);
NewMonth[ 3] = new Date(2016, 7,20);
NewMonth[ 4] = new Date(2016, 8,20);
NewMonth[ 5] = new Date(2016, 9,20);
NewMonth[ 6] = new Date(2016,10,20);
NewMonth[ 7] = new Date(2016,11,20);
for (indexk = 0; indexk <= 11; indexk++) {
NewMonth[indexj + 1 ] = new Date(2017,indexk,20);
NewMonth[indexj + 13] = new Date(2018,indexk,20);
NewMonth[indexj + 25] = new Date(2019,indexk,20);
indexj++;
}
NewMonth[44] = new Date(2020, 0,20);
NewMonth[45] = new Date(2020, 1,20);
NewMonth[46] = new Date(2020, 2,20);
NewMonth[47] = new Date(2020, 3,20);
NewMonth[48] = new Date(2020, 4,20);
}
</script>
</b></font>
<font face="Microsoft YaHei" size=7><b>
<script language="javascript">
var Today = new Date();
var Timezone = (Today.getTimezoneOffset() + 480) / 1440;
var delta, deltaYear, deltaMonth, deltaDay, indexMonth, indexQuantity;
var MonthQuantity = new Array(12, 12, 12, 12, 12);
var ROC = new Array(49);
initialize(ROC);
for (indexMonth = ROC.length; indexMonth >= 0; indexMonth--) {
delta = Today - ROC[indexMonth] + 86400000;
if (delta >= 0) {
deltaYear = 0;
deltaDay = Math.round(delta / 86400000 + Timezone - 0.4999999999);
for (indexQuantity = 0; indexQuantity < MonthQuantity.length; indexQuantity++) {
if (indexMonth - MonthQuantity[indexQuantity] >= 0) {
indexMonth -= MonthQuantity[indexQuantity];
deltaYear++;
} else {
deltaMonth = indexMonth;
break;
}
}
break;
}
}
var deltaPresent = Number(Math.round((deltaYear + (deltaMonth + deltaDay / ((ROC[deltaMonth + 1]
- ROC[deltaMonth]) / 86400000)) / 12) / 4 * 100 * 100000) / 100000);
var str = "蔡英文總統任期趴數:" + deltaPresent + "%";
document.write(str);
<!------------------------------------------------------------------------------------------------------------------>
function Number(deltaData) {
var NUM_2, NUM_1, NUM_0, NUM_M1, NUM_M2, NUM_M3, M_Number, deltaNumber;
var NUM = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
NUM_2 = Math.floor(deltaData / Math.pow(10, 2));
NUM_1 = Math.floor((deltaData - NUM_2 * Math.pow(10, 2)) / Math.pow(10, 1));
NUM_0 = Math.floor(deltaData - NUM_2 * Math.pow(10, 2) - NUM_1 * Math.pow(10, 1));
M_Number = deltaData - NUM_2 * Math.pow(10, 2) - NUM_1 * Math.pow(10, 1) - NUM_0;
NUM_M1 = Math.floor(M_Number * 10);
NUM_M2 = Math.floor((M_Number - NUM_M1 * 0.1) * 100);
NUM_M3 = Math.floor((M_Number - NUM_M1 * 0.1 - NUM_M2 * 0.01) * 1000);
if (NUM_2 >= 1) {
deltaNumber = NUM[NUM_2] + NUM[NUM_1] + NUM[NUM_0];
} else {
if (NUM_1 >= 1) {
deltaNumber = NUM[NUM_1] + NUM[NUM_0];
} else {
deltaNumber = NUM[NUM_0];
}
}
deltaNumber = deltaNumber + "﹒" + NUM[NUM_M1] + NUM[NUM_M2] + NUM[NUM_M3];
return deltaNumber;
}
<!------------------------------------------------------------------------------------------------------------------>
function initialize(NewMonth) {
var indexj = 7, indexk;
NewMonth[ 0] = new Date(2016, 4,20);
NewMonth[ 1] = new Date(2016, 5,20);
NewMonth[ 2] = new Date(2016, 6,20);
NewMonth[ 3] = new Date(2016, 7,20);
NewMonth[ 4] = new Date(2016, 8,20);
NewMonth[ 5] = new Date(2016, 9,20);
NewMonth[ 6] = new Date(2016,10,20);
NewMonth[ 7] = new Date(2016,11,20);
for (indexk = 0; indexk <= 11; indexk++) {
NewMonth[indexj + 1 ] = new Date(2017,indexk,20);
NewMonth[indexj + 13] = new Date(2018,indexk,20);
NewMonth[indexj + 25] = new Date(2019,indexk,20);
indexj++;
}
NewMonth[44] = new Date(2020, 0,20);
NewMonth[45] = new Date(2020, 1,20);
NewMonth[46] = new Date(2020, 2,20);
NewMonth[47] = new Date(2020, 3,20);
NewMonth[48] = new Date(2020, 4,20);
}
</script>
</b></font>