我正在使用JS代码弹出gdpr合规性,向用户显示该网站正在使用cookie。我添加了JS函数,在网站页脚上调用了该函数,但出现控制台错误,并出现了弹出窗口,但是单击接受按钮时无法将其关闭。
我尝试调试,更改了网站上包含的脚本的顺序。我什至关闭了所有其他脚本,但仍然没有任何反应。
var n = "local" === o.storage ? parseInt(localStorage.getItem("cookiesConsentDate")) : "session" === o.storage ? parseInt(sessionStorage.getItem("cookiesConsentDate")) : parseInt(a.cookie("cookiesConsentDate")),
t = this.length ? this : a('<div>', {
html: '<p id="demo" class="cookie-text col-md-10">' + o.message + '<a style="' + o.learnMoreStyle + '" href="'+ o.learnMoreLink +'"> '+ o.learnMoreText + '</a></p>',
class: o.possition + ' ' + 'row' + ' ' + 'ccwrap',
style: "z-index:9999;background:white;font-size:14px;position:fixed;width:100%;padding:1rem 1rem;background-color:white;color:#333;text-align:center;display:none;" + o.style
}).append(accept).append(decline).prependTo(a("body"));
return o.onInit.call(t), o.testing || !n || n + 864e5 * o.consentTime < (new Date).getTime() ? a(t).show() : a(t).hide(), t.each(function() {
var e = a(this);
a(this).prependTo(a("body")), a(this).find("." + o.acceptClass).click(function() {
"local" === o.storage ? localStorage.setItem("cookiesConsentDate", (new Date).getTime()) : "session" === o.storage ? sessionStorage.setItem("cookiesConsentDate", (new Date).getTime()) : a.cookie("cookiesConsentDate", (new Date).getTime(), {
expires: new Date((new Date).getTime() + 864e5 * o.consentTime),
path: "/"
}), e.slideUp(), o.onConsent.call(e)
}),
a(this).prependTo(a("body")), a(this).find("." + o.declineClass).click(function() {
"local" === o.storage ? localStorage.setItem("cookiesConsentDate", (new Date).getTime()) : "session" === o.storage ? sessionStorage.setItem("cookiesConsentDate", (new Date).getTime()) : a.cookie("cookiesConsentDate", (new Date).getTime(), {
expires: new Date((new Date).getTime() + 1),
path: "/"
}), e.slideUp(), o.onDecline.call(e)
})
}
错误是
Uncaught Error: Syntax error, unrecognized expression: .
at Function.ea.error (jquery.js?ver=1.12.4-wp:2)
at ea.tokenize (jquery.js?ver=1.12.4-wp:2)
at Function.ea (jquery.js?ver=1.12.4-wp:2)
at Function.a.find (jquery-migrate.min.js?ver=1.4.1:2)
at a.fn.init.find (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.a.fn.find (jquery-migrate.min.js?ver=1.4.1:2)
at HTMLDivElement.<anonymous> (cookieconsent.min.js?ver=1.0:58)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.a.fn.cookieConsent (cookieconsent.min.js?ver=1.0:56)
每个功能的第56行。