\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{hammiddi} \pdfinfo{ /Title (javascript-uabt.pdf) /Creator (Cheatography) /Author (hammiddi) /Subject (javascript-UABT Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{EBCE19} \definecolor{LightBackground}{HTML}{FDFBF0} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{javascript-UABT Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{hammiddi} via \textcolor{DarkBackground}{\uline{cheatography.com/135314/cs/28037/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}hammiddi \\ \uline{cheatography.com/hammiddi} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 20th May, 2021.\\ Updated 20th May, 2021.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{x{0.89258 cm} x{2.54042 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Attributs d'évènements}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{onload}} & Après le chargement de la page \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{onclick}} & Après avoir cliqué sur l'élément (un bouton, champ input,...) \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{ondblclick}} & Après un double clic sur l'élément \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{oninput}} & Après avoir saisi une valeur dans l'élément \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{onchange}} & Après avoir changé la valeur de l'élément \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} {\bf{onselect}} & Après avoir sélectionné une partie du texte de l'élément \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{oncopy}} & Après avoir copié une partie du texte de l'élément \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} {\bf{oncut}} & Après avoir coupé une partie du texte de l'élément \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{onpaste}} & Après avoir collé un texte dans l'élément \tn % Row Count 20 (+ 2) % Row 9 \SetRowColor{white} {\bf{onreset}} & Après avoir cliqué sur le bouton reset d'un formulaire \tn % Row Count 22 (+ 2) % Row 10 \SetRowColor{LightBackground} {\bf{onsubmit}} & Après avoir cliqué sur le bouton submit d'un formulaire \tn % Row Count 25 (+ 3) % Row 11 \SetRowColor{white} {\bf{onkeyup}} & Après avoir relâché le bouton du clavier \tn % Row Count 27 (+ 2) % Row 12 \SetRowColor{LightBackground} {\bf{onkeydown}} & Après avoir cliqué sur n'importe quel bouton du clavier \tn % Row Count 30 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{0.99557 cm} x{2.43743 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Assignments}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{x = y}} & Sets x to the value of y \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{x += y}} & Same as x = x + y \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\bf{x -= y}} & Same as x = x - y \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\bf{x *= y}} & Same as x = x * y \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{x /= y}} & Same as x = x / y \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} {\bf{x \%= y}} & Same as x = x \% y \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.81949 cm} x{1.61351 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Fonctions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{typeof}} & Retourne le type d'un opérande \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{parseInt()}} & Conversions entre String et Number \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{parseFloat()}} & Conversions entre String et Float \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{isNaN(A)}} & Tester si A n'est pas un nombre \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{prompt()}} & Boite de saisie de valeur \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{confirm()}} & Boite de confirmation \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{getElementsByTagName()}} & Regarde sur DOM \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} {\bf{getElementById()}} & Regarde sur DOM \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{getElementsByClassName()}} & Regarde sur DOM \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.09856 cm} x{2.33444 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Operators}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{x + y (numeric)}} & Adds x and y together \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{x + y (string)}} & Concatinates x and y together \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{x - y}} & Subtracts y from x \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} {\bf{x * y}} & Multiplies x and y together \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} {\bf{x / y}} & Divides x by y \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} {\bf{x \% y}} & Modulus: The remainder when x is divided by y \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{x++, ++x}} & Adds one to x \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} {\bf{x-{}-, -{}-x}}* & Subtracts one from x \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{-x}} & Reverses the sign on x \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Le DOM HTML}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\{\{ac\}\}Qu'est-ce que c'est ? \newline % Row Count 1 (+ 1)  Document Object Model: Représentation du document HTML à base d'objets. \newline % Row Count 3 (+ 2)  C'est une API de programmation (c.-à-d. un ensemble de classes, de méthodes, ou d'objets prédéfinies à utiliser). \newline % Row Count 6 (+ 3)  Permet de manipuler le contenu d'un document HTML : \newline % Row Count 8 (+ 2) - Accéder aux éléments HTML (à leurs propriétés, leurs contenus,...). \newline % Row Count 10 (+ 2) - Modifier les différentes parties d'un document HTML (supprimer des éléments existants, ajouter de nouveaux éléments,...). \newline % Row Count 13 (+ 3)  L'objet prédéfini document représente tout le document HTML. \newline % Row Count 15 (+ 2)  Autres objets prédéfinis: window, event.% Row Count 16 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.23588 cm} x{2.19712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Opérations sur les tableaux et Les chaînes}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{{\bf{{\emph{* Opérations sur les tableaux }}}}*} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\bf{.push()}} & Ajouter des éléments à la fin \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{.unshift()}} & Ajouter des éléments au début \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} {\bf{..shift()}} & Supprimer le premier élément \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{.pop()}} & Supprimer le dernier élément \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} {\bf{.reverse()}} & Inverser le tableau \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} {\bf{.slice(0, 2)}} & Sélectionner une partie \tn % Row Count 12 (+ 2) % Row 7 \SetRowColor{white} {\bf{.sort()}} & Trier un tableau \tn % Row Count 13 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{{\bf{{\emph{* Les chaînes de caractères }}}}*} \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} {\bf{.length}} & Taille \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} {\bf{.charAt(0)}} & Caractère à un indice donné \tn % Row Count 17 (+ 2) % Row 11 \SetRowColor{white} {\bf{.slice(3, 9)}} & Sélectionner une partie \tn % Row Count 19 (+ 2) % Row 12 \SetRowColor{LightBackground} {\bf{.split(" ")}} & Découper une chaîne \tn % Row Count 21 (+ 2) % Row 13 \SetRowColor{white} {\bf{.toLowerCase()}} & Écriture en minuscule \tn % Row Count 23 (+ 2) % Row 14 \SetRowColor{LightBackground} {\bf{.toUpperCase()}} & Écriture en majuscule \tn % Row Count 25 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.33887 cm} x{2.09413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{DOM propriétés}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{.value}} & La valeur de l'attribut value (éléments input, progress, option) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{.textContent}} & La valeur textuelle des éléments label, p, textarea, td,... \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{.style.color}} & La couleur du texte \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} {\bf{.style.width}} & La largeur de l'élément \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{.style.height}} & La hauteur de l'élément \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} {\bf{.style.borderColor}} & La couleur de la bordure \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{.style.borderStyle}} & Le style de la bordure \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} {\bf{.style.bachgroundColor}} & La couleur du fond \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{.style.fontFamily}} & La police du texte \tn % Row Count 20 (+ 2) % Row 9 \SetRowColor{white} {\bf{.style.textAlign}} & L'alignement du texte \tn % Row Count 22 (+ 2) % Row 10 \SetRowColor{LightBackground} {\bf{.innerHTML}} & Retourne le code HTML du contenu de l'élément \tn % Row Count 25 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.75526 cm} x{2.67774 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Comparisons}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{x == y}} & Returns true if x and y are equal \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{x === y}} & Returns true if x and y are identical \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{x != y}} & Returns true if x and y are not equal \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} {\bf{x !== y}} & Returns true if x and y are not identical \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{x \textgreater{} y}} & Returns true if x is greater than y \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} {\bf{x \textgreater{}= y}} & Returns true if x is greater than or equal to y \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} {\bf{x \textless{} y}} & Returns true if x is less than y \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} {\bf{x \textless{}= y}} & Returns true if x is less than or equal to y \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} {\bf{x \&\& y}} & Returns true if both x and y are true \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} {\bf{x || y}} & Returns true if either x or y are true \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} {\bf{!x}} & Returns true if x is false \tn % Row Count 21 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}