-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.template
98 lines (79 loc) · 2.06 KB
/
info.template
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
<script>
var parameters = new Object();
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 1; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
no_plus = hash[1].split('+');
vars[hash[0]] = no_plus.join(' ');
}
return vars;
}
function getparameters()
{
var params = getUrlVars();
regions = document.getElementById("regions");
region = params['region'];
if( null !== region)
{
for( var i=0; i< regions.length; i++)
{
if ( regions[i].value === region)
{
regions.selectedIndex = i;
break;
}
}
}
address_input = document.getElementById("address");
address = params['address'];
address_input.value = address;
}
function combo()
{
theinput = document.getElementById("regions");
var idx = theinput.selectedIndex;
var content = theinput.options[idx].value;
//getparameters();
insertParam("region", content);
address_input = document.getElementById("address");
insertParam("address", address_input.value);
var builded_parameters = [];
for (k in parameters)
{
if (parameters.hasOwnProperty(k))
{
builded_parameters[builded_parameters.length]=k+'='+parameters[k];
}
}
document.location.search = builded_parameters.join('&');
}
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
function insertParam(key, value)
{
value = value.split(' ');
key = escape(key); value = escape(value.join('+'));
var kvp = parameters;
kvp[key] = value;
parameters=kvp;
}
window.onload=getparameters;
</script>
<select id="regions" >
{% for item in regions %}
<option> {{ item }} </option>
{% end %}
</select>
<label>adresse</label>
<input type="text" id="address"/>
<button type="button" onclick="combo()"> Ok </button>