/* * Manba: http://pl.wikipedia.org/wiki/MediaWiki:Wikibugs.js, http://ru.wikipedia.org/wiki/MediaWiki:Wikibugs.js * Oʻzbekchaga moslashtirish: [[User:Xusinboy Bekchanov]], */ window.wb$bugsPage = 'Vikipediya:Xatolar haqida xabarlar'; window.wb$badPages = [ 'Vikipediya:Xatolar haqida xabarlar', 'Bosh sahifa' ]; window.wb$i18n = { ns_file: 'Fayl:', ns_special: 'Maxsus:', ns_cat: 'Turkum:', btn_fix: 'Mustaqil toʻgʻrilash', btn_report: 'Xato haqida xabar berish', btn_cancel: 'Bekor', btn_send: 'Joʻnatish', fld_page: 'Sahifa nomi:', fld_text: 'Xabar matni:', fld_text_info: 'Iltimos, xatoni iloji boricha aniqroq yozing. Daliliy xato haqida xabar berganda axborotingizni tasdiqlovchi manbani koʻrsatishni unutmang.', fld_captcha: 'Tekshirish xos raqami:', fld_sign: 'Imzo:', alert_short: 'Xato tavsifi juda qisqa. Iltimos, uni kengaytiring.', alert_nopage: 'Sahifa nomini kiriting.', alert_captcha: 'В вашем тексте содержатся внешние ссылки. Пожалуйста, введите код с изображения и отправьте сообщение ещё раз.', alert_error: 'При отправке произошла ошибка. Попробуйте ещё раз.', msg_sign: '\n\nXabar muallifi:', new_topic: 'yangi mavzu', html_ip_warn: 'Diqqat. Sizning IP-manzilingiz sahifaning oʻzgarishlar qaydnomasiga yoziladi.', html_info: '
\

Boshqa saytlardagi (masalan, „V Kontakte“ yoki „Odnoklassniki“) xatolar haqida xabar\u00A0bermang, ular eʼtiborsiz qoldiriladi.

\

Vikipediyada maqola mavjud emasligi xato emas, siz uni yaratishga soʻrov qoldirishingiz mumkin.

\

Agar siz Vikipediyada xatoni sezib qolgan boʻlsangiz, iltimos, uni mustaqil toʻgʻrilang, ushbu saytda foydalanilayotgan viki texnologiya buni qilishga imkon beradi. Xijolat boʻlmang, Vikipediya qoidalaridan biri shunday: „Bemalol tahrirlang“! Agar siz xatoni mustaqil tuzata olmasangiz, u haqda ushbu shakl yordamida xabar bering.

Agar xato allaqachon tuzatilgan boʻlsa — u haqda xabar bermang.

Oʻz telefoningiz va/yoki elektron manzilingizni qoldirmang, xabar javobi xabarlar joylashgan sahifada beriladi xolos.

\ \ ', }; function wb$link(page) { 'use strict'; return window.wgArticlePath.replace(/\$1/, page.replace(/ /g, '_')); } function wb$isValidPageName(name) { 'use strict'; if (!name || name.substr(0, name.indexOf(':') + 1) === wb$i18n.ns_special) { return false; } name = name.replace(/_/g, ' '); for (var i = 0; i < wb$badPages.length; i++) { if (name === wb$badPages[i]) { return false; } } return true; } function wb$popWikibug() { 'use strict'; // Background var nel = $('
'); nel.css({ 'background': '#000', 'filter': 'alpha(opacity=75)', 'opacity': '0.75', 'position': 'absolute', 'left': '0', 'top': '0', 'z-index': '2000', 'width': document.documentElement.scrollWidth + 'px', 'height': document.documentElement.scrollHeight + 'px' }); $('body').append(nel); // Scroll to top window.scroll(0, 150); // Info popup var can_edit = false, edit_a = $('#ca-edit a'); if (edit_a.length) { can_edit = true; } nel = $('
'); nel.css({ 'font-size': '13px', 'background': 'white', 'padding': '21px 30px', 'border': '1px solid #2f6fab', 'border-radius': '3px', 'position': 'absolute', 'min-height': '300px', 'width': '500px', 'margin-left': '-250px', 'top': '200px', 'left': '50%', 'z-index': '2002' }); var infoHTML = wb$i18n.html_info; if (!window.wgUserName) { infoHTML += '

' + wb$i18n.html_ip_warn + '

'; } infoHTML += '

\ \ ' + (can_edit ? '' : '') + '\ \

'; nel.html(infoHTML); $('body').append(nel); // Go to report form $('#wikibugs-report').on('click', function() { $('#wikibugs-info').hide(); $('#wikibugs-form').show(); }); // Go to edit page $('#wikibugs-edit').on('click', function(e) { e.preventDefault(); var edit_a = $('#ca-edit a'), edit_href = window.wgArticlePath.replace(/\$1/, wb$bugsPage); if (edit_a.length) { edit_href = edit_a.attr('href'); } window.location.assign(edit_href); }); // Popup with report form nel = $('
'); nel.css({ 'display': 'none', 'background': 'white', 'padding': '15px 20px', 'border': '1px solid #2f6fab', 'border-radius': '3px', 'position': 'absolute', 'min-height': '300px', 'width': '330px', 'margin-left': '-165px', 'top': '200px', 'left': '50%', 'z-index': '2001' }); nel.html('
\
' + wb$i18n.fld_page + '\ \
\
' + wb$i18n.fld_text + '\ \
\ \
' + wb$i18n.fld_sign + '\ \
\ \ \
'); $('body').append(nel); // Send message nel.on('submit', function(e) { e.preventDefault(); var content = $('#wikibugs-text').val(); if (content === '' || content.length < 20 || !content.match(' ')) { mw.notify(wb$i18n.alert_short); $('#wikibugs-text').focus(); return; } var page = $('#wikibugs-page').val() .replace(/^https?:\/\/ru\.wikipedia\.org\/wiki\/(.+)$/, '$1') .replace(/_/g, ' '); page = decodeURIComponent(page); var section; if (page === window.wgPageName.replace(/_/g, ' ') && wb$isValidPageName(window.wgPageName)) { if (window.wgNamespaceNumber === 6) { section = '[[:' + wb$i18n.ns_file + window.wgTitle + '|' + window.wgTitle + ']]'; content = '[[' + wb$i18n.ns_file + window.wgTitle + '|thumb|left|100px]]\n* ' + content + '\n{{clear}}'; } else { var re = new RegExp('^('+ wb$i18n.ns_cat + '|'+ wb$i18n.ns_file + '|\\/)'); section = page.replace(re, ':$1'); section = '[[' + section + ']]'; } } else { page = page .replace(/\[\[([^\[\]\|]+)\|[^\[\]\|]+\]\]/g, '$1') .replace(/[\[\]\|]/g, '') .replace(/^\s+/g, '') .replace(/\s+$/g, ''); if (!wb$isValidPageName(page)) { mw.notify(wb$i18n.alert_nopage); if (wb$isValidPageName(window.wgPageName)) { $('#wikibugs-page').val(window.wgPageName); } else { $('#wikibugs-page') .val('') .focus(); } return; } if (page.indexOf(':') > 0) { section = '[[:' + page + ']]'; } else { section = '[[' + page + ']]'; } } content += wb$i18n.msg_sign; if (!window.wgUserName) { content += ' ' + $('#wikibugs-sign').val().trim(); } content += ' ~~' + '~~'; $('#wikibugs-submit').prop('disabled', true); var data = { format: 'json', action: 'edit', title: wb$bugsPage, section: 'new', sectiontitle: section, summary: '/* ' + page + ' */ ' + wb$i18n.new_topic, text: content.trim(), token: mw.user.tokens.get('editToken') }; var captcha_id = $('#wikibugs-captcha-id').val(); if (captcha_id) { data.captchaid = captcha_id; data.captchaword = $('#wikibugs-captcha-word').val().trim(); } $.ajax({ url: '/w/api.php', type: 'POST', data: data, success: function(xhr) { // Success if (xhr && xhr.edit && xhr.edit.result === 'Success') { var url = window.wgArticlePath .replace(/\$1/, wb$bugsPage) .replace(/ /g, '_'); window.location.href = url + '#' + page; } // Captcha else if (xhr && xhr.edit && xhr.edit.captcha && xhr.edit.captcha.type === 'image') { $('#wikibugs-captcha img').attr('src', xhr.edit.captcha.url); $('#wikibugs-captcha-id').val(xhr.edit.captcha.id); $('#wikibugs-captcha-word').val(''); $('#wikibugs-captcha').show(); $('#wikibugs-submit').prop('disabled', false); mw.notify(wb$i18n.alert_captcha); } // Error else { $('#wikibugs-submit').prop('disabled', false); mw.notify(wb$i18n.alert_error); } }, error: function() { $('#wikibugs-submit').prop('disabled', false); mw.notify(wb$i18n.alert_error); } }); }); // Cancel $('.wikibugs-cancel').on('click', function(e) { e.preventDefault(); $('#wikibugs-info, #wikibugs-form, #wikibugs-globhidden').remove(); }); $('#wikibugs-page').val(window.wgPageName.replace(/_/g, ' ')); // Disable title changes for main namespace if (wb$isValidPageName(window.wgPageName) && !window.wgNamespaceNumber) { $('#wikibugs-page') .prop('disabled', true) .css('background', '#eee'); } if (window.wgUserName) { $('#wikibugs-sign') .val('~~' + '~~') .prop('disabled', true) .css('background', '#eee'); } } $(function(){ 'use strict'; $('#n-bug_in_article a').click(function(e) { e.preventDefault(); mw.loader.using('mediawiki.ui', wb$popWikibug); }); });