Revision 3705:a37d1b34550a,
1.4 KB
checked in by franck <carnet.franck.paul@…>, 7 years ago
(diff) |
use strict and no more linter warnings/errors
|
Line | |
---|
1 | /*global $ */ |
---|
2 | 'use strict'; |
---|
3 | $(function() { |
---|
4 | $('#link-insert-cancel').click(function() { |
---|
5 | window.close(); |
---|
6 | }); |
---|
7 | |
---|
8 | $('#link-insert-ok').click(function() { |
---|
9 | var insert_form = $('#link-insert-form').get(0); |
---|
10 | if (insert_form == undefined) { |
---|
11 | return; |
---|
12 | } |
---|
13 | |
---|
14 | var editor_name = window.opener.$.getEditorName(), |
---|
15 | editor = window.opener.CKEDITOR.instances[editor_name], |
---|
16 | link = '', |
---|
17 | selected_element; |
---|
18 | if (editor.getSelection().getSelectedElement() != null) { |
---|
19 | selected_element = editor.getSelection().getSelectedElement(); |
---|
20 | } else { |
---|
21 | selected_element = editor.getSelection().getNative().toString(); |
---|
22 | } |
---|
23 | |
---|
24 | if (editor.mode == 'wysiwyg') { |
---|
25 | link = editor.document.createElement('a'); |
---|
26 | link.setAttribute('href', insert_form.elements.href.value); |
---|
27 | if (insert_form.elements.title.value != '') { |
---|
28 | link.setAttribute( |
---|
29 | 'title', |
---|
30 | window.opener.CKEDITOR.tools.htmlEncodeAttr(insert_form.elements.title.value) |
---|
31 | ); |
---|
32 | } |
---|
33 | if (insert_form.elements.hreflang.value != '') { |
---|
34 | link.setAttribute( |
---|
35 | 'hreflang', |
---|
36 | window.opener.CKEDITOR.tools.htmlEncodeAttr(insert_form.elements.hreflang.value) |
---|
37 | ); |
---|
38 | } |
---|
39 | if (editor.getSelection().getSelectedElement() != null) { |
---|
40 | selected_element.appendTo(link); |
---|
41 | } else { |
---|
42 | link.appendText(selected_element); |
---|
43 | } |
---|
44 | editor.insertElement(link); |
---|
45 | } |
---|
46 | window.close(); |
---|
47 | }); |
---|
48 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.