Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 382d988

Browse files
author
Wesley Grubbs
committed
Copy changes and setting autofocus to first item on the list.
1 parent 112a1b5 commit 382d988

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ <h1 class="noPointer">Small Arms and Ammunition - Imports & Exports
199199
<div id="aboutBox">
200200
<div class="title">Information about the data</div>
201201
<div class="text">
202-
This project was produced by Google as part of the Google Ideas INFO (Illicit Networks, Forces in Opposition) Summit with support from the <a href="http://igarape.org.br/" target="_blank">Igarape Institute</a> and the <a href="http://www.prio.no/" target="_blank">Peace Research Institute Oslo (PRIO)</a>. It uses annual customs report data providing >1 million data points of individual exports and imports to map the transfer of small arms, light weapons and ammunition across 250 states and territories across the world between 1992 and 2010. The key source of data is the <a href="http://www.prio.no/" target="_blank">Peace Research Institute Oslo (PRIO)</a> small arms database.<br /><br />
202+
This project was produced by Google as part of the Google Ideas INFO (Illicit Networks, Forces in Opposition) Summit with support from the <a href="http://igarape.org.br/" target="_blank">Igarape Institute</a>. It uses annual customs report data providing >1 million data points of individual exports and imports to map the transfer of small arms, light weapons and ammunition across 250 states and territories across the world between 1992 and 2010. The key source of data is the <a href="http://www.prio.no/" target="_blank">Peace Research Institute Oslo (PRIO)</a> small arms database.<br /><br />
203203

204-
For more info, please download our <a href="#" target="_blank">FAQs</a>.
204+
For more info, please download our <a href="#" target="_blank">FAQs</a>.
205205
</div><!--
206206
<div class="links">
207207
<a href="#">link</a>

js/ui.controls.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ var d3Graphs = {
3838
previousImportLabelTranslateY: -1,
3939
previousExportLabelTranslateY: -1,
4040
zoomBtnInterval: -1,
41+
42+
4143
setCountry: function(country) {
4244
$("#hudHeader .countryTextInput").val(country);
4345
d3Graphs.updateViz();
@@ -62,7 +64,7 @@ var d3Graphs = {
6264
$("#hudHeader .searchBtn").click(d3Graphs.updateViz);
6365
$("#importExportBtns .imex>div").not(".label").click(d3Graphs.importExportBtnClick);
6466
$("#importExportBtns .imex .label").click(d3Graphs.importExportLabelClick);
65-
$("#hudHeader .countryTextInput").autocomplete({ source:selectableCountries });
67+
$("#hudHeader .countryTextInput").autocomplete({ source:selectableCountries, autoFocus: true });
6668
$("#hudHeader .countryTextInput").keyup(d3Graphs.countryKeyUp);
6769
$("#hudHeader .countryTextInput").focus(d3Graphs.countryFocus);
6870
$("#hudHeader .aboutBtn").click(d3Graphs.toggleAboutBox);
@@ -236,7 +238,6 @@ var d3Graphs = {
236238
var exportArray = [];
237239
var historical = selectedCountry.summary.historical;
238240
var numHistory = historical.length;
239-
// console.log(historical);
240241
var absMax = 0;
241242
var startingImportIndex = 0;
242243
var startingExportIndex = 0;
@@ -279,11 +280,6 @@ var d3Graphs = {
279280
}
280281

281282
}
282-
/*
283-
console.log('imports');
284-
console.log(importArray);
285-
console.log('exports');
286-
console.log(exportArray);*/
287283
this.histogramImportArray = importArray;
288284
this.histogramExportArray = exportArray;
289285
this.histogramAbsMax = absMax;
@@ -422,12 +418,9 @@ var d3Graphs = {
422418
} else {
423419
maxVal = -1;
424420
}
425-
/*console.log('active year');
426-
console.log(activeYearImports);
427-
console.log(activeYearExports);*/
421+
428422
var activeYearData = [{x:yearOffset, y: activeYearImports != null ? activeYearImports.y : -1, max: maxVal, show: activeYearImports!=null, type:"imports"},
429423
{x: yearOffset, y: activeYearExports != null ? activeYearExports.y : -1, max: maxVal, show:activeYearExports!=null, type:'exports'}];
430-
// console.log(activeYearData);
431424
var yearDots = this.histogramSVG.selectAll("ellipse.year").data(activeYearData);
432425
var yearDotLabels = this.histogramSVG.selectAll("text.yearLabel").data(activeYearData);
433426
yearDots.enter().append('ellipse').attr('class','year').attr('rx',4).attr('ry',4)
@@ -457,10 +450,6 @@ var d3Graphs = {
457450
} else {
458451
yVal += 19;
459452
}
460-
/*
461-
if(yVal < d3Graphs.histogramVertPadding) {
462-
yVal += 26;
463-
}*/
464453
if(yVal > d3Graphs.histogramHeight + d3Graphs.histogramVertPadding) {
465454
yVal -= 26;
466455
}
@@ -687,7 +676,6 @@ var d3Graphs = {
687676
labelWidth = numericLabelEle.getComputedTextLength();
688677
} else if(pieceHeight < mediumLabelSize || data.type == 'ammo') {
689678
//number and type
690-
//console.log('medium label');
691679
var numericLabel = exportLabel.append('text').text(function(d) {
692680
return abbreviateNumber(d.amount);
693681
}).attr('text-anchor','start').attr('font-size',function(d) {
@@ -704,7 +692,6 @@ var d3Graphs = {
704692
labelWidth = numericLabelEle.getComputedTextLength() > textLabelEle.getComputedTextLength() ? numericLabelEle.getComputedTextLength() : textLabelEle.getComputedTextLength();
705693
} else {
706694
//number type and 'weapons'
707-
// console.log('large label');
708695
var numericLabel = exportLabel.append('text').text(function(d) {
709696
return abbreviateNumber(d.amount);
710697
}).attr('text-anchor','start').attr('font-size',function(d) {

0 commit comments

Comments
 (0)