From 4b9efea13431da3057fb69d8f6c943aa805d9e0a Mon Sep 17 00:00:00 2001 From: Brandon Tilley Date: Thu, 2 Jan 2014 09:06:50 -0800 Subject: [PATCH] Update site --- documentation/builtin.html | 4 + documentation/builtin_borders.html | 4 + documentation/builtin_drag.html | 4 + documentation/builtin_earth.html | 4 + documentation/builtin_land.html | 4 + documentation/builtin_oceans.html | 4 + documentation/builtin_pings.html | 4 + documentation/builtin_topojson.html | 4 + documentation/builtin_zoom.html | 4 + documentation/core.html | 19 +-- documentation/faq.html | 41 +------ documentation/help.html | 4 + documentation/index.html | 6 +- documentation/installation.html | 173 ++++++++++++++++++++++++++++ documentation/planet.html | 4 + documentation/plugins.html | 4 + download/index.html | 20 ++-- js/lib/planetaryjs.min.js | 2 +- 18 files changed, 245 insertions(+), 64 deletions(-) create mode 100644 documentation/installation.html diff --git a/documentation/builtin.html b/documentation/builtin.html index c956788..8307282 100644 --- a/documentation/builtin.html +++ b/documentation/builtin.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_borders.html b/documentation/builtin_borders.html index 97fb6d6..9c360d6 100644 --- a/documentation/builtin_borders.html +++ b/documentation/builtin_borders.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_drag.html b/documentation/builtin_drag.html index 8fd18c9..b9a2e78 100644 --- a/documentation/builtin_drag.html +++ b/documentation/builtin_drag.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_earth.html b/documentation/builtin_earth.html index 7be349f..31dd8e3 100644 --- a/documentation/builtin_earth.html +++ b/documentation/builtin_earth.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_land.html b/documentation/builtin_land.html index a81bc54..6930318 100644 --- a/documentation/builtin_land.html +++ b/documentation/builtin_land.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_oceans.html b/documentation/builtin_oceans.html index 504c22d..07e0adf 100644 --- a/documentation/builtin_oceans.html +++ b/documentation/builtin_oceans.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_pings.html b/documentation/builtin_pings.html index 5236a7f..8a6cec3 100644 --- a/documentation/builtin_pings.html +++ b/documentation/builtin_pings.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_topojson.html b/documentation/builtin_topojson.html index 29997b9..bc39cb4 100644 --- a/documentation/builtin_topojson.html +++ b/documentation/builtin_topojson.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/builtin_zoom.html b/documentation/builtin_zoom.html index 77c4a51..527b736 100644 --- a/documentation/builtin_zoom.html +++ b/documentation/builtin_zoom.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/core.html b/documentation/core.html index b5255f8..2b3cbd8 100644 --- a/documentation/core.html +++ b/documentation/core.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API @@ -86,21 +90,6 @@

Core API

-

Installation

-

Once you've downloaded Planetary.js, you can include it via a script tag on your page after the inclusion of D3 and TopoJSON. This example uses the CDN URLs for those libraries:

-
-
HTML
- -
<html>
-<head>
-  <script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>
-  <script type='text/javascript' src='http://d3js.org/topojson.v1.min.js'></script>
-  <script type='text/javascript' src='path/to/planetaryjs.min.js'></script>
-</head>
-<body>
-...
-

-

If you use the default topojson plugin (most people will), you'll also need to make sure world-110m.json (or some other TopoJSON data file) is available on your server. This file is also available from the download page. See the TopoJSON Plugin documentation for more information.

Core API

planetaryjs.noConflict()

In non-AMD and non-CommonJS environments, Planetary.js takes over the global planetaryjs namespace (in the browser, this means window.planetaryjs). If, for some reason, something else useful was there before you loaded Planetary.js, you can ask for it to be returned to that spot by calling planetaryjs.noConflict(). The Planetary.js library will be returned from the function, so you can continue to use the library.

diff --git a/documentation/faq.html b/documentation/faq.html index eefe4f1..fb8930a 100644 --- a/documentation/faq.html +++ b/documentation/faq.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API @@ -119,43 +123,6 @@ planet's draw method.

Q: I'm getting "Cannot read property 'geo' of undefined" or "Cannot call method 'feature' of undefined."

A: Ensure you're requiring the D3 and TopoJSON libraries before Planetary.js.

-
- -
- -

Q: Can I use Planetary.js with AMD or CommonJS?

-

A: Yes and no. Planetary.js uses a universal module definition, and so is compatible with AMD and CommonJS. However, neither D3 nor TopoJSON support AMD, and TopoJSON's CommonJS package (as installed with npm) uses Node-specific functionality, so you can't, for instance, browserify it directly.

-

AMD

-

This example uses RequireJS. Since neither D3 nor TopoJSON support AMD, we will use RequireJS's shim configuration.

