Jump to content

Aiuto:Trovare gli script malfunzionanti

From mediawiki.org
Revision as of 14:06, 1 June 2017 by Vituzzu (talk | contribs) (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].")

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

Prova per verificare se hai problemi con gli script

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 verificare se il malfunzionamento è dovuto agli script puoi provare a disattivare tutti gli script e tutti i gadget in un colpo solo.

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

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

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.

Isolare i problemi

I seguenti link spiegano come farlo per i seguenti browser: Chrome/Chromium, Firefox, Internet Explorer, Opera e Safari.

After opening them, please append ?debug=true to the web address (URL) of the page on which you see the problem. Example: https://www.mediawiki.org/wiki/Help:Locating_broken_scripts?debug=true

If the URL already includes a ?, append &debug=true instead. Example: https://www.mediawiki.org/w/index.php?title=Help:Locating_broken_scripts&debug=true

For more technical information you can check how to Toggle debug mode (but you do not have to read that to follow the next steps.)

If there is a problem with JavaScript, an error should be printed in the 'console' of the developer tools.

Make sure that "JavaScript" or "JS" is enabled here, and potentially disable other output so the output does not get too noisy:

Example of results on a wiki, using Firefox debugging mode.

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:

Example of results on a wiki, using Firefox debugging mode.

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.

This name may just be a comment (something like // Title).

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 User:MyUserName/), 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.

Fix the problem

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 T164242 for hints and links to additional information.)

In the meantime, you can disable the scripts.

If the broken script is identified as a gadget, disable the gadget in your preferences.

If the broken script is on a .js page or yours, disable the gadget by commenting it. Add /* at the beginning of the concerned code and */ at the end.

Others ways to identify broken scripts

  1. note the gadgets and scripts you are using on your account
  2. disable all scripts and gadgets on your account
  3. re-enable one gadget
  4. clear your cache
  5. 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