שיחת מדיה ויקי:Gadget-wikibugs.js: הבדלים בין גרסאות בדף

מתוך אוצר הספרים היהודי השיתופי
קפיצה לניווט קפיצה לחיפוש
אין תקציר עריכה
אין תקציר עריכה
 
(5 גרסאות ביניים של 2 משתמשים אינן מוצגות)
שורה 1: שורה 1:
צריך להחליף את התוכן ל
צריך לעדכן את הקוד [[מיוחד:תרומות/95.86.65.31|95.86.65.31]] 16:40, 4 ביוני 2023 (IDT)
<code>
:זה כנראה לא קוד בעייתי אלא קוד של פונקציה שאינה קיימת בגרסת התוכנה שלנו. ראה [[אוצר:בקשות מהמערכת#הרחבות חסרות]]. [[משתמש:עמד|עמד]] [[שיחת משתמש:עמד|שיחה]] • ט"ו בסיוון ה'תשפ"ג • 16:46, 4 ביוני 2023 (IDT)
<nowiki>
::עכשיו ראיתי בגרסאות הקודמות מה כתבת. תוכל להסביר יותר מה הבעיות בקוד? [[משתמש:עמד|עמד]] • [[שיחת משתמש:עמד|שיחה]] • ט"ו בסיוון ה'תשפ"ג • 16:49, 4 ביוני 2023 (IDT)
/*
:::הדיווחים בויקיפדיה לא מגיעים לדף השיחה אז כנראה הסקריפט שם שונה מויקיטקסט [[מיוחד:תרומות/95.86.65.31|95.86.65.31]] 17:19, 4 ביוני 2023 (IDT)
From [[pl:MediaWiki:Gadget-wikibugs.js]]:
::::לא זכיתי להבין את דבריך. [[משתמש:עמד|עמד]] • [[שיחת משתמש:עמד|שיחה]] • ט"ז בסיוון ה'תשפ"ג • 18:28, 4 ביוני 2023 (IDT)
* @author: [[:pl:User:Dodek]] (idea and text)
* @author: [[:pl:User:Adziura]] (idea and text)
* @author: [[:pl:User:Nux]] (implementation)
* @author: [[:pl:User:Saper]] (implementation)
* @author: [[:pl:User:Beau]] (implementation)
* @author: [[:pt:User:Helder.wiki]] (implementation)
Adaptation for hewiki:
* @author: [[User:ערן]]
*/
mw.messages.set( {
'wikibugs-dialog-title': 'דיווח על טעות',
'wikibugs-open-form-button': 'דיווח לעורכים',
'wikibugs-edit-page-button': 'עריכת הדף',
'wikibugs-cancel-button': 'ביטול',
'wikibugs-submit-report-button': 'שליחה',
'wikibugs-ip-address-notice': '<b>שימו לב:</b> כתובת ה־IP שלכם תירשם בהיסטוריית העריכות של הדף.',
'wikibugs-page-name-label': 'שם הדף:',
'wikibugs-report-content-label': '<br/>פרטי הבעיה:',
'wikibugs-report-content-placeholder': 'תארו את הבעיה בבירור.',
'wikibugs-report-source-placeholder': 'אם ניתן, ציינו מקור חיצוני שתומך בדבריכם.',
'wikibugs-signature-label': 'חתימה:',
'wikibugs-edit-error': '',
'wikibugs-token-error': '',
'wikibugs-unknown-token-error': '',
'wikibugs-ajax-error': 'ארעה שגיאה בשליחת הדיווח. אנא נסו שנית.',
'wikibugs-incomplete-information': 'תארו בפירוט את הבעיה. התיאור שסיפקתם קצר מדי.',
'wikibugs-invalid-page': 'יש למלא את השם.',
'wikibugs-reported-by': ' דווח על ידי: $1',
'wikibugs-bad-reports-text': '<p>טופס זה <b>אינו מיועד</b> לבקשת ערכים או תוכן חסר. ' +
'במקרה שברצונכם לבקש הוספת תכנים פנו ל:</p><ul>' +
'<li><a href="' + mw.util.getUrl( 'אוצר:בקשת דף' ) + '">' +
'דף בקשת ערכים</a></li></ul><p>לפנייה לעורכים או בקשות אחרות פנו ל: </p>' +
'<ul><li><a href="' + mw.util.getUrl( 'אוצר:ספר אורחים' ) + '">ספר האורחים</a></li></ul>',
'wikibugs-article-intro': '<p style="margin-top:0px;">באפשרותכם לדווח כאן על טעות בערכי אוצר. ' +
'שימו לב שכל אחד יכול לערוך כמעט כל דף באוצר – אנו ממליצים שתנסו <b>לתקן את הטעות בעצמכם</b> ולציין מקור שמאשר את המידע המתוקן. ' +
'אם אתם חוששים לערוך בעצמכם, או שאינכם מסתדרים עם ממשק העריכה, ניתן גם לדווח על הטעות לעורכים.</p>',
'wikibugs-image-intro': '<p style="margin-top:0px;">באפשרותכם לדווח על קבצים מפרי זכויות יוצרים, ' +
' קבצים בגרסה טובה יותר בוויקשיתוף או על טעויות בתיאור התמונה.</p>' +
'<p><b>אנא נסו לתקן זאת בעצמכם במידת האפשר.</b></p>',
'wikibugs-already-reported-notice': '<p><b>ראו גם:</b> <ul>' +
'<li><a href="' + mw.util.getUrl( 'אוצר:דיווח על טעויות' ) + '">' +
'דף הדיווח על טעויות באוצר</a> </li>' +
'<li><a href="' + mw.util.getUrl( 'אוצר:דיווח על טעויות' ) + '?action=history">' +
'דף היסטוריית דיווחים על טעויות</a></li></ul>',
'wikibugs-footer': '',
'wikibugs-new-report': 'נושא חדש: $1',
'wikibugs-new-report-talk-title': 'דיווח על טעות',
'wikibugs-new-report-talk-content': 'נוסף דיווח על טעות בדף [[אוצר:דיווח על טעויות|כאן]]. ~~'+'~~',
'wikibugs-new-report-summary-prefix': 'דיווח על טעות',
'wikibugs-new-report-summary-suffix': 'דיווח חדש',
'wikibugs-report-source-subtitle': 'מקור'
} );
window.wikiBugsGadget = {
/**
* Version number of this gadget.
*/
version: 9,
/**
* A name of a page where reports are saved.
*/
reportPage: 'אוצר:דיווח על טעויות',
/**
* Black list of pages which reports should not refer to.
*/
badPages: [
'אוצר:דיווח על טעויות'
],
/**
* Define pages where it's not needed or tends to encourage submission of large
* volumes of unrelated errors; instead, these load CSS which hides the "Report A Bug" link
*/
excludedPages: [
'עמוד ראשי'
],
/**
* Message shown on pages in the main namespace.
*/
articleIntro: '<div id="wbBadReports">' +
mw.msg( 'wikibugs-bad-reports-text' ) + '</div>' +
mw.msg( 'wikibugs-article-intro' ) +
mw.msg( 'wikibugs-already-reported-notice' ) +
mw.msg( 'wikibugs-footer' ),
/**
* Message shown on pages in the file namespace.
*/
imageIntro: '<div id="wbBadReports">' +
mw.msg( 'wikibugs-bad-reports-text' ) + '</div>' +
mw.msg( 'wikibugs-image-intro' ) +
mw.msg( 'wikibugs-already-reported-notice' ) +
mw.msg( 'wikibugs-footer' ),
/**
* Checks if a title of the page is valid for a report.
* @param title A title of the page.
*/
isValidPageName: function( title ) {
// Empty title is not valid
if ( title === '' ) {
return false;
}
// Special pages are not valid too
if ( this.getPageNamespaceNumber( title ) === -1 ) {
return false;
}
// Check black list
title = this.getRefinedPageName( title );
return jQuery.inArray( title, this.badPages ) === -1;
},
/**
* Returns a namespace number of a specifed page.
* @param title A title of the page.
*/
getPageNamespaceNumber: function( title ) {
var matches = title.match( /^([^:]+)/ );
if ( matches ) {
var key = matches[1].toLowerCase();
var namespaces = mw.config.get( 'wgNamespaceIds' );
var result = namespaces[key];
if ( result !== null ) {
return result;
}
}
return 0;
},
/**
* Returns a refined page title.
* @param title A title of the page.
*/
getRefinedPageName: function( title ) {
return jQuery.trim( title.replace( /_/g, ' ' ) );
},
/**
* Sets up the gadget.
*/
init: function() {
var that = this;
var excluded = false;
// Special pages and MediaWiki pages are excluded
if ( jQuery.inArray( mw.config.get( 'wgNamespaceNumber' ), [-1, 8] ) > -1 ) {
excluded = true;
} else {
var name = this.getRefinedPageName( mw.config.get( 'wgPageName' ) );
excluded = jQuery.inArray( name, this.excludedPages ) !== -1;
}
// FIXME: This doesn't exists on "standard", "cologneblue" (no ids) and "nostalgia" (no sidebar)
var $articleBugLink = jQuery( '.n-bug_in_article' );
var $imageBugLink = jQuery( '#n-bad-image' );
if ( excluded ) {
// Hide the links
$articleBugLink.hide();
$imageBugLink.hide();
return;
}
$articleBugLink.find( 'a' )
.attr( 'href', '#' )
.click( function( event ) {
that.open( mw.config.get( 'wgNamespaceNumber' ) == 6? that.imageIntro: that.articleIntro );
event.preventDefault();
} );
// Link on the report-an-error page itself
jQuery( '#report-bug-link a' ).click( function( event ) {
that.open( that.articleIntro );
event.preventDefault();
} );
},
/**
* Redirects to the edit page.
*/
goToEditPage: function() {
var $editLink = jQuery( '#ca-edit' ).find( 'a' );
window.location = $editLink.attr( 'href' ) || mw.util.getUrl( this.reportPage );
},
/**
* Shows the dialog window.
* @param infoHtml The message content.
*/
open: function( infoHtml ) {
var that = this;
var can_edit = document.getElementById( 'ca-edit' ) ? true : false;
var $dialog = jQuery( '<div id="dialogContent"></div>' ).append( infoHtml );
var api = new mw.Api();
api.get({
  action: 'parse',
page: 'תבנית:הודעת עריכה/דף/' + mw.config.get('wgPageName'),
prop: 'text'
}).done( function( res ) {
if ( res && res.parse && res.parse.text ) {
$dialog.append(res.parse.text['*']);
}
});
 
if ( mw.user.isAnon() ) {
$dialog.append( '<p>' + mw.msg( 'wikibugs-ip-address-notice' ) + '</p>' );
}
var buttons = {};
buttons[mw.msg( 'wikibugs-cancel-button' )] = function() {
jQuery( this ).dialog( 'close' );
};
buttons[mw.msg( 'wikibugs-open-form-button' )] = function() {
that.openForm( this );
};
if ( can_edit ) {
buttons[mw.msg( 'wikibugs-edit-page-button' )] = function() {
that.goToEditPage();
};
}
$dialog.dialog( {
width: 700,
height: 500,
modal: true,
resizable: false,
draggable: true,
closeOnEscape: true,
dialogClass: 'reportBugDialog',
title: mw.msg( 'wikibugs-dialog-title' ),
close: function() {
jQuery( this ).dialog( 'destroy' ).remove();
},
buttons: buttons
} );
jQuery( 'div.reportBugDialog button:last' ).focus();
},
/**
* Shows the form in the dialog window.
*/
openForm: function( dialog ) {
var that = this;
jQuery( '#dialogContent' ).empty().append(
'<form name="WikibugForm" enctype="multipart/form-data">' +
'<fieldset>' +
'<label for="wbPageTitle">' + mw.msg( 'wikibugs-page-name-label' ) + '</label>' +
'<input id="wbPageTitle" type="text" name="wbPageTitle" class="text ui-widget-content ui-corner-all" />' +
'<label for="wbText">' + mw.msg( 'wikibugs-report-content-label' ) + '</label>' +
'<textarea id="wbText" name="wbText" rows="6" class="text ui-widget-content ui-corner-all">' +
mw.msg( 'wikibugs-report-content-placeholder' ) + '</textarea>' +
'<textarea id="wbTextSource" name="wbTextSource" rows="2" class="text ui-widget-content ui-corner-all">' +
mw.msg( 'wikibugs-report-source-placeholder' ) + '</textarea>' +
'<label for="wbAuthor">' + mw.msg( 'wikibugs-signature-label' ) + '</label>' +
'<input id="wbAuthor" type="text" class="text ui-widget-content ui-corner-all"/>' +
'</fieldset>' +
'<img id="wikibugs-loading-icon" src="//upload.wikimedia.org/wikipedia/commons/4/49/Linux_Ubuntu_Loader.gif" style="display:none;"/>' +
'</form>'
);
var buttons = {};
buttons[mw.msg( 'wikibugs-cancel-button' )] = function() {
jQuery( this ).dialog( 'close' );
};
buttons[mw.msg( 'wikibugs-submit-report-button' )] = function() {
that.submitForm();
};
jQuery( dialog ).dialog( 'option', 'buttons', buttons );
jQuery( '#wbText' ).focus( function() {
if ( this.value === mw.msg( 'wikibugs-report-content-placeholder' ) ) {
this.value = '';
}
} );
jQuery( '#wbTextSource' ).focus( function() {
if ( this.value === mw.msg( 'wikibugs-report-source-placeholder' ) ) {
this.value = '';
}
} );
 
if ( this.isValidPageName( mw.config.get( 'wgPageName' ) ) ) {
jQuery( '#wbPageTitle' ).val( this.getRefinedPageName( mw.config.get( 'wgPageName' ) ) );
}
if ( !mw.user.isAnon() ) {
var author = document.getElementById( 'wbAuthor' );
author.value = '~~' + '~~';
author.disabled = 'disabled';
}
},
/**
* Indicates wheter submit should be ignored.
*/
suppressSubmit: false,
/**
* Sends the contents of the form.
*/
submitForm: function() {
if ( this.suppressSubmit ) {
    return;
}
var form = document.forms.WikibugForm;
var content = form.wbText.value;
var source = form.wbTextSource.value;
if ( content === mw.msg( 'wikibugs-report-content-placeholder' ) ||
    content.length < 20 ||
    !content.match( ' ' ) ) {
// Description too short or unchanged
alert( mw.msg( 'wikibugs-incomplete-information' ) );
form.wbText.focus();
return;
}
content = jQuery.trim( content );
 
if ( ( source !== mw.msg( 'wikibugs-report-source-placeholder' ) ) && source.length ) {
content += '\n\n'+ mw.msg( 'wikibugs-report-source-subtitle' )+': ' + jQuery.trim( source ) + '\n\n'
}
// Append a signature to the report
if ( !mw.user.isAnon() ) {
content += mw.msg( 'wikibugs-reported-by', '~~' + '~~' );
} else {
content += mw.msg( 'wikibugs-reported-by', jQuery.trim(form.wbAuthor.value) + ' ~~' + '~~' );
}
var reportedPage = this.getRefinedPageName( form.wbPageTitle.value.replace( /[\[\]]/g, '' ) );
var talkPageName = mw.config.get('wgFormattedNamespaces')[1] + ':' + reportedPage
var isFile = this.getPageNamespaceNumber( reportedPage ) === 6;
if ( !this.isValidPageName( reportedPage ) ) {
alert( mw.msg( 'wikibugs-invalid-page' ) );
var refinedPageName = this.getRefinedPageName( mw.config.get( 'wgPageName' ) );
if ( this.isValidPageName( refinedPageName ) ) {
form.wbPageTitle.value = refinedPageName;
} else {
form.wbPageTitle.value = '';
form.wbPageTitle.focus();
}
return;
}
this.suppressSubmit = true;
var $loadingIcon = jQuery( '#wikibugs-loading-icon' );
$loadingIcon.show();
var section_uniq = Date.now();
var toInsertReport = '{{/מצב|חדש}}\n'+(mw.config.get('wgNamespaceNumber') == 0? '{{#lst:'+talkPageName+'|'+section_uniq+'}}' : content);
var toInsertTalk =
'<קטע התחלה="' + section_uniq + '" />'
+ '\n=== פרטי הדיווח ===\n'
+ content
+ '\n\n\n<!-- נא להוסיף דברים מעל שורה זו -->'
+ '\n<קטע סוף="' + section_uniq + '" />';
 
var reportPage = this.reportPage.replace( / /g, '_' );
 
//EDIT THE "REPORT AN ERROR" PAGE
var api=new mw.Api();
var postToReportPage = function(){
return api.postWithToken( 'edit',
{
action: 'edit',
title: reportPage,
section: 'new',
sectiontitle: '[[:'+reportedPage+']]',
text: toInsertReport,
summary: '/* ' + reportedPage + ' */ ' + mw.msg('wikibugs-new-report-summary-suffix')
}).fail(function(){
mw.notify( mw.msg( 'wikibugs-ajax-error' ) );
this.suppressSubmit = false;
$loadingIcon.hide();
}).done(function(){
window.location = mw.util.getUrl(reportPage) + '#catlinks';
});
}
if (mw.config.get('wgNamespaceNumber') == 0) {
api.postWithToken( 'edit',
{
action: 'edit',
title: talkPageName,
section: 'new',
sectiontitle: mw.msg( 'wikibugs-new-report-talk-title' ),
text: toInsertTalk,
summary: mw.msg('wikibugs-new-report-summary-prefix')
} ).then(function(data){
if( data.edit && data.edit.result === 'Success' ){
postToReportPage()
}
else {
mw.notify( mw.msg( 'wikibugs-ajax-error' ) );
}
});
} else {
postToReportPage();
}
}
};
$(function(){
$('#n-featured-articles').after('<li class="n-bug_in_article"><a href="#">דיווח על טעות</a></li>');
if(mw.user.isAnon()){
$('li#pt-createaccount').after('<li class="n-bug_in_article"><a href="#">דיווח על טעות</a></li>');
}
wikiBugsGadget.init();
});
 
</nowiki></code> כי זה בנוי על המודל של ויקיטקסט [[מיוחד:תרומות/95.86.65.31|95.86.65.31]] 16:38, 4 ביוני 2023 (IDT)

גרסה אחרונה מ־18:28, 4 ביוני 2023

צריך לעדכן את הקוד 95.86.65.31 16:40, 4 ביוני 2023 (IDT)

זה כנראה לא קוד בעייתי אלא קוד של פונקציה שאינה קיימת בגרסת התוכנה שלנו. ראה אוצר:בקשות מהמערכת#הרחבות חסרות. עמדשיחה • ט"ו בסיוון ה'תשפ"ג • 16:46, 4 ביוני 2023 (IDT)
עכשיו ראיתי בגרסאות הקודמות מה כתבת. תוכל להסביר יותר מה הבעיות בקוד? עמדשיחה • ט"ו בסיוון ה'תשפ"ג • 16:49, 4 ביוני 2023 (IDT)
הדיווחים בויקיפדיה לא מגיעים לדף השיחה אז כנראה הסקריפט שם שונה מויקיטקסט 95.86.65.31 17:19, 4 ביוני 2023 (IDT)
לא זכיתי להבין את דבריך. עמדשיחה • ט"ז בסיוון ה'תשפ"ג • 18:28, 4 ביוני 2023 (IDT)