注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
/* 这里的任何JavaScript将为所有档案员在每次页面载入时加载。 */
function appendCSS() {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = '/extensions/Whiteverse/font/stylesheet.css';
document.head.appendChild(link);
}
appendCSS();
// 引入 Vis Timeline 库
function appendTimeline() {
var script = document.createElement('script');
script.src = 'https://unpkg.com/vis-timeline/standalone/umd/vis-timeline-graph2d.min.js';
document.head.appendChild(script);
}
appendTimeline();
$(document).ready(function() {
// 确保仅在有时间轴的页面中执行
if ($("#visualization").length) {
const container = document.getElementById("visualization");
// 解析项目和日期
const itemsArray = $(container).data("items").split(";");
const items = new vis.DataSet(itemsArray.map((item, index) => {const [content, start] = item.split(","); return { id: index + 1, content: content.trim(), start: start.trim() };}));
// Configuration for the Timeline
const options = {};
// Create a Timeline
const timeline = new vis.Timeline(container, items, options);
}
});