Skip to content

Commit cbac006

Browse files
author
Max Garin
committed
Remove deprecated bind, unbind, and $.trim
1 parent 58b4dd0 commit cbac006

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/flask_debugtoolbar/static/js/toolbar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function($) {
2-
$.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } };
2+
$.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } };
33
$('head').append('<link rel="stylesheet" href="'+DEBUG_TOOLBAR_STATIC_PATH+'css/toolbar.css?'+ Math.random() +'" type="text/css" />');
44
var COOKIE_NAME = 'fldt';
55
var COOKIE_NAME_ACTIVE = COOKIE_NAME +'_active';
@@ -113,7 +113,7 @@
113113
});
114114
$(this).tablesorter({headers: headers});
115115
})
116-
.bind('sortEnd', function() {
116+
.on('sortEnd', function() {
117117
$(this).find('tbody tr').each(function(idx, elem) {
118118
var even = idx % 2 === 0;
119119
$(elem)
@@ -143,7 +143,7 @@
143143
$('#flDebugToolbar').hide('fast');
144144
$('#flDebugToolbarHandle').show();
145145
// Unbind keydown
146-
$(document).unbind('keydown.flDebug');
146+
$(document).off('keydown.flDebug');
147147
if (setCookie) {
148148
$.cookie(COOKIE_NAME, 'hide', {
149149
path: '/',

0 commit comments

Comments
 (0)