Permalink
Browse files

Fix share button. Test user. Make modal bgs dark.

  • Loading branch information...
tmcw committed Apr 28, 2014
1 parent d4b813c commit 77be4d1414e27f3cb034ca575f5886a26524fecf
Showing with 21,107 additions and 57 deletions.
  1. +1 −1 css/site.css
  2. +9 −7 data/share.html
  3. +35 −23 dist/site.js
  4. +21,004 −0 dist/site.mobile.js
  5. +5 −3 package.json
  6. +1 −1 src/core/user.js
  7. +33 −22 src/ui/share.js
  8. +1 −0 test/index.js
  9. +18 −0 test/user.js
View
@@ -452,7 +452,7 @@ div.children a {
.shaded:before {
content:'';
background:rgba(255,255,255,0.75);
background:rgba(0,0,0,0.75);
position:fixed;
left:0px; right:0px; top:0px; bottom:0px;
}
View
@@ -29,12 +29,9 @@
background-color:#f7f7f7;
}
</style>
<script src='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>
<script src='//api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.js'></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.ie.css' rel='stylesheet' >
<![endif]-->
<link href='//api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.css' rel='stylesheet' />
</head>
<body>
<div id='map'></div>
@@ -46,14 +43,19 @@
detectRetina: true
}).addTo(map);
map.attributionControl.addAttribution('<a href="http://geojson.io/">geojson.io</a>');
$.getJSON('map.geojson', function(geojson) {
var geojsonLayer = L.geoJson(geojson).addTo(map);
map.fitBounds(geojsonLayer.getBounds());
var bounds = geojsonLayer.getBounds();
if (bounds.isValid()) {
map.fitBounds(geojsonLayer.getBounds());
} else {
map.setView([0, 0], 2);
}
geojsonLayer.eachLayer(function(l) {
showProperties(l);
});
});
function showProperties(l) {
var properties = l.toGeoJSON().properties, table = '';
for (var key in properties) {
View
@@ -4414,6 +4414,7 @@ function open() {
function loadPage() {
page('/gists?page=' + p, function(err, res) {
if (err) throw err;
res.filter(isMap).forEach(append);
appendNext();
});
@@ -19145,7 +19146,7 @@ module.exports = function(context) {
var user = {};
user.details = function(callback) {
if (!context.storage.get('github_token')) return callback('not logged in');
if (!context.storage.get('github_token')) return callback(new Error('not logged in'));
var cached = context.storage.get('github_user_details');
@@ -19770,7 +19771,7 @@ module.exports = function(context) {
},{"../lib/smartzoom.js":113,"d3-metatable":14}],119:[function(require,module,exports){
var fs = require('fs'),
tmpl = "<!DOCTYPE html>\n<html>\n<head>\n <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />\n <style>\n body { margin:0; padding:0; }\n #map { position:absolute; top:0; bottom:0; width:100%; }\n .marker-properties {\n border-collapse:collapse;\n font-size:11px;\n border:1px solid #eee;\n margin:0;\n}\n.marker-properties th {\n white-space:nowrap;\n border:1px solid #eee;\n padding:5px 10px;\n}\n.marker-properties td {\n border:1px solid #eee;\n padding:5px 10px;\n}\n.marker-properties tr:last-child td,\n.marker-properties tr:last-child th {\n border-bottom:none;\n}\n.marker-properties tr:nth-child(even) th,\n.marker-properties tr:nth-child(even) td {\n background-color:#f7f7f7;\n}\n </style>\n <script src='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script>\n <script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\" ></script>\n <link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' />\n <!--[if lte IE 8]>\n <link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.ie.css' rel='stylesheet' >\n <![endif]-->\n</head>\n<body>\n<div id='map'></div>\n<script type='text/javascript'>\nvar map = L.mapbox.map('map');\n\nL.mapbox.tileLayer('tmcw.map-ajwqaq7t', {\n retinaVersion: 'tmcw.map-u8vb5w83',\n detectRetina: true\n}).addTo(map);\n\nmap.attributionControl.addAttribution('<a href=\"http://geojson.io/\">geojson.io</a>');\n$.getJSON('map.geojson', function(geojson) {\n var geojsonLayer = L.geoJson(geojson).addTo(map);\n map.fitBounds(geojsonLayer.getBounds());\n geojsonLayer.eachLayer(function(l) {\n showProperties(l);\n });\n});\nfunction showProperties(l) {\n var properties = l.toGeoJSON().properties, table = '';\n for (var key in properties) {\n table += '<tr><th>' + key + '</th>' +\n '<td>' + properties[key] + '</td></tr>';\n }\n if (table) l.bindPopup('<table class=\"marker-properties display\">' + table + '</table>');\n}\n</script>\n</body>\n</html>\n";
tmpl = "<!DOCTYPE html>\n<html>\n<head>\n <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />\n <style>\n body { margin:0; padding:0; }\n #map { position:absolute; top:0; bottom:0; width:100%; }\n .marker-properties {\n border-collapse:collapse;\n font-size:11px;\n border:1px solid #eee;\n margin:0;\n}\n.marker-properties th {\n white-space:nowrap;\n border:1px solid #eee;\n padding:5px 10px;\n}\n.marker-properties td {\n border:1px solid #eee;\n padding:5px 10px;\n}\n.marker-properties tr:last-child td,\n.marker-properties tr:last-child th {\n border-bottom:none;\n}\n.marker-properties tr:nth-child(even) th,\n.marker-properties tr:nth-child(even) td {\n background-color:#f7f7f7;\n}\n </style>\n <script src='//api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.js'></script>\n <script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\" ></script>\n <link href='//api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.css' rel='stylesheet' />\n</head>\n<body>\n<div id='map'></div>\n<script type='text/javascript'>\nvar map = L.mapbox.map('map');\n\nL.mapbox.tileLayer('tmcw.map-ajwqaq7t', {\n retinaVersion: 'tmcw.map-u8vb5w83',\n detectRetina: true\n}).addTo(map);\n\n$.getJSON('map.geojson', function(geojson) {\n var geojsonLayer = L.geoJson(geojson).addTo(map);\n var bounds = geojsonLayer.getBounds();\n if (bounds.isValid()) {\n map.fitBounds(geojsonLayer.getBounds());\n } else {\n map.setView([0, 0], 2);\n }\n geojsonLayer.eachLayer(function(l) {\n showProperties(l);\n });\n});\n\nfunction showProperties(l) {\n var properties = l.toGeoJSON().properties, table = '';\n for (var key in properties) {\n table += '<tr><th>' + key + '</th>' +\n '<td>' + properties[key] + '</td></tr>';\n }\n if (table) l.bindPopup('<table class=\"marker-properties display\">' + table + '</table>');\n}\n</script>\n</body>\n</html>\n";
module.exports.save = save;
module.exports.saveBlocks = saveBlocks;
@@ -20976,7 +20977,8 @@ module.exports = function(context) {
};
},{"./flash":125}],132:[function(require,module,exports){
var gist = require('../source/gist');
var gist = require('../source/gist'),
modal = require('./modal');
module.exports = share;
@@ -20994,34 +20996,44 @@ function emailUrl(_) {
function share(context) {
return function(selection) {
gist.saveBlocks(context.data.get('map'), function(err, res) {
var m = modal(d3.select('div.geojsonio'));
m.select('.m')
.attr('class', 'modal-splash modal col6');
selection.select('.share').remove();
var sel = selection.append('div')
.attr('class', 'share pad1');
var embed_html = sel
.append('input')
.attr('type', 'text')
.attr('title', 'Embed HTML');
var content = m.select('.content');
sel.append('a')
.attr('class', 'icon-remove')
.on('click', function() { sel.remove(); });
content.append('div')
.attr('class', 'header pad2 fillD')
.append('h1')
.text('Share');
gist.saveBlocks(context.data.get('map'), function(err, res) {
if (err) return;
if (res) {
embed_html.property('value',
'<iframe frameborder="0" width="100%" height="300" ' +
'src="http://bl.ocks.org/d/' + res.id + '"></iframe>');
embed_html.node().select();
if (err || !res) {
content
.append('div')
.attr('class', 'pad2')
.text('Could not share: an error occurred: ' + err);
} else {
var container = content.append('div')
.attr('class', 'pad2');
var input = container.append('input')
.style('width', '100%')
.property('value', '<iframe frameborder="0" width="100%" height="300" ' +
'src="http://bl.ocks.org/d/' + res.id + '"></iframe>');
container.append('p')
.text('This is an iframe embed, a snippet of HTML code you can copy and paste onto a webpage to add this map.');
var url = container.append('input')
.style('width', '100%')
.property('value', 'http://bl.ocks.org/d/' + res.id);
container.append('p')
.text('URL to the full-screen map in that embed');
input.node().select();
}
});
};
}
},{"../source/gist":119}],133:[function(require,module,exports){
},{"../source/gist":119,"./modal":129}],133:[function(require,module,exports){
module.exports = function(context) {
return function(selection) {
var name = selection.append('a')
Oops, something went wrong.

0 comments on commit 77be4d1

Please sign in to comment.