مدیاویکی:Gadget-close.js: تفاوت میان نسخهها
ظاهر
imported>Huji بررسی تصادفی پنجاه مورد از کاربردهای این ابزار در سه ماه اخیر نشان داد که در اکثر موارد جمعبندی زیر بحث است نه بالای آن؛ پیشفرض باید چیزی باشد که بیشتر کاربرد دارد |
imported>Jeeputer افزودن صفحهٔ ویکیپدیا:درخواست بایگانی منابع برخط به صفحههایی که هنگام جمعبندی بخش، الگوی «وضعیت» باید در آنها تغییر کند (به درخواست کاربر:Pereoptic در بحث من) |
||
| (۴۴ نسخهٔ میانی ویرایش شده توسط ۶ کاربر نشان داده نشد) | |||
| خط ۱: | خط ۱: | ||
/* | |||
MediaWiki:Gadget-close.js | |||
*/ | |||
// <nowiki> | |||
/*global jQuery, mediaWiki */ | /*global jQuery, mediaWiki */ | ||
(function($, mw) { | (function ($, mw) { | ||
'use strict'; | 'use strict'; | ||
var windowManager; | var windowManager; | ||
| خط ۶: | خط ۱۰: | ||
var commentInSection; | var commentInSection; | ||
var onlyTopSection; | var onlyTopSection; | ||
var archiveSectionOptions = { | var archiveSectionOptions = { | ||
install: function() { | install: function () { | ||
var namespace = mw.config.get("wgNamespaceNumber"); | |||
if (namespace === 4 || namespace % 2 === 1) { | |||
if ($('.mw-editsection').length == 0) { | |||
return false; | |||
} | |||
if (mw.config.get("wgPageName") === "ویکیپدیا:نظرخواهی_برای_حذف" | | |||
mw.config.get("wgPageName") === "ویکیپدیا:آیا_میدانستید_که...؟/پیشنویس" | | |||
mw.config.get("wgPageName") === "ویکیپدیا:گزیدن_موضوعات_برگزیده") { | |||
return false; // ابزار را باید در زیرصفحههای نبح استفاده کرد نه در خود نبح | |||
} | |||
// افزودن دکمه به بخش آغازین | // افزودن دکمه به بخش آغازین | ||
if ( | if ( | ||
!$('.mw-editsection')[0]['innerHTML'].toString().match("ویرایش بخش آغازین") && // mediawiki:gadget-edittop.js is not active | |||
mw.config.get("wgPageName").substr(0, 28) !== 'ویکیپدیا:نظرخواهی_برای_حذف/' | |||
) { // نشان ندادن دکمهها در بخش آغازین نبحها برای جلوگیری از ثبت نظر در جای اشتباه | ) { // نشان ندادن دکمهها در بخش آغازین نبحها برای جلوگیری از ثبت نظر در جای اشتباه | ||
var our_content = $("#content, #mw_content").first(); | var our_content = $("#content, #mw_content").first(); | ||
| خط ۲۴: | خط ۳۵: | ||
var span0 = span1.clone(); | var span0 = span1.clone(); | ||
$("#mw_header h1, #content h1").first().append(span0); | $("#mw_header h1, #content h1").first().append(span0); | ||
span0.find("a").each(function(idx) { | span0.find("a").each(function (idx) { | ||
var a = $(this); | var a = $(this); | ||
a.attr("title", 'ویرایش بخش آغازین'); | a.attr("title", 'ویرایش بخش آغازین'); | ||
| خط ۳۷: | خط ۴۸: | ||
} | } | ||
// افزودن دکمه به زیربخشها | // افزودن دکمه به زیربخشها | ||
$('.mw-editsection').each(function() { | $('.mw-editsection').each(function () { | ||
if ($(this).parent('#firstHeading').length > 0) return; | |||
var section = ''; | var section = ''; | ||
$(this).find('a').each(function() { | $(this).find('a').each(function () { | ||
var m = $(this).attr('href').match(/section=(\d+)/); | var m = $(this).attr('href').match(/section=(\d+)/); | ||
if (m && m.length == 2 && section == '') { | if (m && m.length == 2 && section == '') { | ||
| خط ۵۷: | خط ۶۹: | ||
style: 'font-size: smaller;', | style: 'font-size: smaller;', | ||
text: 'ثبت نظر', | text: 'ثبت نظر', | ||
}).click(function(e) { | }).click(function (e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function() { | mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function () { | ||
archiveSectionOptions.createCommentWindow(section); | archiveSectionOptions.createCommentWindow(section); | ||
}); | }); | ||
})); | })); | ||
span.append($('<span>', { | span.append($('<span>', { | ||
class: ' | class: '', | ||
text: ' / ' | text: ' / ', | ||
style: 'color: var(--color-subtle, #54595d)' | |||
})); | })); | ||
span.append($('<a>', { | span.append($('<a>', { | ||
| خط ۷۲: | خط ۸۵: | ||
style: 'font-size: smaller;', | style: 'font-size: smaller;', | ||
text: 'جمعبندی', | text: 'جمعبندی', | ||
}).click(function(e) { | }).click(function (e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function() { | mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function () { | ||
archiveSectionOptions.createArchiveWindow(section); | archiveSectionOptions.createArchiveWindow(section); | ||
}); | }); | ||
| خط ۸۷: | خط ۱۰۰: | ||
} | } | ||
}, | }, | ||
createArchiveWindow: function(section) { | createArchiveWindow: function (section) { | ||
var query = archiveSectionOptions.getQuery(section); | var query = archiveSectionOptions.getQuery(section); | ||
archiveSectionOptions.currentSectionId = | var sectionId = query.get("section"); | ||
archiveSectionOptions.currentSectionId = sectionId; | |||
function ArchiveSection(config) { | function ArchiveSection(config) { | ||
| خط ۹۷: | خط ۱۱۱: | ||
ArchiveSection.static.name = 'archive'; | ArchiveSection.static.name = 'archive'; | ||
ArchiveSection.static.title = 'جمعبندی بخش'; | ArchiveSection.static.title = 'جمعبندی بخش'; | ||
ArchiveSection.static.actions = [{ | ArchiveSection.static.actions = [ | ||
{ | |||
action: 'archive', | |||
label: 'جمعبندی', | |||
flags: 'primary' | |||
}, { | |||
label: 'لغو', | |||
flags: 'safe' | |||
ArchiveSection.prototype.initialize = function() { | } | ||
]; | |||
ArchiveSection.prototype.initialize = function () { | |||
var fieldset = []; | var fieldset = []; | ||
ArchiveSection.super.prototype.initialize.apply(this, arguments); | ArchiveSection.super.prototype.initialize.apply(this, arguments); | ||
| خط ۱۵۸: | خط ۱۷۴: | ||
this.$body.append(this.panel.$element); | this.$body.append(this.panel.$element); | ||
}; | }; | ||
ArchiveSection.prototype.getActionProcess = function(action) { | ArchiveSection.prototype.getActionProcess = function (action) { | ||
var dialog = this; | var dialog = this; | ||
if (action === 'archive') { | if (action === 'archive') { | ||
| خط ۱۷۷: | خط ۱۹۳: | ||
windowManager.openWindow(archiveSection); | windowManager.openWindow(archiveSection); | ||
}, | }, | ||
createCommentWindow: function(section) { | createCommentWindow: function (section) { | ||
function PreviewPanel(config) { | |||
PreviewPanel.parent.call(this, config); | |||
this.$content = $('<div>').addClass('oo-ui-PreviewPanel'); | |||
} | |||
OO.inheritClass(PreviewPanel, OO.ui.PanelLayout); | |||
PreviewPanel.prototype.setContent = function ($content) { | |||
this.$element.children().detach(); | |||
this.$element.append($content); | |||
windowManager.getCurrentWindow().updateSize(); | |||
}; | |||
var query = archiveSectionOptions.getQuery(section); | var query = archiveSectionOptions.getQuery(section); | ||
archiveSectionOptions.currentSectionId = | var sectionId = query.get("section"); | ||
archiveSectionOptions.currentSectionId = sectionId; | |||
(new mw.Api()).get({ | (new mw.Api()).get({ | ||
format: 'json', | format: 'json', | ||
action: 'query', | action: 'query', | ||
titles: mw.config.get("wgPageName"), | titles: mw.config.get("wgPageName"), | ||
rvsection: | rvsection: sectionId, | ||
prop: 'revisions', | prop: 'revisions', | ||
rvprop: 'content', | rvprop: 'content', | ||
}).then(function(data) { | }).then(function (data) { | ||
var page = data.query.pages[Object.keys(data.query.pages)[0]]; | var page = data.query.pages[Object.keys(data.query.pages)[0]]; | ||
var current = page.revisions[0]['*']; | var current = page.revisions[0]['*']; | ||
current=current.replace(/\= \=/gi,'==') | current = current.replace(/\= \=/gi, '=='); | ||
current=current.replace(/\=([^\= \n\r]+) *\=/gi,'= $1 =') | current = current.replace(/\=([^\= \n\r]+) *\=/gi, '= $1 ='); | ||
current=current.replace(/\={4,}/gi,'==') | current = current.replace(/\={4,}/gi, '=='); | ||
if (current.split('==').length>3){ | if (('\n' + current).split('\n==').length > 3) { | ||
onlyTopSection=confirm('این بخش، زیربخشهایی هم دارد! برای ارسال متن آیا قسمت بالایی منظورتان است؟\nدکمهٔ Ok = پیام در بخش بالایی قرار گیرد.\nدکمهٔ Cancel = متن در انتها قرار گیرد.') | onlyTopSection = confirm('این بخش، زیربخشهایی هم دارد! برای ارسال متن آیا قسمت بالایی منظورتان است؟\nدکمهٔ Ok = پیام در بخش بالایی قرار گیرد.\nدکمهٔ Cancel = متن در انتها قرار گیرد.') | ||
if (onlyTopSection){ | if (onlyTopSection) { | ||
if (!current.match('^\= ')){ | if (!current.match('^\= ')) { | ||
current=current.split('\n===')[0] | current = current.split('\n===')[0] | ||
}else{ | } else { | ||
current=current.split('\n==')[0] | current = current.split('\n==')[0] | ||
} | } | ||
} | } | ||
} | } | ||
function CommentInSection(config) { | function CommentInSection(config) { | ||
CommentInSection.super.call(this, config); | CommentInSection.super.call(this, config); | ||
| خط ۲۱۳: | خط ۲۴۲: | ||
label: 'ثبت نظر', | label: 'ثبت نظر', | ||
flags: 'primary' | flags: 'primary' | ||
}, { | }, | ||
{ | |||
action: 'preview', | |||
label: 'پیشنمایش', | |||
icon: 'check', | |||
title: 'پیشنمایش', | |||
flags: 'progressive' | |||
}, | |||
{ | |||
action: 'close', | |||
label: 'لغو', | label: 'لغو', | ||
flags: 'safe' | flags: 'safe' | ||
}]; | }]; | ||
CommentInSection.prototype.initialize = function() { | CommentInSection.prototype.initialize = function () { | ||
var fieldset = []; | var fieldset = []; | ||
CommentInSection.super.prototype.initialize.apply(this, arguments); | CommentInSection.super.prototype.initialize.apply(this, arguments); | ||
| خط ۲۲۳: | خط ۲۶۱: | ||
padded: true, | padded: true, | ||
expanded: false | expanded: false | ||
}); | |||
this.previewResult = new PreviewPanel({ | |||
expanded: true, | |||
padded: true, | |||
$content: '' | |||
}); | }); | ||
this.content = new OO.ui.FieldsetLayout(); | this.content = new OO.ui.FieldsetLayout(); | ||
var PingUsers = current.match(/\[\[(?:بحث[_ ]کاربر|[Uu]ser[_ ][tT]alk|کاربر|[Uu]ser)\:([^\]\\\/]+)\|(?:[^\]]+)\]\]/gi) | var PingUsers = current.match(/\[\[(?:بحث[_ ]کاربر|[Uu]ser[_ ][tT]alk|کاربر|[Uu]ser)\:([^\]\\\/]+)\|(?:[^\]]+)\]\]/gi) | ||
var uniqueNames = []; | var uniqueNames = []; | ||
$.each(PingUsers, function(i, el) { | $.each(PingUsers, function (i, el) { | ||
var username = el.split('|')[0].split('/')[0].split('#')[0].split(':')[1]; | var username = el.split('|')[0].split('/')[0].split('#')[0].split(':')[1]; | ||
if ($.inArray(username, uniqueNames) === -1 && username != mw.config.get('wgUserName')) { | if ($.inArray(username, uniqueNames) === -1 && username != mw.config.get('wgUserName')) { | ||
| خط ۲۴۱: | خط ۲۸۵: | ||
}) | }) | ||
} | } | ||
archiveSectionOptions.btnOneIndent = new OO.ui.ButtonOptionWidget({ | |||
data: 1, | |||
label: 'پاسخ به قبلی', | |||
title: 'پیام در پاسخ به نفر قبل نوشته میشود.' | |||
}), | |||
archiveSectionOptions.btnSameIndent = new OO.ui.ButtonOptionWidget({ | |||
data: 2, | |||
label: 'بدون دندانهگذاری', | |||
title: 'پیام بدون دندانهگذاری نوشته میشود.' | |||
}), | |||
archiveSectionOptions.btnnoIndent = new OO.ui.ButtonOptionWidget({ | |||
data: 3, | |||
label: 'سر خط', | |||
title: 'پیام از ابتدای خط شروع میشود.' | |||
}), | |||
archiveSectionOptions.buttonIndentSelect = new OO.ui.ButtonSelectWidget({ | |||
items: [archiveSectionOptions.btnOneIndent, archiveSectionOptions.btnSameIndent, archiveSectionOptions.btnnoIndent] | |||
}); | |||
archiveSectionOptions.buttonIndentSelect.selectItem(archiveSectionOptions.btnOneIndent); | |||
archiveSectionOptions.Dropdown = new OO.ui.DropdownWidget({ | |||
label: 'پیام', | |||
menu: { | |||
items: [ | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'share', | |||
data: 'info', | |||
label: 'پیام' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'info', | |||
data: 'Opinion', | |||
label: 'نظر' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'check', | |||
data: 'done', | |||
label: 'شد', | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'close', | |||
data: 'NOTdone', | |||
label: 'نشد' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'add', | |||
data: 'agree', | |||
label: 'موافق' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'subtract', | |||
data: 'contrary', | |||
label: 'مخالف' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'ellipsis', | |||
data: 'Neutralvote', | |||
label: 'ممتنع' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'strikethrough', | |||
data: 'remove', | |||
label: 'حذف شود' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'underline', | |||
data: 'keep', | |||
label: 'بماند' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'referenceExisting', | |||
data: 'merge', | |||
label: 'ادغام شود' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'help', | |||
data: 'Q', | |||
label: 'پرسش' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'feedback', | |||
data: 'A', | |||
label: 'پاسخ' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'heart', | |||
data: 'like', | |||
label: 'لایک' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'lightbulb', | |||
data: 'idea', | |||
label: 'ایده' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'helpNotice', | |||
data: 'suggestion', | |||
label: 'پیشنهاد' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'upTriangle', | |||
data: 'plus1', | |||
label: '+1' | |||
}), | |||
new OO.ui.MenuOptionWidget({ | |||
icon: 'star', | |||
data: 'thankyou', | |||
label: 'سپاسگزارم' | |||
}) | |||
] | |||
} | |||
}); | |||
archiveSectionOptions.Dropdown.getMenu().selectItemByData('info'); | |||
archiveSectionOptions.MultiselectPingUser = new OO.ui.MenuTagMultiselectWidget({ | archiveSectionOptions.MultiselectPingUser = new OO.ui.MenuTagMultiselectWidget({ | ||
inputPosition: 'outline', | inputPosition: 'outline', | ||
| خط ۲۴۶: | خط ۴۰۶: | ||
placeholder: 'از اینجا نام کاربری که قصد پاسخ دارید، انتخاب کنید یا ابتدای نامش را بنویسید', | placeholder: 'از اینجا نام کاربری که قصد پاسخ دارید، انتخاب کنید یا ابتدای نامش را بنویسید', | ||
selected: [] | selected: [] | ||
}); | }); | ||
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.MultiselectPingUser, { | fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.MultiselectPingUser, { | ||
label: 'انتخاب کاربران شرکتکننده در بحث برای پاسخ (پینگ)', | label: 'انتخاب کاربران شرکتکننده در بحث برای پاسخ (پینگ):', | ||
align: 'inline' | align: 'inline' | ||
})); | })); | ||
archiveSectionOptions.dropdownCommentType = new OO.ui.DropdownWidget({ | |||
archiveSectionOptions. | |||
items: [ | items: [ | ||
archiveSectionOptions. | archiveSectionOptions.itemComment, | ||
] | ] | ||
}); | }); | ||
| خط ۲۹۷: | خط ۴۲۴: | ||
}); | }); | ||
if (persianWikiTools) { | if (persianWikiTools) { | ||
archiveSectionOptions.editButton.on('click', function() { | archiveSectionOptions.editButton.on('click', function () { | ||
archiveSectionOptions.textComment.setValue(persianWikiTools.superTool(archiveSectionOptions.textComment.getValue()).trim()) | archiveSectionOptions.textComment.setValue(persianWikiTools.superTool(archiveSectionOptions.textComment.getValue()).trim()) | ||
| خط ۳۰۶: | خط ۴۳۳: | ||
} | } | ||
archiveSectionOptions.textComment = new OO.ui.MultilineTextInputWidget({ | archiveSectionOptions.textComment = new OO.ui.MultilineTextInputWidget({ | ||
placeholder: 'متن نظر را وارد کنید', | placeholder: 'متن نظر را وارد کنید', | ||
rows: 6, | rows: 6, | ||
}); | }); | ||
//archiveSectionOptions.textComment.setRTL(true); | //archiveSectionOptions.textComment.setRTL(true); | ||
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions. | fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.buttonIndentSelect, { | ||
label: ' | label: 'دندانه گذاری:', | ||
align: ' | align: 'top' | ||
})); | })); | ||
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions. | fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.Dropdown, { | ||
label: 'برچسب قبل از نظر', | label: 'برچسب قبل از نظر:', | ||
align: 'top' | align: 'top' | ||
})); | })); | ||
| خط ۳۲۶: | خط ۴۵۲: | ||
align: 'top' | align: 'top' | ||
})); | })); | ||
const bold_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'bold', | |||
label: 'bold', | |||
invisibleLabel: true, | |||
title: 'متن پررنگ' | |||
}); | |||
const italic_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'italic', | |||
label: 'italic', | |||
invisibleLabel: true, | |||
title: 'متن کج' | |||
}); | |||
const wikilink_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'wikiText', | |||
label: 'wikilink', | |||
invisibleLabel: true, | |||
title: 'ویکیلینک' | |||
}); | |||
const newline_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'newline', | |||
label: 'newline', | |||
invisibleLabel: true, | |||
title: 'سطر جدید' | |||
}); | |||
const bigger_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'bigger', | |||
label: 'bigger', | |||
invisibleLabel: true, | |||
title: 'متن بزرگتر' | |||
}); | |||
const smaller_btn = new OO.ui.ButtonWidget({ | |||
framed: false, | |||
icon: 'smaller', | |||
label: 'smaller', | |||
invisibleLabel: true, | |||
title: 'متن کوچکتر' | |||
}); | |||
fieldset.push(bold_btn); | |||
fieldset.push(italic_btn); | |||
fieldset.push(wikilink_btn); | |||
fieldset.push(bigger_btn); | |||
fieldset.push(smaller_btn); | |||
fieldset.push(newline_btn); | |||
archiveSectionOptions.Dropdown.getMenu().on('select', function () { | |||
if (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'contrary' || | |||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'keep' || | |||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'remove' || | |||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'merge' || | |||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'agree' || | |||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Neutralvote' | |||
) { | |||
archiveSectionOptions.btnSameIndent.setDisabled(true); | |||
archiveSectionOptions.btnOneIndent.setDisabled(true); | |||
archiveSectionOptions.buttonIndentSelect.selectItem(archiveSectionOptions.btnnoIndent); | |||
} | |||
else { | |||
if (archiveSectionOptions.btnSameIndent.isDisabled() == true) { | |||
archiveSectionOptions.btnSameIndent.setDisabled(false); | |||
archiveSectionOptions.btnOneIndent.setDisabled(false); | |||
archiveSectionOptions.buttonIndentSelect.selectItem(btnSameIndent); | |||
} | |||
} | |||
}); | |||
bold_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "\'\'\'", "\'\'\'"); | |||
}); | |||
italic_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "\'\'", "\'\'"); | |||
}); | |||
wikilink_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "[[", "]]"); | |||
}); | |||
newline_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "{{سخ}}", ""); | |||
}); | |||
bigger_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "<big>", "</big>"); | |||
}); | |||
smaller_btn.on('click', function () { | |||
var textElement = archiveSectionOptions.textComment.$input[0]; | |||
insertAtCursor(textElement, "<small>", "</small>"); | |||
}); | |||
function insertAtCursor(myField, myValueBefore, myValueAfter) { | |||
if (document.selection) { | |||
myField.focus(); | |||
document.selection.createRange().text = myValueBefore + document.selection.createRange().text + myValueAfter; | |||
} else if (myField.selectionStart || myField.selectionStart == '0') { | |||
var startPos = myField.selectionStart; | |||
var endPos = myField.selectionEnd; | |||
myField.value = myField.value.substring(0, startPos) + myValueBefore + myField.value.substring(startPos, endPos) + myValueAfter + myField.value.substring(endPos, myField.value.length); | |||
} | |||
} | |||
this.content.addItems(fieldset); | this.content.addItems(fieldset); | ||
this.panel.$element.append(this.content.$element); | this.panel.$element.append(this.content.$element); | ||
this.$body.append(this.panel.$element); | this.$body.append(this.panel.$element); | ||
}; | }; | ||
CommentInSection.prototype.getActionProcess = function(action) { | CommentInSection.prototype.getActionProcess = function (action) { | ||
var dialog = this; | var dialog = this; | ||
if (action === 'comment') { | if (action === 'comment') { | ||
archiveSectionOptions.doEdit(archiveSectionOptions.currentSectionId, action); | archiveSectionOptions.doEdit(archiveSectionOptions.currentSectionId, action); | ||
} | |||
else if (action === 'close') { | |||
this.close(); | |||
} | |||
else if (action === 'preview') { | |||
dialog.previewResult.toggle(true); | |||
dialog.previewResult.setContent(''); // Makes any previous preview results go away, so the user notices the change | |||
windowManager.getCurrentWindow().updateSize(); | |||
var wikitext = archiveSectionOptions.textComment.getValue(); | |||
var api = new mw.Api(); | |||
api.get({ | |||
action: 'parse', | |||
text: wikitext + "~~~~", | |||
pst: true | |||
}).done(function (data) { | |||
dialog.previewResult.setContent($(data.parse.text['*'] + "<br>")); | |||
}); | |||
this.panelPreview = new OO.ui.PanelLayout({ | |||
classes: ['panelPreview'], | |||
expanded: false, | |||
padded: false | |||
}); | |||
this.panelPreview.$element.append(this.previewResult.$element); | |||
this.$body.append(this.panelPreview.$element); | |||
$('.oo-ui-layout.oo-ui-panelLayout.oo-ui-panelLayout-padded.oo-ui-panelLayout-expanded').css('padding-top', '0px'); | |||
} | } | ||
return CommentInSection.super.prototype.getActionProcess.call(this, action); | return CommentInSection.super.prototype.getActionProcess.call(this, action); | ||
| خط ۳۵۰: | خط ۶۱۹: | ||
}); | }); | ||
}, | }, | ||
getQuery: function(section) { | getQuery: function (section) { | ||
var query = new mw. | var query = new URL("https://" + mw.config.get("wgServerName") + section).searchParams; | ||
return query; | return query; | ||
}, | }, | ||
setIndentation: function(text, newText) { | setIndentation: function (text, newText, notArchiving) { | ||
text = text.replace(/\r/g, '') | text = text.replace(/\r/g, '') | ||
var lines = text.split('\n'); | var lines = text.split('\n'); | ||
| خط ۳۶۲: | خط ۶۳۱: | ||
var colonType = colons[1]; | var colonType = colons[1]; | ||
try { | try { | ||
if ( | if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() == 2) { | ||
colonNum = colonNum - 1 | colonNum = colonNum - 1 | ||
} | } | ||
}catch(err) {} | } catch (err) { } | ||
var indentation = ''; | var indentation = ''; | ||
for (var i = 0; i < colonNum + 1; i++) { | if (notArchiving == true) { | ||
indentation += ':'; | if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() != 3) { | ||
for (var i = 0; i < colonNum + 1; i++) { | |||
indentation += ':'; | |||
} | |||
} | |||
} | |||
else { | |||
for (var i = 0; i < colonNum + 1; i++) { | |||
indentation += ':'; | |||
} | |||
} | } | ||
text = text + '\n' + colonType + indentation + newText.trim().replace(/\n/ig, '\n' + colonType + indentation).trim(); | text = text + '\n' + colonType + indentation + newText.trim().replace(/\n/ig, '\n' + colonType + indentation).trim(); | ||
return text | return text | ||
}, | }, | ||
doEdit: function(sectionId, action) { | doEdit: function (sectionId, action) { | ||
(new mw.Api()).get({ | (new mw.Api()).get({ | ||
format: 'json', | format: 'json', | ||
| خط ۳۸۱: | خط ۶۵۹: | ||
prop: 'revisions', | prop: 'revisions', | ||
rvprop: 'content', | rvprop: 'content', | ||
}).then(function(data) { | }).then(function (data) { | ||
var page = data.query.pages[Object.keys(data.query.pages)[0]]; | var page = data.query.pages[Object.keys(data.query.pages)[0]]; | ||
var current = page.revisions[0]['*']; | var current = page.revisions[0]['*']; | ||
| خط ۳۹۰: | خط ۶۶۸: | ||
var section_title = (current.match(/^(=+)[^=]*?(\1)$/m) || [''])[0]; | var section_title = (current.match(/^(=+)[^=]*?(\1)$/m) || [''])[0]; | ||
section_title = section_title.replace(/\=/g, ''); | section_title = section_title.replace(/\=/g, ''); | ||
if (!section_title){ | if (!section_title) { | ||
section_title='بخش آغازین' | section_title = 'بخش آغازین' | ||
} | } | ||
var editSummary = '/' + '*' + section_title + '*' + '/ '; | var editSummary = '/' + '*' + section_title + '*' + '/ '; | ||
| خط ۳۹۹: | خط ۶۷۷: | ||
newText = header + '\n'; | newText = header + '\n'; | ||
// Per Special:Diff/18468612 | // Per Special:Diff/18468612 | ||
if (mw.config.get("wgPageName") == "ویکیپدیا:درخواست_انتقال") { | if ( | ||
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_انتقال" || | |||
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_ادغام_تاریخچه" || | |||
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_بایگانی_منابع_برخط" | |||
) { | |||
if (archiveSectionOptions.switchSuccess.getValue()) { | if (archiveSectionOptions.switchSuccess.getValue()) { | ||
content = content.replace(/\{\{وضعیت\|?\}\}/, '{{وضعیت|شد}}'); | content = content.replace(/\{\{وضعیت\|?\}\}/, '{{وضعیت|شد}}'); | ||
| خط ۴۰۶: | خط ۶۸۸: | ||
} | } | ||
} | } | ||
newText += '{{بسته'; | newText += '{{بسته|برچسب زمان={{subst:' + 'CURRENTTIMESTAMP}}'; | ||
if (archiveSectionOptions.switchSuccess.getValue()) { | if (archiveSectionOptions.switchSuccess.getValue()) { | ||
newText += '}}\n'; | newText += '}}\n'; | ||
| خط ۴۱۳: | خط ۶۹۵: | ||
} | } | ||
var summaryText = ''; | var summaryText = ''; | ||
var inputText=archiveSectionOptions.textSummary.getValue() | var inputText = archiveSectionOptions.textSummary.getValue() | ||
if (inputText|| archiveSectionOptions.ActionDone.getValue()) { | if (inputText || archiveSectionOptions.ActionDone.getValue()) { | ||
if (!inputText){ | if (!inputText) { | ||
var inputText=''; | var inputText = ''; | ||
} | } | ||
if (archiveSectionOptions.ActionDone.getValue()){ | if (archiveSectionOptions.ActionDone.getValue()) { | ||
if (archiveSectionOptions.switchSuccess.getValue()){ | if (archiveSectionOptions.switchSuccess.getValue()) { | ||
inputText='{{شد}}'+inputText | inputText = '{{شد}}' + inputText | ||
}else{ | } else { | ||
inputText='{{نشد}}'+inputText | inputText = '{{نشد}}' + inputText | ||
} | } | ||
} | } | ||
if (archiveSectionOptions.switchBold.getValue()) { | if (archiveSectionOptions.switchBold.getValue()) { | ||
summaryText = "'''"+inputText+"'''"; | summaryText = "'''" + inputText + "'''"; | ||
}else{ | } else { | ||
summaryText = inputText; | summaryText = inputText; | ||
} | } | ||
summaryText += ' ~~' + '~~\n'; | summaryText += ' ~~' + '~~\n'; | ||
} | } | ||
if (!archiveSectionOptions.switchTop | if (!archiveSectionOptions.switchTop.getValue()) { | ||
if (inputText) { | if (inputText) { | ||
newText = archiveSectionOptions.setIndentation(newText + content, summaryText); | newText = archiveSectionOptions.setIndentation(newText + content, summaryText, false); | ||
} else { | } else { | ||
newText = newText + content; | newText = newText + content; | ||
| خط ۴۵۴: | خط ۷۳۶: | ||
summary: editSummary, | summary: editSummary, | ||
text: newText, | text: newText, | ||
token: mw.user.tokens.get(' | token: mw.user.tokens.get('csrfToken') | ||
}); | }); | ||
} else { | } else { | ||
| خط ۴۷۹: | خط ۷۶۱: | ||
PingtxteditSummary = '' | PingtxteditSummary = '' | ||
} | } | ||
if (archiveSectionOptions. | |||
newText = Pingtxt + '{{شد}} '; | if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() == 1 && (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Q' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'A' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'like' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'idea' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'suggestion' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'plus1' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'thankyou')) { | ||
prefix = '\n'; | |||
} | |||
newText = Pingtxt + ''; | switch (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString()) { | ||
case 'info': | |||
newText = Pingtxt + ''; | |||
newText = Pingtxt + '{{ | editSummary += 'ثبت پیام' + PingtxteditSummary; | ||
break; | |||
case 'Opinion': | |||
newText = prefix + Pingtxt + ' {{بماند}} '; | newText = prefix + Pingtxt + '{{نظر}} '; | ||
editSummary += 'ثبت نظر' + PingtxteditSummary; | |||
break; | |||
newText = prefix + Pingtxt + ' {{حذف}} '; | case 'done': | ||
newText = Pingtxt + '{{شد}} '; | |||
editSummary += 'انجام شد' + PingtxteditSummary; | |||
newText = prefix + Pingtxt + ' {{ | break; | ||
editSummary += 'ثبت | case 'NOTdone': | ||
newText = Pingtxt + '{{نشد}} '; | |||
newText = | editSummary += 'انجام نشد' + PingtxteditSummary; | ||
editSummary += 'ثبت | break; | ||
case 'agree': | |||
newText = prefix + Pingtxt + '{{موافق}} '; | |||
editSummary += 'ثبت نظر موافق' + PingtxteditSummary; | |||
break; | |||
case 'contrary': | |||
newText = prefix + Pingtxt + '{{مخالف}} '; | |||
editSummary += 'ثبت نظر مخالف' + PingtxteditSummary; | |||
break; | |||
case 'Neutralvote': | |||
newText = prefix + Pingtxt + '{{ممتنع}} '; | |||
editSummary += 'ثبت نظر ممتنع' + PingtxteditSummary; | |||
break; | |||
case 'keep': | |||
newText = prefix + Pingtxt + '{{بماند}} '; | |||
editSummary += 'ثبت نظر «بماند»' + PingtxteditSummary; | |||
break; | |||
case 'remove': | |||
newText = prefix + Pingtxt + '{{حذف شود}} '; | |||
editSummary += 'ثبت نظر «حذف شود»' + PingtxteditSummary; | |||
break; | |||
case 'merge': | |||
newText = prefix + Pingtxt + '{{ادغام شود}} '; | |||
editSummary += 'ثبت نظر «ادغام شود»' + PingtxteditSummary; | |||
break; | |||
case 'Q': | |||
newText = Pingtxt + '{{پرسش}} '; | |||
editSummary += 'ثبت پرسش' + PingtxteditSummary; | |||
break; | |||
case 'A': | |||
newText = Pingtxt + '{{پاسخ}} '; | |||
editSummary += 'ثبت پاسخ' + PingtxteditSummary; | |||
break; | |||
case 'like': | |||
newText = Pingtxt + '{{لایک}} '; | |||
editSummary += 'ثبت «لایک»' + PingtxteditSummary; | |||
break; | |||
case 'idea': | |||
newText = Pingtxt + '{{ایده}} '; | |||
editSummary += 'ثبت ایده' + PingtxteditSummary; | |||
break; | |||
case 'suggestion': | |||
newText = Pingtxt + '{{Suggestion}} '; | |||
editSummary += 'ثبت پیشنهاد' + PingtxteditSummary; | |||
break; | |||
case 'plus1': | |||
newText = Pingtxt + '{{+1}} '; | |||
editSummary += 'ثبت «+1»' + PingtxteditSummary; | |||
break; | |||
case 'thankyou': | |||
newText = Pingtxt + '{{سپاس-گل}} '; | |||
editSummary += 'ثبت سپاسگزاری' + PingtxteditSummary; | |||
break; | |||
default: | |||
} | } | ||
newText += archiveSectionOptions.textComment.getValue(); | newText += archiveSectionOptions.textComment.getValue(); | ||
newText += ' ~~' + '~~'; | newText += ' ~~' + '~~'; | ||
if (onlyTopSection){ | if (onlyTopSection) { | ||
if (!current.match('^\= ')) { | |||
var topCurrent = current.split('\n===')[0]; | |||
} else { | |||
var topCurrent = current.split('\n==')[0] | |||
} | |||
} | } | ||
if (archiveSectionOptions. | if (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'contrary' || | ||
archiveSectionOptions. | archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'keep' || | ||
archiveSectionOptions. | archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'remove' || | ||
archiveSectionOptions. | archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'merge' || | ||
if (onlyTopSection){ | archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'agree' || | ||
newText=current.replace(topCurrent,topCurrent+'\n'+newText) | archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Neutralvote' | ||
}else{ | ) { | ||
if (onlyTopSection) { | |||
newText = current.replace(topCurrent, topCurrent + '\n' + newText); | |||
} else { | |||
newText = current + '\n' + newText; | newText = current + '\n' + newText; | ||
} | } | ||
} else { | } else { | ||
if (onlyTopSection){ | if (onlyTopSection) { | ||
var topCurrentWithIndent = archiveSectionOptions.setIndentation(topCurrent, newText); | var topCurrentWithIndent = archiveSectionOptions.setIndentation(topCurrent, newText, true); | ||
newText=current.replace(topCurrent,topCurrentWithIndent) | newText = current.replace(topCurrent, topCurrentWithIndent) | ||
}else{ | } else { | ||
newText = archiveSectionOptions.setIndentation(current, newText); | newText = archiveSectionOptions.setIndentation(current, newText, true); | ||
} | } | ||
} | } | ||
| خط ۵۳۵: | خط ۸۷۴: | ||
summary: editSummary, | summary: editSummary, | ||
text: newText, | text: newText, | ||
token: mw.user.tokens.get(' | token: mw.user.tokens.get('csrfToken') | ||
}); | }); | ||
} | } | ||
}).then(function() { | }).then(function () { | ||
if (action == 'archive') { | if (action == 'archive') { | ||
mw.notify('در حال ثبت جمعبندی شما ...'); | mw.notify('در حال ثبت جمعبندی شما ...'); | ||
| خط ۵۴۵: | خط ۸۸۴: | ||
} | } | ||
if (sectionId == 0) { | if (sectionId == 0) { | ||
sectionId = 1 | sectionId = 1; | ||
} | |||
if ($('.mw-headline').length) { | |||
location.hash = $('.mw-headline')[sectionId - 1].id; | |||
} else { | |||
location.hash = $($('.mw-heading')[sectionId - 1]).find(':header')[0].id; | |||
} | } | ||
location.reload(true); | location.reload(true); | ||
}, function(error) { | }, function (error) { | ||
mw.notify('ثبت نظر یا جمعبندی ناموفق بود: ' + error, { | mw.notify('ثبت نظر یا جمعبندی ناموفق بود: ' + error, { | ||
type: 'error' | type: 'error' | ||
}); | }); | ||
}) | }); | ||
}, | }, | ||
currentSectionId: -1, | currentSectionId: -1, | ||
| خط ۵۶۱: | خط ۹۰۴: | ||
} | } | ||
})(jQuery, mediaWiki); | })(jQuery, mediaWiki); | ||
// </nowiki> | |||
نسخهٔ کنونی تا ۲۹ ژوئن ۲۰۲۵، ساعت ۱۱:۳۶
/*
MediaWiki:Gadget-close.js
*/
// <nowiki>
/*global jQuery, mediaWiki */
(function ($, mw) {
'use strict';
var windowManager;
var archiveSection;
var commentInSection;
var onlyTopSection;
var archiveSectionOptions = {
install: function () {
var namespace = mw.config.get("wgNamespaceNumber");
if (namespace === 4 || namespace % 2 === 1) {
if ($('.mw-editsection').length == 0) {
return false;
}
if (mw.config.get("wgPageName") === "ویکیپدیا:نظرخواهی_برای_حذف" |
mw.config.get("wgPageName") === "ویکیپدیا:آیا_میدانستید_که...؟/پیشنویس" |
mw.config.get("wgPageName") === "ویکیپدیا:گزیدن_موضوعات_برگزیده") {
return false; // ابزار را باید در زیرصفحههای نبح استفاده کرد نه در خود نبح
}
// افزودن دکمه به بخش آغازین
if (
!$('.mw-editsection')[0]['innerHTML'].toString().match("ویرایش بخش آغازین") && // mediawiki:gadget-edittop.js is not active
mw.config.get("wgPageName").substr(0, 28) !== 'ویکیپدیا:نظرخواهی_برای_حذف/'
) { // نشان ندادن دکمهها در بخش آغازین نبحها برای جلوگیری از ثبت نظر در جای اشتباه
var our_content = $("#content, #mw_content").first();
var span1 = our_content.find("span.mw-editsection:not(.plainlinks)").first();
if (!span1.length) {
return;
}
var span0 = span1.clone();
$("#mw_header h1, #content h1").first().append(span0);
span0.find("a").each(function (idx) {
var a = $(this);
a.attr("title", 'ویرایش بخش آغازین');
if (!/&(ve|)section=T/.test(a.attr("href"))) { // not transcluded
a.attr("href", a.attr("href").replace(/&(ve|)section=\d+/, "&$1section=0&summary=/*%20بخش%20آغازین%20*/%20"));
} else if (/&vesection=/.test(a.attr("href"))) { // transcluded, VE
a.attr("href", mw.util.getUrl(mw.config.get('wgPageName')) + "?veaction=edit&vesection=0&summary=/*%20بخش%20آغازین%20*/%20");
} else { // transcluded, not VE
a.attr("href", mw.util.getUrl(mw.config.get('wgPageName')) + "?action=edit§ion=0&summary=/*%20بخش%20آغازین%20*/%20");
}
});
}
// افزودن دکمه به زیربخشها
$('.mw-editsection').each(function () {
if ($(this).parent('#firstHeading').length > 0) return;
var section = '';
$(this).find('a').each(function () {
var m = $(this).attr('href').match(/section=(\d+)/);
if (m && m.length == 2 && section == '') {
section = $(this).attr('href');
}
});
var span = $('<span>', {
class: 'mw-archivesection'
}).insertAfter(this);
span.append($('<span>', {
class: 'mw-editsection-bracket',
text: '['
}));
span.append($('<a>', {
href: '#',
title: 'ثبت نظر (موافق/مخالف/شد/...)',
style: 'font-size: smaller;',
text: 'ثبت نظر',
}).click(function (e) {
e.preventDefault();
mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function () {
archiveSectionOptions.createCommentWindow(section);
});
}));
span.append($('<span>', {
class: '',
text: ' / ',
style: 'color: var(--color-subtle, #54595d)'
}));
span.append($('<a>', {
href: '#',
title: 'جمعبندی این بخش',
style: 'font-size: smaller;',
text: 'جمعبندی',
}).click(function (e) {
e.preventDefault();
mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']).done(function () {
archiveSectionOptions.createArchiveWindow(section);
});
}));
span.append($('<span>', {
class: 'mw-editsection-bracket',
text: ']'
}));
// Late pre-loading
mw.loader.load(['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows']);
});
}
},
createArchiveWindow: function (section) {
var query = archiveSectionOptions.getQuery(section);
var sectionId = query.get("section");
archiveSectionOptions.currentSectionId = sectionId;
function ArchiveSection(config) {
ArchiveSection.super.call(this, config);
}
OO.inheritClass(ArchiveSection, OO.ui.ProcessDialog);
ArchiveSection.static.name = 'archive';
ArchiveSection.static.title = 'جمعبندی بخش';
ArchiveSection.static.actions = [
{
action: 'archive',
label: 'جمعبندی',
flags: 'primary'
}, {
label: 'لغو',
flags: 'safe'
}
];
ArchiveSection.prototype.initialize = function () {
var fieldset = [];
ArchiveSection.super.prototype.initialize.apply(this, arguments);
this.panel = new OO.ui.PanelLayout({
padded: true,
expanded: false
});
this.content = new OO.ui.FieldsetLayout();
archiveSectionOptions.switchTop = new OO.ui.ToggleSwitchWidget({
label: 'جمعبندی بالای متن باشد',
value: false,
});
archiveSectionOptions.switchSuccess = new OO.ui.ToggleSwitchWidget({
label: 'بحث در رسیدن به اجماع موفق بود',
value: true,
});
archiveSectionOptions.ActionDone = new OO.ui.ToggleSwitchWidget({
label: 'افزودن {{شد}} یا {{نشد}} به پایین بحث، بر پایهٔ موفق بودن یا نبودن',
value: false,
});
archiveSectionOptions.switchBold = new OO.ui.ToggleSwitchWidget({
label: 'متن جمعبندی ضخیم نمایش داده شود',
value: false,
});
archiveSectionOptions.textSummary = new OO.ui.MultilineTextInputWidget({
placeholder: 'متن جمعبندی را وارد کنید',
rows: 6,
});
//archiveSectionOptions.textSummary.setRTL(true);
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.switchTop, {
label: 'جمعبندی بالای متن باشد',
align: 'inline',
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.switchSuccess, {
label: 'بحث در رسیدن به اجماع موفق بود',
align: 'inline',
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.ActionDone, {
label: 'افزودن {{شد}} یا {{نشد}} به پایین بحث، بر پایهٔ موفق بودن یا نبودن',
align: 'inline',
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.switchBold, {
label: 'متن جمعبندی ضخیم نمایش داده شود',
align: 'inline',
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.textSummary, {
label: 'جمعبندی:',
align: 'top'
}));
this.content.addItems(fieldset);
this.panel.$element.append(this.content.$element);
this.$body.append(this.panel.$element);
};
ArchiveSection.prototype.getActionProcess = function (action) {
var dialog = this;
if (action === 'archive') {
archiveSectionOptions.doEdit(archiveSectionOptions.currentSectionId, action);
}
return ArchiveSection.super.prototype.getActionProcess.call(this, action);
};
if (!windowManager) {
windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
}
if (!archiveSection) {
archiveSection = new ArchiveSection({
size: 'medium'
});
windowManager.addWindows([archiveSection]);
}
windowManager.openWindow(archiveSection);
},
createCommentWindow: function (section) {
function PreviewPanel(config) {
PreviewPanel.parent.call(this, config);
this.$content = $('<div>').addClass('oo-ui-PreviewPanel');
}
OO.inheritClass(PreviewPanel, OO.ui.PanelLayout);
PreviewPanel.prototype.setContent = function ($content) {
this.$element.children().detach();
this.$element.append($content);
windowManager.getCurrentWindow().updateSize();
};
var query = archiveSectionOptions.getQuery(section);
var sectionId = query.get("section");
archiveSectionOptions.currentSectionId = sectionId;
(new mw.Api()).get({
format: 'json',
action: 'query',
titles: mw.config.get("wgPageName"),
rvsection: sectionId,
prop: 'revisions',
rvprop: 'content',
}).then(function (data) {
var page = data.query.pages[Object.keys(data.query.pages)[0]];
var current = page.revisions[0]['*'];
current = current.replace(/\= \=/gi, '==');
current = current.replace(/\=([^\= \n\r]+) *\=/gi, '= $1 =');
current = current.replace(/\={4,}/gi, '==');
if (('\n' + current).split('\n==').length > 3) {
onlyTopSection = confirm('این بخش، زیربخشهایی هم دارد! برای ارسال متن آیا قسمت بالایی منظورتان است؟\nدکمهٔ Ok = پیام در بخش بالایی قرار گیرد.\nدکمهٔ Cancel = متن در انتها قرار گیرد.')
if (onlyTopSection) {
if (!current.match('^\= ')) {
current = current.split('\n===')[0]
} else {
current = current.split('\n==')[0]
}
}
}
function CommentInSection(config) {
CommentInSection.super.call(this, config);
}
OO.inheritClass(CommentInSection, OO.ui.ProcessDialog);
CommentInSection.static.name = 'comment';
CommentInSection.static.title = 'ثبت نظر';
CommentInSection.static.actions = [{
action: 'comment',
label: 'ثبت نظر',
flags: 'primary'
},
{
action: 'preview',
label: 'پیشنمایش',
icon: 'check',
title: 'پیشنمایش',
flags: 'progressive'
},
{
action: 'close',
label: 'لغو',
flags: 'safe'
}];
CommentInSection.prototype.initialize = function () {
var fieldset = [];
CommentInSection.super.prototype.initialize.apply(this, arguments);
this.panel = new OO.ui.PanelLayout({
padded: true,
expanded: false
});
this.previewResult = new PreviewPanel({
expanded: true,
padded: true,
$content: ''
});
this.content = new OO.ui.FieldsetLayout();
var PingUsers = current.match(/\[\[(?:بحث[_ ]کاربر|[Uu]ser[_ ][tT]alk|کاربر|[Uu]ser)\:([^\]\\\/]+)\|(?:[^\]]+)\]\]/gi)
var uniqueNames = [];
$.each(PingUsers, function (i, el) {
var username = el.split('|')[0].split('/')[0].split('#')[0].split(':')[1];
if ($.inArray(username, uniqueNames) === -1 && username != mw.config.get('wgUserName')) {
uniqueNames.push(username);
}
});
var finallList = []
var i;
for (i = 0; i < uniqueNames.length; i++) {
finallList.push({
data: uniqueNames[i],
lable: 'کاربر:' + uniqueNames[i]
})
}
archiveSectionOptions.btnOneIndent = new OO.ui.ButtonOptionWidget({
data: 1,
label: 'پاسخ به قبلی',
title: 'پیام در پاسخ به نفر قبل نوشته میشود.'
}),
archiveSectionOptions.btnSameIndent = new OO.ui.ButtonOptionWidget({
data: 2,
label: 'بدون دندانهگذاری',
title: 'پیام بدون دندانهگذاری نوشته میشود.'
}),
archiveSectionOptions.btnnoIndent = new OO.ui.ButtonOptionWidget({
data: 3,
label: 'سر خط',
title: 'پیام از ابتدای خط شروع میشود.'
}),
archiveSectionOptions.buttonIndentSelect = new OO.ui.ButtonSelectWidget({
items: [archiveSectionOptions.btnOneIndent, archiveSectionOptions.btnSameIndent, archiveSectionOptions.btnnoIndent]
});
archiveSectionOptions.buttonIndentSelect.selectItem(archiveSectionOptions.btnOneIndent);
archiveSectionOptions.Dropdown = new OO.ui.DropdownWidget({
label: 'پیام',
menu: {
items: [
new OO.ui.MenuOptionWidget({
icon: 'share',
data: 'info',
label: 'پیام'
}),
new OO.ui.MenuOptionWidget({
icon: 'info',
data: 'Opinion',
label: 'نظر'
}),
new OO.ui.MenuOptionWidget({
icon: 'check',
data: 'done',
label: 'شد',
}),
new OO.ui.MenuOptionWidget({
icon: 'close',
data: 'NOTdone',
label: 'نشد'
}),
new OO.ui.MenuOptionWidget({
icon: 'add',
data: 'agree',
label: 'موافق'
}),
new OO.ui.MenuOptionWidget({
icon: 'subtract',
data: 'contrary',
label: 'مخالف'
}),
new OO.ui.MenuOptionWidget({
icon: 'ellipsis',
data: 'Neutralvote',
label: 'ممتنع'
}),
new OO.ui.MenuOptionWidget({
icon: 'strikethrough',
data: 'remove',
label: 'حذف شود'
}),
new OO.ui.MenuOptionWidget({
icon: 'underline',
data: 'keep',
label: 'بماند'
}),
new OO.ui.MenuOptionWidget({
icon: 'referenceExisting',
data: 'merge',
label: 'ادغام شود'
}),
new OO.ui.MenuOptionWidget({
icon: 'help',
data: 'Q',
label: 'پرسش'
}),
new OO.ui.MenuOptionWidget({
icon: 'feedback',
data: 'A',
label: 'پاسخ'
}),
new OO.ui.MenuOptionWidget({
icon: 'heart',
data: 'like',
label: 'لایک'
}),
new OO.ui.MenuOptionWidget({
icon: 'lightbulb',
data: 'idea',
label: 'ایده'
}),
new OO.ui.MenuOptionWidget({
icon: 'helpNotice',
data: 'suggestion',
label: 'پیشنهاد'
}),
new OO.ui.MenuOptionWidget({
icon: 'upTriangle',
data: 'plus1',
label: '+1'
}),
new OO.ui.MenuOptionWidget({
icon: 'star',
data: 'thankyou',
label: 'سپاسگزارم'
})
]
}
});
archiveSectionOptions.Dropdown.getMenu().selectItemByData('info');
archiveSectionOptions.MultiselectPingUser = new OO.ui.MenuTagMultiselectWidget({
inputPosition: 'outline',
options: finallList,
placeholder: 'از اینجا نام کاربری که قصد پاسخ دارید، انتخاب کنید یا ابتدای نامش را بنویسید',
selected: []
});
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.MultiselectPingUser, {
label: 'انتخاب کاربران شرکتکننده در بحث برای پاسخ (پینگ):',
align: 'inline'
}));
archiveSectionOptions.dropdownCommentType = new OO.ui.DropdownWidget({
items: [
archiveSectionOptions.itemComment,
]
});
archiveSectionOptions.editButton = new OO.ui.ButtonWidget({
label: 'ابرابزار',
flags: [
'primary',
'progressive'
]
});
if (persianWikiTools) {
archiveSectionOptions.editButton.on('click', function () {
archiveSectionOptions.textComment.setValue(persianWikiTools.superTool(archiveSectionOptions.textComment.getValue()).trim())
});
} else {
archiveSectionOptions.editButton.setDisabled(true)
}
archiveSectionOptions.textComment = new OO.ui.MultilineTextInputWidget({
placeholder: 'متن نظر را وارد کنید',
rows: 6,
});
//archiveSectionOptions.textComment.setRTL(true);
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.buttonIndentSelect, {
label: 'دندانه گذاری:',
align: 'top'
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.Dropdown, {
label: 'برچسب قبل از نظر:',
align: 'top'
}));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.editButton));
fieldset.push(new OO.ui.FieldLayout(archiveSectionOptions.textComment, {
label: 'متن نظر:',
align: 'top'
}));
const bold_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'bold',
label: 'bold',
invisibleLabel: true,
title: 'متن پررنگ'
});
const italic_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'italic',
label: 'italic',
invisibleLabel: true,
title: 'متن کج'
});
const wikilink_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'wikiText',
label: 'wikilink',
invisibleLabel: true,
title: 'ویکیلینک'
});
const newline_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'newline',
label: 'newline',
invisibleLabel: true,
title: 'سطر جدید'
});
const bigger_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'bigger',
label: 'bigger',
invisibleLabel: true,
title: 'متن بزرگتر'
});
const smaller_btn = new OO.ui.ButtonWidget({
framed: false,
icon: 'smaller',
label: 'smaller',
invisibleLabel: true,
title: 'متن کوچکتر'
});
fieldset.push(bold_btn);
fieldset.push(italic_btn);
fieldset.push(wikilink_btn);
fieldset.push(bigger_btn);
fieldset.push(smaller_btn);
fieldset.push(newline_btn);
archiveSectionOptions.Dropdown.getMenu().on('select', function () {
if (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'contrary' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'keep' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'remove' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'merge' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'agree' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Neutralvote'
) {
archiveSectionOptions.btnSameIndent.setDisabled(true);
archiveSectionOptions.btnOneIndent.setDisabled(true);
archiveSectionOptions.buttonIndentSelect.selectItem(archiveSectionOptions.btnnoIndent);
}
else {
if (archiveSectionOptions.btnSameIndent.isDisabled() == true) {
archiveSectionOptions.btnSameIndent.setDisabled(false);
archiveSectionOptions.btnOneIndent.setDisabled(false);
archiveSectionOptions.buttonIndentSelect.selectItem(btnSameIndent);
}
}
});
bold_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "\'\'\'", "\'\'\'");
});
italic_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "\'\'", "\'\'");
});
wikilink_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "[[", "]]");
});
newline_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "{{سخ}}", "");
});
bigger_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "<big>", "</big>");
});
smaller_btn.on('click', function () {
var textElement = archiveSectionOptions.textComment.$input[0];
insertAtCursor(textElement, "<small>", "</small>");
});
function insertAtCursor(myField, myValueBefore, myValueAfter) {
if (document.selection) {
myField.focus();
document.selection.createRange().text = myValueBefore + document.selection.createRange().text + myValueAfter;
} else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos) + myValueBefore + myField.value.substring(startPos, endPos) + myValueAfter + myField.value.substring(endPos, myField.value.length);
}
}
this.content.addItems(fieldset);
this.panel.$element.append(this.content.$element);
this.$body.append(this.panel.$element);
};
CommentInSection.prototype.getActionProcess = function (action) {
var dialog = this;
if (action === 'comment') {
archiveSectionOptions.doEdit(archiveSectionOptions.currentSectionId, action);
}
else if (action === 'close') {
this.close();
}
else if (action === 'preview') {
dialog.previewResult.toggle(true);
dialog.previewResult.setContent(''); // Makes any previous preview results go away, so the user notices the change
windowManager.getCurrentWindow().updateSize();
var wikitext = archiveSectionOptions.textComment.getValue();
var api = new mw.Api();
api.get({
action: 'parse',
text: wikitext + "~~~~",
pst: true
}).done(function (data) {
dialog.previewResult.setContent($(data.parse.text['*'] + "<br>"));
});
this.panelPreview = new OO.ui.PanelLayout({
classes: ['panelPreview'],
expanded: false,
padded: false
});
this.panelPreview.$element.append(this.previewResult.$element);
this.$body.append(this.panelPreview.$element);
$('.oo-ui-layout.oo-ui-panelLayout.oo-ui-panelLayout-padded.oo-ui-panelLayout-expanded').css('padding-top', '0px');
}
return CommentInSection.super.prototype.getActionProcess.call(this, action);
};
if (!windowManager) {
windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
}
if (!commentInSection) {
commentInSection = new CommentInSection({
size: 'medium'
});
windowManager.addWindows([commentInSection]);
}
windowManager.openWindow(commentInSection);
});
},
getQuery: function (section) {
var query = new URL("https://" + mw.config.get("wgServerName") + section).searchParams;
return query;
},
setIndentation: function (text, newText, notArchiving) {
text = text.replace(/\r/g, '')
var lines = text.split('\n');
var lastline = lines[lines.length - 1];
var colons = lastline.match('^([\#\*]?)(\:*)')
var colonNum = colons[2].length;
var colonType = colons[1];
try {
if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() == 2) {
colonNum = colonNum - 1
}
} catch (err) { }
var indentation = '';
if (notArchiving == true) {
if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() != 3) {
for (var i = 0; i < colonNum + 1; i++) {
indentation += ':';
}
}
}
else {
for (var i = 0; i < colonNum + 1; i++) {
indentation += ':';
}
}
text = text + '\n' + colonType + indentation + newText.trim().replace(/\n/ig, '\n' + colonType + indentation).trim();
return text
},
doEdit: function (sectionId, action) {
(new mw.Api()).get({
format: 'json',
action: 'query',
titles: mw.config.get("wgPageName"),
rvsection: sectionId,
prop: 'revisions',
rvprop: 'content',
}).then(function (data) {
var page = data.query.pages[Object.keys(data.query.pages)[0]];
var current = page.revisions[0]['*'];
var header = current.substr(0, current.indexOf('\n'));
var content = current.substr(current.indexOf('\n') + 1);
var newText = '';
var pingtxt = '';
var section_title = (current.match(/^(=+)[^=]*?(\1)$/m) || [''])[0];
section_title = section_title.replace(/\=/g, '');
if (!section_title) {
section_title = 'بخش آغازین'
}
var editSummary = '/' + '*' + section_title + '*' + '/ ';
if (action == 'archive') {
editSummary += 'جمعبندی: ';
editSummary += archiveSectionOptions.textSummary.getValue();
newText = header + '\n';
// Per Special:Diff/18468612
if (
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_انتقال" ||
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_ادغام_تاریخچه" ||
mw.config.get("wgPageName") == "ویکیپدیا:درخواست_بایگانی_منابع_برخط"
) {
if (archiveSectionOptions.switchSuccess.getValue()) {
content = content.replace(/\{\{وضعیت\|?\}\}/, '{{وضعیت|شد}}');
} else {
content = content.replace(/\{\{وضعیت\|?\}\}/, '{{وضعیت|نشد}}');
}
}
newText += '{{بسته|برچسب زمان={{subst:' + 'CURRENTTIMESTAMP}}';
if (archiveSectionOptions.switchSuccess.getValue()) {
newText += '}}\n';
} else {
newText += '|ناموفق=بله}}\n';
}
var summaryText = '';
var inputText = archiveSectionOptions.textSummary.getValue()
if (inputText || archiveSectionOptions.ActionDone.getValue()) {
if (!inputText) {
var inputText = '';
}
if (archiveSectionOptions.ActionDone.getValue()) {
if (archiveSectionOptions.switchSuccess.getValue()) {
inputText = '{{شد}}' + inputText
} else {
inputText = '{{نشد}}' + inputText
}
}
if (archiveSectionOptions.switchBold.getValue()) {
summaryText = "'''" + inputText + "'''";
} else {
summaryText = inputText;
}
summaryText += ' ~~' + '~~\n';
}
if (!archiveSectionOptions.switchTop.getValue()) {
if (inputText) {
newText = archiveSectionOptions.setIndentation(newText + content, summaryText, false);
} else {
newText = newText + content;
}
if (newText.indexOf('{{بسته') > -1) newText += '\n{{پایان بسته}}';
} else {
if (inputText) {
newText += ':' + summaryText;
}
newText += content;
if (newText.indexOf('{{بسته') > -1) newText += '\n{{پایان بسته}}';
}
return (new mw.Api()).post({
format: 'json',
action: 'edit',
title: mw.config.get("wgPageName"),
section: sectionId,
summary: editSummary,
text: newText,
token: mw.user.tokens.get('csrfToken')
});
} else {
var currentTxt = current.replace('\r', '')
var prefix = '';
if (currentTxt.search('\n*') > 0) {
prefix = '* ';
} else if (currentTxt.search('\n#') > 0) {
prefix = '# ';
} else {
prefix = '* ';
}
if (archiveSectionOptions.MultiselectPingUser.getValue()) {
var userlist = archiveSectionOptions.MultiselectPingUser.getValue()
var Pingtxt = '{{پینگ|' + userlist.join('|') + '}}'
var userTalkPage = mw.config.get("wgTitle")
Pingtxt = Pingtxt.replace('|' + userTalkPage + '}}', '|}}').replace('|' + userTalkPage + '|', '|')
var PingtxteditSummary = ' + پاسخ به کاربر:' + Pingtxt.replace('{{پینگ|', '').replace('}}', '').trim().replace(/\|/g, '، ')
} else {
var Pingtxt = ''
}
if (Pingtxt == '{{پینگ|}}') {
Pingtxt = ''
PingtxteditSummary = ''
}
if (archiveSectionOptions.buttonIndentSelect.findSelectedItem().getData() == 1 && (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Q' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'A' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'like' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'idea' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'suggestion' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'plus1' || archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'thankyou')) {
prefix = '\n';
}
switch (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString()) {
case 'info':
newText = Pingtxt + '';
editSummary += 'ثبت پیام' + PingtxteditSummary;
break;
case 'Opinion':
newText = prefix + Pingtxt + '{{نظر}} ';
editSummary += 'ثبت نظر' + PingtxteditSummary;
break;
case 'done':
newText = Pingtxt + '{{شد}} ';
editSummary += 'انجام شد' + PingtxteditSummary;
break;
case 'NOTdone':
newText = Pingtxt + '{{نشد}} ';
editSummary += 'انجام نشد' + PingtxteditSummary;
break;
case 'agree':
newText = prefix + Pingtxt + '{{موافق}} ';
editSummary += 'ثبت نظر موافق' + PingtxteditSummary;
break;
case 'contrary':
newText = prefix + Pingtxt + '{{مخالف}} ';
editSummary += 'ثبت نظر مخالف' + PingtxteditSummary;
break;
case 'Neutralvote':
newText = prefix + Pingtxt + '{{ممتنع}} ';
editSummary += 'ثبت نظر ممتنع' + PingtxteditSummary;
break;
case 'keep':
newText = prefix + Pingtxt + '{{بماند}} ';
editSummary += 'ثبت نظر «بماند»' + PingtxteditSummary;
break;
case 'remove':
newText = prefix + Pingtxt + '{{حذف شود}} ';
editSummary += 'ثبت نظر «حذف شود»' + PingtxteditSummary;
break;
case 'merge':
newText = prefix + Pingtxt + '{{ادغام شود}} ';
editSummary += 'ثبت نظر «ادغام شود»' + PingtxteditSummary;
break;
case 'Q':
newText = Pingtxt + '{{پرسش}} ';
editSummary += 'ثبت پرسش' + PingtxteditSummary;
break;
case 'A':
newText = Pingtxt + '{{پاسخ}} ';
editSummary += 'ثبت پاسخ' + PingtxteditSummary;
break;
case 'like':
newText = Pingtxt + '{{لایک}} ';
editSummary += 'ثبت «لایک»' + PingtxteditSummary;
break;
case 'idea':
newText = Pingtxt + '{{ایده}} ';
editSummary += 'ثبت ایده' + PingtxteditSummary;
break;
case 'suggestion':
newText = Pingtxt + '{{Suggestion}} ';
editSummary += 'ثبت پیشنهاد' + PingtxteditSummary;
break;
case 'plus1':
newText = Pingtxt + '{{+1}} ';
editSummary += 'ثبت «+1»' + PingtxteditSummary;
break;
case 'thankyou':
newText = Pingtxt + '{{سپاس-گل}} ';
editSummary += 'ثبت سپاسگزاری' + PingtxteditSummary;
break;
default:
}
newText += archiveSectionOptions.textComment.getValue();
newText += ' ~~' + '~~';
if (onlyTopSection) {
if (!current.match('^\= ')) {
var topCurrent = current.split('\n===')[0];
} else {
var topCurrent = current.split('\n==')[0]
}
}
if (archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'contrary' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'keep' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'remove' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'merge' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'agree' ||
archiveSectionOptions.Dropdown.getMenu().findSelectedItem().getData().toString() == 'Neutralvote'
) {
if (onlyTopSection) {
newText = current.replace(topCurrent, topCurrent + '\n' + newText);
} else {
newText = current + '\n' + newText;
}
} else {
if (onlyTopSection) {
var topCurrentWithIndent = archiveSectionOptions.setIndentation(topCurrent, newText, true);
newText = current.replace(topCurrent, topCurrentWithIndent)
} else {
newText = archiveSectionOptions.setIndentation(current, newText, true);
}
}
return (new mw.Api()).post({
format: 'json',
action: 'edit',
title: mw.config.get("wgPageName"),
section: sectionId,
summary: editSummary,
text: newText,
token: mw.user.tokens.get('csrfToken')
});
}
}).then(function () {
if (action == 'archive') {
mw.notify('در حال ثبت جمعبندی شما ...');
} else {
mw.notify('در حال ثبت نظر شما ...');
}
if (sectionId == 0) {
sectionId = 1;
}
if ($('.mw-headline').length) {
location.hash = $('.mw-headline')[sectionId - 1].id;
} else {
location.hash = $($('.mw-heading')[sectionId - 1]).find(':header')[0].id;
}
location.reload(true);
}, function (error) {
mw.notify('ثبت نظر یا جمعبندی ناموفق بود: ' + error, {
type: 'error'
});
});
},
currentSectionId: -1,
};
if (mw.config.get('wgNamespaceNumber') >= 0) {
$(archiveSectionOptions.install);
}
})(jQuery, mediaWiki);
// </nowiki>