Repository navigation
Expand file tree
/
Copy pathSuperlinks.js
More file actions
625 lines (582 loc) · 21.2 KB
/
Copy pathSuperlinks.js
File metadata and controls
625 lines (582 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
// Forked from https://en.wikipedia.org/w/index.php?title=User:Bradv/Scripts/Superlinks.js&oldid=1171577516, with thanks to the author of that user script, Bradv.
/*
Changes:
- added support for most skins, not just Vector 2010
- fixed a bug that was breaking article superlinks (talk and user were working OK)
- ran eslint-config-wikimedia linter on the code
- refactored the code to use function keyword, to be flatter (no nested functions), to split apart big functions into multiple smaller functions, and to change short function/variable names to be more descriptive
*/
/* eslint-disable no-irregular-whitespace, no-jquery/no-constructor-attributes, no-jquery/no-done-fail, no-jquery/no-each-util */
( function ( $, mw ) {
const app = {
links: {}
};
function execute() {
// It shows up in modern, but in the top right (hard to see), and in the panel the text is hard to read. Color problems. Disabling in modern for now.
// It doesn't show up at all in minerva. No mw-indicators element perhaps?
// It shows up in CologneBlue. The panels are an inch too high. Going to leave it enabled though. It mostly works.
const allowedSkins = [ 'vector', 'vector-2022', 'monobook', 'timeless', 'cologneblue' ];
if ( !allowedSkins.includes( mw.config.get( 'skin' ) ) ) {
return;
}
loadCss();
placeHtmlAndClickListeners();
}
function loadCss() {
mw.util.addCSS( `
.vector-body-before-content {
/* needed for vector-2022, since .vector-body-before-content is overflow: hidden */
overflow: visible;
}
#superlinks {
display:inline-block;
line-height: 24px;
}
#superlinks-links {
font-size: 0.75em;
color:#555;
}
#superlinks-links label {
padding: 0 0.2em;
}
#superlinks-links > span:before {
content: '(';
}
#superlinks-links > span:after {
content: ') ';
}
#superlinks-links > span > a {
text-transform: lowercase;
}
#superlinks-links a {
padding: 0 0.2em;
color: #0645ad !important;
text-decoration: none !important;
}
#superlinks-links a.active,
#superlinks-links a:hover {
border-bottom: 2px solid #a7d7f9;
}
#superlinks-window {
position: absolute;
top: 48px;
right: 5px;
border: 2px solid #a7d7f9;
width: 45vw;
height: 75vh;
box-shadow: 0px 0px 4px 2px #eee;
z-index: 1;
}
#superlinks-window:before {
content: '';
position: absolute;
top: -20px;
width: 0;
height: 0;
border: 10px solid transparent;
border-bottom-color: #a7d7f9;
margin-right: -16px;
}
#superlinks-window:after {
content: '';
position: absolute;
top: -17px;
width: 0;
height: 0;
border: 10px solid transparent;
border-bottom-color: transparent;
margin-right: -16px;
}
#superlinks-icons {
position:absolute;
left:-2px;
top:-14px;
font-size:10px;
line-height:10px;
background-color:#a7d7f9;
padding: 2px 8px;
}
#superlinks-icons a:not(:first-child) {
margin-left: 20px;
}
#superlinks-icons img {
height: 8px;
margin-top: -1px;
}
#superlinks-content {
overflow: auto;
height: calc(100% - 10px);
width: calc(100% - 10px);
font-size: 90%;
padding:5px;
background-color: #f6fbfe;
}
#superlinks-content > ul#pagehistory > li > input {
display: none;
}
#superlinks-content > #empty {
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #a7d7f9;
font-size: 1.5em;
font-weight: bold;
text-align:center;
}
#superlinks-content > #empty img {
width: 30px;
height: 30px;
opacity:0.5;
}
#superlinks-content > #empty #empty-sub {
font-size: 0.8em;
font-weight: normal;
padding-top: 1em;
}
#superlinks-content > #empty #empty-sub a {
opacity: 0.5;
}
#superlinks-content .mw-changeslist-separator:empty:before {
content: '. .';
}
#superlinks-content .mw-changeslist-links {
display: inline-block;
margin: 0;
padding: 0;
}
#superlinks-content .mw-changeslist-links:before {
content: '(';
}
#superlinks-content .mw-changeslist-links:after {
content: ')';
}
#superlinks-content .mw-changeslist-links > span:not(:first-child):before {
content: ' | ';
}
#superlinks-content .snippet {
line-height: 1.5em;
margin-bottom: 1.5em;
}
#superlinks-content .searchmatch {
font-weight: bold;
}
` );
}
function makeLink( caption, $group ) {
let htmlClass = 'superlinks-link-';
if ( $group ) {
htmlClass += $group.prev().text().toLowerCase().replace( /\s/g, '-' ) + '-';
}
htmlClass += caption.toLowerCase().replace( /\s/g, '-' );
const $link = $( '<a>', {
href: '#',
class: htmlClass
} ).text( caption );
if ( $group ) {
$group.append( $link );
} else {
$( '#superlinks-links' ).append( $link );
}
$link.on( 'click', ( e ) => {
handleClick( e );
} );
return $link[ 0 ];
}
/**
* @return {jQuery}
*/
function makeLinkGroup( caption ) {
if ( caption ) {
$( '#superlinks-links' ).append( $( '<label/>' ).text( caption ) );
}
return $( '<span/>' ).appendTo( $( '#superlinks-links' ) );
}
function makeArticleOrArticleHistoryLinks() {
if ( !app.$articleElement.hasClass( 'new' ) ) {
if ( app.$historyElement.hasClass( 'selected' ) ) { // on history page
app.links.article = makeLink( app.$articleElement.find( 'a' ).text() );
}
if ( app.$historyElement.length && ( !app.$historyElement.hasClass( 'selected' ) ) ) { // not on history page (but it exists)
app.links.history = makeLink( 'History' );
}
}
app.links.logs = makeLink( 'Log' );
app.links.filter = makeLink( 'Filter' );
if ( !app.$talkElement.hasClass( 'new' ) ) { // talk exists
app.links.talk = makeLink( 'Talk' );
}
app.links.notice = makeLink( 'Page Notice' );
}
function makeTalkOrTalkHistoryLinks() {
let $pagegrp, $talkgrp;
if ( !app.$articleElement.hasClass( 'new' ) ) { // article exists
app.links.article = makeLink( app.$articleElement.find( 'a' ).text() );
$pagegrp = makeLinkGroup();
app.links.articleHistory = makeLink( 'History', $pagegrp );
} else {
$pagegrp = makeLinkGroup( app.$articleElement.find( 'a' ).text() );
}
app.links.articleLogs = makeLink( 'Log', $pagegrp );
app.links.articleFilter = makeLink( 'Filter', $pagegrp );
app.links.notice = makeLink( 'Page Notice', $pagegrp );
if ( !app.$talkElement.hasClass( 'new' ) ) { // talk exists
if ( app.$historyElement.hasClass( 'selected' ) ) { // on history page
app.links.talk = makeLink( 'Talk' );
$talkgrp = makeLinkGroup();
} else {
$talkgrp = makeLinkGroup( 'Talk' );
app.links.history = makeLink( 'History', $talkgrp );
}
} else {
$talkgrp = makeLinkGroup( 'Talk' );
}
app.links.logs = makeLink( 'Log', $talkgrp );
app.links.filter = makeLink( 'Filter', $talkgrp );
}
function makeSpecialPageLinks() {
app.links.userpage = makeLink( 'User' );
const $usergrp = makeLinkGroup();
app.links.usertalk = makeLink( 'Talk', $usergrp );
makeUserLinksFragment( $usergrp );
}
function makeUserLinks() {
const $usergrp = makeLinkGroup( 'User' );
makeUserLinksFragment( $usergrp );
}
function makeUserLinksFragment( $usergrp ) {
const specialPageName = mw.config.get( 'wgCanonicalSpecialPageName' );
const isAdmin =
mw.config.get( 'wgUserGroups' ).includes( 'sysop' ) ||
mw.config.get( 'wgGlobalGroups' ).includes( 'global-sysop' ) ||
mw.config.get( 'wgGlobalGroups' ).includes( 'steward' );
if ( specialPageName != 'Contributions' ) {
app.links.contribs = makeLink( 'Contribs', $usergrp );
}
if ( isAdmin && specialPageName != 'DeletedContributions' ) {
app.links.deleted = makeLink( 'Deleted', $usergrp );
}
app.links.actions = makeLink( 'Actions', $usergrp );
app.links.userFilter = makeLink( 'Filter', $usergrp );
app.links.rights = makeLink( 'Rights', $usergrp );
app.links.blocklog = makeLink( 'Blocks', $usergrp );
if ( mw.config.get( 'wgWikiID' ) == 'enwiki' ) {
app.links.restrict = makeLink( 'Restrictions', $usergrp );
}
if ( mw.config.get( 'wgUserGroups' ).includes( 'checkuser' ) ) {
app.links.culog = makeLink( 'checks', $usergrp );
}
}
function placeHtmlAndClickListeners() {
app.$articleElement = $( '#ca-user, [id^="ca-nstab-"]' ).first();
app.$talkElement = $( '#ca-talk' );
app.$historyElement = $( '#ca-history' );
app.relevantUser = mw.config.get( 'wgRelevantUserName' );
if ( app.relevantUser ) {
app.relevantUser = mw.util.wikiUrlencode( app.relevantUser );
}
// Don't run on special pages that aren't associated with a specific user. So for example, don't run on Special:FakePage, Special:FlaggedRevs, or Special:Homepage (doesn't have a relevant user for some reason), Special:Contributions, or Special:DeletedContributions. But do run on Special:Contributions/TheirName (has a relevant user) and Special:DeleteContributions/TheirName.
const isSpecialPage = mw.config.get( 'wgCanonicalSpecialPageName' );
if ( isSpecialPage && !app.relevantUser ) {
return;
}
app.$root = $( '<div>', { id: 'superlinks' } ).text( '[' ).append( $( '<span>', { id: 'superlinks-links' } ) );
app.$root.prependTo( $( 'div.mw-indicators' ) );
if ( isSpecialPage ) { // on special page, like contribs
if ( app.relevantUser ) { // on a page associated with a specific user, such as Special:Contributions/TheirName
makeSpecialPageLinks();
}
} else {
if ( app.$articleElement.hasClass( 'selected' ) ) { // on article or article history
makeArticleOrArticleHistoryLinks();
} else { // on talk or talk history
makeTalkOrTalkHistoryLinks();
}
if ( app.relevantUser ) {
makeUserLinks();
}
const ns = mw.config.get( 'wgNamespaceNumber' );
if ( mw.config.get( 'wgWikiID' ) == 'enwiki' && ns == 0 && mw.loader.getState( 'ext.pageTriage.util' ) != 'registered' ) {
app.links.nppflowchart = makeLink( 'NPP Flowchart' );
}
if ( mw.config.get( 'wgWikiID' ) == 'enwiki' && mw.config.get( 'wgCategories' ).includes( 'Pending AfC submissions' ) ) {
app.links.afcflowchart = makeLink( 'AfC Flowchart' );
}
}
app.$root.append( ']' );
}
function putMessageInPanel( text ) { // blank for loading icon
app.$content.empty();
const $div = $( '<div>', { id: 'empty' } );
if ( text ) {
$div.text( text );
} else {
$div.append( $( '<img>', { src: 'https://upload.wikimedia.org/wikipedia/commons/3/30/Chromiumthrobber.svg' } ) );
}
app.$content.append( $div );
}
function putErrorMessageInPanel() {
app.$content.empty().append( $( `
<div id='empty'>
The page does not exist or could not be loaded.
<div id='empty-sub'>
If this is an error, you can report it <a href='/wiki/User_talk:Novem_Linguae/Scripts/Superlinks.js' target='_blank'>here</a>.
</div>
</div>
` ) );
}
function doFinalPanelLoadingTasks() {
if ( app.$content.children().length === 0 ) {
putMessageInPanel( 'No results' );
}
app.$content.find( 'a[href]' ).not( '[href^="#"]' ).attr( 'target', '_blank' );
app.$content.find( 'input' ).remove();
try {
app.$content.find( '.mw-collapsible' ).makeCollapsible();
} catch ( e ) {}
}
function checkForErrors( response, status ) {
if ( status == 'success' ) {
doFinalPanelLoadingTasks();
} else {
putErrorMessageInPanel();
}
}
function openPanel( url ) {
app.$root.find( '#superlinks-popout' ).remove();
if ( url ) {
app.$root.find( '#superlinks-icons' ).append(
$( '<a>', { id: 'superlinks-popout', href: url, target: '_blank' } ).append(
$( '<img>', { src: 'https://upload.wikimedia.org/wikipedia/commons/e/eb/OOjs_UI_icon_newWindow-ltr.svg' } )
)
);
}
}
function handleClick( e ) {
e.preventDefault();
if ( app.active == e.target ) {
closeAllPanels( e );
} else {
closeAllPanels( e );
app.active = e.target;
$( app.active ).addClass( 'active' );
app.$window = $( '<div>', { id: 'superlinks-window' } ).appendTo( app.$root );
const el = $( e.target )[ 0 ];
const pos = el.offsetParent.offsetWidth - el.offsetLeft - ( el.offsetWidth / 2 );
app.styleSheetFragment = mw.util.addCSS( '#superlinks-window:before {right: ' + pos + 'px} #superlinks-window:after {right: ' + pos + 'px}' );
// Draw the outline of the panel
app.$window.append(
$( '<span>', { id: 'superlinks-icons' } )
.append(
$( '<a>', { href: '#' } )
.text( 'close' )
.on( 'click', ( e ) => closeAllPanels( e ) )
)
);
// Draw the inside of the panel, including a spinner
app.$content = $( '<div>', { id: 'superlinks-content' } ).appendTo( app.$window );
putMessageInPanel();
// Run the API query and put real content in the panel
let url;
switch ( e.target ) {
case app.links.userpage:
url = '/w/index.php?action=render&title=User:' + app.relevantUser;
app.$content.load( url, checkForErrors );
openPanel( '/wiki/User:' + app.relevantUser );
break;
case app.links.usertalk:
url = '/w/index.php?action=render&title=User_talk:' + app.relevantUser;
app.$content.load( url, checkForErrors );
openPanel( '/wiki/User_talk:' + app.relevantUser );
break;
case app.links.article:
url = app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/w/index.php?action=render&title=' );
app.$content.load( url, checkForErrors );
openPanel( app.$articleElement.find( 'a' )[ 0 ].href );
break;
case app.links.articleHistory:
url = app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/w/index.php?action=history&safemode=1&limit=100&title=' );
app.$content.load( url + ' #pagehistory', checkForErrors );
openPanel( app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/w/index.php?action=history&title=' ) );
break;
case app.links.talk:
url = $( '#ca-talk > a' )[ 0 ].href.replace( '/wiki/', '/w/index.php?action=render&title=' );
app.$content.load( url, checkForErrors );
openPanel( $( '#ca-talk > a' )[ 0 ].href );
break;
case app.links.history:
url = $( '#ca-history > a' )[ 0 ].href + '&safemode=1&limit=100';
app.$content.load( url + ' #pagehistory', checkForErrors );
openPanel( $( '#ca-history > a' )[ 0 ].href );
break;
case app.links.articleLogs:
url = app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/wiki/Special:Log?wpfilters%5B%5D=patrol&safemode=1&limit=100&page=' );
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/wiki/Special:Log?wpfilters%5B%5D=patrol&page=' ) );
break;
case app.links.logs:
url = '/w/index.php?title=Special:Log&wpfilters%5B%5D=patrol&page=' + mw.config.get( 'wgPageName' ) + '&safemode=1&limit=100';
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( '/w/index.php?title=Special:Log&wpfilters%5B%5D=patrol&page=' + mw.config.get( 'wgPageName' ) );
break;
case app.links.notice:
url = app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/w/index.php?action=render&title=Template:Editnotices/Page/' );
app.$content.load( url, checkForErrors );
openPanel( url.replace( 'action=render&', '' ) );
break;
case app.links.contribs:
url = '/w/index.php?title=Special:Contributions/' + app.relevantUser + '&safemode=1&limit=100';
app.$content.load( url + ' #mw-content-text ul.mw-contributions-list', checkForErrors );
openPanel( '/w/index.php?title=Special:Contributions/' + app.relevantUser );
break;
case app.links.deleted:
url = '/w/index.php?title=Special:DeletedContributions/' + app.relevantUser + '&safemode=1&limit=100';
app.$content.load( url + ' #mw-content-text > section', checkForErrors );
openPanel( '/w/index.php?title=Special:DeletedContributions/' + app.relevantUser );
break;
case app.links.actions:
url = '/wiki/Special:Log/' + app.relevantUser;
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( '/wiki/Special:Log/' + app.relevantUser );
break;
case app.links.blocklog:
url = '/w/index.php?title=Special:Log/block&page=' + app.relevantUser + '&safemode=1';
app.$content.load( url + ' #mw-log-deleterevision-submit ul', checkForErrors );
openPanel( '/w/index.php?title=Special:Log/block&page=' + app.relevantUser );
break;
case app.links.filter:
url = '/w/index.php?title=Special:AbuseLog&wpSearchTitle=' + mw.config.get( 'wgPageName' ) + '&safemode=1';
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( '/w/index.php?title=Special:AbuseLog&wpSearchTitle=' + mw.config.get( 'wgPageName' ) );
break;
case app.links.articleFilter:
url = app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/wiki/Special:AbuseLog?safemode=1&wpSearchTitle=' );
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( app.$articleElement.find( 'a' )[ 0 ].href.replace( '/wiki/', '/wiki/Special:AbuseLog?wpSearchTitle=' ) );
break;
case app.links.userFilter:
url = '/w/index.php?title=Special:AbuseLog&wpSearchUser=' + app.relevantUser + '&safemode=1';
app.$content.load( url + ' #mw-content-text ul', checkForErrors );
openPanel( '/w/index.php?title=Special:AbuseLog&wpSearchUser=' + app.relevantUser );
break;
case app.links.rights:
url = '/w/index.php?title=Special:UserRights&user=' + app.relevantUser + '&safemode=1';
app.$content.load( url + ' #mw-content-text > ul', checkForErrors );
openPanel( '/wiki/Special:UserRights/' + app.relevantUser );
break;
case app.links.culog:
url = '/w/index.php?title=Special:CheckUserLog&cuSearchType=target&cuSearch=' + app.relevantUser;
app.$content.load( url + ' #mw-content-text > ul', checkForErrors );
openPanel( '/w/index.php?title=Special:CheckUserLog&cuSearchType=target&cuSearch=' + app.relevantUser );
break;
case app.links.nppflowchart:
app.$content.empty().append(
$( '<img>', {
src: 'https://upload.wikimedia.org/wikipedia/commons/f/f4/NPP_flowchart.svg',
style: 'width: 100%'
} )
);
break;
case app.links.afcflowchart:
app.$content.empty().append(
$( '<img>', {
src: 'https://upload.wikimedia.org/wikipedia/en/a/a8/Flow_chart_for_AFC_3.1.png',
style: 'width: 100%'
} )
);
break;
case app.links.restrict:
openEditingRestrictionsPanel();
break;
}
app.$keyup = $( 'body' ).on( 'keyup', ( event ) => {
const escapeKey = 27;
if ( event.which == escapeKey ) {
closeAllPanels( event );
}
} );
}
}
function openEditingRestrictionsPanel() {
const $editingRestrictions = $( '<div>' ).appendTo( app.$content );
$.getJSON( '/w/api.php', {
action: 'query',
format: 'json',
list: 'search',
srsearch: 'User:' + app.relevantUser + ' prefix:Wikipedia:Editing restrictions/',
srnamespace: 4
} )
.done( ( data ) => {
app.$content.find( '#empty' ).remove();
if ( data.query.search.length ) {
$editingRestrictions.append( $( '<h2/>' )
.append( '<span/>', { class: 'mw-headline' } )
.text( 'Search results: Wikipedia:Editing restrictions' ) );
$.each( data.query.search, ( i, result ) => {
$editingRestrictions.append( $( '<p style="font-weight:bold"/>' )
.append( $( '<a/>', {
href: '/wiki/' + result.title.replace( / /g, '_' ) + '#:~:text=' + app.relevantUser,
title: result.title
} ).text( result.title ) ) );
$editingRestrictions.append( $( '<p class="snippet">' + result.snippet + '</p>' ) );
$editingRestrictions.append( $( '<hr/>' ) );
} );
} else {
$editingRestrictions.remove();
}
doFinalPanelLoadingTasks();
} )
.fail( () => {
putErrorMessageInPanel();
} );
const $arbitrationEnforcement = $( '<div>' ).appendTo( app.$content );
$.getJSON( '/w/api.php', {
action: 'query',
format: 'json',
list: 'search',
srsearch: 'User:' + app.relevantUser + ' prefix:Wikipedia:Arbitration enforcement log/',
srnamespace: 4
} )
.done( ( data ) => {
app.$content.find( '#empty' ).remove();
if ( data.query.search.length ) {
$arbitrationEnforcement.append( $( '<h2/>' )
.append( '<span/>', { class: 'mw-headline' } )
.text( 'Search results: Wikipedia:Arbitration enforcement log' ) );
$.each( data.query.search, ( i, result ) => {
$arbitrationEnforcement.append( $( '<p style="font-weight:bold"/>' )
.append( $( '<a/>', {
href: '/wiki/' + result.title.replace( / /g, '_' ) + '#:~:text=' + app.relevantUser,
title: result.title
} ).text( result.title ) ) );
$arbitrationEnforcement.append( $( '<p class="snippet">' + result.snippet + '</p>' ) );
$arbitrationEnforcement.append( $( '<hr/>' ) );
} );
} else {
$arbitrationEnforcement.remove();
}
doFinalPanelLoadingTasks();
} )
.fail( () => {
putErrorMessageInPanel();
} );
}
function closeAllPanels( e ) {
if ( e ) {
e.preventDefault();
}
$( 'body' ).off( 'keyup', app.$keyup );
if ( app.styleSheetFragment ) {
$( app.styleSheetFragment.ownerNode ).remove();
app.styleSheetFragment = null;
}
$( app.$window ).remove();
$( app.active ).removeClass( 'active' );
app.active = null;
}
$( () => {
mw.loader.using( [ 'mediawiki.util' ], () => {
execute();
} );
} );
}( jQuery, mediaWiki ) );