1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
(function ($) {
|
10 |
|
|
|
11 |
|
|
Drupal.Sweaver = Drupal.Sweaver || {};
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
$(document).ready(function() {
|
17 |
|
|
Drupal.Sweaver.writeModifications();
|
18 |
|
|
|
19 |
|
|
$('#tab-sweaver_plugin_advanced').click(function(){
|
20 |
|
|
Drupal.Sweaver.writeModifications();
|
21 |
|
|
});
|
22 |
|
|
|
23 |
|
|
});
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
Drupal.Sweaver.reloadInterface = function() {
|
29 |
|
|
Drupal.Sweaver.writeCss();
|
30 |
|
|
Drupal.Sweaver.updateForm();
|
31 |
|
|
Drupal.Sweaver.writeModifications();
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
Drupal.Sweaver.writeModifications = function() {
|
38 |
|
|
var data = '';
|
39 |
|
|
var key_id = 0;
|
40 |
|
|
var properties_counted = 0;
|
41 |
|
|
var hidden_properties_counted = 0;
|
42 |
|
|
|
43 |
|
|
data += '<table>';
|
44 |
|
|
for (key in Drupal.Sweaver.css) {
|
45 |
|
|
key_id++;
|
46 |
|
|
var target = Drupal.Sweaver.css[key];
|
47 |
|
|
var temp_data = '';
|
48 |
|
|
var sub_properties_counted = 0;
|
49 |
|
|
var sub_hidden_properties_counted = 0;
|
50 |
|
|
|
51 |
|
|
for (prop in target) {
|
52 |
|
|
properties_counted++;
|
53 |
|
|
sub_properties_counted++;
|
54 |
|
|
|
55 |
|
|
if (Drupal.Sweaver.properties[prop] && (target[prop]['value'] != '' || target[prop]['value'] == '0')) {
|
56 |
|
|
if (target[prop]['hidden'] == true){
|
57 |
|
|
temp_data += '<tr class="hidden" onclick="Drupal.Sweaver.showKey(' + key_id +')">';
|
58 |
|
|
}
|
59 |
|
|
else {
|
60 |
|
|
temp_data += '<tr onclick="Drupal.Sweaver.showKey(' + key_id +')">';
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
if ((prop == 'background-color' && target[prop]['value'] == 'transparent') || (prop == 'background-image' && target[prop]['value'] == 'none')) {
|
65 |
|
|
temp_data += '<td class="property">' + prop + ' : ' + target[prop]['value'] + '</td>';
|
66 |
|
|
}
|
67 |
|
|
else {
|
68 |
|
|
temp_data += '<td class="property">' + prop + ' : ' + Drupal.Sweaver.properties[prop].prefix + target[prop]['value'] + Drupal.Sweaver.properties[prop].suffix + '</td>';
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
if (target[prop]['hidden'] == true){
|
72 |
|
|
var hide_class = 'disabled';
|
73 |
|
|
var show_class = '';
|
74 |
|
|
hidden_properties_counted++;
|
75 |
|
|
sub_hidden_properties_counted++;
|
76 |
|
|
}
|
77 |
|
|
else {
|
78 |
|
|
var hide_class = '';
|
79 |
|
|
var show_class = 'disabled';
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
temp_data += '<td class="operations">';
|
83 |
|
|
temp_data += '<span class="delete" onclick="Drupal.Sweaver.deleteProperty(\'' + key + '\', \'' + prop + '\'); Drupal.Sweaver.writeModifications();">' + 'Delete' + '</span>';
|
84 |
|
|
temp_data += '<span class="hide ' + hide_class + '" onclick="Drupal.Sweaver.propertyHider(\'' + key + '\', \'' + prop + '\');">Hide</span>';
|
85 |
|
|
temp_data += '<span class="show ' + show_class + '" onclick="Drupal.Sweaver.propertyHider(\'' + key + '\', \'' + prop + '\');">Show</span>';
|
86 |
|
|
temp_data += '</td></tr>';
|
87 |
|
|
}
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
if (sub_properties_counted == sub_hidden_properties_counted) {
|
91 |
|
|
var hide_class = 'disabled';
|
92 |
|
|
var show_class = '';
|
93 |
|
|
}
|
94 |
|
|
else if (sub_hidden_properties_counted == 0) {
|
95 |
|
|
var hide_class = '';
|
96 |
|
|
var show_class = 'disabled';
|
97 |
|
|
}
|
98 |
|
|
else {
|
99 |
|
|
var hide_class = '';
|
100 |
|
|
var show_class = '';
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
data += '<tr class="separator" onclick="Drupal.Sweaver.showKey(' + key_id +')"><th>' + key + '</th><td class="operations">';
|
104 |
|
|
data += '<span class="title delete" onclick="Drupal.Sweaver.deleteKeyProperties(\'' + key + '\');">Delete</span>';
|
105 |
|
|
data += '<span class="title hide ' + hide_class + '" onclick="Drupal.Sweaver.keyPropertiesHider(\'' + key + '\', true);">Hide</span>';
|
106 |
|
|
data += '<span class="title show ' + show_class + '" onclick="Drupal.Sweaver.keyPropertiesHider(\'' + key + '\', false);">Show</span>';
|
107 |
|
|
data += '</td></tr>';
|
108 |
|
|
data += temp_data;
|
109 |
|
|
}
|
110 |
|
|
data += '</table>';
|
111 |
|
|
$('#watchdog #scrollable_area').html(data);
|
112 |
|
|
|
113 |
|
|
if (properties_counted == hidden_properties_counted) {
|
114 |
|
|
$('#watchdog .header .operations .hide').addClass('disabled');
|
115 |
|
|
$('#watchdog .header .operations .show').removeClass('disabled');
|
116 |
|
|
}
|
117 |
|
|
else if (hidden_properties_counted == 0) {
|
118 |
|
|
$('#watchdog .header .operations .hide').removeClass('disabled');
|
119 |
|
|
$('#watchdog .header .operations .show').addClass('disabled');
|
120 |
|
|
}
|
121 |
|
|
else {
|
122 |
|
|
$('#watchdog .header .operations .hide').removeClass('disabled');
|
123 |
|
|
$('#watchdog .header .operations .show').removeClass('disabled');
|
124 |
|
|
}
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
Drupal.Sweaver.showKey = function (key_id) {
|
132 |
|
|
var counter = 0;
|
133 |
|
|
for (key in Drupal.Sweaver.css) {
|
134 |
|
|
counter++;
|
135 |
|
|
if (counter == key_id) {
|
136 |
|
|
$('.sweaver-clicked').removeClass('sweaver-clicked');
|
137 |
|
|
$(key).addClass('sweaver-clicked');
|
138 |
|
|
}
|
139 |
|
|
}
|
140 |
|
|
$('#watchdog tr').removeClass('active');
|
141 |
|
|
$('#watchdog tr[onclick=Drupal.Sweaver.showKey(' + key_id + ')]').addClass('active');
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
Drupal.Sweaver.deleteKeyProperties = function(key) {
|
148 |
|
|
delete Drupal.Sweaver.css[key];
|
149 |
|
|
|
150 |
|
|
Drupal.Sweaver.reloadInterface();
|
151 |
|
|
}
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
Drupal.Sweaver.deleteAllProperties = function() {
|
157 |
|
|
Drupal.Sweaver.css = new Object();
|
158 |
|
|
|
159 |
|
|
Drupal.Sweaver.reloadInterface();
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
Drupal.Sweaver.propertyHider = function(key, property) {
|
168 |
|
|
var target = Drupal.Sweaver.css[key];
|
169 |
|
|
for (prop in target) {
|
170 |
|
|
if (prop == property) {
|
171 |
|
|
Drupal.Sweaver.css[key][property]['hidden'] = !Drupal.Sweaver.css[key][property]['hidden'];
|
172 |
|
|
|
173 |
|
|
Drupal.Sweaver.reloadInterface();
|
174 |
|
|
}
|
175 |
|
|
}
|
176 |
|
|
}
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
Drupal.Sweaver.keyPropertiesHider = function(key, hide) {
|
182 |
|
|
var target = Drupal.Sweaver.css[key];
|
183 |
|
|
for (prop in target) {
|
184 |
|
|
Drupal.Sweaver.css[key][prop]['hidden'] = hide;
|
185 |
|
|
}
|
186 |
|
|
|
187 |
|
|
Drupal.Sweaver.reloadInterface();
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
Drupal.Sweaver.cssHider = function(hide) {
|
194 |
|
|
for (key in Drupal.Sweaver.css) {
|
195 |
|
|
var target = Drupal.Sweaver.css[key];
|
196 |
|
|
for (prop in target) {
|
197 |
|
|
Drupal.Sweaver.css[key][prop]['hidden'] = hide;
|
198 |
|
|
}
|
199 |
|
|
}
|
200 |
|
|
Drupal.Sweaver.reloadInterface();
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
})(jQuery); |