Files
roi-theme/wp-content/plugins/sociallocker-next-premium/bizpanda/assets/admin/js/metaboxes/visability.010001.js
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

100 lines
3.3 KiB
JavaScript
Executable File

(function($){
/**
* Visability Options.
*/
window.visibilityOptions = {
init: function() {
this.initSwitcher();
this.initSimpleOptions();
this.initAdvancedOptions();
},
initSwitcher: function() {
var $buttons = $(".bp-options-switcher .btn");
var selectOptions = function( value ) {
if ( !value ) value = $("#opanda_visibility_mode").val();
$buttons.removeClass('active');
if ( 'simple' === value ) {
$(".bp-options-switcher .btn-btn-simple").addClass('active');
$("#bp-advanced-visibility-options").hide();
$("#bp-simple-visibility-options").fadeIn(300);
} else {
$(".bp-options-switcher .btn-btn-advanced").addClass('active');
$("#bp-simple-visibility-options").hide();
$("#bp-advanced-visibility-options").fadeIn(300);
}
$("#opanda_visibility_mode").val(value);
};
$buttons = $(".bp-options-switcher .btn").click(function(){
var value = $(this).data('value');
selectOptions(value);
return false;
});
selectOptions();
},
initSimpleOptions: function() {
var self = this;
$("#opanda_relock").change(function(){
if ( $(this).is(":checked") ) {
$("#onp-sl-relock-options").hide().removeClass('hide');
$("#onp-sl-relock-options").fadeIn();
} else {
$("#onp-sl-relock-options").hide();
}
});
},
initAdvancedOptions: function() {
var self = this;
var $btnShow = $("#bp-show-more-visability-options");
var $btnSave = $("#bp-advanced-visability-options .bp-save");
var $modal = $("#bp-advanced-visability-options");
var $hidden = $("#opanda_visibility_filters");
var $editor = $("#bp-advanced-visability-options");
// creating an editor
var value = $hidden.val();
$editor.bpConditionEditor({
filters: value ? $.parseJSON( value ) : {}
});
// shows an editor on clicking the button Show
$btnShow.click(function(){
$modal.factoryBootstrap331_modal("show");
});
// saves conditions on clicking the button Save
$btnSave.click(function(){
var data = $editor.bpConditionEditor("getData");
console.log(data);
var json = JSON.stringify(data);
$hidden.val(json);
$modal.factoryBootstrap331_modal("hide");
});
}
};
$(function(){
window.visibilityOptions.init();
});
})(jQuery);