1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
// onLoad -> themes_init
function themes_init() {
$("#edit_theme_css.as_link").live('click', function(event) {
window.location = 'index.php?anketa='+srv_meta_anketa_id+'&a=edit_css';
});
$("#theme_progressbar input:radio").live('change', function(event) {
var progressbar = $(this).val();
$.post("ajax.php?t=theme&a=changeProgressbar", {anketa:srv_meta_anketa_id, progressbar:progressbar}, function() {});
});
$("a.theme_links_preview").live('click', function(event) {
event.preventDefault();
event.stopPropagation();
window.open($(this).attr('src')+'&size=full', '_blank');
});
$("a.theme_delete.theme").live('click', function(event) {
event.preventDefault();
event.stopPropagation();
if (confirm(lang['srv_ask_delete'])) {
var css = $(this).attr('css');
$.post('ajax.php?t=theme&a=theme_delete', {anketa:srv_meta_anketa_id, css:css}, function () {
window.location.reload();
});
}
});
/*$("#div_theme_group span.theme_links_rename").live('click', function(event) {
var theme = $(this).attr('theme');
$('#fade').fadeTo('slow', 1);
$('#fullscreen').html('').fadeIn('slow');
$("#fullscreen").load('ajax.php?t=theme&a=theme_rename', {anketa:srv_meta_anketa_id, theme:theme});
});*/
$("#theme_rename_confirm").live('click', function(event) {
var theme_new_name = $("#theme_new_name").val();
var theme = $("#theme").val();
$.post('ajax.php?t=theme&a=theme_rename_confirm', {anketa:srv_meta_anketa_id, theme:theme, theme_new_name:theme_new_name}, function(data) {
data = jQuery.parseJSON(data);
if (data.error == "0") {
var gid = $("#sel_theme_group").val();
$("#div_theme_group_holder").load("ajax.php?t=theme&a=changeGroup", {anketa:srv_meta_anketa_id, gid:gid}, function() {
// popravimo ime teme:
$("#div_theme_groups span.theme_header strong").html(data.theme_new_name);
$('#fade').fadeOut('slow');
$('#fullscreen').fadeOut('slow').html('');
return false;
});
return false;
} else {
$("#fullscreen").load('ajax.php?t=theme&a=theme_rename', {anketa:srv_meta_anketa_id, theme:data.theme, theme_new_name:data.theme_new_name, msg:data.msg});
}
});
return false;
});
$("#theme_rename_cancle").live('click', function(event) {
$('#fade').fadeOut('slow');
$('#fullscreen').fadeOut('slow').html('');
return false;
});
// change theme
$("#div_theme_group img.theme").live('click', function(event) {
event.preventDefault();
event.stopPropagation();
var css = $(this).attr('css');
var gid = $(this).attr('gid');
$.post("ajax.php?t=theme&a=changeTheme", {anketa:srv_meta_anketa_id, gid:gid,css:css}, function(data) {
$("#div_theme_group_holder").html(data.group_themes);
$('#div_theme_groups').html(data.theme_name);
$('#div_theme_group_holder').append('<div id="success_save">'+lang['srv_success_save']+'</div>');
show_success_save();
}, 'json');
});
//change checkbox value
$('#izbira-checkbox-gumbov').change(function(){
var izbira = $(this).find(":selected").val();
$.post('ajax.php?t=checboxChangeTheme&a=checboxThemeSave', {
anketa: srv_meta_anketa_id,
checkbox: izbira
});
});
}
function theme_changeGroup() {
var gid = $("#sel_theme_group").val();
$("#div_theme_group_holder").load("ajax.php?t=theme&a=changeGroup", {anketa:srv_meta_anketa_id, gid:gid});
}
function add_theme () {
$('#fade').fadeTo('slow', 1);
$('#vrednost_edit').load('ajax.php?t=theme&a=add_theme', {anketa: srv_meta_anketa_id}).show();
}
/* -- theme editor -- */
/**
* Init theme editor
*/
function init_themeEditor(id) {
// init farbtastic
var f = $.farbtastic('#picker');
var p = $('#picker').hide();
var selected;
$('.colorwell')
.each(function () { f.linkTo(this); $(this).css('opacity', 0.75); })
.focus(function() {
if (selected) {
$(selected).css('opacity', 0.75).removeClass('colorwell-selected');
}
f.linkTo(this);
p.show();
$(selected = this).css('opacity', 1).addClass('colorwell-selected');
});
// progress bar
$("#theme_progressbar input:radio").live('change', function(event) {
var progressbar = $(this).val();
$.post("ajax.php?t=theme&a=changeProgressbar", {anketa:srv_meta_anketa_id, progressbar:progressbar}, function() {
var iframe = document.getElementById('theme-preview-iframe');
iframe.src = iframe.src;
});
});
// init auto save
$('.auto-save').change(function () {
te_auto_save(this, true);
}).blur(function () {
te_auto_save(this, true);
$('#picker').hide();
});
}
function te_auto_save (_this, refresh) {
var value = $(_this).val();
// za checkbox popravimo vrednost
if($(_this).is(':checkbox')){
if($(_this).is(':checked'))
value = 1;
else
value = 0;
}
$.post('ajax.php?t=themeEditor&a=auto_save&profile='+$('#profile').val()+'&mobile='+$('#mobile').val(), {anketa: srv_meta_anketa_id, id: $(_this).attr('data-id'), type: $(_this).attr('data-type'), value: value }, function () {
// refresh iframe
if (refresh) {
var iframe = document.getElementById('theme-preview-iframe');
iframe.src = iframe.src;
}
});
}
function te_remove_setting (id, type) {
$.post('ajax.php?t=themeEditor&a=auto_save&profile='+$('#profile').val()+'&mobile='+$('#mobile').val(), {anketa: srv_meta_anketa_id, id: id, type: type, value: '' }, function () {
window.location.reload();
});
}
function te_change_profile (profile, redirect, mobile_skin) {
var mobile = 0;
if(mobile_skin === true)
mobile = 1;
$.post('ajax.php?t=themeEditor&a=change_profile&profile='+profile+'&mobile='+mobile, {anketa: srv_meta_anketa_id}, function () {
if (redirect === true)
window.location = 'index.php?anketa='+srv_meta_anketa_id+'&a=tema';
});
}
function te_change_profile_oldskin (skin, refresh) {
$.post('ajax.php?t=themeEditor&a=change_profile_oldskin', {skin: skin, anketa: srv_meta_anketa_id}, function (data) {
if (refresh === true)
window.location = 'index.php?anketa='+srv_meta_anketa_id+'&a=tema';
else
window.location = data;
});
}
function te_delete_profile (profile, mobile_skin) {
var mobile = 0;
if(mobile_skin === true)
mobile = 1;
$.post('ajax.php?t=themeEditor&a=delete_profile&profile='+profile+'&mobile='+mobile, {anketa: srv_meta_anketa_id}, function () {
window.location = 'index.php?anketa='+srv_meta_anketa_id+'&a=tema';
});
}
function te_add_theme () {
$('#fade').fadeTo('slow', 1);
$('#vrednost_edit').load('ajax.php?t=themeEditor&a=add_theme', {anketa: srv_meta_anketa_id}).show();
}
function te_change_name (_this) {
$.post('ajax.php?t=themeEditor&a=change_name&profile='+$('#profile').val()+'&mobile='+$('#mobile').val(), {anketa: srv_meta_anketa_id, name: $(_this).val()}, function () {
$('select[name=profile-select] option[value='+$('#profile').val()+']').html( $(_this).val() );
});
}
function toggle_custom_themes () {
$('.user_themes_button').toggleClass("plus minus");
$('#div_theme_group.custom').toggle('medium');
}
|