mirror of https://github.com/calzoneman/sync.git
Eliminate jQuery from inline js/css charlimit notice
This commit is contained in:
parent
7441892235
commit
4fada9a8d2
21
www/js/ui.js
21
www/js/ui.js
|
@ -903,25 +903,28 @@ $("#fullscreenbtn").on('click', function () {
|
||||||
|
|
||||||
function handleCSSJSTooLarge(selector) {
|
function handleCSSJSTooLarge(selector) {
|
||||||
if (this.value.length > 20000) {
|
if (this.value.length > 20000) {
|
||||||
var warning = $(selector);
|
let notice = document.querySelector(selector);
|
||||||
if (warning.length > 0) {
|
if (notice !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
warning = makeAlert("Maximum Size Exceeded", "Inline CSS and JavaScript are " +
|
notice = makeAlert("Maximum Size Exceeded", "Inline CSS and JavaScript are " +
|
||||||
"limited to 20,000 characters or less. If you need more room, you " +
|
"limited to 20,000 characters or less. If you need more room, you " +
|
||||||
"need to use the external CSS or JavaScript option.", "alert-danger")
|
"need to use the external CSS or JavaScript option.", "alert-danger")
|
||||||
.attr("id", selector.replace(/#/, ""));
|
.attr("id", selector.replace(/#/, ""));
|
||||||
warning.insertBefore(this);
|
|
||||||
|
// makeAlert returns jQuery
|
||||||
|
this.parentNode.insertBefore(notice[0], this);
|
||||||
} else {
|
} else {
|
||||||
$(selector).remove();
|
let notice = document.querySelector(selector);
|
||||||
|
notice.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#cs-csstext").bind("input", handleCSSJSTooLarge.bind($("#cs-csstext")[0],
|
['#cs-csstext', '#cs-jstext'].forEach((selector)=>{
|
||||||
"#cs-csstext-too-big"));
|
elem = document.querySelector(selector);
|
||||||
$("#cs-jstext").bind("input", handleCSSJSTooLarge.bind($("#cs-jstext")[0],
|
elem.addEventListener('input', handleCSSJSTooLarge.bind(elem, `${selector}-too-big`));
|
||||||
"#cs-jstext-too-big"));
|
});
|
||||||
|
|
||||||
$("#resize-video-larger").on('click', function () {
|
$("#resize-video-larger").on('click', function () {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue