Knowledge (XXG)

:Comments in Local Time - Knowledge (XXG)

Source 📝

1113: 70: 78: 299:
used to import this script, and change the values after the colon. The settings are explained in greater detail below. After changing the settings, force your browser to perform a full reload of a talk page to see the effect.
63:-based dates, such as those in signatures, to be relative to the user's local time. It also adds the day of the week to dates, and uses common phrases to describe dates (i.e., Today, 2 months ago, etc.). 1065:
The script draws local time for signatures from the time set on the user's computer. The time for logs and page histories is drawn from the time set in the appearance tab in each user's
1104: 144:
The date is shown in your local time, based on your computer's timezone setting. The display is highly customizable through the use of options. For instance:
1078: 52: 1085:
in the script's comments. The regular expression used to find timestamps may also need to be updated, on the line following
891:
To produce the absolute smallest display text, suppress the date difference entirely by copying the following code to your
1135: 1098: 1017:. For example, to change the timestamp's size, increase or decrease the percentage in the code accordingly, such as to 60: 1010: 778:
To produce the smallest display text that still includes the date difference, copy the following code to your
96:
Change UTC-based time and date stamps, such as those used in talk page comments, to be relative to local time.
1014: 892: 779: 290: 102: 66:
This script uses plain JavaScript, making pages load significantly faster than if the script used jQuery.
17: 1066: 91: 56: 307:
Shows the difference in terms of days, months, and years from the timestamp and today's date.
159:
Dates that are either today, yesterday, or tomorrow are shown with relative dates, such as
69: 77: 1129: 498: 488: 472: 468: 420:
Number of months in difference at which point only the number of years is displayed.
399:
Number of days in difference at which point only the number of months is displayed.
1077:
To use this script on another Knowledge (XXG) language, copy the code from
101:
This script can also be installed by copying the code below to your
441:
Changes the order in which the time and date appears in timestamps.
319:
to show the difference between the timestamp and today's date, and
76: 68: 138:
7:00 pm, 31 December 2010, Friday (1 month, 2 days ago) (UTC-5)
94:, click on the "Gadgets" tab, and checkmark the box labeled " 289:
To change the default settings, copy the above code to your
1105:
id:Pengguna:William Surya Permana/comments in local time.js
1009:
To change the timestamp's style, add the code below to
39: 32: 25: 1019: 493: 483: 455: 449: 428: 407: 387: 381: 361: 351: 341: 321: 315: 295: 153:19:00, December 31, 2010, (33 days ago) (UTC-5) 432:to always show the number of months, and : --> 8: 453:for the time to appear before the date, and 411:to always show the number of days, and : --> 1087:document.querySelector('.mw-parser-output') 433:0 to set a maximum number of months to show 412:0 to set a maximum number of days to show 1023:(it's set at 95% font size by default). 505: 459:for the date to appear before the time 116:'User:Gary/comments in local time.js' 73:Before Comments in Local Time is used 7: 1081:, and follow the instructions under 81:After Comments in Local Time is used 1119:User:Gary/comments in local time.js 1112: 1107:– Indonesian version of the script 14: 774:Settings for minimum display text 507:Usage of dropDays and dropMonths 1111: 385:to add the day of the week, and 1101:– a replacement using Moment.js 391:to suppress the day of the week 1: 373:Displays the day of the week. 90:To enable this gadget, go to 1099:User:Mxn/CommentsInLocalTime 1152: 581:2 years, 2 months, 7 days 333:Changes the date's format. 150:can instead be changed to 148:00:00 1 January 2011 (UTC) 133:00:00 1 January 2011 (UTC) 15: 1079:comments in local time.js 765: 705: 645: 585: 525: 1025: 897: 784: 567:1 year, 1 month, 3 days 293:, placing it before the 177: 107: 1136:Knowledge (XXG) scripts 471:instead of the default 1083:LOCALIZING THIS SCRIPT 1015:Cascading Style Sheets 893:custom JavaScript file 780:custom JavaScript file 325:to hide the difference 291:custom JavaScript file 162:Today, 1:00 am (UTC-5) 103:custom JavaScript file 82: 74: 49:Comments in Local Time 80: 72: 1013:and modify it using 1011:your common.css page 508: 687:13 months, 3 days 673:5 months, 18 days 659:2 months, 14 days 641:2 years, 2 months 553:5 months, 18 days 539:2 months, 14 days 506: 83: 75: 769: 768: 357:"January 1, 2009" 1143: 1115: 1114: 1088: 1084: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1029: 1021: 1000: 997: 994: 991: 988: 985: 982: 979: 976: 973: 970: 967: 964: 961: 958: 955: 952: 949: 946: 943: 940: 937: 934: 931: 928: 925: 922: 919: 916: 913: 910: 907: 904: 901: 887: 884: 881: 878: 875: 872: 869: 866: 863: 860: 857: 854: 851: 848: 845: 842: 839: 836: 833: 830: 827: 824: 821: 818: 815: 812: 809: 806: 803: 800: 797: 794: 791: 788: 627:1 year, 1 month 509: 495: 485: 457: 451: 430: 409: 389: 383: 365:for "2009-01-01" 363: 358: 353: 348: 347:"1 January 2009" 343: 323: 317: 297: 280: 277: 274: 271: 268: 265: 262: 259: 256: 253: 250: 247: 244: 241: 238: 235: 232: 229: 226: 223: 220: 217: 214: 211: 208: 205: 202: 199: 196: 193: 190: 187: 184: 181: 174:Default settings 165: 156: 141: 123: 120: 117: 114: 111: 92:your preferences 42: 35: 28: 1151: 1150: 1146: 1145: 1144: 1142: 1141: 1140: 1126: 1125: 1124: 1123: 1120: 1116: 1095: 1086: 1082: 1075: 1063: 1058: 1057: 1054: 1051: 1048: 1045: 1042: 1039: 1036: 1033: 1030: 1027: 1007: 1002: 1001: 998: 995: 992: 989: 987:twentyFourHours 986: 983: 980: 977: 974: 971: 968: 965: 962: 959: 956: 953: 950: 947: 944: 941: 938: 935: 932: 929: 926: 923: 920: 917: 914: 911: 908: 905: 902: 899: 889: 888: 885: 882: 879: 876: 874:twentyFourHours 873: 870: 867: 864: 861: 858: 855: 852: 849: 846: 843: 840: 837: 834: 831: 828: 825: 822: 819: 816: 813: 810: 807: 804: 801: 798: 795: 792: 789: 786: 776: 521:Displayed text 518:Days difference 464:twentyFourHours 356: 346: 287: 285:Custom settings 282: 281: 278: 275: 272: 269: 267:twentyFourHours 266: 263: 260: 257: 254: 251: 248: 245: 242: 239: 236: 233: 230: 227: 224: 221: 218: 215: 212: 209: 206: 203: 200: 197: 194: 191: 188: 185: 182: 179: 176: 171: 160: 151: 136: 130: 125: 124: 121: 118: 115: 112: 109: 88: 46: 45: 38: 31: 24: 20: 12: 11: 5: 1149: 1147: 1139: 1138: 1128: 1127: 1121: 1118: 1117: 1110: 1109: 1108: 1102: 1094: 1091: 1074: 1071: 1062: 1059: 1026: 1006: 1003: 915:dateDifference 898: 802:dateDifference 785: 775: 772: 771: 770: 767: 766: 763: 762: 759: 756: 753: 749: 748: 745: 742: 739: 735: 734: 731: 728: 725: 721: 720: 717: 714: 711: 707: 706: 703: 702: 699: 696: 693: 689: 688: 685: 682: 679: 675: 674: 671: 668: 665: 661: 660: 657: 654: 651: 647: 646: 643: 642: 639: 636: 633: 629: 628: 625: 622: 619: 615: 614: 611: 608: 605: 601: 600: 597: 594: 591: 587: 586: 583: 582: 579: 576: 573: 569: 568: 565: 562: 559: 555: 554: 551: 548: 545: 541: 540: 537: 534: 531: 527: 526: 523: 522: 519: 516: 513: 502: 501: 476: 465: 461: 460: 442: 439: 435: 434: 421: 418: 414: 413: 400: 397: 393: 392: 374: 371: 367: 366: 334: 331: 327: 326: 308: 305: 304:dateDifference 286: 283: 195:dateDifference 178: 175: 172: 170: 167: 135:is changed to 129: 126: 108: 87: 84: 44: 43: 36: 29: 21: 16: 13: 10: 9: 6: 4: 3: 2: 1148: 1137: 1134: 1133: 1131: 1106: 1103: 1100: 1097: 1096: 1092: 1090: 1080: 1072: 1070: 1068: 1060: 1031:localcomments 1024: 1022: 1016: 1012: 1004: 906:LocalComments 896: 894: 793:LocalComments 783: 781: 773: 764: 760: 757: 754: 751: 750: 746: 743: 740: 737: 736: 732: 729: 726: 723: 722: 718: 715: 712: 709: 708: 704: 700: 697: 694: 691: 690: 686: 683: 680: 677: 676: 672: 669: 666: 663: 662: 658: 655: 652: 649: 648: 644: 640: 637: 634: 631: 630: 626: 623: 620: 617: 616: 612: 609: 606: 603: 602: 598: 595: 592: 589: 588: 584: 580: 577: 574: 571: 570: 566: 563: 560: 557: 556: 552: 549: 546: 543: 542: 538: 535: 532: 529: 528: 524: 520: 517: 514: 511: 510: 504: 503: 500: 499:24-hour clock 496: 490: 489:12-hour clock 486: 480: 477: 474: 473:12-hour clock 470: 469:24-hour clock 466: 463: 462: 458: 452: 446: 443: 440: 437: 436: 431: 425: 422: 419: 416: 415: 410: 404: 401: 398: 395: 394: 390: 384: 378: 375: 372: 369: 368: 364: 354: 344: 338: 335: 332: 329: 328: 324: 318: 312: 309: 306: 303: 302: 301: 298: 292: 284: 186:LocalComments 173: 168: 166: 163: 157: 154: 149: 145: 142: 139: 134: 127: 106: 104: 99: 97: 93: 85: 79: 71: 67: 64: 62: 59:that changes 58: 54: 50: 41: 37: 34: 30: 27: 23: 22: 19: 1076: 1073:Localization 1064: 1018: 1008: 890: 777: 492: 482: 478: 454: 448: 444: 427: 423: 406: 402: 386: 380: 376: 360: 350: 340: 336: 320: 314: 310: 296:importScript 294: 288: 161: 158: 152: 147: 146: 143: 137: 132: 131: 110:importScript 100: 95: 89: 86:Installation 65: 48: 47: 1067:preferences 53:source code 40:WP:LOCALISE 33:WP:LOCALIZE 1061:Local time 1049:!important 963:dropMonths 927:dateFormat 850:dropMonths 814:dateFormat 747:13 months 515:dropMonths 417:dropMonths 330:dateFormat 243:dropMonths 207:dateFormat 1037:font-size 975:timeFirst 939:dayOfWeek 862:timeFirst 826:dayOfWeek 733:5 months 613:5 months 438:timeFirst 370:dayOfWeek 255:timeFirst 219:dayOfWeek 18:Shortcuts 1130:Category 1093:See also 951:dropDays 838:dropDays 761:2 years 719:75 days 701:2 years 599:75 days 512:dropDays 396:dropDays 231:dropDays 169:Settings 128:Examples 479:Options 467:Uses a 445:Options 424:Options 403:Options 377:Options 337:Options 311:Options 55:) is a 26:WP:LOCO 1122:script 900:window 787:window 497:for a 491:, and 487:for a 359:, and 180:window 57:gadget 1005:Style 945:false 933:'dmy' 921:false 832:false 820:'dmy' 484:false 456:false 388:false 362:'ymd' 352:'mdy' 342:'dmy' 322:false 273:false 213:'dmy' 1020:100% 993:true 981:true 880:true 868:true 808:true 494:true 450:true 382:true 355:for 345:for 316:true 261:true 225:true 201:true 122:// ] 1043:100 758:800 744:400 730:170 698:800 684:400 670:170 638:800 624:400 610:170 578:800 564:400 550:170 98:" 61:UTC 1132:: 1089:. 1069:. 999:}; 969:24 957:93 895:: 886:}; 856:24 844:93 782:: 755:24 752:93 741:24 738:93 727:24 724:93 716:75 713:24 710:93 695:24 681:24 667:24 656:75 653:24 632:93 618:93 604:93 596:75 590:93 536:75 481:: 447:: 426:: 405:: 379:: 349:, 339:: 313:: 279:}; 119:); 105:: 1055:} 1052:; 1046:% 1040:: 1034:{ 1028:. 996:, 990:: 984:, 978:: 972:, 966:: 960:, 954:: 948:, 942:: 936:, 930:: 924:, 918:: 912:{ 909:= 903:. 883:, 877:: 871:, 865:: 859:, 853:: 847:, 841:: 835:, 829:: 823:, 817:: 811:, 805:: 799:{ 796:= 790:. 692:0 678:0 664:0 650:0 635:0 621:0 607:0 593:0 575:0 572:0 561:0 558:0 547:0 544:0 533:0 530:0 475:. 429:0 408:0 276:, 270:: 264:, 258:: 252:, 249:0 246:: 240:, 237:0 234:: 228:, 222:: 216:, 210:: 204:, 198:: 192:{ 189:= 183:. 164:. 155:. 140:. 113:( 51:(

Index

Shortcuts
WP:LOCO
WP:LOCALIZE
WP:LOCALISE
source code
gadget
UTC


your preferences
custom JavaScript file
custom JavaScript file
24-hour clock
12-hour clock
12-hour clock
24-hour clock
custom JavaScript file
custom JavaScript file
your common.css page
Cascading Style Sheets
preferences
comments in local time.js
User:Mxn/CommentsInLocalTime
id:Pengguna:William Surya Permana/comments in local time.js
Category
Knowledge (XXG) scripts

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.