forked from jrocho/ILIAS-Etherpad-Lite-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpad.js.sample
154 lines (122 loc) · 4.59 KB
/
pad.js.sample
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
* Some Customizations for the pad in ilias
*
* @author Timon Amstutz <[email protected]>
*
* **/
function customStart()
{
/** Get Params from URL **/
var parameters = getUrlVars();
/** Set language via cookie **/
document.cookie = "language="+parameters["language"]+"; path=/";
/** Get rid of error in view if language is german **/
$("#mycolorpickersave").css({"padding":"2px","min-width":"70px"});
$("#mycolorpickercancel").css({"padding":"2px","min-width":"70px"});
/** Add classes for data-key fields **/
$( "li[data-key='bold']" ).addClass("bold");
$( "li[data-key='italic']" ).addClass("italic");
$( "li[data-key='underline']" ).addClass("underline");
$( "li[data-key='strikethrough']" ).addClass("strikethrough");
$( "li[data-key='insertorderedlist']" ).addClass("insertorderedlist");
$( "li[data-key='insertunorderedlist']" ).addClass("insertunorderedlist");
$( "li[data-key='indent']" ).addClass("indent");
$( "li[data-key='outdent']" ).addClass("outdent");
$( "li[data-key='undo']" ).addClass("undo");
$( "li[data-key='redo']" ).addClass("redo");
$( "li[data-key='clearauthorship']" ).addClass("clearauthorship");
$( "li[data-key='import_export']" ).addClass("import_export");
$( "li[data-key='showTimeSlider']" ).addClass("showTimeSlider");
$( "li[data-key='savedRevision']" ).addClass("savedRevision");
$( "li[data-key='embed']" ).addClass("embed");
$( "li[data-key='settings']" ).addClass("settings");
// replace name input field
var span = $('<span />', {'id': 'myusernameedit'}).css({'display' : 'block'});
$("#myusernameedit").parent().append($(span).html(decodeURIComponent(parameters["userName"])));
$("#myusernameedit").remove();
/** Always hide Button for embedLinks (direct Link in Ilias should be used instaed) **/
$(".embed").hide();
/** Hide Settings Button (Settings are made in Ilias with tab settings) **/
$(".settings").hide();
/** Hide export doku wiki (comment this out if this is wanted) **/
$("#exportdokuwikia").hide();
$(".import_export a").removeClass("grouped-left");
$(".showTimeSlider a").removeClass("grouped-middle").addClass("grouped-left");
$("li[data-key='import_export']").after("<li class='separator'></li><li class='separator'></li>");
if(parameters["showStyleBlock"] != "true")
{
$(".bold").hide();
$(".italic").hide();
$(".underline").hide();
$(".strikethrough").hide();
}
if(parameters["showListBlock"] != "true")
{
$(".insertorderedlist").hide();
$(".insertunorderedlist").hide();
$(".indent").hide();
$(".outdent").hide();
}
if(parameters["showRedoBlock"] != "true")
{
$(".undo").hide();
$(".redo").hide();
}
if(parameters["showColorBlock"] != "true")
{
$(".clearauthorship").hide();
}
if(parameters["showHeadingBlock"] != "true")
{
$("#heading-selection").hide();
}
if(parameters["showImportExportBlock"] != "true")
{
$(".import_export").hide();
}
if(parameters["showTimelineBlock"] != "true")
{
$(".showTimeSlider").hide();
$(".savedRevision").hide();
}
/**
* <c.t.>
*/
// TOC on left hand
tableOfContents.enable = function(){
$('#toc').show().css({"width" : "calc(15% - 10px)", "left" : "0"});
$('#editorcontainer').css({"left" : "15%"});
this.update();
}
tableOfContents.disable = function(){
$('#toc').hide();
$('#editorcontainer').css({"left" : "0"});
}
// settings button and popup
$(".settings").show(function(){
// hide line numbers checkbox
$("#options-linenoscheck").parent().hide();
// hide RTL checkbox
$("#options-rtlcheck").parent().hide();
// hide right section (e.g. export)
$("#settings .column").eq(1).hide();
// spread left section
$("#settings .column").eq(0).css({'width' : '100%'});
// scale down popup size
$("#settings.popup").css('maxWidth', '300px');
// hide font selection
$("#settings .column table tr").eq(0).hide();
});
}
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}