نکته: پس از انتشار ممکن است برای دیدن تغییرات نیاز باشد که حافظهٔ نهانی مرورگر خود را پاک کنید.
- فایرفاکس / سافاری: کلید Shift را نگه دارید و روی دکمهٔ Reload کلیک کنید، یا کلیدهای Ctrl-F5 یا Ctrl-R را با هم فشار دهید (در رایانههای اپل مکینتاش کلیدهای ⌘-R)
- گوگل کروم: کلیدهای Ctrl+Shift+R را با هم فشار دهید (در رایانههای اپل مکینتاش کلیدهای ⌘-Shift-R)
- Edge: کلید Ctrl را نگهدارید و روی دکمهٔ Refresh کلیک کنید، یا کلیدهای Ctrl-F5 را با هم فشار دهید
// <nowiki> // DON'T REMOVE THIS LINE EVER /*jslint indent: 2, browser: true, white: true*/ /*global jQuery, mediaWiki, persianWikiTools, autoEd*/ /* above functions are coming from [[MediaWiki:Gadget-Extra-Editbuttons-autoed.js]] */ /** */ (function ($, mw) { 'use strict'; // ابزار در حالت نمایش /** * Fetch a page */ function loadPage(title) { return new mw.Api().get({ action: 'query', prop: 'revisions', titles: title, rvprop: 'content', format: 'json' }).then(function (data) { return $.map(data.query.pages, function (value) { return value; })[0].revisions[0]['*']; }); } /** * Save a page */ function savePage(title, text, summary) { return new mw.Api().post({ action: 'edit', title: title, text: text, summary: summary, nocreate: '', minor: '', token: mw.user.tokens.get('csrfToken') }); } /** * Load and save a page */ function loadSavePage(editorDelegate, summary) { return loadPage(mw.config.get('wgPageName')).then(function (text) { return savePage(mw.config.get('wgPageName'), editorDelegate(text), summary); }); } if (mw.config.get('wgAction') === 'view' && mw.config.get('wgIsArticle') && mw.config.get('wgPageName') !== 'صفحهٔ_اصلی') { $.when($.ready, mw.loader.using('jquery.ui')).then(function () { $('#ca-abar-abzar').remove(); if ($('#mw-imagepage-nofile, #noarticletext').length !== 0 || mw.config.get('wgNamespaceNumber') === 6 || mw.config.get('wgNamespaceNumber') === 8) { return; } $(mw.util.addPortletLink('p-views', '#', 'ابرابزار', 'ca-abar-abzar')).click(function () { $( '<div><div>مطمئنید می\u200cخواهید ویرایشی خودکار جهت اصلاح متن این صفحه به کمک ابرابزار داشته باشید؟</h6><br><br>بعد از انجام ویرایش باید ویرایش انجامشده را از نظر درستی بررسی کنید <b>زیرا مسئولیت تغییرات ابرابزار با شماست!</b></div>' ).dialog({ modal: true, title: 'ابرابزار', resizable: false, buttons: { 'بله': function () { loadSavePage( persianWikiTools.superTool, '/' + '* ویرایش به وسیلهٔ [[' + (mw.config.get('wgServerName') !== 'fa.wikipedia.org' ? ':w:fa:' : '') + 'وپ:ابرابزار|ابرابزار]] *' + '/' ).then(function (data) { if (data.error) { mw.notify('ویرایش موفقیت آمیز نبود: ' + data.error.info); } else if (data.edit && data.edit.result === 'Success') { if (data.edit.nochange !== undefined) { mw.notify('تغییری در صفحه ایجاد نشد.'); } else { mw.notify('ویرایش با موفقیت انجام پذیرفت'); // Loading diff page window.location = new mw.Uri(mw.config.get('wgScript')).extend({ title: mw.config.get('wgPageName'), diff: data.edit.newrevid }); } } else { mw.notify('ویرایش در صفحه موفقیتآمیر نبود.'); } }, function (error) { mw.notify(error); }); $(this).dialog("close"); }, 'خیر': function () { $(this).dialog("close"); } }, close: function () { $(this).remove(); } }); }); }); } // ابزار در حالت ویرایش /** * Adds edit summary */ function addEditSummary(summaryText, replaceSummary) { if (summaryText === '') { return; } var summary = $('.editOptions #wpSummary'), summaryPrefix = '', pos; if (summary.length === 0) { return; } if (summary.val().indexOf('*/ ') > -1) { pos = summary.val().indexOf('*/ '); summaryPrefix = summary.val().substr(0, pos + 3); } if (replaceSummary) { summary.val(summaryPrefix + summaryText); } else { if (summary.val() === summaryPrefix) { summary.val(summary.val() + summaryText); } else { if (summary.val().indexOf(summaryText) === -1) { // do not repeat in edit summary summary.val(summary.val() + '، ' + summaryText); } } } } /** * Makes a simple button from parameters */ function buttonGenerator(callback, summaryText, replaceSummary, image, title, alt, idSuffix) { function clickCallback(e) { e.preventDefault(); callback(); addEditSummary(summaryText, replaceSummary); } var button = $('<a>', { id: 'persian-wiki-tools-' + idSuffix }).click(clickCallback).append( $('<img />').attr({ src: image, title: title, alt: alt }).on("error", function () { button.replaceWith($('<button>', { text: alt }).click(clickCallback)); }) ); return button[0]; } /** * Applies the string functions defined below to the * selected text in the edit box. If no text is selected, applies * the function to the whole contents of edit box. */ function applyOnSelection(callback) { var txtarea, range, startPos, endPos, selText; if (document.getElementById('editform')) { txtarea = document.getElementById('wpTextbox1'); } else if (document.getElementById('wpNewTitleMain')) { txtarea = document.getElementById('wpNewTitleMain'); } else { return; } if (document.selection && document.selection.createRange) { // IE/Opera // get current selection txtarea.focus(); range = document.selection.createRange(); selText = range.text; if (selText) { range.text = callback(selText); range.select(); } else { txtarea.value = callback(txtarea.value); } } else if (txtarea.selectionStart || txtarea.selectionStart === 0) { // Mozilla // get current selection txtarea.focus(); startPos = txtarea.selectionStart; endPos = txtarea.selectionEnd; selText = txtarea.value.substring(startPos, endPos); // insert tags if (selText) { txtarea.value = txtarea.value.substring(0, startPos) + callback(selText) + txtarea.value.substring(endPos, txtarea.value.length); txtarea.selectionStart = startPos + selText.length; txtarea.selectionEnd = txtarea.selectionStart; } else { txtarea.value = callback(txtarea.value); } } } var tools = {}; /* حذف سریع */ tools.speedyDel = buttonGenerator( function () { var temp = $('#wpTextbox1').val(); $('#wpTextbox1').val(''); mw.toolbar.insertTags('{{شطب|', '}}\n' + temp, 'معیار'); }, 'شطب', true, '//upload.wikimedia.org/wikipedia/fa/c/c1/Button_delete_vote.png', 'شطب', 'شطب', 'delete-vote' ); /* Welcome */ tools.welcome = buttonGenerator( function () { mw.toolbar.insertTags( '{{subst:welcome}}~~~~', '', '' ); }, 'welcome', true, '//upload.wikimedia.org/wikipedia/commons/4/4a/Smilies_Alien_cool.png', 'welcome', 'welcome', 'alien-cool' ); $(function () { var extraEditButtons = [], extraMoveButtons = [], space = ' '; extraEditButtons = extraEditButtons.concat(tools.toggleDirection, space, tools.ykArabic, tools.zwnj, tools.applyOrthography, tools.dig, tools.punc, tools.dictation, tools.superTool, space, tools.urlFix, space, tools.welcome, tools.addEssentialThings, tools.noSource, tools.sus, tools.tone, tools.wikify, tools.shod, tools.cleanup, tools.speedyDel, tools.prod, space, tools.redirectButton, tools.gregYear, tools.strikeTextButton, tools.chapChin, tools.commentButton, space, tools.sortText); extraEditButtons = extraEditButtons.concat(space).concat(window.userCustomEditButtons || []); extraMoveButtons = extraMoveButtons.concat(tools.superToolMove, space, tools.toggleDirection, space, tools.ykArabic, tools.zwnj, tools.applyOrthography, tools.digMove, tools.punc, space, tools.dictation); $('#persian-wiki-tools').remove(); if ($('#wpTextbox1').length !== 0) { $('<div>', { id: 'persian-wiki-tools', dir: 'rtl', style: 'float:right;' }).append(extraEditButtons).insertBefore('#wpTextbox1'); } if ($('#movepage').length !== 0) { $('<span>', { id: 'persian-wiki-tools' }).append(extraMoveButtons).insertAfter('#wpNewTitleMain'); } }); }(jQuery, mediaWiki)); // </nowiki>