User:Maruf/crossWiki.js
<
User:মোহাম্মদ মারুফ/crossWiki.js
)Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Maruf/crossWiki. |
/*
****************************************
*** ব্যবহারকারী:মোহাম্মদ মারুফ/crossWiki.js: crossWiki module
****************************************
* This module is used to edit pages on other wikis.
* It is used by the crossWiki module.
* created by: [[w:bn:User:মোহাম্মদ মারুফ]]
* License: CC-BY-SA 3.0
* Version: 1.0
* Last updated: 2022-12-10
* Documentation: https://bn.wikipedia.org/wiki/ব্যবহারকারী:মোহাম্মদ মারুফ/crossWiki
* Source: https://bn.wikipedia.org/wiki/ব্যবহারকারী:মোহাম্মদ মারুফ/crossWiki.js
*/
(function () {
// check if mr is defined
if (typeof window.mr === "undefined") {
// if not, define it
mr = new Object();
}
mr.cross = editForeignPage;
// This is the main function that will be called by the user
function editForeignPage(info, success, error) {
// Custom hooks for edit success / failure (e.g., console.log)
var errorHook = typeof error === "function", // has error function?
successHook = typeof success === "function"; // has success hook?
// Most "modern" browsers except IE support CORS
if (!$.support.cors) {
error("Your browser does not support CORS! Try Firefox.", "cors");
return;
}
var api = new mw.ForeignApi(info.url + "/w/api.php");
var params = { ...info };
api
.postWithToken("csrf", params)
.done(function (data) {
console.log(data);
})
.fail(function (data) {
alert("কিছু সমস্যা হয়েছে");
console.log(data);
});
}
})();