-
Notifications
You must be signed in to change notification settings - Fork 0
/
medicaments.html
100 lines (75 loc) · 3.12 KB
/
medicaments.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- include papers-generator -->
<link rel="stylesheet" type="text/css" href="../lib/papiers.css" />
<script src="../node_modules/zepto/zepto.min.js"></script>
<script src="../lib/papers.functions.js"></script>
<script src="../lib/papers.js"></script>
<!-- customize style here -->
<style type="text/css">
section.card {
height:5em;
}
section.card img{
height:inherit;
opacity:0.8;
}
section.card h3{
text-align:left;
margin-left:1em;
width:40%;
}
</style>
<!-- call paper generator here -->
<script type="text/javascript">
// utility function for this particular example
// we use the name of drugs as our titles
var getDrugList = function(){
return (
"Doliprane Efferalgan Dafalgan Levo-thyrox Kardegic Spasfon Tahor Voltarene Metha-done Aphp "+
"Eludril Ixprim Para-cetamol Biogaran Forlax Magne b6 Helicidine Pias-cledine Lamaline Gaviscon"+
" Daflon Rhino-fluimucil Plavix Subutex Aerius Orelox Dextropro-poxyphene Parac Merck Inexium"+
" Efferalgan Codeine Antalvic Meteospasmyl Toplexil"
).split(" ")
.slice(0,30);
}
// When page is loaded
$(function(){
// DOM piece to copy for every paper
var sourceElement = $('#source section');
// target container
var targetElement = $("#liste");
////////////////////////////////////////
// Data generation
////////////////////////////////////////
// in this example, the illustration is always the same
// image (not provided here) and there is no text.
var medocs = getDrugList().map(function(s){return {tit: s.replace('-','- '), img: "src/pillule.jpg", txt: ''}});
////////////////////////////////////////
// Calling the library
////////////////////////////////////////
// multiply the source data before passing it in (i.e. iterate over the combinations)
var sourceData = papers.helpers.multiplyList(medocs,30);
// this is the default formatter. It relies on the presence of an h3, img and p element.
var formatter = papers.formatters.titleImageText;
// main function: create the DOM elements
papers.addDataToDocument( sourceData, sourceElement, targetElement, formatter );
});
</script>
</head>
<body>
<!-- container for the generated elements -->
<div id="liste">
</div>
<!-- DOM element to copy for each element -->
<div id="source" style="clear:both;display:none;">
<section class="card">
<h3 class="titre"></h3>
<img class="image"/>
<p class="texte"></p>
</section>
</div>
</body>
</html>