本WIKI于2021年03月04日通过了时雨音的接管申请,编辑权限开放。
欢迎收藏本WIKI防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
建议使用PC版页面访问本WIKI以获得更佳体验!
编辑帮助 • WIKI建议 • 加入我们 • 使用哔哩哔哩APP打开WIKI
全站通知:
用户:646195980/HeroS.js
刷
历
编
跳到导航
跳到搜索
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/**
* HerosSortable.js
* Author: 飞小RAN (https://wiki.biligame.com/gt/User:646195980)
* License: See https://wiki.biligame.com/gt/User:646195980#License
* 排排坐,吃果果,你吃T0我吃T1
**/
async function main() {
'use strict';
await new Promise(resolve => setTimeout(resolve, 1000));
let mw = window.mw;
let $ = window.$;
await mw.loader.load('https://patchwiki.biligame.com/images/gt/d/d1/2vlakfqaoom96nfo7dt15fxbv1unt9j.txt');
await new Promise(resolve => setTimeout(resolve, 1000));
await load();
document.querySelector('.loading').style.display = 'none';
document.querySelectorAll('.hero-attr').forEach(i => {
i.addEventListener('click', e => {
i.innerHTML = '';
i.contentEditable = true;
i.classList.toggle('ic');
e.preventDefault();
});
});
document.querySelector('.T-add').addEventListener('click', e => {
const tbody = document.querySelector('.T-table tbody');
const tl = document.createElement('tr');
tl.className = 'T-tl';
const th = document.createElement('th');
th.contentEditable = true;
th.textContent = 'T';
tl.appendChild(th);
for (let i = 0; i < 6; i++) {
const td = document.createElement('td');
tl.appendChild(td);
}
tbody.appendChild(tl);
load();
});
}
function load(){
let Sortable = window.Sortable;
const setting = {
group: 'heros',
animation: 150,
scroll: true,
scrollSensitivity: 100,
scrollSpeed: 10,
};
new Sortable(document.querySelector(".heros-content"), setting);
document.querySelectorAll(".T-tl > td").forEach(i => {
new Sortable(i, setting);
});
const setting2 = {
group: 'levels',
animation: 150
};
new Sortable(document.querySelector(".T-table tbody"), setting2);
document.querySelectorAll('.T-table th').forEach(i => {
i.contentEditable = true;
});
}
main();
document.querySelector('.T-ex').addEventListener('click', e=> {
const blob = new Blob([document.querySelector('.T-table').outerHTML], { type: 'text/html' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'table.html';
link.click();
URL.revokeObjectURL(link.href);
});
document.querySelector('.T-in').addEventListener('click', ev=> {
ev.preventDefault();
const input = document.createElement('input');
input.type = 'file';
input.accept = '.html';
input.style.display = 'none';
input.addEventListener('change', e=> {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(evt) {
const uploadedHTML = evt.target.result;
const parser = new DOMParser();
const doc = parser.parseFromString(uploadedHTML, 'text/html');
const tables = doc.querySelectorAll('table');
let newTableContent = '';
if (tables.length > 0) {
newTableContent = tables[0].outerHTML;
} else {
newTableContent = '<p>上传的文件中没有找到表格内容。</p>';
}
const tableElement = document.querySelector('.T-table');
tableElement.innerHTML = newTableContent;
};
reader.onerror = function() {
alert('读取文件时出错,请尝试重新上传。');
};
reader.readAsText(file);
input.remove();
document.querySelector('.loading').style.display = '';
load();
} else {
alert('未选择任何文件。');
input.remove();
}
});
input.click();
});

沪公网安备 31011002002714 号