Upgrade to the newer js-cookie library that replaced jquery.cookie. Fixes #2832. Commit ready for merge.
- Legacy-Id: 17211
This commit is contained in:
parent
c9d944b312
commit
d9ea373b81
|
@ -10,8 +10,8 @@
|
||||||
"fullcalendar": "~4",
|
"fullcalendar": "~4",
|
||||||
"highcharts": "~6",
|
"highcharts": "~6",
|
||||||
"html5shiv": "~3",
|
"html5shiv": "~3",
|
||||||
|
"js-cookie": "~2",
|
||||||
"jquery": "~1",
|
"jquery": "~1",
|
||||||
"jquery.cookie": "~1",
|
|
||||||
"jquery.tablesorter": "~2",
|
"jquery.tablesorter": "~2",
|
||||||
"respond": "~1",
|
"respond": "~1",
|
||||||
"select2": "~3",
|
"select2": "~3",
|
||||||
|
@ -56,6 +56,9 @@
|
||||||
"modules/offline-exporting.js",
|
"modules/offline-exporting.js",
|
||||||
"modules/map.js"
|
"modules/map.js"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"js-cookie": {
|
||||||
|
"main": "src/js.cookie.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
ietf/externals/static/jquery.cookie/bower.json
vendored
18
ietf/externals/static/jquery.cookie/bower.json
vendored
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "jquery.cookie",
|
|
||||||
"version": "1.4.1",
|
|
||||||
"main": [
|
|
||||||
"./jquery.cookie.js"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"jquery": ">=1.2"
|
|
||||||
},
|
|
||||||
"ignore": [
|
|
||||||
"test",
|
|
||||||
".*",
|
|
||||||
"*.json",
|
|
||||||
"*.md",
|
|
||||||
"*.txt",
|
|
||||||
"Gruntfile.js"
|
|
||||||
]
|
|
||||||
}
|
|
117
ietf/externals/static/jquery.cookie/jquery.cookie.js
vendored
117
ietf/externals/static/jquery.cookie/jquery.cookie.js
vendored
|
@ -1,117 +0,0 @@
|
||||||
/*!
|
|
||||||
* jQuery Cookie Plugin v1.4.1
|
|
||||||
* https://github.com/carhartl/jquery-cookie
|
|
||||||
*
|
|
||||||
* Copyright 2013 Klaus Hartl
|
|
||||||
* Released under the MIT license
|
|
||||||
*/
|
|
||||||
(function (factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
// AMD
|
|
||||||
define(['jquery'], factory);
|
|
||||||
} else if (typeof exports === 'object') {
|
|
||||||
// CommonJS
|
|
||||||
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 (value !== undefined && !$.isFunction(value)) {
|
|
||||||
options = $.extend({}, config.defaults, options);
|
|
||||||
|
|
||||||
if (typeof options.expires === 'number') {
|
|
||||||
var days = options.expires, t = options.expires = new Date();
|
|
||||||
t.setTime(+t + 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().
|
|
||||||
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) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Must not alter options, thus extending a fresh object...
|
|
||||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
|
||||||
return !$.cookie(key);
|
|
||||||
};
|
|
||||||
|
|
||||||
}));
|
|
17
ietf/externals/static/js-cookie/bower.json
vendored
Normal file
17
ietf/externals/static/js-cookie/bower.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "js-cookie",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": [
|
||||||
|
"src/js.cookie.js"
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"test",
|
||||||
|
"Gruntfile.js",
|
||||||
|
"package.json",
|
||||||
|
".gitignore",
|
||||||
|
".eslintintignore",
|
||||||
|
".eslintrc",
|
||||||
|
".tm_properties",
|
||||||
|
".travis.yml"
|
||||||
|
]
|
||||||
|
}
|
163
ietf/externals/static/js-cookie/src/js.cookie.js
vendored
Normal file
163
ietf/externals/static/js-cookie/src/js.cookie.js
vendored
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
/*!
|
||||||
|
* JavaScript Cookie v2.2.1
|
||||||
|
* https://github.com/js-cookie/js-cookie
|
||||||
|
*
|
||||||
|
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||||
|
* Released under the MIT license
|
||||||
|
*/
|
||||||
|
;(function (factory) {
|
||||||
|
var registeredInModuleLoader;
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(factory);
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (typeof exports === 'object') {
|
||||||
|
module.exports = factory();
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (!registeredInModuleLoader) {
|
||||||
|
var OldCookies = window.Cookies;
|
||||||
|
var api = window.Cookies = factory();
|
||||||
|
api.noConflict = function () {
|
||||||
|
window.Cookies = OldCookies;
|
||||||
|
return api;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}(function () {
|
||||||
|
function extend () {
|
||||||
|
var i = 0;
|
||||||
|
var result = {};
|
||||||
|
for (; i < arguments.length; i++) {
|
||||||
|
var attributes = arguments[ i ];
|
||||||
|
for (var key in attributes) {
|
||||||
|
result[key] = attributes[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function decode (s) {
|
||||||
|
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init (converter) {
|
||||||
|
function api() {}
|
||||||
|
|
||||||
|
function set (key, value, attributes) {
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = extend({
|
||||||
|
path: '/'
|
||||||
|
}, api.defaults, attributes);
|
||||||
|
|
||||||
|
if (typeof attributes.expires === 'number') {
|
||||||
|
attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We're using "expires" because "max-age" is not supported by IE
|
||||||
|
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
var result = JSON.stringify(value);
|
||||||
|
if (/^[\{\[]/.test(result)) {
|
||||||
|
value = result;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
value = converter.write ?
|
||||||
|
converter.write(value, key) :
|
||||||
|
encodeURIComponent(String(value))
|
||||||
|
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||||
|
|
||||||
|
key = encodeURIComponent(String(key))
|
||||||
|
.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
|
||||||
|
.replace(/[\(\)]/g, escape);
|
||||||
|
|
||||||
|
var stringifiedAttributes = '';
|
||||||
|
for (var attributeName in attributes) {
|
||||||
|
if (!attributes[attributeName]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
|
if (attributes[attributeName] === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Considers RFC 6265 section 5.2:
|
||||||
|
// ...
|
||||||
|
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
||||||
|
// character:
|
||||||
|
// Consume the characters of the unparsed-attributes up to,
|
||||||
|
// not including, the first %x3B (";") character.
|
||||||
|
// ...
|
||||||
|
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get (key, json) {
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var jar = {};
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all.
|
||||||
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (; i < cookies.length; i++) {
|
||||||
|
var parts = cookies[i].split('=');
|
||||||
|
var cookie = parts.slice(1).join('=');
|
||||||
|
|
||||||
|
if (!json && cookie.charAt(0) === '"') {
|
||||||
|
cookie = cookie.slice(1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var name = decode(parts[0]);
|
||||||
|
cookie = (converter.read || converter)(cookie, name) ||
|
||||||
|
decode(cookie);
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
try {
|
||||||
|
cookie = JSON.parse(cookie);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar[name] = cookie;
|
||||||
|
|
||||||
|
if (key === name) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return key ? jar[key] : jar;
|
||||||
|
}
|
||||||
|
|
||||||
|
api.set = set;
|
||||||
|
api.get = function (key) {
|
||||||
|
return get(key, false /* read as raw */);
|
||||||
|
};
|
||||||
|
api.getJSON = function (key) {
|
||||||
|
return get(key, true /* read as json */);
|
||||||
|
};
|
||||||
|
api.remove = function (key, attributes) {
|
||||||
|
set(key, '', extend(attributes, {
|
||||||
|
expires: -1
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
api.defaults = {};
|
||||||
|
|
||||||
|
api.withConverter = init;
|
||||||
|
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
|
return init(function () {});
|
||||||
|
}));
|
|
@ -7,7 +7,7 @@ jQuery.ajaxSetup({
|
||||||
crossDomain: false, // obviates need for sameOrigin test
|
crossDomain: false, // obviates need for sameOrigin test
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
if (!csrfSafeMethod(settings.type)) {
|
if (!csrfSafeMethod(settings.type)) {
|
||||||
xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
|
xhr.setRequestHeader("X-CSRFToken", Cookies.get('csrftoken'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -15,10 +15,10 @@ jQuery.ajaxSetup({
|
||||||
// Remember the state of the "browsehappy" alert
|
// Remember the state of the "browsehappy" alert
|
||||||
$('#browsehappy .close').click(function(e) {
|
$('#browsehappy .close').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$.cookie('browsehappy', 'closed', { path: '/' });
|
Cookies.set('browsehappy', 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
if(typeof $.cookie('browsehappy') === 'undefined') {
|
if(typeof Cookies.get('browsehappy') === 'undefined') {
|
||||||
$('#browsehappy').show();
|
$('#browsehappy').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
<script>$(".visible-nojs").removeClass("visible-nojs");</script>
|
<script>$(".visible-nojs").removeClass("visible-nojs");</script>
|
||||||
<script>$(".hidden-nojs").removeClass("hidden-nojs");</script>
|
<script>$(".hidden-nojs").removeClass("hidden-nojs");</script>
|
||||||
<script src="{% static 'jquery.cookie/jquery.cookie.js' %}"></script>
|
<script src="{% static 'js-cookie/src/js.cookie.js' %}"></script>
|
||||||
<script src="{% static 'ietf/bootstrap/js/bootstrap.min.js' %}"></script>
|
<script src="{% static 'ietf/bootstrap/js/bootstrap.min.js' %}"></script>
|
||||||
<script src="{% static 'ietf/js/ietf.js' %}"></script>
|
<script src="{% static 'ietf/js/ietf.js' %}"></script>
|
||||||
{% block js %}{% endblock %}
|
{% block js %}{% endblock %}
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<script type="text/javascript" src="{% static 'ietf/js/agenda/jquery-1.8.2.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'ietf/js/agenda/jquery-1.8.2.min.js' %}"></script>
|
||||||
<script src="{% static 'jquery.cookie/jquery.cookie.js' %}"></script>
|
<script src="{% static 'js-cookie/src/js.cookie.js' %}"></script>
|
||||||
<script>
|
<script>
|
||||||
jQuery.ajaxSetup({
|
jQuery.ajaxSetup({
|
||||||
crossDomain: false, // obviates need for sameOrigin test
|
crossDomain: false, // obviates need for sameOrigin test
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
if (!csrfSafeMethod(settings.type)) {
|
if (!csrfSafeMethod(settings.type)) {
|
||||||
xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
|
xhr.setRequestHeader("X-CSRFToken", Cookies.get('csrftoken'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<script type="text/javascript" src="{% static 'ietf/js/agenda/jquery-1.8.2.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'ietf/js/agenda/jquery-1.8.2.min.js' %}"></script>
|
||||||
<script src="{% static 'jquery.cookie/jquery.cookie.js' %}"></script>
|
<script src="{% static 'js-cookie/src/js.cookie.js' %}"></script>
|
||||||
<script>
|
<script>
|
||||||
jQuery.ajaxSetup({
|
jQuery.ajaxSetup({
|
||||||
crossDomain: false, // obviates need for sameOrigin test
|
crossDomain: false, // obviates need for sameOrigin test
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
if (!csrfSafeMethod(settings.type)) {
|
if (!csrfSafeMethod(settings.type)) {
|
||||||
xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
|
xhr.setRequestHeader("X-CSRFToken", Cookies.get('csrftoken'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{% if can_manage_materials %}
|
{% if can_manage_materials %}
|
||||||
<script type="text/javascript" src="{% static 'jquery/jquery.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'jquery/jquery.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'jquery.cookie/jquery.cookie.js' %}"></script>
|
<script type="text/javascript" src="{% static 'js-cookie/src/js.cookie.js' %}"></script>
|
||||||
<script type="text/javascript" src={% static 'Sortable/Sortable.min.js' %}></script>
|
<script type="text/javascript" src={% static 'Sortable/Sortable.min.js' %}></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
crossDomain: false,
|
crossDomain: false,
|
||||||
beforeSend: function(xhr, settings) {
|
beforeSend: function(xhr, settings) {
|
||||||
if (!csrfSafeMethod(settings.type)) {
|
if (!csrfSafeMethod(settings.type)) {
|
||||||
xhr.setRequestHeader("X-CSRFToken", $.cookie('csrftoken'));
|
xhr.setRequestHeader("X-CSRFToken", Cookies.get('csrftoken'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue