本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~ 有兴趣想参与WIKI建设的玩家可以加入交流群。赛尔计划WIKI交流群1:818743827


全站通知:

Widget:沙盒236

来自赛尔计划WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<!DOCTYPE html> <html lang="en">

<head>

   <link rel="stylesheet" href="https://s1.hdslb.com/bfs/templar/york-static/cc-iconfont-2.16.2.css">
 <script src="https://wiki.biligame.com/data/index.php?title=MediaWiki:Api.js&action=raw&ctype=text/javascript"></script>
 <style>
   .datacenter-row {
       background: #fff;
       border-radius: 2px;
       padding: 24px;
       height: 280px;
       width: 100%;
       border: 1px solid #228bb554;
       border-radius: 6px;
       height: auto;
       width: 100%;
       min-height: 292px;
   }
   .datacenter-tit {
       font-size: 1.5em;
       font-weight: bold;
   }
   .datacenter-box-item {
       padding-left: 8px;
       padding-right: 8px;
       display: block;
       -webkit-box-sizing: border-box;
       box-sizing: border-box;
       width: 25%;
       display: inline-block;
       width: 246px;
       height: 88px;
       padding: 0 8px 16px 8px;
       vertical-align: middle;
       background-color: rgb(0 174 236 / 11%);
       height: 88px;
       padding: 16px 16px 20px 16px;
       margin-right: 8px;
       margin-bottom: 8px;
       margin-top: 8px;
       border-radius: 6px;
   }
   .datacenter-box-item-tit {
       display: inline-block;
       font-family: PingFang SC, sans-serif;
       font-size: 14px;
       color: #61666d;
       cursor: pointer;
       border-radius: 16px;
   }
   .datacenter-box-item-con {
       color: #00aeec;
       font-family: SF Pro Rounded, sans-serif;
       font-weight: 800;
       font-size: 22px;
       line-height: 22px;
       text-align: center;
       margin-top: 6px;
   }

</style>

   <style>
       div#sidebar-menu {
           margin-top: 22px;
           font-size: 14px;
       }
       div#biliContributors {
           display: none;
       }
       .about-site {
           display: none;
       }
       div#siteNotice {
           display: none;
       }
       div#flowthread {
           display: none !important;
       }
       .sidebar-item-title-wrapper.active a {
           color: #00a1d6 !important;
       }
       .nav-head {
           display: none;
       }
       div#headBox {
           display: none;
       }
       li#pt-notifications-alert {
           display: none;
       }
       /* 游戏页面的样式 */
       .bwiki.container {
           position: relative;
           background-size: cover;
           background-position: center;
           display: grid;
           place-items: center;
           padding: 20px;
       }
       /* 顶部导航栏样式 */
       .bwiki-navbar {
           position: fixed;
           top: 0;
           width: 100%;
           background-color: #ffffff;
           box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
           padding: 1rem;
           display: flex;
           justify-content: space-between;
           align-items: center;
           z-index: 1000;
       }
       .bwiki-navbar .navbar-left {
           display: flex;
           align-items: center;
           gap: 1rem;
       }
       .bwiki-navbar .navbar-right {
           float: right !important;
           margin-right: 7px;
       }
       .bwiki-navbar a {
           text-decoration: none;
           color: #333;
       }
       .user-info {
           display: flex;
           align-items: center;
           gap: 0.5rem;
       }
       .user-avatar {
           width: 30px;
           height: 30px;
           border-radius: 50%;
           background-color: #00a1d6;
           color: white;
           display: flex;
           justify-content: center;
           align-items: center;
           font-size: 0.8rem;
           font-weight: bold;
       }
       /* 侧边栏样式 */
       .sidebar {
           width: 250px;
           /* 默认展开宽度 */
           background-color: #ffffff;
           box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
           height: 100%;
           position: fixed;
           top: 31px;
           left: 0;
           overflow-y: auto;
           transition: width 0.3s ease;
           /* 平滑过渡 */
         z-index: 99999999;
       }
       .sidebar.collapsed {
           width: 60px;
           /* 收起宽度 */
       }
       .sidebar-header {
           padding: 1rem;
           background-color: #00a1d6;
           color: white;
           text-align: center;
           font-size: 1.5em;
           font-weight: bold;
           margin: 20px 0;
           transition: display 0.3s ease;
           /* 平滑过渡 */
       }
       .sidebar.collapsed .sidebar-header {
           display: none;
           /* 收起时隐藏标题 */
       }
       .sidebar-menu {
           padding: 0;
           margin: 0;
       }
       .sidebar-item {
           padding: 1rem;
           border-bottom: 1px solid #eee;
           cursor: pointer;
           position: relative;
           transition: padding-left 0.3s ease;
           /* 平滑过渡 */
       }
       .sidebar.collapsed .sidebar-item {
           padding-left: 0.5rem;
           /* 收起时左侧内边距 */
       }
       .sidebar-item:hover {
           background-color: #f0f0f0;
       }
       .sidebar-item a {
           text-decoration: none;
           color: #333;
           display: flex;
           align-items: center;
           gap: 1rem;
           width: 100%;
           user-select: none;
           margin-left: 15px;
       }
       .sidebar.collapsed .sidebar-item a>span {
           display: none;
           /* 收起时隐藏标题 */
       }
       .submenu {
           display: block;
           /* 始终展开二级菜单 */
           padding-left: 2rem;
           background-color: #f9f9f9;
           transition: display 0.3s ease;
           /* 平滑过渡 */
       }
       .sidebar.collapsed .submenu {
           display: none;
           /* 收起时隐藏二级菜单 */
       }
       .submenu-item {
           padding: 0.5rem;
           border-bottom: none;
       }
       .submenu-item a {
           font-size: 14px;
           text-decoration: none;
           color: #666;
       }
       .main-content {
           padding: 1rem;
           flex: 1;
           transition: margin-left 0.3s ease;
           /* 平滑过渡 */
           width: 100%;
       }
       .sidebar.collapsed+.main-content {}
       .content-card {
           display: none;
           margin-top: 1rem;
           padding: 1rem;
           background-color: #ffffff;
           border-radius: 8px;
           box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
       }
       .content-title {
           font-size: 1.5em;
           font-weight: bold;
           margin: 20px 0;
       }
       .content-card.active {
           display: block;
       }
       /* 高亮样式 */
       .sidebar-item.active,
       .submenu-item.active {
           color: #00a1d6;
           background-color: #f0f0f0;
       }
       .sidebar-item.active a,
       .submenu-item.active a {
           color: #00a1d6 !important;
       }
       /* 展开/收起按钮样式 */
       .toggle-sidebar-button {
           position: fixed;
           margin-left: 237px;
           /* 展开时按钮的位置 */
           top: 50%;
           transform: translateY(-50%);
           background-color: #00a1d6;
           color: white;
           border: none;
           width: 30px;
           height: 30px;
           border-radius: 50%;
           cursor: pointer;
           display: flex;
           align-items: center;
           justify-content: center;
           box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
           transition: margin-left 0.3s ease;
           /* 平滑过渡 */
           z-index: 100;
       }
       .sidebar.collapsed+.toggle-sidebar-button {
           margin-left: 46px;
           /* 收起时按钮的位置 */
       }
   </style>

