From ed5ca6c159bbf57e1314b7f92ad6f99a718f1648 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Tue, 4 Feb 2014 15:52:35 +0100 Subject: [PATCH 1/2] added jQuery-Geolocation --- .../1.0.50/jquery.geolocation.js | 103 ++++++++++++++++++ .../1.0.50/jquery.geolocation.min.js | 1 + ajax/libs/jQuery-Geolocation/package.json | 19 ++++ 3 files changed, 123 insertions(+) create mode 100644 ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.js create mode 100644 ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.min.js create mode 100644 ajax/libs/jQuery-Geolocation/package.json diff --git a/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.js b/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.js new file mode 100644 index 000000000..1f1476ca2 --- /dev/null +++ b/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.js @@ -0,0 +1,103 @@ +/* +* A simple jQuery Wrapper for Geolocation API +* +* @author: Manuel Bieh +* @url: http://www.manuel-bieh.de/ +* @documentation: http://www.manuel-bieh.de/blog/geolocation-jquery-plugin +* @version 1.0.50 +* @license MIT +*/ + +(function($) { + + $.extend({ + + geolocation: { + + watchIDs: [], + + get: function(o) { + o = jQuery.geolocation.prepareOptions(o); + $.geolocation.getCurrentPosition(o.success, o.error, o.options); + }, + + watch: function(o) { + o = jQuery.geolocation.prepareOptions(o); + return $.geolocation.watchPosition(o.success, o.error, o.options); + }, + + stop: function(watchID) { + if(typeof navigator.geolocation != 'undefined') { + navigator.geolocation.clearWatch(watchID); + } + }, + + getCurrentPosition: function(success, error, options) { + if(typeof navigator.geolocation != 'undefined') { + navigator.geolocation.getCurrentPosition(success, error, options); + } else { + error(); + } + }, + + watchPosition: function(success, error, options) { + if(typeof navigator.geolocation != 'undefined') { + watchID = navigator.geolocation.watchPosition(success, error, options); + $.geolocation.watchIDs.push(watchID); + return watchID; + } else { + error(); + } + }, + + clearWatch: function(watchID) { + $.geolocation.stop(watchID); + }, + + getPosition: function(o) { + o = jQuery.geolocation.prepareOptions(o); + $.geolocation.getCurrentPosition(o.success, o.error, o.options); + }, + + prepareOptions: function(o) { + + if(!!o.error == false) { + o.error = function() {} + } + + if(!!o.options == false) { + o.options = { + highAccuracy: false, + maximumAge: 30000, // 30 seconds + timeout: 60000 // 1 minute + } + } + + if(!!o.win != false) { + o.success = o.win; + } else if(!!o.done != false) { + o.success = o.done; + } + + if(!!o.fail != false) { + o.error = o.fail; + } + + return o; + + }, + + stopAll: function() { + + $.each(jQuery.geolocation.watchIDs, function(key, value) { + $.geolocation.stop(value); + }); + + } + + + } + + }); + +})(jQuery); \ No newline at end of file diff --git a/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.min.js b/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.min.js new file mode 100644 index 000000000..9368fca50 --- /dev/null +++ b/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.min.js @@ -0,0 +1 @@ +(function($){$.extend({geolocation:{watchIDs:[],get:function(o){o=jQuery.geolocation.prepareOptions(o);$.geolocation.getCurrentPosition(o.success,o.error,o.options)},watch:function(o){o=jQuery.geolocation.prepareOptions(o);return $.geolocation.watchPosition(o.success,o.error,o.options)},stop:function(watchID){if(typeof navigator.geolocation!="undefined"){navigator.geolocation.clearWatch(watchID)}},getCurrentPosition:function(success,error,options){if(typeof navigator.geolocation!="undefined"){navigator.geolocation.getCurrentPosition(success,error,options)}else{error()}},watchPosition:function(success,error,options){if(typeof navigator.geolocation!="undefined"){watchID=navigator.geolocation.watchPosition(success,error,options);$.geolocation.watchIDs.push(watchID);return watchID}else{error()}},clearWatch:function(watchID){$.geolocation.stop(watchID)},getPosition:function(o){o=jQuery.geolocation.prepareOptions(o);$.geolocation.getCurrentPosition(o.success,o.error,o.options)},prepareOptions:function(o){if(!!o.error==false){o.error=function(){}}if(!!o.options==false){o.options={highAccuracy:false,maximumAge:3e4,timeout:6e4}}if(!!o.win!=false){o.success=o.win}else if(!!o.done!=false){o.success=o.done}if(!!o.fail!=false){o.error=o.fail}return o},stopAll:function(){$.each(jQuery.geolocation.watchIDs,function(key,value){$.geolocation.stop(value)})}}})})(jQuery); \ No newline at end of file diff --git a/ajax/libs/jQuery-Geolocation/package.json b/ajax/libs/jQuery-Geolocation/package.json new file mode 100644 index 000000000..d709fb587 --- /dev/null +++ b/ajax/libs/jQuery-Geolocation/package.json @@ -0,0 +1,19 @@ +{ + "name": " jQuery-Geolocation", + "filename": "jquery.geolocation.js", + "version": "1.0.50", + "description": "jQuery plugin which acts as a simplification of the W3C Geolocation API ", + "author": "Manuel Bieh", + "homepage": "http://www.manuel-bieh.de", + "keywords": [ + "jquery", + "geolocation" + ], + "licenses": [{ + "type": "MIT" + }], + "repository": { + "type": "git", + "url": "git://github.com/manuelbieh/jQuery-Geolocation.git" + } +} \ No newline at end of file From 5308a525f751e5befd6cf2811580172a582aa613 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Tue, 4 Feb 2014 23:57:27 +0100 Subject: [PATCH 2/2] Removed trailing space and used minified JS --- ajax/libs/jQuery-Geolocation/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ajax/libs/jQuery-Geolocation/package.json b/ajax/libs/jQuery-Geolocation/package.json index d709fb587..04afe1767 100644 --- a/ajax/libs/jQuery-Geolocation/package.json +++ b/ajax/libs/jQuery-Geolocation/package.json @@ -1,6 +1,6 @@ { - "name": " jQuery-Geolocation", - "filename": "jquery.geolocation.js", + "name": "jQuery-Geolocation", + "filename": "jquery.geolocation.min.js", "version": "1.0.50", "description": "jQuery plugin which acts as a simplification of the W3C Geolocation API ", "author": "Manuel Bieh", @@ -16,4 +16,4 @@ "type": "git", "url": "git://github.com/manuelbieh/jQuery-Geolocation.git" } -} \ No newline at end of file +}