1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
(function ($) {
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
$(document).ready(function() {
|
13 |
|
|
var span = 0;
|
14 |
|
|
if (Drupal.settings.sweaver['autosave'] != undefined) {
|
15 |
|
|
var interval = Drupal.settings.sweaver['autosave'];
|
16 |
|
|
if (parseInt(interval) > 0) {
|
17 |
|
|
var interval = (interval * 1000) + span;
|
18 |
|
|
var autosave = setInterval('Drupal.Sweaver.AutoSave()', interval);
|
19 |
|
|
span += 100;
|
20 |
|
|
}
|
21 |
|
|
}
|
22 |
|
|
});
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
$(window).unload(function() {
|
28 |
|
|
Drupal.Sweaver.AutoSave();
|
29 |
|
|
});
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
Drupal.Sweaver.AutoSave = function(context) {
|
35 |
|
|
if (Drupal.Sweaver.changed) {
|
36 |
|
|
Drupal.Sweaver.changed = false;
|
37 |
|
|
|
38 |
|
|
var ajax_data = {};
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
if ($('[name=sweaver-css]').length) {
|
42 |
|
|
ajax_data.css = $('[name=sweaver-css]').val();
|
43 |
|
|
}
|
44 |
|
|
if ($('#edit-sweaver-plugin-custom-css').length) {
|
45 |
|
|
ajax_data.customcss = $('#edit-sweaver-plugin-custom-css').val();
|
46 |
|
|
}
|
47 |
|
|
if ($('[name=sweaver-plugin-palette]').length) {
|
48 |
|
|
ajax_data.palette = $('[name=sweaver-plugin-palette]').val();
|
49 |
|
|
}
|
50 |
|
|
var managed_file_fid = 0;
|
51 |
|
|
$('#sweaver input[type=hidden][name$="[fid]"]').each(function(){
|
52 |
|
|
if ($(this).val() != 0){
|
53 |
|
|
ajax_data.managed_file_fid = $(this).val();
|
54 |
|
|
}
|
55 |
|
|
});
|
56 |
|
|
|
57 |
|
|
$.ajax({
|
58 |
|
|
type: "POST",
|
59 |
|
|
url: Drupal.settings.basePath + 'index.php?q=sweaver-autosave',
|
60 |
|
|
data: ajax_data,
|
61 |
|
|
dataType: 'json',
|
62 |
|
|
timeout: 5000,
|
63 |
|
|
success: function(data){
|
64 |
|
|
if (typeof data['message'] == 'undefined' || data['message'] != 0) {
|
65 |
|
|
Drupal.Sweaver.setMessage(Drupal.t('Your changes have been saved.'), 2000);
|
66 |
|
|
}
|
67 |
|
|
if (typeof data['error'] == 'undefined' || data['error'] != 0) {
|
68 |
|
|
Drupal.Sweaver.setMessage(Drupal.t('Your changes have been saved.'), 2000);
|
69 |
|
|
}
|
70 |
|
|
},
|
71 |
|
|
error: function() {
|
72 |
|
|
Drupal.Sweaver.setMessage(Drupal.t('There was an error saving current changes!'), 2000);
|
73 |
|
|
}
|
74 |
|
|
});
|
75 |
|
|
return false;
|
76 |
|
|
}
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
Drupal.behaviors.StylesActions = {
|
83 |
|
|
attach: function(context) {
|
84 |
|
|
$("#style-actions-data-1 select.radio-style-save-type").change(function() {
|
85 |
|
|
var radio_style_save_type = $("#style-actions-data-1 select.radio-style-save-type option:selected").val();
|
86 |
|
|
if (radio_style_save_type == 1) {
|
87 |
|
|
$('#edit-save-style').hide();
|
88 |
|
|
$('#edit-style-existing-id').show();
|
89 |
|
|
}
|
90 |
|
|
else {
|
91 |
|
|
$('#edit-save-style').show();
|
92 |
|
|
$('#edit-style-existing-id').hide();
|
93 |
|
|
}
|
94 |
|
|
});
|
95 |
|
|
|
96 |
|
|
$("#sweaver-popup #edit-delete-confirm").click(function() {
|
97 |
|
|
$('#sweaver-popup .delete-style-confirm').hide();
|
98 |
|
|
$('#sweaver-popup .delete-style-question').show();
|
99 |
|
|
return false;
|
100 |
|
|
});
|
101 |
|
|
|
102 |
|
|
$("#sweaver-popup #edit-delete-cancel").click(function() {
|
103 |
|
|
$('#sweaver-popup .delete-style-confirm').show();
|
104 |
|
|
$('#sweaver-popup .delete-style-question').hide();
|
105 |
|
|
return false;
|
106 |
|
|
});
|
107 |
|
|
}
|
108 |
|
|
};
|
109 |
|
|
|
110 |
|
|
})(jQuery); |