MCPcopy Index your code
hub / github.com/TruthHun/BookStack / load_doc

Function load_doc

static/js/bookstack.js:43–109  ·  view source on GitHub ↗
(url,wd,without_history)

Source from the content-addressed store, hash-verified

41}
42
43function load_doc(url,wd,without_history) {
44 NProgress.start();
45 $.get(url+"?fr=bookstack",function (res) {
46 if(res.errcode === 0){
47 var body = res.data.body;
48 var doc_title = res.data.doc_title;
49 var title = res.data.title;
50 var $body = body;
51 try {
52 if(res.data.is_allow_read==false){$body='<div class="locked-reading text-center"><div class="locked-icon"></div><div class="help-block">未登录游客仅可阅读 <span style="color:red">'+res.data.percent+'%</span> 章节,请您 <a href="/login" title="登录">登录</a> 再阅读</div>' }
53 } catch (error) {}
54 $("#page-content").html($body);
55 // RenderByMarkdown($body);
56 $("title").text(title);
57 $("#article-title").text(doc_title);
58
59 $(".bookmark-action").attr("data-docid",res.data.doc_id);
60 $("input[name=doc_id]").val(res.data.doc_id)
61 $(".btn-edit").attr("href",$(".btn-edit").attr("data-url")+res.data.doc_id);
62 if (res.data.bookmark){//已添加书签
63 $(".bookmark-action .bookmark-add").addClass("hide");
64 $(".bookmark-action .bookmark-remove").removeClass("hide");
65 }else{//未添加书签
66 $(".bookmark-action .bookmark-add").removeClass("hide");
67 $(".bookmark-action .bookmark-remove").addClass("hide");
68 }
69 if (!without_history){
70 change_url_state(url,title);
71 }
72 active_readed_menu(url);
73 toggleToc();
74 NProgress.done();
75 pre_and_next_link();
76 //重新生成脑图
77 $('.mindmap svg').detach();
78 try {
79 $('.mindmap').each(function() {
80 drawMindMap(this);
81 });
82
83 } catch (e) {
84 console.log(e);
85
86 }
87 if(wd) {
88 var wds = wd.split(","),l=wds.length;
89 for (var i = 0; i < l; i++) {
90 $(".markdown-body").highlight(wds[i].trim());
91 }
92 }
93 $('.m-manual .manual-right').animate({scrollTop:0}, 100);
94 $("#qrcode").html("");
95 $("#qrcode").qrcode(location.href);
96 $(".read-count").text(res.data.view);
97 $(".updated-at").text(res.data.updated_at);
98 initLinkWithImage()
99 ilazyload()
100 initComments(res.data.comments)

Callers 1

bookstack.jsFile · 0.85

Calls 12

change_url_stateFunction · 0.85
active_readed_menuFunction · 0.85
toggleTocFunction · 0.85
pre_and_next_linkFunction · 0.85
drawMindMapFunction · 0.85
initLinkWithImageFunction · 0.85
ilazyloadFunction · 0.85
initCommentsFunction · 0.85
show_copy_btnFunction · 0.85
textMethod · 0.80
$Function · 0.50
getMethod · 0.45

Tested by

no test coverage detected