PluginProbe
Gridable / trunk
Gridable vtrunk
1.2.12 1.2.11 trunk 0.1.0 0.5.0 1.0.0 1.1.0 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9
gridable / public / js / gridable-scripts.js

gridable-scripts.js in Gridable trunk, at public/js/gridable-scripts.js

56 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (
2 function( $ ) {
3 'use strict';
4
5 /**
6 * All of the code for your public-facing JavaScript source
7 * should reside in this file.
8 *
9 * Note: It has been assumed you will write jQuery code here, so the
10 * $ function reference has been prepared for usage within the scope
11 * of this function.
12 *
13 * This enables you to define handlers, for when the DOM is ready:
14 *
15 * $(function() {
16 *
17 * });
18 *
19 * When the window is loaded:
20 *
21 * $( window ).load(function() {
22 *
23 * });
24 *
25 * ...and/or other possibilities.
26 *
27 * Ideally, it is not considered best practise to attach more than a
28 * single DOM-ready or window-load handler for a particular page.
29 * Although scripts in the WordPress core, Plugins and Themes may be
30 * practising this, we should strive to set a better example in our own work.
31 */
32
33
34 var GridableClass = function() {};
35
36 GridableClass.prototype.cleanup = function( $container ) {
37 $container = typeof $container !== "undefined" ? $container : $( 'body' );
38
39 $container.find( '.gridable--col' ).each( function( i, obj ) {
40 var $col = $( obj );
41
42 if ( $col.text().trim() === "" && $col.find( 'img, video, input, textarea, [class]' ).length === 0 ) {
43 $col.addClass( 'is-empty' );
44 }
45 } );
46 };
47
48 window.Gridable = new GridableClass();
49
50 $( window ).on( 'load', function() {
51 window.Gridable.cleanup();
52 } );
53
54 }
55 )( jQuery );
56