Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/popup-ma.../trunk/assets/js
File: admin-theme-editor.js
/*******************************************************************************
[0] Fix | Delete
* Copyright (c) 2019, Code Atlantic LLC
[1] Fix | Delete
******************************************************************************/
[2] Fix | Delete
/* global PUM_Admin, jQuery, pum_google_fonts, pum_theme_settings_editor */
[3] Fix | Delete
(function ($) {
[4] Fix | Delete
"use strict";
[5] Fix | Delete
[6] Fix | Delete
window.PUM_Admin = window.PUM_Admin || {};
[7] Fix | Delete
[8] Fix | Delete
window.pum_theme_settings_editor = window.pum_theme_settings_editor || {
[9] Fix | Delete
form_args: {},
[10] Fix | Delete
current_values: {}
[11] Fix | Delete
};
[12] Fix | Delete
[13] Fix | Delete
PUM_Admin.themeEditor = {
[14] Fix | Delete
preview_fixed_scroll: function () {
[15] Fix | Delete
var $preview = $('#pum_theme_preview'),
[16] Fix | Delete
$parent = $preview.parent(),
[17] Fix | Delete
startscroll = $preview.offset().top - 50;
[18] Fix | Delete
[19] Fix | Delete
$(window).on('scroll', function () {
[20] Fix | Delete
if ($('> .postbox:visible', $parent).index($preview) === ($('> .postbox:visible', $parent).length - 1) && $(window).scrollTop() >= startscroll) {
[21] Fix | Delete
$preview.css({
[22] Fix | Delete
left: $preview.offset().left,
[23] Fix | Delete
width: $preview.width(),
[24] Fix | Delete
height: $preview.height(),
[25] Fix | Delete
position: 'fixed',
[26] Fix | Delete
top: 50
[27] Fix | Delete
});
[28] Fix | Delete
} else {
[29] Fix | Delete
$preview.removeAttr('style');
[30] Fix | Delete
}
[31] Fix | Delete
});
[32] Fix | Delete
},
[33] Fix | Delete
update_font_options: function (prefix) {
[34] Fix | Delete
var $font_family_select = $('select[id="' + prefix + '_font_family"]'),
[35] Fix | Delete
$font_weight_select = $('select[id="' + prefix + '_font_weight"]'),
[36] Fix | Delete
$font_style_select = $('select[id="' + prefix + '_font_style"]'),
[37] Fix | Delete
$font_weight_options = $font_weight_select.find('option'),
[38] Fix | Delete
$font_style_options = $font_style_select.find('option'),
[39] Fix | Delete
font_weights = [400, 300, 700, 100, 200, 500, 600, 800, 900],
[40] Fix | Delete
font_styles = ['', 'italic'],
[41] Fix | Delete
chosen_font = $font_family_select.val(),
[42] Fix | Delete
chosen_weight = $font_weight_select.val(),
[43] Fix | Delete
chosen_style = $font_style_select.val(),
[44] Fix | Delete
font,
[45] Fix | Delete
i;
[46] Fix | Delete
[47] Fix | Delete
// Google Font Chosen
[48] Fix | Delete
if (pum_google_fonts[chosen_font] !== undefined) {
[49] Fix | Delete
[50] Fix | Delete
font = pum_google_fonts[chosen_font];
[51] Fix | Delete
[52] Fix | Delete
$font_weight_options.prop('disabled', true);
[53] Fix | Delete
$font_style_options.prop('disabled', true);
[54] Fix | Delete
[55] Fix | Delete
if (font.variants.length) {
[56] Fix | Delete
for (i = 0; font.variants.length > i; i += 1) {
[57] Fix | Delete
if (font.variants[i] === 'regular') {
[58] Fix | Delete
$('option[value="400"]', $font_weight_select).prop('disabled', false);
[59] Fix | Delete
$('option[value=""]', $font_style_select).prop('disabled', false);
[60] Fix | Delete
} else {
[61] Fix | Delete
if (font.variants[i].indexOf('italic') >= 0) {
[62] Fix | Delete
$('option[value="italic"]', $font_style_select).prop('disabled', false);
[63] Fix | Delete
}
[64] Fix | Delete
$('option[value="' + parseInt(font.variants[i], 10) + '"]', $font_weight_select).prop('disabled', false);
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
}
[68] Fix | Delete
// Standard Font Chosen
[69] Fix | Delete
} else {
[70] Fix | Delete
$font_weight_options.prop('disabled', false);
[71] Fix | Delete
$font_style_options.prop('disabled', false);
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
if (chosen_weight === '' || $font_weight_options.filter('[value="' + chosen_weight + '"]').is(':disabled')) {
[75] Fix | Delete
for (i = 0; font_weights.length > i; i += 1) {
[76] Fix | Delete
if (!$font_weight_options.filter('[value="' + font_weights[i] + '"]').is(':disabled')) {
[77] Fix | Delete
$font_weight_select.val(font_weights[i]);
[78] Fix | Delete
break;
[79] Fix | Delete
}
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
if ($font_style_options.filter('[value="' + chosen_style + '"]').is(':disabled')) {
[84] Fix | Delete
for (i = 0; font_styles.length > i; i += 1) {
[85] Fix | Delete
if (!$font_style_options.filter('[value="' + font_styles[i] + '"]').is(':disabled')) {
[86] Fix | Delete
$font_style_select.val(font_styles[i]);
[87] Fix | Delete
break;
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
// Update Select2 if enabled.
[93] Fix | Delete
$font_family_select.trigger('change.select2');
[94] Fix | Delete
$font_weight_select.trigger('change.select2');
[95] Fix | Delete
$font_family_select.trigger('change.select2');
[96] Fix | Delete
[97] Fix | Delete
$font_weight_select = $font_weight_select.parents('.pum-field');
[98] Fix | Delete
if ($font_weight_options.filter(':not(:disabled)').length > 1) {
[99] Fix | Delete
$font_weight_select.show();
[100] Fix | Delete
} else {
[101] Fix | Delete
$font_weight_select.hide();
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
$font_family_select = $font_style_select.parents('.pum-field');
[105] Fix | Delete
if ($font_style_options.filter(':not(:disabled)').length > 1) {
[106] Fix | Delete
$font_family_select.show();
[107] Fix | Delete
} else {
[108] Fix | Delete
$font_family_select.hide();
[109] Fix | Delete
}
[110] Fix | Delete
},
[111] Fix | Delete
update_font_selectboxes: function () {
[112] Fix | Delete
return $('select[id$="_font_family"]').each(function () {
[113] Fix | Delete
PUM_Admin.themeEditor.update_font_options($(this).attr('id').replace('_font_family', ''));
[114] Fix | Delete
});
[115] Fix | Delete
},
[116] Fix | Delete
update_loaded_font: function (prefix) {
[117] Fix | Delete
var $font_family_select = $('select[id="' + prefix + '_font_family"]'),
[118] Fix | Delete
$font_weight_select = $('select[id="' + prefix + '_font_weight"]'),
[119] Fix | Delete
$font_style_select = $('select[id="' + prefix + '_font_style"]'),
[120] Fix | Delete
chosen_font = $font_family_select.val(),
[121] Fix | Delete
chosen_weight = $font_weight_select.val(),
[122] Fix | Delete
chosen_style = $font_style_select.val(),
[123] Fix | Delete
$link = $('link#pum-' + prefix + 'google-font'),
[124] Fix | Delete
$new_link = $('<link id="pum-' + prefix + 'google-font" rel="stylesheet" type="text/css">'),
[125] Fix | Delete
url;
[126] Fix | Delete
[127] Fix | Delete
if (typeof pum_google_fonts[chosen_font] !== 'undefined') {
[128] Fix | Delete
url = "//fonts.googleapis.com/css?family=" + chosen_font;
[129] Fix | Delete
[130] Fix | Delete
if (chosen_weight !== 'normal') {
[131] Fix | Delete
url += ":" + chosen_weight;
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
if (chosen_style === 'italic') {
[135] Fix | Delete
if (url.indexOf(':') === -1) {
[136] Fix | Delete
url += ":";
[137] Fix | Delete
}
[138] Fix | Delete
url += "italic";
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
$new_link.attr('href', url);
[142] Fix | Delete
[143] Fix | Delete
if ($link.length) {
[144] Fix | Delete
if ($link.attr('href') !== url) {
[145] Fix | Delete
$link.replaceWith($new_link);
[146] Fix | Delete
}
[147] Fix | Delete
} else {
[148] Fix | Delete
$('body').append($new_link);
[149] Fix | Delete
}
[150] Fix | Delete
} else {
[151] Fix | Delete
$link.remove();
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
},
[155] Fix | Delete
update_loaded_fonts: function() {
[156] Fix | Delete
return $('select[id$="_font_family"]').each(function () {
[157] Fix | Delete
PUM_Admin.themeEditor.update_loaded_font($(this).attr('id').replace('_font_family', ''));
[158] Fix | Delete
});
[159] Fix | Delete
},
[160] Fix | Delete
refresh_preview: function () {
[161] Fix | Delete
var form_values = $('#pum-theme-settings-container').pumSerializeObject(),
[162] Fix | Delete
theme_settings = form_values.theme_settings;
[163] Fix | Delete
[164] Fix | Delete
// Remap deprecated settings so they work.
[165] Fix | Delete
// Remove this after ATB updated.
[166] Fix | Delete
if (typeof window.PUM_ATB !== 'undefined') {
[167] Fix | Delete
delete form_values.theme_settings;
[168] Fix | Delete
[169] Fix | Delete
for (var old_setting in form_values) {
[170] Fix | Delete
if (form_values.hasOwnProperty(old_setting))
[171] Fix | Delete
theme_settings[old_setting.replace('popup_theme_','')] = form_values[old_setting];
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
PUM_Admin.themeEditor.restyle_preview(theme_settings);
[176] Fix | Delete
},
[177] Fix | Delete
restyle_preview: function (theme) {
[178] Fix | Delete
var $overlay = $('.pum-popup-overlay'),
[179] Fix | Delete
$container = $('.pum-popup-container'),
[180] Fix | Delete
$title = $('.pum-popup-title', $container),
[181] Fix | Delete
$content = $('.pum-popup-content', $container),
[182] Fix | Delete
$close = $('.pum-popup-close', $container),
[183] Fix | Delete
container_inset = theme.container_boxshadow_inset === 'yes' ? 'inset ' : '',
[184] Fix | Delete
close_inset = theme.close_boxshadow_inset === 'yes' ? 'inset ' : '',
[185] Fix | Delete
top, left, right, bottom;
[186] Fix | Delete
[187] Fix | Delete
PUM_Admin.themeEditor.update_loaded_fonts();
[188] Fix | Delete
[189] Fix | Delete
$overlay.removeAttr('style').css({
[190] Fix | Delete
backgroundColor: window.PUM_Admin.utils.convert_hex(theme.overlay_background_color, theme.overlay_background_opacity)
[191] Fix | Delete
});
[192] Fix | Delete
$container.removeAttr('style').css({
[193] Fix | Delete
padding: theme.container_padding + 'px',
[194] Fix | Delete
backgroundColor: window.PUM_Admin.utils.convert_hex(theme.container_background_color, theme.container_background_opacity),
[195] Fix | Delete
borderStyle: theme.container_border_style,
[196] Fix | Delete
borderColor: theme.container_border_color,
[197] Fix | Delete
borderWidth: theme.container_border_width + 'px',
[198] Fix | Delete
borderRadius: theme.container_border_radius + 'px',
[199] Fix | Delete
boxShadow: container_inset + theme.container_boxshadow_horizontal + 'px ' + theme.container_boxshadow_vertical + 'px ' + theme.container_boxshadow_blur + 'px ' + theme.container_boxshadow_spread + 'px ' + window.PUM_Admin.utils.convert_hex(theme.container_boxshadow_color, theme.container_boxshadow_opacity)
[200] Fix | Delete
});
[201] Fix | Delete
$title.removeAttr('style').css({
[202] Fix | Delete
color: theme.title_font_color,
[203] Fix | Delete
lineHeight: theme.title_line_height + 'px',
[204] Fix | Delete
fontSize: theme.title_font_size + 'px',
[205] Fix | Delete
fontFamily: theme.title_font_family,
[206] Fix | Delete
fontStyle: theme.title_font_style,
[207] Fix | Delete
fontWeight: theme.title_font_weight,
[208] Fix | Delete
textAlign: theme.title_text_align,
[209] Fix | Delete
textShadow: theme.title_textshadow_horizontal + 'px ' + theme.title_textshadow_vertical + 'px ' + theme.title_textshadow_blur + 'px ' + window.PUM_Admin.utils.convert_hex(theme.title_textshadow_color, theme.title_textshadow_opacity)
[210] Fix | Delete
});
[211] Fix | Delete
$content.removeAttr('style').css({
[212] Fix | Delete
color: theme.content_font_color,
[213] Fix | Delete
//fontSize: theme.content_font_size+'px',
[214] Fix | Delete
fontFamily: theme.content_font_family,
[215] Fix | Delete
fontStyle: theme.content_font_style,
[216] Fix | Delete
fontWeight: theme.content_font_weight
[217] Fix | Delete
});
[218] Fix | Delete
$close.html(theme.close_text).removeAttr('style').css({
[219] Fix | Delete
position: theme.close_position_outside ? 'fixed' : 'absolute',
[220] Fix | Delete
padding: theme.close_padding + 'px',
[221] Fix | Delete
height: theme.close_height > 0 ? theme.close_height + 'px' : 'auto',
[222] Fix | Delete
width: theme.close_width > 0 ? theme.close_width + 'px' : 'auto',
[223] Fix | Delete
backgroundColor: window.PUM_Admin.utils.convert_hex(theme.close_background_color, theme.close_background_opacity),
[224] Fix | Delete
color: theme.close_font_color,
[225] Fix | Delete
lineHeight: theme.close_line_height + 'px',
[226] Fix | Delete
fontSize: theme.close_font_size + 'px',
[227] Fix | Delete
fontFamily: theme.close_font_family,
[228] Fix | Delete
fontWeight: theme.close_font_weight,
[229] Fix | Delete
fontStyle: theme.close_font_style,
[230] Fix | Delete
borderStyle: theme.close_border_style,
[231] Fix | Delete
borderColor: theme.close_border_color,
[232] Fix | Delete
borderWidth: theme.close_border_width + 'px',
[233] Fix | Delete
borderRadius: theme.close_border_radius + 'px',
[234] Fix | Delete
boxShadow: close_inset + theme.close_boxshadow_horizontal + 'px ' + theme.close_boxshadow_vertical + 'px ' + theme.close_boxshadow_blur + 'px ' + theme.close_boxshadow_spread + 'px ' + window.PUM_Admin.utils.convert_hex(theme.close_boxshadow_color, theme.close_boxshadow_opacity),
[235] Fix | Delete
textShadow: theme.close_textshadow_horizontal + 'px ' + theme.close_textshadow_vertical + 'px ' + theme.close_textshadow_blur + 'px ' + window.PUM_Admin.utils.convert_hex(theme.close_textshadow_color, theme.close_textshadow_opacity)
[236] Fix | Delete
});
[237] Fix | Delete
[238] Fix | Delete
[239] Fix | Delete
top = theme.close_position_top + (theme.close_position_outside ? $('#wpadminbar').outerHeight() : 0);
[240] Fix | Delete
left = theme.close_position_left + (theme.close_position_outside ? $('#adminmenuwrap').outerWidth() : 0);
[241] Fix | Delete
right = theme.close_position_right;
[242] Fix | Delete
bottom = theme.close_position_bottom;
[243] Fix | Delete
[244] Fix | Delete
[245] Fix | Delete
switch (theme.close_location) {
[246] Fix | Delete
[247] Fix | Delete
[248] Fix | Delete
case "topleft":
[249] Fix | Delete
$close.css({
[250] Fix | Delete
top: top + 'px',
[251] Fix | Delete
left: left + 'px'
[252] Fix | Delete
});
[253] Fix | Delete
break;
[254] Fix | Delete
[255] Fix | Delete
case "topcenter":
[256] Fix | Delete
$close.css({
[257] Fix | Delete
top: top + 'px',
[258] Fix | Delete
left: '50%',
[259] Fix | Delete
transform: 'translateX(-50%)'
[260] Fix | Delete
// left: 0,
[261] Fix | Delete
// right: 0,
[262] Fix | Delete
// left: 0,
[263] Fix | Delete
// margin: 'auto'
[264] Fix | Delete
});
[265] Fix | Delete
break;
[266] Fix | Delete
[267] Fix | Delete
case "topright":
[268] Fix | Delete
$close.css({
[269] Fix | Delete
top: top + 'px',
[270] Fix | Delete
right: right + 'px'
[271] Fix | Delete
});
[272] Fix | Delete
break;
[273] Fix | Delete
[274] Fix | Delete
case 'middleleft':
[275] Fix | Delete
$close.css({
[276] Fix | Delete
top: '50%',
[277] Fix | Delete
left: left + 'px',
[278] Fix | Delete
transform: 'translateY(-50%)'
[279] Fix | Delete
});
[280] Fix | Delete
break;
[281] Fix | Delete
[282] Fix | Delete
case 'middleright':
[283] Fix | Delete
$close.css({
[284] Fix | Delete
top: '50%',
[285] Fix | Delete
right: right + 'px',
[286] Fix | Delete
transform: 'translateY(-50%)'
[287] Fix | Delete
});
[288] Fix | Delete
break;
[289] Fix | Delete
[290] Fix | Delete
case "bottomleft":
[291] Fix | Delete
$close.css({
[292] Fix | Delete
bottom: bottom + 'px',
[293] Fix | Delete
left: left + 'px'
[294] Fix | Delete
});
[295] Fix | Delete
break;
[296] Fix | Delete
[297] Fix | Delete
case "bottomcenter":
[298] Fix | Delete
$close.css({
[299] Fix | Delete
bottom: bottom + 'px',
[300] Fix | Delete
left: '50%',
[301] Fix | Delete
transform: 'translateX(-50%)'
[302] Fix | Delete
// left: 0,
[303] Fix | Delete
// right: 0,
[304] Fix | Delete
// left: 0,
[305] Fix | Delete
// margin: 'auto'
[306] Fix | Delete
});
[307] Fix | Delete
break;
[308] Fix | Delete
[309] Fix | Delete
case "bottomright":
[310] Fix | Delete
$close.css({
[311] Fix | Delete
bottom: bottom + 'px',
[312] Fix | Delete
right: right + 'px'
[313] Fix | Delete
});
[314] Fix | Delete
break;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
/** @deprecated 1.8.0 */
[318] Fix | Delete
$(document).trigger('popmake-admin-retheme', [theme]);
[319] Fix | Delete
[320] Fix | Delete
$(document).trigger('pumRestylePreview', [theme]);
[321] Fix | Delete
}
[322] Fix | Delete
};
[323] Fix | Delete
[324] Fix | Delete
$(document)
[325] Fix | Delete
.on('change', 'select[id$="_font_family"]', function () {
[326] Fix | Delete
var prefix = $(this).attr('id').replace('_font_family', '');
[327] Fix | Delete
[328] Fix | Delete
PUM_Admin.themeEditor.update_font_options(prefix);
[329] Fix | Delete
})
[330] Fix | Delete
/**
[331] Fix | Delete
* Change to the appropriate tab when an element is clicked. IE click the close button in preview and trigger the close tab.
[332] Fix | Delete
*/
[333] Fix | Delete
.on('click', '.pum-popup-overlay, .pum-popup-container, .pum-popup-title, .pum-popup-content, .pum-popup-close', function (event) {
[334] Fix | Delete
var $this = $(this),
[335] Fix | Delete
clicked_class = $this.attr('class');
[336] Fix | Delete
[337] Fix | Delete
event.preventDefault();
[338] Fix | Delete
event.stopPropagation();
[339] Fix | Delete
[340] Fix | Delete
switch (clicked_class) {
[341] Fix | Delete
case 'pum-popup-overlay':
[342] Fix | Delete
$('a[href="#pum-theme-settings_overlay"]')[0].click();
[343] Fix | Delete
break;
[344] Fix | Delete
case 'pum-popup-container':
[345] Fix | Delete
$('a[href="#pum-theme-settings_container"]')[0].click();
[346] Fix | Delete
break;
[347] Fix | Delete
case 'pum-popup-title':
[348] Fix | Delete
$('a[href="#pum-theme-settings_title"]')[0].click();
[349] Fix | Delete
break;
[350] Fix | Delete
case 'pum-popup-content':
[351] Fix | Delete
$('a[href="#pum-theme-settings_content"]')[0].click();
[352] Fix | Delete
break;
[353] Fix | Delete
case 'pum-popup-close':
[354] Fix | Delete
$('a[href="#pum-theme-settings_close"]')[0].click();
[355] Fix | Delete
break;
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
$("html, body").animate({
[359] Fix | Delete
scrollTop: ($('#pum_theme_settings').offset().top - 40) + 'px'
[360] Fix | Delete
});
[361] Fix | Delete
})
[362] Fix | Delete
/**
[363] Fix | Delete
* Trigger preview update after any field change.
[364] Fix | Delete
*/
[365] Fix | Delete
.on('change colorchange input focusout', '.pum-field select, .pum-field input', function () {
[366] Fix | Delete
PUM_Admin.themeEditor.refresh_preview();
[367] Fix | Delete
});
[368] Fix | Delete
[369] Fix | Delete
// Initiate when ready.
[370] Fix | Delete
$(function () {
[371] Fix | Delete
$(this).trigger('pum_init');
[372] Fix | Delete
[373] Fix | Delete
var $container = $('#pum-theme-settings-container'),
[374] Fix | Delete
args = pum_theme_settings_editor.form_args || {},
[375] Fix | Delete
values = pum_theme_settings_editor.current_values || {};
[376] Fix | Delete
[377] Fix | Delete
if ($container.length) {
[378] Fix | Delete
$container.find('.pum-no-js').hide();
[379] Fix | Delete
PUM_Admin.forms.render(args, values, $container);
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
PUM_Admin.themeEditor.preview_fixed_scroll();
[383] Fix | Delete
PUM_Admin.themeEditor.refresh_preview();
[384] Fix | Delete
});
[385] Fix | Delete
[386] Fix | Delete
}(jQuery));
[387] Fix | Delete
[388] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function