|
|
| unix_epoch_year := 1970; | | unix_epoch_year := 1970; |
| seconds_in_year := 31536000; | | seconds_in_year := 31536000; |
| seconds_in_day := 86400; | | seconds_in_day := 86400; |
| start_of_year_timestamp := 1704067200; /* 2024 :js: Date.UTC(year, 0, 1) / 1000 */ | | start_of_year_timestamp := 1704067200; /* 2024 :js: Date.UTC(year, 0, 1) / 1000 */ |
| t := int(timestamp); | | t := int(timestamp); |
|
| |
|
| /* Current year */ | | /* Current year */ |
| current_year := unix_epoch_year + int(t / seconds_in_year); | | current_year := unix_epoch_year + int(t / seconds_in_year); |
|
| |
|
| /* Current week */ | | /* Current week */ |
| seconds_difference := t - start_of_year_timestamp; | | seconds_difference := t - start_of_year_timestamp; |
| div := seconds_difference / seconds_in_day; | | div := seconds_difference / seconds_in_day; |
| day_of_year := int((div % 1 == 0 ? div : div + 1) + 1); | | day_of_year := int((div % 1 == 0 ? div : div + 1) + 1); |
| current_week := int((day_of_year - 1) / 7) + 1; | | current_week := int((day_of_year - 1) / 7) + 1; |
| | |
| | /* Current month & day */ |
| | days_since_epoch := int(t / seconds_in_day); |
| | is_leap_year := (current_year % 4 == 0 & current_year % 100 != 0) | (current_year % 400 == 0); |
| | days_in_month := [31, is_leap_year ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
| | |
| | month := 0; |
| | |
| | loop_1 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_1 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_1 ? month + 1 : month; |
| | |
| | loop_2 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_2 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_2 ? month + 1 : month; |
| | |
| | loop_3 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_3 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_3 ? month + 1 : month; |
| | |
| | loop_4 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_4 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_4 ? month + 1 : month; |
| | |
| | loop_5 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_5 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_5 ? month + 1 : month; |
| | |
| | loop_6 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_6 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_6 ? month + 1 : month; |
| | |
| | loop_7 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_7 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_7 ? month + 1 : month; |
| | |
| | loop_8 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_8 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_8 ? month + 1 : month; |
| | |
| | loop_9 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_9 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_9 ? month + 1 : month; |
| | |
| | loop_10 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_10 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_10 ? month + 1 : month; |
| | |
| | loop_11 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_11 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_11 ? month + 1 : month; |
| | |
| | loop_12 := day_of_year >= days_in_month[month]; |
| | day_of_year := loop_12 ? day_of_year - days_in_month[month] : day_of_year; |
| | month := loop_12 ? month + 1 : month; |
| | |
| | current_month := length(string(month + 1)) == 1 ? '0' + string(month + 1) : month + 1; |
| | day_of_month := length(string(day_of_year)) == 1 ? '0' + string(day_of_year) : day_of_year; |
|
| |
|
| /* Patterns */ | | /* Patterns */ |
| bvcl := 'Wikipedia:Bài viết chọn lọc/' + current_year + '/Tuần ' + current_week; | | bvcl := 'Wikipedia:Bài viết chọn lọc/' + current_year + '/Tuần ' + current_week; |
| bvclct := 'Wikipedia:Bài viết chọn lọc/' + current_year + '/Các tựa'; | | bvclct := 'Wikipedia:Bài viết chọn lọc/' + current_year + '/Các tựa'; |
|
| |
|
| bvt := 'Wikipedia:Bài viết tốt/' + current_year + '/Tuần ' + current_week; | | bvt := 'Wikipedia:Bài viết tốt/' + current_year + '/Tuần ' + current_week; |
| bvtct := 'Wikipedia:Bài viết tốt/' + current_year + '/Các tựa'; | | bvtct := 'Wikipedia:Bài viết tốt/' + current_year + '/Các tựa'; |
|
| |
|
| dscl := 'Wikipedia:Danh sách chọn lọc/' + current_year + '/Tuần ' + current_week; | | dscl := 'Wikipedia:Danh sách chọn lọc/' + current_year + '/Tuần ' + current_week; |
| dsclct := 'Wikipedia:Danh sách chọn lọc/' + current_year + '/Các tựa'; | | dsclct := 'Wikipedia:Danh sách chọn lọc/' + current_year + '/Các tựa'; |
|
| |
|
| bcb := 'Wikipedia:Bạn có biết/' + current_year + '/Tuần ' + current_week + '/[1-4]$'; | | bcb := 'Wikipedia:Bạn có biết/' + current_year + '/Tuần ' + current_week + '/[1-4]$'; |
| | |
| | hacl := 'Wikipedia:Hình ảnh chọn lọc/' + current_year + '/' + current_month + '/' + day_of_month; |
|
| |
|
| regex_string := bvcl | | regex_string := bvcl |
| + '|' + bvclct | | + '|' + bvclct |
| + '|' + bvt | | + '|' + bvt |
| + '|' + bvtct | | + '|' + bvtct |
| + '|' + dscl | | + '|' + dscl |
| + '|' + dsclct | | + '|' + dsclct |
| + '|' + bcb; | | + '|' + bcb |
| | + '|' + hacl; |
|
| |
|
| !('autoconfirmed' in user_groups) | | !('autoconfirmed' in user_groups) |
| & page_prefixedtitle regex regex_string; | | & page_prefixedtitle regex regex_string; |