{combine_css path='themes/default/js/plugins/jquery.tokeninput.css'} {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} (function(){ var data = {ldelim}}, edit = false, edited = false; // set changed jQuery('select[name="folder"]').change(function() { if (edited) { var ok = confirm('{'If you change current set you will lost every shortcuts changes.'|translate|escape:javascript}'); 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('{'Edit shorcuts'|translate|escape:javascript}'); } else { $(this).html('{'Preview'|translate|escape:javascript}'); } edit = !edit; update(); return false; }); // reset defaults jQuery('.reset').click(function() { if (!confirm('{'Are you sure?'|translate|escape:javascript}')) { 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 = '', i=0; if (!edit) { html+= '