1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
(function ($) {
|
3 |
|
|
|
4 |
|
|
Drupal.Sweaver = Drupal.Sweaver || {};
|
5 |
|
|
Drupal.Sweaver.invokes = Drupal.Sweaver.invokes || {};
|
6 |
|
|
|
7 |
|
|
Drupal.Sweaver.messageTimer = null;
|
8 |
|
|
Drupal.Sweaver.changed = false;
|
9 |
|
|
Drupal.Sweaver.popup = '';
|
10 |
|
|
|
11 |
|
|
Drupal.Sweaver.writeCss = function(context) {
|
12 |
|
|
|
13 |
|
|
var fullCss = '';
|
14 |
|
|
$.each(Drupal.Sweaver.invokes, function(func) {
|
15 |
|
|
var css = this.execute();
|
16 |
|
|
if (css != '') {
|
17 |
|
|
fullCss += css;
|
18 |
|
|
}
|
19 |
|
|
});
|
20 |
|
|
$style = $('head style[title="sweaver"]');
|
21 |
|
|
$style.remove();
|
22 |
|
|
$('head').append('<style type="text/css" title="sweaver">' + fullCss + '</style>');
|
23 |
|
|
$('[name=css-rendered]').val(fullCss);
|
24 |
|
|
|
25 |
|
|
Drupal.Sweaver.changed = true;
|
26 |
|
|
};
|
27 |
|
|
|
28 |
|
|
$(document).ready(function() {
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
if ($('#l10n-client').length > 0) {
|
32 |
|
|
$('#sweaver').css({'bottom': $('#l10n-client .labels').height()});
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
Drupal.Sweaver.activeTab = Drupal.Sweaver.cookie('sweaver_active_tab') ? Drupal.Sweaver.cookie('sweaver_active_tab') : $('#sweaver-tabs .tab:first').attr('id');
|
37 |
|
|
$('#' + Drupal.Sweaver.activeTab).addClass('active-tab');
|
38 |
|
|
Drupal.Sweaver.cookie('sweaver_active_tab', Drupal.Sweaver.activeTab);
|
39 |
|
|
Drupal.Sweaver.open = Drupal.Sweaver.cookie('sweaver_open') ? Drupal.Sweaver.cookie('sweaver_open') : 'true';
|
40 |
|
|
Drupal.Sweaver.cookie('sweaver_open', Drupal.Sweaver.open);
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
if (Drupal.Sweaver.open != 'false') {
|
44 |
|
|
$('body').addClass('sweaver');
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$('#sweaver-tabs .close a').click(function(){
|
49 |
|
|
Drupal.Sweaver.toggleBar($(this).parent());
|
50 |
|
|
});
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
Drupal.Sweaver.container = Drupal.Sweaver.activeTab.substr(4, Drupal.Sweaver.activeTab.length - 4);
|
54 |
|
|
$('#sweaver-tabs .tab a').click(function(){
|
55 |
|
|
Drupal.Sweaver.toggleTabs($(this).parent());
|
56 |
|
|
});
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
if ($('[name=sweaver-editor-messages]').val() != '') {
|
60 |
|
|
Drupal.Sweaver.setMessage($('[name=sweaver-editor-messages]').val(), 5000);
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
$('#sweaver .vertical-tabs a').click(function(){
|
65 |
|
|
if (!$(this).hasClass('active')) {
|
66 |
|
|
|
67 |
|
|
$('#sweaver #' + Drupal.Sweaver.container + ' .vertical-tabs .active').removeClass('active');
|
68 |
|
|
$(this).addClass('active');
|
69 |
|
|
var id = $(this).parent().attr('id').replace('tab-', '');
|
70 |
|
|
$('#sweaver #' + Drupal.Sweaver.container + ' .vertical-content #container-' + id).siblings().hide();
|
71 |
|
|
$('#sweaver #' + Drupal.Sweaver.container + ' .vertical-content #container-' + id).show();
|
72 |
|
|
}
|
73 |
|
|
return false;
|
74 |
|
|
});
|
75 |
|
|
|
76 |
|
|
});
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
Drupal.Sweaver.toggleBar = function (tab) {
|
82 |
|
|
if (Drupal.Sweaver.open == 'false') {
|
83 |
|
|
$('#sweaver-middle').css('height', 'auto');
|
84 |
|
|
tab.removeClass('active-tab');
|
85 |
|
|
$('#sweaver-tabs .close').removeClass('active-tab');
|
86 |
|
|
$('#' + Drupal.Sweaver.activeTab).addClass('active-tab');
|
87 |
|
|
Drupal.Sweaver.open = 'true';
|
88 |
|
|
}
|
89 |
|
|
else {
|
90 |
|
|
$('#sweaver-middle').css("height", 0);
|
91 |
|
|
$('#follow-link').hide();
|
92 |
|
|
Drupal.Sweaver.activeTab = $('#sweaver-tabs .active-tab').attr('id');
|
93 |
|
|
tab.addClass('active-tab');
|
94 |
|
|
$('#sweaver-tabs .close').addClass('active-tab');
|
95 |
|
|
Drupal.Sweaver.open = 'false';
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
$('body').toggleClass('sweaver');
|
99 |
|
|
|
100 |
|
|
Drupal.Sweaver.toggleClicked();
|
101 |
|
|
Drupal.Sweaver.cookie('sweaver_open', Drupal.Sweaver.open);
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
Drupal.Sweaver.toggleTabs = function (tab) {
|
108 |
|
|
|
109 |
|
|
var container = tab.attr('id').replace('tab-', '');
|
110 |
|
|
if (container != Drupal.Sweaver.container) {
|
111 |
|
|
|
112 |
|
|
if (Drupal.Sweaver.open == 'false') {
|
113 |
|
|
$('#sweaver-middle').css("height", 'auto');
|
114 |
|
|
Drupal.Sweaver.open = 'true';
|
115 |
|
|
$('body').addClass('sweaver');
|
116 |
|
|
}
|
117 |
|
|
tab.siblings().removeClass('active-tab');
|
118 |
|
|
tab.toggleClass('active-tab');
|
119 |
|
|
$('#'+ container + ' > div').show();
|
120 |
|
|
$('#'+ Drupal.Sweaver.container + ' > div').hide();
|
121 |
|
|
Drupal.Sweaver.container = container;
|
122 |
|
|
}
|
123 |
|
|
else {
|
124 |
|
|
Drupal.Sweaver.toggleBar(tab);
|
125 |
|
|
}
|
126 |
|
|
Drupal.Sweaver.activeTab = tab.attr('id');
|
127 |
|
|
Drupal.Sweaver.cookie('sweaver_open', Drupal.Sweaver.open);
|
128 |
|
|
Drupal.Sweaver.cookie('sweaver_active_tab', Drupal.Sweaver.activeTab);
|
129 |
|
|
Drupal.Sweaver.hidePopup();
|
130 |
|
|
Drupal.Sweaver.toggleClicked();
|
131 |
|
|
};
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
Drupal.Sweaver.toggleClicked = function () {
|
138 |
|
|
if (Drupal.Sweaver.open == 'true' && Drupal.Sweaver.activeTab == 'tab-sweaver_plugin_editor') {
|
139 |
|
|
|
140 |
|
|
$('.sweaver-clicked-temp').removeClass('sweaver-clicked-temp').addClass('sweaver-clicked');
|
141 |
|
|
}
|
142 |
|
|
else {
|
143 |
|
|
|
144 |
|
|
$('.sweaver-clicked').removeClass('sweaver-clicked').addClass('sweaver-clicked-temp');
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
Drupal.Sweaver.switchTab = function (remove_tab, show_tab) {
|
153 |
|
|
var container_remove = remove_tab.replace('tab-', '');
|
154 |
|
|
var container_show = show_tab.replace('tab-', '');
|
155 |
|
|
|
156 |
|
|
$('#'+ remove_tab).removeClass('active-tab');
|
157 |
|
|
$('#'+ show_tab).toggleClass('active-tab');
|
158 |
|
|
$('#'+ container_remove + ' > div').hide();
|
159 |
|
|
$('#'+ container_show + ' > div').show();
|
160 |
|
|
Drupal.Sweaver.container = container_show;
|
161 |
|
|
|
162 |
|
|
Drupal.Sweaver.activeTab = show_tab;
|
163 |
|
|
Drupal.Sweaver.cookie('sweaver_active_tab', show_tab);
|
164 |
|
|
Drupal.Sweaver.hidePopup();
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
Drupal.Sweaver.setMessage = function(message, timeout) {
|
171 |
|
|
Drupal.Sweaver.setMessagePosition();
|
172 |
|
|
$('#sweaver-messages .message').html(message);
|
173 |
|
|
$('#sweaver-messages').fadeIn('fast');
|
174 |
|
|
Drupal.Sweaver.messageTimer = window.setTimeout(function() {$('#sweaver-messages').fadeOut('normal');}, timeout);
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
$('#sweaver-messages .close').click(function(){
|
178 |
|
|
$('#sweaver-messages').hide();
|
179 |
|
|
clearTimeout(Drupal.Sweaver.messageTimer);
|
180 |
|
|
});
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
$(window).resize(function(event){
|
184 |
|
|
Drupal.Sweaver.setMessagePosition();
|
185 |
|
|
});
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
Drupal.Sweaver.setMessagePosition = function(){
|
192 |
|
|
messageTop = $(window).height() - $('#sweaver').outerHeight() - $('#sweaver-messages').outerHeight() - 7;
|
193 |
|
|
$('#sweaver-messages').css({'top' : messageTop});
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
Drupal.Sweaver.showPopup = function(message, width, height) {
|
200 |
|
|
|
201 |
|
|
if (Drupal.Sweaver.popup != '') {
|
202 |
|
|
$(Drupal.Sweaver.popup).hide();
|
203 |
|
|
}
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
popup = $('#sweaver-popup');
|
207 |
|
|
$(message).show();
|
208 |
|
|
Drupal.Sweaver.popup = message;
|
209 |
|
|
Drupal.Sweaver.setPopupSize(popup, width, height);
|
210 |
|
|
popup.fadeIn('fast');
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
$('.close', popup).click(function(){
|
214 |
|
|
$(message).hide();
|
215 |
|
|
Drupal.Sweaver.hidePopup();
|
216 |
|
|
});
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
if (!width && !height) {
|
221 |
|
|
$(window).bind('resize.Drupal.Sweaver', function(event){
|
222 |
|
|
Drupal.Sweaver.setPopupSize(popup);
|
223 |
|
|
});
|
224 |
|
|
}
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
Drupal.Sweaver.setPopupSize = function(popup, width, height) {
|
231 |
|
|
popupBorder = 7;
|
232 |
|
|
|
233 |
|
|
$('.content', popup).css({'overflow-y' : 'hidden'});
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
var popupWidth = width ? width : $(window).width() - (popupBorder * 2) - parseInt(popup.css('padding-left')) - parseInt(popup.css('padding-right'));
|
237 |
|
|
var popupHeight = height ? height : $(window).height() - $('#sweaver').outerHeight() - (popupBorder * 2) - parseInt(popup.css('padding-top')) - parseInt(popup.css('padding-bottom'));
|
238 |
|
|
$('.content', popup).css({'height' : popupHeight, 'width' : popupWidth});
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
var popupLeft = width ? (($(window).width() - parseInt(popupWidth)) / 2) : popupBorder;
|
242 |
|
|
var popupTop = height ? (($(window).height() - parseInt(popupHeight)) / 2) : popupBorder;
|
243 |
|
|
popup.css({'left' : popupLeft + 'px', 'top' : popupTop + 'px'});
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
if (!height) {
|
247 |
|
|
$('.content', popup).css({'overflow-y' : 'scroll'});
|
248 |
|
|
}
|
249 |
|
|
}
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
Drupal.Sweaver.hidePopup = function() {
|
255 |
|
|
$('#sweaver-popup').hide();
|
256 |
|
|
$(window).unbind('resize.Drupal.Sweaver');
|
257 |
|
|
}
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
Drupal.behaviors.sweaverOpenPopup = {
|
263 |
|
|
attach: function (context) {
|
264 |
|
|
$('#sweaver .popup-link a').click(function() {
|
265 |
|
|
var wrapper = $(this).attr('id').replace('link', 'data');
|
266 |
|
|
|
267 |
|
|
popup = $('#sweaver-popup');
|
268 |
|
|
if (popup.is(':visible') && $(this).hasClass('open-tab')) {
|
269 |
|
|
Drupal.Sweaver.hidePopup();
|
270 |
|
|
$(this).removeClass('open-tab');
|
271 |
|
|
}
|
272 |
|
|
else {
|
273 |
|
|
$('#sweaver .open-style-actions').removeClass('open-style-actions');
|
274 |
|
|
$('#sweaver .open-tab').removeClass('open-tab');
|
275 |
|
|
$(this).addClass('open-tab');
|
276 |
|
|
Drupal.Sweaver.showPopup($('#'+ wrapper));
|
277 |
|
|
}
|
278 |
|
|
return false;
|
279 |
|
|
});
|
280 |
|
|
|
281 |
|
|
$('#sweaver .form-submit').click(function() {
|
282 |
|
|
Drupal.Sweaver.hidePopup();
|
283 |
|
|
});
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
$('#sweaver .style-actions-link a').click(function() {
|
287 |
|
|
var wrapper = $(this).attr('id').replace('link', 'data');
|
288 |
|
|
|
289 |
|
|
popup = $('#sweaver-popup');
|
290 |
|
|
if (popup.is(':visible') && $(this).hasClass('open-style-actions')) {
|
291 |
|
|
Drupal.Sweaver.hidePopup();
|
292 |
|
|
$(this).removeClass('open-style-actions');
|
293 |
|
|
}
|
294 |
|
|
else {
|
295 |
|
|
$('#sweaver .open-style-actions').removeClass('open-style-actions');
|
296 |
|
|
$('#sweaver .open-tab').removeClass('open-tab');
|
297 |
|
|
$(this).addClass('open-style-actions');
|
298 |
|
|
Drupal.Sweaver.hidePopup();
|
299 |
|
|
Drupal.Sweaver.showPopup($('#'+ wrapper), '400px', '200px');
|
300 |
|
|
}
|
301 |
|
|
return false;
|
302 |
|
|
});
|
303 |
|
|
}
|
304 |
|
|
};
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
Drupal.Sweaver.cookie = function(name, value, options) {
|
363 |
|
|
if (typeof value != 'undefined') {
|
364 |
|
|
options = options || {};
|
365 |
|
|
if (value === null) {
|
366 |
|
|
value = '';
|
367 |
|
|
options.expires = -1;
|
368 |
|
|
}
|
369 |
|
|
var expires = '';
|
370 |
|
|
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
371 |
|
|
var date;
|
372 |
|
|
if (typeof options.expires == 'number') {
|
373 |
|
|
date = new Date();
|
374 |
|
|
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
375 |
|
|
}
|
376 |
|
|
else {
|
377 |
|
|
date = options.expires;
|
378 |
|
|
}
|
379 |
|
|
expires = '; expires=' + date.toUTCString();
|
380 |
|
|
}
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
var path = options.path ? '; path=' + (options.path) : '; path=/';
|
385 |
|
|
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
386 |
|
|
var secure = options.secure ? '; secure' : '';
|
387 |
|
|
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
388 |
|
|
}
|
389 |
|
|
else {
|
390 |
|
|
var cookieValue = null;
|
391 |
|
|
if (document.cookie && document.cookie != '') {
|
392 |
|
|
var cookies = document.cookie.split(';');
|
393 |
|
|
for (var i = 0; i < cookies.length; i++) {
|
394 |
|
|
var cookie = jQuery.trim(cookies[i]);
|
395 |
|
|
|
396 |
|
|
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
397 |
|
|
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
398 |
|
|
break;
|
399 |
|
|
}
|
400 |
|
|
}
|
401 |
|
|
}
|
402 |
|
|
return cookieValue;
|
403 |
|
|
}
|
404 |
|
|
};
|
405 |
|
|
|
406 |
|
|
})(jQuery); |