PluginProbe
Image Source Control Lite – Show Image Credits and Captions / 3.12.0
Image Source Control Lite – Show Image Credits and Captions v3.12.0
3.12.0 3.11.0 trunk 1.1 1.1.1 1.1.2 1.1.2.1 1.1.3 1.10 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.2 1.2.0.1 1.2.0.2 1.2.0.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.4.1 1.3.5 All 110 releases
image-source-control-isc / admin / assets / js / settings.min.js

settings.min.js in Image Source Control Lite – Show Image Credits and Captions 3.12.0, at admin/assets/js/settings.min.js

1 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function($){isc_thumbnail_input_checkstate();isc_caption_checkstate();isc_ai_images_checkstate();isc_licenses_checkstate();isc_toggle_caption_position();isc_toggle_module_sections();$("#isc-settings-overlay-enable").on("click",function(){isc_caption_checkstate()});$("#isc-settings-ai-images-enable").on("click",function(){isc_ai_images_checkstate()});$("#isc-settings-licenses-enable").on("click",function(){isc_licenses_checkstate()});$(".isc-settings-standard-source input").on("change",isc_toggle_standard_source_text);$("#thumbnail-size-select, #use-thumbnail").on("change",function(){isc_thumbnail_input_checkstate()});$("#isc-settings-caption-style input").on("change",function(){isc_toggle_caption_position()});$("#isc-settings-global-list-indexed-images").on("change",function(){isc_show_reindex_warning()});$('#isc-settings-plugin-modules input[type="checkbox"]').on("change",function(){isc_toggle_module_sections()});$("#isc-settings-plugin-images-only").on("change",function(){const enabled=this.checked;$("#isc-settings-plugin-images-only-indexer").toggleClass("hidden");$("#isc-settings-plugin-images-only-cleanup-wrapper").toggleClass("hidden",!enabled)});$("#isc-copy-log-url-btn").on("click",function(){const urlField=document.getElementById("isc-log-url-field");if(!urlField){return}const showSuccess=function(){$("#isc-copy-log-url-success").stop(true,true).fadeIn().delay(2e3).fadeOut()};const fallbackCopy=function(){urlField.focus();urlField.select();urlField.setSelectionRange(0,urlField.value.length);if(document.execCommand("copy")){showSuccess()}};if(navigator.clipboard?.writeText){navigator.clipboard.writeText(urlField.value).then(showSuccess).catch(fallbackCopy)}else{fallbackCopy()}});$("#isc-download-log-btn").on("click",function(){$.ajax({type:"POST",url:ajaxurl,data:{action:"isc_download_log",nonce:isc.ajaxNonce},xhrFields:{responseType:"blob"},success:function(response,status,xhr){const disposition=xhr.getResponseHeader("Content-Disposition");let filename="image-source-control.log";if(disposition&&disposition.indexOf("filename=")!==-1){const filenameMatch=disposition.match(/filename="?([^"]+)"?/);if(filenameMatch&&filenameMatch[1]){filename=filenameMatch[1]}}const blob=new Blob([response],{type:"text/plain"});const url=window.URL.createObjectURL(blob);const link=document.createElement("a");link.href=url;link.download=filename;document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url)},error:function(xhr){console.error("Error downloading log file:",xhr.statusText);let errorMsg="Error downloading log file.";if(xhr.status){errorMsg+=" HTTP status: "+xhr.status+" ("+xhr.statusText+")."}if(xhr.responseText){errorMsg+="\nDetails: "+xhr.responseText}alert(errorMsg)}})});$("#isc-enable-log-checkbox").on("change",function(){$("#isc-log-url-wrapper").toggle(this.checked)});$("#isc-settings-caption-pos-options button").on("click",function(event){event.stopPropagation();$("#isc-settings-caption-pos-options button.selected").removeClass("selected");$(this).addClass("selected");$("#isc-settings-caption-position").val($(this).data("position"));var iframe=document.createElement("iframe");iframe.src=isc_settings.baseurl+"admin/templates/settings/preview/caption-preview.html"+"?position="+$(this).data("position")+"&pretext="+encodeURIComponent($("#source-pretext").val());iframe.width="250";iframe.height="181";var preview_container=$("#isc-settings-caption-preview");preview_container.find("iframe").remove();preview_container.append(iframe);preview_container.removeClass("hidden")});$(document).on("click mouseout",function(event){if(!$(event.target).closest("#isc-settings-caption-pos-options").length){$("#isc-settings-caption-preview").addClass("hidden")}});$("#isc-signup-nl").prop("disabled",false);$("#isc-signup-nl").on("click",function(){$("#isc-signup-nl").prop("disabled",true);$("#isc-signup-loader").removeClass("hidden");$.ajax({type:"POST",url:ajaxurl,data:{action:"newsletter_signup",nonce:isc.ajaxNonce},dataType:"json",success:function(response){if(!response.success){$("#isc-signup-nl-error").removeClass("hidden").html(response.message)}else{$("#isc-signup-nl-success").removeClass("hidden").html(response.message)}$("#isc-signup-loader").addClass("hidden")}})});$("#isc_settings_section_signup .postbox-header .dashicons-no-alt").on("click",function(){$("#isc-signup-nl").prop("disabled",true);$("#isc-signup-loader").removeClass("hidden");$.ajax({type:"POST",url:ajaxurl,data:{action:"newsletter_close",nonce:isc.ajaxNonce},dataType:"json",success:function(response){$("#isc_settings_section_signup").remove()}})});document.querySelectorAll("#source-pretext-buttons button").forEach(function(button){button.addEventListener("click",function(){var inputField=document.getElementById("source-pretext");inputField.value+=this.textContent;inputField.focus()})});document.getElementById("source-pretext").addEventListener("focus",function(){document.getElementById("source-pretext-buttons").classList.remove("hidden")})});function isc_toggle_module_sections(){Object.entries(isc.moduleSections).forEach(([module,sections])=>{const checkbox=document.querySelector(`#isc-settings-plugin-modules input[value="${module}"]`);if(checkbox){sections.forEach(sectionId=>{const sectionElement=document.getElementById(sectionId);const section=sectionElement?sectionElement.querySelector(".inside"):null;if(section){if(checkbox.checked){section.classList.remove("hidden")}else{section.classList.add("hidden")}}})}})}function isc_thumbnail_input_checkstate(){if(document.getElementById("use-thumbnail").checked){document.getElementById("thumbnail-size-select").classList.remove("hidden")}else{document.getElementById("thumbnail-size-select").classList.add("hidden")}if("custom"===document.getElementById("thumbnail-size-select").value&&document.getElementById("use-thumbnail").checked){document.getElementById("isc-settings-custom-size").classList.remove("hidden")}else{document.getElementById("isc-settings-custom-size").classList.add("hidden")}}function isc_caption_checkstate(){var overlay_enabled=document.getElementById("isc-settings-overlay-enable");if(!overlay_enabled){return}var elements=document.querySelectorAll(".isc_settings_section_overlay .form-table tr:not(:first-of-type)");if(overlay_enabled.checked){Array.prototype.forEach.call(elements,function(el,i){el.style.display="table-row"})}else{Array.prototype.forEach.call(elements,function(el,i){el.style.display="none"})}}function isc_ai_images_checkstate(){var ai_images_enabled=document.getElementById("isc-settings-ai-images-enable");if(!ai_images_enabled){return}var elements=document.querySelectorAll(".isc_settings_section_ai_images .form-table tr:not(:first-of-type)");if(ai_images_enabled.checked){Array.prototype.forEach.call(elements,function(el,i){el.style.display="table-row"})}else{Array.prototype.forEach.call(elements,function(el,i){el.style.display="none"})}}function isc_licenses_checkstate(){var licenses_enabled=document.getElementById("isc-settings-licenses-enable");if(!licenses_enabled){return}var elements=document.querySelectorAll(".isc_settings_section_licenses .form-table tr:not(:first-of-type)");if(licenses_enabled.checked){Array.prototype.forEach.call(elements,function(el,i){el.style.display="table-row"})}else{Array.prototype.forEach.call(elements,function(el,i){el.style.display="none"})}}function isc_toggle_standard_source_text(){var standard_source_custom=document.getElementById("isc-custom-text-select");if(!standard_source_custom){return}if(standard_source_custom.checked){document.getElementById("isc-custom-text").removeAttribute("disabled")}else{document.getElementById("isc-custom-text").setAttribute("disabled","disabled")}}function isc_toggle_caption_position(){var caption_style=document.querySelector("#isc-settings-caption-style input:checked");if(!caption_style){return}if(caption_style.value==="none"){document.getElementById("isc-settings-caption-position-options-wrapper").classList.add("hidden");document.getElementById("isc-settings-caption-position-options-wrapper").previousElementSibling.classList.add("hidden")}else{document.getElementById("isc-settings-caption-position-options-wrapper").classList.remove("hidden");document.getElementById("isc-settings-caption-position-options-wrapper").previousElementSibling.classList.remove("hidden")}}function isc_show_reindex_warning(){document.getElementById("isc-settings-global-list-indexed-images-warning").classList.remove("hidden")}