diff --git a/1-js/01-getting-started/index.md b/1-js/01-getting-started/index.md index ffde6849c..cc4d66be2 100644 --- a/1-js/01-getting-started/index.md +++ b/1-js/01-getting-started/index.md @@ -1,3 +1,3 @@ # Introduzione -Riguardo il linguaggio JavaScript e l'ambiente di sviluppo. +Studieremo il linguaggio JavaScript e l'ambiente di sviluppo. diff --git a/1-js/02-first-steps/index.md b/1-js/02-first-steps/index.md index c5569cdd6..ee7725e51 100644 --- a/1-js/02-first-steps/index.md +++ b/1-js/02-first-steps/index.md @@ -1,3 +1,3 @@ # Le basi JavaScript -Impariamo le basi della scrittura di uno script. \ No newline at end of file +Impareremo le basi dello sviluppo di uno script. \ No newline at end of file diff --git a/1-js/03-code-quality/index.md b/1-js/03-code-quality/index.md index 0dda8220f..8a61d522f 100644 --- a/1-js/03-code-quality/index.md +++ b/1-js/03-code-quality/index.md @@ -1,3 +1,3 @@ # Qualità del codice -Questo capitolo spiega le buone pratiche di programmazione da utilizzare durante lo sviluppo. +Impareremo le buone pratiche di programmazione da utilizzare durante lo sviluppo. diff --git a/1-js/07-object-properties/index.md b/1-js/07-object-properties/index.md index 38784dd6b..0029cbeb4 100644 --- a/1-js/07-object-properties/index.md +++ b/1-js/07-object-properties/index.md @@ -1,3 +1,3 @@ # Configurazione delle proprietà dell'oggetto -In questa sezione torniamo a vedere gli oggetti e studiremo le loro proprietà più nel dettaglio. +Procederemo con lo studio degli oggetti e studieremo le loro proprietà più nel dettaglio. diff --git a/1-js/index.md b/1-js/index.md index a97e3a981..3ef150d82 100644 --- a/1-js/index.md +++ b/1-js/index.md @@ -1,5 +1,6 @@ # Il linguaggio JavaScript -Qui impareremo JavaScript, iniziando dalle basi e passando per i concetti avanzati come OOP. + +Impareremo JavaScript, iniziando dalle basi e passando a concetti avanzati come OOP. Ci concentreremo principalmente sul linguaggio, con un minimo di annotazioni riguardo gli ambienti di sviluppo. diff --git a/2-ui/1-document/08-styles-and-classes/2-create-notification/solution.view/index.html b/2-ui/1-document/08-styles-and-classes/2-create-notification/solution.view/index.html index dc4eeec9f..8ef5d48f5 100755 --- a/2-ui/1-document/08-styles-and-classes/2-create-notification/solution.view/index.html +++ b/2-ui/1-document/08-styles-and-classes/2-create-notification/solution.view/index.html @@ -32,7 +32,7 @@

Notification is on the right

setTimeout(() => notification.remove(), 1500); } - // test it + // prova let i = 1; setInterval(() => { showNotification({ diff --git a/2-ui/1-document/08-styles-and-classes/2-create-notification/source.view/index.html b/2-ui/1-document/08-styles-and-classes/2-create-notification/source.view/index.html index b5e2f83f7..c92597797 100755 --- a/2-ui/1-document/08-styles-and-classes/2-create-notification/source.view/index.html +++ b/2-ui/1-document/08-styles-and-classes/2-create-notification/source.view/index.html @@ -16,10 +16,10 @@

Notification is on the right