</head>

<body>

       <nav class="bwiki-navbar">
       </nav>
       <aside class="sidebar">
           <button class="toggle-sidebar-button" id="toggle-sidebar-button">
               
           </button>
       </aside>
       <main class="main-content">
       </main>
       <script>
           // 定义菜单数据
           const menuData = [
               {
                   id: "home",
                   title: "首页",
                   icon: "bcc-iconfont bcc-icon-ic_home_",
                   href: "#home",
content: `
数据总览
阅读量
2000
B站阅读量
--
点赞
--
评论
60
收藏
150
分享
0
`,
                   submenu: []
               },
               {
                   id: "video-management",
                   title: "稿件管理",
                   icon: "bcc-iconfont bcc-icon-ic_Content_",
                   href: "#video-management",
                   content: "这里是稿件管理页面。",
                   submenu: [
                       {
                           id: "upload-video",
                           title: "上传稿件",
                           href: "#upload-video",
                           content: `
                           `
                       },
                       {
                           id: "video-list",
                           title: "稿件列表",
                           href: "#video-list",
                           content: "查看所有已上传的稿件。"
                       },
                       {
                           id: "video-analytics",
                           title: "稿件分析",
                           href: "#video-analytics",
                           content: "查看稿件的播放量、点赞数等数据。"
                       }
                   ]
               },
               {
                   id: "data-analytics",
                   title: "数据分析",
                   icon: "bcc-iconfont bcc-icon-ic_data_",
                   href: "#data-analytics",
                   content: "这里是数据分析页面。",
                   submenu: [
                       {
                           id: "playback-stats",
                           title: "播放量统计",
                           href: "#playback-stats",
                           content: `
                               <style>
                                   .stats-container {
                                       background-color: #f9f9f9;
                                       padding: 20px;
                                       border-radius: 8px;
                                       margin: 20px 0;
                                   }
                                   .stats-chart {
                                       height: 300px;
                                       background-color: white;
                                       border-radius: 4px;
                                       box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
                                   }
                               </style>

播放量统计

                               <script src="https://example.com/stats-script.js"><\/script>
                               <script>
                                   console.log('播放量统计页面脚本已加载');
                               <\/script>
                           `
                       },
                       {
                           id: "user-growth",
                           title: "用户增长",
                           href: "#user-growth",
                           content: "查看粉丝增长趋势。"
                       },
                       {
                           id: "revenue-analytics",
                           title: "收益分析",
                           href: "#revenue-analytics",
                           content: "查看收益数据。"
                       }
                   ]
               },
               {
                   id: "fan-management",
                   title: "粉丝管理",
                   icon: "bcc-iconfont bcc-icon-ic_fans_",
                   href: "#fan-management",
                   content: "这里是粉丝管理页面。",
                   submenu: []
               },
               {
                   id: "settings",
                   title: "设置",
                   icon: "bcc-iconfont bcc-icon-ic_set_1",
                   href: "#settings",
                   content: "这里是设置页面。",
                   submenu: [
                       {
                           id: "account-settings",
                           title: "账户设置",
                           href: "#account-settings",
                           content: "修改账户信息。"
                       },
                       {
                           id: "notification-settings",
                           title: "通知设置",
                           href: "#notification-settings",
                           content: "管理通知偏好。"
                       }
                   ]
               }
           ];
           // 动态生成菜单
           const sidebarMenu = document.getElementById('sidebar-menu');
           menuData.forEach(menu => {
               // 创建一级菜单项的外层 div
               const sidebarItem = document.createElement('div');
               sidebarItem.className = 'sidebar-item';
               // 创建标题部分的 wrapper
               const titleWrapper = document.createElement('div');
               titleWrapper.className = 'sidebar-item-title-wrapper';
               const a = document.createElement('a');
               a.href = menu.href;
               a.innerHTML = ` ${menu.title}`;
               titleWrapper.appendChild(a);
               sidebarItem.appendChild(titleWrapper);
               if (menu.submenu.length > 0) {
                   // 创建子菜单容器
                   const submenu = document.createElement('div');
                   submenu.className = 'submenu';
                   menu.submenu.forEach(submenuItem => {
                       const submenuItemDiv = document.createElement('div');
                       submenuItemDiv.className = 'submenu-item';
                       const suba = document.createElement('a');
                       suba.href = submenuItem.href;
                       suba.textContent = submenuItem.title;
                       submenuItemDiv.appendChild(suba);
                       submenu.appendChild(submenuItemDiv);
                   });
                   sidebarItem.appendChild(submenu);
               }
               sidebarMenu.appendChild(sidebarItem);
           });
           // 动态生成内容卡片
           const mainContent = document.querySelector('.main-content');
           menuData.forEach(menu => {
               const contentCard = document.createElement('div');
               contentCard.className = 'content-card';
               contentCard.id = menu.id;
               // 处理content中的style和script标签
               const contentHTML = menu.content;
               const tempDiv = document.createElement('div');
               tempDiv.innerHTML = contentHTML;
               // 提取并动态加载style标签
               const styleElements = tempDiv.getElementsByTagName('style');
               for (let i = 0; i < styleElements.length; i++) {
                   const style = document.createElement('style');
                   style.type = 'text/css';
                   style.appendChild(document.createTextNode(styleElements[i].innerHTML));
                   document.head.appendChild(style);
               }
               // 提取并动态加载script标签
               const scriptElements = tempDiv.getElementsByTagName('script');
               const scriptURLs = [];
               for (let i = 0; i < scriptElements.length; i++) {
                   const script = scriptElements[i];
                   if (script.src) {
                       scriptURLs.push(script.src);
                   }
               }
               // 加载script
               scriptURLs.forEach(url => {
                   const script = document.createElement('script');
                   script.src = url;
                   script.type = 'text/javascript';
                   document.head.appendChild(script);
               });
               // 将contentHTML插入到卡片中
               contentCard.innerHTML = `
${menu.title}
                   ${contentHTML}
               `;
               mainContent.appendChild(contentCard);
               if (menu.submenu.length > 0) {
                   menu.submenu.forEach(submenuItem => {
                       const subContentCard = document.createElement('div');
                       subContentCard.className = 'content-card';
                       subContentCard.id = submenuItem.id;
                       // 处理子菜单的content中的style和script标签
                       const subContentHTML = submenuItem.content;
                       const subTempDiv = document.createElement('div');
                       subTempDiv.innerHTML = subContentHTML;
                       // 提取并动态加载style标签
                       const subStyleElements = subTempDiv.getElementsByTagName('style');
                       for (let i = 0; i < subStyleElements.length; i++) {
                           const style = document.createElement('style');
                           style.type = 'text/css';
                           style.appendChild(document.createTextNode(subStyleElements[i].innerHTML));
                           document.head.appendChild(style);
                       }
                       // 提取并动态加载script标签
                       const subScriptElements = subTempDiv.getElementsByTagName('script');
                       const subScriptURLs = [];
                       for (let i = 0; i < subScriptElements.length; i++) {
                           const script = subScriptElements[i];
                           if (script.src) {
                               subScriptURLs.push(script.src);
                           }
                       }
                       // 加载script
                       subScriptURLs.forEach(url => {
                           const script = document.createElement('script');
                           script.src = url;
                           script.type = 'text/javascript';
                           document.head.appendChild(script);
                       });
                       // 将contentHTML插入到卡片中
                       subContentCard.innerHTML = `
${submenuItem.title}
                           ${subContentHTML}
                       `;
                       mainContent.appendChild(subContentCard);
                   });
               }
           });
           // 获取展开/收起按钮
           const toggleSidebarButton = document.getElementById('toggle-sidebar-button');
           // 处理展开/收起按钮点击事件
           toggleSidebarButton.addEventListener('click', () => {
               const sidebar = document.querySelector('.sidebar');
               sidebar.classList.toggle('collapsed');
               // 更新按钮位置
               if (sidebar.classList.contains('collapsed')) {
                   toggleSidebarButton.style.marginLeft = '46px';
               } else {
                   toggleSidebarButton.style.marginLeft = '237px';
               }
           });
           // 默认显示首页内容
           document.getElementById('home').classList.add('active');
           document.querySelector('.sidebar-menu > .sidebar-item:nth-child(1) .sidebar-item-title-wrapper').classList.add('active');
           // 隐藏所有内容卡片
           function hideAllContent() {
               document.querySelectorAll('.content-card').forEach(card => card.classList.remove('active'));
           }
           // 处理一级菜单点击事件
           document.querySelectorAll('.sidebar-item-title-wrapper').forEach(titleWrapper => {
               titleWrapper.addEventListener('click', e => {
                   e.preventDefault();
                   const a = titleWrapper.querySelector('a');
                   const href = a.getAttribute('href');
                   const targetId = href.slice(1);
                   // 如果是无子菜单的菜单项,直接切换内容
                   if (!titleWrapper.closest('.sidebar-item').querySelector('.submenu')) {
                       hideAllContent();
                       document.getElementById(targetId)?.classList.add('active');
                   } else if (targetId !== 'toggle-sidebar') {
                       // 如果是一级菜单且有子菜单,则显示第一个子菜单项的内容
                       const submenu = titleWrapper.closest('.sidebar-item').querySelector('.submenu');
                       const firstSubMenu = submenu.querySelector('.submenu-item a');
                       if (firstSubMenu) {
                           const firstSubMenuHref = firstSubMenu.getAttribute('href');
                           const firstSubMenuId = firstSubMenuHref.slice(1);
                           hideAllContent();
                           document.getElementById(firstSubMenuId)?.classList.add('active');
                       }
                   }
                   // 更新选中状态
                   document.querySelectorAll('.sidebar-item-title-wrapper').forEach(w => w.classList.remove('active'));
                   document.querySelectorAll('.submenu-item').forEach(li => li.classList.remove('active'));
                   titleWrapper.classList.add('active');


               });
           });
           // 处理子菜单点击事件
           document.querySelectorAll('.submenu-item a').forEach(a => {
               a.addEventListener('click', e => {
                   e.preventDefault();
                   const href = a.getAttribute('href');
                   const targetId = href.slice(1);
                   hideAllContent();
                   document.getElementById(targetId)?.classList.add('active');
                   // 更新选中状态
                   const currentSubItem = a.closest('.submenu-item');
                   document.querySelectorAll('.submenu-item').forEach(li => li.classList.remove('active'));
                   currentSubItem.classList.add('active');
                   // 更新父级菜单的选中状态
                   const parentMenuItemTitleWrapper = currentSubItem.closest('.sidebar-item').querySelector('.sidebar-item-title-wrapper');
                   document.querySelectorAll('.sidebar-item-title-wrapper').forEach(w => w.classList.remove('active'));
                   parentMenuItemTitleWrapper.classList.add('active');
               });
           });
       </script>
     <script>

