├── .gitignore
├── .meteor
├── .gitignore
├── release
├── platforms
├── .id
├── .finished-upgraders
├── packages
└── versions
├── readme.md
├── server
├── server.js
└── policy.js
├── client
├── main.html
├── styles.css
└── client.js
└── mobile-config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.meteor/.gitignore:
--------------------------------------------------------------------------------
1 | local
2 |
--------------------------------------------------------------------------------
/.meteor/release:
--------------------------------------------------------------------------------
1 | METEOR@1.8.0.1
2 |
--------------------------------------------------------------------------------
/.meteor/platforms:
--------------------------------------------------------------------------------
1 | android
2 | browser
3 | ios
4 | server
5 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Leaflet for Meteor Demo
2 |
3 | ## Demo
4 | meteor
5 |
6 | ## License
7 | MIT
8 |
--------------------------------------------------------------------------------
/.meteor/.id:
--------------------------------------------------------------------------------
1 | # This file contains a token that is unique to your project.
2 | # Check it into your repository along with the rest of this directory.
3 | # It can be used for purposes such as:
4 | # - ensuring you don't accidentally deploy one app on top of another
5 | # - providing package authors with aggregated statistics
6 |
7 | c4g1f6yut211rs2bqp
8 |
--------------------------------------------------------------------------------
/server/server.js:
--------------------------------------------------------------------------------
1 | // marker collection
2 | var Markers = new Meteor.Collection('markers');
3 | Meteor.publish("markers", function () {
4 | return Markers.find();
5 | });
6 |
7 | // Listen to incoming HTTP requests, can only be used on the server
8 | WebApp.connectHandlers.use(function(req, res, next) {
9 | res.setHeader("Access-Control-Allow-Origin", "*");
10 | return next();
11 | });
12 |
--------------------------------------------------------------------------------
/server/policy.js:
--------------------------------------------------------------------------------
1 | // setup local CORS for Cordova testing
2 | BrowserPolicy.content.allowOriginForAll("meteor.local");
3 | BrowserPolicy.content.allowOriginForAll("*.openstreetmap.org");
4 | BrowserPolicy.content.allowOriginForAll("stamen-tiles-a.a.ssl.fastly.net");
5 | BrowserPolicy.content.allowOriginForAll("stamen-tiles-b.a.ssl.fastly.net");
6 | BrowserPolicy.content.allowOriginForAll("stamen-tiles-c.a.ssl.fastly.net");
7 | BrowserPolicy.content.allowOriginForAll("stamen-tiles-d.a.ssl.fastly.net");
8 |
--------------------------------------------------------------------------------
/client/main.html:
--------------------------------------------------------------------------------
1 |
2 | Meteor Leaflet Demo
3 |
4 |
5 |
6 |
7 | {{> map}}
8 |
9 |
10 |
11 |
12 |
Meteor Leaflet Demo
13 |
14 |
15 | Double-click on map creates a marker
16 | Click on a marker to delete it
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/mobile-config.js:
--------------------------------------------------------------------------------
1 | // basic info
2 | App.info({
3 | name: 'meteor-leaflet-demo',
4 | description: 'Meteor Leaflet Demo',
5 | author: 'Bevan Hunt',
6 | email: 'bevan@bevanhunt.com',
7 | website: 'http://bevanhunt.com'
8 | });
9 |
10 | // CORS for Meteor app
11 | App.accessRule('meteor.local/*');
12 | // allow tiles
13 | App.accessRule('*.openstreetmap.org/*');
14 | App.accessRule('stamen-tiles-a.a.ssl.fastly.net/*');
15 | App.accessRule('stamen-tiles-b.a.ssl.fastly.net/*');
16 | App.accessRule('stamen-tiles-c.a.ssl.fastly.net/*');
17 | App.accessRule('stamen-tiles-d.a.ssl.fastly.net/*');
18 |
--------------------------------------------------------------------------------
/.meteor/.finished-upgraders:
--------------------------------------------------------------------------------
1 | # This file contains information which helps Meteor properly upgrade your
2 | # app when you run 'meteor update'. You should check it into version control
3 | # with your project.
4 |
5 | notices-for-0.9.0
6 | notices-for-0.9.1
7 | 0.9.4-platform-file
8 | notices-for-facebook-graph-api-2
9 | 1.2.0-standard-minifiers-package
10 | 1.2.0-meteor-platform-split
11 | 1.2.0-cordova-changes
12 | 1.2.0-breaking-changes
13 | 1.3.0-split-minifiers-package
14 | 1.4.0-remove-old-dev-bundle-link
15 | 1.4.1-add-shell-server-package
16 | 1.4.3-split-account-service-packages
17 | 1.5-add-dynamic-import-package
18 | 1.7-split-underscore-from-meteor-base
19 |
--------------------------------------------------------------------------------
/.meteor/packages:
--------------------------------------------------------------------------------
1 | # Meteor packages used by this project, one per line.
2 | # Check this file (and the other files in this directory) into your repository.
3 | #
4 | # 'meteor add' and 'meteor remove' will edit this file for you,
5 | # but you can also edit it by hand.
6 |
7 | insecure@1.0.7
8 | webapp@1.7.1
9 | browser-policy@1.1.0
10 | meteor-base@1.4.0
11 | mobile-experience@1.0.5
12 | mongo@1.6.0
13 | blaze-html-templates@1.0.4
14 | session@1.2.0
15 | jquery@1.11.10
16 | tracker@1.2.0
17 | logging@1.1.20
18 | reload@1.2.0
19 | random@1.1.0
20 | ejson@1.1.0
21 | spacebars@1.0.12
22 | check@1.3.1
23 | standard-minifier-css@1.5.2
24 | standard-minifier-js@2.4.0
25 | shell-server@0.4.0
26 | bevanhunt:leaflet
27 | crosswalk@1.7.1
28 | dynamic-import@0.5.0
29 | underscore
30 |
--------------------------------------------------------------------------------
/client/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | margin: 0;
3 | padding: 0;
4 | }
5 |
6 | body {
7 | font-family: Arial;
8 | }
9 |
10 | #container {
11 | width: 100%;
12 | margin: 15px auto 0 auto;
13 | }
14 |
15 | .map {
16 | border: solid 1px black;
17 | }
18 |
19 | .title {
20 | margin-top: 0;
21 | margin-bottom: 10px;
22 | text-align: center;
23 | }
24 |
25 | .notice {
26 | margin: 10px 0 5px 0;
27 | line-height: 1.5;
28 | text-align: center;
29 | }
30 |
31 | @media all and (max-width: 480px) {
32 | /* styles for iPhone/Android landscape (and really narrow browser windows) */
33 | .notice {
34 | font-size: 11px;
35 | }
36 | }
37 |
38 | @media all and (max-width: 320px) {
39 | /* styles for iPhone/Android portrait */
40 | .notice {
41 | font-size: 11px;
42 | }
43 | }
44 |
45 | @media all and (max-width: 240px) {
46 | /* styles for smaller devices */
47 | .notice{
48 | font-size: 11px;
49 | }
50 | }
--------------------------------------------------------------------------------
/client/client.js:
--------------------------------------------------------------------------------
1 | // on startup run resizing event
2 | Meteor.startup(function() {
3 | $(window).resize(function() {
4 | $('#map').css('height', window.innerHeight - 82 - 45);
5 | });
6 | $(window).resize(); // trigger resize event
7 | });
8 |
9 | // create marker collection
10 | var Markers = new Meteor.Collection('markers');
11 |
12 | Meteor.subscribe('markers');
13 |
14 | Template.map.rendered = function() {
15 | L.Icon.Default.imagePath = '/packages/bevanhunt_leaflet/images/';
16 |
17 | var map = L.map('map', {
18 | doubleClickZoom: false
19 | }).setView([49.25044, -123.137], 13);
20 |
21 | L.tileLayer.provider('Stamen.Watercolor').addTo(map);
22 |
23 | map.on('dblclick', function(event) {
24 | Markers.insert({latlng: event.latlng});
25 | });
26 |
27 | // add clustermarkers
28 | var markers = L.markerClusterGroup();
29 | map.addLayer(markers);
30 |
31 | var query = Markers.find();
32 | query.observe({
33 | added: function (document) {
34 | var marker = L.marker(document.latlng)
35 | .on('click', function(event) {
36 | Markers.remove({_id: document._id});
37 | });
38 | markers.addLayer(marker);
39 | },
40 | removed: function (oldDocument) {
41 | layers = map._layers;
42 | var key, val;
43 | for (key in layers) {
44 | val = layers[key];
45 | if (val._latlng) {
46 | if (val._latlng.lat === oldDocument.latlng.lat && val._latlng.lng === oldDocument.latlng.lng) {
47 | markers.removeLayer(val);
48 | }
49 | }
50 | }
51 | }
52 | });
53 | };
54 |
--------------------------------------------------------------------------------
/.meteor/versions:
--------------------------------------------------------------------------------
1 | allow-deny@1.1.0
2 | autoupdate@1.5.0
3 | babel-compiler@7.2.4
4 | babel-runtime@1.3.0
5 | base64@1.0.11
6 | bevanhunt:leaflet@3.2.0
7 | binary-heap@1.0.11
8 | blaze@2.3.3
9 | blaze-html-templates@1.1.2
10 | blaze-tools@1.0.10
11 | boilerplate-generator@1.6.0
12 | browser-policy@1.1.0
13 | browser-policy-common@1.0.11
14 | browser-policy-content@1.1.0
15 | browser-policy-framing@1.1.0
16 | caching-compiler@1.2.1
17 | caching-html-compiler@1.1.3
18 | callback-hook@1.1.0
19 | check@1.3.1
20 | crosswalk@1.7.1
21 | ddp@1.4.0
22 | ddp-client@2.3.3
23 | ddp-common@1.4.0
24 | ddp-server@2.2.0
25 | deps@1.0.12
26 | diff-sequence@1.1.1
27 | dynamic-import@0.5.1
28 | ecmascript@0.12.4
29 | ecmascript-runtime@0.7.0
30 | ecmascript-runtime-client@0.8.0
31 | ecmascript-runtime-server@0.7.1
32 | ejson@1.1.0
33 | es5-shim@4.8.0
34 | fetch@0.1.0
35 | geojson-utils@1.0.10
36 | hot-code-push@1.0.4
37 | html-tools@1.0.11
38 | htmljs@1.0.11
39 | id-map@1.1.0
40 | insecure@1.0.7
41 | inter-process-messaging@0.1.0
42 | jquery@1.11.11
43 | launch-screen@1.1.1
44 | livedata@1.0.18
45 | logging@1.1.20
46 | meteor@1.9.2
47 | meteor-base@1.4.0
48 | minifier-css@1.4.1
49 | minifier-js@2.4.0
50 | minimongo@1.4.5
51 | mobile-experience@1.0.5
52 | mobile-status-bar@1.0.14
53 | modern-browsers@0.1.3
54 | modules@0.13.0
55 | modules-runtime@0.10.3
56 | mongo@1.6.0
57 | mongo-decimal@0.1.0
58 | mongo-dev-server@1.1.0
59 | mongo-id@1.0.7
60 | npm-mongo@3.1.1
61 | observe-sequence@1.0.16
62 | ordered-dict@1.1.0
63 | promise@0.11.2
64 | random@1.1.0
65 | reactive-dict@1.2.1
66 | reactive-var@1.0.11
67 | reload@1.2.0
68 | retry@1.1.0
69 | routepolicy@1.1.0
70 | session@1.2.0
71 | shell-server@0.4.0
72 | socket-stream-client@0.2.2
73 | spacebars@1.0.15
74 | spacebars-compiler@1.1.3
75 | standard-minifier-css@1.5.2
76 | standard-minifier-js@2.4.0
77 | templating@1.3.2
78 | templating-compiler@1.3.3
79 | templating-runtime@1.3.2
80 | templating-tools@1.1.2
81 | tracker@1.2.0
82 | ui@1.0.13
83 | underscore@1.0.10
84 | webapp@1.7.2
85 | webapp-hashing@1.0.9
86 |
--------------------------------------------------------------------------------