mirror of
https://github.com/pallets-eco/flask-debugtoolbar.git
synced 2026-05-18 07:08:29 -05:00
Simplify jQuery.noConflict mode to fix #16
This commit is contained in:
@@ -1,19 +1,4 @@
|
||||
(function(window, document, version, callback) {
|
||||
var j, d;
|
||||
var loaded = false;
|
||||
if (!(j = window.jQuery) || version > j.fn.jquery || callback(j)) {
|
||||
var script = document.createElement("script");
|
||||
script.type = "text/javascript";
|
||||
script.src = DEBUG_TOOLBAR_STATIC_PATH + "js/jquery.js";
|
||||
script.onload = script.onreadystatechange = function() {
|
||||
if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
|
||||
callback((j = window.jQuery).noConflict(1), loaded = true);
|
||||
j(script).remove();
|
||||
}
|
||||
};
|
||||
document.documentElement.childNodes[0].appendChild(script)
|
||||
}
|
||||
})(window, document, "1.3", function($, jquery_loaded) {
|
||||
(function($) {
|
||||
$.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; } };
|
||||
$('head').append('<link rel="stylesheet" href="'+DEBUG_TOOLBAR_STATIC_PATH+'css/toolbar.css?'+ Math.random() +'" type="text/css" />');
|
||||
var COOKIE_NAME = 'fldt';
|
||||
@@ -181,4 +166,4 @@
|
||||
fldt.init();
|
||||
});
|
||||
|
||||
});
|
||||
})(jQuery.noConflict(true));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="flDebug" style="display:none;">
|
||||
<script type="text/javascript">var DEBUG_TOOLBAR_STATIC_PATH = '{{ static_path }}'</script>
|
||||
<script type="text/javascript" src="{{ static_path }}js/jquery.js"></script>
|
||||
<script type="text/javascript" src="{{ static_path }}js/toolbar.js"></script>
|
||||
|
||||
<div style="display: none;" id="flDebugToolbar">
|
||||
|
||||
Reference in New Issue
Block a user