]> git.openstreetmap.org Git - rails.git/commitdiff
Move jquery.cookie to be a yarn managed asset
authorTom Hughes <tom@compton.nu>
Thu, 6 Aug 2020 18:27:58 +0000 (19:27 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 6 Aug 2020 18:28:51 +0000 (19:28 +0100)
Vendorfile
app/assets/javascripts/application.js
package.json
test/javascripts/osm_test.js
vendor/assets/jquery/jquery.cookie.js [deleted file]
yarn.lock

index 858870145261e137a63bc2ca08997ca10187620b..d00557322f5dd3126529c70b010a872910b09f66 100644 (file)
@@ -1,6 +1,5 @@
 folder 'vendor/assets' do
   folder 'jquery' do
-    file 'jquery.cookie.js', 'https://raw.githubusercontent.com/carhartl/jquery-cookie/master/src/jquery.cookie.js'
     file 'jquery.throttle-debounce.js', 'https://raw.githubusercontent.com/cowboy/jquery-throttle-debounce/v1.1/jquery.ba-throttle-debounce.js'
   end
 
index 4f52d08cdae1040eb3118a63796acbe2213702a0..d18ece0b102a8971ebec8ceb337326c6985ced78 100644 (file)
@@ -1,7 +1,7 @@
 //= require jquery3
 //= require jquery_ujs
 //= require jquery.timers
-//= require jquery.cookie
+//= require jquery.cookie/jquery.cookie
 //= require jquery.throttle-debounce
 //= require popper
 //= require bootstrap-sprockets
index 4c1c823dcad8ae4b3e7a186cd84747db437fb687..39f39fad4ac5e2169d7b824b6a6cd1e690ef29f3 100644 (file)
@@ -5,6 +5,7 @@
     "bs-custom-file-input": "^1.3.4",
     "html5shiv": "^3.7.3",
     "jquery-simulate": "^1.0.2",
+    "jquery.cookie": "^1.4.1",
     "leaflet": "^1.6.0",
     "leaflet.locatecontrol": "^0.71.1",
     "ohauth": "^0.2.2"
index 991885758d0bd422ed9943e1fdf1fe680c704822..83e7501978bb7a8b3c64bd44e7a1884c435ac515 100644 (file)
@@ -1,5 +1,5 @@
 //= require jquery
-//= require jquery.cookie
+//= require jquery.cookie/jquery.cookie
 //= require osm
 //= require leaflet/dist/leaflet-src
 //= require leaflet.osm
diff --git a/vendor/assets/jquery/jquery.cookie.js b/vendor/assets/jquery/jquery.cookie.js
deleted file mode 100644 (file)
index 8218817..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*!
- * jQuery Cookie Plugin v1.4.1
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2006, 2014 Klaus Hartl
- * Released under the MIT license
- */
-(function (factory) {
-       if (typeof define === 'function' && define.amd) {
-               // AMD (Register as an anonymous module)
-               define(['jquery'], factory);
-       } else if (typeof exports === 'object') {
-               // Node/CommonJS
-               module.exports = factory(require('jquery'));
-       } else {
-               // Browser globals
-               factory(jQuery);
-       }
-}(function ($) {
-
-       var pluses = /\+/g;
-
-       function encode(s) {
-               return config.raw ? s : encodeURIComponent(s);
-       }
-
-       function decode(s) {
-               return config.raw ? s : decodeURIComponent(s);
-       }
-
-       function stringifyCookieValue(value) {
-               return encode(config.json ? JSON.stringify(value) : String(value));
-       }
-
-       function parseCookieValue(s) {
-               if (s.indexOf('"') === 0) {
-                       // This is a quoted cookie as according to RFC2068, unescape...
-                       s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
-               }
-
-               try {
-                       // Replace server-side written pluses with spaces.
-                       // If we can't decode the cookie, ignore it, it's unusable.
-                       // If we can't parse the cookie, ignore it, it's unusable.
-                       s = decodeURIComponent(s.replace(pluses, ' '));
-                       return config.json ? JSON.parse(s) : s;
-               } catch(e) {}
-       }
-
-       function read(s, converter) {
-               var value = config.raw ? s : parseCookieValue(s);
-               return $.isFunction(converter) ? converter(value) : value;
-       }
-
-       var config = $.cookie = function (key, value, options) {
-
-               // Write
-
-               if (arguments.length > 1 && !$.isFunction(value)) {
-                       options = $.extend({}, config.defaults, options);
-
-                       if (typeof options.expires === 'number') {
-                               var days = options.expires, t = options.expires = new Date();
-                               t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
-                       }
-
-                       return (document.cookie = [
-                               encode(key), '=', stringifyCookieValue(value),
-                               options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
-                               options.path    ? '; path=' + options.path : '',
-                               options.domain  ? '; domain=' + options.domain : '',
-                               options.secure  ? '; secure' : ''
-                       ].join(''));
-               }
-
-               // Read
-
-               var result = key ? undefined : {},
-                       // To prevent the for loop in the first place assign an empty array
-                       // in case there are no cookies at all. Also prevents odd result when
-                       // calling $.cookie().
-                       cookies = document.cookie ? document.cookie.split('; ') : [],
-                       i = 0,
-                       l = cookies.length;
-
-               for (; i < l; i++) {
-                       var parts = cookies[i].split('='),
-                               name = decode(parts.shift()),
-                               cookie = parts.join('=');
-
-                       if (key === name) {
-                               // If second argument (value) is a function it's a converter...
-                               result = read(cookie, value);
-                               break;
-                       }
-
-                       // Prevent storing a cookie that we couldn't decode.
-                       if (!key && (cookie = read(cookie)) !== undefined) {
-                               result[name] = cookie;
-                       }
-               }
-
-               return result;
-       };
-
-       config.defaults = {};
-
-       $.removeCookie = function (key, options) {
-               // Must not alter options, thus extending a fresh object...
-               $.cookie(key, '', $.extend({}, options, { expires: -1 }));
-               return !$.cookie(key);
-       };
-
-}));
index f2d12886a9304712fedcea478bf69c08ae65e1d5..6529c1b3400a514c771dd600145343bc97e31c1d 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -449,6 +449,11 @@ jquery-simulate@^1.0.2:
   resolved "https://registry.yarnpkg.com/jquery-simulate/-/jquery-simulate-1.0.2.tgz#2174b859b75123a0ac6d8ab3a9a6fb4ad7e82898"
   integrity sha512-Bq610fSrwTwvH5d06z5oskYaX/79s0BNrKiJZjZOiXRib3iL4ZkSn/wvLwzhf3P9KeXCEpk9wlIaGui/1arOpQ==
 
+jquery.cookie@^1.4.1:
+  version "1.4.1"
+  resolved "https://registry.yarnpkg.com/jquery.cookie/-/jquery.cookie-1.4.1.tgz#d63dce209eab691fe63316db08ca9e47e0f9385b"
+  integrity sha1-1j3OIJ6raR/mMxbbCMqeR+D5OFs=
+
 js-tokens@^4.0.0:
   version "4.0.0"
   resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"