-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectableLanguageList.js
More file actions
41 lines (33 loc) · 949 Bytes
/
SelectableLanguageList.js
File metadata and controls
41 lines (33 loc) · 949 Bytes
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
jQuery(function($)
{
var $ptLanguagesList = mw.util.$content.find("td.mw-pt-languages-list");
if($ptLanguagesList.size() > 0)
{
$select = $('<select id="pt-langages-select"></select>');
$progressImages = $('<span id="pt-languages-progressImages" />');
progressImageList = {};
$shownImage = $("<img />");
$ptLanguagesList.children("a").each(function()
{
$language = $(this);
title = $language.attr("title");
$option = $("<option></option>")
.attr("value", title)
.append($language.text());
$img = $language.children("img").hide();
$progressImages.append($img);
progressImageList[title] = $img;
$select.append($option);
});
$ptLanguagesList.empty()
.append($select)
.append($progressImages)
.css("vertical-align", "bottom");
$select.change(function()
{
$shownImage.hide();
$shownImage = progressImageList[$(this).val()];
$shownImage.show();
});
}
});