|
|
| ৩,৫৮২ নং লাইন: |
৩,৫৮২ নং লাইন: |
| }() ); | | }() ); |
| //</nowiki> | | //</nowiki> |
|
| |
| if (!quickCreate) {
| |
| var quickCreate = function(page, index) {
| |
| var wikitext = prompt("Wiki text to add to " + page + ":");
| |
| if (wikitext == null || wikitext == undefined) {
| |
| return;
| |
| }
| |
| $.get(mw.config.get("wgScriptPath") + "/api.php", {
| |
| action: "query",
| |
| format: "json",
| |
| meta: "tokens",
| |
| type: "csrf"
| |
| }).then(function(result, status) {
| |
| if (status != 'success') {
| |
| alert("Connection failed.");
| |
| } else {
| |
| $.post(mw.config.get("wgScriptPath") + "/api.php", {
| |
| action: "edit",
| |
| format: "json",
| |
| createonly: 1,
| |
| title: page,
| |
| token: result.query.tokens.csrftoken,
| |
| text: wikitext,
| |
| summary: "দ্রুত তৈরি করা হয়েছে " + page
| |
| }).then(function(result, status) {
| |
| if (status != 'success') {
| |
| alert("Connection failed.");
| |
| } else {
| |
| if (result.error) {
| |
| alert(result.error.info);
| |
| } else {
| |
| $("#quickcreate-" + index).remove();
| |
| location.reload();
| |
| }
| |
| }
| |
| })
| |
| }
| |
| });
| |
| };
| |
| $(document).ready(function() {
| |
| $(".new").each(function(i) {
| |
| try {
| |
| $(this).after('<span id="quickcreate-' + i + '"> <sup>[<a href="javascript:void(0)">QC<span class="quickcreate-text" style="display:none;">' + $(this).attr("title").substring(0, $(this).attr("title").length - 22) + '</span></a>]</sup></span>');
| |
| $("#quickcreate-" + i).find("a").click(function() {
| |
| quickCreate($(this).find(".quickcreate-text").text(), i);
| |
| });
| |
| } catch (Error) {
| |
|
| |
| }
| |
| });
| |
| });
| |
| }
| |