1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
(function ($) {
|
6 |
6fd71452
|
Julien Enselme
|
Drupal.ckeditor_ver = 4;
|
7 |
85ad3d82
|
Assos Assos
|
|
8 |
|
|
$(document).ready(function() {
|
9 |
|
|
if (typeof(CKEDITOR) == "undefined")
|
10 |
|
|
return;
|
11 |
|
|
|
12 |
6fd71452
|
Julien Enselme
|
|
13 |
85ad3d82
|
Assos Assos
|
|
14 |
6fd71452
|
Julien Enselme
|
if (Drupal.settings.ckeditor_version) {
|
15 |
|
|
Drupal.ckeditor_ver = Drupal.settings.ckeditor_version.split('.')[0];
|
16 |
|
|
}
|
17 |
85ad3d82
|
Assos Assos
|
|
18 |
|
|
Drupal.editSkinEditorInit = function() {
|
19 |
|
|
var skinframe_src = $('#skinframe').attr('src');
|
20 |
|
|
|
21 |
|
|
var skin = skinframe_src.match(/skin=([^&]+)/)[1];
|
22 |
|
|
if ($('#edit-uicolor').val() == 'custom') {
|
23 |
|
|
skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor='+$('input[name$="uicolor_user"]').val().replace('#', '') || 'D3D3D3');
|
24 |
|
|
}
|
25 |
|
|
else {
|
26 |
|
|
skinframe_src = skinframe_src.replace(/uicolor=[^&]+/, 'uicolor=D3D3D3');
|
27 |
|
|
}
|
28 |
|
|
$('#skinframe').attr('src', skinframe_src);
|
29 |
|
|
|
30 |
|
|
if (Drupal.ckeditor_ver == 3) {
|
31 |
|
|
if (skin == "kama") {
|
32 |
|
|
$("#edit-uicolor").removeAttr('disabled');
|
33 |
|
|
$("#edit-uicolor").parent().removeClass('form-disabled');
|
34 |
|
|
}
|
35 |
|
|
else {
|
36 |
|
|
$("#edit-uicolor").attr('disabled', 'disabled');
|
37 |
|
|
$("#edit-uicolor").parent().addClass('form-disabled');
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
else {
|
41 |
|
|
$("#edit-uicolor").removeAttr('disabled');
|
42 |
|
|
$("#edit-uicolor").parent().removeClass('form-disabled');
|
43 |
|
|
}
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
Drupal.editSkinEditorInit();
|
47 |
|
|
|
48 |
|
|
$("#edit-uicolor").bind("change", function() {
|
49 |
|
|
Drupal.editSkinEditorInit();
|
50 |
|
|
});
|
51 |
|
|
|
52 |
|
|
$("#input-formats :checkbox").change(function() {
|
53 |
|
|
$('#security-filters .filter-warning').hide();
|
54 |
|
|
$('#security-filters div.filter-text-formats[filter]').html('');
|
55 |
|
|
$('#security-filters ul.text-formats-config').html('');
|
56 |
|
|
$('#input-formats :checked').each(function() {
|
57 |
|
|
var format_name = $(this).val();
|
58 |
|
|
var format_label = $('label[for="' + $(this).attr('id') + '"]').html();
|
59 |
|
|
|
60 |
|
|
if (typeof(Drupal.settings.text_formats_config_links[format_name]) != 'undefined') {
|
61 |
|
|
var text = "<li>" + format_label + " - <a href=\"" + Drupal.settings.text_formats_config_links[format_name].config_url + "\">configure</a></li>";
|
62 |
|
|
var dataSel = $('#security-filters ul.text-formats-config');
|
63 |
|
|
var html = dataSel.html();
|
64 |
|
|
if (html == null || html.length == 0) {
|
65 |
|
|
dataSel.html(text);
|
66 |
|
|
}
|
67 |
|
|
else {
|
68 |
|
|
html += text;
|
69 |
|
|
dataSel.html(html);
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
$('#security-filters div.filter-text-formats[filter]').each(function() {
|
74 |
|
|
var filter_name = $(this).attr('filter');
|
75 |
|
|
var dataSel = $(this);
|
76 |
|
|
var html = dataSel.html();
|
77 |
|
|
var status = "enabled";
|
78 |
|
|
if (typeof Drupal.settings.text_format_filters[format_name][filter_name] == 'undefined') {
|
79 |
|
|
status = "disabled";
|
80 |
|
|
}
|
81 |
|
|
var text = "<span class=\"filter-text-format-status " + status + "\">" + format_label + ': </span><br/>';
|
82 |
|
|
|
83 |
|
|
if (html == null || html.length == 0) {
|
84 |
|
|
dataSel.html(text);
|
85 |
|
|
}
|
86 |
|
|
else {
|
87 |
|
|
html += text;
|
88 |
|
|
dataSel.html(html);
|
89 |
|
|
}
|
90 |
|
|
});
|
91 |
|
|
});
|
92 |
|
|
});
|
93 |
|
|
$("#input-formats :checkbox:eq(0)").trigger('change');
|
94 |
|
|
|
95 |
|
|
$(".cke_load_toolbar").click(function() {
|
96 |
|
|
var buttons = eval('Drupal.settings.'+$(this).attr("id"));
|
97 |
|
|
var text = "[\n";
|
98 |
|
|
for(i in buttons) {
|
99 |
|
|
if (typeof buttons[i] == 'string'){
|
100 |
|
|
text = text + " '/',\n";
|
101 |
|
|
}
|
102 |
|
|
else {
|
103 |
|
|
text = text + " [";
|
104 |
|
|
max = buttons[i].length - 1;
|
105 |
|
|
rows = buttons.length - 1;
|
106 |
|
|
for (j in buttons[i]) {
|
107 |
|
|
if (j < max){
|
108 |
|
|
text = text + "'" + buttons[i][j] + "',";
|
109 |
|
|
} else {
|
110 |
|
|
text = text + "'" + buttons[i][j] + "'";
|
111 |
|
|
}
|
112 |
|
|
}
|
113 |
|
|
if (i < rows){
|
114 |
|
|
text = text + "],\n";
|
115 |
|
|
} else {
|
116 |
|
|
text = text + "]\n";
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
text = text + "]";
|
122 |
|
|
text = text.replace(/\['\/'\]/g,"'/'");
|
123 |
|
|
$("#edit-toolbar").attr('value',text);
|
124 |
|
|
if (Drupal.settings.ckeditor_toolbar_wizard == 't'){
|
125 |
|
|
Drupal.ckeditorToolbarReload();
|
126 |
|
|
}
|
127 |
|
|
return false;
|
128 |
|
|
});
|
129 |
|
|
|
130 |
|
|
if (Drupal.settings.ckeditor_toolbar_wizard == 'f'){
|
131 |
|
|
$("form#ckeditor-admin-profile-form textarea#edit-toolbar, form#ckeditor-admin-profile-form #edit-toolbar + .grippie").show();
|
132 |
|
|
}
|
133 |
|
|
});
|
134 |
6fd71452
|
Julien Enselme
|
})(jQuery); |