Advertisement
Guest User

geoloc

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. <script>
  2. if(typeof Geolizr === "undefined") {
  3. var Geolizr = {};
  4. Geolizr.version = 20181108;
  5. }
  6.  
  7. if(typeof Geolizr.events === "undefined") Geolizr.events = {};
  8. if(typeof Geolizr.geolizrEvents === "undefined") Geolizr.geolizrEvents = [];
  9.  
  10. Geolizr.config = function(config) {
  11. Geolizr.currency_widget_enabled = config.currency_widget_enabled === "true" || false;
  12. Geolizr.shopCurrency = "EUR";
  13. Geolizr.moneyFormats = [];
  14. Geolizr.shopifyFormatMoneySet = false;
  15. Geolizr.observeElements = [];
  16. };
  17.  
  18. /* Geolizr Provider Setter */
  19. Geolizr.presetService = false;
  20. Geolizr.activateIpInfo = function(accessKey) { Geolizr.presetService = { name: 'ipInfo', accessKey: accessKey }; };
  21. Geolizr.activateIpApiCo = function(accessKey) { Geolizr.presetService = { name: 'ipApiCo', accessKey: accessKey }; };
  22. Geolizr.activateDbIpProvider = function(accessKey) { Geolizr.presetService = { name: 'dbIpProvider', accessKey: accessKey }; };
  23. Geolizr.activateIpStackProvider = function(accessKey) { Geolizr.presetService = { name: 'ipStackProvider', accessKey: accessKey }; };
  24. Geolizr.activateGeolizrIPApiProvider = function(accessKey) { Geolizr.presetService = { name: 'geolizrIpApiProvider', accessKey: accessKey }; };
  25.  
  26. /* Service Aliase */
  27. Geolizr.activateFreegeoip = Geolizr.activateIpStackProvider;
  28.  
  29. Geolizr.addSystemEventListener = function(name, callback) {
  30. if (typeof Geolizr.realInit !== 'undefined') {
  31. Geolizr.realInit(function($) {
  32. callback({jquery: $});
  33. })
  34. } else {
  35. Geolizr.geolizrEvents.push(new CustomEvent(name));
  36. document.addEventListener(name, callback);
  37. }
  38. };
  39.  
  40. Geolizr.addEventListener = function(name, callback) {
  41. if(typeof Geolizr.realAddEventListener === "undefined") {
  42. if (!Geolizr.events[name]) Geolizr.events[name] = [];
  43. Geolizr.events[name].push(callback);
  44. } else {
  45. Geolizr.realAddEventListener(name, callback);
  46. }
  47. };
  48.  
  49. Geolizr.getGeoData = function(callback) {
  50. if(typeof Geolizr.realGetGeoData === "undefined") {
  51. Geolizr.addEventListener('geolizr.init', function() {
  52. Geolizr.getGeoData(callback);
  53. })
  54. } else {
  55. Geolizr.realGetGeoData(name, callback);
  56. }
  57. };
  58.  
  59. Geolizr.init = function(callback) {
  60. if(typeof Geolizr.realInit === "undefined")
  61. Geolizr.addEventListener("geolizr.init", callback);
  62. else
  63. Geolizr.realInit(callback);
  64. };
  65.  
  66.  
  67. Geolizr.notification_widget_enabled = false;
  68. Geolizr.popup_widget_enabled = false;
  69. Geolizr.api_widget_enabled = false;
  70. Geolizr.currency_widget_enabled = false;
  71.  
  72. if(Geolizr.popup_widget_enabled || Geolizr.notification_widget_enabled || Geolizr.currency_widget_enabled) {
  73. Geolizr.geolizrCssFile = "//cdn.shopify.com/s/files/1/2534/7976/t/8/assets/geolizr-lib.css?16727215580211549249";
  74. }
  75.  
  76.  
  77.  
  78. Geolizr.config({"currency_widget_enabled":"false"});
  79.  
  80.  
  81. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement