%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/proc/self/root/var/www/html/old/media/mod_pwebbox/js/ |
Upload File : |
/**
* @package pwebbox
* @version 2.0.0
*
* @copyright Copyright (C) 2018 Perfect Web. All rights reserved. http://www.perfect-web.co
* @license GNU General Public Licence http://www.gnu.org/licenses/gpl-3.0.html
*/
jQuery(document).ready(function($) {
var toolbox = {};
/**
* Code lifted directly from isis template Joomla! v3.8.7
* used to init radio buttons after ajax form field loaded
*/
toolbox.initRadioButtons = function($container) {
$('*[rel=tooltip]').tooltip();
// Turn radios into btn-group
$container.find('.radio.btn-group label').addClass('btn');
$container.find('.btn-group label:not(.active)').click(function() {
var $label = $(this),
$input = $('#' + $label.attr('for')),
value = $input.val();
if (!$input.prop('checked')) {
$label.closest('.btn-group').find('label').removeClass('active btn-success btn-danger btn-primary');
if ($label.closest('.btn-group').hasClass('btn-group-reversed')) {
if (value === '') {
$label.addClass('active btn-primary');
} else if (parseInt(value) === 0) {
$label.addClass('active btn-success');
} else {
$label.addClass('active btn-danger');
}
} else {
if (value === '') {
$label.addClass('active btn-primary');
} else if (parseInt(value) === 0) {
$label.addClass('active btn-danger');
} else {
$label.addClass('active btn-success');
}
}
$input.prop('checked', true);
$input.trigger('change');
}
});
$container.find('.btn-group input[checked=checked]').each(function() {
var $self = $(this);
var attrId = $self.attr('id');
if ($self.parent().hasClass('btn-group-reversed')) {
if ($self.val() == '') {
$('label[for=' + attrId + ']').addClass('active btn-primary');
}
else if ($self.val() == 0) {
$('label[for=' + attrId + ']').addClass('active btn-success');
}
else {
$('label[for=' + attrId + ']').addClass('active btn-danger');
}
}
else {
if ($self.val() == '') {
$('label[for=' + attrId + ']').addClass('active btn-primary');
}
else if ($self.val() == 0) {
$('label[for=' + attrId + ']').addClass('active btn-danger');
}
else {
$('label[for=' + attrId + ']').addClass('active btn-success');
}
}
});
// add color classes to chosen field based on value
$container.find('select[class^="chzn-color"], select[class*=" chzn-color"]').on('liszt:ready', function() {
var select = $(this);
var cls = this.className.replace(/^.(chzn-color[a-z0-9-_]*)$.*/, '\1');
var container = select.next('.chzn-container').find('.chzn-single');
container.addClass(cls).attr('rel', 'value_' + select.val());
select.on('change click', function() {
container.attr('rel', 'value_' + select.val());
});
});
};
/**
* Init custom toggle buttons
*/
toolbox.initTogglers = function() {
$(".pweb-button-toggler").click(function(e) {
e.preventDefault();
var $self = $(this),
targetId = $self.data('target-id');
$self.toggleClass('pweb-button-active');
$(targetId).slideToggle(500, function() {
$(this).toggleClass('pweb-hidden');
});
});
};
/**
* manager class for custom show/hide fields
* @TODO: Let's convert these to native Joomla system
*/
toolbox.showHide = {
elements: {},
init: function() {
var showHide = this;
$('[rel^=\"pweb_showon_\"]').each(function() {
showHide.bindShowon(this);
});
$('input[name="jform[params][handler]"]').each(function() {
showHide.bindHandlers(this);
});
$('input[name="jform[params][effect]"]').each(function() {
showHide.bindEffects(this);
});
$('#jform_params_handler').find('input').change(function() {
showHide.bindBottom(this);
});
},
bindShowon: function(el) {
el = $(el);
var target = el.attr('rel').replace('pweb_showon_', ''),
targetEl = $('[name=\"' + target + '\"]');
if (!this.elements[target]) {
var showHide = this,
targetType = targetEl.attr('type'),
checkType = (targetType === 'checkbox' || targetType === 'radio');
targetEl.bind('change', function() {
showHide.linkedOptions($(this), target, checkType);
})
.bind('click', function() {
showHide.linkedOptions($(this), target, checkType);
})
.each(function() {
showHide.linkedOptions($(this), target, checkType);
});
this.elements[target] = true;
}
},
bindHandlers: function(el) {
$(el).on('change', function() {
if ($(this).is(':checked')) {
var id = $(this).attr('id'),
target = '',
id_prefix = 'jform_params_handler';
if (id === (id_prefix + '0')) {
if ($('#jform_params_effect0').is(':checked')
|| $('#jform_params_effect1').is(':checked')
|| $('#jform_params_effect8').is(':checked')
) {
target = '#jform_params_effect6';
}
} else if (id === (id_prefix + '1')) {
if ($('#jform_params_effect6').is(':checked')
|| $('#jform_params_effect8').is(':checked')
) {
target = '#jform_params_effect0';
}
} else if (id === (id_prefix + '2')) {
target = '#jform_params_effect7';
} else if (id === (id_prefix + '3')) {
if ($('#jform_params_effect0').is(':checked')
|| $('#jform_params_effect1').is(':checked')
|| $('#jform_params_effect6').is(':checked')
|| $('#jform_params_effect7').is(':checked')
|| $('#jform_params_effect8').is(':checked')
) {
target = '#jform_params_effect2';
}
} else if (id === (id_prefix + '4')) {
target = '#jform_params_effect8';
}
if (target !== '') {
$(target).click();
}
}
});
},
bindEffects: function(el) {
$(el).on('change', function() {
if ($(this).is(':checked')) {
var id = $(this).attr('id'),
target = '',
id_prefix = 'jform_params_effect';
if (id === (id_prefix + '0') || id === (id_prefix + '1')) {
if ($('#jform_params_handler0').is(':checked')
|| $('#jform_params_handler2').is(':checked')
|| $('#jform_params_handler3').is(':checked')
|| $('#jform_params_handler4').is(':checked')
) {
target = '#jform_params_handler1';
}
} else if (id === (id_prefix + '2')
|| id === (id_prefix + '3')
|| id === (id_prefix + '4')
|| id === (id_prefix + '5')
) {
if ($('#jform_params_handler2').is(':checked')
|| $('#jform_params_handler4').is(':checked')
) {
target = '#jform_params_handler1';
}
} else if (id === (id_prefix + '6')) {
if ($('#jform_params_handler1').is(':checked')
|| $('#jform_params_handler2').is(':checked')
|| $('#jform_params_handler3').is(':checked')
|| $('#jform_params_handler4').is(':checked')
) {
target = '#jform_params_handler0';
}
} else if (id === (id_prefix + '7')) {
if ($('#jform_params_handler3').is(':checked')
|| $('#jform_params_handler4').is(':checked')
) {
target = '#jform_params_handler2';
}
} else if (id === (id_prefix + '8')) {
target = '#jform_params_handler4';
}
$(target).click();
}
});
},
bindBottom: function(el) {
var input, label;
if ($(el).val() === 'bottombar') {
input = $('#jform_params_open_toggler').find('input[value="1"]');
label = input.parent().find('label[for="' + input.attr("id") + '"]');
label.click();
input.prop("checked", true).trigger("change");
input.click();
$('#jform_params_open_count').val(0);
} else {
input = $('#jform_params_open_toggler').find('input[value="0"]');
label = input.parent().find('label[for="' + input.attr("id") + '"]');
label.click();
input.prop("checked", true).trigger("change");
input.click();
}
},
linkedOptions: function(element, target, checkType) {
var v = element.val(), id = element.attr('id');
if (checkType && !element.is(':checked')) {
return;
}
$('[rel=\"pweb_showon_' + target + '\"]').each(function() {
var i = jQuery(this);
if (i.hasClass('pweb_showon_' + v))
i.slideDown();
else
i.slideUp();
});
}
};
/**
* Plugin management methods
*/
var plugin = {
options: {
plugin : null,
data : null,
hashUrl: null,
gotoTop: true
},
selectors: {
display : '#jform_params_plugin_config',
container: '#pweb-plugin-params-container',
buttons : '.pweb-button-content',
wrapper : '.pweb-btn-content-wrapper',
idBase : '#pweb-btn-content-',
title : '#pweb_page_title_content',
current : '#jform_params_plugin',
effects : '#pweb_accordion1'
},
request: {
option: 'com_ajax',
group : 'everything_in_everyway',
data : null,
plugin: null,
format: 'json'
},
current: null,
/**
* @param {object} selectors
*/
init: function(selectors) {
$.extend(this.selectors, selectors);
this.current = $(this.selectors.current);
var plugin = this,
currentPlugin = this.current.val(),
$button = null;
$(this.selectors.buttons).on('click', function(e) {
e.preventDefault();
plugin.ajax($(this));
});
// If id in URL is set and if not load plugin.
if (window.location.href.indexOf("&id=") < 0) {
var pluginHash = window.location.hash;
if (pluginHash) {
var hashArray = pluginHash.split('-');
if (hashArray[1]) {
$button = $(this.selectors.idBase + hashArray[1]);
this.ajax($button);
}
}
} else if (currentPlugin) {
$button = $(this.selectors.buttons + '[data-content="' + currentPlugin + '"]');
if ($button[0]) {
this.ajax($button, true);
}
}
},
setPageTitle: function() {
var pluginType = this.current.val(),
$button = $(this.selectors.idBase + pluginType),
pluginName = $button.data('name'),
$pwebTitle = $('#pweb-page-title');
if (pluginType) {
if (!$pwebTitle[0]) {
$('.page-title').append('<span id="pweb-page-title"> - <span></span></span>')
$pwebTitle = $($pwebTitle.selector);
}
$pwebTitle.find('span').html(pluginName || pluginType);
} else {
$pwebTitle.remove();
}
},
/**
*
* @param {jQuery} $button
* @param {boolean} init
*/
ajax: function($button, init) {
init = init || false;
var currentPlugin = this.current.val(),
selectedPlugin = $button.data('content'),
config = $button.data('defaultConfig');
plugin.errorMessage();
if (!init && currentPlugin === selectedPlugin) {
this.gotoTop();
return;
}
var request = $.extend(
{},
plugin.request,
{
data : $.ShackToolbox[selectedPlugin] || {},
plugin: $button.data('content')
}
);
$.ajax(
'index.php',
{
data : request,
success : function(response, status, $xhr) {
if (response.data && response.data.length === 1) {
// Clear any previous selections
$(plugin.selectors.container + ' ' + plugin.selectors.wrapper).removeClass('active');
plugin.current.val('');
plugin.updateForm('');
$button.parents(plugin.selectors.wrapper).addClass('active');
plugin.current.val(response.data[0].plugin);
plugin.updateForm(response.data[0].html);
toolbox.initRadioButtons($(plugin.selectors.display));
plugin.clearDisabledParams();
plugin.disableParams(config);
if (!init) {
plugin.setParams(config, 'required');
if (!currentPlugin) {
// Set optional parameters only if no previous selection
plugin.setParams(config, 'optional');
}
}
// @TODO: Needs review. It's kind of terrible
if (currentPlugin === 'link') {
$('#jform_params_open_event').parents('.control-group').addClass('pweb-hidden');
$('#jform_params_close_event').parents('.control-group').addClass('pweb-hidden');
$('[id*="autoopenclose"]').parents('.control-group').addClass('pweb-hidden');
$('[id$="open_toggler"] [value="0"]').click();
$('#jform_params_open_toggler').parents('.control-group').addClass('pweb-hidden');
$('#jform_params_close_delay').parents('.control-group').addClass('pweb-hidden');
$('[id$="effect"] input[value="static:none"]').click();
} else {
$('#jform_params_open_event').parents('.control-group').removeClass('pweb-hidden');
$('#jform_params_close_event').parents('.control-group').removeClass('pweb-hidden');
$('#jform_params_openclose-lbl').parents('.control-group').removeClass('pweb-hidden');
$('#jform_params_open_toggler').parents('.control-group').removeClass('pweb-hidden');
$('#jform_params_close_delay').parents('.control-group').removeClass('pweb-hidden');
}
} else if (response.message) {
plugin.errorMessage(response.message)
} else if (response.messages) {
plugin.errorMessage(response.messages.join('<br/>'));
} else {
plugin.errorMessage('Unknown Response');
}
},
error : function($xhr, status, errorText) {
var body = $('<div>').text($xhr.responseText).html();
plugin.errorMessage(body, status + ': ' + errorText);
},
complete: function($xhr, status) {
plugin.gotoTop();
}
}
)
},
gotoTop: function() {
if (this.options.gotoTop) {
$('html, body')
.animate({
scrollTop: 0
},
500
);
}
},
setParams: function(defaultConfig, type) {
if (defaultConfig) {
var params = null;
if (type === 'required' && defaultConfig.required) {
params = defaultConfig.required;
} else if (type === 'optional' && defaultConfig.optional) {
params = defaultConfig.optional;
}
if (params) {
$.each(params, function(option, value) {
var field = $("#jform_params_" + option),
input = null,
label = null,
optionText = null;
// Set default theme.
if (option === 'theme') {
$('#pweb-themes-coverflow').find("[data-name='" + value + "']").click();
$('#pweb-themes-coverflow-control-load').click();
}
// Check if field exists.
if (field.prop('tagName')) {
switch (field.prop("tagName").toLowerCase()) {
case '"fieldset':
// Set value for radio inputs.
input = field.find('input[value="' + value + '"]');
label = input.parent().find('label[for="' + input.attr("id") + '"]');
label.click();
input.prop("checked", true).trigger("change");
input.click();
break;
case 'select':
// Set value for select inputs.
option = field.find('option[value="' + value + '"]');
optionText = option.text();
option.prop("selected", true).trigger("change");
option.parent().parent().find('.chzn-container .chzn-single span').html(optionText);
break;
default:
// Set value for text inputs.
field.val(value).trigger("change");
field.click();
break;
}
}
});
}
}
},
disableParams: function(defaultConfig) {
if (defaultConfig) {
if (defaultConfig.disabled) {
$.each(defaultConfig.disabled, function(option, value) {
var field = $("#jform_params_" + option),
input = null,
label = null,
valuesArray = null,
wrongSelection = false,
rightSelection = null;
if (value !== 'disable-all') {
valuesArray = value.split(',');
}
if (field.prop('tagName')) {
switch (field.prop('tagName').toLowerCase()) {
case 'fieldset':
if (value === 'disable-all') {
field.attr('disabled', 'disabled');
field.addClass('disabled');
field.find('input').each(function() {
$(this).addClass('disabled');
$(this).attr('disabled', 'disabled');
});
field.find('label').each(function() {
$(this).addClass('disabled');
$(this).attr('disabled', 'disabled');
$(this).css('cursor', 'not-allowed');
});
} else {
// If disable some options from fieldset.
$.each(valuesArray, function(opt, val) {
input = field.find('input[value="' + val + '"]');
// Check if disabled option is selected.
if (input.is(':checked')) {
wrongSelection = true;
}
label = input.parent().find('label[for="' + input.attr("id") + '"]');
input.attr("disabled", "disabled");
input.addClass("disabled");
label.attr("disabled", "disabled");
label.addClass("disabled");
label.css("cursor", "not-allowed");
});
// If disabled option is selected, then select first enabled option.
if (wrongSelection) {
rightSelection = field.find('input:not(.disabled)').first();
if (rightSelection) {
label = rightSelection.parent().find('label[for="' + rightSelection.attr("id") + '"]');
label.click();
rightSelection.prop("checked", true).trigger("change");
rightSelection.click();
}
}
}
break;
case 'select':
// Set value for select inputs.
if (value === 'disable-all') {
field.attr("disabled", "disabled");
field.addClass("disabled");
}
else {
$.each(valuesArray, function(opt, val) {
field.find('option[value="' + val + '"]').attr('disabled', 'disabled');
field.find('option[value="' + val + '"]').addClass('disabled');
});
}
break;
default:
// Set value for text inputs.
field.attr('disabled', 'disabled');
field.addClass('disabled');
break;
}
}
});
}
}
},
clearDisabledParams() {
$(this.selectors.effects + ' fieldset').each(function() {
$(this).removeAttr("disabled");
$(this).removeClass("disabled");
});
$(this.selectors.effects + ' select').each(function() {
$(this).removeAttr("disabled");
$(this).removeClass("disabled");
$(this).find('option').each(function() {
$(this).removeAttr("disabled");
$(this).removeClass("disabled");
});
});
$(this.selectors.effects + ' input').each(function() {
$(this).removeAttr("disabled");
$(this).removeClass("disabled");
});
$(this.selectors.effects + ' label').each(function() {
$(this).removeAttr("disabled");
$(this).removeClass("disabled");
$(this).css("cursor", "pointer");
});
},
errorMessage: function(text, title) {
var $message = $('#plugin-error-response');
if (text || title) {
if (!$message[0]) {
$message = $('<div>')
.attr({id: 'plugin-error-response', class: 'alert alert-error span12'});
}
} else if ($message[0]) {
$message.slideUp(500, function() {
$message.remove();
});
}
if (title || text) {
title = title ? '<h3>' + title + '</h3>' : '';
$message.html('').html(title + text);
this.updateForm($message, 'prepend');
}
},
updateForm: function(text, type) {
var $display = $(this.selectors.display);
if (text === '') {
$display.slideUp().html(text)
} else {
switch (type) {
case 'prepend':
$display.prepend(text);
break;
case 'append':
$display.append(text);
break;
default:
$display.html(text);
break;
}
$display.slideDown();
}
this.setPageTitle();
}
};
/**
* @param {object} selectors
* @param {function} postInit
*
* @constructor
*/
var Flipster = function(selectors, postInit) {
this.selectors = $.extend({
flipster: '#pweb-themes-coverflow'
}, selectors);
this.element = $(this.selectors.flipster);
this.controller = null;
this.start = this.element.find('.pweb-active-theme').index();
if (this.start < 0) {
this.start = 3;
}
this.resize = function() {
if (this.controller) {
this.controller.resize();
}
};
this.init(postInit);
};
Flipster.prototype.init = function(postInit) {
var flipster = this;
$(window).on('load', function() {
flipster.controller = flipster.element.flipster({
itemContainer : "ul",
itemSelector : "li",
style : "coverflow",
start : flipster.start,
enableKeyboard : false,
enableMousewheel: false,
enableTouch : true,
enableNav : false,
enableNavButtons: false
});
flipster.resize();
if (postInit) {
postInit(true);
}
});
$(this.selectors.tabs).on('click', 'a[href="#attrib-mod_pwebbox_layout"]', function(e) {
e.preventDefault();
// Need a slight pause for things to settle down
setTimeout(function() {
flipster.resize();
}, 50);
});
};
var theme = {
selectors: {
active : '.pweb-active-theme',
previous: '#pweb-themes-coverflow-control-prev',
next : '#pweb-themes-coverflow-control-next',
load : '#pweb-themes-coverflow-control-load',
clear : '#pweb_clear_theme_settings',
tabs : '#myTabTabs'
},
flipster: null,
current : null,
init: function(selectors) {
$.extend(this.selectors, selectors);
this.flipster = new Flipster(this.selectors, this.setSelected);
this.setNavigation();
toolbox.initTogglers();
},
setSelected: function(init) {
init = init || false;
theme.current = theme.flipster.element.find('.flip-current .pweb-theme');
if (init) {
return;
}
var name = theme.current.data('name'),
title = theme.current.data('title'),
settings = theme.current.data("settings"),
description = theme.current.find('.pweb-theme-caption p');
$("#jform_params_theme").val(name);
// set all the form fields from settings object
$.each(settings, function(option, value) {
var field = $("#pweb_themes_advanced_options #jform_params_" + option),
input = null,
label = null,
optionText = null;
// Check if field exists.
if (field.prop("tagName")) {
if (field.prop("tagName").toLowerCase() === "fieldset") {
// Set value for radio inputs.
input = field.find('input[value="' + value + '"]');
label = input.parent().find('label[for="' + input.attr("id") + '"]');
label.click();
input.prop("checked", true).trigger("change");
input.click();
} else if (field.prop("tagName").toLowerCase() === "select") {
// Set value for select inputs.
option = field.find('option[value="' + value + '"]');
optionText = option.text();
option.prop("selected", true).trigger("change");
option.parent().parent().find('.chzn-container .chzn-single span').html(optionText);
} else {
// Set value for text inputs.
field.val(value).trigger("change");
field.click();
}
}
});
// Reset minicolors color picker.
$('#pweb_themes_advanced_options input.minicolors').each(function() {
var color = $(this).val();
$(this).minicolors('value', color);
});
// Set theme settings info.
var imageWrapper = $('.pweb-theme-active-info-image'),
infoWrapper = $('.pweb-theme-active-info-caption'),
infoImage = imageWrapper.find('img'),
themeUrl = imageWrapper.data('url'),
infoTitle = infoWrapper.find('h3'),
infoDescription = infoWrapper.find('p');
infoImage.attr('src', themeUrl + name + '.jpg');
infoTitle.html(title);
infoDescription.html(description.html());
$('#pweb_acc_theme_name').html(title);
$('#pweb_summary_layout span').html(title);
$('#pweb_theme_acc_group').removeClass('pweb-hidden');
},
setNavigation: function() {
var theme = this;
// Themes coverflow navigation
$(this.selectors.previous).on('click', function(evt) {
evt.preventDefault();
theme.flipster.element.find('.flip-current').prev('.flip-item').trigger('click');
});
$(this.selectors.next).on('click', function(evt) {
evt.preventDefault();
theme.flipster.element.find('.flip-current').next('.flip-item').trigger('click');
});
$(this.selectors.load).on('click', function(evt) {
evt.preventDefault();
theme.setSelected();
});
// Reset to default theme settings
$(this.selectors.clear).on('click', function(evt) {
evt.preventDefault();
theme.setSelected();
});
}
};
plugin.init();
theme.init();
toolbox.showHide.init();
});