(window.RLQ = window.RLQ || []).push(['jquery', () => {

   $(function () {
       var u = (document.cookie.match(/DedeUserID=([^;]+)/) || [])[1] || "";
       var tit = mw.config.values.wgTitle //当前页面名称
       var dz = 'data' //目标站点名称
       var dqdz = mw.config.values.wgGameName //当前站点名称
       var nb = new NGBASE()
       var allread = 0;
       var alllike = 0;
       nb.read(`alltginfo_` + dqdz).then((res) => {
           var listmax = res.list.length
           console.table(res.list)
           let intervalId = setInterval(fetchData, 300);
           var i = 0;
           function fetchData() {
               if (i < listmax) {
                   $.get(`https://wiki.biligame.com/${dz}/api.php?action=parse&format=json&title=用户讨论:GLOBAL/${res.list[i].pagename}_${dqdz}.json`).then(function (result233) {
                       //result = (new Function('return ' + result))();
                       if (parseInt(result233.parse.pageid) > 0) { //判断页面存在
                           nb.read(`${res.list[i].pagename}_` + dqdz).then((res1) => {
                               if (res1.read == ) {
                                   if (res1.love == ) {
                                       i = i + 1;
                                   } else {
                                       alllike = alllike + res1.love.length;
                                       i = i + 1;
                                   }
                               } else {
                                   if (res1.love == ) {//判断love是否为空
                                       i = i + 1;
                                   } else {
                                       alllike = alllike + res1.love.length;
                                       i = i + 1;
                                   }
                                   allread = allread + res1.read.length;
                                   i = i + 1;
                               }
                           })
                       } else {
                           i = i + 1;
                       }
                   }).fail(function () { });
               }
               else {
                   document.querySelector('.datacenter-box-item-con#bilibiliread').textContent = allread
                   document.querySelector('.datacenter-box-item-con#wikilike').textContent = alllike
                   console.log(allread)
                   clearInterval(intervalId);
               }
           }
           /*for (var i = 0; i < listmax) {
               var nb = new NGBASE()
               var dqdz = mw.config.values.wgGameName //当前站点名称
               
               
           }*/
       })
   })

}]);

 </script>
   <script
       src="//wiki.biligame.com/seerwar/MediaWiki:2.0.0-dev.3/quill.min.js?action=raw&ctype=text/javascript&r=5"></script>
   <link href="https://wiki.biligame.com/seerwar/MediaWiki:Quill.snow.css?action=raw&ctype=text/css&r=5"
       rel="stylesheet">
   <script
       src="https://wiki.biligame.com/seerwar/MediaWiki:Quill-better-table.min.js?action=raw&ctype=text/javascript"></script>
   <script
       src="https://wiki.biligame.com/data/index.php?title=MediaWiki:Api.js&action=raw&ctype=text/javascript"></script>
   <script
       src="https://wiki.biligame.com/seerwar/index.php?title=MediaWiki:Tucao.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: [
                           [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
                           [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
                           [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
                           [{ 'align': [] }],
                           ['bold', 'italic', 'underline', 'strike', 'link', 'image', 'video', 'table'],        // toggled buttons
                           ['blockquote', 'code-block'],
                           [{ '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: '背景颜色:'
                           }
                       }
                   }


                   // 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.addEventListener('load', 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 ver = `1.0.0 Beta`;
           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>
投稿封面:<input type="file" id="imageLoader" name="imageLoader" onchange="img1cover()" style="display:none;">
<canvas id="imageCanvas"></canvas>

投稿分区:<select id="lx" tabindex="6" name="类别" class="createboxInput pfShowIfSelected" onchange="fenqu()"><option value="">--请选择稿件分区--</option><option value="攻略视频" style="display: none;">攻略视频</option><option value="同人文">同人文</option><option value="专栏攻略">专栏攻略</option><option value="同人视频" style="display: none;">同人视频</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="同人图片[作者]">
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><select id="collection" tabindex="6" name="合集[是否原创]" class="createboxInput pfShowIfSelected" onchange="heji()"><option value=""></option><option value="合集标题1" scvalue="SCXXXXX1">合集名称1(SCXXXX1)</option><option 合集标题2="">合集名称2(SCXXXX2)</option></select><input id="hj" tabindex="5" class="createboxInput mandatoryField" size="35" name="同人图片[B站UID]" style="display: none;"><button class="setupcolle">创建合集</button>
定时发布:<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 = `

<input id="guize" name="guize" type="checkbox" value="" onchange="giz()">我已阅读并接受《BWIKI社区规则》(所投稿件只能由作者本人账号或WIKI管理员权限、WIKI版主权限、WIKI行政员权限,满足其一可进行编辑稿件或删除稿件;所投稿后的稿件均不按照CC BY-NC-SA 3.0协议提供)
Ver ${ver}
<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><button class="fankui" type="button"></button>

`

           //设置元素可见度及样式
           getmodenValue();
           document.getElementById('zizhi').style.display = "none"
           document.getElementsByClassName("zhuanzai")[0].style.display = "none"
           document.getElementById('ding-datetime').style.display = "none"
           document.querySelector("tr.ugc-heji").style.display = "none"
           document.querySelector("tr.timedrelease").style.display = "none"
           document.querySelector("tr.mode").style.display = "none"
           document.querySelector("tr.biliname").style.display = "none"
           document.querySelector("tr.biliuid").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"
           if (mw.config.values.wgUserGroups.indexOf("sysop") != -1) {
               document.querySelector("tr.mode").style.display = ""
               document.querySelector("tr.biliname").style.display = ""
               document.querySelector("tr.biliuid").style.display = ""
           }
           //设置元素value值 
           document.getElementById("BUID").value = u;
           $.getJSON(`https://wiki.biligame.com/data/%E7%94%A8%E6%88%B7%E8%AE%A8%E8%AE%BA:GLOBAL/DeepEye/UserCard/${u}.json?action=raw&ctype=text/json`, function (result) {
               pwd = `DeepEye`
               str = result.body
               pwd = new TextEncoder().encode(pwd)
               str1 = JSON.parse(new TextDecoder().decode(pako.ungzip(new Uint8Array(atob(str).split("").map((e, i, a) => e.charCodeAt(0) ^ pwd[i % pwd.length])))))
               document.getElementById("bname").value = `${str1.name}`;
               window.usernames = `${str1.name}`;
               window.userfaces = `${str1.face}`;
           });
           $('.fankui').on('click', function () {
               var data = {
                   "nickname": `${window.usernames}`,
                   "avatar": `${window.userfaces}`,
                   "openid": `bili${u}`,
               };
               var productId = 653945; // 把1221数字换成你的产品ID,否则会不成功
               handleOnclick()
               function handleOnclick() {
                   Tucao.request(productId, data);
               }
               //console.log('button.fankui 被点击了!');
           });
           //document.getElementById("bname").value = UserStatus.userInfo.uname;
           //封面按钮处理事件
           $('.xuankuang').on('click', function () {
               $('input#imageLoader').trigger('click');
           });
           //提交主函数
           document.getElementById("btn").onclick = function () {
               var xycode = [];
               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
               switch (modenValue) {
                   case `直发模式`: {
                       if (titx != "") {
                           var $qlEditor = $('.ql-editor'); // 获取ql-editor文本框的jQuery对象  
                           var imgIndex = 1; // 初始化编号为0
                           window.title1 = document.getElementById("title").value.replace(/</g, "<").replace(/>/g, ">")
                           function upload() {
                               var canvas = document.getElementById('imageCanvas');
                               var base64 = canvas.toDataURL('image/png');
                               var file = base64ConvertFile(base64, `${VC}-0.png`);
                               new mw.Api().upload(file, { filename: `${VC}-0.png`, ignorewarnings: true })
                               //alert(`上传成功惹!٩(๑>◡<๑)۶ `);
                           }
                           if (document.querySelector("input#imageLoader").value != "") {
                               upload()
                           } else { }
                           quillinnerHTML = replaceIframeWithWidget(quillinnerHTML)
                           $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}`;
                               var img = new Image();
                               img.src = imgSrc;
                               var file = base64ConvertFile(imgSrc, filename); // 注意这里不再硬编码".png"  
                               var mimeType = file.type;
                               var fileExt = mimeType.split('/')[1]; // 提取出子类型作为文件扩展名  
                               // 从file对象中获取MIME类型,并提取出文件扩展名  
                               img.onload = function () {
                                   var canvas = document.getElementById('imgsCanvas');
                                   var ctx = canvas.getContext('2d');
                                   var maxWidth = (img.width > 5000) ? img.width / 3 : img.width;
                                   var maxHeight = (img.height > 5000) ? img.height / 3 : img.height;
                                   // 计算缩放比例  
                                   var width = img.width;
                                   var height = img.height;
                                   if (width > height) {
                                       if (width > maxWidth) {
                                           height *= maxWidth / width;
                                           width = maxWidth;
                                       }
                                   } else {
                                       if (height > maxHeight) {
                                           width *= maxHeight / height;
                                           height = maxHeight;
                                       }
                                   }
                                   // 设置canvas的尺寸  
                                   canvas.width = width;
                                   canvas.height = height;
                                   // 在canvas上绘制图片  
                                   ctx.drawImage(img, 0, 0, width, height);
                                   // 将canvas转换为base64  
                                   var base64 = canvas.toDataURL(`${mimeType}`); // 或者使用其他MIME类型  
                                   // 将base64转换为File对象(假设你有这个函数)  
                                   var file = base64ConvertFile(base64, filename + `.${fileExt}`);
                                   new mw.Api().upload(file, { filename: filename + `.${fileExt}`, ignorewarnings: true })
                                       .then(function (response) {
                                           // 上传成功后的处理逻辑  
                                           console.log('上传成功:', response);
                                       })


                                   /*var size = file.size;
                                   var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
                                   var i = Math.floor(Math.log(size) / Math.log(1024));
                                   var d = (size / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];*/
                                   //document.getElementById("imgeSize").innerHTML = d;
                               };


                               // 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
                           }
                           //Submittodatawikismall(VC, window.title1, document.getElementById("yuan").value, document.getElementById("lx").value, modenValue, document.getElementById("up").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("bname").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("BUID").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("xgjs").value.replace(/</g, "<").replace(/>/g, ">"), ``, document.getElementById("shengming").value, document.getElementById("input_7").value, document.getElementById("input_8").value, document.getElementById("time").value.replace(/</g, "<").replace(/>/g, ">"), ``, window.title1, ``, imgIndex)
                           //处理提交函数↑
                           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.querySelector("#BWIKIPopUp").style.display = "";

document.querySelector("#BWIKIPopUp #BWIKIwindow").innerHTML = `

恭喜,投稿成功!您的稿件已进入审核队列
再投一个
前往该稿件页面

`

                           })
                       } else {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请填写标题后再试一下吧o(╥﹏╥)o

'

                           //alert(`投稿失败,请填写标题后再试一下吧o(╥﹏╥)o`);
                       }
                       break;
                   }
                   case `投稿模式`: {
                       var submissiontype;
                       if (fqq == "") {
                           xycode[xycode.length] = 101;
                       }
                       if (lxx == "") {
                           xycode[xycode.length] = 102;
                       }
                       if (titx == "") {
                           xycode[xycode.length] = 103;
                       }
                       if (document.querySelector("input#imageLoader").value == "") {
                           xycode[xycode.length] = 106;
                       }
                       if (document.getElementById("yuan").value == "转载") {
                           if (zhuan1 == "") {
                               xycode[xycode.length] = 104;
                           }
                           if (zhuan2 == "") {
                               xycode[xycode.length] = 105;
                           }
                       } else { }
                       //分区对应模板更改
                       switch (fqq) {
                           case `攻略视频`:
                               submissiontype = ``;
                               break;
                           case `专栏攻略`:
                               submissiontype = `{{${window.moban}|标题=${document.querySelector("textarea#title").value}|更新时间=|作者=${document.querySelector("input#bname").value}|SVC=${VC}|UID=${document.querySelector("input#BUID").value}|B站昵称=${document.querySelector("input#bname").value}|是否原创=${lxx}|相关角色=${document.querySelector("input#xgjs").value}|内容=${quillinnerHTML}|来源=${zhuan1}|原文地址=${zhuan2}|是否显示合集=|合集名称=|是否定时=|定时=|自制声明=}}`;
                               break;
                           case `同人文`:
                               submissiontype = `{{${window.moban}|标题=${document.querySelector("textarea#title").value}|更新时间=|作者=${document.querySelector("input#bname").value}|SVC=${VC}|UID=${document.querySelector("input#BUID").value}|B站昵称=${document.querySelector("input#bname").value}|是否原创=${lxx}|相关角色=${document.querySelector("input#xgjs").value}|内容=${quillinnerHTML}|来源=${zhuan1}|原文地址=${zhuan2}|是否显示合集=|合集名称=|是否定时=|定时=|自制声明=}}`;
                               break;
                           case `同人图`:
                               submissiontype = `{{${window.moban}|图片=${quillinnerHTML}|时间=${document.querySelector("input#time").value}|是否显示合集=${document.querySelector("select#sfhj").value}|合集名称=|作者=${document.querySelector("input#bname").value}|B站UID=${document.querySelector("input#BUID").value}|是否原创=${lxx}|来源=${zhuan1}|原文地址=${zhuan2}}}`;
                               break;
                           case `同人视频`:
                               submissiontype = ``;
                               break;
                           case `表情包`:
                               submissiontype = `{{${window.moban}|图片=${quillinnerHTML}|时间=${document.querySelector("input#time").value}|是否显示合集=${document.querySelector("select#sfhj").value}|合集名称=|作者=${document.querySelector("input#bname").value}|B站UID=${document.querySelector("input#BUID").value}|是否原创=${lxx}|来源=${zhuan1}|原文地址=${zhuan2}}}`;
                               break;
                           case `cosplay`:
                               submissiontype = `{{${window.moban}|图片=${quillinnerHTML}|时间=${document.querySelector("input#time").value}|是否显示合集=${document.querySelector("select#sfhj").value}|合集名称=|作者=${document.querySelector("input#bname").value}|B站UID=${document.querySelector("input#BUID").value}|是否原创=${lxx}|来源=${zhuan1}|原文地址=${zhuan2}}}`;
                               break;
                       }
                       xycode[xycode.length] = 0;
                       if (xycode[0] == 0) {
                           if (xycode.length == 1) {
                               function upload() {
                                   var canvas = document.getElementById('imageCanvas');
                                   var base64 = canvas.toDataURL('image/png');
                                   var file = base64ConvertFile(base64, `${VC}-0.png`);
                                   new mw.Api().upload(file, { filename: `${VC}-0.png`, ignorewarnings: true })
                                   //alert(`上传成功惹!٩(๑>◡<๑)۶ `);
                               }
                               upload()
                               quillinnerHTML = replaceIframeWithWidget(quillinnerHTML)
                               var $qlEditor = $('.ql-editor'); // 获取ql-editor文本框的jQuery对象  
                               var imgIndex = 1; // 初始化编号为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}`;
                                   var img = new Image();
                                   img.src = imgSrc;
                                   var file = base64ConvertFile(imgSrc, filename); // 注意这里不再硬编码".png"  
                                   var mimeType = file.type;
                                   var fileExt = mimeType.split('/')[1]; // 提取出子类型作为文件扩展名  
                                   // 从file对象中获取MIME类型,并提取出文件扩展名  
                                   img.onload = function () {
                                       var canvas = document.getElementById('imgsCanvas');
                                       var ctx = canvas.getContext('2d');
                                       var maxWidth = (img.width > 5000) ? img.width / 3 : img.width;
                                       var maxHeight = (img.height > 5000) ? img.height / 3 : img.height;
                                       // 计算缩放比例  
                                       var width = img.width;
                                       var height = img.height;
                                       if (width > height) {
                                           if (width > maxWidth) {
                                               height *= maxWidth / width;
                                               width = maxWidth;
                                           }
                                       } else {
                                           if (height > maxHeight) {
                                               width *= maxHeight / height;
                                               height = maxHeight;
                                           }
                                       }
                                       // 设置canvas的尺寸  
                                       canvas.width = width;
                                       canvas.height = height;
                                       // 在canvas上绘制图片  
                                       ctx.drawImage(img, 0, 0, width, height);
                                       // 将canvas转换为base64  
                                       var base64 = canvas.toDataURL(`${mimeType}`); // 或者使用其他MIME类型  
                                       // 将base64转换为File对象(假设你有这个函数)  
                                       var file = base64ConvertFile(base64, filename + `.${fileExt}`);
                                       new mw.Api().upload(file, { filename: filename + `.${fileExt}`, ignorewarnings: true })
                                           .then(function (response) {
                                               // 上传成功后的处理逻辑  
                                               console.log('上传成功:', response);
                                           })


                                       /*var size = file.size;
                                       var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
                                       var i = Math.floor(Math.log(size) / Math.log(1024));
                                       var d = (size / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];*/
                                       //document.getElementById("imgeSize").innerHTML = d;
                                   };
                                   // 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
                               }
                               //Submittodatawikismall(VC, window.title1, document.getElementById("yuan").value, document.getElementById("lx").value, modenValue, document.getElementById("up").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("bname").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("BUID").value.replace(/</g, "<").replace(/>/g, ">"), document.getElementById("xgjs").value.replace(/</g, "<").replace(/>/g, ">"), ``, document.getElementById("shengming").value, document.getElementById("input_7").value, document.getElementById("input_8").value, document.getElementById("time").value.replace(/</g, "<").replace(/>/g, ">"), ``, VC, ``, imgIndex)
                               //处理提交函数↑
                               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", `${quillinnerHTML}`)
                                   fd.append("token", token)
                                   fd.append("format", "json")
                                   postFdApi(url, fd)
                                   window.onbeforeunload = function () { }
                                   document.querySelector("#BWIKIPopUp").style.display = "";

document.getElementById("toolsall").innerHTML = `

恭喜,投稿成功!您的稿件已进入审核队列
再投一个
前往该稿件页面

`

                               })
                           }
                       } else {
                           var i = 0;
                           let intervalId = setInterval(fetchData, 100);
                           function fetchData() {
                               if (xycode[i] != 0) {
                                   document.getElementById("Info").style.display = ""
                                   switch (xycode[i]) {
                                       case 101: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请选择投稿分区后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 102: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请选择类型后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 103: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请填写标题后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 104: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请填写【转载】来源后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 105: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请填写【转载】原文地址后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 106: {

document.getElementById("Info").innerHTML = document.getElementById("Info").innerHTML + '

×错误!请上传投稿封面后再试一下吧o(╥﹏╥)o

'

                                           i = i + 1;
                                           break;
                                       }
                                       case 107: {
                                           break;
                                       }
                                   }
                               } else {
                                   clearInterval(intervalId);
                               }
                           }
                       }
                       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"
                       document.querySelector(`select#collection`).style.display = "revert"
                       document.querySelector(`button.setupcolle`).style.display = `revert`
                   } else {
                       if (sfdingshi == '否') {
                           document.getElementById('hj').style.display = "none"
                           document.querySelector(`select#collection`).style.display = "none"
                           document.querySelector(`button.setupcolle`).style.display = `none`
                       } else {
                           document.getElementById('hj').style.display = "none"
                           document.querySelector(`select#collection`).style.display = "none"
                           document.querySelector(`button.setupcolle`).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>
       div#editor {
   height: auto;
   display: flex;
   width: 100%;
   min-height: 227px;

}

 .ql-editor {
   width: 100%;
   min-height: 227px;

}

       .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: "请输入B站视频BV号:";
       }
       .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;
       }
       div#BWIKIPopUp {
           display: -webkit-box;
           display: -ms-flexbox;
           display: flex;
           -webkit-box-pack: center;
           -ms-flex-pack: center;
           justify-content: center;
           width: 100%;
           height: 100%;
           position: fixed;
           top: 0;
           left: 0;
           font-size: 14px;
           background: rgba(0, 0, 0, .5);
           z-index: 10010;
           -webkit-box-align: center;
           -ms-flex-align: center;
           align-items: center;
       }
       div#BWIKIwindow {
           -webkit-box-sizing: border-box;
           box-sizing: border-box;
           width: 820px;
           min-height: 430px;
           background: #fff;
           border-radius: 8px;
           padding: 52px 65px 29px 92px;
           position: relative;
           -webkit-user-select: none;
           -moz-user-select: none;
           -ms-user-select: none;
           user-select: none;
       }
       button.fankui:hover {
           background-color: #ecf9fe;
       }
       button.fankui {
           display: inline-block;
           height: 40px;
           font-size: 14px;
           border-radius: 42px;
           text-align: center;
           vertical-align: middle;
           width: 120px;
           border: rgba(255, 255, 255, 0);
           cursor: pointer;
           line-height: 40px;
           border: 1px solid #e3e5e7;
           background-color: #fff;
           color: #37c8f7;
           border-color: #37c8f7;
           margin-left: 10px;
           overflow: hidden;
       }
       .fankuilogo {
           background: url(https://patchwiki.biligame.com/images/seerwar/6/65/rfo3romyyrqqvuk9vshdzx0jzzgvmo7.svg);
           width: 114px;
           height: 44px;
           margin-left: 10px;
       }
   </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`;
                           document.querySelector(`imgs-cover`).style.display = `none`;
                           break;
                       }
                       case `投稿模式`: {
                           document.querySelector(`tr.submissionpartition`).style.display = ``;
                           document.querySelector(`tr.type`).style.display = ``;
                           document.querySelector(`tr.author`).style.display = ``;
                           document.querySelector(`tr.biliname`).style.display = ``;
                           document.querySelector(`tr.biliuid`).style.display = ``;
                           document.querySelector(`tr.role`).style.display = ``;
                           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%;
       }
       .xuankuang {
           border: 2px dashed #717171;
           margin-top: 10px;
           padding-top: 10px;
           padding-bottom: 10px;
           padding-left: 10px;
           padding-right: 10px;
       }
       .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=64]::before {
           font-size: 32px;
       }
       .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=64]::before,
       .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=64]::before {
           content: '64';
       }
   </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;
       }
       function Submittodatawikismall(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) {
           (window.RLQ = window.RLQ || []).push(['jquery', () => {
               $(document).ready(function () {
                   var tit = p //当前页面名称
                   var dqdz = mw.config.values.wgGameName //当前站点名称
                   //alert("不存在!");
                   var sj = {}
                   sj.code = 200; //状态
                   sj.pagename = p;//页面名称
                   sj.pic = q;//图片封面
                   sj.images = r;//最大图片数
                   sj.vc = a; //vc号
                   sj.title = b;//标题
                   sj.type = c;//类型
                   sj.tname = d;//分区
                   sj.mode = e;//模式
                   sj.author = f;//作者
                   sj.biliname = g;//B站昵称
                   sj.biliuid = h;//B站UID
                   sj.role = i;//角色
                   sj.ugc_season = j;//合集
                   sj.ugc_seasonid = o;//合集id
                   sj.originalstatement = k;//自制声明
                   sj.source = l;//来源
                   sj.sourceaddress = m;//来源地址
                   sj.time = n;  //投稿时间
                   var nb = new NGBASE()
                   //this.nb.save(tit+`_`+dqdz, sj)
                   nb.save(`info/${tit}_${dqdz}`, sj).then(() => {
                       //alert("写入成功!")
                       Submittodatawikibig(a, b, f, n, e, p, q)
                       sitelist()
                   })
               });
           }]);


       }
       function Submittodatawikibig(a, b, c, d, e, f, g) {
           (window.RLQ = window.RLQ || []).push(['jquery', () => {
               $(document).ready(function () {
                   var dz = 'data' //目标站点名称
                   var dqdz = mw.config.values.wgGameName //当前站点名称
                   $.get(`https://wiki.biligame.com/${dz}/api.php?action=parse&format=json&title=用户讨论:GLOBAL/alltginfo_${dqdz}.json`).then(function (result233) {
                       //result = (new Function('return ' + result))();
                       if (parseInt(result233.parse.pageid) > 0) { //判断页面存在
                           //alert("存在!");
                           var nb = new NGBASE()
                           nb.read(`alltginfo_${dqdz}`).then((res) => {
                               if (res.list == undefined) { //当元素list不存在时
                                   res.list = []
                                   res.list[res.list.length] = { "vc": a, "title": b, "author": c, "time": d, "mode": e, "pagename": f, "pic": g }
                                   var nb = new NGBASE()
                                   //this.nb.save(tit+`_`+dqdz, sj)
                                   nb.save(`alltginfo_${dqdz}`, res).then(() => {
                                       //alert("写入成功!-3")
                                   })
                               } else { //当元素lest存在时
                                   if (res.list.indexOf(f) == -1) { //当列表里不存在该稿件时
                                       res.list[res.list.length] = { "vc": a, "title": b, "author": c, "time": d, "mode": e, "pagename": f, "pic": g }
                                       var nb = new NGBASE()
                                       nb.save(`alltginfo_${dqdz}`, res).then(() => {
                                           //alert("写入成功!-2")
                                       })
                                   }
                               }




                               //alert(res) //保存的内容
                               //console.log(res)
                           })


                       } else { //判断页面不存在
                           //alert("不存在!");
                           var sj = {}
                           sj.list = []
                           sj.list[sj.list.length] = { "vc": a, "title": b, "author": c, "time": d, "mode": e, "pagename": f, "pic": g }
                           var nb = new NGBASE()
                           //this.nb.save(tit+`_`+dqdz, sj)
                           nb.save(`alltginfo_${dqdz}`, sj).then(() => {
                               //alert("写入成功!")
                           })
                       }
                   })


               });
           }]);


       }
       function sitelist() {
           (window.RLQ = window.RLQ || []).push(['jquery', () => {
               $(document).ready(function () {
                   var dz = 'data' //目标站点名称
                   var dqdz = mw.config.values.wgGameName //当前站点名称
                   var sitename
                   let str = mw.config.values.wgSiteName;
                   let separatorIndex = str.indexOf("_BWIKI_"); // 找到分隔符的位置  
                   let sitelogo = document.querySelector("img.pic-logo").src;
                   if (separatorIndex !== -1) { // 确保找到了分隔符  
                       let i = str.slice(0, separatorIndex); // 提取从开头到分隔符之前的字符串  
                       sitename = i;
                   }
                   $.get(`https://wiki.biligame.com/${dz}/api.php?action=parse&format=json&title=用户讨论:GLOBAL/user_wikisitelist.json`).then(function (result233) {
                       //result = (new Function('return ' + result))();
                       if (parseInt(result233.parse.pageid) > 0) { //判断页面存在
                           //alert("存在!");
                           var nb = new NGBASE()
                           nb.read(`user_wikisitelist`).then((res) => {
                               function containsSitename(arr, sitename) {
                                   for (let i = 0; i < arr.length; i++) {
                                       if (arr[i].sitename === sitename) {
                                           return true; // 如果找到,返回true  
                                       }
                                   }
                                   return false; // 如果没有找到,返回false  
                               }
                               if (res.site == undefined) { //当前站点在site不存在时
                                   res.site = []
                                   res.site[res.site.length] = { "sitename": dqdz, "sitename_zh": sitename, "siteicon": mw.config.values.wgBiliIcon, "sitelogo": sitelogo }
                                   var nb = new NGBASE()
                                   //this.nb.save(tit+`_`+dqdz, sj)
                                   nb.save(`user_wikisitelist`, res).then(() => {
                                       //alert("写入成功!-3")
                                   })
                               } else { //当前站点在site存在时
                                   if (containsSitename(res.site, `${sitename}`) == false) { //当列表里不存在时
                                       res.site[res.site.length] = { "sitename": dqdz, "sitename_zh": sitename, "siteicon": mw.config.values.wgBiliIcon, "sitelogo": sitelogo }
                                       var nb = new NGBASE()
                                       nb.save(`user_wikisitelist`, res).then(() => {
                                           //alert("写入成功!-2")
                                       })
                                   }
                               }




                               //alert(res) //保存的内容
                               //console.log(res)
                           })


                       } else { //判断页面不存在
                           //alert("不存在!");
                           var sj = {}
                           sj.site = []
                           sj.site[sj.site.length] = { "sitename": dqdz, "sitename_zh": sitename, "siteicon": mw.config.values.wgBiliIcon, "sitelogo": sitelogo }
                           var nb = new NGBASE()
                           //this.nb.save(tit+`_`+dqdz, sj)
                           nb.save(`user_wikisitelist`, sj).then(() => {
                               //alert("写入成功!")
                           })
                       }
                   })


               });
           }]);
       }
   </script>
   <script>
       //封面选择器
       function img1cover() {
           var file = document.getElementById("imageLoader").files[0];
           var canvas = document.getElementById('imageCanvas');
           var ctx = canvas.getContext('2d');
           var reader = new FileReader();
           reader.onload = function (event) {
               var img = new Image();
               img.onload = function () {
                   var scaleFactor = Math.min(300 / img.width, 200 / img.height);
                   canvas.style.zoom = scaleFactor;
                   var size = file.size;
                   var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
                   var i = Math.floor(Math.log(size) / Math.log(1024));
                   var d = (size / Math.pow(1024, i)).toPrecision(3) + ' ' + sizes[i];
                   //document.getElementById("imgeSize").innerHTML = d;
                   var maxWidth = (img.width > 5000) ? img.width / 3 : img.width;
                   var maxHeight = (img.height > 5000) ? img.height / 3 : img.height;
                   drawImage(canvas, ctx, img, maxWidth, maxHeight);
               };
               img.src = event.target.result;
           };
           reader.readAsDataURL(file);
       }
       //var imageObject = null;
       function drawImage(canvas, ctx, img, maxWidth, maxHeight) {
           var canvasWidth = Math.min(maxWidth, img.width);
           var canvasHeight = Math.min(maxHeight, img.height);
           canvas.width = canvasWidth;
           canvas.height = canvasHeight;
           ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight);
       }
       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 replaceIframeWithWidget(htmlContent) {
           // 定义要搜索的<iframe>的正则表达式,并确保它可以匹配你给出的格式  
           const iframeRegex = /<iframe class="ql-video" frameborder="0" allowfullscreen="true" src="https:\/\/player.bilibili.com\/player.html\?bvid=([^"]+)&cid=&page=1"><\/iframe>/g;
           // 替换函数,它将使用匹配的iframe的bvid和page属性来生成新的字符串  
           const replacer = (match, bvid) => {
               return `
`; };
           // 使用正则表达式和替换函数来替换所有的<iframe>标签  
           return htmlContent.replace(iframeRegex, replacer);
       }
   </script>
   <script>
       //(function () { var t = function () { window.jQuery && window.mw ? $ready() : window.setTimeout(t, 100); }; t(); })();
   </script>
 

</body>

</html>