사용자:Ryush00/common.js
참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다. 구글 크롬, 파이어폭스, 마이크로소프트 엣지, 사파리: ⇧ Shift 키를 누른 채 "새로 고침" 버튼을 클릭하십시오. 더 자세한 정보를 보려면 위키백과:캐시 무시하기 항목을 참고하십시오.
/*** 위키휴가 집행기 시작 ***/
//집행기 테스트 중입니다.
$(function() {
/*** 여기부터 편집 ***/
// 휴가를 언제부터 시작하실 건가요?
// 앞에 0을 채우지 마세요. (예: 7 - 맞음, 07 - 틀림)
var sdate = { year: 2014, month: 4, day: 10};
var stime = { hours: 0, minutes: 0, seconds: 0 };
// 휴가를 언제 끝내실 건가요?
// 앞에 0을 채우지 마세요. (예: 7 - 맞음, 07 - 틀림)
var date = { year: 2014, month: 5, day: 1};
var time = { hours: 0, minutes: 0, seconds: 0 };
/*** 여기까지만 편집 ***/
var StartDate = new Date(
sdate.year,sdate.month-1,sdate.day,stime.hours,stime.minutes,stime.seconds);
var isEnabled = false;
var now = new Date();
var EndDate = new Date(
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
if (now >= StartDate && now <= EndDate && isEnabled) {
//남은시간 계산
var RemainDate = new Date(EndDate - now);
RemainSecond = RemainDate / 1000;
//alert (RemainDate);
var msg = "";
//alert(RemainDate.seconds);
/*
if (Math.floor(RemainSecond / 60 / 60 / 60 % 24) > 0 )
msg = msg + Math.floor(RemainSecond / 60 / 60 / 60 % 24) + "일";
if (Math.floor(RemainSecond / 60 / 60 % 60) > 0 )
msg = msg + Math.floor(RemainSecond / 60 / 60 % 60) + "시간";
if (Math.floor(RemainSecond / 60 % 60) > 0 )
msg = msg + Math.floor(RemainSecond / 60 % 60) + "분";
if (Math.floor(RemainSecond % 60) > 0 )
msg = msg + Math.floor(RemainSecond % 60) + "초";
*/
//msg = RemainDate.getSeconds();
//alert (date.month);
//alert (msg);
alert("당신의 위키휴가는 "+StartDate.toLocaleString()+"에 시작해서 "+EndDate.toLocaleString()
+ "까지 입니다.\n(지금은 "+now.toLocaleString()+"입니다.)\n\n안녕히 가세요!");
location = "http://"+location.host+"/w/index.php?title=" + "Special:Userlogout&returnto=Main_Page";
} else {
//alert(StartDate.toLocaleString()+">="+now.toLocaleString()+"<="+EndDate.toLocaleString()+"가 거짓입니다");
}
});
/*** 위키휴가 집행기 끝 ***/