This repository has been archived by the owner on Jun 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
350 lines (301 loc) · 13.5 KB
/
index.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
---
layout: default
title: "Revivez la convention de la France insoumise - #ConventionFi"
slug : convention_fi
date: 2017-11-25
menu: true
image: https://evenements.lafranceinsoumise.fr/photos/rs_fin.jpg
description: |
Le samedi 25 et dimanche 26 novembre, la France insoumise organisait sa troisième Convention. Revivez cet événement en direct !
map: true
subject: Convention législatives
---
<p class="lead">
Le samedi 25 et dimanche 26 novembre, la France insoumise organisait sa troisième Convention. Revivez cet événement
en vidéo !<a target="_blank">#ConventionFI</a>.
</p>
<div class="row">
<div class="col-md-6">
<iframe width="560" height="315" src="https://www.youtube.com/embed/0-j2zGnZWJI" frameborder="0" allowfullscreen></iframe>
</div>
<div class="col-md-6">
<iframe width="1280" height="720" src="https://www.youtube.com/embed/gasFlr74Cu4?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
<div class="row">
<p>
<div class="col-xs-12 bottom-margin"><a target="_blank" class="btn btn-lg btn-block btn-primary" href="https://dons.lafranceinsoumise.fr/">Je fais un don</a></div>
<div class="col-md-6 bottom-margin"><a target="_blank" class="btn btn-lg btn-block" style="background-color:#3b5998;color: white;" href="https://www.facebook.com/sharer/sharer.php?app_id=113869198637480&kid_directed_site=0&sdk=joey&u=https%3A%2F%2Fevenements.lafranceinsoumise.fr%2F&display=popup&ref=plugin&src=share_button">PARTAGER SUR FACEBOOK</a></div>
<div class="col-md-6 bottom-margin"><a target="_blank" class="btn btn-lg btn-block" style="background-color:#4099FF;color: white;" href="https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fpublish.twitter.com%2F&ref_src=twsrc%5Etfw&related=franceinsoumise&text=Dimanche%2026%20novembre%2C%20suivez%20en%20direct%20la%20troisième%20convention%20de%20la%20%40franceinsoumise.%20%23ConventionFi&tw_p=tweetbutton&url=https%3A%2F%2Fevenements.lafranceinsoumise.fr">PARTAGER SUR TWITTER</a></div>
<br/><br/>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<div id="participation" style="display: {% if site.data.contributions.enabled %}block{% else %}none{%endif%};">
<h3>Je participe !</h3>
<div>
<p id="contribution-intro">{{ site.data.contributions.intro }}</p>
</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label for="contribution">Ma contribution</label>
<textarea class="form-control" rows="4" id="contribution" maxlength="280" data-toggle="popover"
data-content="Indiquez-ici votre contribution" title="Qu'avez-vous dire ?" data-trigger="manual"
data-container="body"></textarea>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="prenom">Mon prénom</label>
<input type="text" class="form-control" id="prenom" data-toggle="popover" title="Pas de prénom ?"
data-content="Vous devez indiquez votre prénom !" data-trigger="manual" data-container="body">
</div>
<button class="btn btn-primary btn-block" id="envoyer" data-toggle="popover" data-trigger="manual" data-container="body">
Contribuer
</button>
</div>
</div>
<div class="form-inline">
<div class="form-group" id="hashtag-container" data-toggle="popover" title="Choisissez au moins un thème"
data-content="Ajoutez le hashtag avec un des boutons." data-trigger="manual" data-container="body"></div>
</div>
<div id="contribution-form-link">
{% if site.data.contributions.form %}
<p>
<a class="btn btn-block btn-primary btn-lg" href="{{ site.data.contributions.form.link }}">
{{ site.data.contributions.form.title }}
</a>
</p>
{% endif %}
</div>
</div>
<script>
function uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
)
}
function hidePopovers() {
$('[data-toggle="popover"]').popover('hide');
}
function saveFirstName(e) {
localStorage.setItem('prenom', e.currentTarget.value);
}
function sendContribution(e) {
e.stopPropagation();
var prenom = prenomField.value.trim();
var contribution = contributionField.value.trim();
if (!prenom) {
$(prenomField).popover('show');
return;
}
if(!contribution) {
$(contributionField).popover('show');
return;
}
if (config.compulsory && !config.tags.some(function(t) { return contributionField.value.indexOf('#' + t) !== -1 })) {
$(hashtagContainer).popover('show');
return;
}
var message = {
id: contributerId,
name: prenom,
text: contribution,
};
sendButton.disabled = true;
sendButton.textContent = 'Envoi...';
var r = new XMLHttpRequest();
r.open("POST", config.endpoint, true);
r.setRequestHeader('Content-Type', 'application/json');
r.onreadystatechange = function () {
if (r.readyState !== 4) {
return;
}
switch (r.status) {
case 200:
contributionField.value = '';
break;
case 403:
$(sendButton).popover({
title: "C'est pas ouvert :(",
content: "Les contributions ne sont pas ouvertures pour le moment."
});
break;
case 429:
$(sendButton).popover({
title: "Pas si vite !",
content: "Un message seulement toutes les minutes ! Patientez un peu."
}).popover('show');
break;
default:
$(sendButton).popover({
title: "Erreur inconnue",
content: "Aucune idée de ce qui s'est passé !? Essayez un peu plus tard."
}).popover('show');
}
sendButton.disabled = false;
sendButton.textContent = 'Contribuer';
};
r.send(JSON.stringify(message));
}
function refreshConfig() {
var r = new XMLHttpRequest();
r.open("GET", '/data/contributions.json', true);
r.onreadystatechange = function(e) {
if (this.readyState === 4) {
if (this.status === 200) {
try {
var config = JSON.parse(this.responseText);
refreshInterface(config);
} catch(e) {
console.error("Config parsing error: ", e);
}
} else {
console.error("Server error: ", this.status);
}
}
};
r.send(null);
}
function refreshInterface(newConfig) {
if (newConfig.interfaceVersion > config.interfaceVersion) {
window.location.reload(true);
return;
}
config = newConfig;
contributionDiv.style.display = config.enabled ? 'block' : 'none';
setUpHashtagButtons();
changeIntroText();
refreshFormButton();
}
function changeIntroText() {
introElement.textContent = config.intro;
}
function refreshFormButton() {
if (!config.form) {
while(contributionFormLinkContainer.firstChild) {
contributionFormLinkContainer.removeChild(contributionFormLinkContainer.firstChild)
}
return;
}
var paragraph = contributionFormLinkContainer.firstElementChild;
if (!paragraph) {
paragraph = document.createElement('p');
contributionFormLinkContainer.append(paragraph);
}
var link = paragraph.firstElementChild;
if(!link) {
link = document.createElement('a');
paragraph.append(link);
}
link.className = 'btn btn-block btn-primary btn-lg';
link.textContent = config.form.title;
link.href = config.form.link;
}
function addHashtag(e) {
var cursorPos = $(contributionField).prop('selectionStart');
var v = contributionField.value;
var textBefore = v.substring(0, cursorPos);
var textAfter = v.substring(cursorPos, v.length);
var additionalChars = 1;
if(textBefore[textBefore.length -1] !== ' ') { textBefore += ' '; additionalChars++; }
if(textAfter[0] !== ' ') { textAfter = ' ' + textAfter; additionalChars++; }
contributionField.value = textBefore + '#' + e.currentTarget.dataset.tag + textAfter;
var newCursor = cursorPos + e.currentTarget.dataset.tag.length + additionalChars;
contributionField.selectionStart = newCursor;
contributionField.selectionEnd = newCursor;
}
function preventLosingFocus(e) {
e.preventDefault();
}
function getQueryParameterByName(name) {
var url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function createHashTagButton(tag) {
var button = document.createElement('button');
button.className = "btn btn-info hashtag form-control";
button.dataset.tag = tag;
button.textContent = '#' + tag;
hashtagContainer.append(button);
button.addEventListener('click', addHashtag);
button.addEventListener('mousedown', preventLosingFocus);
hashtagButtons[tag] = button;
}
function setUpHashtagButtons() {
var i;
var existings = Object.keys(hashtagButtons);
for (i = 0; i < existings.length; i++) {
if (config.tags.indexOf(existings[i]) === -1) {
hashtagButtons[existings[i]].remove();
delete hashtagButtons[existings[i]];
}
}
for(i = 0; i < config.tags.length; i++) {
if (! (config.tags[i] in hashtagButtons)) {
createHashTagButton(config.tags[i]);
}
}
}
var uuidRegExp = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
var contributerId = window.localStorage.getItem('contributerId');
if (contributerId === null || !uuidRegExp.exec(contributerId)) {
contributerId = uuidv4();
window.localStorage.setItem('contributerId', contributerId);
}
var contributionDiv = document.getElementById('participation');
var contributionField = document.getElementById('contribution');
var prenomField = document.getElementById('prenom');
prenomField.value = localStorage.getItem('prenom') || '';
var sendButton = document.getElementById("envoyer");
var introElement = document.getElementById("contribution-intro");
var contributionFormLinkContainer = document.getElementById("contribution-form-link");
document.addEventListener('click', hidePopovers);
sendButton.addEventListener('click', sendContribution);
prenomField.addEventListener('change', saveFirstName);
var config = {{ site.data.contributions | jsonify }};
var hashtagContainer = document.getElementById('hashtag-container');
var hashtagButtons = {};
setUpHashtagButtons();
if(!getQueryParameterByName('donotrefresh')) {
setInterval(refreshConfig, config.refreshInterval * 1000);
}
</script>
<style>.hashtag + .hashtag { margin-left: 5px;}</style>
<h3>En direct</h3>
<div class="row">
<div style="max-height: 1500px; border-left: 1px solid #DDD; overflow:auto; padding-top: 10px;" id="direct">
{% assign direct='direct_convention_fi' %}
</div>
</div>
</div>
<div class="col-sm-4">
<!--<a class="twitter-timeline" href="https://twitter.com/hashtag/ConventionFi" data-widget-id="933715590057021440">Tweets sur #ConventionFi</a>-->
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<h3>Déroulé de la journée</h3>
<div class="row">
<p>
<div class="col-xs-3 text-important">Samedi 13h00</div>
<div class="col-xs-9">
Début de la première séance de travail
</div>
</p>
</div>
<div class="row">
<p>
<div class="col-xs-3 text-important">Dimanche 9h30</div>
<div class="col-xs-9">
Début de la seconde séance de travail
</div>
</p>
</div>
</div>
</div>
<script>window.direct = "{{ site.url }}/{{ site.data_dir }}/{{ direct }}.yml";</script>
<script type="text/javascript" src="{{ site.url }}/main.95ed4e20.js"></script>