%Listings

\usepackage{listings}

\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}

\lstdefinelanguage{JavaScript}{
  keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
  keywordstyle=\color{blue}\bfseries,
  ndkeywords={class, export, boolean, throw, implements, import, this},
  ndkeywordstyle=\color{darkgray}\bfseries,
  identifierstyle=\color{black},
  sensitive=false,
  comment=[l]{//},
  morecomment=[s]{/*}{*/},
  commentstyle=\color{purple}\ttfamily,
  stringstyle=\color{red}\ttfamily,
  morestring=[b]',
  morestring=[b]"
}


\lstset{
  basicstyle=\ttfamily,
  language=JavaScript,
  belowcaptionskip=1\baselineskip,
  basicstyle=\footnotesize\ttfamily,
  stringstyle=\color{orange},
  numbers=left,
  numberstyle=\tiny,
  xleftmargin=\parindent,
  commentstyle=\color{blue},
  keywordstyle=\color{green},
  inputencoding=utf8,
  extendedchars=true,
  breaklines=true,
  columns=fullflexible,
  showstringspaces=false,
  postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
  literate=%
   {é}{{\'{e}}}1
   {è}{{\`{e}}}1
   {ê}{{\^{e}}}1
   {ë}{{\¨{e}}}1
   {û}{{\^{u}}}1
   {ù}{{\`{u}}}1
   {â}{{\^{a}}}1
   {à}{{\`{a}}}1
   {î}{{\^{i}}}1
   {ô}{{\^{o}}}1
   {ç}{{\c{c}}}1
   {Ç}{{\c{C}}}1
   {É}{{\'{E}}}1
   {Ê}{{\^{E}}}1
   {À}{{\`{A}}}1
   {Â}{{\^{A}}}1
   {Î}{{\^{I}}}1
}