Permalink
Browse files

last changes

  • Loading branch information...
xavijam committed May 24, 2011
1 parent 1de73ac commit 5ed0f34f64cd3e0f55b215a663350f817a8b3786
View
@@ -22,12 +22,12 @@
<script src="javascripts/plugins/jquery-ui-1.8.12.custom.min.js" type="text/javascript" charset="utf-8"></script>
<!-- ON DEPLOY RUN THE CLOSURE COMPRESSOR (./lib/compress-javascript.sh) AND UNCOMMENT THIS -->
- <script src="lib/application.closure.js" type="text/javascript" charset="utf-8"></script>
+ <!-- <script src="lib/application.closure.js" type="text/javascript" charset="utf-8"></script> -->
<!-- ON DEPLOY DELETE ALL THESE JS ONCE COMPRESSED JS IS ACTIVE ABOVE -->
- <!--script src="javascripts/max_min_avg.js" type="text/javascript" charset="utf-8"></script>
+ <script src="javascripts/max_min_avg.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/var_resolutions.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/environment.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/plugins/underscore.js" type="text/javascript" charset="utf-8"></script>
@@ -45,7 +45,7 @@
<script src="javascripts/maps/maps.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/graph/graph.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/header.js" type="text/javascript" charset="utf-8"></script>
- <script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script -->
+ <script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
<!-- ON DEPLOY DELETE ALL THESE JS ONCE COMPRESSED JS IS ACTIVE ABOVE -->
<!--[if lt IE 8 ]>
@@ -1090,8 +1090,8 @@ function goDeeper(url){
showGraphLoader();
var url_split = url.split('/');
-
- deep = url_split[5];
+
+ deep = url_split[url_split.length-3];
var url_split_length = url_split.length-1;
var compare_var = compare.replace(/ /g,'_');
View
@@ -630,8 +630,7 @@
var comparison_var = normalization[compare];
-
- if (var_resolutions[deep_level][comparison_var]!=undefined) {
+ if (comparison_var!=undefined && var_resolutions[deep_level][comparison_var]!=undefined) {
var left_no = var_resolutions[deep_level][comparison_var][0] - 1987;
var length_array = var_resolutions[deep_level][comparison_var].length;
@@ -462,20 +462,6 @@
CompareWindow.prototype.drawBar = function(party_id, level, data){
var id = party_id - 1;
var positions = ["primer", "segundo", "tercer"];
-
-
- if (party_id == 1 && (data['data'][year][positions[id] + '_partido_name']==undefined || data['data'][year][positions[id] + '_partido_name']==null || data['data'][year][positions[id] + '_partido_name']=='null')) {
- $('div#comparewindow div'+((level=="top")?'#compare_region1':'#compare_region2')+' div.stats').css('display','none!important');
- $('div#comparewindow div'+((level=="top")?'#compare_region1':'#compare_region2')+' div.stats').hide();
- $('div#comparewindow div.'+level+' div.summary').hide();
- $('div#comparewindow div'+((level=="top")?'#compare_region1':'#compare_region2')+'p.no_data').hide();
- return false;
- } else {
- $('div#comparewindow div.'+level+' div.stats').show();
- $('div#comparewindow div.'+level+' div.summary').hide();
- $('div#comparewindow div'+((level=="top")?'#compare_region1':'#compare_region2')+'p.no_data').hide();
- }
-
if (party_id < 4) {
if (data['data'][year][positions[id] + '_partido_name']!=undefined && data['data'][year][positions[id] + '_partido_name']!=null && data['data'][year][positions[id] + '_partido_name']!='null') {
@@ -513,32 +499,56 @@
} else {
$('div#comparewindow div.'+level+' div.stats div.partido:eq(3)').hide();
}
+ }
+
+
+ if (party_id==4 && (data['data'][year]['percen_participacion']==undefined)) {
+ $('div#comparewindow p.no_data').show();
+ $('div#comparewindow div.'+level+' div.stats').hide();
+ } else {
+ // if (level=='top' && this.firstData.provincia!=undefined) {
+ // $('div#comparewindow div.'+level+' div.stats').hide();
+ // } else {
+ // $('div#comparewindow div.'+level+' div.stats').show();
+ // }
+ //
+ // if (level=='bottom' && this.secondData.provincia!=undefined) {
+ // $('div#comparewindow div.'+level+' div.stats').hide();
+ // } else {
+ // $('div#comparewindow div.'+level+' div.stats').show();
+ // }
+
+ $('div#comparewindow p.no_data').hide();
}
}
+
CompareWindow.prototype.refreshChart = function(){
if (this.firstData != null) {
this.createChart(this.firstData, true, true);
}
}
+
CompareWindow.prototype.updateValues = function(){
if (this.div) {
$('div#comparewindow div.top div.stats h4').text(parseFloat(this.firstData.data[year].percen_participacion).toFixed(0)+'% de participación');
$('div#comparewindow div.top p.province').text(((this.firstData.provincia!=undefined)?(this.firstData.provincia+', '):' ')+((this.firstData['data'][year]['censo_total']!=undefined)?this.firstData['data'][year]['censo_total']+' habitantes':' '));
-
+
if (!_.isEmpty(this.secondData)) {
$('div#comparewindow div.bottom div.stats h4').text(parseFloat(this.secondData.data[year].percen_participacion).toFixed(0)+'% de participación');
$('div#comparewindow div.bottom p.province').text(((this.secondData.provincia!=undefined)?(this.secondData.provincia+', '):' ')+((this.secondData['data'][year]['censo_total']!=undefined)?this.secondData['data'][year]['censo_total']+' habitantes':' '));
}
-
+
+
this.updateTotalNumber();
this.updateBars();
}
}
+
CompareWindow.prototype.updateTotalNumber = function() {
$('div#comparewindow div.summary li.partido').each(function(i,ele){
$(ele).removeClass(parties.join(" ") + ' par1 par2 par3');
@@ -337,6 +337,7 @@
if (this.deep_level=="municipios") {
$('div.infowindow a.goTo').hide();
+ $('div#infowindow div.summary').hide();
} else if (this.deep_level=="provincias") {
$('div.infowindow a.goTo').text('Ver municipios');
$('div.infowindow a.goTo').attr('href','#ver_municipios');
View
@@ -32,25 +32,6 @@
peninsula.mapTypes.set('rtve', rtveMapType);
peninsula.setMapTypeId('rtve');
-
- // var mapChartOptions = {
- // getTileUrl: function(coord, zoom) {
- // var lULP = new google.maps.Point(coord.x*256,(coord.y+1)*256);
- // var lLRP = new google.maps.Point((coord.x+1)*256,coord.y*256);
- // var projectionMap = new MercatorProjection();
- // var lULg = projectionMap.fromDivPixelToLatLng(lULP, zoom);
- // var lLRg = projectionMap.fromDivPixelToLatLng(lLRP, zoom);
- // return baseUrl+"&chd="+chd+"&chco="+chco+"&chld="+chld+"&chf="+chf+"&cht=map:fixed="+
- // lULg.lat() +","+ lULg.lng() + "," + lLRg.lat() + "," + lLRg.lng();
- // },
- // tileSize: new google.maps.Size(256, 256),
- // isPng: true,
- // minZoom: 6,
- // maxZoom: 12,
- // name: "Hide rest of countries"
- // };
- // var mapChartType = new google.maps.ImageMapType(mapChartOptions);
- // peninsula.overlayMapTypes.insertAt(0, mapChartType);
//Political tiles

0 comments on commit 5ed0f34

Please sign in to comment.