Initial commit.

This commit is contained in:
2026-03-10 21:25:26 +08:00
commit 78739bf725
3089 changed files with 472990 additions and 0 deletions

View File

@@ -0,0 +1,177 @@
/* Woman's Voice
* accounting.js: The accounting-related JavaScript subroutines.
*/
/* Copyright (c) 2007-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2007-09-26
*/
// setAutoSummary: Automatically supply a summary
function setAutoSummary(subj) {
var i, j, sum, dateText, today, subjText, subjCode, thisMonth;
// Get the name prefix of this selection
i = subj.name.indexOf("subj");
// Obtain the summary column
sum = subj.form[subj.name.substr(0, i) + "summary"];
// Get today's date
today = new Date;
dateText = trim(subj.form.date.value);
if (!isDate(dateText))
return;
today.setFullYear(dateText.substr(0, 4));
today.setMonth(dateText.substr(5, 2) - 1);
today.setDate(dateText.substr(8, 2));
thisMonth = today.getMonth() + 1;
// Obtain the selected subject
// The value of the selection is S/N but not subject code,
// so we have to obtain the subject code from the option text
subjText = subj.options[subj.selectedIndex].text;
subjCode = parseInt(subjText.substr(0, subjText.indexOf(" ")));
switch (subjCode) {
// 74811 共同生活基金-燕秋
case 74811:
sum.value = "燕秋" + thisMonth + "月";
break;
// 74812 共同生活基金-士青
case 74812:
sum.value = "士青" + thisMonth + "月";
break;
// 6252 租金支出
case 6252:
sum.value = "房租" + thisMonth + "月";
break;
// 62562 市話 02-3233-7444
case 62562:
// 2142 應付—電話費
case 2142:
// 20 or later - assume to be of this month
if (today.getDate() >= 20) {
sum.value = "電話費" + thisMonth + "月";
// Before 20 - assume to be of previous month
} else {
sum.value = "電話費" + ((thisMonth + 10) % 12 + 1) + "月";
}
break;
// 62611 電費
case 62611:
i = ((thisMonth + thisMonth % 2 + 8) % 12 + 1)
j = ((thisMonth + thisMonth % 2 + 9) % 12 + 1)
sum.value = "電費" + i + "" + j + "月";
break;
// 62612 水費
case 62612:
i = ((thisMonth + thisMonth % 2 + 8) % 12 + 1)
j = ((thisMonth + thisMonth % 2 + 9) % 12 + 1)
sum.value = "水費" + i + "" + j + "月";
break;
// 62613 瓦斯費
case 62613:
i = ((thisMonth + thisMonth % 2 + 8) % 12 + 1)
j = ((thisMonth + thisMonth % 2 + 9) % 12 + 1)
sum.value = "瓦斯費" + i + "" + j + "月";
break;
// 62614 公用電費
case 62614:
i = ((thisMonth + thisMonth % 2 + 8) % 12 + 1)
j = ((thisMonth + thisMonth % 2 + 9) % 12 + 1)
sum.value = "公用電費" + i + "" + j + "月";
break;
// 62732 有線電視—新視波
case 62732:
if (thisMonth == 12 || thisMonth == 1)
sum.value = "新視波16月"
else if (thisMonth == 6 || thisMonth == 7)
sum.value = "新視波712月"
break;
}
return;
}
// acctRepQueryDisableNoUseRanges: Disable range parameters that are not in use
function acctRepQueryDisableNoUseRanges() {
var i, form, curValue;
// Obtain our form
form = document.forms["acctrepquery"];
if (form == undefined)
return;
// Find the current selection
for (i = 0; i < form.r.length; i++) {
if (form["r"][i].checked) {
curValue = form["r"][i].value;
break;
}
}
// Disable or enable the month selection
if (curValue == "m")
form["m"].disabled = false;
else
form["m"].disabled = true;
// Disable or enable the year selection
if (curValue == "y")
form["y"].disabled = false;
else
form["y"].disabled = true;
// Disable or enable the start and end date
if (curValue == "s") {
form["f"].disabled = false;
form["t"].disabled = false;
} else {
form["f"].disabled = true;
form["t"].disabled = true;
}
return;
}
// calcTotal: Calculating the total
function calcTotal(amount) {
var i, j, side, sum, a, pos, isNumber;
a = "NT$ 3,433.00";
side = amount.name.substr(0, 4);
for ( i = 0, sum = 0;
amount.form[side + i + "amount"] != undefined;
i++) {
a = amount.form[side + i + "amount"];
// Trim the text
a.value = trim(a.value);
// Remove the dollar sign
if (a.value.substr(0, 3) == "NT$")
a.value = a.value.substr(3);
// Trim the text again, for possible spaces after the dollar sign
a.value = trim(a.value);
// Remove the decimal point
if (a.value.substr(a.value.length - 3) == ".00")
a.value = a.value.substr(0, a.value.length - 3);
// Remove the thousand seperators
while ((pos = a.value.indexOf(",")) != -1) {
a.value = a.value.substr(0, pos) + a.value.substr(pos + 1);
}
// Check if it is a number
for (j = 0, isNumber = true; j < a.value.length; j++) {
if (a.value.charCodeAt(j) < 48 || a.value.charCodeAt(j) > 57) {
isNumber = false;
break;
}
}
// Add the amount
if (isNumber)
sum = sum + a.value * 1;
}
a = amount.form[side + "total"];
if (a != undefined)
a.value = sum;
}

View File

@@ -0,0 +1,139 @@
/* Woman's Voice
* common.js: The common JavaScript subroutines.
*/
/* Copyright (c) 2000-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2000-05-17
*/
// _: Gettext
function _(msg) {
var i;
for (i = 0; i < lc_messages.length; i++) {
if (lc_messages[i][0] == msg) {
return lc_messages[i][1];
}
}
return msg;
}
// The messages
lc_messages = [];
// isEmail: Check if an email address is legal
function isEmail(a) {
var i, c, re;
if (typeof(RegExp) == "undefined") return true;
re = new RegExp("^[\\w\\-]+(\\.[\\w\\-]+)*\\@([\\w\\-]+\\.)+[\\w\\-]+$");
if (typeof(a) != "string") return false;
a = a.toLowerCase();
if (re.exec(a) == null) return false;
return true;
}
// isDate: Check if a date is legal
function isDate(dateText) {
var i, year, month, day, maxDay;
if (dateText.length != 10) {
return false;
}
// Check each character
for (i = 0; i < dateText.length; i++) {
// The dash sign
if (i == 4 || i == 7) {
if (dateText.charAt(i) != "-")
return false;
// The digits
} else {
if (dateText.charCodeAt(i) < 48 || dateText.charCodeAt(i) > 57)
return false;
}
}
// Check if the date is valid
year = dateText.substr(0, 4) * 1;
month = dateText.substr(5, 2) * 1;
day = dateText.substr(8, 2) * 1;
// A reasonable month
if (month < 1 || month > 12)
return false;
// Find the maximum day in this month
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
maxDay = 31;
break;
case 4:
case 6:
case 9:
case 11:
maxDay = 30;
break;
case 2:
maxDay = 28;
if (year % 4 == 0)
maxDay = 29;
if (year % 100 == 0)
maxDay = 28;
if (year % 400 == 0)
maxDay = 29;
break;
}
// A reasonable day
if (day < 1 || day > maxDay)
return false;
return true;
}
// trim: Trim the leading and tailing spaces
function trim(a) {
var pos, start, len, spaces;
start = 0;
len = a.length;
spaces = " \t\f\n\r";
for (start = 0; start < a.length && spaces.indexOf(a.charAt(start)) >= 0; start++, len--);
for (pos = a.length - 1; pos >= 0 && spaces.indexOf(a.charAt(pos)) >= 0; pos--, len--);
return a.substr(start, len);
}
function trimText(a) {
var pos, start, len, spaces, newlines;
start = 0;
len = a.length;
spaces = " \t\f\n\r";
newlines = "\n\r";
for (start = 0; start < a.length && spaces.indexOf(a.charAt(start)) >= 0; start++, len--);
for ( ; start-1 >= 0 && newlines.indexOf(a.charAt(start-1)) < 0; start--, len++);
for (pos = a.length - 1; pos >= 0 && spaces.indexOf(a.charAt(pos)) >= 0; pos--, len--);
return a.substr(start, len);
}
// Replace one phace with another in a string
function replace(source, oldStr, newStr) {
var pos;
pos = 0;
while (true) {
pos = source.indexOf(oldStr, pos);
if (pos == -1) break;
source = source.substr(0, pos) + newStr + source.substr(pos + oldStr.length)
pos += newStr.length;
}
return source;
}

View File

@@ -0,0 +1,55 @@
/* Woman's Voice
* guestbook.js: The guestbook-related JavaScript subroutines.
*/
/* Copyright (c) 2000-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2000-06-07
*/
// isGuestbookOK: Check if the message is ready to be submitted
function isGuestbookOK(form) {
// Regularize the fields
form.message.value = trimText(form.message.value);
form.name.value = trim(form.name.value);
form.identity.value = trim(form.identity.value);
form.location.value = trim(form.location.value);
form.email.value = trim(form.email.value);
form.url.value = trim(form.url.value);
// Check the message
if (form.message.value == "" || form.message.value == _("Fill in your message here.")) {
alert(_("Please fill in your message."));
form.message.focus();
return false;
}
if (form.message.value.length > 10240) {
alert(_("Your message is too long. (Max. 10,240 letters)"));
form.message.focus();
return false;
}
message = form.message.value.toLowerCase();
if (message.indexOf("<a href=") != -1 || message.indexOf("<table") != -1) {
return confirm(_("Your message contains HTML, which will be displayed \"AS IS\". If this is a commercial advertisement, it will be deleted right away and you are wasting your time. Do you still want to submit this message?"));
}
if (message.indexOf("[url=") != -1) {
return confirm(_("Your message contains BBCode, which will be displayed \"AS IS\". If this is a commercial advertisement, it will be deleted right away and you are wasting your time. Do you still want to submit this message?"));
}
return true;
}

View File

@@ -0,0 +1,39 @@
/* Woman's Voice
* lang.zh-tw.js: The Chinese (Taiwan) localized messages.
*/
/* Copyright (c) 2004-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2004-11-05
*/
// The messages
lc_messages = [
["Fill in your message here.", "請填上妳的留言。"],
["Please fill in your message.", "請填上妳的留言。"],
["Your message is too long. (Max. 10,240 letters)", "妳的留言太長了。(最長 10,240 個字)"],
["Your message contains HTML, which will be displayed \"AS IS\". If this is a commercial advertisement, it will be deleted right away and you are wasting your time. Do you still want to submit this message?", "妳的留言內含 HTML HTML 會以原始碼秀出。一般商業廣告留言隨見隨刪,請勿浪費時間。妳確定要留這則留言嗎?"],
["Your message contains BBCode, which will be displayed \"AS IS\". If this is a commercial advertisement, it will be deleted right away and you are wasting your time. Do you still want to submit this message?", "妳的留言內含 BBCode BBCode 會以原始碼秀出。一般商業廣告留言隨見隨刪,請勿浪費時間。妳確定要留這則留言嗎?"],
["Fill in the description here.", "請填上簡介。"],
["This description is too long. (Max. 256 letters)", "簡介太長了。(最長 256 個字)"],
["Please fill in the site name.", "請填上站名。"],
["Please fill in the URL.", "請填上網址。"],
["Please fill in the description.", "請填上簡介。"],
["Please fill in your query.", "請填上檢索的辭彙。"],
];

