Skip to content

Instantly share code, notes, and snippets.

View Pross's full-sized avatar
💬

Simon Prosser Pross

💬
View GitHub Profile
var oldFadeIn = jQuery.fn.fadeIn;
jQuery.fn.fadeIn = function(){
jQuery(this).trigger('fadeInComplete');
return oldFadeIn.apply( this, arguments );
}
jQuery('.foo .fl-success-msg').on('fadeInComplete', function(){
// do some magic here
console.log('bar')
});
diff --git a/common/helpers.php b/common/helpers.php
index 6fe1ca4..fc436fd 100644
--- a/common/helpers.php
+++ b/common/helpers.php
@@ -16,8 +16,12 @@ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
return isset( $_GET['cs-render'] ) && $_GET['cs-render'] === '1';
}
+ static function is_beaver_builder() {
+ return isset( $_GET['fl_builder'] );
@Pross
Pross / functions.php
Created November 17, 2023 17:45
Show hook location with fl_hooks $_GET is used in Beaver Builder
<php
/**
* Show hook location with fl_hooks $_GET is used.
*/
add_action( 'template_redirect', function() {
if ( ! isset( $_REQUEST['fl_hooks'] ) ) {
return false;
}
@Pross
Pross / functions.php
Created September 14, 2017 17:27
Some animations using animate.css
<?php
// The following code is designed to be added to your child theme functions.php
// It adds a new 'Animation Redux' setting under the advanced tab for any module.
add_filter( 'fl_builder_module_custom_class', 'fl_builder_module_custom_class_filter', 10, 2 );
function fl_builder_module_custom_class_filter( $class, $module ) {
$animate = '';
if ( ! empty( $module->settings->animation_redux ) ) {
$animate = ' animated ' . $module->settings->animation_redux;
wp_enqueue_style( 'animate-css', '//cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css' );
@Pross
Pross / bb-cleanup.php
Created September 1, 2021 18:30
Mini plugin for Beaver Builder that clears all history states and draft data weekly for people on crippled potato hosting.
<?php
/*
Plugin Name: Beaver Builder Cleanup Tool
Description: Clears temporary data weekly
Author: <Simon>
Version: 1.0
*/
class BB_Cleanup {
protected $seconds = 604800; // Weekly.
function __construct() {
@Pross
Pross / gist:f2bfa701327bf4ee60576daa3215083c
Created February 28, 2023 20:13
Auto unselect unused modules
jQuery('.fl-settings-form-content label').each(function(){if(~jQuery(this).prop('innerText').indexOf("( Not used )")){jQuery(this).find('input').prop('checked',false)}});
@Pross
Pross / functions.php
Created December 19, 2019 19:39
10m challenge.. add to mu-plugins to show latest commits and branches in admin bar
<?php
add_action( 'admin_bar_menu', function() {
global $wp_admin_bar;
$menu_id = 'bb-git';
$wp_admin_bar->add_menu( array(
'id' => $menu_id,
'title' => __( 'BB - Git Helper' ),
) );
@Pross
Pross / functions.php
Created July 29, 2021 17:57
Random row animations
<?php
add_filter( 'fl_builder_node_settings', function( $settings, $node ) {
if ( 'module' === $node->type ) {
$animations = array(
'fade-in',
'fade-left',
'fade-right',
'fade-up',
@Pross
Pross / gist:c4c24fc59f543f9284b21881ad9c06c5
Last active November 16, 2022 19:38
New iframe UI docs

Beaver Builder IFrame UI

This PR introduces an updated builder interface that uses an iframe to display the layout you are editing for accurate previews at different device sizes. The responsive editing interface has also been updated to allow you to preview the layout at any size you'd like while you're editing.

The iframe UI works by using two "windows." One is the browser window you use to view the builder, also referred to as the parent window. The other is an iframe window used to render the page content for you to edit.

What's in the Parent Window? The parent window contains what is needed for the iframe to load and work correctly. This is also where the iframe renders the builder's UI once it has loaded. That includes the majority of the UI including the toolbar, menu, panels, and settings. Even though the parent window loads everything, the iframe controls most execution.

What's in the IFrame The iframe currently contains the entire page and builder. That could change in the future but

== What the hell does this do? ==
When you save settings in a module or your layout when enabled any settings that is *not* set, blank or null
the settings is not saved, this can save about 30% size for the postmeta.
== Are there any downsides? ==
Possibly, if a 3rd party module expects an option to be blank and it isnt set you might see some strange things like
default text showing when you blanked it out expecting the text to then be blank.