Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Customize extension

  • Loading branch information...
commit c1f467a2fe4406fa00baed5484d349cc73fd8bbc 1 parent 351189e
Massimiliano Marcon authored
Showing with 86 additions and 0 deletions.
  1. +45 −0 src/examples/example.customize.html
  2. +41 −0 src/extensions/customize.js
45 src/examples/example.customize.html
View
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>HTML5 boilerplate—all you really need…</title>
+ <style>
+ #map {
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ background: white;
+ }
+ </style>
+</head>
+
+<body>
+<div id="map"></div>
+<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>
+<script type="text/javascript" src="../zepto.adapter.js"></script>
+<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> -->
+<script type="text/javascript" src="../jhere.js"></script>
+<script type="text/javascript" src="../extensions/customize.js"></script>
+<script type="text/javascript">
+$(window).on('load', function(){
+ //Set default credentials
+ $.jHERE.defaultCredentials('_peU-uCkp-j8ovkzFGNU', 'gBoUkAMoxoqIWfxWA5DuMQ');
+
+ $('#map').jHERE({enable: ['behavior', 'zoombar', 'typeselector', 'positioning', 'contextmenu']})
+ .jHERE('customize', {
+ bubble: {
+ backgroundColor: '#ff6347',
+ color: '#ffffff',
+ autoClose: false
+ }
+ });
+ var point1 = [52.49, 13.39];
+ $('#map').jHERE('marker', point1, {text: '', textColor: '#fff', fill: '#004C9A'}).jHERE('bubble', point1, {content: JSON.stringify(point1), closable: false});
+ var point2 = {latitude: 52.521, longitude: 13.433};
+ $('#map').jHERE('marker', point2, {text: 'Ï', textColor: '#fff', fill: '#004C9A'}).jHERE('bubble', point2, {content: JSON.stringify(point2), closable: false});
+ });
+</script>
+</body>
+</html>
41 src/extensions/customize.js
View
@@ -0,0 +1,41 @@
+/*
+Copyright (c) 2013 Massimiliano Marcon, http://marcon.me
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+;(function($){
+ var _ns;
+
+ function customize(options){
+ _ns = _ns || nokia.maps;
+ var map = this.map;
+ $.each(options, function(k, v){
+ if(k === 'bubble') {
+ var bubbles = map.getComponentById('InfoBubbles') ||
+ map.addComponent(new _ns.map.component.InfoBubbles());
+ bubbles.options.set(v);
+ } else {
+ $.error(k + ' unsupported');
+ }
+ });
+ }
+
+ $.jHERE.extend('customize', customize);
+}(jQuery));
Please sign in to comment.
Something went wrong with that request. Please try again.