Commit 214eef5c authored by stef's avatar stef
Browse files

[fix] faster map loading

parent 1a4e64f4
$script.ready('kartograph', function() { $(document).ready(function() {
var onCountryClick = function(target) { var onCountryClick = function(target) {
window.location='/list/'+target.iso2+"/"; window.location='/list/'+target.iso2+"/";
}; };
...@@ -6,43 +6,13 @@ $script.ready('kartograph', function() { ...@@ -6,43 +6,13 @@ $script.ready('kartograph', function() {
window.map = $K.map('#map'); window.map = $K.map('#map');
map.loadMap('/site_media/eu.svg', function(map) { map.loadMap('/site_media/eu.svg', function(map) {
map map
.addLayer({'id': 'eu', .addLayer('eu', 'bgback')
'className': 'bgback', .addLayer('eu', 'bg')
filter: function(d) { .addLayer('eu', 'bgstroke')
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({'id': 'countries', 'className': 'context'}) .addLayer({'id': 'countries', 'className': 'context'})
.addLayer('graticule') .addLayer('graticule')
.addLayer({'id': 'eu', .addLayer({'id': 'eu',
'className': 'fg', 'className': 'fg',
filter: function(d) {
if(country.length==2) {
return d.iso2 == country;
}
return true;
},
'tooltip': { 'tooltip': {
content: function(obj,foo) { content: function(obj,foo) {
var count=0; var count=0;
......
...@@ -11,58 +11,57 @@ ...@@ -11,58 +11,57 @@
{% block scripts %} {% block scripts %}
<script type="text/javascript" src="{{ MEDIA_URL }}/js/script.min.js"></script> <script type="text/javascript" src="{{ MEDIA_URL }}/js/jquery.min.js"></script>
<script type="text/javascript"> <script type="text/javascript" src="{{ MEDIA_URL }}/js/jquery.tablesorter.min.js"></script>
$script(['{{ MEDIA_URL }}/js/jquery.min.js'], 'jquery'); <script type="text/javascript" src="{{ MEDIA_URL }}/js/picnet.table.filter.min.js"></script>
$script(["{{ MEDIA_URL }}/js/jquery.tablesorter.min.js", "{{ MEDIA_URL }}/js/picnet.table.filter.min.js"], 'tables'); <script type="text/javascript" src='{{ MEDIA_URL }}/js/raphael.min.js'></script>
$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 type="text/javascript" src='{{ MEDIA_URL }}/js/kartograph.min.js'></script>
</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"> <script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %}; var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}"; var country="{{country}}";
$script.ready(['jquery','tables'], function() { $(document).ready(function() {
$(document).ready(function() { $.tablesorter.addParser({
$.tablesorter.addParser({ // set a unique id
// set a unique id id: 'stateparser',
id: 'stateparser', is: function(s) {
is: function(s) { // return false so this parser is not auto detected
// return false so this parser is not auto detected return false;
return false; },
}, format: function(s) {
format: function(s) { // format your data for normalization
// format your data for normalization return s{% for s, translation in status %}.replace(/{{translation}}/,{{forloop.counter}}){% endfor %};
return s{% for s, translation in status %}.replace(/{{translation}}/,{{forloop.counter}}){% endfor %}; },
}, // set type, either numeric or text
// set type, either numeric or text type: 'numeric'
type: 'numeric' });
}); $("#sortedlist").tablesorter({
$("#sortedlist").tablesorter({ headers: { 8: { sorter: false },
headers: { 8: { sorter: false }, 0: { sorter: 'stateparser' }},
0: { sorter: 'stateparser' }}, sortList: [[1,0],[0,0],[7,1]],
sortList: [[1,0],[0,0],[7,1]], });
}); var options = { enableCookies: false };
var options = { enableCookies: false }; $('#sortedlist').tableFilter(options);
$('#sortedlist').tableFilter(options); $('.confirm_form').submit(function() {
$('.confirm_form').submit(function() { var self=this;
var self=this; var email=$(this).find('input:first').attr('value');
var email=$(this).find('input:first').attr('value'); if( email.length>0) {
if( email.length>0) { $.ajax({url: '/confirm/'+$(this).attr('id').slice(1)+'/'+email, success: function(data) { $(self).html(data); }});
$.ajax({url: '/confirm/'+$(this).attr('id').slice(1)+'/'+email, success: function(data) { $(self).html(data); }}); } else {
} else { $(this).find('[type=text]').focus();
$(this).find('[type=text]').focus(); }
} return false;
return false; });
}); $(".confirm > .button").click(function(){
$(".confirm > .button").click(function(){ $(this).parent().parent().parent().find('.info-validate').toggle();
$(this).parent().parent().parent().find('.info-validate').toggle(); });
}); $(".cancel-button").click(function(){
$(".cancel-button").click(function(){ $(this).parent().hide();
$(this).parent().hide(); });
}); });
});
});
</script> </script>
<script type="text/javascript" src="{{ MEDIA_URL }}/js/map.js"></script>
{% endblock %} {% endblock %}
{%block content%} {%block content%}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment