Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
Respect My Net
Commits
214eef5c
Commit
214eef5c
authored
Oct 19, 2012
by
stef
Browse files
[fix] faster map loading
parent
1a4e64f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
media/js/map.js
View file @
214eef5c
$
script
.
ready
(
'
kartograph
'
,
function
()
{
$
(
document
).
ready
(
function
()
{
var
onCountryClick
=
function
(
target
)
{
window
.
location
=
'
/list/
'
+
target
.
iso2
+
"
/
"
;
};
...
...
@@ -6,43 +6,13 @@ $script.ready('kartograph', function() {
window
.
map
=
$K
.
map
(
'
#map
'
);
map
.
loadMap
(
'
/site_media/eu.svg
'
,
function
(
map
)
{
map
.
addLayer
({
'
id
'
:
'
eu
'
,
'
className
'
:
'
bgback
'
,
filter
:
function
(
d
)
{
if
(
country
.
length
==
2
)
{
return
d
.
iso2
==
country
;
}
return
true
;
}
})
.
addLayer
({
'
id
'
:
'
eu
'
,
'
className
'
:
'
bg
'
,
filter
:
function
(
d
)
{
if
(
country
.
length
==
2
)
{
return
d
.
iso2
==
country
;
}
return
true
;
}
})
.
addLayer
({
'
id
'
:
'
eu
'
,
'
className
'
:
'
bgstroke
'
,
filter
:
function
(
d
)
{
if
(
country
.
length
==
2
)
{
return
d
.
iso2
==
country
;
}
return
true
;
}
})
.
addLayer
(
'
eu
'
,
'
bgback
'
)
.
addLayer
(
'
eu
'
,
'
bg
'
)
.
addLayer
(
'
eu
'
,
'
bgstroke
'
)
.
addLayer
({
'
id
'
:
'
countries
'
,
'
className
'
:
'
context
'
})
.
addLayer
(
'
graticule
'
)
.
addLayer
({
'
id
'
:
'
eu
'
,
'
className
'
:
'
fg
'
,
filter
:
function
(
d
)
{
if
(
country
.
length
==
2
)
{
return
d
.
iso2
==
country
;
}
return
true
;
},
'
tooltip
'
:
{
content
:
function
(
obj
,
foo
)
{
var
count
=
0
;
...
...
templates/list.html
View file @
214eef5c
...
...
@@ -11,58 +11,57 @@
{% block scripts %}
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/script.min.js"
></script>
<script
type=
"text/javascript"
>
$script
([
'
{{ MEDIA_URL }}/js/jquery.min.js
'
],
'
jquery
'
);
$script
([
"
{{ MEDIA_URL }}/js/jquery.tablesorter.min.js
"
,
"
{{ MEDIA_URL }}/js/picnet.table.filter.min.js
"
],
'
tables
'
);
$script
([
'
{{ MEDIA_URL }}/js/raphael.min.js
'
,
'
{{ MEDIA_URL }}/js/kartograph.min.js
'
,
'
{{ MEDIA_URL }}/js/chroma.min.js
'
,
'
{{ MEDIA_URL }}/js/qtip.min.js
'
],
'
kartograph
'
);
</script>
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/jquery.tablesorter.min.js"
></script>
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/picnet.table.filter.min.js"
></script>
<script
type=
"text/javascript"
src=
'{{ MEDIA_URL }}/js/raphael.min.js'
></script>
<script
type=
"text/javascript"
src=
'{{ MEDIA_URL }}/js/kartograph.min.js'
></script>
<script
type=
"text/javascript"
src=
'{{ MEDIA_URL }}/js/chroma.min.js'
></script>
<script
type=
"text/javascript"
src=
'{{ MEDIA_URL }}/js/qtip.min.js'
></script>
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/map.js"
></script>
<script
type=
"text/javascript"
>
var
data
=
{
%
if
countryweights
%
}{{
countryweights
|
safe
}}{
%
else
%
}[]{
%
endif
%
};
var
country
=
"
{{country}}
"
;
$script
.
ready
([
'
jquery
'
,
'
tables
'
],
function
()
{
$
(
document
).
ready
(
function
()
{
$
.
tablesorter
.
addParser
({
// set a unique id
id
:
'
stateparser
'
,
is
:
function
(
s
)
{
// return false so this parser is not auto detected
return
false
;
},
format
:
function
(
s
)
{
// format your data for normalization
return
s
{
%
for
s
,
translation
in
status
%
}.
replace
(
/{{translation}}/
,{{
forloop
.
counter
}}){
%
endfor
%
};
},
// set type, either numeric or text
type
:
'
numeric
'
});
$
(
"
#sortedlist
"
).
tablesorter
({
headers
:
{
8
:
{
sorter
:
false
},
0
:
{
sorter
:
'
stateparser
'
}},
sortList
:
[[
1
,
0
],[
0
,
0
],[
7
,
1
]],
});
var
options
=
{
enableCookies
:
false
};
$
(
'
#sortedlist
'
).
tableFilter
(
options
);
$
(
'
.confirm_form
'
).
submit
(
function
()
{
var
self
=
this
;
var
email
=
$
(
this
).
find
(
'
input:first
'
).
attr
(
'
value
'
);
if
(
email
.
length
>
0
)
{
$
.
ajax
({
url
:
'
/confirm/
'
+
$
(
this
).
attr
(
'
id
'
).
slice
(
1
)
+
'
/
'
+
email
,
success
:
function
(
data
)
{
$
(
self
).
html
(
data
);
}});
}
else
{
$
(
this
).
find
(
'
[type=text]
'
).
focus
();
}
return
false
;
});
$
(
"
.confirm > .button
"
).
click
(
function
(){
$
(
this
).
parent
().
parent
().
parent
().
find
(
'
.info-validate
'
).
toggle
();
});
$
(
"
.cancel-button
"
).
click
(
function
(){
$
(
this
).
parent
().
hide
();
});
});
});
$
(
document
).
ready
(
function
()
{
$
.
tablesorter
.
addParser
({
// set a unique id
id
:
'
stateparser
'
,
is
:
function
(
s
)
{
// return false so this parser is not auto detected
return
false
;
},
format
:
function
(
s
)
{
// format your data for normalization
return
s
{
%
for
s
,
translation
in
status
%
}.
replace
(
/{{translation}}/
,{{
forloop
.
counter
}}){
%
endfor
%
};
},
// set type, either numeric or text
type
:
'
numeric
'
});
$
(
"
#sortedlist
"
).
tablesorter
({
headers
:
{
8
:
{
sorter
:
false
},
0
:
{
sorter
:
'
stateparser
'
}},
sortList
:
[[
1
,
0
],[
0
,
0
],[
7
,
1
]],
});
var
options
=
{
enableCookies
:
false
};
$
(
'
#sortedlist
'
).
tableFilter
(
options
);
$
(
'
.confirm_form
'
).
submit
(
function
()
{
var
self
=
this
;
var
email
=
$
(
this
).
find
(
'
input:first
'
).
attr
(
'
value
'
);
if
(
email
.
length
>
0
)
{
$
.
ajax
({
url
:
'
/confirm/
'
+
$
(
this
).
attr
(
'
id
'
).
slice
(
1
)
+
'
/
'
+
email
,
success
:
function
(
data
)
{
$
(
self
).
html
(
data
);
}});
}
else
{
$
(
this
).
find
(
'
[type=text]
'
).
focus
();
}
return
false
;
});
$
(
"
.confirm > .button
"
).
click
(
function
(){
$
(
this
).
parent
().
parent
().
parent
().
find
(
'
.info-validate
'
).
toggle
();
});
$
(
"
.cancel-button
"
).
click
(
function
(){
$
(
this
).
parent
().
hide
();
});
});
</script>
<script
type=
"text/javascript"
src=
"{{ MEDIA_URL }}/js/map.js"
></script>
{% endblock %}
{%block content%}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment