Commit f2aa222078b4b39614aa63aad37dc7c18108af30

Authored by Rémi Emonet
1 parent 666c0d4535
Exists in master

index

Showing 2 changed files with 33 additions and 8 deletions

extensions/tools.js View file @ f2aa222
  1 +
  2 +function forEachNode(nodes, f) {
  3 + for (var i = 0; i < nodes.length; i++) {
  4 + //f(nodes.item(i));
  5 + f(nodes.item(i), i, nodes); // ressemble à "map" de lundi
  6 + }
  7 +}
  8 +function forEachInSelector(sel, f) {
  9 + var nodes = document.querySelectorAll(sel);
  10 + forEachNode(nodes, f);
  11 +};
... ... @@ -3,8 +3,7 @@
3 3 <title>Computer Networks and Security − 2017 − M1 WI/MLDM</title>
4 4 <meta name="year" content="2017"/>
5 5 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
6   - <script type="text/javascript" src="jquery.min.js"></script>
7   - <script type="text/javascript" src="tools.js"></script>
  6 + <script type="text/javascript" src="extensions/tools.js"></script>
8 7 <style type="text/css">
9 8 html, body {margin:0; padding:0;}
10 9 html {text-align: center; background: white; font-family: Arial;}
11 10  
12 11  
... ... @@ -22,22 +21,20 @@
22 21 a.proj {min-height: 65px;}
23 22 a:hover {background: rgb(255, 127, 0);}
24 23 .outlined {outline: 1px solid black;}
  24 + .pdf { box-shadow: blue 2px 2px 5px; }
25 25 .vil {
26 26 outline: 2px solid black;
27 27 }
28 28 </style>
29   - <script>
30   - $(function(){ $("a").attr("target", "_blank"); });
31   - </script>
32 29 </head>
33 30  
34 31 <body class="">
35 32 <h1><span class="var-title"></span></h1>
36 33 <h2>Slides</h2>
37 34 <div>
38   - <!--a class="outlined" href="more-slides-help.html">Viewing the slides?</a-->
39   - <a href="lesson-01.html">Slides 1 <br/> Intro</a>
40   -
  35 + <!--a class="outlined" href="more-slides-help.html">Viewing the slides?</a-->
  36 + <a data-lesson="01">Intro</a>
  37 +
41 38 <!--a href="all-slides-do-not-print.pdf">Slides as pdf <br/> (do not print) </a-->
42 39 <!--a href="../static/export_cours_1_2_3_4.pdf">Slides 1,2,3,4 <br/> en PDF</a-->
43 40 </div>
... ... @@ -76,6 +73,23 @@
76 73 <a href="raw/lesson10-endcode.zip">Code from <br/> lesson-10's end </a>
77 74 </div>
78 75 <p style="clear:both; padding-top: 2em; text-align: left;">¹ from https://vimeo.com/140075655</p-->
  76 +
  77 + <script>
  78 +forEachInSelector("a[data-lesson]", function(e, i) {
  79 + var l = e.getAttribute("data-lesson");
  80 + e.setAttribute("href", "lesson-"+l+".html");
  81 + var pdf = e.cloneNode();
  82 + pdf.innerHTML = e.innerHTML + "<br/> (pdf)";
  83 + pdf.setAttribute("href", "lesson-"+l+".pdf");
  84 + pdf.classList.add("pdf");
  85 + e.parentElement.insertBefore(pdf, e);
  86 + e.innerHTML += "<br/> ";
  87 +});
  88 +forEachInSelector("a", function(e, i) {
  89 + e.setAttribute("target", "_blank");
  90 +});
  91 + </script>
  92 +
79 93 <!-- clicky Cla -->
80 94 <script type="text/javascript">
81 95 var clicky_site_ids = clicky_site_ids || [];