1 line
8.7 KiB
JavaScript
1 line
8.7 KiB
JavaScript
|
function disableScrolling(){var e=window.scrollX,t=window.scrollY;window.onscroll=function(){window.scrollTo(e,t)}}function enableScrolling(){ezTocSettingsTabsFixed()}jQuery(document).ready((function(e){var t=e(".ez-toc-color-picker");t.length&&t.wpColorPicker();var s=document.getElementById("ez-toc-settings[width]"),c=document.getElementById("ez-toc-settings[width_custom]");c&&("custom"!=s.value&&(c.parentNode.parentNode.style.display="none"),s.addEventListener("change",(function(){"custom"==document.getElementById("ez-toc-settings[width]").value?c.parentNode.parentNode.style.display="revert":c.parentNode.parentNode.style.display="none"}))),e("#reset-options-to-default-button").click((function(){1==confirm("Do you want reset settings to default options?")&&e.post(ajaxurl,{action:"eztoc_reset_options_to_default",eztoc_security_nonce:cn_toc_admin_data.eztoc_security_nonce},(function(e){alert("Default Options Reset Now!"),window.location.reload()}))})),e("#subscribe-newsletter-form").on("submit",(function(t){t.preventDefault();var s=e("#subscribe-newsletter-form"),c=s.find('input[name="name"]').val(),a=s.find('input[name="email"]').val(),o=s.find('input[name="company"]').val();e.post(ajaxurl,{action:"eztoc_subscribe_newsletter",name:c,email:a,website:o,eztoc_security_nonce:cn_toc_admin_data.eztoc_security_nonce},(function(e){if("security_nonce_not_verified"===e)return alert("Security nonce not verified"),!1}))}));let a=e("#eztoc-general").find("select[name='ez-toc-settings[position]']"),o=e("#eztoc-general").find("input[name='ez-toc-settings[custom_para_number]']"),n=e("#eztoc-general").find("input[name='ez-toc-settings[custom_img_number]']"),i=e("#eztoc-general").find("input[name='ez-toc-settings[blockqoute_checkbox]']");"aftercustompara"==e(a).val()?e(o).parents("tr").show():e(o).parents("tr").hide(),"afterpara"==e(a).val()||"aftercustompara"==e(a).val()?e(i).parents("tr").show():e(i).parents("tr").hide(),"aftercustomimg"==e(a).val()?e(n).parents("tr").show():e(n).parents("tr").hide(),e(document).on("change","select[name='ez-toc-settings[position]']",(function(){"aftercustompara"==e(this).val()?e(o).parents("tr").show(500):e(o).parents("tr").hide(500),"afterpara"==e(this).val()||"aftercustompara"==e(this).val()?e(i).parents("tr").show(500):e(i).parents("tr").hide(500),"aftercustomimg"==e(this).val()?e(n).parents("tr").show(500):e(n).parents("tr").hide(500)}));let r=e("#eztoc-general").find("select[name='ez-toc-settings[toc_loading]']"),l=e("#eztoc-general").find("input[name='ez-toc-settings[smooth_scroll]']"),v=e("#eztoc-general").find("input[name='ez-toc-settings[avoid_anch_jump]']"),d=e("#eztoc-advanced").find("select[name='ez-toc-settings[load_js_in]']");"js"==e(r).val()?(e(l).parents("tr").show(),e(v).parents("tr").show(),e(d).parents("tr").show()):(e(l).parents("tr").hide(),e(v).parents("tr").hide(),e(d).parents("tr").hide()),e(document).on("change","select[name='ez-toc-settings[toc_loading]']",(function(){"js"==e(this).val()?(e(l).parents("tr").show(500),e(v).parents("tr").show(500),e(d).parents("tr").show(500)):(e(l).parents("tr").hide(500),e(v).parents("tr").hide(500),e(d).parents("tr").hide(500))}));let m=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky_highlight_heading]']"),u=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky_highlight_bg_colour]']"),p=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky_highlight_title_colour]']");1==e(m).prop("checked")?(e(u).parents("tr").show(),e(p).parents("tr").show()):(e(u).parents("tr").hide(),e(p).parents("tr").hide()),e(document).on("change","input[name='ez-toc-settings[sticky_highlight_heading]']",(function(){1==e(this).prop("checked")?(e(u).parents("tr").show(500),e(p).parents("tr").show(500)):(e(u).parents("tr").hide(500),e(p).parents("tr").hide(500))}))}));const unsecuredCopyToClipboard=e=>{const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Unable to copy to clipboard",e)}document.body.removeChild(t)};function ez_toc_clipboard(e
|