লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: Ctrl-F5 টিপুন।
var api = new mw.Api();
var R = {};
var dga;
var cont;
$.when(mw.loader.using("mediawiki.util"), $.ready).then(function() {
    dga = document.createElement("DIV");
    dga.innerHTML =
        "<ul type='none'><li type='button' style='background:#0e444d;color:white' onclick='GA(0)'>Review</li><li type='button' style='background:#0e444d;color:white' onclick='GA(1)'>Passed</li><li style='background:#0e444d;color:white'  type='button' onclick='GA(2)'>Failed</li></ul > ";
    dga.id = "GA";
    dga = $(document.body.appendChild(dga));
    dga.css({
        border: "2px solid grey",
        padding: "10px",
        borderRadius: " 10px",
        background: "aliceblue",
        width: "70%",
        left: "10%",
        top: "30%",
        position: "fixed",
        display: "none"
    });
    $(
        mw.util.addPortletLink(
            "p-personal",
            "#",
            "ভালো নিবন্ধ",
            "t-GA",
            "ভালো নিবন্ধের পর্যালোচনা",
            "G",
            "#pt-logout"
        )
    ).click(() => {
        dga.toggle("slow");
    });
});
/* Function to fetch the data*/
function GA(status) {
    //fetch the data
    R.status = status;
    var title = mw.config.get("wgTitle");
    var i = title.indexOf("/");
    if (i ^ -1) title = title.substring(0, i);
    var data = {
        action: "query",
        format: "json",
        prop: "revisions",
        titles: "উইকিপিডিয়া:প্রস্তাবিত ভালো নিবন্ধ",
        rvprop: "content",
        rvslots: "main",
        rvsection: "1"
    };

    api.get(data).done(function(v) {
        var sections, entry;
        cont = v.query.pages["43067"].revisions[0].slots.main["*"];
        sections = cont.split("===");
        sections.shift();
        var l1 = sections.length;
        var i = 0;
        var t = "";
        R.catid = 0;
        while (i < l1) {
            console.log(R.catid++ + "  " + (R.cat = sections[i++].trim()));
            entry = sections[i].split("# ");
            entry.shift();
            var j = 0,
                l2 = entry.length;
            while (j < l2) {
                if (entry[j].includes(title)) {
                    var k = entry[j].match(/\|\s*2=\s*[\u09e6-\u09ef]/)[0];
                    k = k.replace(/\|\s*2=\s*/, "");
                    R.sub = k;
                    k = entry[j]
                        .match(
                            /\[\[(user|User|ব্যবহারকারী)?:([\u0980-\u09ff]*|[A-z]*[0-9]*\s*)+\|/gi
                        )[0]
                        .replace(/\[\[(User|user|ব্যবহারকারী):/i, "");
                    R.user = k.substr(0, k.length - 1);
                    R.title = title;
                    alert(
                        "প্রাপ্ত উপাত্ত<br/>নিবন্ধ: " +
                            R.title +
                            "<br/>মনোয়নকারী: " +
                            R.user +
                            "<br/>বিভাগ :" +
                            R.cat
                    );
                    //Ask for the Action
                    if (status) {
                        //result is submitted
                        //update article history in talk page
                        if (status == 1) {
                            //passed
                            //prepend {{ GA }} on the page
                            api.edit(R.title, function(rev) {
                                return {
                                    text: "{{ভালো নিবন্ধ}}\n" + rev.content,
                                    summary:
                                        "[[ব্যবহারকারী:" +
                                        R.user +
                                        "|]] কে অভিনন্দন!! নিবন্ধটি ভালো নিবন্ধ হিসেবে গৃহীত হয়েছে",
                                    minor: 1,
                                    bot: 1
                                };
                            }).done(() =>
                                alert("নিবন্ধে ট্যাগ যুক্ত করা হয়েছে")
                            );
                        }
                        updateWikidata(status); //update wikidata item badge
                        notify(); //Give the nominator a message
                        updateMyList(); //add the article to my list
                    } else {
                        //Review first
                        notify(); //Give the user a message
                        //create Review page
                    }
                    return;
                }
                j++;
            }
            i++;
        }
    });
}
function updateWikidata(status) {
    var fore = new mw.ForeignApi("https://www.wikidata.org/w/api.php");
    fore.getEditToken().then(v => {
        var badge = status ? "Q17437798" : "Q17559452";
        var data = {
            action: "wbsetsitelink",
            format: "json",
            linksite: "bnwiki",
            site: "bnwiki",
            title: R.title,
            badges: badge,
            token: v,
            bot: 1
        };
        fore.post(data).then(v => {
            if (v.success) {
                alert("Wikidata Item হালনাগাদ");
            }
        });
    });
}
//Message the user
function notify() {
    var h =
        "[[" +
        R.title +
        "]] নিবন্ধের পর্যালোচনা" +
        (R.status? "র ফলাফল" : "");
    var c =
        "{{subst:ব্যবহারকারী:Nokib Sarkar/GA" +
        (R.status? (R.status == 1 ? "N" : "F") : "") +
        "|" +
        R.title +
        "|" +
        R.cat +
        "|" +
        R.sub +
        "}}";
    var k = api.newSection("ব্যবহারকারী আলাপ:" + R.user, h, c, {
        redirect: true
    });
    k.done(function() {
        alert("ব্যবহারকারীকে অবহিত করা হয়েছে");
    });
}
/*Function to update my list*/
function updateMyList() {
    var k = api.edit("ব্যবহারকারী:Nokib Sarkar/পর্যালোচিত", function(rev) {
        var l = rev.content.length;
        var txt =
            "\n|[[" +
            R.title +
            "]]||{{" +
            (R.status==1? "সফল" : "ব্যর্থ") +
            "}}||~~" +
            "~~" +
            "~\n|-\n|}";
        return {
            text: rev.content.substring(0, l - 3) + txt,
            summary: "[[" + R.title + "]] নিবন্ধের পর্যালোচনা সমাপ্ত",
            minor: true,
            bot: 1
        };
    });
    k.done(() => {
        alert("Updated List");
    });
    k.fail(v => console.log(v));
}
function removeFromList() {
    var ls = [
        3,
        5,
        78,
        10,
        11,
        13,
        14,
        16,
        18,
        20,
        21,
        22,
        24,
        25,
        26,
        28,
        29,
        30,
        31,
        33,
        35,
        36,
        37,
        38,
        39,
        40,
        42,
        44,
        46,
        47
    ];
    var data = {
        action: "query",
        format: "json",
        prop: "revisions",
        titles: "উইকিপিডিয়া:প্রস্তাবিত ভালো নিবন্ধ",
        rvprop: "content",
        rvslots: "main",
        rvsection: ls[R.catid]
    };

    api.get(data).then(v => {
        console.log(
            (cont = v.query.pages["43067"].revisions[0].slots.main["*"])
        );
    });

    var i = cont.indexOf(R.title);
    var t = cont.substring(1, i - 1);
    var l = cont.length - 10;
    var j;
    for (j = i; j < l; j++) {
        if (cont.substring(j, j + 8) == "(ইউটিসি)") {
            j += 8;
            break;
        }
    }
    t += cont.substring(j);
    console.log(t);
}