@burdapraha/frontend
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,34 +0,41 @@ | ||
/** | ||
* Cookie time format | ||
* @param exp_days | ||
* @returns {string} | ||
*/ | ||
function cookieTimeInDays(exp_days) | ||
{ | ||
var dt = new Date(); | ||
dt.setTime(dt.getTime() + (exp_days * 86400000)); // Convert days to ms | ||
return dt.toUTCString(); | ||
} | ||
(function ( $ ) { | ||
window.BP_Frontend = function() {}; | ||
window.BP_Frontend.prototype = { | ||
/** | ||
* Credit: https://stackoverflow.com/a/25971410 | ||
* @type {{getLocation: Function}} | ||
*/ | ||
var geoLocation = { | ||
getLocation: function() { | ||
var deferred = $.Deferred(); | ||
if(navigator.geolocation) { | ||
// geo location is supported. Call navigator.geolocation.getCurrentPosition and : | ||
// - resolve the promise with the returned Position object, or | ||
// - reject the promise with the returned PositionError object, or | ||
// - time out after 5 seconds | ||
navigator.geolocation.getCurrentPosition(deferred.resolve, deferred.reject, { timeout: 5000 }); | ||
} else { | ||
//geo location isn't supported | ||
//Reject the promise with a suitable error message | ||
deferred.reject(new Error('Your browser does not support Geo Location.')); | ||
/** | ||
* Cookie time format | ||
* @param exp_days | ||
* @returns {string} | ||
*/ | ||
cookieTimeInDays: function(exp_days) | ||
{ | ||
var dt = new Date(); | ||
dt.setTime(dt.getTime() + (exp_days * 86400000)); // Convert days to ms | ||
return dt.toUTCString(); | ||
}, | ||
/** | ||
* Credit: https://stackoverflow.com/a/25971410 | ||
* @returns {*} | ||
*/ | ||
getLocation: function() | ||
{ | ||
var deferred = $.Deferred(); | ||
if(navigator.geolocation) { | ||
// geo location is supported. Call navigator.geolocation.getCurrentPosition and : | ||
// - resolve the promise with the returned Position object, or | ||
// - reject the promise with the returned PositionError object, or | ||
// - time out after 5 seconds | ||
navigator.geolocation.getCurrentPosition(deferred.resolve, deferred.reject, { timeout: 5000 }); | ||
} else { | ||
//geo location isn't supported | ||
//Reject the promise with a suitable error message | ||
deferred.reject(new Error('Your browser does not support Geo Location.')); | ||
} | ||
return deferred.promise(); | ||
} | ||
return deferred.promise(); | ||
} | ||
}; | ||
}; | ||
}( jQuery )); |
{ | ||
"name": "@burdapraha/frontend", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "BurdaPraha UI kit", | ||
@@ -29,3 +29,6 @@ "main": "assets/javascripts/main.js", | ||
"run-sequence": "^1.2.2" | ||
}, | ||
"dependencies": { | ||
"jquery": "^3.2.1" | ||
} | ||
} |
9052
59
1
+ Addedjquery@^3.2.1
+ Addedjquery@3.7.1(transitive)