-
Notifications
You must be signed in to change notification settings - Fork 988
/
head.twig
106 lines (82 loc) · 3.57 KB
/
head.twig
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
{#
LimeSurvey
Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Header ·._.·´¯)·._.·´¯)
This file generates the headers.
Most of the time, it is not the right place to add your own JS/CSS - instead, use the config.xml file for that.
#}
{% if(aSurveyInfo.jYesNo) %}
{{ registerScript('activateConfirmLanguage',"$.extend(LSvar.lang," ~ aSurveyInfo.jYesNo ~ ")", "POS_BEGIN") }}
{% endif %}
{{ registerScript('activateActionLink',"activateActionLink();", "POS_END") }}
{{ registerScript('activateConfirmButton',"activateConfirmButton();", "POS_END") }}
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
{{ aSurveyInfo.surveyls_title }}
</title>
<meta name="generator" content="LimeSurvey http://www.limesurvey.org" />
<link rel="shortcut icon" href="{{ aSurveyInfo.oTemplate.sTemplateurl }}favicon.ico" />
{# Ajax mode #}
{% if(aSurveyInfo.options.ajaxmode == "on") %}
<script>
// Submit the form with Ajax
function ajaxSubmit(){
var numPost = 0;
// First we get the value of the button clicked (movenext, submit, prev, etc)
var move = "";
$(".ls-move-btn").on("click", function(){
move = $(this).attr("value");
});
// If the user try to submit the form
$(document).on("submit", "#limesurvey", function (e) {
e.preventDefault();
// Prevent multiposting
numPost++;
if ( numPost > 1){
return;
}
var sUrl = $(this).attr("action");
var aPost = $(this).serialize();
// We add the value of the button clicked to the post request
aPost += "&move="+move;
$.ajax({
url : sUrl,
type : 'POST',
dataType : 'html',
data : aPost,
success : function(body_html, statut){
$('.toRemoveOnAjax').each(function(){
$(this).remove();
});
var $dataScripts = $(body_html).filter('script');
$("body").empty().append($.parseHTML(body_html));
$dataScripts.each(function() {
$(this).attr('type', 'text/javascript').addClass('toRemoveOnAjax').appendTo('head');
});
// We reapply the function to the new form
ajaxSubmit();
},
error : function(result, statut, erreur){
alert("ERROR");
console.log(result);
}
});
});
}
$( document ).ready( function(){
ajaxSubmit();
});
</script>
{% endif %}
{{ include('./subviews/google_analytics.twig') }}
</head>