1(function ($) { 2 'use strict' 3 4 /* Check The Background Brightness --------------------- */ 5 function checkBrightness () { 6 $('.organic-widgets-section').not('.organic-widgets-content-slideshow-section').each(function (brightness) { 7 $(this).backgroundBrightness() 8 }) 9 } 10 11 /* Add Section Highlighting When Hovering Over Edit Shortcuts --------------------- */ 12 function editShortcutHoverBorder () { 13 setTimeout(function () { 14 $('.organic-widget .customize-partial-edit-shortcut').hover(function () { 15 $('<div class="organic-widgets-preview-highlighter"></div>').insertAfter($(this).siblings('.organic-widgets-section')) 16 }, function () { 17 $('.organic-widgets-preview-highlighter').remove() 18 }) 19 }, 2000) 20 } 21 22 /* Group Groupable Widgets --------------------- */ 23 function groupGroupableWidgets () { 24 // Loop through all groups 25 $('.organic-widgets-groupable-first').each(function () { 26 var firstGroupItem = $(this) 27 var parentContainer = firstGroupItem.closest('.organic-widget') 28 var groupID = $(this).data('group-id') 29 var group = $('*[data-group-id="' + groupID + '"]') 30 var numItems = group.length 31 if (numItems == 1 || numItems == 0) { 32 var itemClass = 'organic-widgets-single' 33 } else if (numItems == 2 || numItems == 4) { 34 var itemClass = 'organic-widgets-half' 35 } else { 36 var itemClass = 'organic-widgets-third' 37 } 38 39 parentContainer.before('<div class="organic-widgets-section organic-widgets-group"><div class="organic-widgets-group-container" data-group-id="' + groupID + '"></div></div>') 40 41 // Get container 42 var container = $('.organic-widgets-group-container[data-group-id="' + groupID + '"]') 43 var containerWrapperSection = container.closest('.organic-widgets-section') 44 45 // Loop through all elements of that group 46 group.each(function () { 47 var groupableWidget = $(this).closest('.organic-widget') 48 if ($(this).hasClass('organic-widgets-groupable-first')) { 49 var bgColor = $(this).css('backgroundColor') 50 var bgImage = $(this).css('backgroundImage') 51 $(this).css('backgroundColor', '') 52 $(this).css('backgroundImage', '') 53 containerWrapperSection.css('backgroundColor', bgColor) 54 containerWrapperSection.css('backgroundImage', bgImage) 55 } else { 56 $(this).css('backgroundColor', '') 57 } 58 if (!$(this).hasClass('organic-widgets-groupable-widget')) { 59 $(this).addClass('organic-widgets-groupable-widget') 60 } 61 groupableWidget.addClass(itemClass) 62 container.append(groupableWidget) 63 }) 64 $('.organic-widgets-group .organic-widgets-featured-content-section .organic-widgets-content').addClass('organic-widgets-card') 65 }) 66 checkBrightness() 67 } 68 69 function bgVidSize () { 70 $('.organic-widgets-video-bg-container').each(function () { 71 var $this = $(this) 72 if ($this.height() / $this.width() < 0.6666666666666667) { 73 $this.children('.organic-widgets-video-bg-center').css({ 74 height: '300%', 75 top: '-100%', 76 width: '100%', 77 left: '0' 78 }) 79 } else { 80 $this.children('.organic-widgets-video-bg-center').css({ 81 width: '300%', 82 left: '-100%', 83 height: '100%', 84 top: '0' 85 }) 86 } 87 }) 88 } 89 90 function editShortcutHoverBorderReady () { 91 // WP Customizer 92 if (typeof wp.customize != 'undefined') { 93 wp.customize.bind('preview-ready', _.defer(function () { editShortcutHoverBorder() })) 94 } 95 } 96 97 $(document) 98 .ready(checkBrightness) 99 .ready(groupGroupableWidgets) 100 .ready(bgVidSize) 101 .ready(editShortcutHoverBorderReady) 102 .ajaxComplete(checkBrightness) 103 $(window) 104 .resize(bgVidSize) 105})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.