``` -## Element style +## La proprietà style di un elemento -The property `elem.style` is an object that corresponds to what's written in the `"style"` attribute. Setting `elem.style.width="100px"` works the same as if we had in the attribute `style` a string `width:100px`. +La proprietà `elem.style` è un oggetto corrispondente a ciò che è scritto dentro l'attributo `"style"`. Impostando `elem.style.width="100px"` otteniamo lo stesso effetto che otterremmo scrivendo `width:100px` dentro l'attributo `style`. -For multi-word property the camelCase is used: +Per le proprietà composte da più di una parola, si usa l'iniziale maiuscola dalla seconda parola in poi (camel case): ```js no-beautify background-color => elem.style.backgroundColor @@ -94,16 +94,16 @@ z-index => elem.style.zIndex border-left-width => elem.style.borderLeftWidth ``` -For instance: +Per esempio: ```js run document.body.style.backgroundColor = prompt('background color?', 'green'); ``` -````smart header="Prefixed properties" -Browser-prefixed properties like `-moz-border-radius`, `-webkit-border-radius` also follow the same rule: a dash means upper case. +````smart header="Proprietà con prefisso" +Le proprietà con il prefisso del browser come `-moz-border-radius`, `-webkit-border-radius` seguono anch'esse la stessa regola: un trattino comporta l'uso del maiuscolo. -For instance: +Per esempio: ```js button.style.MozBorderRadius = '5px'; @@ -111,33 +111,34 @@ button.style.WebkitBorderRadius = '5px'; ``` ```` -## Resetting the style property +## Resettare la proprietà style -Sometimes we want to assign a style property, and later remove it. +Talvolta vogliamo assegnare uno stile e successivamente rimuoverlo. -For instance, to hide an element, we can set `elem.style.display = "none"`. +Per esempio, per nascondere un elemento, possiamo impostare `elem.style.display = "none"`. + +Successivamente potremmo voler rimuovere `style.display` come se non fosse impostato. Invece di `delete elem.style.display` dovremmo assegnargli una stringa vuota: `elem.style.display = ""`. -Then later we may want to remove the `style.display` as if it were not set. Instead of `delete elem.style.display` we should assign an empty string to it: `elem.style.display = ""`. ```js run -// if we run this code, the will blink +// se eseguiamo questo codice, il lampeggerà document.body.style.display = "none"; // hide -setTimeout(() => document.body.style.display = "", 1000); // back to normal +setTimeout(() => document.body.style.display = "", 1000); // ritorna alla normalità ``` -If we set `style.display` to an empty string, then the browser applies CSS classes and its built-in styles normally, as if there were no such `style.display` property at all. +Se assegniamo una stringa vuota a `style.display`, il browser applica come di consueto le classi CSS ed i suoi stili predefiniti, come se non ci fosse alcuna proprietà `style.display`. -````smart header="Full rewrite with `style.cssText`" -Normally, we use `style.*` to assign individual style properties. We can't set the full style like `div.style="color: red; width: 100px"`, because `div.style` is an object, and it's read-only. +````smart header="Riscrittura completa con `style.cssText`" +Di solito usiamo `style.*` per assegnare le proprietà di stile individualmente. Non possiamo impostare tutti gli stili in questo modo `div.style="color: red; width: 100px"`, perché `div.style` è un oggetto ed è in sola lettura. -To set the full style as a string, there's a special property `style.cssText`: +Per impostare tutti gli stili come stringa c'è una speciale proprietà `style.cssText`: ```html run
Button
``` -This property is rarely used, because such assignment removes all existing styles: it does not add, but replaces them. May occasionally delete something needed. But we can safely use it for new elements, when we know we won't delete an existing style. +Questa proprietà è usata di rado, poiché un tale assegnamento rimuove tutti gli stili esistenti: non li aggiunge, piuttosto li sostituisce. Potrebbe eliminare in modo fortuito qualcosa di necessario. Possiamo tuttavia usarla in sicurezza per i nuovi elementi, quando siamo certi che non cancelleremo uno stile preesistente. -The same can be accomplished by setting an attribute: `div.setAttribute('style', 'color: red...')`. +Lo stesso risultato può essere ottenuto impostando un attributo: `div.setAttribute('style', 'color: red...')`. ```` -## Mind the units +## Prestate attenzione alle unità di misura -Don't forget to add CSS units to values. +Non dimenticate di aggiungere le unità di misura CSS ai valori. -For instance, we should not set `elem.style.top` to `10`, but rather to `10px`. Otherwise it wouldn't work: +Ad esempio, non dovremmo impostare `elem.style.top` a `10`, piuttosto a `10px`. Altrimenti non funzionerebbe: ```html run height=100 ``` -...But what if we need, say, to increase the margin by `20px`? We would want the current value of it. +...ma cosa dovremmo fare se avessimo bisogno, per dire, di incrementare il margine di `20px`? Dovremmo prima conoscerne il valore corrente. -There's another method for that: `getComputedStyle`. +C'è un altro metodo per quello: `getComputedStyle`. -The syntax is: +La sintassi è: ```js getComputedStyle(element, [pseudo]) ``` element -: Element to read the value for. +: L'elemento di cui leggere il valore. pseudo -: A pseudo-element if required, for instance `::before`. An empty string or no argument means the element itself. +: Uno pseudo-elemento se richiesto, per esempio `::before`. Una stringa vuota o nessun argomento significa l'elemento stesso. -The result is an object with styles, like `elem.style`, but now with respect to all CSS classes. +Il risultato è un oggetto con gli stili, come `elem.style`, ma, a differenza di quello, tiene conto di tutte le classi CSS. -For instance: +Per esempio: ```html run height=100 @@ -237,7 +238,7 @@ For instance: ``` ```` -```smart header="Styles applied to `:visited` links are hidden!" -Visited links may be colored using `:visited` CSS pseudoclass. +```smart header="Gli stili applicati ai link `:visited` sono nascosti!" +I link visitati possono ricevere un colore tramite la pseudoclasse CSS `:visited`. -But `getComputedStyle` does not give access to that color, because otherwise an arbitrary page could find out whether the user visited a link by creating it on the page and checking the styles. +Tuttavia `getComputedStyle non dà accesso a quel colore, poiché diversamente una pagina arbitraria potrebbe scoprire se l'utente ha visitato un link creandolo sulla pagina e verificandone gli stili. -JavaScript may not see the styles applied by `:visited`. And also, there's a limitation in CSS that forbids applying geometry-changing styles in `:visited`. That's to guarantee that there's no side way for an evil page to test if a link was visited and hence to break the privacy. +JavaScript potrebbe non rilevare gli stili applicati da `:visited`. C'è una limitazione nei CSS, inoltre, che vieta su `:visited` l'applicazione di stili che modifichino le proprietà geometriche. Questo per garantire che, per una pagina malevola, non ci sia una via traversa di testare se un link è stato visitato e quindi di violare la privacy. ``` -## Summary +## Riepilogo -To manage classes, there are two DOM properties: +Per gestire le classi ci sono due proprietà DOM: -- `className` -- the string value, good to manage the whole set of classes. -- `classList` -- the object with methods `add/remove/toggle/contains`, good for individual classes. +- `className` -- il valore stringa, ottimo per gestire l'intero insieme delle classi. +- `classList` -- il valore oggetto con i metodi `add/remove/toggle/contains`, ottimo per gestire le classi individualmente. -To change the styles: +Per modificare gli stili: -- The `style` property is an object with camelCased styles. Reading and writing to it has the same meaning as modifying individual properties in the `"style"` attribute. To see how to apply `important` and other rare stuff -- there's a list of methods at [MDN](mdn:api/CSSStyleDeclaration). +- La proprietà `style` è un oggetto contenente gli stili CSS, le proprietà composte da più di una parola sono trascritte in camel case. Leggere e scrivere con questa proprietà equivale a modificare individualmente gli stili con l'attributo `"style"`. Per vedere come applicare `important` e per altre esigenze poco comuni -- c'è una lista di metodi su [MDN](mdn:api/CSSStyleDeclaration). -- The `style.cssText` property corresponds to the whole `"style"` attribute, the full string of styles. +- La proprietà `style.cssText` corrisponde al contenuto completo dell'attributo `"style"`, l'intera stringa degli stili. -To read the resolved styles (with respect to all classes, after all CSS is applied and final values are calculated): +Per leggere gli stili resolved (che tengono conto di tutte le classi, dopo che tutti i CSS sono stati applicati e sono stati calcolati i valori risultanti): -- The `getComputedStyle(elem, [pseudo])` returns the style-like object with them. Read-only. +- Il metodo `getComputedStyle(elem, [pseudo])` restituisce un oggetto simile a `style` con tali valori. Questi sono in sola lettura. diff --git a/2-ui/1-document/index.md b/2-ui/1-document/index.md index 1b60cdf2c..766141ea4 100644 --- a/2-ui/1-document/index.md +++ b/2-ui/1-document/index.md @@ -1,3 +1,3 @@ # Document -Here we'll learn to manipulate a web-page using JavaScript. +Impareremo come manipolare una pagina web usando JavaScript. diff --git a/2-ui/2-events/index.md b/2-ui/2-events/index.md index f4996083c..b996f643c 100644 --- a/2-ui/2-events/index.md +++ b/2-ui/2-events/index.md @@ -1,3 +1,3 @@ -# Introduction to Events +# Introduzione agli Eventi -An introduction to browser events, event properties and handling patterns. +Introdurremo gli eventi browser, le loro proprietà e i pattern per la loro gestione. diff --git a/2-ui/3-event-details/index.md b/2-ui/3-event-details/index.md index 569f08137..00082a4f1 100644 --- a/2-ui/3-event-details/index.md +++ b/2-ui/3-event-details/index.md @@ -1,3 +1,3 @@ -# UI Events +# Eventi UI -Here we cover most important user interface events and how to work with them. +Studieremo i principali eventi per interfacce utente e come gestrili. diff --git a/2-ui/4-forms-controls/index.md b/2-ui/4-forms-controls/index.md index 726474b19..f71568059 100644 --- a/2-ui/4-forms-controls/index.md +++ b/2-ui/4-forms-controls/index.md @@ -1,3 +1,3 @@ # Forms, controls -Special properties and events for forms `
` and controls: ``, ``, `