This is an automated email from the ASF dual-hosted git repository.

dhavalrajpara pushed a commit to branch ranger-2.8
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.8 by this push:
     new ed470a7a1 RANGER-5389 : Replace unmaintained jquery-cookie library 
with modern alternative (#777)
ed470a7a1 is described below

commit ed470a7a175bbb11b4e193e59bf159baaa547fba
Author: Dhaval Rajpara <[email protected]>
AuthorDate: Sat Jan 31 00:36:03 2026 +0530

    RANGER-5389 : Replace unmaintained jquery-cookie library with modern 
alternative (#777)
    
    Co-authored-by: Dhaval Rajpara <[email protected]>
---
 .../webapp/libs/other/jquery-cookie/js/bower.json  |  18 ----
 .../libs/other/jquery-cookie/js/cookie.jquery.json |  32 ------
 .../libs/other/jquery-cookie/js/jquery.cookie.js   | 117 ---------------------
 .../libs/other/jquery-cookie/js/package.json       |  31 ------
 security-admin/src/main/webapp/scripts/Init.js     |   4 -
 .../src/main/webapp/scripts/views/common/TopNav.js |   5 +-
 6 files changed, 2 insertions(+), 205 deletions(-)

diff --git 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/bower.json 
b/security-admin/src/main/webapp/libs/other/jquery-cookie/js/bower.json
deleted file mode 100644
index 8a5b5d04c..000000000
--- a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/bower.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  "name": "jquery.cookie",
-  "version": "1.4.0",
-  "main": [
-    "./jquery.cookie.js"
-  ],
-  "dependencies": {
-    "jquery": ">=1.2"
-  },
-  "ignore": [
-    "test",
-    ".*",
-    "*.json",
-    "*.md",
-    "*.txt",
-    "Gruntfile.js"
-  ]
-}
diff --git 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/cookie.jquery.json 
b/security-admin/src/main/webapp/libs/other/jquery-cookie/js/cookie.jquery.json
deleted file mode 100644
index 522d5e159..000000000
--- 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/cookie.jquery.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-  "name": "cookie",
-  "version": "1.4.0",
-  "title":  "jQuery Cookie",
-  "description": "A simple, lightweight jQuery plugin for reading, writing and 
deleting cookies.",
-  "author": {
-    "name": "Klaus Hartl",
-    "url": "https://github.com/carhartl";
-  },
-  "maintainers": [
-    {
-      "name": "Klaus Hartl",
-      "url": "https://github.com/carhartl";
-    },
-    {
-      "name": "Fagner Martins",
-      "url": "https://github.com/FagnerMartinsBrack";
-    }
-  ],
-  "licenses": [
-    {
-      "type": "MIT",
-      "url": 
"https://raw.github.com/carhartl/jquery-cookie/master/MIT-LICENSE.txt";
-    }
-  ],
-  "dependencies": {
-    "jquery": ">=1.2"
-  },
-  "bugs": "https://github.com/carhartl/jquery-cookie/issues";,
-  "homepage": "https://github.com/carhartl/jquery-cookie";,
-  "docs": "https://github.com/carhartl/jquery-cookie#readme";
-}
diff --git 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/jquery.cookie.js 
b/security-admin/src/main/webapp/libs/other/jquery-cookie/js/jquery.cookie.js
deleted file mode 100644
index 927190008..000000000
--- 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/jquery.cookie.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/*!
- * jQuery Cookie Plugin v1.4.0
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2013 Klaus Hartl
- * Released under the MIT license
- */
-(function (factory) {
-       if (typeof define === 'function' && define.amd) {
-               // AMD. Register as anonymous module.
-               define(['jquery'], factory);
-       } 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.
-                       s = decodeURIComponent(s.replace(pluses, ' '));
-               } catch(e) {
-                       return;
-               }
-
-               try {
-                       // If we can't parse the cookie, ignore it, it's 
unusable.
-                       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 (value !== undefined && !$.isFunction(value)) {
-                       options = $.extend({}, config.defaults, options);
-
-                       if (typeof options.expires === 'number') {
-                               var days = options.expires, t = options.expires 
= new Date();
-                               t.setDate(t.getDate() + days);
-                       }
-
-                       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().
-               var cookies = document.cookie ? document.cookie.split('; ') : 
[];
-
-               for (var i = 0, l = cookies.length; i < l; i++) {
-                       var parts = cookies[i].split('=');
-                       var name = decode(parts.shift());
-                       var cookie = parts.join('=');
-
-                       if (key && 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) {
-               if ($.cookie(key) !== undefined) {
-                       // Must not alter options, thus extending a fresh 
object...
-                       $.cookie(key, '', $.extend({}, options, { expires: -1 
}));
-                       return true;
-               }
-               return false;
-       };
-
-}));
diff --git 
a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/package.json 
b/security-admin/src/main/webapp/libs/other/jquery-cookie/js/package.json
deleted file mode 100644
index 3942d3247..000000000
--- a/security-admin/src/main/webapp/libs/other/jquery-cookie/js/package.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-  "name": "jquery.cookie",
-  "version": "1.4.0",
-  "description": "A simple, lightweight jQuery plugin for reading, writing and 
deleting cookies.",
-  "main": "Gruntfile.js",
-  "directories": {
-    "test": "test"
-  },
-  "scripts": {
-    "test": "grunt"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/carhartl/jquery-cookie.git"
-  },
-  "author": "Klaus Hartl",
-  "license": "MIT",
-  "gitHead": "bd3c9713222bace68d25fe2128c0f8633cad1269",
-  "readmeFilename": "README.md",
-  "devDependencies": {
-    "grunt": "~0.4.1",
-    "grunt-contrib-jshint": "~0.4.0",
-    "grunt-contrib-uglify": "~0.2.0",
-    "grunt-contrib-qunit": "~0.2.0",
-    "grunt-contrib-watch": "~0.3.0",
-    "grunt-compare-size": "~0.4.0",
-    "grunt-saucelabs": "~4.1.1",
-    "grunt-contrib-connect": "~0.5.0",
-    "gzip-js": "~0.3.0"
-  }
-}
diff --git a/security-admin/src/main/webapp/scripts/Init.js 
b/security-admin/src/main/webapp/scripts/Init.js
index bff79b3c4..42f3f8deb 100644
--- a/security-admin/src/main/webapp/scripts/Init.js
+++ b/security-admin/src/main/webapp/scripts/Init.js
@@ -46,9 +46,6 @@ require.config({
         'jquery-toggles': {
             deps: ['jquery']
         },
-        'jquery.cookie': {
-            deps: ['jquery']
-        },
         'tag-it': {
             deps: ['jquery', 'jquery-ui']
         },
@@ -130,7 +127,6 @@ require.config({
         'momentTz': '../libs/bower/moment/js/moment-timezone-with-data.min',
         'daterangepicker': '../libs/other/daterangepicker/js/daterangepicker',
         'bootstrap-notify': 
'../libs/bower/bootstrap-notify/js/bootstrap-notify',
-        'jquery.cookie': '../libs/other/jquery-cookie/js/jquery.cookie',
         'jquery-toggles': '../libs/bower/jquery-toggles/js/toggles.min',
         'tag-it': '../libs/bower/tag-it/js/tag-it',
         'select2': '../libs/bower/select2/select2',
diff --git a/security-admin/src/main/webapp/scripts/views/common/TopNav.js 
b/security-admin/src/main/webapp/scripts/views/common/TopNav.js
index 7826ac608..b24989a86 100644
--- a/security-admin/src/main/webapp/scripts/views/common/TopNav.js
+++ b/security-admin/src/main/webapp/scripts/views/common/TopNav.js
@@ -27,7 +27,7 @@ define(function(require){
         var SessionMgr  = require('mgrs/SessionMgr');
         var XAUtil = require('utils/XAUtils');
         var App    =require('App');
-       require('jquery.cookie');
+
        var TopNav = Backbone.Marionette.ItemView.extend(
        /** @lends TopNav */
        {
@@ -80,8 +80,7 @@ define(function(require){
                                that.$('ul li').removeClass('active');
                                that.$('ul li:first').addClass('active');
                        });
-                       $.cookie('clientTimeOffset', new 
Date().getTimezoneOffset());
-                       
+                       document.cookie = "clientTimeOffset=" + new 
Date().getTimezoneOffset();
                        //To hide top menu when user don't have access to all 
it's sub menu's
                        _.each($(this.$el.find('.page-nav ul')), function(ul) {
                                if($(ul).find('li').length <= 0){

Reply via email to