]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'osmlab/map-ui'
authorTom Hughes <tom@compton.nu>
Fri, 19 Jul 2013 10:18:12 +0000 (11:18 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 19 Jul 2013 10:18:12 +0000 (11:18 +0100)
42 files changed:
Vendorfile
app/assets/images/sprite.png
app/assets/images/sprite.svg
app/assets/javascripts/application.js
app/assets/javascripts/browse.js
app/assets/javascripts/changeset.js
app/assets/javascripts/diary_entry.js
app/assets/javascripts/edit.js
app/assets/javascripts/embed.js.erb
app/assets/javascripts/index.js
app/assets/javascripts/index/browse.js
app/assets/javascripts/index/export.js
app/assets/javascripts/index/key.js [deleted file]
app/assets/javascripts/index/notes.js.erb
app/assets/javascripts/leaflet.extend.js.erb [new file with mode: 0644]
app/assets/javascripts/leaflet.key.js [new file with mode: 0644]
app/assets/javascripts/leaflet.layers.js [new file with mode: 0644]
app/assets/javascripts/leaflet.note.js [new file with mode: 0644]
app/assets/javascripts/leaflet.share.js [new file with mode: 0644]
app/assets/javascripts/leaflet.sidebar.js [new file with mode: 0644]
app/assets/javascripts/leaflet.zoom.js [new file with mode: 0644]
app/assets/javascripts/map.js.erb
app/assets/javascripts/querystring.js [new file with mode: 0644]
app/assets/javascripts/resize.js [deleted file]
app/assets/javascripts/templates/notes/new.jst.ejs
app/assets/javascripts/user.js
app/assets/stylesheets/common.css.scss
app/assets/stylesheets/large.css
app/assets/stylesheets/leaflet-all.css.scss
app/assets/stylesheets/leaflet.pan.css.scss [deleted file]
app/assets/stylesheets/leaflet.zoom.css.scss [deleted file]
app/assets/stylesheets/small.css.scss
app/views/layouts/site.html.erb
app/views/site/_potlatch2.html.erb
app/views/site/_search.html.erb
app/views/site/_sidebar.html.erb
app/views/site/id.html.erb
app/views/site/index.html.erb
config/locales/en.yml
vendor/assets/leaflet/leaflet.locate.js [new file with mode: 0644]
vendor/assets/leaflet/leaflet.pan.js [deleted file]
vendor/assets/leaflet/leaflet.zoom.js [deleted file]

index 3eee989d3adcf45a784e25046629d9d00d807d85..cc590e8bf8a6406563d5c7e1a538af7e37dd7aea 100644 (file)
@@ -16,12 +16,8 @@ folder 'vendor/assets' do
       folder 'img', 'src/img'
     end
 
-    from 'git://github.com/kartena/Leaflet.Pancontrol.git' do
-      file 'leaflet.pan.js', 'src/L.Control.Pan.js'
-    end
-
-    from 'git://github.com/kartena/Leaflet.zoomslider.git' do
-      file 'leaflet.zoom.js', 'src/L.Control.Zoomslider.js'
+    from 'git://github.com/domoritz/leaflet-locatecontrol.git' do
+      file 'leaflet.locate.js', 'src/L.Control.Locate.js'
     end
 
     from 'git://github.com/jfirebaugh/leaflet-osm.git' do
@@ -32,7 +28,7 @@ folder 'vendor/assets' do
   folder 'jquery' do
     from 'git://github.com/jevin/Autogrow-Textarea.git' do
       file 'jquery.autogrowtextarea.js', 'jquery.autogrowtextarea.js'
-    end  
+    end
   end
 
   folder 'ohauth' do
@@ -42,7 +38,7 @@ folder 'vendor/assets' do
   end
 
   folder 'iD' do
-    from 'git://github.com/systemed/iD', :branch => '1-0-stable' do
+    from 'git://github.com/systemed/iD', :branch => 'release' do
       folder 'iD/img', 'dist/img'
       folder 'iD/locales', 'dist/locales'
       file 'iD.css.erb', 'dist/iD.css' do |path|
index 7b6c6a73f564bcca2933a1274c5ac4d6f40b3f22..9f857f852b8a5c783b4d256474a14a46d5ab68d7 100644 (file)
Binary files a/app/assets/images/sprite.png and b/app/assets/images/sprite.png differ
index bf65021fa6cc07dea7657949b0a3f237444ab8f8..2e1d309e4b60acf7759f946b9103d7210f1874ce 100644 (file)
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="4.7683716"
-     inkscape:cx="8.5527915"
-     inkscape:cy="148.78096"
+     inkscape:zoom="5"
+     inkscape:cx="159.62972"
+     inkscape:cy="181.16738"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="true"
-     inkscape:window-width="1289"
-     inkscape:window-height="904"
+     inkscape:window-width="1280"
+     inkscape:window-height="756"
      inkscape:window-x="0"
      inkscape:window-y="0"
-     inkscape:window-maximized="0">
+     inkscape:window-maximized="0"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:object-paths="true"
+     inkscape:object-nodes="true">
     <inkscape:grid
        type="xygrid"
        id="grid2985"
        visible="true"
        enabled="true"
        snapvisiblegridlinesonly="true" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="20,185"
+       id="guide6892" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="40,185"
+       id="guide6894" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="60,180"
+       id="guide6896" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="80,185"
+       id="guide6898" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="100,185"
+       id="guide6900" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="120,175"
+       id="guide6902" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="140,185"
+       id="guide6904" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="160,190"
+       id="guide6906" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="180,180"
+       id="guide6908" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="50,180"
+       id="guide6910" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="200,180"
+       id="guide10867" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="180,160"
+       id="guide10873" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="220,190"
+       id="guide10875" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="240,160"
+       id="guide10881" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="230,140"
+       id="guide10887" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="260,195"
+       id="guide11761" />
   </sodipodi:namedview>
   <metadata
      id="metadata7">
       </cc:Work>
     </rdf:RDF>
   </metadata>
+  <g
+     inkscape:groupmode="layer"
+     id="layer2"
+     inkscape:label="background"
+     style="display:none">
+    <rect
+       style="color:#000000;fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       id="rect6890"
+       width="300"
+       height="200"
+       x="0"
+       y="0" />
+  </g>
   <g
      inkscape:label="Layer 1"
      inkscape:groupmode="layer"
      id="layer1"
      transform="translate(0,-852.36218)">
-    <path
-       style="color:#000000;fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.55720866px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-       d="m 8.4000012,852.36218 c -3.3137081,0 -5.9999994,2.68629 -5.9999994,6 0,3.31371 2.6862913,6 5.9999994,6 3.3137078,0 5.9999988,-2.68629 5.9999988,-6 0,-3.31371 -2.686291,-6 -5.9999988,-6 z m 0,2.4 c 1.9882248,0 3.5999988,1.61178 3.5999988,3.6 0,1.98822 -1.611774,3.6 -3.5999988,3.6 -1.9882249,0 -3.5999997,-1.61178 -3.5999997,-3.6 0,-1.98822 1.6117748,-3.6 3.5999997,-3.6 z"
-       id="path2987"
-       inkscape:connector-curvature="0" />
-    <rect
-       style="color:#000000;fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.55720866px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-       id="rect3033"
-       width="6.3023868"
-       height="3"
-       x="679.99603"
-       y="-530.39673"
-       transform="matrix(-0.60876143,0.79335334,-0.79335334,-0.60876143,0,0)" />
     <path
        style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-       d="m 1,35 c 0,-1.827643 1,-4 3.75,-4 1.8276427,0 2.75,2 2.75,2 0,0 0.9223573,-2 2.75,-2 C 13,31 14,33.172357 14,35 14,40 7.5,43 7.5,43 7.5,43 1,40 1,35 z"
+       d="m 24,860.36218 c 0,-1.82764 1,-4 3.75,-4 1.827643,0 2.75,2 2.75,2 0,0 0.922357,-2 2.75,-2 2.75,0 3.75,2.17236 3.75,4 0,5 -6.5,8 -6.5,8 0,0 -6.5,-3 -6.5,-8 z"
        id="path3843"
        inkscape:connector-curvature="0"
-       transform="translate(0,852.36218)"
        sodipodi:nodetypes="sscsscs" />
-    <rect
-       style="color:#000000;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-       id="rect3845"
-       width="15"
-       height="60"
-       x="0"
-       y="852.36218"
-       inkscape:export-filename="/Users/tmcw/src/openstreetmap-website/app/assets/images/sprite.png"
+    <path
+       sodipodi:nodetypes="cccccccccccc"
+       inkscape:connector-curvature="0"
+       id="path3361-4"
+       d="m 224,880.36218 2,0 3,3 4.7735,-6 2.2265,0 0,2 -5,6 -1,1 -2,0 -1,-1 -3,-3 z"
+       style="color:#000000;fill:#70cd8f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       sodipodi:nodetypes="cccccccccccccccccc"
+       d="m 129,855.3622 -1.00001,1 0,2 1.00001,1 2.00002,0 1,-1 0,-2 -1.00002,-1 z m 2e-5,6 -1.00001,1 0,6 1.00001,1 1.99998,0 1.00004,-1 -3e-5,-6 -1,-1 z"
+       id="path6912"
+       style="font-size:16.71258354px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:100%;letter-spacing:0px;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate;font-family:Helvetica Neue"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       inkscape:connector-curvature="0"
+       id="path6914"
+       d="m 57,861.36216 -1,-1 -4,0 0,-4 -1,-0.99999 -1,0 -1,1 0,4 -4,0 -1,0.99999 0,1 1,1 4,0 0,3.99999 1,1.00002 1,0 1,-1.00001 0,-3.99999 4,-10e-6 1,-0.99998 0,-1.00002 z"
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate" />
+    <path
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate"
+       d="m 65,860.36216 11,-2e-5 1,1.00002 0,1.00002 -1,0.99997 -11,3e-5 -1,-1.00003 0,-1 z"
+       id="path6916"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ccccccccc"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
        inkscape:export-xdpi="90"
        inkscape:export-ydpi="90" />
     <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       sodipodi:nodetypes="ccccccccc"
+       inkscape:connector-curvature="0"
+       id="path6918"
+       d="m 84,862.36218 0,-2.00001 10,-3.99999 2,1e-5 0,1.99998 -4,10 -2,10e-6 0,-6 z"
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       id="path6920"
+       d="m 155,854.3622 -1,1 0,2 -2,0 c -6,0 -6,7 -6,7 0,0 2,-4 6,-4 0.66667,0 1.33333,0 2,0 l 0,2 1,1 4,-4.5 -4,-4.5 z m -13,4 -1,1 0,9 1,1 10,0 1,-1 0,-2 0,-3 0,-1 -1,0 c -0.3202,-10e-5 -0.6603,0.073 -1,0.1875 l 0,2.8125 0,2 -5.5625,0 a 2.0002,2.0002 0 0 1 -0.90625,0 l -1.53125,0 0,-1.625 a 2.0002,2.0002 0 0 1 0,-0.625 l 0,-2.75 0,-2 1.53125,0 c 0.3433,-0.6691 0.79175,-1.3477 1.34375,-2 l -0.875,0 -3,0 z"
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate"
+       d="m 109.50003,855.3622 -6.50002,3 1e-5,1 6.49998,3 1.00002,0 6.49999,-3 1e-5,-1 -6.50001,-3 -0.99998,0 z m -5.40621,6.5 -1.09377,0.5 -3e-5,1 6.49999,3 1,0 6.50001,-3 0,-1 -1.0937,-0.5 -5.40631,2.5 -0.99998,0 -5.40621,-2.5 z m 0,4 -1.09379,0.5 -2e-5,1 6.50001,3 1.00001,0 6.5,-3 -10e-6,-1 -1.0937,-0.5 -5.40631,2.5 -0.99999,0 -5.4062,-2.5 z"
+       id="path6922"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       inkscape:connector-curvature="0"
+       id="path6924"
+       d="m 170,853.3622 -1,1 0,1 -1,0 -1,1 0,2 7,0 0,-2 -1,-1 -1,0 0,-1 -1,-1 -1,0 z m -5,3 -1,1 0,11 1,1 11,0 1,-1 0,-11 -1,-1 -1,0 0,1 0,2 0,8 -9,0 0,-8 0,-2 0,-1 -1,0 z m 3,4 0,1 5,0 0,-1 -5,0 z m 0,2 0,1 5,0 0,-1 -5,0 z m 0,2 0,1 3,0 0,-1 -3,0 z"
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/Dropbox/new-osm/community-landing-fg-dropdown.png"
+       inkscape:connector-curvature="0"
+       id="path10739"
+       d="m 11.5,855.36218 c 3.0376,0 5.5,2.46243 5.5,5.5 0,3.03757 -2.4624,5.5 -5.5,5.5 -1.0061,0 -1.9387,-0.27827 -2.75,-0.75 l -3.75,3.75 -1,0 -1,-1 0,-1 3.75,-3.75 C 6.2783,862.80084 6,861.86831 6,860.86218 c 0,-3.03757 2.4624,-5.5 5.5,-5.5 z m 0.5,2 -1,0 -2,1 -1,2 0,1 1,2 2,1 1,0 2,-1 1,-2 0,-1 -1,-2 -2,-1 z"
+       style="color:#000000;fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate" />
+    <path
+       style="color:#000000;fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate"
+       d="m 192.00001,854.36218 -2,2 3,0 0,0 3,3 -4.50001,4.5 -2,-2 -1.5,1.5 2.5,2.5 2,0 5.50001,-5.5 0,-2 -4,-4 z m -3.50001,3.5 -5.5,5.5 0,2 4,4 2,0 2,-2 -3,0 0,0 -3,-3 4.5,-4.5 2,2 1.5,-1.5 -2.5,-2.5 z"
+       id="path10871"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccccccccccccccccccccccc" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       id="path10879"
+       d="m 206,857.36218 -1,1 0,1 3,3 -3,3 0,1 1,1 1,0 3,-3 3,3 1,0 1,-1 0,-1 -3,-3 3,-3 0,-1 -1,-1 -1,0 -3,3 -3,-3 -1,0 z"
+       style="color:#000000;fill:#cccccc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       inkscape:connector-curvature="0" />
+    <path
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       d="m 224,860.36218 2,0 3,3 4.7735,-6 2.2265,0 0,2 -5,6 -1,1 -2,0 -1,-1 -3,-3 z"
+       id="path10883"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccccccc" />
+    <path
+       style="color:#000000;fill:#222222;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       d="m 244,864.36218 0,-7 1,-1 10,0 1,1 0,7 -1,1 -3,0 -2,3 -2,-3 -3,0 z"
+       id="path11741"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccccccc" />
+    <path
+       inkscape:export-ydpi="90"
+       inkscape:export-xdpi="90"
+       inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
+       sodipodi:nodetypes="ccccccccc"
        inkscape:connector-curvature="0"
-       id="path6649"
-       d="m 10.21875,898.45593 c -0.51124,0 -1.01451,0.20201 -1.40625,0.59375 l -1.59375,1.59375 c 0.70051,0 1.3332,0.25386 1.84375,0.65625 L 9.5,900.86218 c 0.19587,-0.19587 0.46313,-0.3125 0.71875,-0.3125 0.25562,0 0.52288,0.11663 0.71875,0.3125 L 12,901.92468 c 0.39174,0.39174 0.39174,1.04576 0,1.4375 l -1.0625,1.0625 -1.5,1.5 c -0.39174,0.39174 -1.04576,0.39174 -1.4375,0 l -1.0625,-1.0625 c -0.0772,-0.0772 -0.10948,-0.1877 -0.15625,-0.28125 l -1.3125,1.3125 1.84375,1.84375 c 0.78347,0.78347 2.02903,0.78347 2.8125,0 l 3.6875,-3.6875 c 0.783469,-0.78347 0.783469,-2.02903 0,-2.8125 l -2.1875,-2.1875 c -0.39174,-0.39174 -0.89501,-0.59375 -1.40625,-0.59375 z m -3,3 c -0.51124,0 -1.01451,0.20201 -1.40625,0.59375 l -3.6875,3.6875 c -0.78347,0.78347 -0.78347,2.02903 0,2.8125 l 2.1875,2.1875 c 0.78347,0.78347 2.02903,0.78347 2.8125,0 l 1.59375,-1.59375 c -0.70051,0 -1.3332,-0.25386 -1.84375,-0.65625 l -0.4375,0.4375 c -0.39174,0.39174 -1.04576,0.39174 -1.4375,0 l -1.0625,-1.0625 c -0.39174,-0.39174 -0.39174,-1.04576 0,-1.4375 L 5,905.36218 l 1.5,-1.5 c 0.19587,-0.19587 0.46313,-0.3125 0.71875,-0.3125 0.25562,0 0.52288,0.11663 0.71875,0.3125 L 9,904.92468 c 0.0772,0.0772 0.10948,0.1877 0.15625,0.28125 l 1.3125,-1.3125 -1.84375,-1.84375 c -0.39174,-0.39174 -0.89501,-0.59375 -1.40625,-0.59375 z"
-       style="color:#000000;fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+       id="path6918-2"
+       d="m 84,882.36218 0,-2.00001 10,-3.99999 2,1e-5 0,1.99998 -4,10 -2,10e-6 0,-6 z"
+       style="color:#000000;fill:#70cd8f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter6591-2);enable-background:accumulate" />
   </g>
 </svg>
index f8a8c4520699c160b108a1dc447fe3a1ca4a12c1..cb670da340d0feaf2fbead39da4086e643afef02 100644 (file)
@@ -5,9 +5,9 @@
 //= require augment
 //= require leaflet
 //= require leaflet.osm
-//= require leaflet.locationfilter
-//= require leaflet.pan
 //= require leaflet.zoom
+//= require leaflet.extend
+//= require leaflet.locationfilter
 //= require i18n/translations
 //= require oauth
 //= require osm
 //= require menu
 //= require sidebar
 //= require richtext
-//= require resize
 //= require geocoder
+//= require querystring
+
+var querystring = require('querystring-component');
 
 function zoomPrecision(zoom) {
     var decimals = Math.pow(10, Math.floor(zoom/3));
@@ -26,188 +28,164 @@ function zoomPrecision(zoom) {
     };
 }
 
+function normalBounds(bounds) {
+    if (bounds instanceof L.LatLngBounds) return bounds;
+    return new L.LatLngBounds(
+        new L.LatLng(bounds[0][0], bounds[0][1]),
+        new L.LatLng(bounds[1][0], bounds[1][1]));
+}
+
+function remoteEditHandler(bbox, select) {
+  var loaded = false,
+      query = {
+          left: bbox.getWest() - 0.0001,
+          top: bbox.getNorth() + 0.0001,
+          right: bbox.getEast() + 0.0001,
+          bottom: bbox.getSouth() - 0.0001
+      };
+
+  if (select) query.select = select;
+  $("#linkloader")
+    .attr("src", "http://127.0.0.1:8111/load_and_zoom?" + querystring.stringify(query))
+    .load(function() { loaded = true; });
+
+  setTimeout(function () {
+    if (!loaded) alert(I18n.t('site.index.remote_failed'));
+  }, 1000);
+
+  return false;
+}
+
 /*
- * Called as the user scrolls/zooms around to aniplate hrefs of the
+ * Called as the user scrolls/zooms around to maniplate hrefs of the
  * view tab and various other links
  */
-function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,object) {
+function updatelinks(loc, zoom, layers, bounds, object) {
   var toPrecision = zoomPrecision(zoom);
+  bounds = normalBounds(bounds);
   var node;
 
-  lat = toPrecision(lat);
-  lon = toPrecision(lon);
+  var lat = toPrecision(loc.lat),
+      lon = toPrecision(loc.lon || loc.lng);
 
-  if (minlon) {
-    minlon = toPrecision(minlon);
-    minlat = toPrecision(minlat);
-    maxlon = toPrecision(maxlon);
-    maxlat = toPrecision(maxlat);
+  if (bounds) {
+    var minlon = toPrecision(bounds.getWest()),
+        minlat = toPrecision(bounds.getSouth()),
+        maxlon = toPrecision(bounds.getEast()),
+        maxlat = toPrecision(bounds.getNorth());
   }
 
-  $(".geolink").each(function (index, link) {
-    var args = getArgs(link.href);
+  $(".geolink").each(setGeolink);
+
+  function setGeolink(index, link) {
+    var base = link.href.split('?')[0],
+        qs = link.href.split('?')[1],
+        args = querystring.parse(qs);
 
     if ($(link).hasClass("llz")) {
-      args.lat = lat;
-      args.lon = lon;
-      args.zoom = zoom;
+      $.extend(args, {
+          lat: lat,
+          lon: lon,
+          zoom: zoom
+      });
     } else if (minlon && $(link).hasClass("bbox")) {
-      args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat;
+      $.extend(args, {
+          bbox: minlon + "," + minlat + "," + maxlon + "," + maxlat
+      });
     }
 
-    if (layers && $(link).hasClass("layers")) {
-      args.layers = layers;
-    }
-
-    if (object && $(link).hasClass("object")) {
-      args[object.type] = object.id;
-    }
+    if (layers && $(link).hasClass("layers")) args.layers = layers;
+    if (object && $(link).hasClass("object")) args[object.type] = object.id;
 
     var minzoom = $(link).data("minzoom");
     if (minzoom) {
-        var name = link.id.replace(/anchor$/, "");
-
-        $(link).off("click.minzoom");
-
-        if (zoom >= minzoom) {
-          $(link).attr("title", I18n.t("javascripts.site." + name + "_tooltip"));
-          $(link).removeClass("disabled");
-        } else {
-          $(link).on("click.minzoom", function () { alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false; });
-          $(link).attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"));
-          $(link).addClass("disabled");
-        }
-    }
-
-    link.href = setArgs(link.href, args);
-  });
-
-  $("#shortlinkanchor").each(function () {
-    var args = getArgs(this.href);
-    var code = makeShortCode(lat, lon, zoom);
-    var prefix = shortlinkPrefix();
-
-    // Add ?{node,way,relation}=id to the arguments
-    if (object) {
-      args[object.type] = object.id;
-    }
-
-    // This is a hack to omit the default mapnik layer from the shortlink.
-    if (layers && layers != "M") {
-      args.layers = layers;
-    }
-    else {
-      delete args.layers;
-    }
-
-    // Here we're assuming that all parameters but ?layers= and
-    // ?{node,way,relation}= can be safely omitted from the shortlink
-    // which encodes lat/lon/zoom. If new URL parameters are added to
-    // the main slippy map this needs to be changed.
-    if (args.layers || object) {
-      this.href = setArgs(prefix + "/go/" + code, args);
-    } else {
-      this.href = prefix + "/go/" + code;
+      var name = link.id.replace(/anchor$/, "");
+      $(link).off("click.minzoom");
+      if (zoom >= minzoom) {
+        $(link)
+          .attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
+          .removeClass("disabled");
+      } else {
+        $(link)
+          .attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
+          .addClass("disabled")
+          .on("click.minzoom", function () {
+            alert(I18n.t("javascripts.site." + name + "_zoom_alert"));
+            return false;
+          });
+      }
     }
-  });
-}
-
-/*
- * Get the URL prefix to use for a short link
- */
-function shortlinkPrefix() {
-  if (window.location.hostname.match(/^www\.openstreetmap\.org/i)) {
-    return "http://osm.org";
-  } else {
-    return "";
+    link.href = base + '?' + querystring.stringify(args);
   }
 }
 
-/*
- * Called to get the arguments from a URL as a hash.
- */
-function getArgs(url) {
-  var args = {};
-  var querystart = url.indexOf("?");
-
-  if (querystart >= 0) {
-     var querystring = url.substring(querystart + 1);
-     var queryitems = querystring.split("&");
-
-     for (var i = 0; i < queryitems.length; i++) {
-        if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
-           args[unescape(match[1])] = unescape(match[2]);
-        } else {
-           args[unescape(queryitems[i])] = null;
-        }
-     }
-  }
-
-  return args;
+function getShortUrl(map) {
+  return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
+          'http://osm.org/go/' : 'http://' + window.location.hostname + '/go/') +
+          makeShortCode(map);
 }
 
-/*
- * Called to set the arguments on a URL from the given hash.
- */
-function setArgs(url, args) {
-   var queryitems = [];
-
-   for (arg in args) {
-      if (args[arg] == null) {
-         queryitems.push(escape(arg));
-      } else {
-         queryitems.push(escape(arg) + "=" + escape(args[arg]));
-      }
-   }
-
-   return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");
+function getUrl(map) {
+  var center = map.getCenter(),
+      zoom = map.getZoom(),
+      toZoom = zoomPrecision(zoom);
+
+  return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
+          'http://openstreetmap.org/?' : 'http://' + window.location.hostname + '/?') +
+        querystring.stringify({
+            lat: toZoom(center.lat),
+            lon: toZoom(center.lng),
+            zoom: zoom,
+            layers: map.getLayersCode()
+        });
 }
 
-/*
- * Called to interlace the bits in x and y, making a Morton code.
- */
-function interlace(x, y) {
-    x = (x | (x << 8)) & 0x00ff00ff;
-    x = (x | (x << 4)) & 0x0f0f0f0f;
-    x = (x | (x << 2)) & 0x33333333;
-    x = (x | (x << 1)) & 0x55555555;
-
-    y = (y | (y << 8)) & 0x00ff00ff;
-    y = (y | (y << 4)) & 0x0f0f0f0f;
-    y = (y | (y << 2)) & 0x33333333;
-    y = (y | (y << 1)) & 0x55555555;
-
-    return (x << 1) | y;
-}
+// Called to create a short code for the short link.
+function makeShortCode(map) {
+    var zoom = map.getZoom(),
+        str = '',
+        char_array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_~",
+        x = Math.round((map.getCenter().lng + 180.0) * ((1 << 30) / 90.0)),
+        y = Math.round((map.getCenter().lat +  90.0) * ((1 << 30) / 45.0)),
+        // JavaScript only has to keep 32 bits of bitwise operators, so this has to be
+        // done in two parts. each of the parts c1/c2 has 30 bits of the total in it
+        // and drops the last 4 bits of the full 64 bit Morton code.
+        c1 = interlace(x >>> 17, y >>> 17), c2 = interlace((x >>> 2) & 0x7fff, (y >>> 2) & 0x7fff);
 
-/*
- * Called to create a short code for the short link.
- */
-function makeShortCode(lat, lon, zoom) {
-    char_array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_~";
-    var x = Math.round((lon + 180.0) * ((1 << 30) / 90.0));
-    var y = Math.round((lat +  90.0) * ((1 << 30) / 45.0));
-    // JavaScript only has to keep 32 bits of bitwise operators, so this has to be
-    // done in two parts. each of the parts c1/c2 has 30 bits of the total in it
-    // and drops the last 4 bits of the full 64 bit Morton code.
-    var str = "";
-    var c1 = interlace(x >>> 17, y >>> 17), c2 = interlace((x >>> 2) & 0x7fff, (y >>> 2) & 0x7fff);
     for (var i = 0; i < Math.ceil((zoom + 8) / 3.0) && i < 5; ++i) {
         digit = (c1 >> (24 - 6 * i)) & 0x3f;
         str += char_array.charAt(digit);
     }
-    for (var i = 5; i < Math.ceil((zoom + 8) / 3.0); ++i) {
+    for (i = 5; i < Math.ceil((zoom + 8) / 3.0); ++i) {
         digit = (c2 >> (24 - 6 * (i - 5))) & 0x3f;
         str += char_array.charAt(digit);
     }
-    for (var i = 0; i < ((zoom + 8) % 3); ++i) {
-        str += "-";
+    for (i = 0; i < ((zoom + 8) % 3); ++i) str += "-";
+
+    // Called to interlace the bits in x and y, making a Morton code.
+    function interlace(x, y) {
+        x = (x | (x << 8)) & 0x00ff00ff;
+        x = (x | (x << 4)) & 0x0f0f0f0f;
+        x = (x | (x << 2)) & 0x33333333;
+        x = (x | (x << 1)) & 0x55555555;
+        y = (y | (y << 8)) & 0x00ff00ff;
+        y = (y | (y << 4)) & 0x0f0f0f0f;
+        y = (y | (y << 2)) & 0x33333333;
+        y = (y | (y << 1)) & 0x55555555;
+        return (x << 1) | y;
     }
+
     return str;
 }
 
+// generate a cookie-safe string of map state
+function cookieContent(map) {
+  var center = map.getCenter().wrap();
+  return [center.lng, center.lat, map.getZoom(), map.getLayersCode()].join('|');
+}
+
 /*
- * Forms which have been cached by rails may have he wrong
+ * Forms which have been cached by rails may have the wrong
  * authenticity token, so patch up any forms with the correct
  * token taken from the page header.
  */
index edfb4643aef8e80216f0f087909a37a369dfe712..b20e4516e8ceda5b698abceae4cc8c460e75d859 100644 (file)
@@ -1,39 +1,26 @@
 $(document).ready(function () {
-  function remoteEditHandler(bbox, select) {
-    var left = bbox.getWest() - 0.0001;
-    var top = bbox.getNorth() + 0.0001;
-    var right = bbox.getEast() + 0.0001;
-    var bottom = bbox.getSouth() - 0.0001;
-    var loaded = false;
-
-    $("#linkloader").load(function () { loaded = true; });
-
-    if (select) {
-      $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom + "&select=" + select);
-    } else {
-      $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom);
-    }
-
-    setTimeout(function () {
-      if (!loaded) alert(I18n.t('site.index.remote_failed'));
-    }, 1000);
 
-    return false;
-  }
+  var map = L.map("small_map", {
+    attributionControl: false,
+    zoomControl: false
+  }).addLayer(new L.OSM.Mapnik());
 
-  var map = createMap("small_map", {
-    layerControl: false,
-    panZoomControl: false,
-    attributionControl: false
-  });
+  L.OSM.zoom()
+    .addTo(map);
 
   var params = $("#small_map").data();
+  var object, bbox;
   if (params.type == "changeset") {
-    var bbox = L.latLngBounds([params.minlat, params.minlon],
-                              [params.maxlat, params.maxlon]);
+    bbox = L.latLngBounds([params.minlat, params.minlon],
+        [params.maxlat, params.maxlon]);
 
     map.fitBounds(bbox);
-    addBoxToMap(bbox);
+
+    L.rectangle(bbox, {
+      weight: 2,
+      color: '#e90',
+      fillOpacity: 0
+    }).addTo(map);
 
     $("#loading").hide();
     $("#browse_map .geolink").show();
@@ -42,16 +29,16 @@ $(document).ready(function () {
       return remoteEditHandler(bbox);
     });
 
-    var centre = bbox.getCenter();
-    updatelinks(centre.lng, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
+    updatelinks(map.getCenter(), 16, null, [[params.minlat, params.minlon],
+        [params.maxlat, params.maxlon]]);
   } else if (params.type == "note") {
-    var object = {type: params.type, id: params.id};
+    object = {type: params.type, id: params.id};
 
     map.setView([params.lat, params.lon], 16);
 
     L.marker([params.lat, params.lon], { icon: getUserIcon() }).addTo(map);
 
-    var bbox = map.getBounds();
+    bbox = map.getBounds();
 
     $("#loading").hide();
     $("#browse_map .geolink").show();
@@ -60,21 +47,20 @@ $(document).ready(function () {
       return remoteEditHandler(bbox);
     });
 
-    updatelinks(params.lon, params.lat, 16, null, 
+    updatelinks(params, 16, null,
                 bbox.getWest(), bbox.getSouth(),
                 bbox.getEast(), bbox.getNorth(),
                 object);
   } else {
-    $("#object_larger_map").hide();
-    $("#object_edit").hide();
+    $("#object_larger_map, #object_edit").hide();
 
-    var object = {type: params.type, id: params.id};
+    object = {type: params.type, id: params.id};
 
     if (!params.visible) {
       object.version = params.version - 1;
     }
 
-    addObjectToMap(object, {
+    addObjectToMap(object, map, {
       zoom: true, 
       callback: function(extent) {
         $("#loading").hide();
@@ -92,15 +78,7 @@ $(document).ready(function () {
           $("#object_larger_map").show();
           $("#object_edit").show();
 
-          var centre = extent.getCenter();
-          updatelinks(centre.lng,
-                      centre.lat,
-                      16, null,
-                      extent.getWest(),
-                      extent.getSouth(),
-                      extent.getEast(),
-                      extent.getNorth(),
-                      object);
+          updatelinks(map.getCenter(), 16, null, extent, object);
         } else {
           $("#small_map").hide();
         }
index 1010fbac94b03fdeab92db2d3ee3b98e1230295a..6d4881547b4d07bba65eecaf661c64462b0aa2c0 100644 (file)
@@ -1,6 +1,14 @@
 $(document).ready(function () {
   var changesets = [], rects = {};
-  var map = createMap("changeset_list_map");
+
+  var map = L.map("changeset_list_map", {
+    attributionControl: false,
+    zoomControl: false
+  }).addLayer(new L.OSM.Mapnik());
+
+  L.OSM.zoom()
+    .addTo(map);
+
   var group = L.featureGroup().addTo(map);
 
   $("[data-changeset]").each(function () {
index 291c8652382a85ab4cee1414eb6ce5d962a8bfef..1aa728ea0f36d3c4f40b38fe667888f74c4877c9 100644 (file)
@@ -1,5 +1,5 @@
 $(document).ready(function () {
-  var marker;
+  var marker, map;
 
   function setLocation(e) {
     $("#latitude").val(e.latlng.lat);
@@ -21,7 +21,14 @@ $(document).ready(function () {
 
     var params = $("#map").data();
     var centre = [params.lat, params.lon];
-    var map = createMap("map");
+
+    map = L.map("map", {
+      attributionControl: false,
+      zoomControl: false
+    }).addLayer(new L.OSM.Mapnik());
+
+    L.OSM.zoom()
+      .addTo(map);
 
     map.setView(centre, params.zoom);
 
index f13e2d48130d6c50396cd7d8c012d8c28c23692b..b9aba25d3fb2bc6e5fd77646cadd7db66861490a 100644 (file)
@@ -1,19 +1,12 @@
 function maximiseMap() {
   $("#content").addClass("maximised");
-
-  handleResize();
 }
 
 function minimiseMap() {
   $("#content").removeClass("maximised");
-
-  handleResize();
 }
 
 $(document).ready(function () {
-  $(window).resize(handleResize);
-  handleResize();
-
   $("#search_form").submit(function () {
     $("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
     $("#sidebar_content").load($(this).attr("action"), {
index 742061fa618a6d790fd06ba5830b61af97ae236f..57572ca48ff31dee1cd998d5312c6886443f37fb 100644 (file)
@@ -40,5 +40,5 @@ window.onload = function () {
                    L.latLng(args.bbox[3], args.bbox[2])])
   } else {
     map.fitWorld();
-  }  
+  }
 };
index 9f0c8649340e63678c8288f60b0e0fa88c7ff093..029c0bfd1f1046fe8ef0617b911a48bd6bb4a1d1 100644 (file)
 //= require_self
+//= require leaflet.sidebar
+//= require leaflet.locate
+//= require leaflet.layers
+//= require leaflet.key
+//= require leaflet.note
+//= require leaflet.share
 //= require index/browse
 //= require index/export
-//= require index/key
 //= require index/notes
 
 $(document).ready(function () {
-  var permalinks = $("#permalink").detach().html();
-  var marker;
   var params = OSM.mapParams();
-  var map = createMap("map");
 
-  L.control.scale().addTo(map);
+  var map = L.map("map", {
+    zoomControl: false,
+    layerControl: false
+  });
+
+  map.attributionControl.setPrefix('');
+
+  var layers = [
+    new L.OSM.Mapnik({
+      attribution: '',
+      code: "M",
+      keyid: "mapnik",
+      name: I18n.t("javascripts.map.base.standard")
+    }),
+    new L.OSM.CycleMap({
+      attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
+      code: "C",
+      keyid: "cyclemap",
+      name: I18n.t("javascripts.map.base.cycle_map")
+    }),
+    new L.OSM.TransportMap({
+      attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
+      code: "T",
+      keyid: "transportmap",
+      name: I18n.t("javascripts.map.base.transport_map")
+    }),
+    new L.OSM.MapQuestOpen({
+      attribution: "Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
+      code: "Q",
+      keyid: "mapquest",
+      name: I18n.t("javascripts.map.base.mapquest")
+    })
+  ];
+
+  layers[0].addTo(map);
+
+  map.noteLayer = new L.LayerGroup({code: 'N'});
+  map.dataLayer = new L.OSM.DataLayer(null);
+
+  $("#sidebar").on("opened closed", function () {
+    map.invalidateSize();
+  });
+
+  var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright';
+
+  L.OSM.zoom({position: position})
+    .addTo(map);
+
+  L.control.locate({position: position})
+    .addTo(map);
+
+  var sidebar = L.OSM.sidebar('#map-ui')
+    .addTo(map);
 
-  map.attributionControl.setPrefix(permalinks);
+  L.OSM.layers({
+    position: position,
+    layers: layers,
+    sidebar: sidebar
+  }).addTo(map);
 
-  map.on("moveend layeradd layerremove", updateLocation);
+  L.OSM.key({
+    position: position,
+    sidebar: sidebar
+  }).addTo(map);
+
+  L.OSM.share({
+    position: position,
+    getShortUrl: getShortUrl,
+    getUrl: getUrl,
+    sidebar: sidebar,
+    short: true
+  }).addTo(map);
+
+  L.OSM.note({
+    position: position,
+    sidebar: sidebar
+  }).addTo(map);
+
+  L.control.scale()
+    .addTo(map);
+
+  map.on('moveend layeradd layerremove', updateLocation);
+
+  map.markerLayer = L.layerGroup().addTo(map);
 
   if (!params.object_zoom) {
     if (params.bbox) {
@@ -24,7 +105,11 @@ $(document).ready(function () {
       map.fitBounds(bbox);
 
       if (params.box) {
-        addBoxToMap(bbox);
+        L.rectangle(bbox, {
+          weight: 2,
+          color: '#e90',
+          fillOpacity: 0
+        }).addTo(map);
       }
     } else {
       map.setView([params.lat, params.lon], params.zoom);
@@ -32,90 +117,93 @@ $(document).ready(function () {
   }
 
   if (params.layers) {
-    setMapLayers(params.layers);
+    var foundLayer = false;
+    for (var i = 0; i < layers.length; i++) {
+      if (params.layers.indexOf(layers[i].options.code) >= 0) {
+        map.addLayer(layers[i]);
+        foundLayer = true;
+      } else {
+        map.removeLayer(layers[i]);
+      }
+    }
+    if (!foundLayer) {
+      map.addLayer(layers[0]);
+    }
   }
 
   if (params.marker) {
-    marker = L.marker([params.mlat, params.mlon], {icon: getUserIcon()}).addTo(map);
+    L.marker([params.mlat, params.mlon], {icon: getUserIcon()}).addTo(map.markerLayer);
   }
 
   if (params.object) {
-    addObjectToMap(params.object, { zoom: params.object_zoom });
+    addObjectToMap(params.object, map, { zoom: params.object_zoom });
   }
 
-  handleResize();
-
-  $("body").on("click", "a.set_position", function (e) {
-    e.preventDefault();
-
-    var data = $(this).data();
-    var centre = L.latLng(data.lat, data.lon);
-
-    if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
-      map.fitBounds([[data.minLat, data.minLon],
-                     [data.maxLat, data.maxLon]]);
-    } else {
-      map.setView(centre, data.zoom);
-    }
+  $("body").on("click", "a.set_position", setPositionLink(map));
 
-    if (data.type && data.id) {
-      addObjectToMap(data, { zoom: true, style: { opacity: 0.2, fill: false } });
-    }
-
-    if (marker) {
-      map.removeLayer(marker);
-    }
-
-    marker = L.marker(centre, {icon: getUserIcon()}).addTo(map);
+  $("a[data-editor=remote]").click(function(e) {
+      remoteEditHandler(map.getBounds());
+      e.preventDefault();
   });
 
-  function updateLocation() {
-    var center = map.getCenter().wrap();
-    var zoom = map.getZoom();
-    var layers = getMapLayers();
-    var extents = map.getBounds().wrap();
-
-    updatelinks(center.lng,
-                center.lat,
-                zoom,
-                layers,
-                extents.getWest(),
-                extents.getSouth(),
-                extents.getEast(),
-                extents.getNorth(),
-                params.object);
-
-    var expiry = new Date();
-    expiry.setYear(expiry.getFullYear() + 10);
-    $.cookie("_osm_location", [center.lng, center.lat, zoom, layers].join("|"), {expires: expiry});
+  if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) {
+    remoteEditHandler(map.getBounds());
   }
 
-  function remoteEditHandler() {
-    var extent = map.getBounds();
-    var loaded = false;
+  $("#search_form").submit(submitSearch(map));
 
-    $("#linkloader").load(function () { loaded = true; });
-    $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + extent.getWest()
-                                                                   + "&bottom=" + extent.getSouth()
-                                                                   + "&right=" + extent.getEast()
-                                                                   + "&top=" + extent.getNorth());
 
-    setTimeout(function () {
-      if (!loaded) alert(I18n.t('site.index.remote_failed'));
-    }, 1000);
+  if ($("#query").val()) {
+    $("#search_form").submit();
+  }
 
-    return false;
+  // Focus the search field for browsers that don't support
+  // the HTML5 'autofocus' attribute
+  if (!("autofocus" in document.createElement("input"))) {
+    $("#query").focus();
   }
 
-  $("a[data-editor=remote]").click(remoteEditHandler);
+  initializeExport(map);
+  initializeBrowse(map);
+  initializeNotes(map);
+});
 
-  if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) {
-    remoteEditHandler();
-  }
+function updateLocation() {
+  updatelinks(this.getCenter().wrap(),
+      this.getZoom(),
+      this.getLayersCode(),
+      this.getBounds().wrap());
+
+  var expiry = new Date();
+  expiry.setYear(expiry.getFullYear() + 10);
+  $.cookie("_osm_location", cookieContent(this), { expires: expiry });
+}
+
+function setPositionLink(map) {
+  return function(e) {
+      var data = $(this).data(),
+          center = L.latLng(data.lat, data.lon);
+
+      if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
+        map.fitBounds([[data.minLat, data.minLon],
+                       [data.maxLat, data.maxLon]]);
+      } else {
+        map.setView(center, data.zoom);
+      }
+
+      if (data.type && data.id) {
+        addObjectToMap(data, map, { zoom: true, style: { opacity: 0.2, fill: false } });
+      }
+
+      map.markerLayer.clearLayers();
+      L.marker(center, {icon: getUserIcon()}).addTo(map.markerLayer);
 
-  $(window).resize(handleResize);
+      return e.preventDefault();
+  };
+}
 
-  $("#search_form").submit(function () {
+function submitSearch(map) {
+  return function(e) {
     var bounds = map.getBounds();
 
     $("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
@@ -127,16 +215,6 @@ $(document).ready(function () {
       maxlat: bounds.getNorth()
     }, openSidebar);
 
-    return false;
-  });
-
-  if ($("#query").val()) {
-    $("#search_form").submit();
-  }
-
-  // Focus the search field for browsers that don't support
-  // the HTML5 'autofocus' attribute
-  if (!("autofocus" in document.createElement("input"))) {
-    $("#query").focus();
-  }
-});
+    return e.preventDefault();
+  };
+}
index 228a5a411ba8f38e62acbcddbae405dcbcf069fd..e04a864f468c74e1f5d7ce58e53022c4b91780e7 100644 (file)
@@ -2,7 +2,7 @@
 //= require templates/browse/feature_list
 //= require templates/browse/feature_history
 
-$(document).ready(function () {
+function initializeBrowse(map) {
   var browseBounds;
   var layersById;
   var selectedLayer;
@@ -10,20 +10,20 @@ $(document).ready(function () {
   var areasHidden = false;
   var locationFilter;
 
-  var dataLayer = new L.OSM.DataLayer(null, {
-    styles: {
-      way: {
-        weight: 3,
-        color: "#000000",
-        opacity: 0.4
-      },
-      area: {
-        weight: 3,
-        color: "#ff0000"
-      },
-      node: {
-        color: "#00ff00"
-      }
+  var dataLayer = map.dataLayer;
+
+  dataLayer.setStyle({
+    way: {
+      weight: 3,
+      color: "#000000",
+      opacity: 0.4
+    },
+    area: {
+      weight: 3,
+      color: "#ff0000"
+    },
+    node: {
+      color: "#00ff00"
     }
   });
 
@@ -35,10 +35,6 @@ $(document).ready(function () {
     onSelect(e.layer);
   });
 
-  if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
-    map.layersControl.addOverlay(dataLayer, I18n.t("browse.start_rjs.data_layer_name"));
-  }
-
   map.on('layeradd', function (e) {
     if (e.layer === dataLayer) {
       $.ajax({ url: "/browse/start", success: function (sidebarHtml) {
@@ -327,4 +323,4 @@ $(document).ready(function () {
     $("#browse_status").html("");
     $("#browse_status").hide();
   }
-});
+}
index 52af96ebb7ad20d120ce60b9c84e234a17b104df..417dfabd35be892cdf5e9ad391083d30c35de215 100644 (file)
@@ -1,4 +1,4 @@
-$(document).ready(function () {
+function initializeExport(map) {
   $("#exportanchor").click(function (e) {
     $.ajax({ url: $(this).data('url'), success: function (sidebarHtml) {
       startExport(sidebarHtml);
@@ -38,7 +38,7 @@ $(document).ready(function () {
 
     openSidebar();
 
-    if (getMapBaseLayer().keyid == "mapnik") {
+    if (map.getMapBaseLayerId() == "mapnik") {
       $("#format_mapnik").prop("checked", true);
     }
 
@@ -186,7 +186,7 @@ $(document).ready(function () {
 
     function htmlUrlChanged() {
       var bounds = getBounds();
-      var layerName = getMapBaseLayer().keyid;
+      var layerName = map.getMapBaseLayerId();
 
       var url = "http://" + OSM.SERVER_URL + "/export/embed.html?bbox=" + bounds.toBBoxString() + "&amp;layer=" + layerName;
       var markerUrl = "";
@@ -203,7 +203,7 @@ $(document).ready(function () {
 
       var zoom = map.getBoundsZoom(bounds);
 
-      var layers = getMapLayers();
+      var layers = map.getLayersCode();
 
       var text = I18n.t('export.start_rjs.view_larger_map');
       var escaped = [];
@@ -281,4 +281,4 @@ $(document).ready(function () {
       validateControls();
     }
   }
-});
+}
diff --git a/app/assets/javascripts/index/key.js b/app/assets/javascripts/index/key.js
deleted file mode 100644 (file)
index 9722cf4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-$(document).ready(function () {
-  $("#open_map_key").click(function (e) {
-    e.preventDefault();
-
-    var url = $(this).attr('href'),
-        title = $(this).text();
-
-    function updateMapKey() {
-      var mapLayer = getMapBaseLayer().keyid,
-          mapZoom = map.getZoom();
-
-      $(".mapkey-table-entry").each(function () {
-        var data = $(this).data();
-
-        if (mapLayer == data.layer &&
-            mapZoom >= data.zoomMin && mapZoom <= data.zoomMax) {
-          $(this).show();
-        } else {
-          $(this).hide();
-        }
-      });
-    }
-
-    $("#sidebar_content").load(url, updateMapKey);
-
-    openSidebar({ title: title });
-
-    $("#sidebar").one("closed", function () {
-      map.off("zoomend baselayerchange", updateMapKey);
-    });
-
-    map.on("zoomend baselayerchange", updateMapKey);
-  });
-});
index 6a7c50373d8173207c0e7439d45d55a15c3d64e4..2d807eb92e6ccab6554f6249587aada0cf5c11c2 100644 (file)
@@ -1,8 +1,11 @@
 //= require templates/notes/show
 //= require templates/notes/new
 
-$(document).ready(function () {
-  var params = OSM.mapParams();
+function initializeNotes(map) {
+  var params = OSM.mapParams(),
+      noteLayer = map.noteLayer,
+      notes = {},
+      newNote;
 
   var noteIcons = {
     "new": L.icon({
@@ -22,60 +25,38 @@ $(document).ready(function () {
     })
   };
 
-  var noteLayer = new L.LayerGroup();
-  var notes = {};
-  var newNote;
-
-  layers.push({
-    layer: noteLayer,
-    layerCode: "N"
-  });
-
   map.on("layeradd", function (e) {
     if (e.layer == noteLayer) {
       loadNotes();
       map.on("moveend", loadNotes);
     }
-  });
-
-  map.on("layerremove", function (e) {
+  }).on("layerremove", function (e) {
     if (e.layer == noteLayer) {
       map.off("moveend", loadNotes);
       noteLayer.clearLayers();
       notes = {};
     }
-  });
-
-  // Don't focus the text area on touch devices to avoid flashing the keyboard
-  if (!('ontouchstart' in document.documentElement)) {
-    map.on("popupopen", function (e) {
-      $(e.popup._container).find(".comment").focus();
-    });
-  }
-
-  map.on("popupclose", function (e) {
+  }).on("popupclose", function (e) {
     if (newNote && e.popup == newNote._popup) {
       $(newNote).oneTime(10, "removenote", function () {
         map.removeLayer(newNote);
         newNote = null;
       });
     }
+  }).on("popupopen", function (e) {
+    if (!('ontouchstart' in document.documentElement)) {
+      $(e.popup._container).find(".comment").focus();
+    }
   });
 
   if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
-    map.layersControl.addOverlay(noteLayer, I18n.t("browse.start_rjs.notes_layer_name"));
-
-    if (params.layers) setMapLayers(params.layers);
-    if (params.notes) map.addLayer(noteLayer);
-
+    if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer);
     if (params.note) {
       $.ajax({
         url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",
         success: function (feature) {
           var marker = updateMarker(notes[feature.properties.id], feature);
-
           notes[feature.properties.id] = marker;
-
           map.addLayer(noteLayer);
           marker.openPopup();
         }
@@ -84,27 +65,22 @@ $(document).ready(function () {
   }
 
   function updateMarker(marker, feature) {
-    if (marker)
-    {
+    if (marker) {
       marker.setIcon(noteIcons[feature.properties.status]);
       marker.setPopupContent(createPopupContent(
-        marker, feature.properties, 
+        marker, feature.properties,
         $(marker._popup._content).find("textarea").val()
       ));
-    }
-    else
-    {
+    } else {
       marker = L.marker(feature.geometry.coordinates.reverse(), {
         icon: noteIcons[feature.properties.status],
         opacity: 0.9
       });
-
       marker.addTo(noteLayer).bindPopup(
         createPopupContent(marker, feature.properties),
         popupOptions()
       );
     }
-
     return marker;
   }
 
@@ -121,26 +97,26 @@ $(document).ready(function () {
 
       noteLoader = $.ajax({
         url: url,
-        success: function (json) {
-          var oldNotes = notes;
-
-          notes = {};
-
-          json.features.forEach(function (feature) {
-            var marker = oldNotes[feature.properties.id];
+        success: success
+      });
+    }
 
-            delete oldNotes[feature.properties.id];
+    function success(json) {
+      var oldNotes = notes;
+      notes = {};
+      json.features.forEach(updateMarkers);
 
-            notes[feature.properties.id] = updateMarker(marker, feature);
-          });
+      function updateMarkers(feature) {
+        var marker = oldNotes[feature.properties.id];
+        delete oldNotes[feature.properties.id];
+        notes[feature.properties.id] = updateMarker(marker, feature);
+      }
 
-          for (id in oldNotes) {
-            noteLayer.removeLayer(oldNotes[id]);
-          }
+      for (id in oldNotes) {
+        noteLayer.removeLayer(oldNotes[id]);
+      }
 
-          noteLoader = null;
-        }
-      });
+      noteLoader = null;
     }
   };
 
@@ -184,6 +160,8 @@ $(document).ready(function () {
     return content[0];
   }
 
+  var addNoteButton = $(".control-note .control-button");
+
   function createNote(marker, form, url) {
     var location = marker.getLatLng();
 
@@ -201,15 +179,17 @@ $(document).ready(function () {
         lon: location.lng,
         text: $(form.text).val()
       },
-      success: function (feature) {
-        $(marker._popup._content).find("textarea").val("");
+      success: noteCreated
+    });
 
-        notes[feature.properties.id] = updateMarker(marker, feature);
-        newNote = null;
+    function noteCreated(feature) {
+      $(marker._popup._content).find("textarea").val("");
 
-        $("#createnoteanchor").removeClass("disabled").addClass("geolink");
-      }
-    });
+      notes[feature.properties.id] = updateMarker(marker, feature);
+      newNote = null;
+
+      addNoteButton.removeClass("disabled");
+    }
   }
 
   function updateNote(marker, form, method, url) {
@@ -237,28 +217,24 @@ $(document).ready(function () {
     });
   }
 
-  $(".leaflet-control-attribution").on("click", "#createnoteanchor", function (e) {
+  addNoteButton.on("click", function (e) {
     e.preventDefault();
+    e.stopPropagation();
 
-    if ($(e.target).hasClass("disabled")) return;
+    if (addNoteButton.hasClass("disabled")) return;
 
-    $(e.target).removeClass("geolink").addClass("disabled");
+    addNoteButton.addClass("disabled");
 
     map.addLayer(noteLayer);
 
     var mapSize = map.getSize();
     var markerPosition;
 
-    if (mapSize.y > 800)
-    {
+    if (mapSize.y > 800) {
       markerPosition = [mapSize.x / 2, mapSize.y / 2];
-    }
-    else if (mapSize.y > 400)
-    {
+    } else if (mapSize.y > 400) {
       markerPosition = [mapSize.x / 2, 400];
-    }
-    else
-    {
+    } else {
       markerPosition = [mapSize.x / 2, mapSize.y];
     }
 
@@ -268,35 +244,27 @@ $(document).ready(function () {
       draggable: true
     });
 
-    var popupContent = $(JST["templates/notes/new"]({ create_url: $(e.target).attr("href") }));
+    var popupContent = $(JST["templates/notes/new"]());
 
-    popupContent.find("textarea").on("input", function (e) {
-      var form = e.target.form;
+    popupContent.find("textarea").on("input", disableWhenBlank);
 
-      if ($(e.target).val() == "") {
-        $(form.add).prop("disabled", true);
-      } else {
-        $(form.add).prop("disabled", false);
-      }
-    });
+    function disableWhenBlank(e) {
+      $(e.target.form.add).prop("disabled", $(e.target).val() === "");
+    }
 
     popupContent.find("input[type=submit]").on("click", function (e) {
       e.preventDefault();
-      createNote(newNote, e.target.form, $(e.target).data("url"));
+      createNote(newNote, e.target.form, '/api/0.6/notes.json');
     });
 
     newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
 
     newNote.on("remove", function (e) {
-      $("#createnoteanchor").removeClass("disabled").addClass("geolink");
-    });
-
-    newNote.on("dragstart", function (e) {
+      addNoteButton.removeClass("disabled");
+    }).on("dragstart", function (e) {
       $(newNote).stopTime("removenote");
-    });
-
-    newNote.on("dragend", function (e) {
+    }).on("dragend", function (e) {
       e.target.openPopup();
     });
   });
-});
+}
diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb
new file mode 100644 (file)
index 0000000..3b50530
--- /dev/null
@@ -0,0 +1,31 @@
+L.extend(L.LatLngBounds.prototype, {
+  getSize: function () {
+    return (this._northEast.lat - this._southWest.lat) *
+           (this._northEast.lng - this._southWest.lng);
+  },
+
+  wrap: function () {
+    return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
+  }
+});
+
+L.extend(L.Map.prototype, {
+    getLayersCode: function() {
+        var layerConfig = '';
+        for (var i in this._layers) { // TODO: map.eachLayer
+            var layer = this._layers[i];
+            if (layer.options && layer.options.code) {
+                layerConfig += layer.options.code;
+            }
+        }
+        return layerConfig;
+    },
+    getMapBaseLayerId: function() {
+        for (var i in this._layers) { // TODO: map.eachLayer
+            var layer = this._layers[i];
+            if (layer.options && layer.options.keyid) return layer.options.keyid;
+        }
+    }
+});
+
+L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>;
diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js
new file mode 100644 (file)
index 0000000..c5124e3
--- /dev/null
@@ -0,0 +1,75 @@
+L.OSM.key = function (options) {
+  var control = L.control(options);
+
+  control.onAdd = function (map) {
+    var $container = $('<div>')
+      .attr('class', 'control-key');
+
+    $('<a>')
+      .attr('class', 'control-button')
+      .attr('href', '#')
+      .attr('title', I18n.t('javascripts.key.tooltip'))
+      .html('<span class="icon key"></span>')
+      .on('click', toggle)
+      .appendTo($container);
+
+    var $ui = $('<div>')
+      .attr('class', 'key-ui');
+
+    $('<div>')
+      .attr('class', 'sidebar_heading')
+      .appendTo($ui)
+      .append(
+        $('<a>')
+          .text(I18n.t('javascripts.close'))
+          .attr('class', 'sidebar_close')
+          .attr('href', '#')
+          .bind('click', toggle))
+      .append(
+        $('<h4>')
+          .text(I18n.t('javascripts.key.title')));
+
+    var $section = $('<div>')
+      .attr('class', 'section')
+      .appendTo($ui);
+
+    options.sidebar.addPane($ui);
+
+    $ui
+      .on('show', shown)
+      .on('hide', hidden);
+
+    function shown() {
+      map.on('zoomend baselayerchange', update);
+      $section.load('/key', update);
+    }
+
+    function hidden() {
+      map.off('zoomend baselayerchange', update);
+    }
+
+    function toggle(e) {
+      e.stopPropagation();
+      e.preventDefault();
+      options.sidebar.togglePane($ui);
+    }
+
+    function update() {
+      var layer = map.getMapBaseLayerId(),
+        zoom = map.getZoom();
+
+      $('.mapkey-table-entry').each(function () {
+        var data = $(this).data();
+        if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {
+          $(this).show();
+        } else {
+          $(this).hide();
+        }
+      });
+    }
+
+    return $container[0];
+  };
+
+  return control;
+};
diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js
new file mode 100644 (file)
index 0000000..e8014ac
--- /dev/null
@@ -0,0 +1,162 @@
+L.OSM.layers = function(options) {
+  var control = L.control(options);
+
+  control.onAdd = function (map) {
+    var layers = options.layers;
+
+    var $container = $('<div>')
+      .attr('class', 'control-layers');
+
+    var link = $('<a>')
+      .attr('class', 'control-button')
+      .attr('href', '#')
+      .attr('title', 'Layers')
+      .html('<span class="icon layers"></span>')
+      .on('click', toggle)
+      .appendTo($container);
+
+    var $ui = $('<div>')
+      .attr('class', 'layers-ui');
+
+    $('<div>')
+      .attr('class', 'sidebar_heading')
+      .appendTo($ui)
+      .append(
+        $('<a>')
+          .text(I18n.t('javascripts.close'))
+          .attr('class', 'sidebar_close')
+          .attr('href', '#')
+          .bind('click', toggle))
+      .append(
+        $('<h4>')
+          .text(I18n.t('javascripts.map.layers.header')));
+
+    var baseSection = $('<div>')
+      .attr('class', 'section base-layers')
+      .appendTo($ui);
+
+    list = $('<ul>')
+      .appendTo(baseSection);
+
+    layers.forEach(function(layer) {
+      var item = $('<li>')
+        .appendTo(list);
+
+      if (map.hasLayer(layer)) {
+        item.addClass('active');
+      }
+
+      var div = $('<div>')
+        .appendTo(item);
+
+      map.whenReady(function() {
+        var miniMap = L.map(div[0], {attributionControl: false, zoomControl: false})
+          .addLayer(new layer.constructor());
+
+        miniMap.dragging.disable();
+        miniMap.touchZoom.disable();
+        miniMap.doubleClickZoom.disable();
+        miniMap.scrollWheelZoom.disable();
+
+        $ui
+          .on('show', shown)
+          .on('hide', hide);
+
+        function shown() {
+          miniMap.invalidateSize();
+          setView();
+          map.on('moveend', setView);
+        }
+
+        function hide() {
+          map.off('moveend', setView);
+        }
+
+        function setView() {
+          miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0));
+        }
+      });
+
+      var label = $('<label>')
+        .appendTo(item);
+
+      var input = $('<input>')
+        .attr('type', 'radio')
+        .prop('checked', map.hasLayer(layer))
+        .appendTo(label);
+
+      label.append(layer.options.name);
+
+      item.on('click', function() {
+        layers.forEach(function(other) {
+          if (other === layer) {
+            map.addLayer(other);
+          } else {
+            map.removeLayer(other);
+          }
+        });
+        map.fire('baselayerchange', {layer: layer});
+      });
+
+      map.on('layeradd layerremove', function() {
+        item.toggleClass('active', map.hasLayer(layer));
+        input.prop('checked', map.hasLayer(layer));
+      });
+    });
+
+    if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
+      var overlaySection = $('<div>')
+        .attr('class', 'section overlay-layers')
+        .appendTo($ui);
+
+      $('<p>')
+        .text(I18n.t('javascripts.map.layers.overlays'))
+        .appendTo(overlaySection);
+
+      var list = $('<ul>')
+        .appendTo(overlaySection);
+
+      function addOverlay(layer, name) {
+        var item = $('<li>')
+          .appendTo(list);
+
+        var label = $('<label>')
+          .appendTo(item);
+
+        var input = $('<input>')
+          .attr('type', 'checkbox')
+          .prop('checked', map.hasLayer(layer))
+          .appendTo(label);
+
+        label.append(name);
+
+        input.on('change', function() {
+          if (input.is(':checked')) {
+            map.addLayer(layer);
+          } else {
+            map.removeLayer(layer);
+          }
+        });
+
+        map.on('layeradd layerremove', function() {
+          input.prop('checked', map.hasLayer(layer));
+        });
+      }
+
+      addOverlay(map.noteLayer, I18n.t('javascripts.map.layers.notes'));
+      addOverlay(map.dataLayer, I18n.t('javascripts.map.layers.data'));
+    }
+
+    options.sidebar.addPane($ui);
+
+    function toggle(e) {
+      e.stopPropagation();
+      e.preventDefault();
+      options.sidebar.togglePane($ui);
+    }
+
+    return $container[0];
+  };
+
+  return control;
+};
diff --git a/app/assets/javascripts/leaflet.note.js b/app/assets/javascripts/leaflet.note.js
new file mode 100644 (file)
index 0000000..a38e012
--- /dev/null
@@ -0,0 +1,20 @@
+L.OSM.note = function (options) {
+  var control = L.control(options);
+
+  control.onAdd = function (map) {
+    var $container = $('<div>')
+      .attr('class', 'control-note');
+
+    $('<a>')
+      .attr('id', 'createnoteanchor')
+      .attr('class', 'control-button geolink')
+      .attr('data-minzoom', 12)
+      .attr('href', '#')
+      .html('<span class="icon note"></span>')
+      .appendTo($container);
+
+    return $container[0];
+  };
+
+  return control;
+};
diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js
new file mode 100644 (file)
index 0000000..b808bc4
--- /dev/null
@@ -0,0 +1,75 @@
+L.OSM.share = function (options) {
+  var control = L.control(options);
+
+  control.onAdd = function (map) {
+    var $container = $('<div>')
+      .attr('class', 'control-share');
+
+    $('<a>')
+      .attr('class', 'control-button')
+      .attr('href', '#')
+      .attr('title', 'Share')
+      .html('<span class="icon share"></span>')
+      .on('click', toggle)
+      .appendTo($container);
+
+    var $ui = $('<div>')
+      .attr('class', 'share-ui');
+
+    $('<div>')
+      .attr('class', 'sidebar_heading')
+      .appendTo($ui)
+      .append(
+        $('<a>')
+          .text(I18n.t('javascripts.close'))
+          .attr('class', 'sidebar_close')
+          .attr('href', '#')
+          .bind('click', toggle))
+      .append(
+        $('<h4>')
+          .text(I18n.t('javascripts.share.title')));
+
+    var $linkSection = $('<div>')
+      .attr('class', 'section share-link')
+      .appendTo($ui);
+
+    $('<h4>')
+      .text(I18n.t('javascripts.share.link'))
+      .appendTo($linkSection);
+
+    var $shortLink, $longLink;
+
+    $('<ul>')
+      .appendTo($linkSection)
+      .append($('<li>')
+        .append($longLink = $('<a>')
+          .text(I18n.t('javascripts.share.long_link'))))
+      .append($('<li>')
+        .append($shortLink = $('<a>')
+          .text(I18n.t('javascripts.share.short_link'))));
+
+    map.on('moveend layeradd layerremove', update);
+
+    options.sidebar.addPane($ui);
+
+    function toggle(e) {
+      e.stopPropagation();
+      e.preventDefault();
+      options.sidebar.togglePane($ui);
+      update();
+    }
+
+    function update() {
+      $shortLink.attr('href', options.getShortUrl(map));
+      $longLink.attr('href', options.getUrl(map));
+    }
+
+    function select() {
+      $(this).select();
+    }
+
+    return $container[0];
+  };
+
+  return control;
+};
diff --git a/app/assets/javascripts/leaflet.sidebar.js b/app/assets/javascripts/leaflet.sidebar.js
new file mode 100644 (file)
index 0000000..9618426
--- /dev/null
@@ -0,0 +1,39 @@
+L.OSM.sidebar = function(selector) {
+  var control = {},
+    sidebar = $(selector),
+    current = $(),
+    map;
+
+  control.addTo = function (_) {
+    map = _;
+    return control;
+  };
+
+  control.addPane = function(pane) {
+    pane
+      .hide()
+      .appendTo(sidebar);
+  };
+
+  control.togglePane = function(pane) {
+    current
+      .hide()
+      .trigger('hide');
+
+    if (current === pane) {
+      $(sidebar).hide();
+      current = $();
+    } else {
+      $(sidebar).show();
+      current = pane;
+    }
+
+    current
+      .show()
+      .trigger('show');
+
+    map.invalidateSize({pan: false, animate: false});
+  };
+
+  return control;
+};
diff --git a/app/assets/javascripts/leaflet.zoom.js b/app/assets/javascripts/leaflet.zoom.js
new file mode 100644 (file)
index 0000000..80b4ab1
--- /dev/null
@@ -0,0 +1,72 @@
+L.OSM.Zoom = L.Control.extend({
+       options: {
+               position: 'topright'
+       },
+
+       onAdd: function (map) {
+               var zoomName = 'zoom',
+                   container = L.DomUtil.create('div', zoomName);
+
+               this._map = map;
+
+               this._zoomInButton  = this._createButton(
+                       '', I18n.t('javascripts.map.zoom.in'),  zoomName + 'in',  container, this._zoomIn,  this);
+               this._zoomOutButton = this._createButton(
+                       '', I18n.t('javascripts.map.zoom.out'), zoomName + 'out', container, this._zoomOut, this);
+
+               map.on('zoomend zoomlevelschange', this._updateDisabled, this);
+
+               return container;
+       },
+
+       onRemove: function (map) {
+               map.off('zoomend zoomlevelschange', this._updateDisabled, this);
+       },
+
+       _zoomIn: function (e) {
+               this._map.zoomIn(e.shiftKey ? 3 : 1);
+       },
+
+       _zoomOut: function (e) {
+               this._map.zoomOut(e.shiftKey ? 3 : 1);
+       },
+
+       _createButton: function (html, title, className, container, fn, context) {
+               var link = L.DomUtil.create('a', 'control-button ' + className, container);
+               link.innerHTML = html;
+               link.href = '#';
+               link.title = title;
+
+               var sprite = L.DomUtil.create('span', 'icon ' + className, link);
+
+               var stop = L.DomEvent.stopPropagation;
+
+               L.DomEvent
+                   .on(link, 'click', stop)
+                   .on(link, 'mousedown', stop)
+                   .on(link, 'dblclick', stop)
+                   .on(link, 'click', L.DomEvent.preventDefault)
+                   .on(link, 'click', fn, context);
+
+               return link;
+       },
+
+       _updateDisabled: function () {
+               var map = this._map,
+                       className = 'leaflet-disabled';
+
+               L.DomUtil.removeClass(this._zoomInButton, className);
+               L.DomUtil.removeClass(this._zoomOutButton, className);
+
+               if (map._zoom === map.getMinZoom()) {
+                       L.DomUtil.addClass(this._zoomOutButton, className);
+               }
+               if (map._zoom === map.getMaxZoom()) {
+                       L.DomUtil.addClass(this._zoomInButton, className);
+               }
+       }
+});
+
+L.OSM.zoom = function (options) {
+       return new L.OSM.Zoom(options);
+};
index 90aefa94580a5fd466c4eb5316d5111c896f9978..6d26763f8986ab851f5b1b547a0e6e451a772f56 100644 (file)
@@ -1,90 +1,5 @@
-// Leaflet extensions
-L.extend(L.LatLngBounds.prototype, {
-  getSize: function () {
-    return (this._northEast.lat - this._southWest.lat) *
-           (this._northEast.lng - this._southWest.lng);
-  },
-
-  wrap: function () {
-    return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
-  }
-});
-
-L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>;
-
-var map;
-var layers;
-var objectLayer;
 var objectLoader;
 
-function createMap(divName, options) {
-  if (!layers) {
-    layers = [
-      {
-        klass: L.OSM.Mapnik,
-        attribution: "",
-        keyid: "mapnik",
-        layerCode: "M",
-        name: I18n.t("javascripts.map.base.standard")
-      },
-      {
-        klass: L.OSM.CycleMap,
-        attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
-        keyid: "cyclemap",
-        layerCode: "C",
-        name: I18n.t("javascripts.map.base.cycle_map")
-      },
-      {
-        klass: L.OSM.TransportMap,
-        attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
-        keyid: "transportmap",
-        layerCode: "T",
-        name: I18n.t("javascripts.map.base.transport_map")
-      },
-      {
-        klass: L.OSM.MapQuestOpen,
-        attribution: "Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
-        keyid: "mapquest",
-        layerCode: "Q",
-        name: I18n.t("javascripts.map.base.mapquest")
-      }
-    ];
-  }
-
-  options = $.extend({zoomControl: true, panZoomControl: true, layerControl: true}, options);
-
-  map = L.map(divName, $.extend({}, options, {panControl: false, zoomsliderControl: false, maxZoom: 18}));
-
-  if (map.attributionControl) {
-    map.attributionControl.setPrefix('');
-  }
-
-  if (options.panZoomControl) {
-    new L.Control.Pan().addTo(map);
-    new L.Control.Zoomslider({stepHeight: 7}).addTo(map);
-  }
-
-  var layersControl = L.control.layers();
-
-  if (options.layerControl) {
-    layersControl.addTo(map);
-    map.layersControl = layersControl;
-  }
-
-  for (var i = 0; i < layers.length; i++) {
-    layers[i].layer = new (layers[i].klass)(layers[i]);
-    layersControl.addBaseLayer(layers[i].layer, layers[i].name);
-  }
-
-  layers[0].layer.addTo(map);
-
-  $("#" + divName).on("resized", function () {
-    map.invalidateSize();
-  });
-
-  return map;
-}
-
 function getUserIcon(url) {
   return L.icon({
     iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
@@ -96,20 +11,15 @@ function getUserIcon(url) {
   });
 }
 
-function addObjectToMap(object, options) {
-  if (objectLoader) {
-    objectLoader.abort();
-  }
-
-  if (objectLayer) {
-    map.removeLayer(objectLayer);
-  }
+function addObjectToMap(object, map, options) {
+  if (objectLoader) objectLoader.abort();
+  if (map.objectLayer) map.removeLayer(map.objectLayer);
 
   objectLoader = $.ajax({
     url: OSM.apiUrl(object),
     dataType: "xml",
     success: function (xml) {
-      objectLayer = new L.OSM.DataLayer(null, {
+      map.objectLayer = new L.OSM.DataLayer(null, {
         styles: {
           node: options.style,
           way: options.style,
@@ -117,7 +27,7 @@ function addObjectToMap(object, options) {
         }
       });
 
-      objectLayer.interestingNode = function (node, ways, relations) {
+      map.objectLayer.interestingNode = function (node, ways, relations) {
         if (object.type === "node") {
           return true;
         } else if (object.type === "relation") {
@@ -129,64 +39,12 @@ function addObjectToMap(object, options) {
         }
       };
 
-      objectLayer.addData(xml);
+      map.objectLayer.addData(xml);
 
-      var bounds = objectLayer.getBounds();
+      if (options.zoom) map.fitBounds(map.objectLayer.getBounds());
+      if (options.callback) options.callback(map.objectLayer.getBounds());
 
-      if (options.zoom) {
-        map.fitBounds(bounds);
-      }
-
-      if (options.callback) {
-        options.callback(bounds);
-      }
-
-      objectLayer.addTo(map);
+      map.objectLayer.addTo(map);
     }
   });
 }
-
-function addBoxToMap(bounds) {
-  var box = L.rectangle(bounds, {
-    weight: 2,
-    color: '#e90',
-    fillOpacity: 0
-  });
-
-  box.addTo(map);
-
-  return box;
-}
-
-function getMapBaseLayer() {
-  for (var i = 0; i < layers.length; i++) {
-    if (map.hasLayer(layers[i].layer)) {
-      return layers[i];
-    }
-  }
-}
-
-function getMapLayers() {
-  var layerConfig = "";
-  for (var i = 0; i < layers.length; i++) {
-    if (map.hasLayer(layers[i].layer)) {
-      layerConfig += layers[i].layerCode;
-    }
-  }
-  return layerConfig;
-}
-
-function setMapLayers(layerConfig) {
-  var foundLayer = false;
-  for (var i = 0; i < layers.length; i++) {
-    if (layerConfig.indexOf(layers[i].layerCode) >= 0) {
-      map.addLayer(layers[i].layer);
-      foundLayer = true;
-    } else {
-      map.removeLayer(layers[i].layer);
-    }
-  }
-  if (!foundLayer) {
-    map.addLayer(layers[0].layer);
-  }
-}
diff --git a/app/assets/javascripts/querystring.js b/app/assets/javascripts/querystring.js
new file mode 100644 (file)
index 0000000..24e4382
--- /dev/null
@@ -0,0 +1,71 @@
+require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({"querystring-component":[function(require,module,exports){
+module.exports=require('Xr2wId');
+},{}],"Xr2wId":[function(require,module,exports){
+
+/**
+ * Module dependencies.
+ */
+
+var trim = require('trim');
+
+/**
+ * Parse the given query `str`.
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api public
+ */
+
+exports.parse = function(str){
+  if ('string' != typeof str) return {};
+
+  str = trim(str);
+  if ('' == str) return {};
+
+  var obj = {};
+  var pairs = str.split('&');
+  for (var i = 0; i < pairs.length; i++) {
+    var parts = pairs[i].split('=');
+    obj[parts[0]] = null == parts[1]
+      ? ''
+      : decodeURIComponent(parts[1]);
+  }
+
+  return obj;
+};
+
+/**
+ * Stringify the given `obj`.
+ *
+ * @param {Object} obj
+ * @return {String}
+ * @api public
+ */
+
+exports.stringify = function(obj){
+  if (!obj) return '';
+  var pairs = [];
+  for (var key in obj) {
+    pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));
+  }
+  return pairs.join('&');
+};
+
+},{"trim":1}],1:[function(require,module,exports){
+
+exports = module.exports = trim;
+
+function trim(str){
+  return str.replace(/^\s*|\s*$/g, '');
+}
+
+exports.left = function(str){
+  return str.replace(/^\s*/, '');
+};
+
+exports.right = function(str){
+  return str.replace(/\s*$/, '');
+};
+
+},{}]},{},[])
+;
\ No newline at end of file
diff --git a/app/assets/javascripts/resize.js b/app/assets/javascripts/resize.js
deleted file mode 100644 (file)
index 64c006a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-function resizeContent() {
-  var content = $("#content");
-  var leftMargin = parseInt(content.css("left"));
-  var rightMargin = parseInt(content.css("right"));
-  var bottomMargin = parseInt(content.css("bottom"));
-
-  if ($("html").attr("dir") == "ltr") {
-    content.width($(window).width() - content.prop("offsetLeft") - rightMargin);
-  } else {
-    content.width($(window).width() - content.prop("offsetRight") - leftMargin);
-  }
-
-  content.height($(window).height() - content.prop("offsetTop") - bottomMargin);
-}
-
-function resizeMap() {
-  var content_width = $("#content").width();
-  var content_height = $("#content").height();
-  var sidebar_width = 0;
-  var left_border = parseFloat($("#map").css("border-left-width"));
-  var right_border = parseFloat($("#map").css("border-right-width"));
-  var top_border = parseFloat($("#map").css("border-top-width"));
-  var bottom_border = parseFloat($("#map").css("border-bottom-width"));
-
-  $("#sidebar:visible").each(function () {
-    sidebar_width = sidebar_width + $(this).outerWidth(true);
-  });
-
-  if ($("html").attr("dir") == "ltr") {
-    $("#map").css("left", (sidebar_width) + "px");
-  } else {
-    $("#map").css("right", (sidebar_width) + "px");
-  }
-
-  $("#map").width(content_width - sidebar_width - left_border - right_border);
-  $("#map").height(content_height - top_border - bottom_border);
-  $("#map").trigger("resized");
-}
-
-function handleResize() {
-  var brokenContentSize = $("#content").prop("offsetWidth") == 0;
-
-  if (brokenContentSize) {
-    resizeContent();
-  }
-
-  resizeMap();
-}
-
-$(document).ready(function () {
-  $("#sidebar").on("opened", resizeMap);
-  $("#sidebar").on("closed", resizeMap);
-});
index a4ea5079ae31dc908ed3faf3b1e11fa20b5cf8a0..003971088cd37a626b20da30e05387f96522756f 100644 (file)
@@ -6,7 +6,7 @@
     <textarea class="comment" name="text" cols="40" rows="10"></textarea>
     <br/>
     <div class="buttons clearfix">
-      <input type="submit" name="add" value="<%- I18n.t('javascripts.notes.new.add') %>" data-url="<%- create_url %>" disabled="1">
+      <input type="submit" name="add" value="<%- I18n.t('javascripts.notes.new.add') %>" disabled="1">
     </div>
   </form>
 </div>
index 25456d04ebb080b46564fb359b5801fac551c163..86a30958b97d258b22ab81ebae1e60bb74c82ff4 100644 (file)
@@ -1,8 +1,11 @@
 $(document).ready(function () {
-  var map = createMap("map", {
-    zoomControl: true,
-    panZoomControl: false
-  });
+  var map = L.map("map", {
+    attributionControl: false,
+    zoomControl: false
+  }).addLayer(new L.OSM.Mapnik());
+
+  L.OSM.zoom()
+    .addTo(map);
 
   if (OSM.home) {
     map.setView([OSM.home.lat, OSM.home.lon], 12);
index 0ab8069e94fb5820443cd15a688c4690eff77643..18983242f30e4f5ce85440eb76e639b090879f7b 100644 (file)
@@ -141,6 +141,37 @@ h6:first-child {
   margin-right: $lineheight/4;
 }
 
+/* Rules for icons */
+
+.icon {
+  display:inline-block;
+  vertical-align:top;
+  width:20px;
+  height:20px;
+  background:transparent image-url("sprite.png") no-repeat 0 0;
+  text-indent:-9999px;
+  overflow:hidden;
+  }
+
+.icon-pre-text {
+    margin-right: 5px;
+}
+
+.icon.search      { background-position: 0 0; }
+.icon.donate      { background-position: -20px 0; }
+.icon.zoomin      { background-position: -40px 0; }
+.icon.zoomout     { background-position: -60px 0; }
+.icon.geolocate   { background-position: -80px 0; }
+.active .icon.geolocate   { background-position: -80px -20px; }
+.icon.layers      { background-position: -100px 0; }
+.icon.key         { background-position: -120px 0; }
+.icon.share       { background-position: -140px 0; }
+.icon.clipboard   { background-position: -160px 0; }
+.icon.link        { background-position: -180px 0; }
+.icon.close       { background-position: -200px 0; }
+.icon.check       { background-position: -220px 0; }
+.icon.note        { background-position: -240px 0; }
+
 /* Rules for links */
 
 a {
@@ -307,19 +338,6 @@ table {
   }
 }
 
-/* Rules for SOTM advert */
-
-#sotm {
-  width: 165px;
-  margin: $lineheight/2;
-  padding: 0px;
-  border: 0px;
-  background: #fff;
-  img {
-    width: 165px;
-  }
-}
-
 /*
  * Rules for "optional boxes" which appear in the left sidebar on
  * certain pages. Current users are the seach box on the main page
@@ -389,7 +407,7 @@ table {
 
 /* Rules for donation request box */
 
-.donate {
+a.donate {
   display: block;
   width: 163px;
   padding: $lineheight/4;
@@ -406,11 +424,6 @@ table {
     background: #9ed485;
     text-decoration: none;
   }
-  span {
-    margin: 0;
-    padding-left: 18px;
-    background: image-url("sprite.png") 0 -29px no-repeat;
-  }
 }
 
 /* Rules for Creative Commons logo button */
@@ -518,27 +531,114 @@ table {
 }
 
 /* Rules for Leaflet maps */
-.leaflet-control-layers-expanded {
-  padding: 10px !important;
+
+.leaflet-control .control-button {
+  display: block;
+  height: 40px;
+  width: 40px;
+  background-color: white;
+  background-color: rgba(255,255,255,.8);
+  border-radius: 4px;
+  margin-bottom: 10px;
+  outline: none;
 }
 
-.leaflet-control-layers-separator {
-  margin: 5px -10px !important;
+.leaflet-control .zoomin,
+.control-layers .control-button {
+  margin-bottom: 0px;
+  border-radius: 4px 4px 0px 0px;
 }
 
-.leaflet-control-attribution {
-  a.disabled {
-    color: #99c9dc;
-    cursor: default;
-    text-decoration: none;
+.site .leaflet-control .zoomout,
+.control-key .control-button {
+  margin-bottom: 0px;
+  border-radius: 0px;
+}
+
+.leaflet-control .zoomout,
+.control-locate .control-button,
+.control-share .control-button {
+  border-radius: 0px 0px 4px 4px;
+}
+
+.leaflet-control .control-button:hover {
+  background-color: white;
+}
+
+.leaflet-control .control-button .icon {
+  margin: 10px;
+}
+
+/* Rules for the home page */
+
+.site-export #map,
+.site-index #map,
+.site-edit #map {
+  height: 100%;
+  overflow: hidden;
+}
+
+#map-ui {
+  display: none;
+  position: relative;
+  float: right;
+  width: 250px;
+  height: 100%;
+  background: white;
+  border-left: 1px solid #CCC;
+  overflow: auto;
+
+  .section {
+    border-bottom: 1px solid #DDD;
+    padding: 15px;
   }
 
-  ul.secondary-actions {
-    float: left;
-    margin-right: $lineheight/4;
+  a.close-button {
+    float: right;
+    padding:5px;
+    font-size:20px;
+    line-height:10px;
+    color:#222;
+    border:1px solid #ddd;
+  }
+}
 
-    &:only-child {
-      margin-right: 0px;
+.layers-ui {
+  ul, li:last-child {
+    margin-bottom: 0;
+  }
+
+  li {
+    border-radius: 4px;
+    overflow: hidden;
+    margin-bottom: 10px;
+  }
+
+  label {
+    display: block;
+    padding: 5px 5px 5px 7px;
+    background-color: #eee;
+    cursor: pointer;
+  }
+
+  li.active label {
+    background-color: #ccc;
+  }
+
+  .base-layers {
+    .leaflet-container {
+      width: 100%;
+      height: 50px;
+      cursor: pointer;
+    }
+  }
+}
+
+.share-ui {
+  .share-link {
+    li {
+      display: inline-block;
+      width: 50%;
     }
   }
 }
@@ -551,11 +651,6 @@ table {
   }
 }
 
-.site-index #map .olControlScaleLine,
-.site-export #map .olControlScaleLine {
-  left: $lineheight/2 !important;
-}
-
 .leaflet-popup-scrolled {
   padding-right: $lineheight;
   border-bottom: 0px !important;
@@ -614,23 +709,11 @@ table {
 
 #sidebar {
   display: none;
-  position: absolute;
+  position: relative;
+  float: left;
   overflow: auto;
-  top: 0px;
-  bottom: 0px;
-  left: 0px;
   border-right: 1px solid $keyline;
   width: 33.3333%;
-  .sidebar_heading {
-    position: relative;
-    padding: $lineheight/2 $lineheight;
-    z-index: 9999;
-    background: $offwhite;
-    border-bottom: 1px solid #ccc;
-  }
-  h4 {
-    margin: 0;
-  }
   ul {
     margin-bottom: 0;
     &:last-child {
@@ -645,7 +728,18 @@ table {
   }
 }
 
-#sidebar_close {
+.sidebar_heading {
+  position: relative;
+  padding: $lineheight/2 $lineheight;
+  z-index: 9999;
+  background: $offwhite;
+  border-bottom: 1px solid #ccc;
+  h4 {
+    margin: 0;
+  }
+}
+
+.sidebar_close {
   position: absolute;
   height: $lineheight;
   top: 0px;
@@ -669,7 +763,6 @@ table {
 /* Rules for the map key which appears in the popout sidebar */
 
 #mapkey {
-  padding: $lineheight $lineheight 0 $lineheight;
  .mapkey-table-key img {
     display: block;
     margin-left: auto;
@@ -876,28 +969,6 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
   margin-bottom: $lineheight;
 }
 
-/* Rules for the home page */
-
-.site-export #map,
-.site-index #map {
-  position: absolute;
-  top: 0px;
-  bottom: 0px;
-  left: 0px;
-  right: 0px;
-}
-
-/* Rules for the edit page */
-
-.site-edit #map {
-  position: absolute;
-  top: 0px;
-  bottom: 0px;
-  left: 0px;
-  right: 0px;
-  overflow: hidden;
-}
-
 /* Rules for the changeset list shown by the history tab etc */
 
 #changeset_list {
@@ -1162,7 +1233,7 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
   }
   h1, h2 {
     font-size: 21px;
-    line-height: 1;
+    line-height: 1em;
   }
   small.deemphasize {
     float: left;
@@ -1883,11 +1954,11 @@ a.button {
 
 /* Rules for the notes interface */
 
-.note {
+.leaflet-popup-content .note {
   padding-top: $lineheight/2;
 }
 
-.note {
+.leaflet-popup-content .note {
   h2 {
     margin-bottom: $lineheight/2;
   }
index cf7c0c2023cc4c3edebcb679ff4d354715b4e66d..050272b773726e60f32f21844c270f93b28e7819 100644 (file)
@@ -1,7 +1 @@
 /* Styles specific to large screens  */
-
-/* Rules for OpenLayers maps */
-
-.leaflet-control-zoom {
-  display: none;
-}
index 16001e5a59c80c5ef081e0ebd2759dbfd28185d1..10ad2607a5a4c5bbbc56b6df50892edff384ac54 100644 (file)
@@ -1,15 +1,9 @@
 /*
  *= require leaflet
  *= require leaflet.locationfilter
- *= require leaflet.pan
- *= require leaflet.zoom
  */
 
 /* Override to serve images through the asset pipeline. */
-.leaflet-control-layers-toggle {
-  background-image: image-url("images/layers.png");
-}
-
 div.leaflet-marker-icon.location-filter.resize-marker {
   background-image: image-url("img/resize-handle.png");
 }
@@ -18,13 +12,6 @@ div.leaflet-marker-icon.location-filter.move-marker {
   background-image: image-url("img/move-handle.png");
 }
 
-/* Override to better match the pan/zoom control. */
-.leaflet-control-layers {
-  box-shadow: 0px 0px 3px #666;
-  background: #fff;
-  border-radius: 3px;
-}
-
 /* Override some conflicting styles.
    https://github.com/openstreetmap/openstreetmap-website/pull/121#issuecomment-10206946 */
 .leaflet-popup-content img.user_thumbnail {
@@ -35,20 +22,6 @@ div.leaflet-marker-icon.location-filter.move-marker {
   margin: 0 !important;
 }
 
-.site .leaflet-container a {
-  color: #00f;
-}
-
 .site .leaflet-popup p {
   margin: 0 0 20px 0;
 }
-
-.leaflet-control-attribution #permalinkanchor {
-  background: image-url("sprite.png") 0 -45px no-repeat;
-  padding-left:20px;
-}
-
-.site .leaflet-control-attribution {
-  box-shadow: none;
-  font-size: inherit;
-}
diff --git a/app/assets/stylesheets/leaflet.pan.css.scss b/app/assets/stylesheets/leaflet.pan.css.scss
deleted file mode 100644 (file)
index 4b5aa65..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-.leaflet-control-pan-up,
-.leaflet-control-pan-down,
-.leaflet-control-pan-left,
-.leaflet-control-pan-right {
-  background-image: image-url("map_sprite.png");
-  position: absolute;
-  background-repeat: no-repeat;
-  cursor: hand;
-  cursor: pointer;
-}
-
-.leaflet-control-pan-up {
-  left: 10px;
-  width: 25px;
-  height: 13px;
-  background-position: -15px -5px;
-}
-
-.leaflet-control-pan-down {
-  left: 10px;
-  top: 36px;
-  width: 25px;
-  height: 15px;
-  background-position: -15px -40px;
-}
-
-.leaflet-control-pan-left {
-  left: 0px;
-  top: 13px;
-  width: 25px;
-  height: 24px;
-  background-position: -5px -17px;
-}
-
-.leaflet-control-pan-right {
-  left: 25px;
-  top: 13px;
-  width: 25px;
-  height: 24px;
-  background-position: -30px -17px;
-}
diff --git a/app/assets/stylesheets/leaflet.zoom.css.scss b/app/assets/stylesheets/leaflet.zoom.css.scss
deleted file mode 100644 (file)
index 66f464a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-.leaflet-control-zoomslider {
-  .leaflet-control-zoomslider-in,
-  .leaflet-control-zoomslider-out,
-  .leaflet-control-zoomslider-slider,
-  .leaflet-control-zoomslider-slider-knob {
-    background-image: image-url("map_sprite.png");
-    position: absolute;
-    background-repeat: no-repeat;
-    cursor: hand;
-    cursor: pointer;
-  }
-
-  .leaflet-control-zoomslider-in,
-  .leaflet-control-zoomslider-out {
-    text-indent: 26px;
-    overflow: hidden;
-    outline-style: none;
-    border: 0;
-    background-color: transparent;
-  }
-
-  .leaflet-control-zoomslider-in {
-    top: 50px;
-    width: 26px;
-    height: 20px;
-    left: 10px;
-    background-position: -15px -61px;
-  }
-
-  .leaflet-control-zoomslider-out {
-    top: 202px;
-    width: 26px;
-    height: 20px;
-    left: 10px;
-    background-position: -15px -220px;
-  }
-
-  .leaflet-control-zoomslider-slider {
-    top: 70px;
-    width: 26px;
-    height: 132px;
-    left: 10px;
-    background-position: -15px -84px;
-  }
-
-  .leaflet-control-zoomslider-slider-knob {
-    top: 0px;
-    width: 25px;
-    height: 10px;
-    -webkit-transition: top 100ms linear;
-    -moz-transition: top 100ms linear;
-    -o-transition: top 100ms linear;
-    background-position: -77px -58px;
-    pointer: move;
-    cursor: move;
-  }
-}
index 2bec6d24960883f5ca630852c70d846f4dc5a446..a6bf475c3661ae90da227e0e7d51d643693c5cd8 100644 (file)
@@ -168,6 +168,27 @@ p.search_results_entry {
   padding: 2px 0px;
 }
 
+/* Rules for the map UI */
+
+.layers-ui {
+  .leaflet-container {
+    display: none;
+  }
+
+  li {
+    border-radius: 0;
+    margin-bottom: 0;
+
+    &:first-child {
+      border-radius: 4px 4px 0 0;
+    }
+
+    &:last-child {
+      border-radius: 0 0 4px 4px;
+    }
+  }
+}
+
 /* Rules for the signup form */
 
 #signupForm input[type="text"], #signupForm input[type="password"] {
index 65723d97f9c2c619b6512510f3b7e7966fda720a..0ba203fde18a1c0e4b0c9b31a551a51ebdd11ca9 100644 (file)
@@ -81,6 +81,7 @@
         </div>
       </div>
       <a title="<%= h(t('layouts.make_a_donation.title')) %>" href="http://donate.openstreetmap.org/" class="donate">
+        <span class='icon donate'></span>
         <span><%= h(t('layouts.make_a_donation.text')) %></span>
       </a>
       <div class='sidebar-copy'>
index f77f67f520b3f009935d8f0839d7fe01a632f5e8..51c9aa905e01ae3212fc221d956a23082e40add9 100644 (file)
@@ -64,7 +64,7 @@
     // 700,600 for fixed size, 100%,100% for resizable
 
     if (lat && lon) {
-      updatelinks(lon, lat, zoom);
+      updatelinks({ lon: lon, lat: lat }, zoom);
     }
   }
 
@@ -86,6 +86,6 @@
   });
 
   function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
-    updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);
+    updatelinks({ lon: lon, lat: lat }, zoom, null, [[minlat, minlon], [maxlat, maxlon]]);
   }
 </script>
index c074a49a30804082ff6c1d5fbe8e07abf3eb423d..52adf66e1817e31df290976d10bb5f4883da5d21 100644 (file)
@@ -1,7 +1,7 @@
 <script type="text/javascript">
 <!--
   function describeLocation() {
-    var args = getArgs($("#viewanchor").attr("href"));
+    var args = querystring.parse($("#viewanchor").attr("href").split('?')[1]);
 
     $("#sidebar_title").html("<%= t 'site.sidebar.search_results' %>");
     $("#sidebar_content").load("<%= url_for :controller => :geocoder, :action => :description %>", {
index 60d0575127d4d3afce90b0c03278eb371640190f..db5f44356c1292d4959268d9bec54b385a995b7e 100644 (file)
@@ -1,7 +1,7 @@
 <div id="sidebar">
   <div class="sidebar_heading">
     <h4 id="sidebar_title"><% t 'site.sidebar.search_results' %></h4>
-    <div id="sidebar_close"><a class="sidebar_close" href="#"><%= t 'site.sidebar.close' %></a></div>
+    <a class="sidebar_close" href="#"><%= t 'site.sidebar.close' %></a>
   </div>
   <div id="sidebar_content">
   </div>
index aaa3927a9ecdf8fc5567a1f566a6fd90569c48b4..c0682258d3f9845febaa331cb9d1994a25e1b2eb 100644 (file)
           zoom = ~~id.map().zoom(),
           center = id.map().center();
 
-      parent.updatelinks(
-        center[0],
-        center[1],
+      parent.updatelinks({
+          lon: center[0],
+          lat: center[1]
+        },
         zoom,
         null,
-        extent[0][0],
-        extent[0][1],
-        extent[1][0],
-        extent[1][1]);
+        [[extent[0][1],
+        extent[0][0]],
+        [extent[1][1],
+        extent[1][0]]]);
     });
 
     parent.$("body").on("click", "a.set_position", function (e) {
index 3efdd9289fd873fbb9a4697777c2406dc52b50f3..4b66fa149c12c646953bb41d48c828fadac0be57 100644 (file)
@@ -2,10 +2,6 @@
   <%= javascript_include_tag "index" %>
 <% end %>
 
-<% content_for :left_menu do %>
-  <li><h4><%= link_to t("site.key.map_key"), {:action => :key}, :id => "open_map_key", :title => t("site.key.map_key_tooltip") %></h4></li>
-<% end %>
-
 <%= render :partial => 'home_link' %>
 <%= render :partial => 'sidebar' %>
 <%= render :partial => 'search' %>
   </div>
 </noscript>
 
+<div id="map-ui">
+</div>
+
 <div id="map">
-  <div id="permalink">
-    <ul class="secondary-actions">
-      <li><a href="/" id="permalinkanchor" class="geolink llz layers object"><%= t 'site.index.permalink' %></a></li>
-      <li><a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a></li>
-      <li><%= link_to t("site.index.createnote"), notes_url(:format => :json),
-          :id => "createnoteanchor",
-          :data => { :minzoom => 12 },
-          :title => "javascripts.site.createnote_tooltip",
-          :class => "geolink"
-      %></li>
-    </ul>
-  </div>
 </div>
 
 <iframe id="linkloader" style="display: none">
index a264aff9487789db5751145aeaf20d8c74337edf..715cef436a5c01113309d8d9f5c3506aeddb4063 100644 (file)
@@ -1338,8 +1338,6 @@ en:
       submit_text: "Go"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
-      map_key: "Map Key"
-      map_key_tooltip: "Key for the map"
       table:
         entry:
           motorway: "Motorway"
@@ -2039,14 +2037,30 @@ en:
       last_changed: "Last changed"
       ago_html: "%{when} ago"
   javascripts:
+    close: Close
+    share:
+      title: "Share"
+      cancel: "Cancel"
+      link: "Link"
+      short_link: "Short Link"
+      long_link: "Long Link"
+    key:
+      title: "Map Key"
+      tooltip: "Map Key"
     map:
+      zoom:
+        in: Zoom In
+        out: Zoom Out
       base:
         standard: Standard
         cycle_map: Cycle Map
         transport_map: Transport Map
         mapquest: MapQuest Open
-      overlays:
-        maplint: Maplint
+      layers:
+        header: Map Layers
+        notes: Map Notes
+        data: Map Data
+        overlays: Enable overlays for troubleshooting the map
     site:
       edit_tooltip: Edit the map
       edit_disabled_tooltip: Zoom in to edit the map
diff --git a/vendor/assets/leaflet/leaflet.locate.js b/vendor/assets/leaflet/leaflet.locate.js
new file mode 100644 (file)
index 0000000..77754d8
--- /dev/null
@@ -0,0 +1,194 @@
+L.Control.Locate = L.Control.extend({
+    options: {
+        position: 'topleft',
+        drawCircle: true,
+        follow: false,  // follow with zoom and pan the user's location
+        // range circle
+        circleStyle: {
+                color: '#136AEC',
+                fillColor: '#136AEC',
+                fillOpacity: 0.15,
+                weight: 2,
+                opacity: 0.5
+            },
+        // inner marker
+        markerStyle: {
+            color: '#136AEC',
+            fillColor: '#2A93EE',
+            fillOpacity: 0.7,
+            weight: 2,
+            opacity: 0.9,
+            radius: 4
+        },
+        metric: true,
+        debug: false,
+        onLocationError: function(err) {
+            alert(err.message);
+        },
+        title: "Show me where I am",
+        popupText: ["You are within ", " from this point"],
+        setView: true, // automatically sets the map view to the user's location
+        locateOptions: {}
+    },
+
+    onAdd: function (map) {
+        var className = 'control-locate',
+            container = L.DomUtil.create('div', className);
+
+        var self = this;
+        this._layer = new L.LayerGroup();
+        this._layer.addTo(map);
+        this._event = undefined;
+        // nested extend so that the first can overwrite the second
+        // and the second can overwrite the third
+        this._locateOptions = L.extend(L.extend({
+            'setView': false // have to set this to false because we have to
+                             // do setView manually
+        }, this.options.locateOptions), {
+            'watch': true  // if you overwrite this, visualization cannot be updated
+        });
+
+        var link = L.DomUtil.create('a', 'control-button', container);
+        link.innerHTML = "<span class='icon geolocate'></span>";
+        link.href = '#';
+        link.title = this.options.title;
+
+        var _log = function(data) {
+            if (self.options.debug) {
+                console.log(data);
+            }
+        };
+
+        L.DomEvent
+            .on(link, 'click', L.DomEvent.stopPropagation)
+            .on(link, 'click', L.DomEvent.preventDefault)
+            .on(link, 'click', function() {
+                if (self._active && (map.getBounds().contains(self._event.latlng) || !self.options.setView)) {
+                    stopLocate();
+                } else {
+                    if (self.options.setView) {
+                        self._locateOnNextLocationFound = true;
+                    }
+                    if(!self._active) {
+                        map.locate(self._locateOptions);
+                    }
+                    self._active = true;
+                    if (!self._event) {
+                        L.DomUtil.addClass(self._container, "requesting");
+                    } else {
+                        visualizeLocation();
+                    }
+                }
+            })
+            .on(link, 'dblclick', L.DomEvent.stopPropagation);
+
+        var onLocationFound = function (e) {
+            _log('onLocationFound');
+
+            self._active = true;
+
+            if (self._event &&
+                (self._event.latlng.lat != e.latlng.lat ||
+                 self._event.latlng.lng != e.latlng.lng)) {
+                _log('location has changed');
+            }
+
+            self._event = e;
+
+            if (self.options.follow) {
+                self._locateOnNextLocationFound = true;
+            }
+
+            visualizeLocation();
+        };
+
+        var visualizeLocation = function() {
+            _log('visualizeLocation,' + 'setView:' + self._locateOnNextLocationFound);
+
+            var radius = self._event.accuracy / 2;
+
+            if (self._locateOnNextLocationFound) {
+                map.fitBounds(self._event.bounds);
+                self._locateOnNextLocationFound = false;
+            }
+
+            self._layer.clearLayers();
+
+            // circle with the radius of the location's accuracy
+            if (self.options.drawCircle) {
+                L.circle(self._event.latlng, radius, self.options.circleStyle)
+                    .addTo(self._layer);
+            }
+
+            var distance, unit;
+            if (self.options.metric) {
+                distance = radius.toFixed(0);
+                unit = "meters";
+            } else {
+                distance = (radius * 3.2808399).toFixed(0);
+                unit = "feet";
+            }
+
+            // small inner marker
+            var t = self.options.popupText;
+            L.circleMarker(self._event.latlng, self.options.markerStyle)
+                .bindPopup(t[0] + distance + " " + unit  + t[1])
+                .addTo(self._layer);
+
+            if (!self._container)
+                return;
+
+            L.DomUtil.removeClass(self._container, "requesting");
+            L.DomUtil.addClass(self._container, "active");
+        };
+
+        var resetVariables = function() {
+            self._active = false;
+            self._locateOnNextLocationFound = true;
+        };
+
+        resetVariables();
+
+        var stopLocate = function() {
+            _log('stopLocate');
+            map.stopLocate();
+
+            L.DomUtil.removeClass(self._container, "requesting");
+            L.DomUtil.removeClass(self._container, "active");
+
+            resetVariables();
+
+            self._layer.clearLayers();
+        };
+
+
+        var onLocationError = function (err) {
+            _log('onLocationError');
+
+            // ignore timeout error if the location is watched
+            if (err.code==3 && this._locateOptions.watch) {
+                return;
+            }
+
+            stopLocate();
+            self.options.onLocationError(err);
+        };
+
+        // event hooks
+        map.on('locationfound', onLocationFound, self);
+        map.on('locationerror', onLocationError, self);
+
+        return container;
+    }
+});
+
+L.Map.addInitHook(function () {
+    if (this.options.locateControl) {
+        this.locateControl = L.control.locate();
+        this.addControl(this.locateControl);
+    }
+});
+
+L.control.locate = function (options) {
+    return new L.Control.Locate(options);
+};
diff --git a/vendor/assets/leaflet/leaflet.pan.js b/vendor/assets/leaflet/leaflet.pan.js
deleted file mode 100644 (file)
index 5fa3a91..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-L.Control.Pan = L.Control.extend({
-       options: {
-               position: 'topleft',
-               panOffset: 500
-       },
-
-       onAdd: function (map) {
-               var className = 'leaflet-control-pan',
-                       container = L.DomUtil.create('div', className),
-                       off = this.options.panOffset;
-
-               this._panButton('Up'   , className + '-up'   
-                                               , container, map, new L.Point(    0 , -off));
-               this._panButton('Left' , className + '-left' 
-                                               , container, map, new L.Point( -off ,  0));
-               this._panButton('Right', className + '-right'
-                                               , container, map, new L.Point(  off ,  0));
-               this._panButton('Down' , className + '-down'
-                                               , container, map, new L.Point(    0 ,  off));
-               
-               return container;
-       },
-
-       _panButton: function (title, className, container, map, offset, text) {
-               var wrapper = L.DomUtil.create('div', className + "-wrap", container);
-               var link = L.DomUtil.create('a', className, wrapper);
-               link.href = '#';
-               link.title = title;
-               L.DomEvent
-                       .on(link, 'click', L.DomEvent.stopPropagation)
-                       .on(link, 'click', L.DomEvent.preventDefault)
-                       .on(link, 'click', function(){ map.panBy(offset); }, map)
-                       .on(link, 'dblclick', L.DomEvent.stopPropagation)
-
-               return link;
-       }
-});
-
-L.Map.mergeOptions({
-    panControl: true
-});
-
-L.Map.addInitHook(function () {
-    if (this.options.panControl) {
-               this.panControl = new L.Control.Pan();
-               this.addControl(this.panControl);
-       }
-});
-
-L.control.pan = function (options) {
-    return new L.Control.Pan(options);
-};
diff --git a/vendor/assets/leaflet/leaflet.zoom.js b/vendor/assets/leaflet/leaflet.zoom.js
deleted file mode 100644 (file)
index 0d105f9..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-L.Control.Zoomslider = (function () {
-
-       var Knob = L.Draggable.extend({
-               initialize: function (element, stepHeight, knobHeight) {
-                       L.Draggable.prototype.initialize.call(this, element, element);
-                       this._element = element;
-
-                       this._stepHeight = stepHeight;
-                       this._knobHeight = knobHeight;
-
-                       this.on('predrag', function () {
-                               this._newPos.x = 0;
-                               this._newPos.y = this._adjust(this._newPos.y);
-                       }, this);
-               },
-
-               _adjust: function (y) {
-                       var value = Math.round(this._toValue(y));
-                       value = Math.max(0, Math.min(this._maxValue, value));
-                       return this._toY(value);
-               },
-
-               // y = k*v + m
-               _toY: function (value) {
-                       return this._k * value + this._m;
-               },
-               // v = (y - m) / k
-               _toValue: function (y) {
-                       return (y - this._m) / this._k;
-               },
-
-               setSteps: function (steps) {
-                       var sliderHeight = steps * this._stepHeight;
-                       this._maxValue = steps - 1;
-
-                       // conversion parameters
-                       // the conversion is just a common linear function.
-                       this._k = -this._stepHeight;
-                       this._m = sliderHeight - (this._stepHeight + this._knobHeight) / 2;
-               },
-
-               setPosition: function (y) {
-                       L.DomUtil.setPosition(this._element,
-                                                                 L.point(0, this._adjust(y)));
-               },
-
-               setValue: function (v) {
-                       this.setPosition(this._toY(v));
-               },
-
-               getValue: function () {
-                       return this._toValue(L.DomUtil.getPosition(this._element).y);
-               }
-       });
-
-       var Zoomslider = L.Control.extend({
-               options: {
-                       position: 'topleft',
-                       // Height of zoom-slider.png in px
-                       stepHeight: 9,
-                       // Height of the knob div in px
-                       knobHeight: 5,
-                       styleNS: 'leaflet-control-zoomslider'
-               },
-
-               onAdd: function (map) {
-                       var container = L.DomUtil.create('div', this.options.styleNS + ' leaflet-bar');
-
-                       L.DomEvent.disableClickPropagation(container);
-
-                       this._map = map;
-
-                       this._zoomInButton = this._createZoomButton(
-                               'in', 'top', container, this._zoomIn);
-
-                       this._sliderElem = L.DomUtil.create(
-                               'div',
-                               this.options.styleNS + "-slider leaflet-bar-part",
-                               container);
-
-                       this._zoomOutButton = this._createZoomButton(
-                               'out', 'bottom', container, this._zoomOut);
-
-                       map .on('zoomlevelschange', this._refresh, this)
-                               .on("zoomend", this._updateKnob, this)
-                               .on("zoomend", this._updateDisabled, this)
-                               .whenReady(this._createSlider, this)
-                               .whenReady(this._createKnob, this)
-                               .whenReady(this._refresh, this);
-
-                       return container;
-               },
-
-               onRemove: function (map) {
-                       map .off("zoomend", this._updateKnob)
-                               .off("zoomend", this._updateDisabled)
-                               .off('zoomlevelschange', this._refresh);
-               },
-
-               _refresh: function () {
-                       var zoomLevels = this._zoomLevels();
-                       if (zoomLevels < Infinity  && this._knob  && this._sliderBody) {
-                               this._setSteps(zoomLevels);
-                               this._updateKnob();
-                               this._updateDisabled();
-                       }
-               },
-               _zoomLevels: function () {
-                       return this._map.getMaxZoom() - this._map.getMinZoom() + 1;
-               },
-
-               _createSlider: function () {
-                       this._sliderBody = L.DomUtil.create('div',
-                                                                                               this.options.styleNS + '-slider-body',
-                                                                                               this._sliderElem);
-                       L.DomEvent.on(this._sliderBody, 'click', this._onSliderClick, this);
-               },
-
-               _createKnob: function () {
-                       var knobElem = L.DomUtil.create('div', this.options.styleNS + '-slider-knob',
-                                                                                       this._sliderBody);
-                       L.DomEvent.disableClickPropagation(knobElem);
-
-                       this._knob = new Knob(knobElem,
-                                                                 this.options.stepHeight,
-                                                                 this.options.knobHeight)
-                               .on('dragend', this._updateZoom, this);
-                       this._knob.enable();
-               },
-
-               _onSliderClick: function (e) {
-                       var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e);
-                       var y = L.DomEvent.getMousePosition(first).y
-                                       - L.DomUtil.getViewportOffset(this._sliderBody).y; // Cache this?
-                       this._knob.setPosition(y);
-                       this._updateZoom();
-               },
-
-               _zoomIn: function (e) {
-                       this._map.zoomIn(e.shiftKey ? 3 : 1);
-               },
-               _zoomOut: function (e) {
-                       this._map.zoomOut(e.shiftKey ? 3 : 1);
-               },
-
-               _createZoomButton: function (zoomDir, end, container, fn) {
-                       var barPart = 'leaflet-bar-part',
-                               classDef = this.options.styleNS + '-' + zoomDir
-                                       + ' ' + barPart
-                                       + ' ' + barPart + '-' + end,
-                               title = 'Zoom ' + zoomDir,
-                               link = L.DomUtil.create('a', classDef, container);
-                       link.href = '#';
-                       link.title = title;
-
-                       L.DomEvent
-                               .on(link, 'click', L.DomEvent.preventDefault)
-                               .on(link, 'click', fn, this);
-
-                       return link;
-               },
-               _toZoomLevel: function (value) {
-                       return value + this._map.getMinZoom();
-               },
-               _toValue: function (zoomLevel) {
-                       return zoomLevel - this._map.getMinZoom();
-               },
-               _setSteps: function (zoomLevels) {
-                       this._sliderBody.style.height 
-                               = (this.options.stepHeight * zoomLevels) + "px";
-                       this._knob.setSteps(zoomLevels);
-               },
-               _updateZoom: function () {
-                       this._map.setZoom(this._toZoomLevel(this._knob.getValue()));
-               },
-               _updateKnob: function () {
-                       if (this._knob) {
-                               this._knob.setValue(this._toValue(this._map.getZoom()));
-                       }
-               },
-               _updateDisabled: function () {
-                       var map = this._map,
-                               className = this.options.styleNS + '-disabled';
-
-                       L.DomUtil.removeClass(this._zoomInButton, className);
-                       L.DomUtil.removeClass(this._zoomOutButton, className);
-
-                       if (map.getZoom() === map.getMinZoom()) {
-                               L.DomUtil.addClass(this._zoomOutButton, className);
-                       }
-                       if (map.getZoom() === map.getMaxZoom()) {
-                               L.DomUtil.addClass(this._zoomInButton, className);
-                       }
-               }
-       });
-       return Zoomslider;
-})();
-
-L.Map.mergeOptions({
-    zoomControl: false,
-    zoomsliderControl: true
-});
-
-L.Map.addInitHook(function () {
-    if (this.options.zoomsliderControl) {
-               this.zoomsliderControl = new L.Control.Zoomslider();
-               this.addControl(this.zoomsliderControl);
-       }
-});
-
-L.control.zoomslider = function (options) {
-    return new L.Control.Zoomslider(options);
-};