Knowledge (XXG)

User:Nardog/SmartDiff

Source 📝

770:
If you want the script to recognize certain magic words it does not by default and stop linking them as templates, you can do so by adding code like below to your common.js or global.js. This example adds localized variables for
80:
This script turns wikilinks, external links, and template/module calls in a diff into clickable links. It shows links to nonexistent pages in red, and keeps the linked part to a minimum to avoid
207:
To do it, add code like below to your common.js (templates vary by wiki, so even if you have installed the script globally, it is recommended to have different code on each wiki).
951:
Verifies the result after processing each line, so it will never alter the substance of a diff even if it makes a mistake (and notifies you in such an event so you can report it).
948:
classes, so if you style them in your CSS (or use the gadget "Display links to disambiguation pages in orange"), they appear the same as in the page body.
714: 1127: 204:. Linking of named parameters is not supported, and the template call and parameters must be in the same line for the latter to be linked. 140: 649:, no underscores, start with a capital letter except on Wiktionary). Redirects are not resolved, so include all you expect to find. 1133: 1058: 1155: 991: 985: 807: 85: 1115: 1099: 1121: 1109: 1064: 1007: 964:
The detection/retrieval of red links and link classes is capped at 500 unique page names (10 API calls) per diff.
1136:– Warns when you try to use "Preview page with this template" with a page that doesn't transclude the template. 1017: 101: 72: 105: 1023: 1001: 854: 131:'//en.wikipedia.org/search/?title=User:Nardog/SmartDiff.js&action=raw&ctype=text/javascript' 1080: 1039: 830: 81: 36: 1070: 1052: 906: 707:, the namespace prefix will be added even if the input begins with a valid namespace prefix (so e.g. 1029: 149: 145: 1112:– Autofills "Preview page with this template" with the most relevant /testcases page that exists. 1086: 898: 1074: 179: 678:
Specify the range of parameters to link. If omitted, all unnamed parameters will be linked.
689: 1004:– Adds links to diffs of consecutive edits by the same user on watchlist, history, etc. 198: 1020:– Adds a button to copy the unencoded page title or section path next to each heading. 1149: 1118:– Links "diff" and "hist" for category additions/removals on Watchlist/RecentChanges. 166:
You can instruct the script to link certain unnamed parameters in templates, so e.g.
1038:– Makes links and template calls in diffs clickable (supports red links, avoids 894: 710: 188: 175: 54: 17: 1089:– Converts each piped link to a non-piped one if both lead to the same article. 779:
in Polish (a trailing colon is required if the magic word accepts a variable).
995: 35:
Makes links and template calls in diffs clickable (supports red links, avoids
1083:– Replaces reference names like ":0" with descriptive ones like "Smith-2015". 967: 1106:
as you edit so only the modified section will be linked in the summary.
891:
Supports customizable linking of unnamed parameters in templates (e.g.
645:
Template names to apply this object to. Must be well-formed names (no
1124:– Upload an image to Commons from anywhere on the site by pasting it. 61: 940:
Adds to links to redirects and disambiguation pages the respective
810:
in its concept, and makes improvements on it. Differences include:
240:
Here is an example based on templates on English Knowledge (XXG).
998:, e.g. changing the color theme and enabling live autocompletion. 861:
Recognizes relative links to and transclusions of subpages (e.g.
757:
Specify the range of parameters to suppress redirects (by adding
1130:– Sorts the list of local accounts on CentralAuth by edit count. 1067:– Insert any character by searching in the entire Unicode chart. 869: 971: 988:– Lists recent category additions/removals on a category page. 910: 1073:– Type in IPA symbols by directly looking at an IPA key like 1032:– Hides specified users' edits on Watchlist/RecentChanges. 1010:– Adds a button to copy the content of each code block ( 740:
is useful for linking to a special page or sister site.
521:// {{Distinguish}}, {{Further}}, {{Main}}, {{See also}} 1055:– Partially undo changes by double-clicking on a diff. 629:
The objects can have the following properties (only
68: 53: 43: 31: 153:and click "Install" in the infobox on this page. 89: 1026:– Lists the past moves a page has gone through. 916: 8: 184:. This is useful for linking templates like 26: 968: 736:String to prepend or append to the input. 243: 25: 169:{{tl|reflist}} 886:{{{1}}} 7: 1011: 933:Shows external and interwiki links 847:Recognizes template names without 839: 24: 814:Shows links to nonexistent pages 806:This script owes a great debt to 401:// {{Reply to}}, {{Re}}, {{Ping}} 954:Does not support image previews. 875:{{PAGENAME}} 494:// {{Other uses}}, {{Otheruses}} 881:{{#if:...}} 815: 715:Knowledge (XXG):Cleanup/Header 1: 926:in multilingual wikis, as in 836:Links section headings (e.g. 1077:and clicking on the symbols. 49:    (3 months ago) 802:Comparison with fancy-diffs 1172: 1128:SortCentralAuthByEditCount 162:Template parameter linking 994:– Allows customizing the 978: 888:etc.) for template calls. 872:and template parameters ( 808:Enterprisey's fancy-diffs 868:Does not mistake common 781: 254: 209: 110: 73:User:Nardog/SmartDiff.js 1156:Knowledge (XXG) scripts 1061:– Expands contractions. 851:in the same line (e.g. 60:Chrome, Firefox, etc. ( 1102:– Adds or refines the 139:Or you may enable the 922:Links content inside 719:is linked correctly). 100:Add the following to 1134:TemplatePreviewGuard 937:as in the page body. 981:Extra functionality 790:smartdiffMagicWords 28: 1104:/* section link */ 1059:ExpandContractions 1047:Editing assistance 641:(array of strings) 263:smartdiffTemplates 227:// Objects go here 218:smartdiffTemplates 194:and hatnotes like 90:further comparison 1143: 1142: 935:in the same color 621: 620: 78: 77: 1163: 1105: 1075:Help:IPA/English 1013: 992:CodeEditorAssist 986:CatChangesViewer 973:Nardog's scripts 969: 947: 943: 936: 929: 925: 914: 902: 887: 883: 882: 877: 876: 864: 857: 850: 843: 828: 824: 817: 797: 794: 791: 788: 785: 778: 774: 760: 754: 751: 748: 745: 739: 733: 730: 727: 724: 718: 706: 700: 697: 690:Namespace number 686: 683: 675: 672: 669: 666: 663: 660: 657: 654: 648: 642: 639: 632: 615: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 558: 555: 552: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 492: 489: 486: 483: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 375: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 336: 333: 330: 327: 324: 321: 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 279: 276: 273: 272:// {{t}}, {{tl}} 270: 267: 264: 261: 258: 244: 231: 228: 225: 222: 219: 216: 213: 203: 197: 193: 187: 183: 171: 170: 152: 141:script installer 135: 132: 129: 126: 123: 120: 117: 114: 29: 1171: 1170: 1166: 1165: 1164: 1162: 1161: 1160: 1146: 1145: 1144: 1139: 1116:CatChangeLinker 1103: 1100:AutoSectionLink 1094:Itch scratchers 974: 961: 945: 941: 934: 927: 923: 904: 892: 885: 880: 879: 874: 873: 862: 852: 848: 837: 826: 822: 804: 799: 798: 795: 792: 789: 786: 783: 776: 772: 768: 761:to the URL) in. 758: 752: 749: 746: 744:noRedirectStart 743: 737: 731: 728: 725: 722: 708: 704: 698: 695: 684: 681: 673: 670: 667: 664: 661: 658: 655: 652: 646: 640: 637: 630: 627: 622: 617: 616: 613: 610: 608:'phab:' 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 547: 544: 541: 538: 536:// {{Redirect}} 535: 532: 529: 526: 523: 520: 517: 514: 511: 508: 505: 502: 499: 496: 493: 490: 487: 484: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 337: 334: 331: 328: 325: 322: 319: 316: 313: 310: 307: 304: 301: 298: 295: 292: 289: 286: 283: 280: 277: 274: 271: 268: 265: 262: 259: 256: 249: 238: 233: 232: 229: 226: 223: 220: 217: 214: 211: 201: 195: 191: 185: 173: 168: 167: 164: 159: 144: 137: 136: 133: 130: 127: 124: 121: 118: 115: 112: 98: 48: 22: 21: 20: 12: 11: 5: 1169: 1167: 1159: 1158: 1148: 1147: 1141: 1140: 1138: 1137: 1131: 1125: 1122:PasteToCommons 1119: 1113: 1107: 1091: 1090: 1084: 1078: 1068: 1062: 1056: 1044: 1043: 1033: 1027: 1021: 1015: 1005: 999: 989: 979: 976: 975: 972: 966: 965: 960: 957: 956: 955: 952: 949: 938: 931: 920: 889: 866: 859: 855:Infobox person 845: 834: 819: 803: 800: 782: 767: 764: 763: 762: 755: 741: 734: 720: 701: 693: 687: 679: 676: 650: 643: 633:is required): 626: 623: 619: 618: 575:// {{Tracked}} 255: 251: 250: 247: 242: 237: 234: 210: 163: 160: 158: 155: 111: 102:your common.js 97: 94: 76: 75: 70: 66: 65: 58: 51: 50: 45: 41: 40: 33: 23: 15: 14: 13: 10: 9: 6: 4: 3: 2: 1168: 1157: 1154: 1153: 1151: 1135: 1132: 1129: 1126: 1123: 1120: 1117: 1114: 1111: 1110:AutoTestcases 1108: 1101: 1098: 1097: 1096: 1095: 1088: 1085: 1082: 1079: 1076: 1072: 1069: 1066: 1065:InsertAnyChar 1063: 1060: 1057: 1054: 1051: 1050: 1049: 1048: 1041: 1037: 1034: 1031: 1028: 1025: 1022: 1019: 1016: 1009: 1008:CopyCodeBlock 1006: 1003: 1000: 997: 993: 990: 987: 984: 983: 982: 977: 970: 963: 962: 958: 953: 950: 939: 932: 921: 918: 912: 908: 900: 896: 890: 871: 867: 860: 856: 846: 841: 840:Customization 835: 832: 820: 813: 812: 811: 809: 801: 780: 765: 756: 750:noRedirectEnd 742: 735: 721: 716: 712: 702: 694: 692:for the link. 691: 688: 680: 677: 651: 644: 636: 635: 634: 624: 563:noRedirectEnd 253: 252: 246: 245: 241: 235: 208: 205: 200: 190: 181: 177: 161: 157:Customization 156: 154: 151: 147: 142: 109: 107: 103: 95: 93: 91: 87: 83: 74: 71: 67: 63: 59: 56: 52: 47:June 10, 2024 46: 42: 38: 34: 30: 19: 1093: 1092: 1046: 1045: 1040:WP:SEAOFBLUE 1035: 1018:CopySectLink 980: 913:}} 905:{{ 901:}} 893:{{ 831:WP:SEAOFBLUE 805: 769: 717:}} 709:{{ 628: 428:// {{About}} 248:Example code 239: 206: 202:}} 196:{{ 192:}} 186:{{ 182:}} 174:{{ 165: 138: 99: 96:Installation 82:WP:SEAOFBLUE 79: 37:WP:SEAOFBLUE 1024:MoveHistory 1012:<pre> 1002:Consecudiff 996:code editor 959:Limitations 946:mw-disambig 942:mw-redirect 907:distinguish 870:magic words 829:, avoiding 821:Links only 777:DEFAULTSORT 766:Magic words 759:redirect=no 172:appears as 146:Preferences 86:fancy-diffs 32:Description 18:User:Nardog 1081:RefRenamer 467:// {{For}} 323:// {{tlx}} 1036:SmartDiff 699:(boolean) 682:namespace 674:(boolean) 662:(number); 647:Template: 416:namespace 389:namespace 350:namespace 299:namespace 106:global.js 84:, unlike 64:+ needed) 27:SmartDiff 1150:Category 1071:IPAInput 1053:DiffUndo 899:Cite web 773:PAGENAME 753:(number) 732:(string) 685:(number) 671:skipEven 551:skipEven 455:skipEven 362:// {{u}} 148: → 1030:RCMuter 696:forceNs 665:skipOdd 311:forceNs 236:Example 180:reflist 150:Gadgets 57:support 55:Browser 44:Updated 1087:Unpipe 915:)—see 909:| 897:| 816:in red 784:window 738:prefix 729:suffix 723:prefix 713:| 625:Schema 602:prefix 257:window 212:window 178:| 119:loader 69:Source 62:ES2018 917:above 653:start 638:names 631:names 581:names 542:names 527:names 500:names 482:start 473:names 443:start 434:names 407:names 368:names 329:names 278:names 199:About 16:< 944:and 924:tvar 825:and 775:and 705:true 557:true 461:true 317:true 125:load 911:Foo 838:== 703:If 659:end 590:end 509:end 377:end 338:end 287:end 143:in 104:or 92:). 1152:: 1042:). 1014:). 903:, 895:tl 884:, 878:, 865:). 858:). 853:{{ 849:}} 844:). 842:== 747:, 726:, 711:tl 668:, 656:, 614:]; 611:}, 572:}, 533:}, 518:}, 491:}, 464:}, 425:}, 398:}, 359:}, 356:10 320:}, 305:10 230:]; 189:tl 176:tl 134:); 113:mw 108:: 930:. 928:] 919:. 863:] 833:. 827:] 823:] 818:. 796:; 793:= 787:. 605:: 599:, 596:1 593:: 587:, 584:: 578:{ 569:1 566:: 560:, 554:: 548:, 545:: 539:{ 530:: 524:{ 515:1 512:: 506:, 503:: 497:{ 488:2 485:: 479:, 476:: 470:{ 458:: 452:, 449:3 446:: 440:, 437:: 431:{ 422:1 419:: 413:, 410:: 404:{ 395:1 392:: 386:, 383:1 380:: 374:, 371:: 365:{ 353:: 347:, 344:1 341:: 335:, 332:: 326:{ 314:: 308:, 302:: 296:, 293:1 290:: 284:, 281:: 275:{ 269:[ 266:= 260:. 224:[ 221:= 215:. 128:( 122:. 116:. 88:( 39:)

Index

User:Nardog
WP:SEAOFBLUE
Browser
ES2018
User:Nardog/SmartDiff.js
WP:SEAOFBLUE
fancy-diffs
further comparison
your common.js
global.js
script installer
Preferences
Gadgets
tl
reflist
tl
About
Namespace number
tl
Knowledge (XXG):Cleanup/Header
Enterprisey's fancy-diffs
WP:SEAOFBLUE
Customization
Infobox person
magic words
tl
Cite web
distinguish
Foo
above

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