Jump to content

Help:Locating broken scripts/it: Difference between revisions

From mediawiki.org
Content deleted Content added
Created page with "I seguenti link spiegano come farlo per i seguenti browser: [$chrome Chrome/Chromium], [$firefox Firefox], [$IE Internet Explorer], [$opera Opera] e [$safari Safari]."
FuzzyBot (talk | contribs)
Updating to match new version of source page
 
(91 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages />
<languages />
Se hai problemi con gadget o script utenti tali problemi sono spesso dovuti a codice [[JavaScript]] (il linguaggio di programmazione da essi usato) con errori o a dipendenze non dichiarate da altri elementi di codice.


Per individuare il codice problematico e ciò che necessita di essere corretto è necessario che tu utilizzi lo strumento da sviluppatore incluso nel tuo browser web.
Se hai problemi con gadget o script utenti tali problemi sono spesso dovuti a codice [[JavaScript]] (il linguaggio di programmazione da essi usato) con errori o a dipendenze non dichiarate da altri elementi di codice.
Questo strumento, combinato con un apposito URL ti aiuterà a isolare gli script malfunzionanti.

Per individuare il codice problematico e ciò che necessita di essere corretto è necessario che tu utilizzi lo strumento da sviluppatore incluso nel tuo browser web. Questo strumento, combinato con un apposito URL ti aiuterà a isolare gli script malfunzionanti.


<span id="How-to"></span>
== Come fare ==
== Come fare ==


<span id="Be_sure_you_have_an_up-to-date_configuration"></span>
=== Prova per verificare se hai problemi con gli script ===
=== Essere sicuri di avere una configurazione aggiornata ===


Per prima cosa assicurati di aver aggiornato il tuo browser. Alcune funzionalità di MediaWiki e alcuni script non sono supportati dai vecchi browser per ragioni di sicurezza.
Per prima cosa assicurati di avere un browser aggiornato. Alcune funzionalità di MediaWiki e alcuni script non sono supportati dai vecchi browser per ragioni di sicurezza.


Successivamente, [[Special:MyLanguage/Manual:Purge|svuota/purga la cache della pagina]] per forzare le pagine ad essere ricaricate a partire dal loro codice o per far ripartire gli script.
Per verificare se il malfunzionamento è dovuto agli script puoi provare a disattivare tutti gli script e tutti i gadget in un colpo solo.


Questi due punti risolvono la maggior parte dei problemi.
Per farlo, aggiungi <code>?safemode=1</code> all'indirizzo (URL) della pagina sulla quale noti il malfunzionamento: Per sempio: <code><nowiki>https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?safemode=1</nowiki></code>


Se hai uno strumento come "NoScript" o blocchi per le pubblicità installati sul tuo browser web, assicurati che gli script siano abilitati per wikipedia.org, wikimedia.org, mediawiki.org e wikidata.org.
Se l'URL contiene già un $QMark, aggiungi invece <code>&safemode=1</code>. Esempio: <code><nowiki>https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&safemode=1</nowiki></code>


<span id="Test_if_you_have_problems_related_to_user_scripts_or_gadgets"></span>
Se hai ancora problemi su quella pagina che stai testando in modalità safe (senza gadget e script), contatta cortesemente uno sviluppatore di MediaWiki. Se non noti più alcun problema in modalità safe significa che hai un problema di script che dovresti isolare.
=== Verificare se hai problemi legati agli script o agli accessori ===


<div class="mw-translate-fuzzy">
=== Isolare i problemi ===
Per verificare se il malfunzionamento è dovuto agli script o agli accessori, puoi provare a disattivare temporaneamente tutti gli accessori e gli script del wiki.
</div>


<span class="mw-translate-fuzzy">Per farlo, aggiungi <code>?safemode=1</code> all'indirizzo (URL) della pagina sulla quale noti il malfunzionamento: Per sempio: $example</span>
I seguenti link spiegano come farlo per i seguenti browser: [https://developer.chrome.com/devtools Chrome/Chromium], [https://developer.mozilla.org/en-US/docs/Tools/Web_Console Firefox], [http://msdn.microsoft.com/en-us/library/ie/dn255006 Internet Explorer], [http://help.opera.com/Linux/12.10/en/errorconsole.html Opera] e [https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/Introduction/Introduction.html Safari].
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span>
<code><nowiki>https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?safemode=1</nowiki></code>


<span class="mw-translate-fuzzy">Se l'URL contiene già un $QMark, aggiungi invece <code>&safemode=1</code>. Esempio: $example</span>
After opening them, please append <code>?debug=true</code> to the web address (URL) of the page on which you see the problem. Example: <code><nowiki>https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?debug=true</nowiki></code>
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span>
<code><nowiki>https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&safemode=1</nowiki></code>


<span class="mw-translate-fuzzy">Se hai ancora problemi sulla pagina che stai testando in modalità ''safe'', e il tuo browser è aggiornato, contatta cortesemente uno sviluppatore di MediaWiki ([[$Report|come segnalare un problema]]).</span>
If the URL already includes a <code>?</code>, append <code>&debug=true</code> instead. Example: <code><nowiki>https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&debug=true</nowiki></code>
Se non noti più alcun problema in modalità ''safe'', significa che hai un problema con uno script o un accessorio.
Devi identificare il problema.


<div lang="en" dir="ltr" class="mw-content-ltr">
For more technical information you can check [[ResourceLoader/Developing_with_ResourceLoader#Toggle_debug_mode|how to Toggle debug mode]] (but you do not have to read that to follow the next steps.)
=== Test if you have problems related to browser extensions ===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">Some issues may be a result of interaction between Wikipedia and some browser extension.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The easiest way to test it, is to try the same action with all extensions disabled, and the easiest way to achieve this, at least with the Google Chrome and Firefox browsers, is to repeat the operation using "anonymous browsing" or "guest mode", where the browser disables all extensions by default.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">If the issue disappears with anonymous browsing, try to narrow it down by temporarily disabling extensions one by one, until the "culprit" extension is found.</span>


<span lang="en" dir="ltr" class="mw-content-ltr">If you find that the problem is indeed related to a browser extension, consider reporting it to the extension developers.</span>
If there is a problem with JavaScript, an error should be printed in the 'console' of the developer tools.
<span lang="en" dir="ltr" class="mw-content-ltr">If you decide to report it on a discussion forum on Wikimedia wikis, please mention your browser extension in your report.</span>


<span id="Identify_the_problems"></span>
Make sure that "JavaScript" or "JS" is enabled here, and potentially disable other output so the output does not get too noisy:
=== Identificare i problemi ===

I seguenti link spiegano come farlo per i seguenti browser:

* [https://developers.google.com/web/tools/chrome-devtools Chrome/Chromium]
* [[devmo:Tools/Web Console|Firefox]]
* [https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/console/ Microsoft Edge]
* [https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/samples/dn255006(v=vs.85) Internet Explorer]
* [https://help.opera.com/latest/advanced/#developerTools Opera]
* [https://support.apple.com/guide/safari-developer/ Safari]

<span class="mw-translate-fuzzy">Dopo averli aperti aggiungi <code>?debug=true</code> all'indirizzo web (URL) della pagina nella quale noti il problema. Esempio: $example</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span>
<code><nowiki>https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?debug=true</nowiki></code>

<span class="mw-translate-fuzzy">Se l'URL contiene già un $QMark, aggiungi invece <code>&debug=true</code>. Esempio: $example</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Example:</span>
<code><nowiki>https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&debug=true</nowiki></code>

Se c'è un problema con JavaScript la 'console' dello strumento di sviluppo riporterà un errore.

Assicurati che "JavaScript" o "JS" sia selezionato e magari disattiva le altre spunte per evitare che il risultato sia troppo prolisso.
{{clr}}
{{clr}}
[[File:Use of the console to identify broken scripts - Result 01.png|thumb|center|600px|Example of results on a wiki, using Firefox debugging mode.]]
[[File:Use of the console to identify broken scripts - Result 01.png|thumb|center|600px|Esempio di ciò che si ottiene su una wiki, usando Firefox in modalità debug.]]
{{clr}}
{{clr}}
<span class="mw-translate-fuzzy">Clicca sul nome del file sulla destra. Questo aprirà la modalità "Debugger". Sul pannello di destra vedrai il codice che necessita una correzione. Il pannello di sinistra mostrerà quali file devono essere corretti (potresti aver bisogno di scorrere la lista per trovare il file evidenziato). Clicca con il tasto destro sul file che ha bisogno di essere corretto per vederlo in una nuova scheda:</span>
Click on the file name on the right. This will open the "Debugger" view. The right pane will show the code which needs to be fixed. The left pane will show which file needs to be fixed (you might need to scroll through the list to find the one file that is highlighted). Right-click on the file, to open the file that needs fixing in a new tab:
<span lang="en" dir="ltr" class="mw-content-ltr">This will open the "Debugger" view.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The right pane will show the code which needs to be fixed.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The left pane will show which file needs to be fixed (you might need to scroll through the list to find the one file that is highlighted).</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Right-click on the file, to open the file that needs fixing in a new tab:</span>

{{clr}}
{{clr}}
[[File:Use of the console to identify broken scripts - Identify.png|thumb|center|600px|Example of results on a wiki, using Firefox debugging mode.]]
[[File:Use of the console to identify broken scripts - Identify.png|thumb|center|600px|Esempio di un risultato su una wiki, utilizzando la modalità di debugging in Firefox.]]
{{clr}}
{{clr}}


Due to how files are "loaded", the exact URL of the file might not always be obvious. So you may have to scroll to the top of the file to see its name.
A causa di come i file sono "caricati", l'esatto URL del file potrebbe non essere ovvio. Potresti aver bisogno di scorrere in cima al file per vedere il suo nome.

Questo nome potrebbe essere semplicemente un commento (qualcosa come <code>// Title</code>).

I problemi da correggere potrebbero essere essere all'interno del file <code>MediaWiki:Common.js</code> su tale wiki, nei tuoi file personali come <code>User:MyUserName/common.js</code> (o altri file .js che hai nelle tue <code>User:MyUserName/</code>), o nel codice di uno dei gadget disponibili in tale wiki, o nel codice dipeso dalle definizioni dei gadget definiti in <code>MediaWiki:Gadgets-definition</code> su tale wiki.

Per avere informazioni di carattere tecnico puoi consultare [[ResourceLoader/Developing_with_ResourceLoader#Toggle_debug_mode|come attivare la modalità di debug]].

<span id="Fix_the_problem"></span>
== Correggere il problema ==

Troverai la maggior parte degli script guardando il file <code>[[:m:Special:MyPage/global.js]]</code> su Meta, e localmente <code>Special:MyPage/common.js</code>, <code>Special:MyPage/vector.js</code> (o nomi di pagine similari, se stai usando una skin differente, come <code>Special:MyPage/monobook.js</code> se stai usando il tema MonoBook), e qualsiasi cosa che sia selezionata localmente nei <code>Special:Preferences#mw-prefsection-gadgets</code>.

I problemi legati agli script possono avere cause molteplici. Vi suggeriamo di contattare qualcuno che conosca JavaScript per ricevere aiuto. (Se hai conoscenze tecniche basilari di JavaScript, vedi [[phab:T164242|T164242]] per suggerimenti e link ad informazioni aggiuntive.)


Nel frattempo, puoi disabilitare gli script.
This name may just be a comment (something like <code>// Title</code>).


Se lo script problematico è identificato all'interno di un gadget, disabilita il gadget dalle tue preferenze.
Problems that need fixing could be in the local MediaWiki:Common.js file on that wiki, in your personal files such as User:MyUserName/common.js (or other .js files that you have under <code>User:MyUserName/</code>), or in the code of one of the gadgets available on that wiki, or in the code dependency definitions of the gadget defined in MediaWiki:Gadgets-definition on that wiki.


Se lo script problematico è in una pagina .js o in una tua pagina,disabilita lo script commentandolo. Aggiungi <code>/* </code> all'inizio della riga interessata e <code>*/</code> alla fine.
== Fix the problem ==


<div class="mw-translate-fuzzy">
Problem on scripts can be due to multiple causes. We advise you to contact someone who knows JavaScript to help you. (If you have basic technical knowledge of JavaScript, see [[phab:T164242|T164242]] for hints and links to additional information.)
Puoi anche disabilitare gli scritpt svuotando tutte le righe interessate nella tua pagina .js.
</div>


<span id="Other_ways_to_identify_broken_scripts"></span>
In the meantime, you can disable the scripts.
== Altri modi per identificare script con errori ==
# prendi nota dei gadget e degli script che stai utilizzando nel tuo account
# disabilita tutti gli script ed i gadget sul tuo account
# ri-abilita un gadget
# pulisci la tua cache
# controlla se hai ancora problemi:
#* Se la risposta è no, vai al passo 3
#* Se la risposta è sì, vai al passo 3 per cercare eventuali altri script rotti


<span lang="en" dir="ltr" class="mw-content-ltr">Totally unrelated gadgets can break the strangest things.</span>
If the broken script is identified as a gadget, disable the gadget in your preferences.
<span lang="en" dir="ltr" class="mw-content-ltr">To narrow it down turn off all the gadgets in a particular section of the gadgets list in preferences, and see if that helps.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Then if that doesn't work try turning off another section of gadgets.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Eventually you will find the section of gadgets where the problem lies.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Then turn off the gadgets in that section one by one.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Before doing any of this take a screenshot of the whole gadget preferences page.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">This way you can get back to what you like.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Firefox has a built-in screenshot tool that lets you get the whole page including the part of the page not showing on the screen.</span>


<span id="See_also"></span>
If the broken script is on a .js page or yours, disable the gadget by commenting it. Add <code>/* </code> at the beginning of the concerned code and <code>*/</code> at the end.
== Pagine correlate ==
* {{ll|ResourceLoader/Architecture#Disable on a single page|2=ResourceLoader/Architecture#Disable on a single page}}
* [[wikitech:Client errors]] – <span lang="en" dir="ltr" class="mw-content-ltr">Wikimedia infrastructure for logging JavaScript errors</span>


[[Category:JavaScript{{#translation:}}]]
== Others ways to identify broken scripts ==
# note the gadgets and scripts you are using on your account
# disable all scripts and gadgets on your account
# re-enable one gadget
# clear your cache
# test if you still have problems:
#* If not, go to step 3
#* If yes, fix the script and go back to step 3 for other potentially broken scripts

Latest revision as of 07:27, 1 July 2023

Se hai problemi con gadget o script utenti tali problemi sono spesso dovuti a codice JavaScript (il linguaggio di programmazione da essi usato) con errori o a dipendenze non dichiarate da altri elementi di codice.

Per individuare il codice problematico e ciò che necessita di essere corretto è necessario che tu utilizzi lo strumento da sviluppatore incluso nel tuo browser web. Questo strumento, combinato con un apposito URL ti aiuterà a isolare gli script malfunzionanti.

Come fare

Essere sicuri di avere una configurazione aggiornata

Per prima cosa assicurati di avere un browser aggiornato. Alcune funzionalità di MediaWiki e alcuni script non sono supportati dai vecchi browser per ragioni di sicurezza.

Successivamente, svuota/purga la cache della pagina per forzare le pagine ad essere ricaricate a partire dal loro codice o per far ripartire gli script.

Questi due punti risolvono la maggior parte dei problemi.

Se hai uno strumento come "NoScript" o blocchi per le pubblicità installati sul tuo browser web, assicurati che gli script siano abilitati per wikipedia.org, wikimedia.org, mediawiki.org e wikidata.org.

Verificare se hai problemi legati agli script o agli accessori

Per verificare se il malfunzionamento è dovuto agli script o agli accessori, puoi provare a disattivare temporaneamente tutti gli accessori e gli script del wiki.

Per farlo, aggiungi ?safemode=1 all'indirizzo (URL) della pagina sulla quale noti il malfunzionamento: Per sempio: $example Example: https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?safemode=1

Se l'URL contiene già un $QMark, aggiungi invece &safemode=1. Esempio: $example Example: https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&safemode=1

Se hai ancora problemi sulla pagina che stai testando in modalità safe, e il tuo browser è aggiornato, contatta cortesemente uno sviluppatore di MediaWiki (come segnalare un problema). Se non noti più alcun problema in modalità safe, significa che hai un problema con uno script o un accessorio. Devi identificare il problema.

Some issues may be a result of interaction between Wikipedia and some browser extension. The easiest way to test it, is to try the same action with all extensions disabled, and the easiest way to achieve this, at least with the Google Chrome and Firefox browsers, is to repeat the operation using "anonymous browsing" or "guest mode", where the browser disables all extensions by default. If the issue disappears with anonymous browsing, try to narrow it down by temporarily disabling extensions one by one, until the "culprit" extension is found.

If you find that the problem is indeed related to a browser extension, consider reporting it to the extension developers. If you decide to report it on a discussion forum on Wikimedia wikis, please mention your browser extension in your report.

Identificare i problemi

I seguenti link spiegano come farlo per i seguenti browser:

Dopo averli aperti aggiungi ?debug=true all'indirizzo web (URL) della pagina nella quale noti il problema. Esempio: $example Example: https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?debug=true

Se l'URL contiene già un $QMark, aggiungi invece &debug=true. Esempio: $example Example: https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&debug=true

Se c'è un problema con JavaScript la 'console' dello strumento di sviluppo riporterà un errore.

Assicurati che "JavaScript" o "JS" sia selezionato e magari disattiva le altre spunte per evitare che il risultato sia troppo prolisso.

Esempio di ciò che si ottiene su una wiki, usando Firefox in modalità debug.

Clicca sul nome del file sulla destra. Questo aprirà la modalità "Debugger". Sul pannello di destra vedrai il codice che necessita una correzione. Il pannello di sinistra mostrerà quali file devono essere corretti (potresti aver bisogno di scorrere la lista per trovare il file evidenziato). Clicca con il tasto destro sul file che ha bisogno di essere corretto per vederlo in una nuova scheda: This will open the "Debugger" view. The right pane will show the code which needs to be fixed. The left pane will show which file needs to be fixed (you might need to scroll through the list to find the one file that is highlighted). Right-click on the file, to open the file that needs fixing in a new tab:

Esempio di un risultato su una wiki, utilizzando la modalità di debugging in Firefox.

A causa di come i file sono "caricati", l'esatto URL del file potrebbe non essere ovvio. Potresti aver bisogno di scorrere in cima al file per vedere il suo nome.

Questo nome potrebbe essere semplicemente un commento (qualcosa come // Title).

I problemi da correggere potrebbero essere essere all'interno del file MediaWiki:Common.js su tale wiki, nei tuoi file personali come User:MyUserName/common.js (o altri file .js che hai nelle tue User:MyUserName/), o nel codice di uno dei gadget disponibili in tale wiki, o nel codice dipeso dalle definizioni dei gadget definiti in MediaWiki:Gadgets-definition su tale wiki.

Per avere informazioni di carattere tecnico puoi consultare come attivare la modalità di debug.

Correggere il problema

Troverai la maggior parte degli script guardando il file m:Special:MyPage/global.js su Meta, e localmente Special:MyPage/common.js, Special:MyPage/vector.js (o nomi di pagine similari, se stai usando una skin differente, come Special:MyPage/monobook.js se stai usando il tema MonoBook), e qualsiasi cosa che sia selezionata localmente nei Special:Preferences#mw-prefsection-gadgets.

I problemi legati agli script possono avere cause molteplici. Vi suggeriamo di contattare qualcuno che conosca JavaScript per ricevere aiuto. (Se hai conoscenze tecniche basilari di JavaScript, vedi T164242 per suggerimenti e link ad informazioni aggiuntive.)

Nel frattempo, puoi disabilitare gli script.

Se lo script problematico è identificato all'interno di un gadget, disabilita il gadget dalle tue preferenze.

Se lo script problematico è in una pagina .js o in una tua pagina,disabilita lo script commentandolo. Aggiungi /* all'inizio della riga interessata e */ alla fine.

Puoi anche disabilitare gli scritpt svuotando tutte le righe interessate nella tua pagina .js.

Altri modi per identificare script con errori

  1. prendi nota dei gadget e degli script che stai utilizzando nel tuo account
  2. disabilita tutti gli script ed i gadget sul tuo account
  3. ri-abilita un gadget
  4. pulisci la tua cache
  5. controlla se hai ancora problemi:
    • Se la risposta è no, vai al passo 3
    • Se la risposta è sì, vai al passo 3 per cercare eventuali altri script rotti

Totally unrelated gadgets can break the strangest things. To narrow it down turn off all the gadgets in a particular section of the gadgets list in preferences, and see if that helps. Then if that doesn't work try turning off another section of gadgets. Eventually you will find the section of gadgets where the problem lies. Then turn off the gadgets in that section one by one. Before doing any of this take a screenshot of the whole gadget preferences page. This way you can get back to what you like. Firefox has a built-in screenshot tool that lets you get the whole page including the part of the page not showing on the screen.

Pagine correlate