PATH:
home
/
centosnipponia
/
public_html
/
BAK_doohannl
/
wp-content
/
themes
/
sydney-pro-ii
/
js
"use strict"; //Add spacing for CPT panels jQuery( document ).ready(function($) { var panels = $('li[id^="accordion-panel-sydney_panel_cpt_"]'); panels.first().css( 'margin-top', '10px' ); panels.last().css( 'margin-bottom', '10px' ); } ); jQuery( document ).ready( function() { /* === Checkbox Multiple Control === */ jQuery( '.customize-control-checkbox-multiple input[type="checkbox"]' ).on( 'change', function() { checkbox_values = jQuery( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map( function() { return this.value; } ).get().join( ',' ); jQuery( this ).parents( '.customize-control' ).find( 'input[type="hidden"]' ).val( checkbox_values ).trigger( 'change' ); } ); } ); // jQuery( document ).ready //Featured posts jQuery( document ).ready(function($) { "use strict"; $('.customize-control-dropdown-select2').each(function(){ $('.customize-control-select2').select2({ allowClear: true, maximumSelectionLength: 5 }); }); $(".customize-control-select2").on("change", function() { var select2Val = $(this).val(); $(this).parent().find('.customize-control-dropdown-select2').val(select2Val).trigger('change'); }); $('#featured_posts_ids').select2({ allowClear: true, placeholder: "Select...", maximumSelectionLength: 5 }); $("#featured_posts_ids").on("change", function() { var select2Val = $(this).val(); $(this).parent().find('.customize-control-dropdown-select2').val(select2Val).trigger('change'); }); }); /* Typography */ jQuery(document).ready(function ($) { "use strict"; $('.google-fonts-list').each(function (i, obj) { if (!$(this).hasClass('select2-hidden-accessible')) { $(this).select2(); } }); $('.google-fonts-list').on('change', function () { var elementRegularWeight = $(this).parent().parent().find('.google-fonts-regularweight-style'); var selectedFont = $(this).val(); var customizerControlName = $(this).attr('control-name'); // Clear Weight/Style dropdowns elementRegularWeight.empty(); // Make sure Italic & Bold dropdowns are enabled // Get the Google Fonts control object var bodyfontcontrol = _wpCustomizeSettings.controls[customizerControlName]; // Find the index of the selected font var indexes = $.map(bodyfontcontrol.sydneyfontslist, function (obj, index) { if (obj.family === selectedFont) { return index; } }); var index = indexes[0]; // For the selected Google font show the available weight/style variants $.each(bodyfontcontrol.sydneyfontslist[index].variants, function (val, text) { elementRegularWeight.append($('<option></option>').val(text).html(text)); //Set default value if ($(elementRegularWeight).find('option[value="regular"]').length > 0) { $(elementRegularWeight).val('regular'); } else if ($(elementRegularWeight).find('option[value="400"]').length > 0) { $(elementRegularWeight).val('400'); } else if ($(elementRegularWeight).find('option[value="300"]').length > 0) { $(elementRegularWeight).val('300'); } }); // Update the font category based on the selected font $(this).parent().parent().find('.google-fonts-category').val(bodyfontcontrol.sydneyfontslist[index].category); sydneyGetAllSelects($(this).parent().parent().parent().parent()); }); $('.google_fonts_select_control select').on('change', function () { sydneyGetAllSelects($(this).parent().parent().parent().parent()); }); function sydneyGetAllSelects($element) { var selectedFont = { font: $element.find('.google-fonts-list').val(), regularweight: $element.find('.google-fonts-regularweight-style').val(), category: $element.find('.google-fonts-category').val() }; // Important! Make sure to trigger change event so Customizer knows it has to save the field $element.find('.customize-control-google-font-selection').val(JSON.stringify(selectedFont)).trigger('change'); } }); /* Typography - Adobe Type Kit Fonts */ jQuery(document).ready(function ($) { $('.adobe-font-family').each(function (i, obj) { if (!$(this).hasClass('select2-hidden-accessible')) { $(this).select2(); } }); $('.adobe-font-family').on('change', function () { const $el = $(this).closest('.adobe_fonts_select_control'); const selected_css_name = $(this).val(); let variations = ''; for (let i = 0; i < sydney_adobe_fonts.length; i++) { if (sydney_adobe_fonts[i].css_name == selected_css_name) { variations = sydney_adobe_fonts[i].variations; break; } } $el.find('.adobe-font-weight').html(''); for (let i = 0; i < variations.length; i++) { // exclude italic variations if (variations[i].indexOf('i') === -1) { $el.find('.adobe-font-weight').append('<option value="' + sydney_standardize_font_variations(variations[i]) + '">' + sydney_standardize_font_variations(variations[i]) + '</option>'); } } $el.find('.customize-control-adobe-font-selection').val($el.find('.adobe-font-family').val() + '|' + $el.find('.adobe-font-weight').val()).trigger('change'); }); $('.adobe-font-weight').on('change', function () { const $el = $(this).closest('.adobe_fonts_select_control'); $el.find('.customize-control-adobe-font-selection').val($el.find('.adobe-font-family').val() + '|' + $el.find('.adobe-font-weight').val()).trigger('change'); }); function sydney_standardize_font_variations(variation) { let variations = []; // normal format for (let i = 1; i <= 9; i++) { variations['n' + i] = i * 100; } if (variations.hasOwnProperty(variation)) { return variations[variation]; } else { return '400'; } } }); /** * Typography adobe fonts kits control */ jQuery(document).ready(function ($) { // Get Kits from API $(document).on('click', '.sydney-adobe_fonts_kits_submit_token', function (e) { e.preventDefault(); var $this = $(this), token = $('#adobe_fonts_kits_generator').val(), ajax_wrapper = $('.sydney-adobe_fonts_kits_ajax_wrapper'), nonce = $this.data('nonce'); $(this).text($this.data('loading-text')); $(this).attr('disabled', true); $.ajax({ type: 'post', url: ajaxurl, data: { action: 'sydney_typography_adobe_kits_control', token: token, nonce: nonce }, success: function (response) { ajax_wrapper.html(response.output); $this.text($this.data('default-text')); $this.attr('disabled', false); if (response.status === 'success' && response.output !== null) { wp.customize.bind('saved', function () { var href = $('.sydney-adobe_fonts_kits_wrapper-item .reload-message a').attr('href'); window.location.href = href; }); $('#customize-save-button-wrapper > .save').trigger('click'); } } }); }); // Enable or disable specific kits $(document).on('click', '.sydney-adobe_fonts_kit_onoff', function (e) { e.preventDefault(); var $this = $(this), kit_id = $this.data('kit'), nonce = $this.data('nonce'); $(this).text($this.data('loading-text')); $(this).attr('disabled', true); $.ajax({ type: 'post', url: ajaxurl, data: { action: 'sydney_typography_adobe_kits_control_enable_disable', kit: kit_id, nonce: nonce }, success: function (response) { if (response.kit_enabled) { $this.text($this.data('disable-text')); $this.closest('.sydney-adobe_fonts_kits_wrapper-item').removeClass('disabled'); } else { $this.text($this.data('enable-text')); $this.closest('.sydney-adobe_fonts_kits_wrapper-item').addClass('disabled'); } $this.closest('.sydney-adobe_fonts_kits_wrapper-item').find('.reload-message').addClass('show'); $this.attr('disabled', false); } }); }); }); jQuery(document).ready(function ($) { "use strict"; let clickFlag = false; $('.sydney-devices-preview').find('button').on('click', function (event) { if (clickFlag) { clickFlag = false; return false; } clickFlag = true; let device = ''; if ($(this).hasClass('preview-desktop')) { $('.sydney-devices-preview').find('.preview-desktop').addClass('active'); $('.sydney-devices-preview').find('.preview-tablet').removeClass('active'); $('.sydney-devices-preview').find('.preview-mobile').removeClass('active'); $('.font-size-desktop').addClass('active'); $('.font-size-tablet').removeClass('active'); $('.font-size-mobile').removeClass('active'); $('.wp-full-overlay-footer .devices button[data-device="desktop"]').trigger('click'); } else if ($(this).hasClass('preview-tablet')) { $('.sydney-devices-preview').find('.preview-tablet').addClass('active'); $('.sydney-devices-preview').find('.preview-desktop').removeClass('active'); $('.sydney-devices-preview').find('.preview-mobile').removeClass('active'); $('.font-size-desktop').removeClass('active'); $('.font-size-tablet').addClass('active'); $('.font-size-mobile').removeClass('active'); $('.wp-full-overlay-footer .devices button[data-device="tablet"]').trigger('click'); } else { $('.sydney-devices-preview').find('.preview-mobile').addClass('active'); $('.sydney-devices-preview').find('.preview-desktop').removeClass('active'); $('.sydney-devices-preview').find('.preview-tablet').removeClass('active'); $('.font-size-desktop').removeClass('active'); $('.font-size-tablet').removeClass('active'); $('.font-size-mobile').addClass('active'); $('.wp-full-overlay-footer .devices button[data-device="mobile"]').trigger('click'); } }); $(' .wp-full-overlay-footer .devices button ').on('click', function () { if (clickFlag) { clickFlag = false; return false; } var device = $(this).attr('data-device'); $('.sydney-devices-preview').find('.preview-' + device).trigger('click'); }); }); /** * Repeater */ jQuery(document).ready(function ($) { "use strict"; // Update the values for all our input fields and initialise the sortable repeater $('.sydney-sortable_repeater_control').each(function () { // If there is an existing customizer value, populate our rows var defaultValuesArray = $(this).find('.customize-control-sortable-repeater').val().split(','); var numRepeaterItems = defaultValuesArray.length; if (numRepeaterItems > 0) { // Add the first item to our existing input field $(this).find('.repeater-input').val(defaultValuesArray[0]); // Create a new row for each new value if (numRepeaterItems > 1) { var i; for (i = 1; i < numRepeaterItems; ++i) { sydneyAppendRow($(this), defaultValuesArray[i]); } } } }); // Make our Repeater fields sortable $(this).find('.sydney-sortable_repeater.sortable').sortable({ update: function update(event, ui) { sydneyGetAllInputs($(this).parent()); } }); // Remove item starting from it's parent element $('.sydney-sortable_repeater.sortable').on('click', '.customize-control-sortable-repeater-delete', function (event) { event.preventDefault(); var numItems = $(this).parent().parent().find('.repeater').length; if (numItems > 1) { $(this).parent().slideUp('fast', function () { var parentContainer = $(this).parent().parent(); $(this).remove(); sydneyGetAllInputs(parentContainer); }); } else { $(this).parent().find('.repeater-input').val(''); sydneyGetAllInputs($(this).parent().parent().parent()); } }); // Add new item $('.customize-control-sortable-repeater-add').click(function (event) { event.preventDefault(); sydneyAppendRow($(this).parent()); sydneyGetAllInputs($(this).parent()); }); // Refresh our hidden field if any fields change $('.sydney-sortable_repeater.sortable').change(function () { sydneyGetAllInputs($(this).parent()); }); // Add https:// to the start of the URL if it doesn't have it $('.sydney-sortable_repeater.sortable').on('blur', '.repeater-input', function () { var url = $(this); var val = url.val(); if (val && !val.match(/^.+:\/\/.*/)) { // Important! Make sure to trigger change event so Customizer knows it has to save the field url.trigger('change'); } }); // Append a new row to our list of elements function sydneyAppendRow($element) { var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var newRow = '<div class="repeater" style="display:none"><input type="text" value="' + defaultValue + '" class="repeater-input" placeholder="" /><span class="dashicons dashicons-menu"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a></div>'; $element.find('.sortable').append(newRow); $element.find('.sortable').find('.repeater:last').slideDown('slow', function () { $(this).find('input').focus(); }); } // Get the values from the repeater input fields and add to our hidden field function sydneyGetAllInputs($element) { var inputValues = $element.find('.repeater-input').map(function () { return $(this).val(); }).toArray(); // Add all the values from our repeater fields to the hidden field (which is the one that actually gets saved) $element.find('.customize-control-sortable-repeater').val(inputValues); // Important! Make sure to trigger change event so Customizer knows it has to save the field $element.find('.customize-control-sortable-repeater').trigger('change'); } }); /** * Alpha color picker */ jQuery(document).ready(function ($) { $('.alpha-color-control').each(function () { // Scope the vars. var $control, startingColor, paletteInput, showOpacity, defaultColor, palette, colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions; // Store the control instance. $control = $(this); // Get a clean starting value for the option. startingColor = $control.val().replace(/\s+/g, ''); // Get some data off the control. paletteInput = $control.attr('data-palette'); showOpacity = $control.attr('data-show-opacity'); defaultColor = $control.attr('data-default-color'); // Process the palette. if (paletteInput.indexOf('|') !== -1) { palette = paletteInput.split('|'); } else if ('false' == paletteInput) { palette = false; } else { palette = true; } // Set up the options that we'll pass to wpColorPicker(). colorPickerOptions = { change: function change(event, ui) { var key, value, alpha, $transparency; key = $control.attr('data-customize-setting-link'); value = $control.wpColorPicker('color'); // Set the opacity value on the slider handle when the default color button is clicked. if (defaultColor == value) { alpha = acp_get_alpha_value_from_color(value); $alphaSlider.find('.ui-slider-handle').text(alpha); } // Send ajax request to wp.customize to trigger the Save action. wp.customize(key, function (obj) { obj.set(value); }); $transparency = $container.find('.transparency'); // Always show the background color of the opacity slider at 100% opacity. $transparency.css('background-color', ui.color.toString('no-alpha')); }, palettes: palette // Use the passed in palette. }; // Create the colorpicker. $control.wpColorPicker(colorPickerOptions); $container = $control.parents('.wp-picker-container:first'); // Insert our opacity slider. $('<div class="alpha-color-picker-container">' + '<div class="min-click-zone click-zone"></div>' + '<div class="max-click-zone click-zone"></div>' + '<div class="alpha-slider"></div>' + '<div class="transparency"></div>' + '</div>').appendTo($container.find('.wp-picker-holder')); $alphaSlider = $container.find('.alpha-slider'); // If starting value is in format RGBa, grab the alpha channel. alphaVal = acp_get_alpha_value_from_color(startingColor); // Set up jQuery UI slider() options. sliderOptions = { create: function create(event, ui) { var value = $(this).slider('value'); // Set up initial values. $(this).find('.ui-slider-handle').text(value); $(this).siblings('.transparency ').css('background-color', startingColor); }, value: alphaVal, range: 'max', step: 1, min: 0, max: 100, animate: 300 }; // Initialize jQuery UI slider with our options. $alphaSlider.slider(sliderOptions); // Maybe show the opacity on the handle. if ('true' == showOpacity) { $alphaSlider.find('.ui-slider-handle').addClass('show-opacity'); } // Bind event handlers for the click zones. $container.find('.min-click-zone').on('click', function () { acp_update_alpha_value_on_color_control(0, $control, $alphaSlider, true); }); $container.find('.max-click-zone').on('click', function () { acp_update_alpha_value_on_color_control(100, $control, $alphaSlider, true); }); // Bind event handler for clicking on a palette color. $container.find('.iris-palette').on('click', function () { var color, alpha; color = $(this).css('background-color'); alpha = acp_get_alpha_value_from_color(color); acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider); // Sometimes Iris doesn't set a perfect background-color on the palette, // for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039). // To compensante for this we round the opacity value on RGBa colors here // and save it a second time to the color picker object. if (alpha != 100) { color = color.replace(/[^,]+(?=\))/, (alpha / 100).toFixed(2)); } $control.wpColorPicker('color', color); }); // Bind event handler for clicking on the 'Clear' button. $container.find('.button.wp-picker-clear').on('click', function () { var key = $control.attr('data-customize-setting-link'); // The #fff color is delibrate here. This sets the color picker to white instead of the // defult black, which puts the color picker in a better place to visually represent empty. $control.wpColorPicker('color', '#ffffff'); // Set the actual option value to empty string. wp.customize(key, function (obj) { obj.set(''); }); acp_update_alpha_value_on_alpha_slider(100, $alphaSlider); }); // Bind event handler for clicking on the 'Default' button. $container.find('.button.wp-picker-default').on('click', function () { var alpha = acp_get_alpha_value_from_color(defaultColor); acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider); }); // Bind event handler for typing or pasting into the input. $control.on('input', function () { var value = $(this).val(); var alpha = acp_get_alpha_value_from_color(value); acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider); }); // Update all the things when the slider is interacted with. $alphaSlider.slider().on('slide', function (event, ui) { var alpha = parseFloat(ui.value) / 100.0; acp_update_alpha_value_on_color_control(alpha, $control, $alphaSlider, false); // Change value shown on slider handle. $(this).find('.ui-slider-handle').text(ui.value); }); }); /** * Override the stock color.js toString() method to add support for outputting RGBa or Hex. */ Color.prototype.toString = function (flag) { // If our no-alpha flag has been passed in, output RGBa value with 100% opacity. // This is used to set the background color on the opacity slider during color changes. if ('no-alpha' == flag) { return this.toCSS('rgba', '1').replace(/\s+/g, ''); } // If we have a proper opacity value, output RGBa. if (1 > this._alpha) { return this.toCSS('rgba', this._alpha).replace(/\s+/g, ''); } // Proceed with stock color.js hex output. var hex = parseInt(this._color, 10).toString(16); if (this.error) { return ''; } if (hex.length < 6) { for (var i = 6 - hex.length - 1; i >= 0; i--) { hex = '0' + hex; } } return '#' + hex; }; /** * Given an RGBa, RGB, or hex color value, return the alpha channel value. */ function acp_get_alpha_value_from_color(value) { var alphaVal; // Remove all spaces from the passed in value to help our RGBa regex. value = value.replace(/ /g, ''); if (value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)) { alphaVal = parseFloat(value.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]).toFixed(2) * 100; alphaVal = parseInt(alphaVal); } else { alphaVal = 100; } return alphaVal; } /** * Force update the alpha value of the color picker object and maybe the alpha slider. */ function acp_update_alpha_value_on_color_control(alpha, $control, $alphaSlider, update_slider) { var iris, colorPicker, color; iris = $control.data('a8cIris'); colorPicker = $control.data('wpWpColorPicker'); // Set the alpha value on the Iris object. iris._color._alpha = alpha; // Store the new color value. color = iris._color.toString(); // Set the value of the input. $control.val(color); // Update the background color of the color picker. colorPicker.toggler.css({ 'background-color': color }); // Maybe update the alpha slider itself. if (update_slider) { acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider); } // Update the color value of the color picker object. $control.wpColorPicker('color', color); } /** * Update the slider handle position and label. */ function acp_update_alpha_value_on_alpha_slider(alpha, $alphaSlider) { $alphaSlider.slider('value', alpha); $alphaSlider.find('.ui-slider-handle').text(alpha.toString()); } }); /** * Tab control */ jQuery(document).ready(function ($) { "use strict"; $('.customize-control-sydney-tab-control').each(function () { $(this).parent().find('li').not('.section-meta').not('.customize-control-sydney-tab-control').addClass('sydney-hide-control'); var generals = $(this).find('.control-tab-general').data('connected'); $.each(generals, function (i, v) { $(this).removeClass('sydney-hide-control'); //show }); $(this).find('.control-tab').on('click', function () { var visibles = $(this).data('connected'); $(this).addClass('active'); $(this).siblings().removeClass('active'); $(this).parent().parent().parent().find('li').not('.section-meta').not('.customize-control-sydney-tab-control').addClass('sydney-hide-control'); $.each(visibles, function (i, v) { $(this).removeClass('sydney-hide-control'); //show }); }); }); }); /** * TinyMCE control */ jQuery(document).ready(function ($) { "use strict"; $('.customize-control-tinymce-editor').each(function () { // Get the toolbar strings that were passed from the PHP Class var tinyMCEToolbar1String = _wpCustomizeSettings.controls[$(this).attr('id')].sydneytb1; var tinyMCEToolbar2String = _wpCustomizeSettings.controls[$(this).attr('id')].sydneytb2; var tinyMCEMediaButtons = _wpCustomizeSettings.controls[$(this).attr('id')].sydneytmb; wp.editor.initialize($(this).attr('id'), { tinymce: { wpautop: true, toolbar1: tinyMCEToolbar1String, toolbar2: tinyMCEToolbar2String }, quicktags: true, mediaButtons: true }); }); $(document).on('tinymce-editor-init', function (event, editor) { editor.on('change', function (e) { tinyMCE.triggerSave(); $('#' + editor.id).trigger('change'); }); }); }); /** * Footer widget areas links */ jQuery(document).ready(function ($) { var footerCols = $('#customize-control-footer_widget_areas').find('input:checked'); toggleLinks(footerCols); $('#customize-control-footer_widget_areas').find('input').change(function () { toggleLinks($(this)); }); function toggleLinks(el) { if ('3' === $(el).val() || 'col3-bigleft' === $(el).val() || 'col3-bigright' === $(el).val()) { $('.footer-widget-area-link-1, .footer-widget-area-link-2, .footer-widget-area-link-3').show(); $('.footer-widget-area-link-4').hide(); } else if ('4' === $(el).val() || 'col4-bigleft' === $(el).val() || 'col4-bigright' === $(el).val()) { $('.footer-widget-area-link-1, .footer-widget-area-link-2, .footer-widget-area-link-3, .footer-widget-area-link-4').show(); } else if ('2' === $(el).val() || 'col2-bigleft' === $(el).val() || 'col2-bigright' === $(el).val()) { $('.footer-widget-area-link-1, .footer-widget-area-link-2').show(); $('.footer-widget-area-link-4, .footer-widget-area-link-3').hide(); } else if ('1' === $(el).val()) { $('.footer-widget-area-link-1').show(); $('.footer-widget-area-link-4, .footer-widget-area-link-2, .footer-widget-area-link-3').hide(); } else { $('.footer-widget-area-link-1, .footer-widget-area-link-2, .footer-widget-area-link-3, .footer-widget-area-link-4').hide(); } } }); /* Non-refresh header custom content toggle */ wp.customize.bind('ready', function () { var $types = syd_data.post_types; var $options = {}; // Loop through each post type jQuery.each($types, function (index, value) { $options[value + '_header_custom_content'] = value + '_header_custom_content_toggle'; $options[value + '_header_cc_placement'] = value + '_header_custom_content_toggle'; }); jQuery.each( $options, function( option, toggle ) { wp.customize.control( option, function (control) { var setting = wp.customize( toggle ); setting.bind(function (value) { control.active.set(value); }); }); }); }); /** * Accordion control */ (function ($) { var Sydney_Accordion = { init: function init() { this.firstTime = true; if (!this.initialized) { this.events(); } this.initialized = true; }, events: function events() { var self = this; // Toggle accordion $(document).on('click', '.sydney-accordion-title', function () { var $this = $(this); if ($(this).hasClass('expanded')) { self.showOrHide($(this), 'hide'); $(this).removeClass('expanded').addClass('collapse'); setTimeout(function () { $this.removeClass('collapse'); }, 300); } if (!$(this).hasClass('collapse')) { // Open one accordion item per time $('.sydney-accordion-item').addClass('sydney-accordion-hide'); $('.sydney-accordion-title').removeClass('expanded'); // Show accordion content self.showOrHide($(this), 'show'); $this.addClass('expanded'); } }); // Mount the accordion when enter in the section (with accordions inside) // Also used to collapse all accordions when navigating between others tabs $(document).on('click', '.control-section', function (e) { var $section = $('.control-section.open'); if (self.firstTime && $section.find('.sydney-accordion-title').length) { $section.find('.sydney-accordion-title').each(function () { self.showOrHide($(this), 'hide'); $(this).removeClass('expanded'); }); setTimeout(function () { self.firstTime = false; }, 300); } }); // Reset the first time $(document).on('click', '.customize-section-back', function () { self.firstTime = true; }); return this; }, showOrHide: function showOrHide($this, status) { var self = this; var current = ''; current = $this.closest('.customize-control').next(); var elements = []; if (current.attr('id') == 'customize-control-' + $this.data('until')) { elements.push(current[0].id); } else { while (current.attr('id') != 'customize-control-' + $this.data('until')) { elements.push(current[0].id); current = current.next(); } } if (elements.length >= 1) { elements.push(current[0].id); } for (var i = 0; i < elements.length; i++) { // Identify accordion items $('#' + elements[i]).addClass('sydney-accordion-item active'); // Hide or show the accordion content if (status == 'hide') { $('#' + elements[i]).addClass('sydney-accordion-hide'); } else { $('#' + elements[i]).removeClass('sydney-accordion-hide'); } // Identify first accordion item if (i == 0) { $('#' + elements[i]).addClass('sydney-accordion-first-item'); } // Identify last accordion item if (i == elements.length - 1 && elements.length > 1 || elements.length == 1) { $('#' + elements[i]).addClass('sydney-accordion-last-item'); } } return this; }, focusAccordionOpenControl: function focusAccordionOpenControl() { var self = this, urlParams = document.location.search, paramsArr = urlParams.split('&'), newString = ''; paramsArr.shift(); newString = paramsArr.join('&'); var params = self.getQueryParams(newString); if ($('.control-section.open').get(0)) { self.firstTime = false; $('.control-section.open').find('.sydney-accordion-title').trigger('click'); if (typeof params.control !== 'undefined') { $('.control-section.open').find('#' + params.control + ' > a').trigger('click'); } return; } setTimeout(function () { self.focusAccordionOpenControl(); }, 300); return this; }, getQueryParams: function getQueryParams(qs) { qs = qs.split('+').join(' '); var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) { params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); } return params; } }; $(document).ready(function ($) { Sydney_Accordion.init(); }); if (window.location.href.indexOf('?autofocus') > 0) { wp.customize.bind('ready', function () { Sydney_Accordion.focusAccordionOpenControl(); }); } })(jQuery); /** * Controls a11y */ jQuery(document).ready(function ($) { "use strict"; $('.customize-control-sydney-toggle-control').each(function () { $(this).find('label').on('keydown', function (event) { var enterPressed = (event.key === 'Enter' || event.keyCode === 13); if (!enterPressed) { return; } $( this ).click(); }); }); $('.customize-control-sydney-radio-buttons').each(function () { $(this).find('label').on('keydown', function (event) { var enterPressed = (event.key === 'Enter' || event.keyCode === 13); if (!enterPressed) { return; } $( this ).click(); }); }); }); /** * Create page control */ jQuery( document ).ready(function($) { $( document ).on( 'click', '.sydney-create-page-control-button', function(e){ e.preventDefault(); var $this = $(this), $create_message = $this.parent().find('.sydney-create-page-control-create-message'), $success_message = $this.parent().find('.sydney-create-page-control-success-message'), initial_text = $this.text(), creating_text = $this.data('creating-text'), created_text = $this.data('created-text'), page_title = $this.data('page-title'), page_meta_key = $this.data('page-meta-key'), page_meta_value = $this.data('page-meta-value'), option_name = $this.data('option-name'), nonce = $this.data('nonce'); if( ! page_title ) { return false; } $(this).text( creating_text ); $(this).attr( 'disabled', true ); $.ajax({ type: 'post', url: ajaxurl, data: { action: 'sydney_create_page_control', page_title: page_title, page_meta_key: page_meta_key, page_meta_value: page_meta_value, option_name: option_name, nonce: nonce }, success: function(response) { if( 'success' === response.status ) { var href = $success_message.find('a').attr( 'href' ), newhref = href.replace( '?post=&', '?post='+ response.page_id +'&' ); $success_message.find('a').attr( 'href', newhref ); $success_message.css( 'display', 'block' ); $create_message.remove(); $this.remove(); } else { } } }); }); }); /** * Display Conditions Control */ jQuery(document).ready(function ($) { $(document).on('sydney-display-conditions-select2-initalize', function (event, item) { var $item = $(item); var $control = $item.closest('.sydney-display-conditions-control'); var $typeSelectWrap = $item.find('.sydney-display-conditions-select2-type'); var $typeSelect = $typeSelectWrap.find('select'); var $conditionSelectWrap = $item.find('.sydney-display-conditions-select2-condition'); var $conditionSelect = $conditionSelectWrap.find('select'); var $idSelectWrap = $item.find('.sydney-display-conditions-select2-id'); var $idSelect = $idSelectWrap.find('select'); $typeSelect.select2({ width: '100%', minimumResultsForSearch: -1 }); $typeSelect.on('select2:select', function (event) { $typeSelectWrap.attr('data-type', event.params.data.id); }); $conditionSelect.select2({ width: '100%' }); $conditionSelect.on('select2:select', function (event) { var $element = $(event.params.data.element); if ($element.data('ajax')) { $idSelectWrap.removeClass('hidden'); } else { $idSelectWrap.addClass('hidden'); } $idSelect.val(null).trigger('change'); }); var isAjaxSelected = $conditionSelect.find(':selected').data('ajax'); if (isAjaxSelected) { $idSelectWrap.removeClass('hidden'); } $idSelect.select2({ width: '100%', placeholder: '', allowClear: true, minimumInputLength: 1, ajax: { url: ajaxurl, dataType: 'json', delay: 250, cache: true, data: function data(params) { return { action: 'sydney_display_conditions_select_ajax', term: params.term, nonce: syd_data.ajax_nonce, source: $conditionSelect.val() }; }, processResults: function processResults(response, params) { if (response.success) { return { results: response.data }; } return {}; } } }); }); $(document).on('click', '.sydney-display-conditions-modal-toggle', function (event) { event.preventDefault(); var $button = $(this); var template = wp.template('sydney-display-conditions-template'); var $control = $button.closest('.sydney-display-conditions-control'); var $modal = $control.find('.sydney-display-conditions-modal'); if (!$modal.data('initialized')) { $control.append(template($control.data('condition-settings'))); var $items = $control.find('.sydney-display-conditions-modal-content-list-item').not('.hidden'); if ($items.length) { $items.each(function () { $(document).trigger('sydney-display-conditions-select2-initalize', this); }); } $modal = $control.find('.sydney-display-conditions-modal'); $modal.data('initialized', true); $modal.addClass('open'); } else { $modal.toggleClass('open'); } }); $(document).on('click', '.sydney-display-conditions-modal', function (event) { event.preventDefault(); var $modal = $(this); if ($(event.target).is($modal)) { $modal.removeClass('open'); } }); $(document).on('click', '.sydney-display-conditions-modal-add', function (event) { event.preventDefault(); var $button = $(this); var $control = $button.closest('.sydney-display-conditions-control'); var $modal = $control.find('.sydney-display-conditions-modal'); var $list = $modal.find('.sydney-display-conditions-modal-content-list'); var $item = $modal.find('.sydney-display-conditions-modal-content-list-item').first().clone(); var conditionGroup = $button.data('condition-group'); $item.removeClass('hidden'); $item.find('.sydney-display-conditions-select2-condition').not('[data-condition-group="' + conditionGroup + '"]').remove(); $list.append($item); $(document).trigger('sydney-display-conditions-select2-initalize', $item); }); $(document).on('click', '.sydney-display-conditions-modal-remove', function (event) { event.preventDefault(); var $item = $(this).closest('.sydney-display-conditions-modal-content-list-item'); $item.remove(); }); $(document).on('click', '.sydney-display-conditions-modal-save', function (event) { event.preventDefault(); var data = []; var $button = $(this); var $control = $button.closest('.sydney-display-conditions-control'); var $modal = $control.find('.sydney-display-conditions-modal'); var $textarea = $control.find('.sydney-display-conditions-textarea'); var $items = $modal.find('.sydney-display-conditions-modal-content-list-item').not('.hidden'); $items.each(function () { var $item = $(this); data.push({ type: $item.find('select[name="type"]').val(), condition: $item.find('select[name="condition"]').val(), id: $item.find('select[name="id"]').val() }); }); $textarea.val(JSON.stringify(data)).trigger('change'); }); }); /** * Custom Sidebars Control */ jQuery(document).ready(function ($) { "use strict"; $(document).on('sydney-custom-sidebar-update', function (event, control) { event.preventDefault(); var data = []; var $control = $(control); var $textarea = $control.find('.sydney-custom-sidebar-textarea'); var $items = $control.find('.sydney-custom-sidebar-list-item').not('.hidden'); $items.each(function () { var $item = $(this); var name = $item.find('input[name="sidebar_name"]').val(); var conditions = $item.find('textarea[name="sidebar_conditions"]').val(); if (conditions) { conditions = JSON.parse(conditions); } if (name) { data.push({ name: name, conditions: conditions }); } }); $textarea.val(JSON.stringify(data)).trigger('change'); }); $('.sydney-custom-sidebars-control').each(function () { var $control = $(this); var $list = $control.find('.sydney-custom-sidebar-list'); $list.sortable({ axis: 'y', update: function update() { $(document).trigger('sydney-custom-sidebar-update', [$control]); } }); }); $(document).on('change', '.sydney-custom-sidebar-name, .sydney-custom-sidebar-conditions', function (event) { var $button = $(this); var $control = $button.closest('.sydney-custom-sidebars-control'); $(document).trigger('sydney-custom-sidebar-update', [$control]); }); $(document).on('click', '.sydney-custom-sidebar-remove', function (event) { var $button = $(this); var $control = $button.closest('.sydney-custom-sidebars-control'); var $items = $control.find('.sydney-custom-sidebar-list-item').not('.hidden'); $button.closest('.sydney-custom-sidebar-list-item').remove(); if ($items.length === 1) { var $list = $control.find('.sydney-custom-sidebar-list'); var $item = $control.find('.sydney-custom-sidebar-list-item').first().clone(); $item.removeClass('hidden'); $list.append($item); } $(document).trigger('sydney-custom-sidebar-update', [$control]); }); $(document).on('click', '.sydney-custom-sidebar-add', function (event) { var $button = $(this); var $control = $button.closest('.sydney-custom-sidebars-control'); var $list = $control.find('.sydney-custom-sidebar-list'); var $item = $control.find('.sydney-custom-sidebar-list-item').first().clone(); $item.removeClass('hidden'); $list.append($item); $(document).trigger('sydney-custom-sidebar-update', [$control]); }); $(document).on('click', '.sydney-custom-sidebar-condition', function (event) { var $button = $(this); var $item = $button.closest('.sydney-custom-sidebar-list-item'); }); });
[+]
..
[+]
modules
[-] admin-functions.js
[edit]
[-] customize-controls.js
[edit]
[-] customize-controls.min.js
[edit]
[-] customizer-select2.js
[edit]
[-] customizer.js
[edit]
[-] customizer.min.js
[edit]
[-] elementor.js
[edit]
[-] functions.js
[edit]
[-] functions.min.js
[edit]
[-] hero-slider.js
[edit]
[-] imagesloaded.pkgd.js
[edit]
[-] infinite-load.js
[edit]
[-] jquery.countTo.js
[edit]
[-] jquery.fitvids.js
[edit]
[-] jquery.flexslider.js
[edit]
[-] jquery.superslides.js
[edit]
[-] jquery.validate.js
[edit]
[-] jquery.validate.min.js
[edit]
[-] media-uploader.js
[edit]
[-] owl.carousel.js
[edit]
[-] scripts.js
[edit]
[-] select2.js
[edit]
[-] select2.min.js
[edit]
[-] so-legacy-main.js
[edit]
[-] so-legacy-main.min.js
[edit]
[-] so-legacy.js
[edit]
[-] sydney-popup.js
[edit]
[-] sydney-popup.min.js
[edit]
[-] typed.js
[edit]
[-] typed.min.js
[edit]
[-] waypoints.js
[edit]
[-] woo-sidebar.js
[edit]
[-] .htaccess.disabled
[edit]