mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-06 21:44:03 +08:00
commit
02e90619b2
@ -83,6 +83,11 @@ showManual = path => {
|
||||
} else {
|
||||
var f = window.manualVars.dirs.idxFile ? path : path + '.html';
|
||||
}
|
||||
if (/(.*?)(\.md)/.test(path)) {
|
||||
var isMd = true
|
||||
e = true
|
||||
id = '#' + $('.select .name').text()
|
||||
}
|
||||
var file = `${window.manualVars.dirs.docPath}/${f}`;
|
||||
$("#mainlist").fadeOut();
|
||||
$(".load").html('Loading').show();
|
||||
@ -91,6 +96,9 @@ showManual = path => {
|
||||
type: "GET",
|
||||
});
|
||||
request.done(data => {
|
||||
if (isMd) {
|
||||
data = window.markdownit().use(window.markdownItAnchor).render(data)
|
||||
}
|
||||
$(".load").hide();
|
||||
var relPath = f.substr(0, f.lastIndexOf('/') + 1);
|
||||
// a 标签改为相对路径
|
||||
@ -234,7 +242,7 @@ utools.onPluginEnter(async ({ code, type, payload }) => {
|
||||
if (!err) {
|
||||
files.forEach(file => {
|
||||
$('title').after(`<link rel="stylesheet" href="${assetDir}/${file}" name="manual">`)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
$('title').after('<link rel="stylesheet" href="assets/styles/manual.css" name="manual">')
|
||||
}
|
||||
@ -246,7 +254,7 @@ utools.onPluginEnter(async ({ code, type, payload }) => {
|
||||
if (window.manualVars.dirs.idxFile.includes('payload.json')) {
|
||||
index = JSON.parse(rc4(index, 'uTools'))
|
||||
} else {
|
||||
index = JSON.parse(index);
|
||||
index = JSON.parse(index);
|
||||
}
|
||||
} else {
|
||||
index = utools.db.get(code).data;
|
||||
@ -307,7 +315,7 @@ $("#mainlist").on('mousemove', '.info', function () {
|
||||
$(".select").removeClass('select');
|
||||
$(this).addClass('select');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 右键单击手册,退出手册; 中键发送文本
|
||||
$("#manual").on('mousedown', function (e) {
|
||||
@ -352,7 +360,7 @@ $(document).keydown(e => {
|
||||
select && sendText(select);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 列表界面进入手册
|
||||
if ($('#manual').is(':hidden') && $("#mainlist").is(":visible")) {
|
||||
var path = $(".select").attr('path');
|
||||
@ -366,7 +374,7 @@ $(document).keydown(e => {
|
||||
if (window.manualVars.findex > 0) {
|
||||
$(`.founds:eq(${window.manualVars.findex - 1})`).removeClass('firstFound');
|
||||
} else {
|
||||
$('.founds:last').removeClass('firstFound');
|
||||
$('.founds:last').removeClass('firstFound');
|
||||
}
|
||||
$(`.founds:eq(${window.manualVars.findex})`).addClass('firstFound');
|
||||
$('.firstFound').get(0).scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
@ -446,10 +454,10 @@ $(document).keydown(e => {
|
||||
cnText += '<br>';
|
||||
}
|
||||
$("#infopannel").html(cnText)
|
||||
})
|
||||
})
|
||||
// }
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
3
src/assets/plugins/markdown-it.min.js
vendored
Normal file
3
src/assets/plugins/markdown-it.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
src/assets/plugins/markdownItAnchor.umd.js
Normal file
2
src/assets/plugins/markdownItAnchor.umd.js
Normal file
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="assets/styles/style.css">
|
||||
@ -12,6 +12,8 @@
|
||||
<script src="assets/plugins/jquery-3.3.1.min.js"></script>
|
||||
<script src="assets/plugins/jquery.autoMenu.js"></script>
|
||||
<script src="assets/plugins/hlsearch.js"></script>
|
||||
<script src="assets/plugins/markdown-it.min.js"></script>
|
||||
<script src="assets/plugins/markdownItAnchor.umd.js"></script>
|
||||
<!-- <script src="assets/plugins/jquery.nicescroll.min.js"></script> -->
|
||||
<script src="assets/plugins/prism.js"></script>
|
||||
<script src="assets/plugins/sweetalert2.all.min.js"></script>
|
||||
@ -31,4 +33,4 @@
|
||||
<script src="assets/index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user