Lines Matching refs:ep
1 var ep = { }; variable
3 ep.imgBase = null;
4 ep.config = etherpad_lite_config;
5 ep.aceWasEnabled = false;
6 ep.cmWasEnabled = false;
7 ep.isOwner = false;
8 ep.readOnly = false;
9 ep.isSaveable = false;
10 ep.timer = null;
11 ep.lang = null;
12 ep.password = "";
13 ep.opened = false;
14 ep.hasPadPlugin = false;
16 ep.on_disable = function() {
17 if (ep.isOwner) {
20 …{ 'id' : ep.config["id"], "rev" : ep.config["rev"], "call" : "pad_getText", "isSaveable" : ep.isSa…
35 if (!ep.isSaveable) { // fix toolbar
39 ep.opened = false;
40 ep.on_disable_close();
53 if (!ep.isSaveable) { // fix toolbar
57 ep.opened = false;
58 if (ep.aceWasEnabled) {
59 ep.aceShow();
61 if (ep.cmWasEnabled) {
62 ep.cmShow();
67 ep.on_disable_close = function() {
68 window.clearInterval(ep.timer); ep.timer = null;
71 { "id" : ep.config["id"], "rev" : ep.config["rev"], "call" : "pad_close",
76 "isSaveable" : ep.isSaveable,
85 if (ep.aceWasEnabled) {
86 ep.aceShow();
88 if (ep.cmWasEnabled) {
89 ep.cmShow();
96 ep.on_password_cancel = function(event) {
97 ep.pwdlg.dlg.dialog('close');
101 ep.on_password_submit = function() {
102 ep.password = ep.pwdlg.inp.val();
103 ep.pwdlg.dlg.dialog('close');
104 ep.on_re_enable(true);
107 ep.on_password_click = function() {
108 if (!ep.readOnly) {
109 alert(ep.lang.alreadywriteable);
111 ep.on_password();
116 ep.on_password = function() {
117 ep.pwdlg.inp.val(ep.password);
118 ep.pwdlg.dlg.dialog('open');
121 ep.init_password = function() {
122 ep.pwdlg = {};
123 ep.pwdlg.dlg = jQuery('<div/>').attr('title',ep.lang.password);
124 …ep.pwdlg.frm = jQuery('<form/>').addClass('pad-form').submit(ep.on_password_submit).appendTo(ep.pw…
125 jQuery('<label/>').attr('for','password').text(ep.lang.passwordforpad).appendTo(ep.pwdlg.frm);
126 …ep.pwdlg.inp = jQuery('<input/>').attr('name','password').attr('type','password').appendTo(ep.pwdl…
127 …jQuery('<input/>').attr('type','submit').val(ep.lang.submit).click(ep.on_password_submit).appendTo…
128 …jQuery('<input/>').attr('type','reset').val(ep.lang.reset).click(ep.on_password_cancel).appendTo(e…
129 ep.pwdlg.dlg.dialog({modal: true, width: 500,height:150, autoOpen: false});
132 ep.init_security = function() {
133 ep.dlg = {};
134 ep.dlg.dlg = jQuery('<div/>').attr('title',ep.lang.securitymanager);
135 …ep.dlg.frm = jQuery('<form/>').addClass('pad-form').submit(ep.on_security_submit).appendTo(ep.dlg.…
136 var encLabel = jQuery('<label/>').attr('for','encMode').text(ep.lang.encryption+':');
137 …ep.dlg.encMode = jQuery('<select/>').attr('name','encMode').attr('size',1).change(ep.on_security_e…
138 ep.dlg.encMode.append(jQuery('<option/>').val('enc').text(ep.lang.padIsEncrypted));
139 ep.dlg.encMode.append(jQuery('<option/>').val('noenc').text(ep.lang.padIsUnencrypted));
140 ep.dlg.encPassword = jQuery('<span/>').show();
141 var encALabel = jQuery('<label/>').attr('for','encAccessMode').text(ep.lang.accessRequires+':');
142 ep.dlg.encAMode = jQuery('<select/>').attr('name','encAccessMode').attr('size',1);
143 ep.dlg.encAMode.append(jQuery('<option/>').val('wikiread').text(ep.lang.permToReadWiki));
144 ep.dlg.encAMode.append(jQuery('<option/>').val('wikiwrite').text(ep.lang.permToWriteWiki));
145 jQuery('<label/>').attr('for','encpw').text(ep.lang.password+':').appendTo(ep.dlg.encPassword);
146 …ep.dlg.encPasswordFrm = jQuery('<input/>').attr('name','encpw').attr('type','password').appendTo(e…
148 var readLabel = jQuery('<label/>').attr('for','readMode').text(ep.lang.readAccessRequires+':');
149 …ep.dlg.readMode = jQuery('<select/>').attr('name','readMode').attr('size',1).change(ep.on_security…
150 ep.dlg.readMode.append(jQuery('<option/>').val('wikiread').text(ep.lang.permToReadWiki));
151 …ep.dlg.readMode.append(jQuery('<option/>').val('wikiread+password').text(ep.lang.permToReadWikiPlu…
152 ep.dlg.readMode.append(jQuery('<option/>').val('wikiwrite').text(ep.lang.permToWriteWiki));
153 …ep.dlg.readMode.append(jQuery('<option/>').val('wikiwrite+password').text(ep.lang.permToWriteWikiP…
154 ep.dlg.readPassword = jQuery('<span/>').hide();
155 …jQuery('<label/>').attr('for','readpw').text(ep.lang.readPassword+':').appendTo(ep.dlg.readPasswor…
156 …ep.dlg.readPasswordFrm = jQuery('<input/>').attr('name','readpw').attr('type','password').appendTo…
158 var writeLabel = jQuery('<label/>').attr('for','writeMode').text(ep.lang.writeAccessRequires+':');
159 …ep.dlg.writeMode = jQuery('<select/>').attr('name','writeMode').attr('size',1).change(ep.on_securi…
160 ep.dlg.writeMode.append(jQuery('<option/>').val('wikiwrite').text(ep.lang.permToWriteWiki));
161 …ep.dlg.writeMode.append(jQuery('<option/>').val('wikiwrite+password').text(ep.lang.permToWriteWiki…
162 ep.dlg.writePassword = jQuery('<span/>').hide();
163 …jQuery('<label/>').attr('for','writepw').text(ep.lang.writePassword+':').appendTo(ep.dlg.writePass…
164 …ep.dlg.writePasswordFrm = jQuery('<input/>').attr('name','writepw').attr('type','password').append…
166 ep.dlg.frm.append(encLabel).append(ep.dlg.encMode);
167 ep.dlg.enc = jQuery('<span/>').show();
168 ep.dlg.enc.append(encALabel).append(ep.dlg.encAMode).append(ep.dlg.encPassword);
169 ep.dlg.frm.append(ep.dlg.enc);
170 ep.dlg.noEnc = jQuery('<span/>').hide();
171 ep.dlg.noEnc.append(readLabel).append(ep.dlg.readMode).append(ep.dlg.readPassword);
172 ep.dlg.noEnc.append(writeLabel).append(ep.dlg.writeMode).append(ep.dlg.writePassword);
173 ep.dlg.frm.append(ep.dlg.noEnc);
175 …jQuery('<input/>').attr('type','submit').val(ep.lang.submit).click(ep.on_security_submit).appendTo…
176 …jQuery('<input/>').attr('type','reset').val(ep.lang.reset).click(ep.on_security_cancel).appendTo(e…
178 ep.dlg.encMode.val('noenc');
179 ep.dlg.encAMode.val('wikiwrite');
180 ep.dlg.readMode.val('wikiwrite');
181 ep.dlg.writeMode.val('wikiwrite');
182 ep.dlg.encPasswordFrm.val('');
183 ep.dlg.readPasswordFrm.val('');
184 ep.dlg.writePasswordFrm.val('');
186 ep.dlg.dlg.dialog({modal: true, width: 600,height:300, autoOpen: false});
189 ep.on_security = function() {
190 ep.dlg.dlg.dialog('open');
194 ep.on_security_submit = function() {
197 { 'id' : ep.config["id"], "rev" : ep.config["rev"], "call" : "pad_security",
199 "encMode" : ep.dlg.encMode.val(),
200 "encAMode" : ep.dlg.encAMode.val(),
201 "readMode" : ep.dlg.readMode.val(),
202 "writeMode" : ep.dlg.writeMode.val(),
203 "encpw" : ep.dlg.encPasswordFrm.val(),
204 "readpw" : ep.dlg.readPasswordFrm.val(),
205 "writepw" : ep.dlg.writePasswordFrm.val(),
206 "isSaveable" : ep.isSaveable,
213 ep.security_fill(data);
214 ep.dlg.dlg.dialog('close');
222 ep.security_fill = function(data) {
229 ep.dlg.encMode.val(data.encMode);
230 ep.dlg.encAMode.val(data.encAMode);
231 ep.dlg.readMode.val(data.readMode);
232 ep.dlg.writeMode.val(data.writeMode);
234 ep.dlg.encPasswordFrm.val('');
236 ep.dlg.encPasswordFrm.val('***');
238 ep.dlg.readPasswordFrm.val(data.readpw);
239 ep.dlg.writePasswordFrm.val(data.writepw);
240 ep.readOnly = data.isReadonly;
242 ep.on_security_encmode_changed();
243 ep.on_security_readmode_changed();
244 ep.on_security_writemode_changed();
247 jQuery(".pad-security").attr("src",ep.imgBase+"lock.png");
248 } else if (ep.dlg.writePasswordFrm.val() != "") {
249 jQuery(".pad-security").attr("src",ep.imgBase+"lock2.png");
250 } else if (ep.dlg.readPasswordFrm.val() != "") {
251 jQuery(".pad-security").attr("src",ep.imgBase+"lock1.png");
253 jQuery(".pad-security").attr("src",ep.imgBase+"nolock.png");
255 if (ep.readOnly) {
256 jQuery(".pad-saveable").attr("src",ep.imgBase+"no-saveable.png");
258 jQuery(".pad-saveable").attr("src",ep.imgBase+"saveable.png");
263 ep.refresh = function() {
266 …{ 'id' : ep.config["id"], "rev" : ep.config["rev"], "call" : "pad_getText", "isSaveable" : ep.isSa…
280 ep.on_security_encmode_changed = function() {
281 if (ep.dlg.encMode.val() == "enc") {
282 ep.dlg.enc.show();
283 ep.dlg.noEnc.hide();
285 ep.dlg.enc.hide();
286 ep.dlg.noEnc.show();
290 ep.on_security_writemode_changed = function() {
291 if(ep.dlg.writeMode.val().indexOf('password') == -1) {
292 ep.dlg.writePassword.hide();
294 ep.dlg.writePassword.show();
298 ep.on_security_readmode_changed = function() {
299 if(ep.dlg.readMode.val().indexOf('password') == -1) {
300 ep.dlg.readPassword.hide();
302 ep.dlg.readPassword.show();
306 ep.on_enable_password = function(txt) {
308 ep.on_password();
311 ep.on_enable = function() {
312 return ep.on_re_enable(false);
315 ep.aceShow = function() {
319 ep.aceHide = function() {
323 ep.aceIsEnabled = function() {
327 ep.cmShow = function() {
333 ep.cmHide = function() {
339 ep.cmIsEnabled = function() {
344 ep.on_re_enable = function(reopen) {
347 ep.aceWasEnabled = ep.aceIsEnabled();
348 ep.cmWasEnabled = ep.cmIsEnabled();
350 ep.aceHide();
351 ep.cmHide();
353 self.setTimeout(ep.on_re_enable_cont, 500);
356 ep.on_re_enable_cont = function() {
358 if (ep.isSaveable) {
364 { 'id' : ep.config["id"], "rev" : ep.config["rev"], "call" : "pad_open", "text" : text,
366 "isSaveable" : ep.isSaveable, "accessPassword" : ep.password },
370 ep.on_enable_password(data.error);
375 ep.isOwner = data.isOwner;
376 ep.opened = true;
380 var htext = (ep.isOwner ? ep.lang.padowner : ep.lang.padnoowner);
381 htext = htext.replace(/%s/, ep.config["id"]);
382 htext = htext.replace(/%d/, ep.config["rev"]);
399 if (!ep.isSaveable) { // fix toolbar
403 ep.security_fill(data);
404 if (ep.isOwner) {
405 ep.timer = window.setInterval(ep.refresh, 5 * 60 * 1000);
412 ep.sendMessage = function(func, data) {
413 if (ep.hasPadPlugin) {
419 alert(ep.lang.missingPlugin);
423 ep.proxyGetSelection = function(textArea) {
424 if (ep.opened) {
425 alert(ep.lang.noGetSelection);
427 return ep.getSelection.apply(self, [textArea]);
431 ep.proxySetSelection = function(selection) {
432 if (ep.opened) {
433 alert(ep.lang.noSetSelection);
435 return ep.setSelection.apply(self, [selection]);
439 ep.proxyDWgetSelection = function(textArea) {
440 if (ep.opened) {
441 alert(ep.lang.noGetSelection);
443 return ep.DWgetSelection(textArea);
447 ep.proxyDWsetSelection = function(selection) {
448 if (ep.opened) {
449 alert(ep.lang.noSetSelection);
451 return ep.DWsetSelection(selection);
455 ep.proxyPasteText = function (selection,text,opts) {
458 if (ep.opened) {
459 alert(ep.lang.noPasteText);
461 return ep.pasteText.apply(self,[selection,text,opts]);
465 ep.proxyInsertTags = function(textAreaID, tagOpen, tagClose, sampleText) {
466 if (ep.opened) {
467 …ep.sendMessage('insertTags', {'tagOpen': tagOpen, 'tagClose' : tagClose, 'sampleText' : sampleText…
469 return ep.insertTags.apply(this, [textAreaID, tagOpen, tagClose, sampleText]);
473 ep.proxyInsertAtCarret = function(textAreaID, text) {
474 if (ep.opened) {
475 ep.sendMessage('insert', {'text': text});
477 return ep.insertAtCarret.apply(self, [textAreaID, text]);
482 ep.proxyTbFormatLn = function(btn, props, edid) {
483 if (ep.opened) {
490 …ep.sendMessage('insertTagsLn', {'tagOpen': props.open, 'tagClose' : props.close, 'sampleText' : sa…
495 return ep.tb_formatln.apply(self, [btn, props, edid]);
500 ep.proxyInsertLink = function(title) {
501 if (ep.opened) {
510 …ep.sendMessage('insertTags', {'tagOpen': '[['+link+'|', 'tagClose' : ']]', 'sampleText' : title, '…
514 return ep.insertLink(title);
518 ep.onSave = function(event) {
521 if (ep.opened) {
523 ep.on_disable(event);
531 ep.onPreview = function(event) {
534 if (ep.opened) {
535 alert(ep.lang.noPreview);
542 ep.onCancel = function(event) {
545 if (ep.opened) {
547 ep.on_disable(event);
557 ep.initialize = function() {
558 ep.lang = LANG.plugins.etherpadlite;
559 ep.imgBase = ep.config["base"] + "/img/";
560 ep.isSaveable = (ep.config["act"] != "locked");
564 …("pad-toggle pad-toggle-off").attr("src",ep.imgBase+"toggle_off.png").insertAfter(jQuery("#size__c…
565 …s("pad-toggle pad-toggle-on").attr("src",ep.imgBase+"toggle_on.png").insertAfter(jQuery("#size__ct…
566 …jQuery("#edbtn__save").clone().attr('id','edbtn__save2').insertAfter('#edbtn__save').click(ep.onSa…
570 …_preview").clone().attr('id','edbtn__preview2').insertAfter('#edbtn__preview').click(ep.onPreview);
575 …btn__cancel').clone().attr('id','edbtn__cancel2').insertAfter('#edbtn__cancel').click(ep.onCancel);
584 …("<img/>").addClass("pad-close").attr("src",ep.imgBase+"close.png").appendTo(jQuery(".pad-toolbar"…
585 …mg/>").addClass("pad-security").attr("src",ep.imgBase+"nolock.png").appendTo(jQuery(".pad-toolbar"…
586 …/>").addClass("pad-saveable").attr("src",ep.imgBase+"no-saveable.png").appendTo(jQuery(".pad-toolb…
588 ep.init_security();
589 ep.init_password();
591 if (ep.config["rev"] !== false && ep.config["rev"] > 0) {
594 { 'id' : ep.config["id"], "rev" : ep.config["rev"], "call" : "has_pad",
595 "isSaveable" : ep.isSaveable, "accessPassword" : ep.password },
601 ep.on_enable();
608 ep.iframeinsertReceiveMessage = function(event) {
614 ep.hasPadPlugin = true;
615 if (ep.opened) {
627 ep.setSelection = self.setSelection;
628 ep.getSelection = self.getSelection;
629 ep.DWsetSelection = self.DWsetSelection;
630 ep.DWgetSelection = self.DWgetSelection;
631 ep.pasteText = self.pasteText;
632 ep.insertTags = self.insertTags;
633 ep.insertAtCarret = self.insertAtCarret;
634 ep.tb_formatln = self.tb_formatln;
635 ep.insertLink = dw_linkwiz.insertLink;
637 self.getSelection = ep.proxyGetSelection;
638 self.setSelection = ep.proxySetSelection;
639 self.DWgetSelection = ep.proxyDWgetSelection;
640 self.DWsetSelection = ep.proxyDWsetSelection;
641 self.pasteText = ep.proxyPasteText;
642 self.insertTags = ep.proxyInsertTags;
643 self.insertAtCarret = ep.proxyInsertAtCarret;
644 self.tb_formatln = ep.proxyTbFormatLn;
645 dw_linkwiz.insertLink = ep.proxyInsertLink;
647 self.setTimeout(ep.initialize, 500);
649 window.addEventListener("message", ep.iframeinsertReceiveMessage, false);