forked from mirror/MrDoc
modified: template/app_doc/tag_doc_base.html
This commit is contained in:
parent
aadcb5e2f7
commit
0a36a38296
@ -2,35 +2,32 @@
|
||||
{% load i18n %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn" style="font-size: 14px;">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name=renderer content=webkit>
|
||||
<meta name=renderer content=webkit>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||||
<meta http-equiv="Cache-Control" content="no-transform" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<meta http-equiv="Cache-Control" content="max-age=7200" />
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="keywords" content="{% if site_keywords != None %}{{site_keywords}}{% endif %}" />
|
||||
<meta name="keywords" content="{% if site_keywords != None %}{{site_keywords}}{% endif %}"/>
|
||||
<meta name="description" content="{% if site_desc != None %}{{site_desc}}{% endif %}" />
|
||||
<title>{% block title %}{% trans "标签:" %}{{tag.name}}{% endblock %} - {% if site_name != None and site_name != ''
|
||||
%}{{ site_name }}{% else %}{% trans "站点标题" %}{% endif %}</title>
|
||||
<title>{% block title %}{% trans "标签:" %}{{tag.name}}{% endblock %} - {% if site_name != None and site_name != '' %}{{ site_name }}{% else %}{% trans "站点标题" %}{% endif %}</title>
|
||||
|
||||
<link href="{% static 'layui/css/layui.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
{% if doc.editor_mode != 4 %}
|
||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}?version={{mrdoc_version}}" />
|
||||
{% endif %}
|
||||
{% if doc.editor_mode == 2 %}
|
||||
<link rel="stylesheet" href="{% static 'vditor/dist/index.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel="stylesheet" href="{% static 'vditor/dist/index.css' %}?version={{mrdoc_version}}" />
|
||||
{% endif %}
|
||||
{% if doc.editor_mode == 4 %}
|
||||
<!-- 在线表格 -->
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/plugins/css/pluginsCss.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/plugins/plugins.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/css/luckysheet.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet'
|
||||
href="{% static 'luckysheet/dist/assets/iconfont/iconfont.css' %}?version={{mrdoc_version}}" />
|
||||
<!-- 在线表格 -->
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/plugins/css/pluginsCss.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/plugins/plugins.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/css/luckysheet.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel='stylesheet' href="{% static 'luckysheet/dist/assets/iconfont/iconfont.css' %}?version={{mrdoc_version}}" />
|
||||
{% endif %}
|
||||
<link href="{% static 'viewerjs/viewer.min.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
@ -39,32 +36,16 @@
|
||||
<link href="{% static 'iconFont/iconfont.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'prismjs/prism.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<style>
|
||||
{
|
||||
% if img_scale %
|
||||
}
|
||||
|
||||
.markdown-body p img {
|
||||
{% if img_scale %}
|
||||
.markdown-body p img{
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
{
|
||||
% endif %
|
||||
{% endif %}
|
||||
{% if long_code == 'on' %}
|
||||
pre.linenums,pre.line-numbers,.vditor-reset > pre > code{
|
||||
max-height: max-content!important;
|
||||
}
|
||||
|
||||
{
|
||||
% if long_code=='on' %
|
||||
}
|
||||
|
||||
pre.linenums,
|
||||
pre.line-numbers,
|
||||
.vditor-reset>pre>code {
|
||||
max-height: max-content !important;
|
||||
}
|
||||
|
||||
{
|
||||
% endif %
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
/* html{
|
||||
filter: invert(1) hue-rotate(180deg);
|
||||
} */
|
||||
@ -75,304 +56,301 @@
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="doc layui-fluid" style="padding-left:0px;">
|
||||
<!-- 左侧目录栏 -->
|
||||
<div class="doc-summary">
|
||||
<!-- 文档搜索 -->
|
||||
<form action="" method="get">
|
||||
<div id="doc-search-input">
|
||||
<input type="text" name="kw" placeholder="输入并回车搜索" value="" class="layui-input doc-search-input">
|
||||
</div>
|
||||
</form>
|
||||
<!-- 文集名称 -->
|
||||
<div class="project-title">
|
||||
<i class="fa fa-tag"></i> {% trans "标签:" %}<a href="{% url 'tag_docs' tag.id %}">{{ tag.name }}
|
||||
{% if project.role == 1 %}
|
||||
<div class="doc layui-fluid" style="padding-left:0px;">
|
||||
<!-- 左侧目录栏 -->
|
||||
<div class="doc-summary">
|
||||
<!-- 文档搜索 -->
|
||||
<form action="" method="get">
|
||||
<div id="doc-search-input">
|
||||
<input type="text" name="kw" placeholder="输入并回车搜索" value="" class="layui-input doc-search-input">
|
||||
</div>
|
||||
</form>
|
||||
<!-- 文集名称 -->
|
||||
<div class="project-title">
|
||||
<i class="fa fa-tag"></i> {% trans "标签:" %}<a href="{% url 'tag_docs' tag.id %}">{{ tag.name }}
|
||||
{% if project.role == 1 %}
|
||||
<i class="layui-icon layui-icon-password" title="私密文档"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<!-- 遍历文集大纲 -->
|
||||
{% load doc_filter %}
|
||||
<nav>
|
||||
<ul class="summary">
|
||||
<!-- 一级目录 -->
|
||||
{% for doc in docs %}
|
||||
<li tooltip="{{doc.doc.top_doc | get_doc_top}}" placement="bottom">
|
||||
<a href="{% url 'tag_doc' tag_id=tag.id doc_id=doc.doc.id %}" target="_blank"><i
|
||||
class="{% if doc.doc.editor_mode == 4 %}layui-icon layui-icon-table {% else %}iconfont mrdoc-icon-wendang{% endif %}"></i>
|
||||
{{ doc.doc.name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- 右下角广告块 -->
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{% if ad_code_3 %}
|
||||
<div class="ad-code">
|
||||
{{ ad_code_3 | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<!-- 左侧目录栏结束 -->
|
||||
<hr>
|
||||
|
||||
<!-- 遍历文集大纲 -->
|
||||
{% load doc_filter %}
|
||||
<nav>
|
||||
<ul class="summary">
|
||||
<!-- 一级目录 -->
|
||||
{% for doc in docs %}
|
||||
<li tooltip="{{doc.doc.top_doc | get_doc_top}}" placement="bottom">
|
||||
<a href="{% url 'tag_doc' tag_id=tag.id doc_id=doc.doc.id %}" target="_blank" ><i class="{% if doc.doc.editor_mode == 4 %}layui-icon layui-icon-table {% else %}iconfont mrdoc-icon-wendang{% endif %}"></i> {{ doc.doc.name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="bq">
|
||||
<a href="javascript:void(0);" class="mrdoc-link" id="dashang">{% trans "本文档使用 MrDoc 发布" %}</a>
|
||||
</div>
|
||||
<!-- 右下角广告块 -->
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{% if ad_code_3 %}
|
||||
<div class="ad-code">
|
||||
{{ ad_code_3 | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
</div>
|
||||
<!-- 左侧目录栏结束 -->
|
||||
|
||||
<!-- 右侧文档栏 -->
|
||||
<div class="doc-body">
|
||||
<!-- 文档导航 -->
|
||||
<div class="doc-header" role="navigation">
|
||||
<a class="btn pull-left js-toolbar-action" aria-label="" href="javascript:void(0);" title="切换侧边栏">
|
||||
<i class="fa fa-align-justify"></i>
|
||||
</a>
|
||||
<a class="btn pull-left font-small" href="javascript:void(0);" title="缩小字体">
|
||||
<i class="fa fa-font">-</i>
|
||||
</a>
|
||||
<a class="btn pull-left font-large" href="javascript:void(0);" title="放大字体">
|
||||
<i class="fa fa-font">+</i>
|
||||
</a>
|
||||
<a class="btn pull-left font-switch" href="javascript:void(0);" title="切换字体类型">
|
||||
<i class="fa fa-text-height"></i>
|
||||
</a>
|
||||
<!-- 顶部工具栏 -->
|
||||
{% block head_toolbar %}
|
||||
{% endblock %}
|
||||
<!-- 右侧文档栏 -->
|
||||
<div class="doc-body">
|
||||
<!-- 文档导航 -->
|
||||
<div class="doc-header" role="navigation">
|
||||
<a class="btn pull-left js-toolbar-action" aria-label="" href="javascript:void(0);" title="切换侧边栏">
|
||||
<i class="fa fa-align-justify"></i>
|
||||
</a>
|
||||
<a class="btn pull-left font-small" href="javascript:void(0);" title="缩小字体">
|
||||
<i class="fa fa-font">-</i>
|
||||
</a>
|
||||
<a class="btn pull-left font-large" href="javascript:void(0);" title="放大字体">
|
||||
<i class="fa fa-font">+</i>
|
||||
</a>
|
||||
<a class="btn pull-left font-switch" href="javascript:void(0);" title="切换字体类型">
|
||||
<i class="fa fa-text-height"></i>
|
||||
</a>
|
||||
<!-- 顶部工具栏 -->
|
||||
{% block head_toolbar %}
|
||||
{% endblock %}
|
||||
|
||||
<a class="btn pull-right" aria-label="" href="{% url 'pro_list' %}">
|
||||
<i class="fa fa-home"></i> <span class="layui-hide-xs">{% trans "首页" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- 文档主体 -->
|
||||
<div class="doc-body-content">
|
||||
<div class="doc-body-content-div">
|
||||
<!-- 文档内容 -->
|
||||
<div class="doc-content">
|
||||
<!-- 标题 -->
|
||||
<div class="doc-info">
|
||||
<!-- 页面主体头信息 -->
|
||||
{% block content_head %}
|
||||
<h1>{% trans "标签:" %}{{ tag.name }}</h1>
|
||||
<hr>
|
||||
{% endblock %}
|
||||
<a class="btn pull-right" aria-label="" href="{% url 'pro_list' %}">
|
||||
<i class="fa fa-home"></i> <span class="layui-hide-xs">{% trans "首页" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- 文档主体 -->
|
||||
<div class="doc-body-content">
|
||||
<div class="doc-body-content-div">
|
||||
<!-- 文档内容 -->
|
||||
<div class="doc-content">
|
||||
<!-- 标题 -->
|
||||
<div class="doc-info">
|
||||
<!-- 页面主体头信息 -->
|
||||
{% block content_head %}
|
||||
<h1>{% trans "标签:" %}{{ tag.name }}</h1><hr>
|
||||
{% endblock %}
|
||||
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{% if ad_code %}
|
||||
<div class="ad-code">
|
||||
<div class="ad-code">
|
||||
{{ ad_code | safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
</div>
|
||||
<!-- 标题结束 -->
|
||||
<!-- 正文开始 -->
|
||||
<div class="markdown-body" id="content">
|
||||
{% block page_content %}
|
||||
<div id="tag-relation-chart" style="max-width: max-content;width: 800px;height: 600px;">
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<!-- 正文结束 -->
|
||||
<hr>
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
</div>
|
||||
<!-- 分享栏 -->
|
||||
<div style="color: rgba(0,0,0,.65);margin-bottom: 10px;margin-top: 10px;">
|
||||
{% block doc_bottom_block %}
|
||||
<!-- 标题结束 -->
|
||||
<!-- 正文开始 -->
|
||||
<div class="markdown-body" id="content">
|
||||
{% block page_content %}
|
||||
<div id="tag-relation-chart" style="max-width: max-content;width: 800px;height: 600px;">
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<!-- 正文结束 -->
|
||||
<hr>
|
||||
</div>
|
||||
<!-- 分享栏 -->
|
||||
<div style="color: rgba(0,0,0,.65);margin-bottom: 10px;margin-top: 10px;">
|
||||
{% block doc_bottom_block %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
<!-- 广告代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{% if ad_code_2 %}
|
||||
<div class="ad-code">
|
||||
<div class="ad-code">
|
||||
{{ ad_code_2 | safe }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
|
||||
{% block doc_previous_next %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧文档栏结束 -->
|
||||
<div class="fixed-tool-bar">
|
||||
<div class="toTop"><i class="layui-icon layui-icon-up"></i></div>
|
||||
{% block right_widget %} {% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 转发选项卡模板 -->
|
||||
<div id="share_div" style="display: none;">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">手机扫码</li>
|
||||
<li>复制链接</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<div class="layui-tab-item layui-show" align='center'>
|
||||
<p style="font-weight: 700;margin-bottom: 10px;">手机扫一扫转发分享</p>
|
||||
<div id="url_qrcode"></div>
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<input type="text" id="copy_crt_url" name="current_url" class="layui-input" /><br>
|
||||
<button class="layui-btn layui-btn-radius layui-btn-xs" style="background-color: #333;"
|
||||
onclick="copyUrl();">复制链接</button>
|
||||
</div>
|
||||
{% block doc_previous_next %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧文档栏结束 -->
|
||||
<div class="fixed-tool-bar">
|
||||
<div class="toTop" ><i class="layui-icon layui-icon-up"></i></div>
|
||||
{% block right_widget %} {% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'layui/layui.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'viewerjs/viewer.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'qrcodejs/qrcode.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'prismjs/prism.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc-docs.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'iconFont/iconfont.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/lib/purify.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/lib/echarts.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<!-- 生成文集目录大纲 -->
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
});
|
||||
// 生成文集目录
|
||||
getProjectToc = function () {
|
||||
$.post("{% url 'get_pro_doc_tree' %}", { 'pro_id': '{{project.id}}' }, function (r) {
|
||||
$("#loading-project-toc").hide();
|
||||
if (r.status) {
|
||||
var toc_str = ""
|
||||
layui.each(r.data, function (index, item) {
|
||||
toc_str += "<li>"
|
||||
if (item['children'] != undefined) { // 存在二级文档
|
||||
li = '<div style="display:flex;justify-content:space-between;">' +
|
||||
'<a href="/project-' + '{{project.id}}' + '/doc-' + item.id + '/" title="' + item.title + '">' + item.title + '</a>' +
|
||||
'<i class="fa fa-chevron-left switch-toc" style="padding:15px;"></i>' +
|
||||
'</div>' +
|
||||
'<ul class="sub-menu toc-close">'
|
||||
toc_str += li
|
||||
layui.each(item['children'], function (index, item) {// 遍历二级文档
|
||||
toc_str += '<li>'
|
||||
if (item['children'] != undefined) { //存在三级文档
|
||||
li = '<div style="display:flex;justify-content:space-between;">' +
|
||||
'<a href="/project-' + '{{project.id}}' + '/doc-' + item.id + '/" title="' + item.title + '">' + item.title + '</a>' +
|
||||
'<i class="fa fa-chevron-left switch-toc" style="padding:15px;"></i>' +
|
||||
'</div>' + '<ul class="sub-menu toc-close">'
|
||||
<!-- 转发选项卡模板 -->
|
||||
<div id="share_div" style="display: none;">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">手机扫码</li>
|
||||
<li>复制链接</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<div class="layui-tab-item layui-show" align='center'>
|
||||
<p style="font-weight: 700;margin-bottom: 10px;">手机扫一扫转发分享</p>
|
||||
<div id="url_qrcode"></div>
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<input type="text" id="copy_crt_url" name="current_url" class="layui-input" /><br>
|
||||
<button class="layui-btn layui-btn-radius layui-btn-xs" style="background-color: #333;" onclick="copyUrl();">复制链接</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'layui/layui.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'viewerjs/viewer.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'qrcodejs/qrcode.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'prismjs/prism.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc-docs.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'iconFont/iconfont.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/lib/purify.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/lib/echarts.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<!-- 生成文集目录大纲 -->
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
});
|
||||
// 生成文集目录
|
||||
getProjectToc = function(){
|
||||
$.post("{% url 'get_pro_doc_tree' %}",{'pro_id':'{{project.id}}'},function(r){
|
||||
$("#loading-project-toc").hide();
|
||||
if(r.status){
|
||||
var toc_str = ""
|
||||
layui.each(r.data,function(index,item){
|
||||
toc_str += "<li>"
|
||||
if(item['children'] != undefined){ // 存在二级文档
|
||||
li = '<div style="display:flex;justify-content:space-between;">' +
|
||||
'<a href="/project-'+'{{project.id}}'+'/doc-'+item.id+'/" title="'+item.title+'">'+item.title+'</a>' +
|
||||
'<i class="fa fa-chevron-left switch-toc" style="padding:15px;"></i>'+
|
||||
'</div>'+
|
||||
'<ul class="sub-menu toc-close">'
|
||||
toc_str += li
|
||||
layui.each(item['children'],function(index,item){// 遍历二级文档
|
||||
toc_str += '<li>'
|
||||
if(item['children'] != undefined){ //存在三级文档
|
||||
li = '<div style="display:flex;justify-content:space-between;">' +
|
||||
'<a href="/project-'+'{{project.id}}'+'/doc-'+item.id+'/" title="'+item.title+'">'+item.title+'</a>' +
|
||||
'<i class="fa fa-chevron-left switch-toc" style="padding:15px;"></i>'+
|
||||
'</div>'+'<ul class="sub-menu toc-close">'
|
||||
toc_str += li
|
||||
layui.each(item['children'],function(index,item){ // 遍历三级文档
|
||||
li = '<li><a href="/project-'+'{{project.id}}'+'/doc-'+item.id+'/" title="'+item.title+'">'+item.title+'</a></li>'
|
||||
toc_str += li
|
||||
layui.each(item['children'], function (index, item) { // 遍历三级文档
|
||||
li = '<li><a href="/project-' + '{{project.id}}' + '/doc-' + item.id + '/" title="' + item.title + '">' + item.title + '</a></li>'
|
||||
toc_str += li
|
||||
})
|
||||
toc_str += '</ul>'
|
||||
} else {// 不存在三级文档
|
||||
li = '<a href="/project-' + '{{project.id}}' + '/doc-' + item.id + '/" title="' + item.title + '">' + item.title + '</a>'
|
||||
toc_str += li
|
||||
}
|
||||
toc_str += '</li>'
|
||||
})
|
||||
toc_str += '</ul>'
|
||||
} else {//不存在二级文档
|
||||
li = '<a href="/project-' + '{{project.id}}' + '/doc-' + item.id + '/" title="' + item.title + '">' + item.title + '</a>'
|
||||
toc_str += li
|
||||
}
|
||||
toc_str += '</li>'
|
||||
});
|
||||
$('#project-toc').append(toc_str)
|
||||
tagCurrentDoc();
|
||||
} else {
|
||||
layer.msg("获取文集目录失败!")
|
||||
}
|
||||
});
|
||||
};
|
||||
// getProjectToc();
|
||||
|
||||
//为当前页面的目录链接添加蓝色样式
|
||||
tagCurrentDoc = function () {
|
||||
$("nav li a").each(function (i) {
|
||||
var $me = $(this);
|
||||
var lochref = $.trim(window.location.href); // 获取当前URL
|
||||
var mehref = $.trim($me.get(0).href);
|
||||
if (lochref.indexOf(mehref) != -1) {
|
||||
// console.log($me,lochref,mehref)
|
||||
$me.closest("li").addClass("active");
|
||||
//展开当前文档的上级目录
|
||||
$me.parent("li").parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开二级目录
|
||||
$me.parent("div").parent('li').parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开还有子级的二级目录
|
||||
$me.parent("li").parent('ul').parent('li').parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开三级目录
|
||||
$me.parents("ul.sub-menu").prevAll("div").children("i").toggleClass("fa-chevron-left fa-chevron-down");//切换图标
|
||||
} else {
|
||||
// console.log(lochref,mehref)
|
||||
$me.closest("li").removeClass("active");
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
{% if doc.editor_mode == 2 %}
|
||||
<script src="{% static 'vditor/dist/method.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% elif doc.editor_mode == 1 %}
|
||||
<script src="{% static 'editor.md/lib/marked.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% elif doc.editor_mode == 4 %}
|
||||
<!-- 在线表格 -->
|
||||
<script src="{% static 'luckysheet/dist/plugins/js/plugin.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'luckysheet/dist/luckysheet.umd.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
// 外部链接添加图标
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
Array.prototype.filter.call(document.links, function (link) {
|
||||
return link.hostname && link.hostname !== location.hostname;
|
||||
})
|
||||
.forEach(function (link) {
|
||||
// console.log(link,$(link).children('img').length)
|
||||
if ($(link).children().length == 0) {
|
||||
link.classList.add('external');
|
||||
})
|
||||
toc_str += '</ul>'
|
||||
}else{// 不存在三级文档
|
||||
li = '<a href="/project-'+'{{project.id}}'+'/doc-'+item.id+'/" title="'+item.title+'">'+item.title+'</a>'
|
||||
toc_str += li
|
||||
}
|
||||
toc_str += '</li>'
|
||||
})
|
||||
toc_str += '</ul>'
|
||||
}else{//不存在二级文档
|
||||
li = '<a href="/project-'+'{{project.id}}'+'/doc-'+item.id+'/" title="'+item.title+'">'+item.title+'</a>'
|
||||
toc_str += li
|
||||
}
|
||||
toc_str += '</li>'
|
||||
});
|
||||
$('#project-toc').append(toc_str)
|
||||
tagCurrentDoc();
|
||||
}else{
|
||||
layer.msg("获取文集目录失败!")
|
||||
}
|
||||
});
|
||||
};
|
||||
// getProjectToc();
|
||||
|
||||
</script>
|
||||
//为当前页面的目录链接添加蓝色样式
|
||||
tagCurrentDoc = function(){
|
||||
$("nav li a").each(function (i) {
|
||||
var $me = $(this);
|
||||
var lochref = $.trim(window.location.href); // 获取当前URL
|
||||
var mehref = $.trim($me.get(0).href);
|
||||
if (lochref.indexOf(mehref) != -1) {
|
||||
// console.log($me,lochref,mehref)
|
||||
$me.closest("li").addClass("active");
|
||||
//展开当前文档的上级目录
|
||||
$me.parent("li").parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开二级目录
|
||||
$me.parent("div").parent('li').parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开还有子级的二级目录
|
||||
$me.parent("li").parent('ul').parent('li').parent('ul.sub-menu').toggleClass("toc-close toc-open"); //展开三级目录
|
||||
$me.parents("ul.sub-menu").prevAll("div").children("i").toggleClass("fa-chevron-left fa-chevron-down");//切换图标
|
||||
} else {
|
||||
// console.log(lochref,mehref)
|
||||
$me.closest("li").removeClass("active");
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- 动态添加广告代码 -->
|
||||
{% if doc.editor_mode == 2 %}
|
||||
<script src="{% static 'vditor/dist/method.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% elif doc.editor_mode == 1 %}
|
||||
<script src="{% static 'editor.md/lib/marked.min.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% elif doc.editor_mode == 4 %}
|
||||
<!-- 在线表格 -->
|
||||
<script src="{% static 'luckysheet/dist/plugins/js/plugin.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'luckysheet/dist/luckysheet.umd.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
// 外部链接添加图标
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
Array.prototype.filter.call(document.links, function(link) {
|
||||
return link.hostname && link.hostname !== location.hostname;
|
||||
})
|
||||
.forEach(function(link) {
|
||||
// console.log(link,$(link).children('img').length)
|
||||
if($(link).children().length == 0){
|
||||
link.classList.add('external');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- 动态添加广告代码 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
<div id="ad-1">
|
||||
{{ad_code|safe}}
|
||||
</div>
|
||||
<div id="ad-2">
|
||||
{{ad_code_2|safe}}
|
||||
</div>
|
||||
<div id="ad-3">
|
||||
{{ad_code_3|safe}}
|
||||
</div>
|
||||
<script>
|
||||
$("#ad-1").appendTo($("#ad-code-1"));
|
||||
$("#ad-2").appendTo($("#ad-code-2"));
|
||||
$("#ad-3").appendTo($("#ad-code-3"));
|
||||
</script>
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
|
||||
<!-- 统计代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
<div id="ad-1">
|
||||
{{ad_code|safe}}
|
||||
</div>
|
||||
<div id="ad-2">
|
||||
{{ad_code_2|safe}}
|
||||
</div>
|
||||
<div id="ad-3">
|
||||
{{ad_code_3|safe}}
|
||||
</div>
|
||||
<script>
|
||||
$("#ad-1").appendTo($("#ad-code-1"));
|
||||
$("#ad-2").appendTo($("#ad-code-2"));
|
||||
$("#ad-3").appendTo($("#ad-code-3"));
|
||||
</script>
|
||||
{{ static_code | safe }}
|
||||
{% endif %}
|
||||
<!-- 广告代码结束 -->
|
||||
|
||||
<!-- 统计代码开始 -->
|
||||
{% if debug %}
|
||||
{% else %}
|
||||
{{ static_code | safe }}
|
||||
{% endif %}
|
||||
<!-- 统计代码结束 -->
|
||||
{% block custom_script %}
|
||||
{% endblock %}
|
||||
<!-- 统计代码结束 -->
|
||||
{% block custom_script %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user