本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
有兴趣想参与WIKI建设的玩家可以加入交流群。赛尔计划WIKI交流群:818743827
编辑帮助:目录 • BWIKI反馈留言板
本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~ 有兴趣想参与WIKI建设的玩家可以加入交流群。赛尔计划WIKI交流群:818743827
Widget:沙盒556
<script src="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.3/quill.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.3/quill.snow.min.css" rel="stylesheet"> <link href="unpkg.com/quill-better-table@1.2.10/dist/quill-better-table.css" rel="stylesheet"> <script src="https://wiki.biligame.com/seerwar/MediaWiki:Quill-better-table.min.js?action=raw&ctype=text/javascript"></script> <script id="rendered-js"> Quill.register({
'modules/better-table': quillBetterTable },
true);
window.onload = () => {
const quill = new Quill('#editor', { theme: 'snow', modules: { table: true, toolbar: { container: [ [{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown [{ 'header': [1, 2, 3, 4, 5, 6, false] }], [{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme [{ 'align': [] }], ['bold', 'italic', 'underline', 'strike','link','image','video','table'], // toggled buttons ['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values [{ 'list': 'ordered'}, { 'list': 'bullet' }], [{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript [{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent [{ 'direction': 'rtl' }], // text direction
['clean'] ], handlers: { table: function(val) { this.quill.getModule('better-table').insertTable(3, 3) } } }, 'better-table': { operationMenu: { items: { unmergeCells: { text: 'Another unmerge cells name' }, insertColumnRight: { text: '右边插入一列' }, insertColumnLeft: { text: '左边插入一列' }, insertRowUp: { text: '上边插入一行' }, insertRowDown: { text: '下边插入一行' }, mergeCells: { text: '合并单元格' }, unmergeCells: { text: '拆分单元格' }, deleteColumn: { text: '删除列' }, deleteRow: { text: '删除行' }, deleteTable: { text: '删除表格' } }, color: { colors: ['green', 'red', 'yellow', 'blue', 'white'], text: 'Background Colors:' } } }
// keyboard: { // bindings: quillBetterTable.keyboardBindings // } } });
let tableModule = quill.getModule('better-table'); document.body.querySelector('#insert-table'). onclick = () => { tableModule.insertTable(3, 3); };
document.body.querySelector('#get-table'). onclick = () => { console.log(tableModule.getTable()); };
document.body.querySelector('#get-contents'). onclick = () => { updateDeltaView(quill); };
};
function updateDeltaView(quill) {
document.body.querySelector('#delta-view'). innerHTML = JSON.stringify( quill.getContents());
} //# sourceURL=pen.js
</script>
<script> (window.RLQ = window.RLQ || []).push(['jquery', () => {
$(document).ready(function () { var u = (document.cookie.match(/DedeUserID=([^;]+)/) || [])[1] || ""; var dz = mw.config.values.wgGameName; var vcname = dz.slice(0, 1).toUpperCase() var moban var other var sj = parseInt(Math.random(100) * 10).toString() + parseInt(Math.random(100) * 10).toString() + parseInt(Math.random(100) * 10).toString() var VC = `${vcname}VC${parseInt(Math.round(new Date() / 1000) + sj).toString(32).toUpperCase()}` window.vc = VC window.DZ = dz
document.getElementById("inputDOM").innerHTML = `
<tbody></tbody>基础信息 | |||
---|---|---|---|
<textarea maxlength="" placeholder="请输入标题(建议30字以内)" style="overflow-y: hidden;height: auto;border: 0px;font-size: 28px;padding: 12px 50px 12px 0px;font-weight: 700;line-height: 40px;width: 100%;" id="title"></textarea> | |||
发布模式: | <form name="Publishingmode"><input type="radio" name="gender" onclick="getmodenValue()" value="投稿模式" checked> 投稿模式 <input type="radio" name="gender" onclick="getmodenValue()" value="直发模式"> 直发模式 </form> | ||
投稿分区: | <select id="lx" tabindex="6" name="类别" class="createboxInput pfShowIfSelected" onchange="fenqu()"><option value="">--请选择稿件分区--</option><option value="攻略视频">攻略视频</option><option value="同人文">同人文</option><option value="专栏攻略">专栏攻略</option><option value="同人视频">同人视频</option><option value="同人图">同人图</option><option value="表情包">表情包</option><option value="cosplay">cosplay</option></select> | ||
类型: | <select id="yuan" tabindex="6" name="同人图片[是否原创]" class="createboxInput pfShowIfSelected" onchange="yc()"><option value="">--请选择类型--</option><option value="自制">自制</option><option value="转载">转载</option></select> | ||
时间: | <input id="time" type="date"> | ||
作者: | <input id="up" tabindex="4" class="createboxInput mandatoryField" size="35" name="同人图片[作者]"> | ||
B站昵称: | <input id="bname" tabindex="4" class="createboxInput mandatoryField" size="35" name="同人图片[作者]" value="${UserStatus.userInfo.uname}"> | ||
B站UID: | <input id="BUID" tabindex="5" class="createboxInput mandatoryField" size="35" name="同人图片[B站UID]" value="${u}"> | ||
相关角色: | <input id="xgjs" tabindex="4" class="createboxInput mandatoryField" size="35" name="同人图片[作者]"> | ||
合集 | <select id="sfhj" tabindex="6" name="合集[是否原创]" class="createboxInput pfShowIfSelected" onchange="heji()"><option value=""></option><option value="是">是</option><option value="否">否</option></select><input id="hj" tabindex="5" class="createboxInput mandatoryField" size="35" name="同人图片[B站UID]" style="display: none;"> | ||
定时发布: | <select id="sfdingshi" tabindex="6" name="定时[是否]" class="createboxInput pfShowIfSelected" onchange="ds()"><option value="">--是否定时--</option><option value="是">是</option><option value="否">否</option></select><input type="datetime-local" id="ding-datetime" style="display: none;"> |
` document.getElementById("btnDOM").innerHTML = `
Ver 0.6.5
<button class='submit-btn-group-add' id='btn' style='display: inline-block;height: 40px;font-size: 14px;border-radius: 42px;text-align: center;vertical-align: middle; width: 120px; border: #fff0;cursor: pointer;line-height: 40px;color: #fff;background: #37c8f7;'>立即投稿</button>
`
//设置元素可见度及样式 getmodenValue(); document.getElementById('zizhi').style.display = "none" document.getElementsByClassName("zhuanzai")[0].style.display = "none" document.getElementById('ding-datetime').style.display = "none" document.getElementById('hj').style.display = "none" document.getElementById('btn').disabled = true document.getElementById('btn').style.background = "#e5e9ef" document.getElementById('btn').style.color = "#99a2aa" //设置元素value值 document.getElementById("BUID").value = u; //document.getElementById("bname").value = UserStatus.userInfo.uname; //提交主函数 document.getElementById("btn").onclick = function () { var xycode = 0; var fqq = document.getElementById("lx").value var lxx = document.getElementById("yuan").value var titx = document.getElementById("title").value var zhuan1 = document.getElementById("input_7").value var zhuan2 = document.getElementById("input_8").value var quillinnerHTML = document.getElementsByClassName("ql-editor")[0].innerHTML if (fqq == "") { xycode = 101; } if (lxx == "") { xycode = 102; } if (titx == "") { xycode = 103; } if (document.getElementById("yuan").value == "转载") { if (zhuan1 == "") { xycode = 104; } if (zhuan2 == "") { xycode = 105; } } else { }
switch (modenValue) { case `直发模式`: { if(titx != ""){
var $qlEditor = $('.ql-editor'); // 获取ql-editor文本框的jQuery对象 var imgIndex = 0; // 初始化编号为0 window.title1 = document.getElementById("title").value.replace(/</g, "<").replace(/>/g, ">")
$qlEditor.find('img').each(function () {
var imgSrc = $(this).attr('src'); // 获取当前img的src值 submitAndReplaceImg(imgSrc); // 提交src值并替换img标签 // 注意:这里不需要在.each()的回调内部处理递归,因为submitAndReplaceImg会自行处理
}); function submitAndReplaceImg(imgSrc) {
var filename = `${VC}-${imgIndex}`; // 从file对象中获取MIME类型,并提取出文件扩展名 var file = base64ConvertFile(imgSrc, filename); // 注意这里不再硬编码".png" var mimeType = file.type; var fileExt = mimeType.split('/')[1]; // 提取出子类型作为文件扩展名
new mw.Api().upload(file, { filename: filename + `.${fileExt}`, ignorewarnings: true }) // API调用成功后的处理逻辑 console.log('API调用成功惹!٩(๑>◡<๑)۶ '); // 替换img标签为带有顺序编号的文本格式 $qlEditor.find('img[src="' + imgSrc + '"]').replaceWith(`[[文件:${VC}-${imgIndex}.${fileExt}]]`); imgIndex++; // 递增编号
// 检查是否还有剩余的img需要处理 var $remainingImgs = $qlEditor.find('img'); if ($remainingImgs.length > 0) { // 如果有剩余的img,递归调用submitAndReplaceImg处理下一个img submitAndReplaceImg($remainingImgs.first().attr('src')); } quillinnerHTML = document.getElementsByClassName("ql-editor")[0].innerHTML
}
var regex = /<colgroup[^>]*>.*?<\/colgroup>/gi; var regex1 = /<tbody[^>]*>.*?<\/tbody>/gi; if (regex.test(quillinnerHTML)) {
console.log('字符串中包含 <colgroup> 标签'); quillinnerHTML = removeColgroupsRegex(quillinnerHTML);
}
if (regex1.test(quillinnerHTML)) {
console.log('字符串中包含 <tbody> 标签'); quillinnerHTML = removeColgroupsRegex1(quillinnerHTML);
}
getApi(`https://wiki.biligame.com/${dz}/api.php?action=query&meta=tokens&format=json`, function (json) {
let token = JSON.parse(json).query.tokens.csrftoken let url = `https://wiki.biligame.com/${dz}/api.php` let fd = new FormData() fd.append("action", "edit") fd.append("title", `${window.title1}`) fd.append("text", `${quillinnerHTML}`) fd.append("token", token) fd.append("format", "json") postFdApi(url, fd) window.onbeforeunload = function () { }
document.getElementById("toolsall").innerHTML = `
`
}) }else{
alert(`投稿失败,请填写标题后再试一下吧o(╥﹏╥)o`);
}
break; } case `投稿模式`: { switch (xycode) { case 0: { var $qlEditor = $('.ql-editor'); // 获取ql-editor文本框的jQuery对象 var imgIndex = 0; // 初始化编号为0
$qlEditor.find('img').each(function () { var imgSrc = $(this).attr('src'); // 获取当前img的src值 submitAndReplaceImg(imgSrc); // 提交src值并替换img标签 // 注意:这里不需要在.each()的回调内部处理递归,因为submitAndReplaceImg会自行处理 }); function submitAndReplaceImg(imgSrc) { var filename = `${VC}-${imgIndex}`; // 从file对象中获取MIME类型,并提取出文件扩展名 var file = base64ConvertFile(imgSrc, filename); // 注意这里不再硬编码".png" var mimeType = file.type; var fileExt = mimeType.split('/')[1]; // 提取出子类型作为文件扩展名 new mw.Api().upload(file, { filename: filename + `.${fileExt}`, ignorewarnings: true }) // API调用成功后的处理逻辑 console.log('API调用成功惹!٩(๑>◡<๑)۶ '); // 替换img标签为带有顺序编号的文本格式 $qlEditor.find('img[src="' + imgSrc + '"]').replaceWith(`[[文件:${VC}-${imgIndex}.${fileExt}]]`); imgIndex++; // 递增编号
// 检查是否还有剩余的img需要处理 var $remainingImgs = $qlEditor.find('img'); if ($remainingImgs.length > 0) { // 如果有剩余的img,递归调用submitAndReplaceImg处理下一个img submitAndReplaceImg($remainingImgs.first().attr('src')); } quillinnerHTML = document.getElementsByClassName("ql-editor")[0].innerHTML
}
var regex = /<colgroup[^>]*>.*?<\/colgroup>/gi;
var regex1 = /<tbody[^>]*>.*?<\/tbody>/gi;
if (regex.test(quillinnerHTML)) {
console.log('字符串中包含 <colgroup> 标签');
quillinnerHTML = removeColgroupsRegex(quillinnerHTML);
}
if (regex1.test(quillinnerHTML)) {
console.log('字符串中包含 <tbody> 标签');
quillinnerHTML = removeColgroupsRegex1(quillinnerHTML);
}
getApi(`https://wiki.biligame.com/${dz}/api.php?action=query&meta=tokens&format=json`, function (json) { let token = JSON.parse(json).query.tokens.csrftoken let url = `https://wiki.biligame.com/${dz}/api.php` let fd = new FormData() fd.append("action", "edit") fd.append("title", `${VC}`) fd.append("text", `{{${window.moban}|标题=${document.getElementById("title").value.replace(/</g, "<").replace(/>/g, ">")}|上级页面=${document.getElementById("lx").value.replace(/</g, "<").replace(/>/g, ">")}|更新时间=${document.getElementById("time").value.replace(/</g, "<").replace(/>/g, ">")}|作者=${document.getElementById("up").value.replace(/</g, "<").replace(/>/g, ">")}|${vcname}VC=${VC}|UID=${document.getElementById("BUID").value.replace(/</g, "<").replace(/>/g, ">")}|B站昵称=${document.getElementById("bname").value.replace(/</g, "<").replace(/>/g, ">")}|是否原创=${document.getElementById("yuan").value.replace(/</g, "<").replace(/>/g, ">")}|相关角色=${document.getElementById("xgjs").value.replace(/</g, "<").replace(/>/g, ">")}|内容=${quillinnerHTML}|来源=${document.getElementById("input_7").value}|原文地址=${document.getElementById("input_8").value}|是否显示合集=${document.getElementById("sfhj").value}|合集名称=${document.getElementById("hj").value}|是否定时=${document.getElementById("sfdingshi").value}|定时=${document.getElementById("ding-datetime").value.replace("T", " ")}|自制声明=${document.getElementById("shengming").value}}}`) fd.append("token", token) fd.append("format", "json") postFdApi(url, fd) window.onbeforeunload = function () { }
document.getElementById("toolsall").innerHTML = `
`
}) break; } case 101: { alert(`投稿失败,请选择投稿分区后再试一下吧o(╥﹏╥)o`); xycode = 0; break; } case 102: { alert(`投稿失败,请选择类型后再试一下吧o(╥﹏╥)o`); xycode = 0; break; } case 103: { alert(`投稿失败,请填写标题后再试一下吧o(╥﹏╥)o`); xycode = 0; break; } case 104: { alert(`投稿失败,请填写【转载】来源后再试一下吧o(╥﹏╥)o`); xycode = 0; break; } case 105: { alert(`投稿失败,请填写【转载】原文地址后再试一下吧o(╥﹏╥)o`); xycode = 0; break; } case 106: { break; } } break; }
}
}
window.onbeforeunload = function () { return "您的投稿尚未保存!"; } });
}]);
function goagain(){
document.getElementById("ca-purge").getElementsByTagName("a")[0].click()
}
function gopage() {
switch (modenValue) { case `直发模式`: { (window.RLQ = window.RLQ || []).push(['jquery', () => { location.href = `https://wiki.biligame.com/${DZ}/${window.title1}`; }]); break; } case `投稿模式`: { (window.RLQ = window.RLQ || []).push(['jquery', () => { location.href = `https://wiki.biligame.com/${DZ}/${vc}`; }]); break; } }
}
function fenqu() {
(window.RLQ = window.RLQ || []).push(['jquery', () => { $(document).ready(function() { var lx = document.getElementById("lx").value switch (lx) { case "同人图": window.moban = "同人图片|类别=同人图片"; break; case "表情包": window.moban = "同人图片|类别=表情包"; break; case "cosplay": window.moban = "同人图片|类别=cosplay"; break; case "攻略视频": window.moban = "视频模板|类别=攻略视频"; break; case "同人视频": window.moban = "视频模板|类型=同人视频"; break; case "专栏攻略": window.moban = "文章模板|类型=专栏攻略"; break; case "同人文": window.moban = "文章模板|类型=同人文"; break; } }) }]);
}
function yc() {
(window.RLQ = window.RLQ || []).push(['jquery', () => { $(document).ready(function() { var yuan = document.getElementById("yuan").value if (yuan == '自制') { document.getElementById('zizhi').style.display = "revert" document.getElementsByClassName("zhuanzai")[0].style.display = "none" } else { if (yuan == '转载') { document.getElementById('zizhi').style.display = "none" document.getElementsByClassName("zhuanzai")[0].style.display = "revert" } else { document.getElementById('zizhi').style.display = "none" document.getElementsByClassName("zhuanzai")[0].style.display = "none" } } }) }]);
}
function ds() {
(window.RLQ = window.RLQ || []).push(['jquery', () => { $(document).ready(function() { var sfdingshi = document.getElementById("sfdingshi").value if (sfdingshi == '是') { document.getElementById('ding-datetime').style.display = "revert" } else { if (sfdingshi == '否') { document.getElementById('ding-datetime').style.display = "none" } else { document.getElementById('ding-datetime').style.display = "none" } } }) }]);
}
function heji() {
(window.RLQ = window.RLQ || []).push(['jquery', () => { $(document).ready(function() { var sfdingshi = document.getElementById("sfhj").value if (sfdingshi == '是') { document.getElementById('hj').style.display = "revert" } else { if (sfdingshi == '否') { document.getElementById('hj').style.display = "none" } else { document.getElementById('hj').style.display = "none" } } }) }]);
}
function giz() {
(window.RLQ = window.RLQ || []).push(['jquery', () => { $(document).ready(function() { var sfguize = document.getElementById('guize').checked if (sfguize == true) { document.getElementById('btn').disabled = false document.getElementById('btn').style.background = "#37c8f7" document.getElementById('btn').style.color = "#ffffff" } else { document.getElementById('btn').disabled = true document.getElementById('btn').style.background = "#e5e9ef" document.getElementById('btn').style.color = "#99a2aa" } }) }]);
}
</script> <script>
var toolbarOptions = [ // remove formatting button
]; /*var quill = new Quill('#editor', {
modules: { toolbar: toolbarOptions }, theme: 'snow'
});*/ function quillGetHTML(inputDelta) {
var tempCont = document.createElement("div"); (new Quill(tempCont)).setContents(inputDelta); return tempCont.getElementsByClassName("ql-editor")[0].innerHTML;
} </script> <style> .editor {
line-height: normal !important; height: 750px;
} .ql-snow .ql-tooltip[data-mode=link]::before {
content: "请输入链接地址:";
} .ql-snow .ql-tooltip.ql-editing a.ql-action::after {
border-right: 0px; content: '保存'; padding-right: 0px;
}
.ql-snow .ql-tooltip[data-mode=video]::before {
content: "请输入视频地址:";
} .ql-snow .ql-picker.ql-header .ql-picker-label::before, .ql-snow .ql-picker.ql-header .ql-picker-item::before {
content: '文本';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
content: '标题1';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
content: '标题2';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
content: '标题3';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
content: '标题4';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
content: '标题5';
} .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
content: '标题6';
}
.ql-snow .ql-picker.ql-font .ql-picker-label::before, .ql-snow .ql-picker.ql-font .ql-picker-item::before {
content: '标准字体';
} .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before {
content: '衬线字体';
} .ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before {
content: '等宽字体';
} .ql-toolbar.ql-snow + .ql-container.ql-snow {
height: 230;
} .ql-editor {
background: #ffffffb8; } .ql-toolbar.ql-snow { background: #ffffff;
} .ql-snow .ql-editor h2{ margin-top: 0;
margin-bottom: .5em; color: rgba(0,0,0,.85); font-weight: 500; display: block; text-align: left; font-size: 1.5em; background: #fff0; border-radius: 0px; margin-block-start: 0.83em; margin-block-end: 0.83em; margin-inline-start: 0px; margin-inline-end: 0px;
} div#Info {
position: fixed; top: 79px; width: 50%; right: 0; right: 0; left: 0; margin: auto; z-index: 6;
} .suc-img {
background: url(https://patchwiki.biligame.com/images/seerwar/7/7e/6aohbs5d3afbw6edba2jxilpna97a6i.png); height: 299px; width: 309px; display: inline-block; text-align: center;
} .suc-title {
text-align: center; font-size: 25px;
} .suc-btus {
margin-bottom: 10px;
} .anniu {
border: 1px solid #bdbdbd; border-radius: 4px; width: 132px; margin-top: 11px; text-align: center; background: #ffffff; padding-top: 10px; padding-bottom: 7px; padding-left: 7px; padding-right: 7px; margin-right: 11px; display: inline-block; cursor: pointer;
} .anniu:hover {
background: #009edd; color: #ffffff;
} </style> <script> function getmodenValue() {
// 获取form元素 var form = document.forms['Publishingmode']; // 获取所有名为'gender'的单选框 var radios = form.elements['gender']; // 遍历单选框,查找选中的项 for (var i = 0; i < radios.length; i++) { if (radios[i].checked) { window.modenValue=radios[i].value; switch (modenValue) { case `直发模式`: { document.querySelector(`tr.submissionpartition`).style.display = `none`; document.querySelector(`tr.type`).style.display = `none`; document.querySelector(`tr.author`).style.display = `none`; document.querySelector(`tr.role`).style.display = `none`; document.querySelector(`tr.time`).style.display = `none`; document.querySelector(`tr.biliname`).style.display = `none`; document.querySelector(`tr.biliuid`).style.display = `none`; break; } case `投稿模式`: { document.querySelector(`tr.submissionpartition`).style.display = `table-row`; document.querySelector(`tr.type`).style.display = `table-row`; document.querySelector(`tr.author`).style.display = `table-row`; document.querySelector(`tr.role`).style.display = `table-row`; break; }
}
break; // 找到后跳出循环 } } }
function base64ConvertFile(urlData, filename) { // 64转file if (typeof urlData != 'string') { console.log("urlData不是字符串"); return; } var arr = urlData.split(','), type = arr[0].match(/:(.*?);/)[1], fileExt = type.split('/')[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); if(!filename) filename = "image"; while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new File([u8arr], `${filename}.${fileExt}`, {type}); } function getApi(url,callback=false,callbackE=false){ let ajax=new XMLHttpRequest() if(!callback){ ajax.open("GET",url,false) ajax.send() let json=JSON.parse(ajax.responseText) return json } ajax.open("GET",url) ajax.send() ajax.onreadystatechange=function(){ if(ajax.readyState==4){ if(ajax.status==200){ callback(ajax.responseText) } else if(ajax.status==404&&callbackE){ callbackE(true) } } } } function postFdApi(url,fd,isParse=true){ let ajax=new XMLHttpRequest() ajax.open("POST",url,false) ajax.send(fd) if(!isParse){ return ajax.responseText } let json=JSON.parse(ajax.responseText) return json } </script> <style> .ql-container .qlbt-selection-line.qlbt-selection-line-left::before {
position: absolute; left: -2px; top: -2px; content: ; width: 5px; height: 5px; background-color: #0589f3; border-radius: 5px; }
.ql-container .qlbt-selection-line.qlbt-selection-line-right::before {
position: absolute; right: -2px; bottom: -3px; content: ; width: 5px; height: 5px; background-color: #0589f3; border-radius: 5px; }
.quill-better-table-wrapper {
overflow-x: auto; }
table.quill-better-table {
table-layout: fixed; border-collapse: collapse; } table.quill-better-table td { border: 1px solid #000; padding: 2px 5px; }
.qlbt-operation-menu {
background-color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); font-size: 14px; z-index: 100; overflow: hidden; } .qlbt-operation-menu .qlbt-operation-menu-dividing { height: 1px; background-color: #efefef; } .qlbt-operation-menu .qlbt-operation-menu-subtitle { color: #999; font-size: 14px; padding: 5px 16px; } .qlbt-operation-menu .qlbt-operation-color-picker { display: flex; align-items: center; flex-wrap: wrap; padding: 0 16px 10px; background-color: #fff; overflow: hidden; } .qlbt-operation-menu .qlbt-operation-color-picker .qlbt-operation-color-picker-item { width: 20px; height: 20px; border: 1px solid #595959; margin-right: 5px; margin-bottom: 5px; cursor: pointer; } .qlbt-operation-menu .qlbt-operation-menu-item { display: flex; align-items: center; padding: 10px 16px; background-color: #fff; cursor: pointer; color: #595959; overflow: hidden; text-overflow: ellipsis; } .qlbt-operation-menu .qlbt-operation-menu-item:hover { background-color: #efefef; } .qlbt-operation-menu .qlbt-operation-menu-item .qlbt-operation-menu-icon { margin-right: 8px; height: 20px; width: 20px; font-size: 0; }
.qlbt-col-tool {
position: absolute; display: flex; align-items: flex-end; overflow: hidden; z-index: 99; height: 16px; } .qlbt-col-tool .qlbt-col-tool-cell { position: relative; background-color: #fff; border-top: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } .qlbt-col-tool .qlbt-col-tool-cell:first-child { border-left: 1px solid #000; } .qlbt-col-tool .qlbt-col-tool-cell-holder { position: absolute; right: -1px; top: 0; bottom: 0; z-index: 3; width: 1px; background-color: transparent; cursor: ew-resize; } .qlbt-col-tool .qlbt-col-tool-cell-holder:hover { background-color: #0589f3; } .qlbt-col-tool .qlbt-col-tool-cell-holder::before { content: ""; position: absolute; top: 0; left: -6px; display: block; width: 8px; height: 100%; } .qlbt-col-tool .qlbt-col-tool-cell-holder::after { content: ""; position: absolute; top: 0; right: -6px; display: block; width: 8px; height: 100%; }
</style> <script> function removeColgroupsRegex(htmlString) {
// 使用正则表达式替换 <colgroup>...</colgroup> // 注意:这个正则表达式可能无法处理所有复杂情况,比如嵌套标签或属性中的引号 var cleanedHtml = htmlString.replace(/<colgroup\b[^>]*>(.*?)<\/colgroup>/gi, function(match, capture) { // 这里我们简单地返回空字符串来移除整个匹配项 // 但如果你需要保留 <colgroup> 之间的文本(不含标签),可以返回 capture return ; }); // 清理可能的前导或尾随空白字符 cleanedHtml = cleanedHtml.trim(); return cleanedHtml;
} function removeColgroupsRegex1(htmlString) {
// 使用正则表达式替换 <tbody>...</tbody> // 注意:这个正则表达式可能无法处理所有复杂情况,比如嵌套标签或属性中的引号 var cleanedHtml = htmlString.replace(/<tbody\b[^>]*>(.*?)<\/tbody>/gi, function(match, capture) { // 这里我们简单地返回空字符串来移除整个匹配项 // 但如果你需要保留 <tbody> 之间的文本(不含标签),可以返回 capture return capture.trim(); }); // 清理可能的前导或尾随空白字符 cleanedHtml = cleanedHtml.trim(); return cleanedHtml;
} </script>