Welcome Guest [Log In] [Register]
Hiện thời Webstie của chúng tôi đang tạm đóng dể sửa chữa nhằm mục đích phục vụ tốt hơn cho nhu cầu của các bạn. Khi mọi công việc sữa chữa hoàn thành chúng tôi sẽ gửi email thông báo đến tất cả các bạn. Mong các bạn vui ḷng ghé lại sau. Thành thật xin lỗi v́ sự cố này.


>> Bạn đă có tài khoản chưa, click vào đây để đăng kư !


Nếu bạn đă là thành viên của L'@mour ™, vui ḷng đăng nhập để tham gia thảo luận. Cảm ơn !

Username:   Password:
Add Reply
Mă Hôm Nay / Hôm Qua !
Topic Started: Jun 3 2006, 09:28 PM (451 Views)
Jimmy
Member Avatar
__Love__

...Mă này sẽ hiện lên chữ "hôm nay" hoặc "hôm qua" thay v́ chỉ viết ngày tháng như hiện tại IF đang sử dụng ở cột cuối cùng trước tên bài đăng và người viết bài.

Mẫu here:

Posted Image

...Để hiện luôn trong phần showthread, hăy vào ACP => System Setting => Date and Time Formats đổi cả 3 fields đó thành như sau:

Quote:
 
M j Y, h:i A


...Đặt đoạn này trong footer:

Quote:
 
<script language="JavaScript">
/*
Show "Today" or "Yesterday" in Last Post Info - v2.0
by Verminox
//Development support by Kenshin of http://hanarui.t8x.net/
*/

function write_date(theday)
{
var thetime=new Date();

var nmonth=thetime.getMonth();
if(theday=='t'){
var ntoday=(thetime.getDate());
}
else if(theday=='y'){
var ntoday=(thetime.getDate()-1);
}
var nyear=thetime.getYear();

nmonth+=1;

var xmonth = new Array()
xmonth[1] = "Jan"
xmonth[2] = "Feb"
xmonth[3] = "Mar"
xmonth[4] = "Apr"
xmonth[5] = "May"
xmonth[6] = "Jun"
xmonth[7] = "Jul"
xmonth[8] = "Aug"
xmonth[9] = "Sept"
xmonth[10] = "Oct"
xmonth[11] = "Nov"
xmonth[12] = "Dec"

for(n=1;n<13;n++){
if (nmonth==n){
nmonth=xmonth[n];
}}


if (nyear<=99)
nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
nyear+=1900;


return nmonth + " " + ntoday + " " + nyear;


}

var today = write_date('t')

var yesterday = write_date('y')

var datecell = document.getElementsByTagName('TD')

for(x=0;x<datecell.length;x++){
if(datecell[x].innerHTML.match(today) && datecell[x].innerHTML.match(/By:/i)){
datecell[x].innerHTML = datecell[x].innerHTML.replace(today, "Hôm nay")
}}

for(y=0;y<datecell.length;y++){
if(datecell[y].innerHTML.match(yesterday) && datecell[y].innerHTML.match(/By:/i)){
datecell[y].innerHTML = datecell[y].innerHTML.replace(yesterday, "Hôm qua")
}}

</script>


Enjoy! :ngoaymui:
Posted Image
Offline Profile Quote Post Goto Top
 
bigbangs
No Avatar


thanks pro nh́u nhé h́ :D
Offline Profile Quote Post Goto Top
 
8xman
No Avatar


được lém, cám ơn nhiều nha
Offline Profile Quote Post Goto Top
 
caigiday
No Avatar


VIC
Jun 3 2006, 09:28 PM
...Mă này sẽ hiện lên chữ "hôm nay" hoặc "hôm qua" thay v́ chỉ viết ngày tháng như hiện tại IF đang sử dụng ở cột cuối cùng trước tên bài đăng và người viết bài.

Mẫu here:

Posted Image

...Để hiện luôn trong phần showthread, hăy vào ACP => System Setting => Date and Time Formats đổi cả 3 fields đó thành như sau:

Quote:
 
M j Y, h:i A


...Đặt đoạn này trong footer:

Quote:
 
<script language="JavaScript">
/*
Show "Today" or "Yesterday" in Last Post Info - v2.0
by Verminox
//Development support by Kenshin of http://hanarui.t8x.net/
*/

function write_date(theday)
{
var thetime=new Date();

var nmonth=thetime.getMonth();
if(theday=='t'){
var ntoday=(thetime.getDate());
}
else if(theday=='y'){
var ntoday=(thetime.getDate()-1);
}
var nyear=thetime.getYear();

nmonth+=1;

var xmonth = new Array()
xmonth[1] = "Jan"
xmonth[2] = "Feb"
xmonth[3] = "Mar"
xmonth[4] = "Apr"
xmonth[5] = "May"
xmonth[6] = "Jun"
xmonth[7] = "Jul"
xmonth[8] = "Aug"
xmonth[9] = "Sept"
xmonth[10] = "Oct"
xmonth[11] = "Nov"
xmonth[12] = "Dec"

for(n=1;n<13;n++){
if (nmonth==n){
nmonth=xmonth[n];
}}


if (nyear<=99)
nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
nyear+=1900;


return nmonth + " " + ntoday + " " + nyear;


}

var today = write_date('t')

var yesterday = write_date('y')

var datecell = document.getElementsByTagName('TD')

for(x=0;x<datecell.length;x++){
if(datecell[x].innerHTML.match(today) && datecell[x].innerHTML.match(/By:/i)){
datecell[x].innerHTML = datecell[x].innerHTML.replace(today, "Hôm nay")
}}

for(y=0;y<datecell.length;y++){
if(datecell[y].innerHTML.match(yesterday) && datecell[y].innerHTML.match(/By:/i)){
datecell[y].innerHTML = datecell[y].innerHTML.replace(yesterday, "Hôm qua")
}}

</script>


Enjoy! :ngoaymui:

Có thêm đoạn code nào tính cách đây bao nhiêu ngày hoặc bao nhiêu phút không vậy?
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ..: CODES :.. · Next Topic »
Add Reply