Commit 85ed3279 authored by Sarath's avatar Sarath

First commit. Primitive state

parents
node_modules/
// Gruntfile.js
// our wrapper function (required by grunt and its plugins)
// all configuration goes inside this function
module.exports = function(grunt) {
// ===========================================================================
// CONFIGURE GRUNT ===========================================================
// ===========================================================================
grunt.initConfig({
// all of our configuration will go here
browserSync: {
dev: {
bsFiles: {
src : [ '*.html', 'assets/**/*.css', 'assets/**/*.js']
},
options: {
server: {
baseDir: "./"
}
// watchTask: true,
// injectChanges: false,
// reloadDelay: 3000,
// proxy: "localhost/sandbox"
}
}
}
});
grunt.registerTask('default', ['browserSync']);
// ===========================================================================
// LOAD GRUNT PLUGINS ========================================================
// ===========================================================================
// we can only load these if they are in our package.json
// make sure you have run npm install so our app can find these
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
};
html, body, #container {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
padding-top: 50px;
}
input[type="radio"], input[type="checkbox"] {
margin: 0;
}
#sidebar {
width: 250px;
height: 100%;
max-width: 100%;
float: left;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
}
#map {
width: auto;
height: 100%;
box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#loading {
position: absolute;
width: 220px;
height: 19px;
top: 50%;
left: 50%;
margin: -10px 0 0 -110px;
z-index: 20001;
}
#features {
margin: 0px;
border: none;
border-radius: 0px;
-webkit-box-shadow: none;
box-shadow: none;
}
#sidebar-hide-btn {
margin-top: -2px;
}
#aboutTabsContent {
padding-top: 10px;
}
.progress-bar-full {
width: 100%;
}
.white {
color: #FFFFFF;
}
.feature-row {
cursor: pointer;
}
.sidebar-wrapper {
width: 100%;
height: 100%;
position: relative;
}
.sidebar-table {
position: absolute;
width: 100%;
top: 103px;
bottom: 0px;
overflow: auto;
}
.leaflet-control-layers {
overflow: auto;
}
.leaflet-control-layers label {
font-weight: normal;
margin-bottom: 0px;
}
.leaflet-control-layers-list input[type="radio"], input[type="checkbox"] {
margin: 2px;
}
.table {
margin-bottom: 0px;
}
.navbar .navbar-brand {
font-weight: bold;
font-size: 25px;
color: #FFFFFF;
}
.navbar-collapse.in {
overflow-y: hidden;
}
.navbar-header .navbar-icon-container {
margin-right: 15px;
}
.navbar-header .navbar-icon {
line-height: 50px;
height: 50px;
}
.navbar-header a.navbar-icon {
margin-left: 25px;
}
.typeahead {
background-color: #FFFFFF;
}
.tt-dropdown-menu {
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px 4px 4px 4px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
margin-top: 4px;
padding: 4px 0;
width: 100%;
max-height: 300px;
overflow: auto;
}
.tt-suggestion {
font-size: 14px;
line-height: 20px;
padding: 3px 10px;
}
.tt-suggestion.tt-cursor {
background-color: #0097CF;
color: #FFFFFF;
cursor: pointer;
}
.tt-suggestion p {
margin: 0;
}
.tt-suggestion + .tt-suggestion {
border-top: 1px solid #ccc;
}
.typeahead-header {
margin: 0 5px 5px 5px;
padding: 3px 0;
border-bottom: 2px solid #333;
}
.has-feedback .form-control-feedback {
position: absolute;
top: 0;
right: 0;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
}
@media (max-width: 992px) {
.navbar .navbar-brand {
font-size: 18px;
}
}
@media (max-width: 767px){
#sidebar {
display: none;
}
.url-break {
word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
hyphens: auto;
}
.dropdown-menu a i{
color: #FFFFFF;
}
}
/* Print Handling */
@media print {
.navbar {
display: none !important;
}
.leaflet-control-container {
display: none !important;
}
}
.missing {
color: red;
}
var shutdowns = {}, states = [], colorScales = [];
$.getJSON("data/shutdowns.json", function (data) {
prepareData(data);
});
/*
Parse raw data to prepare data for visualization.
1. Generate year-wise statistics
2. TBD
*/
function prepareData(raw) {
shutdowns.data = raw;
shutdowns.yearWise = _.groupBy(raw, function (o) { return moment(o.date).year(); });
shutdowns.stateWise = _.groupBy(raw, 'state');
shutdowns.maxCount = _.max(_.map(_.countBy(shutdowns.data, 'state'), function (o) { return o; }));
shutdowns.colors = chroma.scale(['yellow', ['red']]).colors(shutdowns.maxCount);
shutdowns.colors.unshift("white");
}
var map = L.map('map').setView([23, 83], 5);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', {
maxZoom: 20,
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.light'
}).addTo(map);
// control that shows state info on hover
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info');
this.update();
return this._div;
};
info.update = function (props) {
var count = 0;
if (props && shutdowns.stateWise[props.name]) {
count = shutdowns.stateWise[props.name].length;
}
this._div.innerHTML = '<h4>Internet Shutdowns Info</h4>' + (props ?
'<b>' + props.name + '</b><br />' + count + ' shutdowns reported so far.'
: '<i>Hover over a state for summary, click for details.</i>');
};
info.addTo(map);
function getColor(stateName) {
var color = (shutdowns.stateWise[stateName])? shutdowns.colors[shutdowns.stateWise[stateName].length]: 'white';
return color;
}
function style(feature) {
return {
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.7,
fillColor: getColor(feature.properties.name)
};
}
function highlightFeature(e) {
var layer = e.target;
layer.setStyle({
weight: 5,
color: '#666',
dashArray: '',
fillOpacity: 0.7
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
info.update(layer.feature.properties);
}
var states;
function resetHighlight(e) {
states.resetStyle(e.target);
info.update();
}
function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight,
click: zoomToFeature
});
}
var states = L.geoJson(null, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
$.getJSON("data/india_states.geojson", function (data) {
states.addData(data);
});
map.attributionControl.addAttribution('<span class="missing"><strong> Insert Data License/Attribution here.</strong></span>');
/* Legend (disabled) */
// var legend = L.control({position: 'bottomright'});
//
// legend.onAdd = function (map) {
//
// var div = L.DomUtil.create('div', 'info legend'),
// grades = [0, 10, 20, 50, 100, 200, 500, 1000],
// labels = [],
// from, to;
//
// for (var i = 0; i < grades.length; i++) {
// from = grades[i];
// to = grades[i + 1];
//
// labels.push(
// '<i style="background:' + getColor(from + 1) + '"></i> ' +
// from + (to ? '&ndash;' + to : '+'));
// }
//
// div.innerHTML = labels.join('<br>');
// return div;
// };
//
// legend.addTo(map);
This diff is collapsed.
[
{"state":"Jammu and Kashmir","locality":"","date":"2013-02-09","description":"TV News channels and mobile Internet banned immediately after Afzal Guru's execution on 9th February, 2013","source":"http://www.hindustantimes.com/india/shutdown-hits-kashmir-on-afzal-guru-s-death-anniversary/story-v1vCdWTqVFjEiCf6KvWUlK.html"}
,
{"state":"Jammu and Kashmir","locality":"","date":"2014-03-17","description":"Internet blocked in the whole state to stop pro-independence leaders from addressing a UNHRC event in Geneva via video link on 17th March, 2014","source":"http://www.kmsnews.org/news/2014/03/18/india-shuts-down-internet-to-prevent-mirwaizs-address.html"}
,
{"state":"Gujarat","locality":"Vadodara","date":"2014-09-27","description":"Mobile Internet blocked for three days starting 27th to 30th September, 2014 after riots over a morphed picture of a Muslim religious shrine","source":"http://timesofindia.indiatimes.com/city/vadodara/Internet-services-blocked-in-Vadodara-after-riots/articleshow/43674499.cms"}
,
{"state":"Nagaland","locality":"","date":"2015-03-07","description":"Internet blackout for 48 hours on 7th March, 2015, after lynching video of a rape accused goes viral","source":"http://www.medianama.com/2015/03/223-mobile-and-internet-services-blocked-in-nagaland-following-lynching-videos/"}
,
{"state":"Gujarat","locality":"","date":"2015-08-25","description":"Mobile Internet services shut down in the entire state of Gujarat from 25th August to 2nd September, 2015 after a mega rally led by Hardik Patel seeking OBC status for the Patel community. Mobile internet remained blocked in Ahmedabad, even post 2nd September, 2015","source":"http://articles.economictimes.indiatimes.com/2015-09-02/news/66144045_1_statewide-ban-mobile-internet-social-media"}
,
{"state":"Manipur","locality":"","date":"2015-09-02","description":"Complete internet shut down (mobile and broadband, except for certain BSNL lines) starting 2nd September, 2015 after violence in Churachandpur district","source":"http://scroll.in/article/753108/why-a-blanket-ban-on-the-internet-in-troubled-manipur-is-not-a-good-idea"}
,
{"state":"Jammu and Kashmir","locality":"","date":"2015-09-25","description":"Internet shut down during Eid on 25th September, 2015, apprehending violence against the prohibition on cow slaughter and selling of beef in the State.","source":"http://articles.economictimes.indiatimes.com/2015-09-25/news/66884614_1_jammu-and-kashmir-police-k-rajendra-kumar-internet-services"}
,
{"state":"Rajasthan","locality":"","date":"2015-12-19","description":"After reports of caste & communal clashes in the area, mobile Internet services were shut down in 11 districts to combat inflammatory messages posted through social media networks, starting 19th December, 2015","source":"http://timesofindia.indiatimes.com/india/Rajasthan-police-to-ban-internet-usage-as-per-needs-to-maintain-communal-harmony/articleshow/50258271.cms"}
,
{"state":"Haryana","locality":"","date":"2016-02-19","description":"Subsequent to the Jat reservation protest in Haryana, mobile Internet, and SMS services were blocked in many areas, including Rohtak, Sonepat, and Jhajjar, beginning 19th February, 2016. ","source":"http://indianexpress.com/article/india/india-news-india/rohtak-jat-reservation-mobile-internet-blocked-haryana/"}
,
{"state":"Gujarat","locality":"","date":"2016-02-28","description":"Mobile Internet services were suspended for 4 hours to prevent cheating on the Revenue Accountants Recruitment Exam on 28th February, 2016","source":"http://zeenews.india.com/news/india/mobile-internet-services-blocked-in-gujarat-know-why_1860264.html"}
,
{"state":"Jammu and Kashmir","locality":"","date":"2016-04-14","description":"To check rumor mongering about an incident that led to death of 4 people in a firing by security forces, mobile internet services were suspended in the area on 14th April, 2016.","source":"http://www.hindustantimes.com/india/handwara-firing-mobile-internet-services-suspended-in-kashmir/story-iPQHs3vdmiWx7w0uCGK8NJ.html"}
,
{"state":"Gujarat","locality":"Ahmedabad","date":"2016-04-17","description":"Pursuant to the Patel reservation agitation, mobile internet sevices were suspended in various parts of Gujarat on 17th April, 2016","source":"http://indianexpress.com/article/india/india-news-india/gujarat-curfew-imposed-in-mehsana-as-patels-rally-turns-violent-lalji-patel-injured-2757681/"}
,
{"state":"Jharkhand","locality":"Bokaro","date":"2016-04-16","description":"Subsequent to the communal clashes in the town of Bokaro during the celebration of Ram Navami, internet services were cut off to prevent use of social media as a tool for spreading communal fear and hatred. ","source":"http://timesofindia.indiatimes.com/city/ranchi/Internet-services-blocked-in-Bokaro-after-communal-tension/articleshow/51856786.cms"}
]
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Layers Control Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css">
<link rel="stylesheet" href="assets/css/app.css">
<style>
#map {
width: auto;
height: 100%;
}
.info {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.8);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
width: 360px;
}
.info h4 {
margin: 0 0 5px;
color: #777;
}
.legend {
text-align: left;
line-height: 18px;
color: #555;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin-right: 8px;
opacity: 0.7;
}
.container: {
width: 600px;
position: absolute;
left: 300px;
}
.missing {
color: red;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/4.11.1/lodash.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.1.1/chroma.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script type="text/javascript" src="assets/js/app.js"></script>
</body>
</html>
Markdown is supported
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