first
This commit is contained in:
364
wp-content/plugins/easy-table-of-contents/assets/js/admin.js
Normal file
364
wp-content/plugins/easy-table-of-contents/assets/js/admin.js
Normal file
@ -0,0 +1,364 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
var ez_toc_color_picker = $('.ez-toc-color-picker');
|
||||
|
||||
if (ez_toc_color_picker.length) {
|
||||
ez_toc_color_picker.wpColorPicker();
|
||||
}
|
||||
|
||||
var ezTocSettingsWidth = document.getElementById('ez-toc-settings[width]');
|
||||
var ezTocSettingsCustomWidth = document.getElementById('ez-toc-settings[width_custom]');
|
||||
|
||||
if(ezTocSettingsCustomWidth) {
|
||||
if(ezTocSettingsWidth.value != 'custom')
|
||||
ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "none";
|
||||
|
||||
ezTocSettingsWidth.addEventListener('change', function () {
|
||||
if (document.getElementById('ez-toc-settings[width]').value == 'custom') {
|
||||
ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "revert";
|
||||
} else {
|
||||
ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "none";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#reset-options-to-default-button").click(function() {
|
||||
let text = "Do you want reset settings to default options?";
|
||||
if (confirm(text) == true) {
|
||||
$.post(ajaxurl, { action: 'eztoc_reset_options_to_default', eztoc_security_nonce: cn_toc_admin_data.eztoc_security_nonce },
|
||||
function (data) {
|
||||
alert('Default Options Reset Now!');
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#subscribe-newsletter-form").on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#subscribe-newsletter-form");
|
||||
var name = $form.find('input[name="name"]').val();
|
||||
var email = $form.find('input[name="email"]').val();
|
||||
var website = $form.find('input[name="company"]').val();
|
||||
$.post(ajaxurl, {action: 'eztoc_subscribe_newsletter', name: name, email: email, website: website, eztoc_security_nonce: cn_toc_admin_data.eztoc_security_nonce},
|
||||
function (data) {
|
||||
if(data === 'security_nonce_not_verified' ){
|
||||
alert('Security nonce not verified');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
let position = $('#eztoc-general').find("select[name='ez-toc-settings[position]']");
|
||||
let customParaNumber = $('#eztoc-general').find("input[name='ez-toc-settings[custom_para_number]']");
|
||||
let customImgNumber = $('#eztoc-general').find("input[name='ez-toc-settings[custom_img_number]']");
|
||||
let blockQCheckB = $('#eztoc-general').find("input[name='ez-toc-settings[blockqoute_checkbox]']");
|
||||
if($(position).val() == 'aftercustompara'){
|
||||
$(customParaNumber).parents('tr').show();
|
||||
}else{
|
||||
$(customParaNumber).parents('tr').hide();
|
||||
}
|
||||
if($(position).val() == 'afterpara' || $(position).val() == 'aftercustompara'){
|
||||
$(blockQCheckB).parents('tr').show();
|
||||
}else{
|
||||
$(blockQCheckB).parents('tr').hide();
|
||||
}
|
||||
if($(position).val() == 'aftercustomimg'){
|
||||
$(customImgNumber).parents('tr').show();
|
||||
}else{
|
||||
$(customImgNumber).parents('tr').hide();
|
||||
}
|
||||
$(document).on("change", "select[name='ez-toc-settings[position]']", function() {
|
||||
if($(this).val() == 'aftercustompara'){
|
||||
$(customParaNumber).parents('tr').show(500);
|
||||
}else{
|
||||
$(customParaNumber).parents('tr').hide(500);
|
||||
}
|
||||
if($(this).val() == 'afterpara' || $(this).val() == 'aftercustompara'){
|
||||
$(blockQCheckB).parents('tr').show(500);
|
||||
}else{
|
||||
$(blockQCheckB).parents('tr').hide(500);
|
||||
}
|
||||
if($(this).val() == 'aftercustomimg'){
|
||||
$(customImgNumber).parents('tr').show(500);
|
||||
}else{
|
||||
$(customImgNumber).parents('tr').hide(500);
|
||||
}
|
||||
});
|
||||
let check_method = $('#eztoc-general').find("select[name='ez-toc-settings[toc_loading]']");
|
||||
let smoothCheck = $('#eztoc-general').find("input[name='ez-toc-settings[smooth_scroll]']");
|
||||
let anchsJump = $('#eztoc-general').find("input[name='ez-toc-settings[avoid_anch_jump]']");
|
||||
let js_where = $('#eztoc-advanced').find("select[name='ez-toc-settings[load_js_in]']");
|
||||
if($(check_method).val() == 'js'){
|
||||
$(smoothCheck).parents('tr').show();
|
||||
$(anchsJump).parents('tr').show();
|
||||
$(js_where).parents('tr').show();
|
||||
}else{
|
||||
$(smoothCheck).parents('tr').hide();
|
||||
$(anchsJump).parents('tr').hide();
|
||||
$(js_where).parents('tr').hide();
|
||||
}
|
||||
$(document).on("change", "select[name='ez-toc-settings[toc_loading]']", function() {
|
||||
if($(this).val() == 'js'){
|
||||
$(smoothCheck).parents('tr').show(500);
|
||||
$(anchsJump).parents('tr').show(500);
|
||||
$(js_where).parents('tr').show(500);
|
||||
}else{
|
||||
$(smoothCheck).parents('tr').hide(500);
|
||||
$(anchsJump).parents('tr').hide(500);
|
||||
$(js_where).parents('tr').hide(500);
|
||||
}
|
||||
});
|
||||
|
||||
let stickyHighlight = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky_highlight_heading]']");
|
||||
let stickyHighlightBg = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky_highlight_bg_colour]']");
|
||||
let stickyHighlightTitle = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky_highlight_title_colour]']");
|
||||
if($(stickyHighlight).prop('checked') == true){
|
||||
$(stickyHighlightBg).parents('tr').show();
|
||||
$(stickyHighlightTitle).parents('tr').show();
|
||||
}else{
|
||||
$(stickyHighlightBg).parents('tr').hide();
|
||||
$(stickyHighlightTitle).parents('tr').hide();
|
||||
}
|
||||
$(document).on("change", "input[name='ez-toc-settings[sticky_highlight_heading]']", function() {
|
||||
if($(this).prop('checked') == true){
|
||||
$(stickyHighlightBg).parents('tr').show(500);
|
||||
$(stickyHighlightTitle).parents('tr').show(500);
|
||||
}else{
|
||||
$(stickyHighlightBg).parents('tr').hide(500);
|
||||
$(stickyHighlightTitle).parents('tr').hide(500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* DisableScrolling Function
|
||||
* @since 2.0.33
|
||||
*/
|
||||
function disableScrolling() {
|
||||
var x=window.scrollX;
|
||||
var y=window.scrollY;
|
||||
window.onscroll=function(){window.scrollTo(x, y);};
|
||||
}
|
||||
/**
|
||||
* EnableScrolling Function
|
||||
* @since 2.0.33
|
||||
*/
|
||||
function enableScrolling(){
|
||||
ezTocSettingsTabsFixed();
|
||||
}
|
||||
|
||||
/**
|
||||
* unsecuredCopyToClipboard Function
|
||||
* Clipboard JS
|
||||
* @since 2.0.33
|
||||
*/
|
||||
const unsecuredCopyToClipboard = (text) => {
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
try {
|
||||
document.execCommand('copy')
|
||||
} catch (err) {
|
||||
console.error('Unable to copy to clipboard', err)
|
||||
}
|
||||
document.body.removeChild(textArea)
|
||||
};
|
||||
/**
|
||||
* ez_toc_clipboard Function
|
||||
* Clipboard JS
|
||||
* @since 2.0.33
|
||||
*/
|
||||
function ez_toc_clipboard(id, tooltipId, $this, event) {
|
||||
event.preventDefault();
|
||||
disableScrolling();
|
||||
var copyText = $this.parentNode.parentNode.querySelectorAll("#" + id)[0];
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999);
|
||||
unsecuredCopyToClipboard(copyText.value);
|
||||
|
||||
var tooltip = $this.querySelectorAll('span.' + tooltipId)[0];
|
||||
tooltip.innerHTML = "Copied: " + copyText.value;
|
||||
}
|
||||
/**
|
||||
* ez_toc_outFunc Function
|
||||
* Clipboard JS
|
||||
* @since 2.0.33
|
||||
*/
|
||||
function ez_toc_outFunc(tooltipId, $this, event) {
|
||||
event.preventDefault();
|
||||
var tooltip = $this.querySelectorAll('span.' + tooltipId)[0];
|
||||
tooltip.innerHTML = "Copy to clipboard";
|
||||
enableScrolling();
|
||||
}
|
||||
|
||||
/**
|
||||
* ezTocSettingsTabsFixed Function
|
||||
* Apply Fixed CSS & JS for General Settings Tabs
|
||||
* @since 2.0.38
|
||||
*/
|
||||
function ezTocSettingsTabsFixed() {
|
||||
var ezTocProSettingsContainer = '<span class="general-pro-settings-container"> | <a href="#eztoc-prosettings" id="eztoc-link-prosettings">Pro Settings</a></span>';
|
||||
|
||||
var ezTocGeneralTabs = document.querySelector("#general #eztoc-tabs");
|
||||
var ezTocGeneralForm = document.querySelector("#general form");
|
||||
|
||||
if(ezTocGeneralTabs !== null) {
|
||||
window.onscroll = function () {
|
||||
var y = window.scrollY;
|
||||
|
||||
var ez_toc_pro_settings_link_paid = document.getElementsByClassName('ez-toc-pro-settings-link-paid');
|
||||
var ezTocElementProSettingsContainer = document.getElementsByClassName("general-pro-settings-container");
|
||||
|
||||
var ezTocGeneralTabsLinkGeneral = document.querySelector("#general #eztoc-tabs #eztoc-link-general");
|
||||
var ezTocGeneralTabsLinkAppearance = document.querySelector("#general #eztoc-tabs #eztoc-link-appearance");
|
||||
var ezTocGeneralTabsLinkAdvanced = document.querySelector("#general #eztoc-tabs #eztoc-link-advanced");
|
||||
var ezTocGeneralTabsLinkShortcode = document.querySelector("#general #eztoc-tabs #eztoc-link-shortcode");
|
||||
var ezTocGeneralTabsLinkSticky = document.querySelector("#general #eztoc-tabs #eztoc-link-sticky");
|
||||
var ezTocGeneralTabsLinkCompatibility = document.querySelector("#general #eztoc-tabs #eztoc-link-compatibility");
|
||||
var ezTocGeneralTabsLinkIeSettings = document.querySelector("#general #eztoc-tabs #eztoc-link-iesettings");
|
||||
var ezTocGeneralTabsLinkProSettings = document.querySelector("#general #eztoc-tabs #eztoc-link-prosettings");
|
||||
|
||||
var minusOffsetTop = 100;
|
||||
|
||||
var ezTocGeneralContainerGeneral = document.querySelector("#general div#eztoc-general").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerAppearance = document.querySelector("#general div#eztoc-appearance").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerAdvanced = document.querySelector("#general div#eztoc-advanced").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerShortcode = document.querySelector("#general div#eztoc-shortcode").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerCompatibility = document.querySelector("#general div#eztoc-compatibility").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerIeSettings = document.querySelector("#general div#eztoc-iesettings").offsetTop - minusOffsetTop;
|
||||
var ezTocGeneralContainerSticky = document.querySelector("#eztoc-sticky").offsetTop - minusOffsetTop;
|
||||
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0) {
|
||||
var ezTocGeneralContainerProSettings = document.querySelector("#general div#eztoc-prosettings").offsetTop - minusOffsetTop - 150;
|
||||
} else {
|
||||
ezTocGeneralContainerCompatibility -= 150;
|
||||
ezTocGeneralContainerIeSettings -= 150;
|
||||
}
|
||||
ezTocGeneralTabsLinkGeneral.classList.add('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if (ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
|
||||
if (y >= 100) {
|
||||
ezTocGeneralTabs.classList.remove('stay');
|
||||
ezTocGeneralTabs.classList.add('moving');
|
||||
ezTocGeneralForm.classList.add('moving');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length == 0)
|
||||
ezTocGeneralTabs.innerHTML += ezTocProSettingsContainer;
|
||||
} else {
|
||||
ezTocGeneralTabs.classList.remove('moving');
|
||||
ezTocGeneralTabs.classList.add('stay');
|
||||
ezTocGeneralForm.classList.remove('moving');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0)
|
||||
document.querySelector(".general-pro-settings-container").remove();
|
||||
}
|
||||
|
||||
if (y >= ezTocGeneralContainerGeneral) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.add('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerAppearance) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.add('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerAdvanced) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.add('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerShortcode) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.add('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerSticky) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.add('active');
|
||||
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerCompatibility) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.add('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (y >= ezTocGeneralContainerIeSettings) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.add('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.remove('active');
|
||||
}
|
||||
if (ezTocElementProSettingsContainer.length > 0 && y >= ezTocGeneralContainerProSettings) {
|
||||
ezTocGeneralTabsLinkGeneral.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAppearance.classList.remove('active');
|
||||
ezTocGeneralTabsLinkAdvanced.classList.remove('active');
|
||||
ezTocGeneralTabsLinkShortcode.classList.remove('active');
|
||||
ezTocGeneralTabsLinkCompatibility.classList.remove('active');
|
||||
ezTocGeneralTabsLinkIeSettings.classList.remove('active');
|
||||
ezTocGeneralTabsLinkSticky.classList.remove('active');
|
||||
if(ez_toc_pro_settings_link_paid !== null && ez_toc_pro_settings_link_paid.length > 0 && ezTocElementProSettingsContainer.length > 0 && ezTocGeneralTabsLinkProSettings !== null)
|
||||
ezTocGeneralTabsLinkProSettings.classList.add('active');
|
||||
}
|
||||
};
|
||||
} else {
|
||||
window.onscroll = function () {}
|
||||
}
|
||||
}
|
||||
ezTocSettingsTabsFixed();
|
||||
|
1
wp-content/plugins/easy-table-of-contents/assets/js/admin.min.js
vendored
Normal file
1
wp-content/plugins/easy-table-of-contents/assets/js/admin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,163 @@
|
||||
jQuery(function ($) {
|
||||
// ======================================
|
||||
// Set active heading in ez-toc-widget list
|
||||
// ======================================
|
||||
|
||||
var ezTOCWidgetStickyheadings = $('span.ez-toc-section').toArray();
|
||||
var ezTOCWidgetStickyheadingToListElementLinkMap = ezTOCWidgetStickygetHeadingToListElementLinkMap(ezTOCWidgetStickyheadings);
|
||||
var ezTOCWidgetStickylistElementLinks = $.map(ezTOCWidgetStickyheadingToListElementLinkMap, function (value, key) {
|
||||
return value
|
||||
});
|
||||
var ezTOCWidgetStickyscrollOffset = ezTOCWidgetStickygetScrollOffset();
|
||||
|
||||
ezTOCWidgetStickyactivateSetActiveEzTocListElement();
|
||||
|
||||
function ezTOCWidgetStickysetActiveEzTocListElement() {
|
||||
var ezTOCWidgetStickyactiveHeading = ezTOCWidgetStickygetActiveHeading(ezTOCWidgetStickyscrollOffset, ezTOCWidgetStickyheadings);
|
||||
if (ezTOCWidgetStickyactiveHeading) {
|
||||
var ezTOCWidgetStickyactiveListElementLink = ezTOCWidgetStickyheadingToListElementLinkMap[ ezTOCWidgetStickyactiveHeading.id ];
|
||||
ezTOCWidgetStickyremoveStyleFromNonActiveListElement(ezTOCWidgetStickyactiveListElementLink, ezTOCWidgetStickylistElementLinks);
|
||||
ezTOCWidgetStickysetStyleForActiveListElementElement(ezTOCWidgetStickyactiveListElementLink);
|
||||
}
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickyactivateSetActiveEzTocListElement() {
|
||||
if (ezTOCWidgetStickyheadings.length > 0 && $('.ez-toc-widget-sticky-container').length) {
|
||||
$(window).on('load resize scroll', ezTOCWidgetStickysetActiveEzTocListElement);
|
||||
}
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickydeactivateSetActiveEzTocListElement() {
|
||||
$(window).off('load resize scroll', ezTOCWidgetStickysetActiveEzTocListElement);
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickygetEzTocListElementLinkByHeading(ezTOCWidgetStickyheading) {
|
||||
return $('.ez-toc-widget-sticky-container .ez-toc-widget-sticky-list a[href="#' + $(ezTOCWidgetStickyheading).attr('id') + '"]');
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickygetHeadingToListElementLinkMap(ezTOCWidgetStickyheadings) {
|
||||
return ezTOCWidgetStickyheadings.reduce(function (ezTOCWidgetStickymap, ezTOCWidgetStickyheading) {
|
||||
ezTOCWidgetStickymap[ ezTOCWidgetStickyheading.id ] = ezTOCWidgetStickygetEzTocListElementLinkByHeading(ezTOCWidgetStickyheading);
|
||||
return ezTOCWidgetStickymap;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickygetScrollOffset() {
|
||||
var ezTOCWidgetStickyscrollOffset = 30; // so if smooth offset is off, the correct title is set as active
|
||||
if (typeof ezTOC != 'undefined' && typeof ezTOC.smooth_scroll != 'undefined' && parseInt(ezTOC.smooth_scroll) === 1) {
|
||||
ezTOCWidgetStickyscrollOffset = (typeof ezTOC.scroll_offset != 'undefined') ? parseInt(ezTOC.scroll_offset) : 30;
|
||||
}
|
||||
|
||||
var adminbar = $('#wpadminbar');
|
||||
|
||||
if (adminbar.length) {
|
||||
ezTOCWidgetStickyscrollOffset += adminbar.height();
|
||||
}
|
||||
return ezTOCWidgetStickyscrollOffset;
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickygetActiveHeading(ezTOCWidgetStickytopOffset, ezTOCWidgetStickyheadings) {
|
||||
var ezTOCWidgetStickyscrollTop = $(window).scrollTop();
|
||||
var ezTOCWidgetStickyrelevantOffset = ezTOCWidgetStickyscrollTop + ezTOCWidgetStickytopOffset + 1;
|
||||
var ezTOCWidgetStickyactiveHeading = ezTOCWidgetStickyheadings[ 0 ];
|
||||
var ezTOCWidgetStickyclosestHeadingAboveOffset = ezTOCWidgetStickyrelevantOffset - $(ezTOCWidgetStickyactiveHeading).offset().top;
|
||||
ezTOCWidgetStickyheadings.forEach(function (ezTOCWidgetStickysection) {
|
||||
var ezTOCWidgetStickytopOffset = ezTOCWidgetStickyrelevantOffset - $(ezTOCWidgetStickysection).offset().top;
|
||||
if (ezTOCWidgetStickytopOffset > 0 && ezTOCWidgetStickytopOffset < ezTOCWidgetStickyclosestHeadingAboveOffset) {
|
||||
ezTOCWidgetStickyclosestHeadingAboveOffset = ezTOCWidgetStickytopOffset;
|
||||
ezTOCWidgetStickyactiveHeading = ezTOCWidgetStickysection;
|
||||
}
|
||||
});
|
||||
return ezTOCWidgetStickyactiveHeading;
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickyremoveStyleFromNonActiveListElement(ezTOCWidgetStickyactiveListElementLink, ezTOCWidgetStickylistElementLinks) {
|
||||
ezTOCWidgetStickylistElementLinks.forEach(function (ezTOCWidgetStickylistElementLink) {
|
||||
if (ezTOCWidgetStickyactiveListElementLink !== ezTOCWidgetStickylistElementLink && ezTOCWidgetStickylistElementLink.parent().hasClass('active')) {
|
||||
ezTOCWidgetStickylistElementLink.parent().removeClass('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickycorrectActiveListElementBackgroundColorHeight(ezTOCWidgetStickyactiveListElement) {
|
||||
var ezTOCWidgetStickylistElementHeight = ezTOCWidgetStickygetListElementHeightWithoutUlChildren(ezTOCWidgetStickyactiveListElement);
|
||||
ezTOCWidgetStickyaddListElementBackgroundColorHeightStyleToHead(ezTOCWidgetStickylistElementHeight);
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickygetListElementHeightWithoutUlChildren(ezTOCWidgetStickylistElement) {
|
||||
var $ezTOCWidgetStickylistElement = $(ezTOCWidgetStickylistElement);
|
||||
var ezTOCWidgetStickycontent = $ezTOCWidgetStickylistElement.html();
|
||||
// Adding list item with class '.active' to get the real height.
|
||||
// When adding a class to an existing element and using jQuery(..).height() directly afterwards,
|
||||
// the height is the 'old' height. The height might change due to text-wraps when setting the text-weight bold for example
|
||||
// When adding a new item, the height is calculated correctly.
|
||||
// But only when it might be visible (so display:none; is not possible...)
|
||||
// But because it get's directly removed afterwards it never will be rendered by the browser
|
||||
// (at least in my tests in FF, Chrome, IE11 and Edge)
|
||||
$ezTOCWidgetStickylistElement.parent().append('<li id="ez-toc-widget-sticky-height-test" class="active">' + ezTOCWidgetStickycontent + '</li>');
|
||||
var ezTOCWidgetStickylistItem = $('#ez-toc-widget-sticky-height-test');
|
||||
var ezTOCWidgetStickyheight = ezTOCWidgetStickylistItem.height();
|
||||
ezTOCWidgetStickylistItem.remove();
|
||||
return ezTOCWidgetStickyheight - $ezTOCWidgetStickylistElement.children('ul').first().height();
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickyaddListElementBackgroundColorHeightStyleToHead(ezTOCWidgetStickylistElementHeight) {
|
||||
// Remove existing
|
||||
$('#ez-toc-widget-sticky-active-height').remove();
|
||||
// jQuery(..).css(..) doesn't work, because ::before is a pseudo element and not part of the DOM
|
||||
// Workaround is to add it to head
|
||||
$('<style id="ez-toc-widget-sticky-active-height">' +
|
||||
'.ez-toc-widget-sticky-container ul.ez-toc-widget-sticky-list li.active {' +
|
||||
// 'line-heigh:' + listElementHeight + 'px; ' +
|
||||
'height:' + ezTOCWidgetStickylistElementHeight + 'px;' +
|
||||
'} </style>')
|
||||
.appendTo('head');
|
||||
}
|
||||
|
||||
function ezTOCWidgetStickysetStyleForActiveListElementElement(ezTOCWidgetStickyactiveListElementLink) {
|
||||
var ezTOCWidgetStickyactiveListElement = ezTOCWidgetStickyactiveListElementLink.parent();
|
||||
if (!ezTOCWidgetStickyactiveListElement.hasClass('active')) {
|
||||
ezTOCWidgetStickyactiveListElement.addClass('active');
|
||||
}
|
||||
ezTOCWidgetStickycorrectActiveListElementBackgroundColorHeight(ezTOCWidgetStickyactiveListElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* EzTOC Widget Dynamic Scrolling JS
|
||||
*
|
||||
* @since 2.0.41
|
||||
*/
|
||||
|
||||
setTimeout(function () {
|
||||
jQuery(window).on('load resize scroll', ezTOCWidgetStickysetScrollActiveEzTocListElement);
|
||||
}, 100);
|
||||
|
||||
var ezTocActiveList = '';
|
||||
function ezTOCWidgetStickysetScrollActiveEzTocListElement(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (jQuery(document).width() > 980 && jQuery(window).scrollTop() >= ezTocWidgetSticky.scroll_fixed_position && (jQuery('.post,.post-content').length == 0 || jQuery('.post,.post-content').length > 0 && jQuery(window).scrollTop() <= jQuery('.post,.post-content').height())) {
|
||||
jQuery('.ez-toc-widget-sticky').css({
|
||||
'position': 'fixed',
|
||||
'width': (ezTocWidgetSticky.sidebar_width != 'auto') ? ezTocWidgetSticky.sidebar_width + '' + ezTocWidgetSticky.sidebar_width_size_unit : $('#ez-toc-widget-sticky-container').parents('.widget-area').width(),
|
||||
'top': (ezTocWidgetSticky.fixed_top_position != '30') ? ezTocWidgetSticky.fixed_top_position + '' + ezTocWidgetSticky.fixed_top_position_size_unit : '30px',
|
||||
'z-index': '9999999',
|
||||
'background-color': jQuery(document).find('body').css("background-color"),
|
||||
});
|
||||
jQuery('.ez-toc-widget-sticky nav').css({
|
||||
'overflow-y': (ezTocWidgetSticky.navigation_scroll_bar == 'on') ? 'auto' : 'hidden',
|
||||
'max-height': (ezTocWidgetSticky.scroll_max_height != 'auto') ? ezTocWidgetSticky.scroll_max_height + '' + ezTocWidgetSticky.scroll_max_height_size_unit : 'calc(100vh - 111px)'
|
||||
});
|
||||
} else {
|
||||
jQuery('.ez-toc-widget-sticky,.ez-toc-widget-sticky nav').attr('style', false);
|
||||
}
|
||||
var ezTocHrefActive = jQuery("#ez-toc-widget-sticky-container li.active a").attr('href');
|
||||
var ezTocLastChild = "#ez-toc-widget-sticky-container nav>ul>li:last-child a";
|
||||
let ezTocOffsetTopDynamic = Math.round(jQuery("#ez-toc-widget-sticky-container .ez-toc-link[href='" + ezTocHrefActive + "']").position().top);
|
||||
var ezTocLastChildTop = Math.round(jQuery(ezTocLastChild).position().top);
|
||||
if (ezTocHrefActive != ezTocActiveList) {
|
||||
jQuery('.ez-toc-widget-sticky nav').scrollTop(Math.round(jQuery('.ez-toc-widget-sticky nav').scrollTop() + ezTocOffsetTopDynamic) - 50);
|
||||
}
|
||||
ezTocActiveList = ezTocHrefActive;
|
||||
}
|
||||
});
|
1
wp-content/plugins/easy-table-of-contents/assets/js/ez-toc-widget-sticky.min.js
vendored
Normal file
1
wp-content/plugins/easy-table-of-contents/assets/js/ez-toc-widget-sticky.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
jQuery(function(t){var i,e,o,c=t("span.ez-toc-section").toArray(),s=(i=c,i.reduce(function(i,e){var o;return i[e.id]=t('.ez-toc-widget-sticky-container .ez-toc-widget-sticky-list a[href="#'+t(o=e).attr("id")+'"]'),i},{})),n=t.map(s,function(t,i){return t}),a=(e=30,"undefined"!=typeof ezTOC&&void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(e=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),o=t("#wpadminbar"),o.length&&(e+=o.height()),e);function r(){var i,e,o,r,l,d=(i=a,e=c,o=t(window).scrollTop()+i+1,r=e[0],l=o-t(r).offset().top,e.forEach(function(i){var e=o-t(i).offset().top;e>0&&e<l&&(l=e,r=i)}),r);if(d){var h,p,g,f,v,u,w,z,y,k=s[d.id];(function t(i,e){e.forEach(function(t){i!==t&&t.parent().hasClass("active")&&t.parent().removeClass("active")})})(k,n),(g=(h=k).parent()).hasClass("active")||g.addClass("active"),y=(f=p=g,v=t(f),u=v.html(),v.parent().append('<li id="ez-toc-widget-sticky-height-test" class="active">'+u+"</li>"),w=t("#ez-toc-widget-sticky-height-test"),z=w.height(),w.remove(),z-v.children("ul").first().height()),t("#ez-toc-widget-sticky-active-height").remove(),t('<style id="ez-toc-widget-sticky-active-height">.ez-toc-widget-sticky-container ul.ez-toc-widget-sticky-list li.active {height:'+y+"px;} </style>").appendTo("head")}}function l(){t(window).off("load resize scroll",r)}c.length>0&&t(".ez-toc-widget-sticky-container").length&&t(window).on("load resize scroll",r),setTimeout(function(){jQuery(window).on("load resize scroll",h)},100);var d="";function h(i){i.preventDefault(),jQuery(document).width()>980&&jQuery(window).scrollTop()>=ezTocWidgetSticky.scroll_fixed_position&&(0==jQuery(".post,.post-content").length||jQuery(".post,.post-content").length>0&&jQuery(window).scrollTop()<=jQuery(".post,.post-content").height())?(jQuery(".ez-toc-widget-sticky").css({position:"fixed",width:"auto"!=ezTocWidgetSticky.sidebar_width?ezTocWidgetSticky.sidebar_width+""+ezTocWidgetSticky.sidebar_width_size_unit:t("#ez-toc-widget-sticky-container").parents(".widget-area").width(),top:"30"!=ezTocWidgetSticky.fixed_top_position?ezTocWidgetSticky.fixed_top_position+""+ezTocWidgetSticky.fixed_top_position_size_unit:"30px","z-index":"9999999","background-color":jQuery(document).find("body").css("background-color")}),jQuery(".ez-toc-widget-sticky nav").css({"overflow-y":"on"==ezTocWidgetSticky.navigation_scroll_bar?"auto":"hidden","max-height":"auto"!=ezTocWidgetSticky.scroll_max_height?ezTocWidgetSticky.scroll_max_height+""+ezTocWidgetSticky.scroll_max_height_size_unit:"calc(100vh - 111px)"})):jQuery(".ez-toc-widget-sticky,.ez-toc-widget-sticky nav").attr("style",!1);var e=jQuery("#ez-toc-widget-sticky-container li.active a").attr("href");let o=Math.round(jQuery("#ez-toc-widget-sticky-container .ez-toc-link[href='"+e+"']").position().top);jQuery("#ez-toc-widget-sticky-container nav>ul>li:last-child a").position().top,e!=d&&jQuery(".ez-toc-widget-sticky nav").scrollTop(Math.round(jQuery(".ez-toc-widget-sticky nav").scrollTop()+o)-50),d=e}});
|
@ -0,0 +1,157 @@
|
||||
function ezTocTabToggle(evt, idname, tabContentClass = 'eztoc-tabcontent', tabLinksClass = 'eztoc-tablinks') {
|
||||
var i, tabcontent, tablinks;
|
||||
evt.preventDefault();
|
||||
tabcontent = document.getElementsByClassName(tabContentClass);
|
||||
for (i = 0; i < tabcontent.length; i++) {
|
||||
tabcontent[i].style.display = "none";
|
||||
}
|
||||
tablinks = document.getElementsByClassName(tabLinksClass);
|
||||
for (i = 0; i < tablinks.length; i++) {
|
||||
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
||||
}
|
||||
document.getElementById(idname).style.display = "block";
|
||||
|
||||
evt.target.className += " active";
|
||||
}
|
||||
|
||||
function eztocIsEmail(email) {
|
||||
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
|
||||
return regex.test(email);
|
||||
}
|
||||
|
||||
|
||||
//query form send starts here
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
var url = window.location.href;
|
||||
if (url.indexOf('#technical-support') > -1) {
|
||||
$("#eztoc-technical").click();
|
||||
} else if (url.indexOf('#freevspro-support') > -1) {
|
||||
$("#eztoc-freevspro").click();
|
||||
} else if (url.indexOf('#welcome') > -1) {
|
||||
$("#eztoc-welcome").click();
|
||||
} else {
|
||||
$("#eztoc-default").click();
|
||||
}
|
||||
|
||||
$(".eztoc-send-query").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
var message = $("#eztoc_query_message").val();
|
||||
var email = $("#eztoc_query_email").val();
|
||||
var premium_cus = $("#saswp_query_premium_cus").val();
|
||||
|
||||
if ($.trim(message) != '' && $.trim(email) != '' && eztocIsEmail(email) == true) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
dataType: "json",
|
||||
data: {
|
||||
action: "eztoc_send_query_message",
|
||||
message: message,
|
||||
email: email,
|
||||
eztoc_security_nonce: eztoc_admin_data.eztoc_security_nonce
|
||||
},
|
||||
success: function (response) {
|
||||
if (response['status'] == 't') {
|
||||
$(".eztoc-query-success").show();
|
||||
$(".eztoc-query-error").hide();
|
||||
} else {
|
||||
$(".eztoc-query-success").hide();
|
||||
$(".eztoc-query-error").show();
|
||||
}
|
||||
},
|
||||
error: function (response) {
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
if ($.trim(message) == '' && $.trim(email) == '') {
|
||||
alert('Please enter the message, email and select customer type');
|
||||
} else {
|
||||
|
||||
if ($.trim(message) == '') {
|
||||
alert('Please enter the message');
|
||||
}
|
||||
if ($.trim(email) == '') {
|
||||
alert('Please enter the email');
|
||||
}
|
||||
if (eztocIsEmail(email) == false) {
|
||||
alert('Please enter a valid email');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#subscribe-newsletter-form").on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#subscribe-newsletter-form");
|
||||
var name = $form.find('input[name="name"]').val();
|
||||
var email = $form.find('input[name="email"]').val();
|
||||
var website = $form.find('input[name="company"]').val();
|
||||
$.post(ajaxurl, {action: 'eztoc_subscribe_newsletter', name: name, email: email, website: website, eztoc_security_nonce: eztoc_admin_data.eztoc_security_nonce},
|
||||
function (data) {
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
let stickyToggleCheckbox = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky-toggle]']");
|
||||
let stickyToggleWidth = $('#eztoc-sticky').find("select[name='ez-toc-settings[sticky-toggle-width]']");
|
||||
let stickyToggleWidthCustom = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky-toggle-width-custom]']");
|
||||
let stickyToggleHeight = $('#eztoc-sticky').find("select[name='ez-toc-settings[sticky-toggle-height]']");
|
||||
let stickyToggleHeightCustom = $('#eztoc-sticky').find("input[name='ez-toc-settings[sticky-toggle-height-custom]']");
|
||||
|
||||
if($(stickyToggleCheckbox).prop('checked') == false) {
|
||||
$('#eztoc-sticky').find('tr:not(:first-child)').hide(500);
|
||||
}
|
||||
|
||||
$(document).on("change", "input[name='ez-toc-settings[sticky-toggle]']", function() {
|
||||
|
||||
if($(stickyToggleCheckbox).prop('checked') == true) {
|
||||
|
||||
$('#eztoc-sticky').find('tr:not(:first-child)').show(500);
|
||||
|
||||
if($(stickyToggleWidth).val() == '' || $(stickyToggleWidth).val() != 'custom'){
|
||||
$(stickyToggleWidthCustom).parents('tr').hide();
|
||||
}
|
||||
if($(stickyToggleHeight).val() == '' || $(stickyToggleHeight).val() != 'custom'){
|
||||
$(stickyToggleHeightCustom).parents('tr').hide();
|
||||
}
|
||||
} else {
|
||||
$('#eztoc-sticky').find('tr:not(:first-child)').hide(500);
|
||||
}
|
||||
|
||||
});
|
||||
update_sticky_width_field(stickyToggleWidth.val());
|
||||
update_sticky_height_field(stickyToggleHeight.val());
|
||||
|
||||
$(document).on("change", "select[name='ez-toc-settings[sticky-toggle-width]']", function() {
|
||||
update_sticky_width_field($(this).val());
|
||||
});
|
||||
|
||||
$(document).on("change", "select[name='ez-toc-settings[sticky-toggle-height]']", function() {
|
||||
update_sticky_height_field($(this).val());
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function update_sticky_width_field(width){
|
||||
let stickyToggleWidthCustom = jQuery('#eztoc-sticky').find("input[name='ez-toc-settings[sticky-toggle-width-custom]']");
|
||||
if(width == 'custom') {
|
||||
jQuery(stickyToggleWidthCustom).parents('tr').show(500);
|
||||
} else {
|
||||
jQuery(stickyToggleWidthCustom).parents('tr').hide(500);
|
||||
}
|
||||
}
|
||||
|
||||
function update_sticky_height_field(height){
|
||||
let stickyToggleHeightCustom = jQuery('#eztoc-sticky').find("input[name='ez-toc-settings[sticky-toggle-height-custom]']");
|
||||
if(height == 'custom') {
|
||||
jQuery(stickyToggleHeightCustom).parents('tr').show(500);
|
||||
} else {
|
||||
jQuery(stickyToggleHeightCustom).parents('tr').hide(500);
|
||||
}
|
||||
}
|
1
wp-content/plugins/easy-table-of-contents/assets/js/eztoc-admin.min.js
vendored
Normal file
1
wp-content/plugins/easy-table-of-contents/assets/js/eztoc-admin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
function ezTocTabToggle(e,t,c="eztoc-tabcontent",i="eztoc-tablinks"){var s,n,o;for(e.preventDefault(),n=document.getElementsByClassName(c),s=0;s<n.length;s++)n[s].style.display="none";for(o=document.getElementsByClassName(i),s=0;s<o.length;s++)o[s].className=o[s].className.replace(" active","");document.getElementById(t).style.display="block",e.target.className+=" active"}function eztocIsEmail(e){return/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e)}function update_sticky_width_field(e){let t=jQuery("#eztoc-sticky").find("input[name='ez-toc-settings[sticky-toggle-width-custom]']");"custom"==e?jQuery(t).parents("tr").show(500):jQuery(t).parents("tr").hide(500)}function update_sticky_height_field(e){let t=jQuery("#eztoc-sticky").find("input[name='ez-toc-settings[sticky-toggle-height-custom]']");"custom"==e?jQuery(t).parents("tr").show(500):jQuery(t).parents("tr").hide(500)}jQuery(document).ready((function(e){var t=window.location.href;t.indexOf("#technical-support")>-1?e("#eztoc-technical").click():t.indexOf("#freevspro-support")>-1?e("#eztoc-freevspro").click():t.indexOf("#welcome")>-1?e("#eztoc-welcome").click():e("#eztoc-default").click(),e(".eztoc-send-query").on("click",(function(t){t.preventDefault();var c=e("#eztoc_query_message").val(),i=e("#eztoc_query_email").val();e("#saswp_query_premium_cus").val();""!=e.trim(c)&&""!=e.trim(i)&&1==eztocIsEmail(i)?e.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"eztoc_send_query_message",message:c,email:i,eztoc_security_nonce:eztoc_admin_data.eztoc_security_nonce},success:function(t){"t"==t.status?(e(".eztoc-query-success").show(),e(".eztoc-query-error").hide()):(e(".eztoc-query-success").hide(),e(".eztoc-query-error").show())},error:function(e){console.log(e)}}):""==e.trim(c)&&""==e.trim(i)?alert("Please enter the message, email and select customer type"):(""==e.trim(c)&&alert("Please enter the message"),""==e.trim(i)&&alert("Please enter the email"),0==eztocIsEmail(i)&&alert("Please enter a valid email"))})),e("#subscribe-newsletter-form").on("submit",(function(t){t.preventDefault();var c=e("#subscribe-newsletter-form"),i=c.find('input[name="name"]').val(),s=c.find('input[name="email"]').val(),n=c.find('input[name="company"]').val();e.post(ajaxurl,{action:"eztoc_subscribe_newsletter",name:i,email:s,website:n,eztoc_security_nonce:eztoc_admin_data.eztoc_security_nonce},(function(e){}))})),e(".eztoc-set-pos-btn").hide(),e("[name='ez-toc-settings[fixedtoc]']").on("click",(function(t){e(this).is(":checked")?(e(".eztoc-set-pos-btn").show(),console.log("checkbox checked")):(e(".eztoc-set-pos-btn").hide(),console.log("checkbox unchecked"))}));let c=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky-toggle]']"),i=e("#eztoc-sticky").find("select[name='ez-toc-settings[sticky-toggle-width]']"),s=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky-toggle-width-custom]']"),n=e("#eztoc-sticky").find("select[name='ez-toc-settings[sticky-toggle-height]']"),o=e("#eztoc-sticky").find("input[name='ez-toc-settings[sticky-toggle-height-custom]']");0==e(c).prop("checked")&&e("#eztoc-sticky").find("tr:not(:first-child)").hide(500),e(document).on("change","input[name='ez-toc-settings[sticky-toggle]']",(function(){1==e(c).prop("checked")?(e("#eztoc-sticky").find("tr:not(:first-child)").show(500),""!=e(i).val()&&"custom"==e(i).val()||e(s).parents("tr").hide(),""!=e(n).val()&&"custom"==e(n).val()||e(o).parents("tr").hide()):e("#eztoc-sticky").find("tr:not(:first-child)").hide(500)})),update_sticky_width_field(i.val()),update_sticky_height_field(n.val()),e(document).on("change","select[name='ez-toc-settings[sticky-toggle-width]']",(function(){update_sticky_width_field(e(this).val())})),e(document).on("change","select[name='ez-toc-settings[sticky-toggle-height]']",(function(){update_sticky_height_field(e(this).val())}))}));
|
302
wp-content/plugins/easy-table-of-contents/assets/js/front.js
Normal file
302
wp-content/plugins/easy-table-of-contents/assets/js/front.js
Normal file
@ -0,0 +1,302 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
/**
|
||||
* @typedef ezTOC
|
||||
* @type {Object} ezTOC
|
||||
* @property {string} affixSelector
|
||||
* @property {string} scroll_offset
|
||||
* @property {string} smooth_scroll
|
||||
* @property {string} visibility_hide_by_default
|
||||
*/
|
||||
|
||||
if ( typeof ezTOC != 'undefined' ) {
|
||||
|
||||
/**
|
||||
* Init EZ TOC.
|
||||
*/
|
||||
function ezTOCInit() {
|
||||
|
||||
var affix = $( '.ez-toc-widget-container.ez-toc-affix' );
|
||||
|
||||
if ( 0 !== affix.length ) {
|
||||
|
||||
/**
|
||||
* The smooth scroll offset needs to be taken into account when defining the offset_top property.
|
||||
* @link https://github.com/shazahm1/Easy-Table-of-Contents/issues/19
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
var affixOffset = 30;
|
||||
|
||||
// check offset setting
|
||||
if ( typeof ezTOC.scroll_offset != 'undefined' ) {
|
||||
|
||||
affixOffset = parseInt( ezTOC.scroll_offset );
|
||||
}
|
||||
|
||||
$( ezTOC.affixSelector ).stick_in_parent( {
|
||||
inner_scrolling: false,
|
||||
offset_top: affixOffset
|
||||
} )
|
||||
}
|
||||
|
||||
$.fn.shrinkTOCWidth = function() {
|
||||
|
||||
$( this ).css( {
|
||||
width: 'auto',
|
||||
display: 'table'
|
||||
});
|
||||
|
||||
if ( /MSIE 7\./.test( navigator.userAgent ) )
|
||||
$( this ).css( 'width', '' );
|
||||
};
|
||||
|
||||
|
||||
if ( typeof ezTOC.visibility_hide_by_default != 'undefined' ) {
|
||||
|
||||
// Get all toggles that have not been loaded.
|
||||
var toggles = $( '.ez-toc-toggle:not(.ez-toc-loaded),.ez-toc-widget-sticky-toggle:not(.ez-toc-loaded)' );
|
||||
|
||||
var invert = ezTOC.visibility_hide_by_default;
|
||||
|
||||
$.each(toggles, function(i, obj) {
|
||||
|
||||
var toggle = $(this);
|
||||
$(toggle).addClass('ez-toc-loaded'); // Attach loaded class.
|
||||
var toc = $( toggle ).parents('#ez-toc-container,#ez-toc-widget-container,#ez-toc-widget-sticky-container').find( 'ul.ez-toc-list,ul.ez-toc-widget-sticky-list' );
|
||||
if($(toc).hasClass('eztoc-toggle-hide-by-default')){
|
||||
invert = 1;
|
||||
}
|
||||
if ( Cookies ) {
|
||||
|
||||
Cookies.get( 'ezTOC_hidetoc-' + i ) == 1 ? $(toggle).data( 'visible', false ) : $(toggle).data( 'visible', true );
|
||||
Cookies.remove('ezTOC_hidetoc-' + i)
|
||||
|
||||
} else {
|
||||
|
||||
$(toggle).data( 'visible', true );
|
||||
Cookies.remove('ezTOC_hidetoc-' + i);
|
||||
}
|
||||
|
||||
if ( invert ) {
|
||||
|
||||
$(toggle).data( 'visible', false )
|
||||
}
|
||||
|
||||
if ( ! $(toggle).data( 'visible' ) ) {
|
||||
|
||||
toc.hide();
|
||||
}
|
||||
|
||||
$(toggle).on( 'click', function( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const main = document.querySelector("#ez-toc-container");
|
||||
if(main){
|
||||
main.classList.toggle("toc_close");
|
||||
}
|
||||
else
|
||||
{
|
||||
const side = document.querySelector(".ez-toc-widget-container,.ez-toc-widget-sticky-container");
|
||||
side.classList.toggle("toc_close");
|
||||
}
|
||||
|
||||
if ( $( this ).data( 'visible' ) ) {
|
||||
|
||||
$( this ).data( 'visible', false );
|
||||
|
||||
if ( Cookies ) {
|
||||
|
||||
if ( invert )
|
||||
Cookies.set( 'ezTOC_hidetoc-' + i, null, { path: '/' } );
|
||||
else
|
||||
Cookies.set( 'ezTOC_hidetoc-' + i, '1', { expires: 30, path: '/' } );
|
||||
}
|
||||
|
||||
toc.hide( 'fast' );
|
||||
|
||||
} else {
|
||||
|
||||
$( this ).data( 'visible', true );
|
||||
|
||||
if ( Cookies ) {
|
||||
|
||||
if ( invert )
|
||||
Cookies.set( 'ezTOC_hidetoc-' + i, '1', { expires: 30, path: '/' } );
|
||||
else
|
||||
Cookies.set( 'ezTOC_hidetoc-' + i, null, { path: '/' } );
|
||||
}
|
||||
|
||||
toc.show( 'fast' );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ======================================
|
||||
// Set active heading in ez-toc-widget list
|
||||
// ======================================
|
||||
|
||||
var headings = $( 'span.ez-toc-section' ).toArray();
|
||||
var headingToListElementLinkMap = getHeadingToListElementLinkMap( headings );
|
||||
var listElementLinks = $.map( headingToListElementLinkMap, function ( value, key ) {
|
||||
return value
|
||||
} );
|
||||
var scrollOffset = getScrollOffset();
|
||||
|
||||
activateSetActiveEzTocListElement();
|
||||
|
||||
function setActiveEzTocListElement() {
|
||||
var activeHeading = getActiveHeading( scrollOffset, headings );
|
||||
if ( activeHeading ) {
|
||||
var activeListElementLink = headingToListElementLinkMap[ activeHeading.id ];
|
||||
removeStyleFromNonActiveListElement( activeListElementLink, listElementLinks );
|
||||
setStyleForActiveListElementElement( activeListElementLink );
|
||||
}
|
||||
}
|
||||
|
||||
function activateSetActiveEzTocListElement() {
|
||||
if ( headings.length > 0 && $('.ez-toc-widget-container').length) {
|
||||
$( window ).on( 'load resize scroll', setActiveEzTocListElement );
|
||||
}
|
||||
}
|
||||
|
||||
function deactivateSetActiveEzTocListElement() {
|
||||
$( window ).off( 'load resize scroll', setActiveEzTocListElement );
|
||||
}
|
||||
|
||||
function getEzTocListElementLinkByHeading( heading ) {
|
||||
return $( '.ez-toc-widget-container .ez-toc-list a[href="#' + $( heading ).attr( 'id' ) + '"]' );
|
||||
}
|
||||
|
||||
function getHeadingToListElementLinkMap( headings ) {
|
||||
return headings.reduce( function ( map, heading ) {
|
||||
map[ heading.id ] = getEzTocListElementLinkByHeading( heading );
|
||||
return map;
|
||||
}, {} );
|
||||
}
|
||||
|
||||
function getScrollOffset() {
|
||||
var scrollOffset = 5; // so if smooth offset is off, the correct title is set as active
|
||||
if ( typeof ezTOC.smooth_scroll != 'undefined' && parseInt( ezTOC.smooth_scroll ) === 1 ) {
|
||||
scrollOffset = ( typeof ezTOC.scroll_offset != 'undefined' ) ? parseInt( ezTOC.scroll_offset ) : 30;
|
||||
}
|
||||
|
||||
var adminbar = $( '#wpadminbar' );
|
||||
|
||||
if ( adminbar.length ) {
|
||||
scrollOffset += adminbar.height();
|
||||
}
|
||||
return scrollOffset;
|
||||
}
|
||||
|
||||
function getActiveHeading( topOffset, headings ) {
|
||||
var scrollTop = $( window ).scrollTop();
|
||||
var relevantOffset = scrollTop + topOffset + 1;
|
||||
var activeHeading = headings[ 0 ];
|
||||
var closestHeadingAboveOffset = relevantOffset - $( activeHeading ).offset().top;
|
||||
headings.forEach( function ( section ) {
|
||||
var topOffset = relevantOffset - $( section ).offset().top;
|
||||
if ( topOffset > 0 && topOffset < closestHeadingAboveOffset ) {
|
||||
closestHeadingAboveOffset = topOffset;
|
||||
activeHeading = section;
|
||||
}
|
||||
} );
|
||||
return activeHeading;
|
||||
}
|
||||
|
||||
function removeStyleFromNonActiveListElement( activeListElementLink, listElementLinks ) {
|
||||
listElementLinks.forEach( function ( listElementLink ) {
|
||||
if ( activeListElementLink !== listElementLink && listElementLink.parent().hasClass( 'active' ) ) {
|
||||
listElementLink.parent().removeClass( 'active' );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function correctActiveListElementBackgroundColorHeight( activeListElement ) {
|
||||
var listElementHeight = getListElementHeightWithoutUlChildren( activeListElement );
|
||||
addListElementBackgroundColorHeightStyleToHead( listElementHeight );
|
||||
}
|
||||
|
||||
function getListElementHeightWithoutUlChildren( listElement ) {
|
||||
var $listElement = $( listElement );
|
||||
var content = $listElement.html();
|
||||
// Adding list item with class '.active' to get the real height.
|
||||
// When adding a class to an existing element and using jQuery(..).height() directly afterwards,
|
||||
// the height is the 'old' height. The height might change due to text-wraps when setting the text-weight bold for example
|
||||
// When adding a new item, the height is calculated correctly.
|
||||
// But only when it might be visible (so display:none; is not possible...)
|
||||
// But because it get's directly removed afterwards it never will be rendered by the browser
|
||||
// (at least in my tests in FF, Chrome, IE11 and Edge)
|
||||
$listElement.parent().append( '<li id="ez-toc-height-test" class="active">' + content + '</li>' );
|
||||
var listItem = $( '#ez-toc-height-test' );
|
||||
var height = listItem.height();
|
||||
listItem.remove();
|
||||
return height - ($listElement.children( 'ul' ).first().height() || 0);
|
||||
}
|
||||
|
||||
function addListElementBackgroundColorHeightStyleToHead( listElementHeight ) {
|
||||
// Remove existing
|
||||
//$( '#ez-toc-active-height' ).remove();
|
||||
// jQuery(..).css(..) doesn't work, because ::before is a pseudo element and not part of the DOM
|
||||
// Workaround is to add it to head
|
||||
// $( '<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active {height:' + listElementHeight + 'px;' + '} </style>' ).appendTo( 'head' );
|
||||
$( '.ez-toc-widget-container ul.ez-toc-list li.active' ).css( 'height',listElementHeight + 'px' );
|
||||
}
|
||||
|
||||
function setStyleForActiveListElementElement( activeListElementLink ) {
|
||||
var activeListElement = activeListElementLink.parent();
|
||||
if ( !activeListElement.hasClass( 'active' ) ) {
|
||||
activeListElement.addClass( 'active' );
|
||||
}
|
||||
correctActiveListElementBackgroundColorHeight( activeListElement );
|
||||
}
|
||||
}
|
||||
if($( '#ez-toc-container').length){
|
||||
if(!$( '#ez-toc-container .ez-toc-toggle label span').html()){
|
||||
$( '#ez-toc-container .ez-toc-toggle label').html(ezTOC.fallbackIcon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach global init handler to ezTOC window object.
|
||||
*/
|
||||
ezTOC.init = function(){
|
||||
ezTOCInit();
|
||||
}
|
||||
// Start EZ TOC on page load.
|
||||
ezTOCInit();
|
||||
|
||||
if ( typeof ezTOC.ajax_toggle != 'undefined' && parseInt( ezTOC.ajax_toggle ) === 1 ) {
|
||||
$( document ).ajaxComplete(function() {
|
||||
ezTOCInit();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
$("#ez-toc-more-links-enabler").click(function () {
|
||||
$(".ez-toc-more-link").show();
|
||||
$("#ez-toc-more-links-enabler").hide();
|
||||
$("#ez-toc-more-links-disabler").attr("style","display:inline-block");
|
||||
});
|
||||
$("#ez-toc-more-links-disabler").click(function () {
|
||||
$(".ez-toc-more-link").hide();
|
||||
$("#ez-toc-more-links-enabler").show();
|
||||
$("#ez-toc-more-links-disabler").hide();
|
||||
});
|
||||
|
||||
$(document).on('click', '#ez-toc-open-sub-hd', function(e) {
|
||||
$(this).attr("id","ez-toc-open-sub-hd-active");
|
||||
e.preventDefault();
|
||||
});
|
||||
$(document).on('click', '#ez-toc-open-sub-hd-active', function(e) {
|
||||
$(this).attr("id","ez-toc-open-sub-hd");
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
} );
|
1
wp-content/plugins/easy-table-of-contents/assets/js/front.min.js
vendored
Normal file
1
wp-content/plugins/easy-table-of-contents/assets/js/front.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
jQuery((function(e){if("undefined"!=typeof ezTOC){function t(){if(0!==e(".ez-toc-widget-container.ez-toc-affix").length){var t=30;void 0!==ezTOC.scroll_offset&&(t=parseInt(ezTOC.scroll_offset)),e(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:t})}if(e.fn.shrinkTOCWidth=function(){e(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&e(this).css("width","")},void 0!==ezTOC.visibility_hide_by_default){var o=e(".ez-toc-toggle:not(.ez-toc-loaded),.ez-toc-widget-sticky-toggle:not(.ez-toc-loaded)"),i=ezTOC.visibility_hide_by_default;e.each(o,(function(t,o){var n=e(this);e(n).addClass("ez-toc-loaded");var c=e(n).parents("#ez-toc-container,#ez-toc-widget-container,#ez-toc-widget-sticky-container").find("ul.ez-toc-list,ul.ez-toc-widget-sticky-list");e(c).hasClass("eztoc-toggle-hide-by-default")&&(i=1),Cookies?(1==Cookies.get("ezTOC_hidetoc-"+t)?e(n).data("visible",!1):e(n).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+t)):(e(n).data("visible",!0),Cookies.remove("ezTOC_hidetoc-"+t)),i&&e(n).data("visible",!1),e(n).data("visible")||c.hide(),e(n).on("click",(function(o){o.preventDefault();const n=document.querySelector("#ez-toc-container");if(n)n.classList.toggle("toc_close");else{document.querySelector(".ez-toc-widget-container,.ez-toc-widget-sticky-container").classList.toggle("toc_close")}e(this).data("visible")?(e(this).data("visible",!1),Cookies&&(i?Cookies.set("ezTOC_hidetoc-"+t,null,{path:"/"}):Cookies.set("ezTOC_hidetoc-"+t,"1",{expires:30,path:"/"})),c.hide("fast")):(e(this).data("visible",!0),Cookies&&(i?Cookies.set("ezTOC_hidetoc-"+t,"1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc-"+t,null,{path:"/"})),c.show("fast"))}))}))}var n=e("span.ez-toc-section").toArray(),c=function(t){return t.reduce((function(t,o){return t[o.id]=function(t){return e('.ez-toc-widget-container .ez-toc-list a[href="#'+e(t).attr("id")+'"]')}(o),t}),{})}(n),a=e.map(c,(function(e,t){return e})),s=function(){var t=5;void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(t=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30);var o=e("#wpadminbar");o.length&&(t+=o.height());return t}();function l(){var t=function(t,o){var i=e(window).scrollTop()+t+1,n=o[0],c=i-e(n).offset().top;return o.forEach((function(t){var o=i-e(t).offset().top;o>0&&o<c&&(c=o,n=t)})),n}(s,n);if(t){var o=c[t.id];!function(e,t){t.forEach((function(t){e!==t&&t.parent().hasClass("active")&&t.parent().removeClass("active")}))}(o,a),function(t){var o=t.parent();o.hasClass("active")||o.addClass("active");!function(t){var o=function(t){var o=e(t),i=o.html();o.parent().append('<li id="ez-toc-height-test" class="active">'+i+"</li>");var n=e("#ez-toc-height-test"),c=n.height();return n.remove(),c-(o.children("ul").first().height()||0)}(t);!function(t){e(".ez-toc-widget-container ul.ez-toc-list li.active").css("height",t+"px")}(o)}(o)}(o)}}n.length>0&&e(".ez-toc-widget-container").length&&e(window).on("load resize scroll",l)}e("#ez-toc-container").length&&(e("#ez-toc-container .ez-toc-toggle label span").html()||e("#ez-toc-container .ez-toc-toggle label").html(ezTOC.fallbackIcon)),ezTOC.init=function(){t()},t(),void 0!==ezTOC.ajax_toggle&&1===parseInt(ezTOC.ajax_toggle)&&e(document).ajaxComplete((function(){t()}))}e("#ez-toc-more-links-enabler").click((function(){e(".ez-toc-more-link").show(),e("#ez-toc-more-links-enabler").hide(),e("#ez-toc-more-links-disabler").attr("style","display:inline-block")})),e("#ez-toc-more-links-disabler").click((function(){e(".ez-toc-more-link").hide(),e("#ez-toc-more-links-enabler").show(),e("#ez-toc-more-links-disabler").hide()})),e(document).on("click","#ez-toc-open-sub-hd",(function(t){e(this).attr("id","ez-toc-open-sub-hd-active"),t.preventDefault()})),e(document).on("click","#ez-toc-open-sub-hd-active",(function(t){e(this).attr("id","ez-toc-open-sub-hd"),t.preventDefault()}))}));
|
@ -0,0 +1,35 @@
|
||||
jQuery(document).ready((function() {
|
||||
var e = !1;
|
||||
void 0 !== eztoc_smooth_local.JumpJsLinks && 1 === parseInt(eztoc_smooth_local.JumpJsLinks) && (e = !0), document.querySelectorAll(".ez-toc-link").forEach((e => {
|
||||
e = e.replaceWith(e.cloneNode(!0))
|
||||
})), document.querySelectorAll(".ez-toc-section").forEach((e => {
|
||||
e.setAttribute("ez-toc-data-id", "#" + decodeURI(e.getAttribute("id")))
|
||||
})), jQuery("a.ez-toc-link").click((function() {
|
||||
|
||||
let dhref = jQuery(this).attr("data-href");
|
||||
let ahref = jQuery(this).attr("href");
|
||||
|
||||
if(1 === parseInt(eztoc_smooth_local.add_request_uri)){
|
||||
if(jQuery(this).attr("data-href")){
|
||||
let dsplit = jQuery(this).attr("data-href").split("#");
|
||||
if(dsplit && dsplit.length > 1){
|
||||
dhref = `#${dsplit[1]}`;
|
||||
}
|
||||
}
|
||||
if(jQuery(this).attr("href")){
|
||||
let asplit = jQuery(this).attr("href").split("#");
|
||||
if(asplit && asplit.length > 1){
|
||||
ahref = `#${asplit[1]}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let t = e ? dhref : ahref,
|
||||
o = jQuery("#wpadminbar"),
|
||||
c = jQuery("header"),
|
||||
r = 0;
|
||||
if (parseInt(eztoc_smooth_local.scroll_offset) > 30 && (r = parseInt(eztoc_smooth_local.scroll_offset)), o.length && (r += o.height()), (c.length && "fixed" == c.css("position") || "sticky" == c.css("position")) && (r += c.height()), jQuery('[ez-toc-data-id="' + decodeURI(t) + '"]').length > 0 && (r = jQuery('[ez-toc-data-id="' + decodeURI(t) + '"]').offset().top - r), jQuery("html, body").animate({
|
||||
scrollTop: r
|
||||
}, 500), e) return !1
|
||||
}))
|
||||
}));
|
1
wp-content/plugins/easy-table-of-contents/assets/js/smooth_scroll.min.js
vendored
Normal file
1
wp-content/plugins/easy-table-of-contents/assets/js/smooth_scroll.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(){var t=!1;void 0!==eztoc_smooth_local.JumpJsLinks&&1===parseInt(eztoc_smooth_local.JumpJsLinks)&&(t=!0),document.querySelectorAll(".ez-toc-link").forEach(t=>{t=t.replaceWith(t.cloneNode(!0))}),document.querySelectorAll(".ez-toc-section").forEach(t=>{t.setAttribute("ez-toc-data-id","#"+decodeURI(t.getAttribute("id")))}),jQuery("a.ez-toc-link").click(function(){let e=jQuery(this).attr("data-href"),i=jQuery(this).attr("href");if(1===parseInt(eztoc_smooth_local.add_request_uri)){if(jQuery(this).attr("data-href")){let r=jQuery(this).attr("data-href").split("#");r&&r.length>1&&(e=`#${r[1]}`)}if(jQuery(this).attr("href")){let a=jQuery(this).attr("href").split("#");a&&a.length>1&&(i=`#${a[1]}`)}}let l=t?e:i,o=jQuery("#wpadminbar"),s=jQuery("header"),h=0;if(parseInt(eztoc_smooth_local.scroll_offset)>30&&(h=parseInt(eztoc_smooth_local.scroll_offset)),o.length&&(h+=o.height()),(s.length&&"fixed"==s.css("position")||"sticky"==s.css("position"))&&(h+=s.height()),jQuery('[ez-toc-data-id="'+decodeURI(l)+'"]').length>0&&(h=jQuery('[ez-toc-data-id="'+decodeURI(l)+'"]').offset().top-h),jQuery("html, body").animate({scrollTop:h},500),t)return!1})});
|
@ -0,0 +1,12 @@
|
||||
(function() {
|
||||
tinymce.PluginManager.add('toc_mce_button', function( editor, url ) {
|
||||
editor.addButton('toc_mce_button', {
|
||||
text: 'TOC',
|
||||
icon: false,
|
||||
onclick: function() {
|
||||
// change the shortcode as per your requirement
|
||||
editor.insertContent('[ez-toc]');
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
Reference in New Issue
Block a user