forked from ether/ep_table_of_contents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (31 loc) · 1.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var eejs = require('ep_etherpad-lite/node/eejs'),
express = require('ep_etherpad-lite/node_modules/express'),
settings = require('ep_etherpad-lite/node/utils/Settings');
exports.eejsBlock_styles = function (hook_name, args, cb) {
args.content = args.content + "<link href='../static/plugins/ep_table_of_contents/static/css/toc.css' rel='stylesheet'>";
return cb();
}
exports.eejsBlock_dd_view = function (hook_name, args, cb) {
args.content = args.content + "<li><a href='#' onClick='$(\"#options-toc\").click();'>Table Of Contents</a></li>";
return cb();
}
exports.eejsBlock_body = function (hook_name, args, cb) {
args.content = args.content + eejs.require("ep_table_of_contents/templates/toc.ejs", {}, module);
return cb();
}
exports.eejsBlock_scripts = function (hook_name, args, cb) {
args.content += "<script src='../static/plugins/ep_table_of_contents/static/js/toc.js'></script>";
return cb();
}
exports.eejsBlock_mySettings = function (hook_name, args, cb) {
var checked_state = 'unchecked';
if(settings.ep_toc){
if (settings.ep_toc.disable_by_default === true){
checked_state = 'unchecked';
}else{
checked_state = 'checked';
}
}
args.content = args.content + eejs.require('ep_table_of_contents/templates/toc_entry.ejs', {checked : checked_state});
return cb();
}