مدیاویکی:Gadget-CatMaker.js: تفاوت میان نسخهها
ظاهر
imported>Yamaha5 صفحهای جدید حاوی «$(function () { if (wgNamespaceNumber !== 14 || $('.noarticletext').length === 0) { return; } $(mw.util.addPortletLink('p-views',...» ایجاد کرد |
imported>Yamaha5 بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
//--------------Get cat---------------------- | |||
function GetCategory(title) { | |||
new mw.Api().get({ | |||
action: 'query', | |||
prop: 'categories', | |||
titles: title, | |||
clshow: '!hidden', | |||
format: 'json', | |||
cllimit: '500', | |||
}).done(GetCatList); | |||
} | |||
function GetCatList(data) { | |||
var Categories= data["query"]["pages"][Object.keys(data["query"]["pages"])]["categories"]; | |||
for (i in Categories) { | |||
CatName=Categories[i]["title"] | |||
alert(CatName); | |||
} | |||
} | |||
//var test=GetCategory('ایران') | |||
//-------------------------------------------- | |||
$(function () { | $(function () { | ||
if (wgNamespaceNumber !== 14 || $('.noarticletext').length === 0) { | if (wgNamespaceNumber !== 14 || $('.noarticletext').length === 0) { | ||
نسخهٔ ۲۸ مارس ۲۰۱۴، ساعت ۱۳:۴۴
//--------------Get cat----------------------
function GetCategory(title) {
new mw.Api().get({
action: 'query',
prop: 'categories',
titles: title,
clshow: '!hidden',
format: 'json',
cllimit: '500',
}).done(GetCatList);
}
function GetCatList(data) {
var Categories= data["query"]["pages"][Object.keys(data["query"]["pages"])]["categories"];
for (i in Categories) {
CatName=Categories[i]["title"]
alert(CatName);
}
}
//var test=GetCategory('ایران')
//--------------------------------------------
$(function () {
if (wgNamespaceNumber !== 14 || $('.noarticletext').length === 0) {
return;
}
$(mw.util.addPortletLink('p-views', '#', 'ردهساز', 'ca-catmaker'))
.click(function (e) {
alert(prompt('نام ردهٔ معادل انگلیسی؟'));
e.preventDefault();
});
});