Use global carto if present, otherwise fallback to require.

This commit is contained in:
Raul Ochoa 2014-12-09 18:05:11 +01:00
parent d44b2db551
commit 1e83584d12
16 changed files with 2281 additions and 2240 deletions

View File

@ -11,12 +11,12 @@ JS_CLIENT_FILES= lib/torque/*.js \
all: dist/torque.js dist/torque.full.js all: dist/torque.js dist/torque.full.js
dist/torque.full.js: dist_folder dist/torque.uncompressed.js dist/torque.full.js: dist_folder dist/torque.uncompressed.js
cat vendor/carto.js dist/torque.uncompressed.js > dist/_torque.full.js browserify lib/torque/index.js --standalone torque > dist/_torque.full.js
$(UGLIFYJS) dist/_torque.full.js > dist/torque.full.js $(UGLIFYJS) dist/_torque.full.js > dist/torque.full.js
rm -rf dist/_torque.full.js rm -rf dist/_torque.full.js
dist/torque.uncompressed.js: dist_folder $(JS_CLIENT_FILES) dist/torque.uncompressed.js: dist_folder $(JS_CLIENT_FILES)
cat $(JS_CLIENT_FILES) > dist/torque.uncompressed.js browserify lib/torque/index.js --no-bundle-external --standalone torque > dist/torque.uncompressed.js
dist/torque.js: dist_folder dist/torque.uncompressed.js dist/torque.js: dist_folder dist/torque.uncompressed.js
$(UGLIFYJS) dist/torque.uncompressed.js > dist/torque.js $(UGLIFYJS) dist/torque.uncompressed.js > dist/torque.js

12
dist/torque.full.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<html> <html>
<link rel="stylesheet" href="../vendor/leaflet.css" /> <link rel="stylesheet" href="vendor/leaflet.css" />
<style> <style>
#map, html, body { #map, html, body {
width: 100%; height: 100%; padding: 0; margin: 0; width: 100%; height: 100%; padding: 0; margin: 0;
@ -10,8 +10,7 @@
<div id="map"></div> <div id="map"></div>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.uncompressed.js"></script> <script src="../dist/torque.uncompressed.js"></script>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<link rel="stylesheet" href="../vendor/leaflet.css" /> <link rel="stylesheet" href="vendor/leaflet.css" />
<style> <style>
#map, html, body { #map, html, body {
width: 100%; height: 100%; padding: 0; margin: 0; width: 100%; height: 100%; padding: 0; margin: 0;
@ -9,19 +9,9 @@
<body> <body>
<div id="map"></div> <div id="map"></div>
<script src="../vendor/leaflet.js"></script> <script src="vendor/leaflet.js"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script> <script src="../dist/torque.uncompressed.js"></script>
<script src="../lib/torque/cartocss_reference.js"></script>
<script src="../lib/torque/profiler.js"></script>
<script src="../lib/torque/request.js"></script>
<script src="../lib/torque/leaflet/leaflet_tileloader_mixin.js"></script>
<script src="../lib/torque/leaflet/canvas_layer.js"></script>
<script src="../lib/torque/renderer/point.js"></script>
<script src="../lib/torque/renderer/rectangle.js"></script>
<script src="../lib/torque/provider.json.js"></script>
<script src="../lib/torque/provider.jsonarray.js"></script>
<script src="../lib/torque/leaflet/torque.js"></script>
<script> <script>

View File

@ -1,6 +1,6 @@
<html> <html>
<link rel="stylesheet" href="../vendor/leaflet.css" /> <link rel="stylesheet" href="vendor/leaflet.css" />
<style> <style>
#map, html, body { #map, html, body {
width: 100%; height: 100%; padding: 0; margin: 0; width: 100%; height: 100%; padding: 0; margin: 0;
@ -18,9 +18,8 @@
<div id="map"></div> <div id="map"></div>
<div id="title">Average temperature collected by Britain's Royal Navy (1913-1925)</div> <div id="title">Average temperature collected by Britain's Royal Navy (1913-1925)</div>
<script src="../vendor/leaflet.js"></script> <script src="vendor/leaflet.js"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.uncompressed.js"></script> <script src="../dist/torque.uncompressed.js"></script>

View File

@ -1,6 +1,4 @@
<html> <html>
<link rel="stylesheet" href="../vendor/leaflet.css" />
<style> <style>
#map, html, body { #map, html, body {
width: 100%; height: 100%; padding: 0; margin: 0; width: 100%; height: 100%; padding: 0; margin: 0;
@ -11,11 +9,8 @@
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="vendor/carto.js"></script>
<script src="../vendor/underscore.js"></script> <script src="../dist/torque.uncompressed.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.js"></script>
<script> <script>

View File

@ -1,6 +1,5 @@
<html> <html>
<link rel="stylesheet" href="../vendor/leaflet.css" /> <link rel="stylesheet" href="vendor/leaflet.css" />
<style> <style>
#map, html, body { #map, html, body {
width: 100%; height: 100%; padding: 0; margin: 0; width: 100%; height: 100%; padding: 0; margin: 0;
@ -9,9 +8,8 @@
<body> <body>
<div id="map"></div> <div id="map"></div>
<script src="../vendor/leaflet.js"></script> <script src="vendor/leaflet.js"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.uncompressed.js"></script> <script src="../dist/torque.uncompressed.js"></script>

View File

@ -57,9 +57,8 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="../vendor/leaflet.js"></script> <script src="vendor/leaflet.js"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.uncompressed.js"></script> <script src="../dist/torque.uncompressed.js"></script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -100,9 +100,8 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="../vendor/leaflet.js"></script> <script src="vendor/leaflet.js"></script>
<script src="../vendor/underscore.js"></script> <script src="vendor/carto.js"></script>
<script src="../vendor/carto.js"></script>
<script src="../dist/torque.uncompressed.js"></script> <script src="../dist/torque.uncompressed.js"></script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -117,10 +117,10 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12"></script> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.12"></script>
<script src="vendor/leaflet.js"></script> <script src="examples/vendor/leaflet.js"></script>
<script src="vendor/underscore.js"></script> <script src="examples/vendor/carto.js"></script>
<script src="vendor/carto.js"></script>
<script src="examples/vendor/codemirror.js"></script> <script src="examples/vendor/codemirror.js"></script>
<script src="examples/vendor/css.js"></script> <script src="examples/vendor/css.js"></script>

View File

@ -1,7 +1,7 @@
// //
// common functionallity for torque layers // common functionallity for torque layers
// //
var carto = require('carto'); var carto = global.carto || require('carto');
function TorqueLayer() {} function TorqueLayer() {}

View File

@ -1,5 +1,4 @@
var carto = global.carto || require('carto');
var carto = require('carto');
var CanvasLayer = require('./CanvasLayer'); var CanvasLayer = require('./CanvasLayer');
var CanvasTileLayer = require('./canvas_tile_layer'); var CanvasTileLayer = require('./canvas_tile_layer');
var GMapsTileLoader = require('./gmaps_tileloader_mixin'); var GMapsTileLoader = require('./gmaps_tileloader_mixin');

View File

@ -1,3 +1,4 @@
var carto = global.carto || require('carto');
/** /**
* torque layer * torque layer
*/ */

View File

@ -1,7 +1,7 @@
var torque = require('../'); var torque = require('../');
var cartocss = require('./cartocss_render'); var cartocss = require('./cartocss_render');
var Profiler = require('../profiler'); var Profiler = require('../profiler');
var carto = require('carto'); var carto = global.carto || require('carto');
var TAU = Math.PI * 2; var TAU = Math.PI * 2;
var DEFAULT_CARTOCSS = [ var DEFAULT_CARTOCSS = [

View File

@ -1,4 +1,4 @@
var carto = require('carto'); var carto = global.carto || require('carto');
var DEFAULT_CARTOCSS = [ var DEFAULT_CARTOCSS = [
'#layer {', '#layer {',