View File

@@ -0,0 +1,75 @@
/* Woman's Voice
* links.js: The related-link related JavaScript subroutines.
*/
/* Copyright (c) 2000-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2000-06-28
*/
// isRegisterOK: Check if the register form is ready to be submitted
function isRegisterOK(form) {
// Regularize the fields
form.title.value = trim(form.title.value);
form.title_2ln.value = trim(form.title_2ln.value);
form.url.value = trim(form.url.value);
form.icon.value = trim(form.icon.value);
form.cat0.value = trim(form.cat0.value);
form.cat1.value = trim(form.cat1.value);
form.cat2.value = trim(form.cat2.value);
form.dsc.value = trimText(form.dsc.value);
form.email.value = trim(form.email.value);
form.addr.value = trim(form.addr.value);
form.tel.value = trim(form.tel.value);
form.fax.value = trim(form.fax.value);
// Check the site name
if (form.title.value == "") {
alert(_("Please fill in the site name."));
form.title.focus();
return false;
}
// Check the URL
if (form.url.value == "" || form.url.value == "http://") {
alert(_("Please fill in the URL."));
form.url.focus();
return false;
}
// Check the description
if (form.dsc.value == "" || form.dsc.value == _("Fill in the description here.")) {
alert(_("Please fill in the description."));
form.dsc.focus();
return false;
}
if (form.dsc.value.length > 256) {
alert(_("This description is too long. (Max. 256 letters)"));
form.dsc.focus();
return false;
}
return true;
}
// clearDscDefault: Clear the default value of the description
function clearDscDefault(dsc, deftext) {
if (dsc.value == deftext) {
dsc.value = "";
}
}

View File

@@ -0,0 +1,38 @@
/* Woman's Voice
* search.js: The full text search related JavaScript subroutines.
*/
/* Copyright (c) 2004-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2004-11-28
*/
// isSearchOK: Check if the query phrase is ready to be submitted
function isSearchOK(form) {
// Regularize the fields
form.query.value = trim(form.query.value);
// Check the query phrase
if (form.query.value == "") {
alert(_("Please fill in your query."));
form.query.focus();
return false;
}
return true;
}

View File

@@ -0,0 +1,73 @@
/* Woman's Voice
* subscribe.js: The mailing list subscription related JavaScript subroutines.
*/
/* Copyright (c) 2000-2018 imacat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Author: imacat <imacat@mail.imacat.idv.tw>
* First written: 2000-05-18
*/
/* isSubOK: is the subscription request OK? */
function isSubOK(form) {
// Regularize the fields
form.email.value = trim(form.email.value);
if (form.email.value == "") {
alert("請填上收件用的 E-mail 信箱。");
form.email.focus();
return false;
}
if (!isEmail(form.email.value)) {
alert("E-mail 有誤,請檢查有沒有拼錯。");
form.email.focus();
return false;
}
if (form.pw.value == "") {
alert("請設定密碼。");
form.pw.focus();
return false;
}
if (form["pw-conf"].value == "") {
alert("請核對你設定的密碼。");
form["pw-conf"].focus();
return false;
}
if (form.pw.value != form["pw-conf"].value) {
alert("核對密碼不符,請重新設定密碼。");
form.pw.value = "";
form["pw-conf"].value = "";
form.pw.focus();
return false;
}
return true;
}
/* isOptionsOK: is the options request OK? */
function isOptionsOK(form) {
// Regularize the fields
form.email.value = trim(form.email.value);
if (form.email.value == "") {
alert("請填上妳的收件 E-mail 信箱。");
form.email.focus();
return false;
}
if (!isEmail(form.email.value)) {
alert("E-mail 有誤,請檢查有沒有拼錯。");
form.email.focus();
return false;
}
return true;
}