-
-
HTML
- -
<body>
-  <canvas id='globe' width='500' height='500'></canavs>
-  <script src='//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.9/require.min.js'
-    data-main='/app.js'></script>
-</body>
-
JavaScript
- -
requirejs.config({
-  // Tell RequireJS to use `window.d3` and `window.topojson`
-  // for those libraries, respectively
-  shim: {
-    d3: { exports: 'd3' },
-    topojson: { exports: 'topojson' }
-  },
-  paths: {
-    'd3': 'path/to/d3.v3.min',
-    'topojson': 'path/to/topojson.v1.min'
-  }
-});
-
-requirejs(['planetaryjs'], function(planetaryjs) {
-  // Use Planetary.js here
-});
-

-

CommonJS

-

To use Planetary.js with a tool like Browserify, you will need to create a shim for TopoJSON (D3 includes a Browserify-compatible script). Take a look at browserify-shim for more information.

diff --git a/documentation/help.html b/documentation/help.html index e653286..8290351 100644 --- a/documentation/help.html +++ b/documentation/help.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/index.html b/documentation/index.html index 6ced982..529bede 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API @@ -97,7 +101,7 @@
  • Getting Help describes what to do if you still need help after reading this documentation.
  • Quick Start

    -

    If you want to get up-and-running quickly, or like to experiment and figure things out, you can use this HTML and JavaScript to get a very simple globe up and running.

    +

    If you want to get up-and-running quickly, or like to experiment and figure things out, you can use this HTML and JavaScript to get a very simple globe up and running (once you've installed Planetary.js).

    Note that you'll need to run this page from a web server of some kind so that Planetary.js can load the TopoJSON data via Ajax (Ajax requests don't work when viewing a page directly from the filesystem).

    Be sure to check out the examples as well!

    diff --git a/documentation/installation.html b/documentation/installation.html new file mode 100644 index 0000000..cd0b345 --- /dev/null +++ b/documentation/installation.html @@ -0,0 +1,173 @@ + + + + Planetary.js: Awesome interactive globes for the web + + + + + + + + + + + + + + + + +
    +
    + + +
    +

    Installation

    +

    Once you've downloaded Planetary.js, you can include it via a script tag on your page after the inclusion of D3 and TopoJSON. This example uses the CDN URLs for those libraries:

    +
    +
    HTML
    + +
    <html>
    +<head>
    +  <script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>
    +  <script type='text/javascript' src='http://d3js.org/topojson.v1.min.js'></script>
    +  <script type='text/javascript' src='path/to/planetaryjs.min.js'></script>
    +</head>
    +<body>
    +...
    +

    +

    If you use the default topojson plugin (most people will), you'll also need to make sure world-110m.json (or some other TopoJSON data file) is available on your server. This file is also available from the download page. See the TopoJSON Plugin documentation for more information.

    +

    Planetary.js also supports installation via AMD and CommonJS loaders.

    +

    AMD

    +

    This example uses RequireJS. Since neither D3 nor TopoJSON support AMD, we will use RequireJS's shim configuration.

    +
    +
    HTML
    + +
    <body>
    +  <canvas id='globe' width='500' height='500'></canavs>
    +  <script src='//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.9/require.min.js'
    +    data-main='/app.js'></script>
    +</body>
    +
    JavaScript
    + +
    requirejs.config({
    +  // Tell RequireJS to use `window.d3` and `window.topojson`
    +  // for those libraries, respectively
    +  shim: {
    +    d3: { exports: 'd3' },
    +    topojson: { exports: 'topojson' }
    +  },
    +  paths: {
    +    'd3': 'path/to/d3.v3.min',
    +    'topojson': 'path/to/topojson.v1.min'
    +  }
    +});
    +
    +requirejs(['planetaryjs'], function(planetaryjs) {
    +  // Use Planetary.js here
    +});
    +

    +

    CommonJS

    +
    +There is a pull request open on the TopoJSON project to make this process more intuitive; these instructions will be updated based on its acceptance. +
    + +

    First, install browserify and brfs from npm (as well as planetary.js, if you haven't already). Then, create your application (here referred to as app.js) and bundle it with browserify, running the dependencies through brfs.

    +
    +
    JavaScript
    + +
    var planetaryjs = require('planetary.js');
    +
    +var planet = planetaryjs.planet();
    +var canvas = document.getElementById('canvas');
    +planet.draw(canvas);
    +
    Shell
    + +
    $ npm install browserify brfs
    +$ ./node_modules/.bin/browserify --g brfs app.js > bundle.js
    +

    +

    bundle.js is now ready to use!

    + +
    +
    +
    + + + + + diff --git a/documentation/planet.html b/documentation/planet.html index c0da4e1..98c52ed 100644 --- a/documentation/planet.html +++ b/documentation/planet.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/documentation/plugins.html b/documentation/plugins.html index a50747a..e094fc4 100644 --- a/documentation/plugins.html +++ b/documentation/plugins.html @@ -45,6 +45,10 @@ Introduction + + Installation + + Core API diff --git a/download/index.html b/download/index.html index 24e8362..ee02a8f 100644 --- a/download/index.html +++ b/download/index.html @@ -55,40 +55,40 @@ -

    Latest Stable Build: v1.0.0

    -

    Release notes +

    Latest Stable Build: v1.0.1

    +

    Release notes | - GitHub tag

    + GitHub tag

    Core library: [ - minified + minified | - unminified + unminified ]
    Core library (no plugins): [ - minified + minified | - unminified + unminified ]
    Earth TopoJSON data ("land" and "countries" objects): [ - download + download ]
    Source code [ - .zip + .zip | - .tar.gz + .tar.gz ]
    diff --git a/js/lib/planetaryjs.min.js b/js/lib/planetaryjs.min.js index fc24251..d277ae8 100644 --- a/js/lib/planetaryjs.min.js +++ b/js/lib/planetaryjs.min.js @@ -1,2 +1,2 @@ -/*! Planetary.js 1.0.0 | (c) 2013 Brandon Tilley | Released under MIT License */ +/*! Planetary.js 1.0.1 | (c) 2013 Brandon Tilley | Released under MIT License */ !function(n,t){"function"==typeof define&&define.amd?define(["d3","topojson"],t):"object"==typeof exports?module.exports=t(require("d3"),require("topojson")):n.planetaryjs=t(n.d3,n.topojson,n)}(this,function(n,t,o){"use strict";var i=null;o&&(i=o.planetaryjs);var e=[],r=function(t,o,i){n.timer(function(){t.context.clearRect(0,0,o.width,o.height);for(var n=0;n=0;o--)t.unshift(e[o]);for(0===t.length&&(u.plugins.earth&&n.loadPlugin(u.plugins.earth()),u.plugins.pings&&n.loadPlugin(u.plugins.pings())),o=0;o=o.onInit.length?r(n,t,o):e(l)};e(l)}else r(n,t,o)},c=function(n,t,o,i){l(n,o),n.canvas=t,n.context=t.getContext("2d"),a(n,t,i)},u={plugins:{},noConflict:function(){return o.planetaryjs=i,u},loadPlugin:function(n){e.push(n)},planet:function(){var t=[],o={onInit:[],onDraw:[]},i={plugins:{},draw:function(n){c(i,n,t,o)},onInit:function(n){o.onInit.push(n)},onDraw:function(n){o.onDraw.push(n)},loadPlugin:function(n){t.push(n)},withSavedContext:function(n){if(!this.context)throw new Error("No canvas to fetch context for");this.context.save(),n(this.context),this.context.restore()}};return i.projection=n.geo.orthographic().clipAngle(90).precision(0),i.path=n.geo.path().projection(i.projection),i}};return u.plugins.topojson=function(t){return function(o){o.plugins.topojson={},o.onInit(function(i){if(t.world)o.plugins.topojson.world=t.world,setTimeout(i,0);else{var e=t.file||"world-110m.json";n.json(e,function(n,t){if(n)throw new Error("Could not load JSON "+e);o.plugins.topojson.world=t,i()})}})}},u.plugins.oceans=function(n){return function(t){t.onDraw(function(){t.withSavedContext(function(o){o.beginPath(),t.path.context(o)({type:"Sphere"}),o.fillStyle=n.fill||"black",o.fill()})})}},u.plugins.land=function(n){return function(o){var i=null;o.onInit(function(){var n=o.plugins.topojson.world;i=t.feature(n,n.objects.land)}),o.onDraw(function(){o.withSavedContext(function(t){t.beginPath(),o.path.context(t)(i),n.fill!==!1&&(t.fillStyle=n.fill||"white",t.fill()),n.stroke&&(n.lineWidth&&(t.lineWidth=n.lineWidth),t.strokeStyle=n.stroke,t.stroke())})})}},u.plugins.borders=function(n){return function(o){var i=null,e={internal:function(n,t){return n.id!==t.id},external:function(n,t){return n.id===t.id},both:function(){return!0}};o.onInit(function(){var r=o.plugins.topojson.world,l=r.objects.countries,a=n.type||"internal";i=t.mesh(r,l,e[a])}),o.onDraw(function(){o.withSavedContext(function(t){t.beginPath(),o.path.context(t)(i),t.strokeStyle=n.stroke||"gray",n.lineWidth&&(t.lineWidth=n.lineWidth),t.stroke()})})}},u.plugins.earth=function(n){n=n||{};var t=n.topojson||{},o=n.oceans||{},i=n.land||{},e=n.borders||{};return function(n){u.plugins.topojson(t)(n),u.plugins.oceans(o)(n),u.plugins.land(i)(n),u.plugins.borders(e)(n)}},u.plugins.pings=function(t){var o=[];t=t||{};var i=function(n,i,e){e=e||{},e.color=e.color||t.color||"white",e.angle=e.angle||t.angle||5,e.ttl=e.ttl||t.ttl||2e3;var r={time:new Date,options:e};t.latitudeFirst?(r.lat=n,r.lng=i):(r.lng=n,r.lat=i),o.push(r)},e=function(n,t,i){for(var e=[],l=0;l90&&(e[1]=90),e[1]<-90&&(e[1]=-90),e[0]>=180&&(e[0]-=360),t.projection.rotate(e),l.call(t)});n.select(t.canvas).call(o)})}},u}); \ No newline at end of file