{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' } {footer_script require='jquery.ajaxmanager'} /* incompatible message */ var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; incompatible_msg += '\n'; incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; /* group action */ var pwg_token = '{$PWG_TOKEN}'; var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; {literal} var queuedManager = jQuery.manageAjax.create('queued', { queue: true, maxRequests: 1, complete: function() { location.reload(); } }); jQuery(document).ready(function() { /* group action */ jQuery('a.deactivate_all').click(function() { if (confirm(confirmMsg)) { jQuery('div.active').each(function() { performPluginAction(jQuery(this).attr('id'), 'deactivate'); }); } }); jQuery('a.activate_all').click(function() { if (confirm(confirmMsg)) { jQuery('div.inactive').each(function() { performPluginAction(jQuery(this).attr('id'), 'activate'); }); } }); function performPluginAction(id, action) { queuedManager.add({ type: 'GET', dataType: 'json', url: 'ws.php', data: { method: 'pwg.plugins.performAction', action: action, plugin: id, pwg_token: pwg_token, format: 'json' }, success: function(data) { if (data['stat'] == 'ok') { if (action == 'deactivate') jQuery("#"+id).removeClass('active').addClass('inactive'); else jQuery("#"+id).removeClass('inactive').addClass('active'); } } }); }; /* incompatible message */ jQuery('.incompatible a.incompatible').click(function() { return confirm(incompatible_msg); }); /* TipTips */ jQuery('.warning').tipTip({ 'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200, 'maxWidth':'250px' }); jQuery('.plugin-restore').tipTip({ 'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200 }); jQuery('.pluginMiniBoxDesc').tipTip({ 'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200, 'maxWidth':'300px', /* not effective, TipTip bug */ 'defaultPosition':'left', 'keepAlive':true }); }); {/literal} {/footer_script}