Skip to content

Commit

Permalink
jHERE initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Massimiliano Marcon committed Nov 13, 2012
1 parent 0fa19e3 commit 69e1196
Show file tree
Hide file tree
Showing 12 changed files with 1,113 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
node_modules
docs/*.html
docs/*.css
20 changes: 20 additions & 0 deletions Makefile
@@ -0,0 +1,20 @@
.PHONY: dist

PLUGIN = jhere

deps:
npm install

dist: plugin zepto summary

plugin:
@./node_modules/.bin/uglifyjs -o dist/$(PLUGIN).min.js src/$(PLUGIN).js

zepto:
@./node_modules/.bin/uglifyjs -o dist/zepto.adapter.min.js src/zepto.adapter.js

summary:
@ls -nhl dist | awk '{print $$9,$$5}' | tail -n +2

doc:
@docco -t docs/docco.jst -o docs src/$(PLUGIN).js;mv docs/$(PLUGIN).html docs/docs.html
65 changes: 65 additions & 0 deletions README.md
@@ -0,0 +1,65 @@
#jOVI

Maps are cool, but map APIs are complicated. jHERE solves this problem by offering a simple but powerful map API in the form of a jQuery (or Zepto.JS) plugin.

With jHERE, you can easily add interactive maps to your website. In only 4KB, you get a powerful map API, highly customizable markers, event handling and info bubbles. Bonus features are KML support and data visualization via heatmaps.

![Screenshot](https://raw.github.com/mmarcon/jOVI/new_version/docs/shot.png)

## Add jOVI to your pages

Adding jOVI to a web page or web application is very easy. jOVI supports both jQuery as well as Zepto.JS, so first of all include one of these libraries.

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

or

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>

In case you are using Zepto, you will need to include the Zepto adapter, that includes a couple of little things that are not implmented in Zepto and I used in my plugin (`$.Deferred` and `$.data`).

<script type="text/javascript" src="js/zepto.adapter.js">
<!--Only when using Zepto-->
</script>

Finally include the plugin.

<script type="text/javascript" src="js/jquery.jovi.js"></script>

And done. Execute your code on window load.

<script>
$(window).on('load', function(){
$('#map').jOVI({
enable: ['behavior'],
center: [40.664167, -73.838611],
zoom: 8
})
});
</script>

That's it.

## Contributing

Feel free to submit pull requests and report the issues you may find when using the plugin.

### Code Style

I am not a code style super-geek, but here are the things I like and I don't like:

1. **☼ Like:** semicolons, at the end of the line, **never at the beginning**.
2. **☁ Don't like:** tabs, use **4** spaces instead. Not 1, not 2, **4**.
3. **☼ Like:** single quotes for strings.
4. **☁ Don't like:** trailing whitespaces, messed up indentation.
5. **☼ Like:** meaningful variable names. Don't steal the job to the minificator. Also I want to keep the size of the plugin small, so do facilitate the minificator's job by caching long namespaces and functions that are invoked often.
6. **☁ Don't like:** globals.
7. **☼ Like:** well documented API. If you add functionalities, take the time to write the documentation using `//` comments directly in the source code. Docco will do the rest.

#### Comments

I normally like single line comments, i.e.

//My comment goes here

However I am using [Docco](http://jashkenas.github.com/docco/) to automatically generate documentation for the API, so `//` is reserved for documentation, as single line comments are parsed by the tool. Anything that developers using the plugin should not see in the API docs will have to be commented with `/* */`.
1 change: 1 addition & 0 deletions dist/jhere.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/zepto.adapter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions docs/docco.jst
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jHERE - Maps Made Easy</title>
<link href='http://fonts.googleapis.com/css?family=Copse|Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/main.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>

<body>
<div class="ribbon"></div>
<div class="container">

<header>
<div class="logo"><img src="images/logo-white.png" alt="jHERE logo"/></div>
<h1>jHERE</h1>
<h2>Maps made easy.</h2>
</header>

<div class="documentation">
<section id="map"></section>
<nav>
<ul>
<li><a href="/">jHERE</a></li>
<li><a href="/docs.html" class="active">Docs</a></li>
<li><a href="/about.html">About</a></li>
<li class="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://jhere.net" data-text="jHERE - Maps made easy:" data-via="mmarcon" data-related="mmarcon" data-hashtags="jHERE">Tweet</a></li>
<li class="facebook"><div class="fb-like" data-href="http://jhere.net" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-font="lucida grande"></div></li>
</ul>
</nav>
<section class="docs">
<% for (var i=0, l=sections.length; i<l; i++) { %>
<% var section = sections[i]; %>
<div id="section-<%= i + 1 %>">
<%= section.docsHtml %>
</div>
<% } %>
</section>
</div>
</div>

<footer>
<small>Massimiliano Marcon &copy; 2012</small>
</footer>

<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript" src="js/zepto.adapter.js"></script>
<script type="text/javascript" src="js/jhere.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=185145734898525";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</body>
</html>
Binary file added docs/shot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions package.json
@@ -0,0 +1,27 @@
{
"name": "jOVI",
"version": "0.2.0",
"description": "Maps made simple.",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/mmarcon/jOVI.git"
},
"keywords": [
"maps",
"nokia",
"maps",
"jquery"
],
"author": "Massimiliano Marcon (@mmarcon)",
"license": "MIT",
"devDependencies": {
"uglify-js": "1.3.4"
}
}

0 comments on commit 69e1196

Please sign in to comment.