forked from jrocho/ILIAS-Etherpad-Lite-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pad.js.sample
114 lines (91 loc) · 3.46 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
/**
* Some Customizations for the pad in ilias
*
* @author Timon Amstutz <timon.amstutz@ilub.unibe.ch>
*
* **/
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");
$( "#myusernameedit" ).prop('readonly', true);
/** 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();
}
}
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;
}