{combine_script id='jquery.tokeninput' load='footer' path='themes/default/js/plugins/jquery.tokeninput.js'} {combine_css path=$SMILIES_PATH|cat:'template/style.css'} {footer_script}{literal} var data = {}; var edit = false; var edited = false; // set changed jQuery("select[name='folder']").change(function() { if (edited) { var ok = confirm("{/literal}{'If you change current set you will lost every shortcuts changes.'|@translate}{literal}"); if (!ok) { jQuery(this).val(jQuery(this).data("selected")); return false; } } var image = jQuery(this).find(":selected").css("background-image"); jQuery(this).css("background-image", image); jQuery(this).data("selected", jQuery(this).val()); fetch(); }); // size changed jQuery("input[name='cols']").change(function() { update(); }); // switch preview/edit jQuery(".edit").click(function() { if (edit) { $(this).html("{/literal}{'Edit shorcuts'|@translate}{literal}"); } else { $(this).html("{/literal}{'Preview'|@translate}{literal}"); } edit = !edit; update(); return false; }); // reset defaults jQuery(".reset").click(function() { var ok = confirm("{/literal}{'Are you sure?'|@translate}{literal}"); if (!ok) return false; jQuery.ajax({ url: 'admin.php', type: 'GET', dataType: 'json', data: { action: 'ss_reset', folder: jQuery("select[name='folder']").val(), }, success: function(result) { data = result; edited = false; update(); } }); return false; }); // display edit form before submit jQuery("#smiliesupport").submit(function() { if (!edit) jQuery(".edit").click(); return true; }); /* get smilies list */ function fetch() { jQuery.ajax({ url: 'admin.php', type: 'GET', dataType: 'json', data: { action: 'ss_list', folder: jQuery("select[name='folder']").val(), }, success: function(result) { data = result; edited = false; update(); } }); } /* update preview/edit table */ function update() { var html = ''; if (!edit) { html+= '