MediaWiki:Gadget-iw-links.js - Wikiźródła, wolna biblioteka
Przejdź do zawartości
Z Wikiźródeł, wolnej biblioteki
Uwaga:
aby zobaczyć zmiany po opublikowaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.
Firefox / Safari:
Przytrzymaj
Shift
podczas klikania
Odśwież bieżącą stronę
, lub naciśnij klawisze
Ctrl+F5
, lub
Ctrl+R
⌘-R
na komputerze Mac)
Google Chrome:
Naciśnij
Ctrl-Shift-R
⌘-Shift-R
na komputerze Mac)
Edge:
Przytrzymaj
Ctrl
, jednocześnie klikając
Odśwież
, lub naciśnij klawisze
Ctrl+F5
Opera:
Naciśnij klawisze
Ctrl+F5
/*
* @author: [[:pl:User:Beau]]
*/
/* Translatable strings */
mw
messages
set
'iw-whl-not-found'
'Brak.'
'iw-whl-error-unable-to-fetch'
'Nie udało się pobrać linkujących.'
'iw-whl-error-empty-title'
'Podaj nazwę strony.'
'iw-whl-fetching-links'
'Sprawdzanie linkujących...'
'iw-whl-button-show'
'Pokaż linkujące z siostrzanych projektów'
'iw-whl-sister-project-links'
'Linkujące z projektu $1'
'iw-whl-current-project-links'
'Linkujące z bieżącego projektu'
'iw-whl-project-wikipedia'
'Wikipedia'
'iw-whl-project-wikisource'
'Wikiźródła'
'iw-whl-project-wiktionary'
'Wikisłownik'
'iw-whl-project-wikibooks'
'Wikibooks'
'iw-whl-project-wikinews'
'Wikinews'
'iw-whl-project-wikiquote'
'Wikicytaty'
'iw-whl-project-wikiversity'
'Wikiversity'
);
window
whatLinksHereGadget
/** Version of the gadget */
version
/** List of families for Polish projects. Should obtain this list using sitematrix api call. */
families
name
'wikipedia'
prefix
'w'
title
mw
msg
'iw-whl-project-wikipedia'
},
name
'wikisource'
prefix
's'
title
mw
msg
'iw-whl-project-wikisource'
},
name
'wiktionary'
prefix
'wikt'
title
mw
msg
'iw-whl-project-wiktionary'
},
name
'wikibooks'
prefix
'b'
title
mw
msg
'iw-whl-project-wikibooks'
},
name
'wikinews'
prefix
'n'
title
mw
msg
'iw-whl-project-wikinews'
},
name
'wikiquote'
prefix
'q'
title
mw
msg
'iw-whl-project-wikiquote'
/*,
name: 'wikiversity',
prefix: 'v',
title: mw.msg('iw-whl-project-wikiversity')
}*/
],
/** A family of the wiki the gadget is running on */
family
null
/** A prefix of the wiki the gadget is running on */
prefix
null
/** A url template for article links */
articleUrl
null
/** A url template for api links */
apiUrl
null
ajax
true
/** An identifier of last sent request */
lastRequestId
/** An array requestId => requestCallback */
callbacks
{},
/** Sets up the gadget */
init
function
()
var
that
this
var
server
mw
config
get
'wgServer'
);
var
server
match
/^(?:https?:)?\/\/(.+)\.([^.]+)\.org$/
);
if
this
family
];
this
articleUrl
"//"
".$1.org/wiki/$2"
this
apiUrl
"//"
".$1.org/w/api.php"
this
ajax
false
if
this
family
return
for
var
in
this
families
var
this
families
];
if
name
==
this
family
this
prefix
prefix
break
if
this
prefix
return
if
mw
config
get
'wgCanonicalSpecialPageName'
==
"Whatlinkshere"
var
$fieldset
jQuery
'#namespace'
).
parents
'fieldset'
).
find
'.mw-htmlform-submit-buttons'
);
if
$fieldset
length
return
var
buttonIwl
new
OO
ui
ButtonWidget
label
mw
msg
'iw-whl-button-show'
);
buttonIwl
$element
on
'click'
function
()
that
show
();
);
$fieldset
append
buttonIwl
$element
);
},
/** Executes the callback function for all families except the current one */
forEachFamily
function
callback
for
var
in
this
families
var
this
families
];
// Ignore current wiki
if
name
==
this
family
continue
callback
);
},
/** Shows the list of links */
show
function
()
var
target
jQuery
trim
jQuery
'#mw-whatlinkshere-target'
).
children
'input'
).
val
()
).
replace
/ /g
'_'
);
if
target
==
''
alert
mw
msg
'iw-whl-error-empty-title'
);
return
if
this
uiVisible
this
uiVisible
true
var
$p
jQuery
'fieldset'
).
parent
'form'
).
parent
().
next
'p'
);
$p
after
jQuery
'

'
).
append
mw
msg
'iw-whl-current-project-links'
);
var
$list
jQuery
'
'
);
this
forEachFamily
function
family
$list
append
''
'