{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' } {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {combine_script id='jquery.cookie' path='themes/default/js/jquery.cookie.js' load='footer'} {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'}'; var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; var deactivate_all_msg = '{'Deactivate all'|@translate}'; var showInactivePlugins = function() { jQuery(".showInactivePlugins").fadeOut(complete=function(){ jQuery(".plugin-inactive").fadeIn(); }) } /* group action */ const pwg_token = '{$PWG_TOKEN}'; var nb_plugin = { 'all' : {$count_types_plugins["active"]} + {$count_types_plugins["inactive"]} + {$count_types_plugins["missing"]} + {$count_types_plugins["merged"]}, 'active' : {$count_types_plugins["active"]}, 'inactive' : {$count_types_plugins["inactive"]}, 'other' : {$count_types_plugins["missing"]} + {$count_types_plugins["merged"]}, }; const are_you_sure_msg = '{'Are you sure?'|@translate|@escape:'javascript'}'; const confirm_msg = '{"Yes, I am sure"|@translate}'; const cancel_msg = "{"No, I have changed my mind"|@translate}"; let delete_plugin_msg = '{'Are you sure you want to delete the plugin "%s"?'|@translate|@escape:'javascript'}'; let deleted_plugin_msg = '{'Plugin "%s" deleted!'|@translate|@escape:'javascript'}'; let restore_plugin_msg = '{'Are you sure you want to restore the plugin "%s"?'|@translate|@escape:'javascript'}'; let uninstall_plugin_msg = '{'Are you sure you want to uninstall the plugin "%s"?'|@translate|@escape:'javascript'}'; const restore_tip_msg = "{'Restore default configuration. You will lose your plugin settings!'|@translate|@escape:'javascript'}"; const plugin_added_str = '{'Activated'|@translate|@escape:'javascript'}'; const plugin_deactivated_str = '{'Deactivated'|@translate|@escape:'javascript'}'; const plugin_restored_str = '{'Restored'|@translate|@escape:'javascript'}'; const plugin_action_error = '{'an error happened'|@translate|@escape:'javascript'}'; const not_webmaster = '{'Webmaster status required'|@translate|@escape:'javascript'}'; const nothing_found = '{'No plugins found'|@translate|@escape:'javascript'}'; const x_plugins_found = '{'%s plugins found'|@translate|@escape:'javascript'}'; const plugin_found = '{'%s plugin found'|@translate|@escape:'javascript'}'; const isWebmaster = {$isWebmaster}; {literal} jQuery(document).ready(function() { /* Add the '...' for the overflow of the description line*/ jQuery( document ).ready(function () { jQuery('.pluginDesc').each(function () { var el = jQuery(this).context; var wordArray = el.innerHTML.split(' '); if (el.scrollHeight > el.offsetHeight) { jQuery(this).attr('title', jQuery(this).html()) } while(el.scrollHeight > el.offsetHeight) { wordArray.pop(); el.innerHTML = wordArray.join(' ') + '...'; } }) }); /*Add the filter research*/ jQuery( document ).ready(function () { document.onkeydown = function(e) { if (e.keyCode == 58) { jQuery(".pluginFilter input.search-input").focus(); return false; } } jQuery(".pluginFilter input").on("input", function() { let text = jQuery(this).val().toLowerCase(); var searchNumber = 0; var searchActive = 0; var searchInactive = 0; var searchOther = 0; $(".pluginMiniBox").each(function() { if (text == "") { jQuery(".nbPluginsSearch").hide(); if ($("#seeAll").is(":checked")) { jQuery(this).show(); } if ($("#seeActive").is(":checked") && jQuery(this).hasClass("plugin-active")) { jQuery(this).show(); } if ($("#seeInactive").is(":checked") && jQuery(this).hasClass("plugin-inactive")) { jQuery(this).show(); } if ($("#seeOther").is(":checked") && (jQuery(this).hasClass("plugin-merged") || jQuery(this).hasClass("plugin-missing"))) { jQuery(this).show(); } if ($(this).hasClass("plugin-active")) { searchActive++; } if ($(this).hasClass("plugin-inactive")) { searchInactive++; } if (($(this).hasClass("plugin-merged") || $(this).hasClass("plugin-missing"))) { searchOther++; } searchNumber++ nb_plugin.all = searchNumber; nb_plugin.active = searchActive; nb_plugin.inactive = searchInactive; nb_plugin.other = searchOther; } else { jQuery(".nbPluginsSearch").show(); let name = jQuery(this).find(".pluginMiniBoxNameCell").text().toLowerCase(); let description = jQuery(this).find(".pluginDesc").text().toLowerCase(); if (name.search(text) != -1 || description.search(text) != -1){ searchNumber++; if ($("#seeAll").is(":checked")) { jQuery(this).show(); } if ($("#seeActive").is(":checked") && jQuery(this).hasClass("plugin-active")) { jQuery(this).show(); } if ($("#seeInactive").is(":checked") && jQuery(this).hasClass("plugin-inactive")) { jQuery(this).show(); } if ($("#seeOther").is(":checked") && (jQuery(this).hasClass("plugin-merged") || jQuery(this).hasClass("plugin-missing"))) { jQuery(this).show(); } if ($(this).hasClass("plugin-active")) { searchActive++; } if ($(this).hasClass("plugin-inactive")) { searchInactive++; } if (($(this).hasClass("plugin-merged") || $(this).hasClass("plugin-missing"))) { searchOther++; } nb_plugin.all = searchNumber; nb_plugin.active = searchActive; nb_plugin.inactive = searchInactive; nb_plugin.other = searchOther; } else { jQuery(this).hide(); nb_plugin.all = searchNumber; nb_plugin.active = searchActive; nb_plugin.inactive = searchInactive; nb_plugin.other = searchOther; } } }) actualizeFilter(); if (searchNumber == 0) { jQuery(".nbPluginsSearch").html(nothing_found); } else if (searchNumber == 1) { jQuery(".nbPluginsSearch").html(plugin_found.replace("%s", searchNumber)); } else { jQuery(".nbPluginsSearch").html(x_plugins_found.replace("%s", searchNumber)); } }); }); /* Show Inactive plugins or button to show them*/ jQuery( document ).ready(function () { jQuery(".showInactivePlugins button").on('click', showInactivePlugins) }); }); $(document).mouseup(function (e) { e.stopPropagation(); $(".pluginMiniBox").each(function() { if ($(this).find(".showOptions").has(e.target).length === 0) { $(this).find(".PluginOptionsBlock").hide(); } }) }); function actualizeFilter() { $("label[for='seeAll'] .filter-badge").html(nb_plugin.all); $("label[for='seeActive'] .filter-badge").html(nb_plugin.active); $("label[for='seeInactive'] .filter-badge").html(nb_plugin.inactive); $("label[for='seeOther'] .filter-badge").html(nb_plugin.other); //console.log(nb_plugin) $(".filterLabel").show(); $(".pluginMiniBox").each(function () { if (nb_plugin.active == 0) { $("label[for='seeActive']").hide(); if ($("#seeActive").is(":checked")) { $("#seeAll").trigger("click") } } if (nb_plugin.inactive == 0) { $("label[for='seeInactive']").hide(); if ($("#seeInactive").is(":checked")) { $("#seeAll").trigger("click") } } if (nb_plugin.other == 0) { $("label[for='seeOther']").hide(); if ($("#seeOther").is(":checked")) { $("#seeAll").trigger("click") } } }) } jQuery(".pluginMiniBox").each(function(index){ let myplugin = jQuery(this); myplugin.find(".showOptions").click(function(){ myplugin.find(".PluginOptionsBlock").toggle(); }); }) {/literal} {/footer_script} {combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'} {combine_css path="themes/default/js/plugins/jquery-confirm.min.css"} {combine_script id='tiptip' load='header' path='themes/default/js/plugins/jquery.tipTip.minified.js'} {combine_script id='pluginInstallated' load='footer' path='admin/themes/default/js/plugins_installated.js'}