|
|
خط ۱: |
خط ۱: |
| /* global mw, $ */
| |
| // Editing-related javascripts
| |
| if (mw.config.get("wgAction") === "edit" || mw.config.get("wgAction") === "submit" || mw.config.get("wgCanonicalSpecialPageName") === "Upload") {
| |
| /* scripts specific to editing pages */
| |
| importScript("مدیاویکی:Common.js/edit.js");
| |
| }
| |
| /** Magic editintros ****************************************************
| |
| *
| |
| * Description: Adds editintros on disambiguation pages and BLP pages.
| |
| * Maintainers: [[User:RockMFR]]
| |
| */
| |
| function addEditIntro(name) {
| |
| $(".mw-editsection, #ca-edit").find("a").each(function(i, el) {
| |
| el.href = $(this).attr("href") + "&editintro=" + name;
| |
| });
| |
| }
| |
|
| |
| if (mw.config.get("wgNamespaceNumber") === 0) {
| |
| $(function() {
| |
| if (document.getElementById("disambigbox")) {
| |
| addEditIntro("Template:Disambig_editintro");
| |
| }
| |
| });
| |
|
| |
| $(function() {
| |
| var cats = mw.config.get("wgCategories");
| |
| if (!cats) {
| |
| return;
| |
| }
| |
| if ($.inArray("افراد زنده", cats) !== -1) {
| |
| addEditIntro("Template:BLP_editintro");
| |
| }
| |
| });
| |
| }
| |
|
| |
| /**
| |
| * @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
| |
| * @revision 2017-05-16
| |
| */
| |
| mw.loader.using( ['mediawiki.util', 'mediawiki.notify'], function () {
| |
| var extraCSS = mw.util.getParamValue( 'withCSS' ),
| |
| extraJS = mw.util.getParamValue( 'withJS' );
| |
|
| |
| if ( extraCSS ) {
| |
| // DONT REMOVE THIS IF (unless you are OK with CSRF attacks)
| |
| if ( /^MediaWiki:[^&<>=%#]*\.css$/.test( extraCSS ) ) {
| |
| mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraCSS ) + '&action=raw&ctype=text/css', 'text/css' );
| |
| } else {
| |
| mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
| |
| }
| |
| }
| |
|
| |
| if ( extraJS ) {
| |
| // DONT REMOVE THIS IF (unless you are OK with XSS & CSRF attacks)
| |
| if ( /^MediaWiki:[^&<>=%#]*\.js$/.test( extraJS ) ) {
| |
| mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraJS ) + '&action=raw&ctype=text/javascript' );
| |
| } else {
| |
| mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
| |
| }
| |
| }
| |
| });
| |
|
| |
| /**
| |
| * Opening preload.js to add interactive training keys
| |
| */
| |
| mw.loader.using(["mediawiki.util"], function() {
| |
| if (mw.util.getParamValue("preload")) {
| |
| importScript("MediaWiki:Preloaded.js");
| |
| }
| |
| });
| |
|
| |
|
| /** Collapsible tables ********************************************************* | | /** Collapsible tables ********************************************************* |
خط ۲۶۵: |
خط ۱۹۵: |
|
| |
|
| $(createNavigationBarToggleButton); | | $(createNavigationBarToggleButton); |
|
| |
| /** Main Page layout fixes *********************************************************
| |
| *
| |
| * Description: Adds an additional link to the complete list of languages available.
| |
| * Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
| |
| */
| |
| mw.loader.using(["mediawiki.util"], function() {
| |
| if (["صفحهٔ_اصلی", "بحث:صفحه_اصلی"].indexOf(mw.config.get("wgPageName")) !== -1) {
| |
| $(function() {
| |
| mw.util.addPortletLink("p-lang", "//meta.wikimedia.org/wiki/List_of_Wikipedias/fa", "فهرست کامل", "interwiki-completelist", "فهرست کامل");
| |
| });
| |
| }
| |
| });
| |
|
| |
| /**
| |
| * WikiMiniAtlas
| |
| *
| |
| * Description: WikiMiniAtlas is a popup click and drag world map.
| |
| * This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
| |
| * The script itself is located on meta because it is used by many projects.
| |
| * See [[Meta:WikiMiniAtlas]] for more information.
| |
| * Maintainers: [[User:Dschwen]]
| |
| */
| |
| (function() {
| |
| var require_wikiminiatlas = false;
| |
| var coord_filter = /geohack/;
| |
| $(function() {
| |
| $("a.external.text").each(function(key, link) {
| |
| if (link.href && coord_filter.exec(link.href)) {
| |
| require_wikiminiatlas = true;
| |
| // break from loop
| |
| return false;
| |
| }
| |
| });
| |
| if ($("div.kmldata").length) {
| |
| require_wikiminiatlas = true;
| |
| }
| |
| if (require_wikiminiatlas) {
| |
| mw.loader.load("//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript");
| |
| }
| |
| });
| |
| })();
| |
|
| |
| /**
| |
| * Source codes pages direction and and pre white-space
| |
| */
| |
| mw.loader.using(["mediawiki.util"], function() {
| |
| if ([2, 4, 8].indexOf(mw.config.get("wgNamespaceNumber")) !== -1) {
| |
| if (/\.(js|css|py)$/.test(mw.config.get("wgPageName"))) {
| |
| mw.util.addCSS(".diff-addedline, .diff-deletedline, .diff-context { direction: ltr; } " +
| |
| "#wpTextbox1 { direction: ltr; }");
| |
| }
| |
| }
| |
|
| |
| // Newbies are misusing wikilove instead using talk pages add new section
| |
| // hiding WikiLove from not autoconfirmed users or without more than 100 edits
| |
| if ($.inArray("autoconfirmed", mw.config.get("wgUserGroups")) === -1 || mw.config.get("wgUserEditCount") < 100) {
| |
| mw.util.addCSS("#ca-wikilove { display: none; }");
| |
| }
| |
| });
| |
| /**
| |
| * قراردادن فرمولهای ریاضی در سمت چپ مناسب برای ویکیهای راست به چپ
| |
| */
| |
| $(function() {
| |
| $("span.mwe-math-mathml-inline").each(function() {
| |
| if ($(this).parent().parent().text().trim() === $(this).parent().text().trim() && $(this).parent().parent().is("p, dd")) {
| |
| $(this).parent().parent().css({
| |
| direction: "ltr",
| |
| padding: "1em 0"
| |
| });
| |
| }
| |
| });
| |
| });
| |
|
| |
| // هشدار به کاربرها در مورد عنوان ایمیل
| |
| $(function() {
| |
| if ( $('#mw-input-wpSubject').parents('tr').length > 0 ) {
| |
| $('#mw-input-wpSubject').parents('tr').before('<tr><td></td><td style="color: red; font-weight: bold">لطفاً عبارت Wikipedia e-mail را با یک عنوان مناسب جایگزین کنید!</td><tr>');
| |
| }
| |
| });
| |
|
| |
|
| // Make refrence number that you clicked on bold for proper navigation | | // Make refrence number that you clicked on bold for proper navigation |
خط ۳۷۲: |
خط ۲۲۲: |
| $('#reflist-notes').before('<h2>یادداشتها</h2>'); | | $('#reflist-notes').before('<h2>یادداشتها</h2>'); |
| } | | } |
|
| |
|
| |
| }); | | }); |
|
| |
|