ورتنوالا:Yethrosh/Urdu2Pnp.js
نوٹ: بچان مگروں توانوں اپنے براؤزر دے کاشے توں بار جانا پوے گا تبدیلیاں ویکھن لئی۔
- Firefox / Safari: Shift پھڑی رکھو ریلوڈ تے کلکنگ کردیاں ہویاںCtrl-F5 or Ctrl-R (Command-R میک تے)
- گوکل کروم: دباؤ Ctrl-Shift-R (Command-Shift-R میک تے)
Internet Explorer: hold Ctrl کلک کردیاں Refresh, یا دباؤ Ctrl-F5 Konqueror:کلک ریلوڈ یا F5 دباؤ۔ Opera: کاشے نوں صاف کرو آوزار → تانگاں
$(function() {
function loadPage(title, callback) {
new mw.Api().get({
action: 'query',
prop: 'revisions',
titles: title,
rvprop: 'content',
format: 'json'
}).done(function(data) {
try {
callback($.map(data.query.pages, function(value) {
return value;
})[0].revisions[0]['*']);
} catch (exception) {
callback('');
}
}).fail(function(data) {
callback($.map(data.query.pages, function(value) {
return value;
})[0].revisions[0]);
});
}
function savePage(title, text, summary, callback) {
new mw.Api().post({
action: 'edit',
title: title,
text: text,
summary: summary,
minor: '',
token: mw.user.tokens.get('editToken')
}).done(function(data) {
if (data.error && data.error.info) {
mw.notify(data.error.info);
} else {
callback();
}
}).fail(function(data) {
mw.notify(data);
});
}
function addBotLink(botName, id, tooltip, note, botUrl, imageUrl) {
$(mw.util.addPortletLink(
'p-cactions',
'#',
botName,
id,
tooltip
)).click(function(e) {
e.preventDefault();
mw.notify(note, {
autoHide: true
});
var pageTitle=mw.config.get('wgTitle');
$.get(new mw.Uri(botUrl).extend({
title: pageTitle,
urwiki: mw.config.get('wgTitle').replace(/ /g,'_'),
user: 'ورتنوالا:' + mw.config.get('wgUserName'),
namespace: mw.config.get('wgNamespaceNumber')
}).toString()).then(function(result) {
mw.notify(result.msg, {
autoHide: true
});
var resultmsg = result.msg;
var uri = new mw.Uri(),
pageTitle;
if (id === 'ca-eval' && mw.config.get('wgNamespaceNumber') === 0) {
pageTitle = 'گل_بات:' + mw.config.get('wgPageName');
} else if (id === 'ca-articleneeded') {
pageTitle = resultmsg;
} else {
pageTitle = mw.config.get('wgPageName');
}
uri.query = {
'title': pageTitle,
'diff': 'cur',
'oldid': 'prev'
};
uri.path = mw.config.get('wgScriptPath') + '/index.php';
if (id === 'ca-addzumra' && id === 'ca-filling'&& id === 'ca-navebox' && id === 'ca-pipe'){
window.location = uri.toString();
}else if (id === 'ca-r-replace'){
mw.notify('متھیا کم ہُندا پیا اے۔۔۔');
}else{
setTimeout(function() {
var uri = new mw.Uri();
uri.query = {
'title': pageTitle
};
uri.path = mw.config.get('wgScriptPath') + '/index.php';
window.location = uri.toString();
}, 8000);
}
});
}).find('a').prepend(imageUrl ? [$('<img>', {
src: imageUrl,
height: 20,
width: 20
}), ' '] : '');
}
if (mw.config.get('wgNamespaceNumber') === 0) {
addBotLink(
'ترجمہ کرو',
'ca-ur2pnb',
'خودکار طور اُتے ترجمہ کرو',
'بولی وٹاندا ہُندا پیا اے، مہربانی کر کے کجھ چر مگروں صفحہ تازہ کر لو کیونجے تبدیلیاں نظر آ سکن۔',
'//tools.wmflabs.org/shuaib-bot/ur2pnb.php',
'//upload.wikimedia.org/wikipedia/commons/8/81/Ic_border_color_48px.svg'
);
}
});