1jQuery(document).ready(function($) { 2 $('.eic-image').hover( function() { 3 $(this).find('[data-pin-log="button_pinit"]').show(); 4 $(this).find('.eic-image-caption-hover').show(); 5 }, function() { 6 $(this).find('[data-pin-log="button_pinit"]').hide(); 7 $(this).find('.eic-image-caption-hover').hide(); 8 }); 9}); 10 11// Based on https://github.com/kumailht/responsive-elements 12 13const responsive_breakpoint = parseInt( eic_public.responsive_breakpoint ); 14const responsive_layout = '1' === eic_public.responsive_layout ? true : false; 15 16var EIC_Responsive = { 17 elementsSelector: '.eic-container', 18 maxRefreshRate: 5, 19 init: function() { 20 var self = this; 21 jQuery(function() { 22 self.el = { 23 window: jQuery(window), 24 responsive_elements: jQuery(self.elementsSelector) 25 }; 26 27 self.events(); 28 }); 29 }, 30 checkBreakpointOfAllElements: function() { 31 var self = EIC_Responsive; 32 self.el.responsive_elements.each(function(i, _el) { 33 var container = jQuery(_el); 34 self.checkBreakpointOfElement(container); 35 36 // Check if mobile or desktop version. 37 if ( container.width() < responsive_breakpoint ) { 38 container.removeClass( 'eic-container-desktop' ); 39 container.addClass( 'eic-container-mobile' ); 40 41 if ( responsive_layout ) { 42 container.addClass( 'eic-container-mobile-regular' ); 43 } 44 } else { 45 container.addClass( 'eic-container-desktop' ); 46 container.removeClass( 'eic-container-mobile' ); 47 container.removeClass( 'eic-container-mobile-regular' ); 48 } 49 }); 50 }, 51 checkBreakpointOfElement: function(_el) { 52 var frame = _el.find('.eic-frame'); 53 54 var container_width = _el.width(); 55 var frame_width = frame.outerWidth(); 56 var orig_frame_width = frame.data('orig-width'); 57 var frame_ratio = frame.data('ratio'); 58 59 // Frame resize required if container is smaller or frame is smaller than original width 60 if(container_width < frame_width || frame_width < orig_frame_width) { 61 var new_frame_width = container_width; 62 if(new_frame_width > orig_frame_width) { 63 new_frame_width = orig_frame_width; 64 } 65 66 var change_ratio = new_frame_width / orig_frame_width; 67 68 // Borders 69 var orig_border = frame.data('orig-border'); 70 var border = Math.ceil(orig_border * change_ratio); 71 var orig_radius = frame.data('orig-radius') || 0; 72 var radius = Math.ceil(orig_radius * change_ratio); 73 var image_radius = Math.max(0, radius - border); 74 75 // Change frame styling 76 frame 77 .css('width', new_frame_width + 'px') 78 .css('height', new_frame_width / frame_ratio + 'px') 79 .css('border-width', border + 'px') 80 .css('border-radius', radius + 'px') 81 .css('overflow', 'hidden'); 82 83 frame.find('.eic-image') 84 .css('border-top-left-radius', '') 85 .css('border-top-right-radius', '') 86 .css('border-bottom-left-radius', '') 87 .css('border-bottom-right-radius', ''); 88 89 frame.find('.eic-corner-top-left').css('border-top-left-radius', image_radius + 'px'); 90 frame.find('.eic-corner-top-right').css('border-top-right-radius', image_radius + 'px'); 91 frame.find('.eic-corner-bottom-left').css('border-bottom-left-radius', image_radius + 'px'); 92 frame.find('.eic-corner-bottom-right').css('border-bottom-right-radius', image_radius + 'px'); 93 94 _el.find('.eic-image').each(function() { 95 var image = jQuery(this); 96 97 if (image.data('frame-type') === 'text') { 98 image.css('border-width', border + 'px'); 99 return; 100 } 101 102 if ( responsive_layout && container_width < responsive_breakpoint ) { 103 // Change image styling (New) 104 image.find('img') 105 .style('position', 'static', 'important') 106 .style('width', '100%', 'important') 107 .style('height', 'auto', 'important') 108 .style('left', '0', 'important') 109 .style('top', '0', 'important'); 110 } else { 111 var size_x = Math.ceil(image.data('size-x') * change_ratio); 112 var size_y = Math.ceil(image.data('size-y') * change_ratio); 113 var pos_x = Math.ceil(image.data('pos-x') * change_ratio); 114 var pos_y = Math.ceil(image.data('pos-y') * change_ratio); 115 116 // Change image styling (Legacy) 117 image 118 .css('background-size', '' + size_x + 'px ' + size_y + 'px') 119 .css('background-position', '' + pos_x + 'px ' + pos_y + 'px') 120 .css('border-width', border + 'px'); 121 122 // Change image styling (New) 123 image.find('img') 124 .style('position', 'absolute', 'important') 125 .style('width', '' + size_x + 'px', 'important') 126 .style('height', '' + size_y + 'px', 'important') 127 .style('left', '' + pos_x + 'px', 'important') 128 .style('top', '' + pos_y + 'px', 'important'); 129 } 130 }); 131 } 132 }, 133 events: function() { 134 this.checkBreakpointOfAllElements(); 135 136 this.el.window.bind('resize', this.debounce( 137 this.checkBreakpointOfAllElements, this.maxRefreshRate)); 138 }, 139 // Debounce is part of Underscore.js 1.5.2 http://underscorejs.org
140 // (c) 2009-2013 Jeremy Ashkenas. Distributed under the MIT license. 141 debounce: function(func, wait, immediate) { 142 // Returns a function, that, as long as it continues to be invoked, 143 // will not be triggered. The function will be called after it stops 144 // being called for N milliseconds. If `immediate` is passed, 145 // trigger the function on the leading edge, instead of the trailing. 146 var result; 147 var timeout = null; 148 return function() { 149 var context = this, 150 args = arguments; 151 var later = function() { 152 timeout = null; 153 if (!immediate) result = func.apply(context, args); 154 }; 155 var callNow = immediate && !timeout; 156 clearTimeout(timeout); 157 timeout = setTimeout(later, wait); 158 if (callNow) result = func.apply(context, args); 159 return result; 160 }; 161 } 162}; 163 164// Source: http://stackoverflow.com/questions/2655925/how-to-apply-important-using-css 165(function($) { 166 if ($.fn.style) { 167 return; 168 } 169 170 // Escape regex chars with \ 171 var escape = function(text) { 172 return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 173 }; 174 175 // For those who need them (< IE 9), add support for CSS functions 176 var isStyleFuncSupported = !!CSSStyleDeclaration.prototype.getPropertyValue; 177 if (!isStyleFuncSupported) { 178 CSSStyleDeclaration.prototype.getPropertyValue = function(a) { 179 return this.getAttribute(a); 180 }; 181 CSSStyleDeclaration.prototype.setProperty = function(styleName, value, priority) { 182 this.setAttribute(styleName, value); 183 var priority = typeof priority != 'undefined' ? priority : ''; 184 if (priority != '') { 185 // Add priority manually 186 var rule = new RegExp(escape(styleName) + '\\s*:\\s*' + escape(value) + 187 '(\\s*;)?', 'gmi'); 188 this.cssText = 189 this.cssText.replace(rule, styleName + ': ' + value + ' !' + priority + ';'); 190 } 191 }; 192 CSSStyleDeclaration.prototype.removeProperty = function(a) { 193 return this.removeAttribute(a); 194 }; 195 CSSStyleDeclaration.prototype.getPropertyPriority = function(styleName) { 196 var rule = new RegExp(escape(styleName) + '\\s*:\\s*[^\\s]*\\s*!important(\\s*;)?', 197 'gmi'); 198 return rule.test(this.cssText) ? 'important' : ''; 199 } 200 } 201 202 // The style function 203 $.fn.style = function(styleName, value, priority) { 204 // DOM node 205 var node = this.get(0); 206 // Ensure we have a DOM node 207 if (typeof node == 'undefined') { 208 return this; 209 } 210 // CSSStyleDeclaration 211 var style = this.get(0).style; 212 // Getter/Setter 213 if (typeof styleName != 'undefined') { 214 if (typeof value != 'undefined') { 215 // Set style property 216 priority = typeof priority != 'undefined' ? priority : ''; 217 style.setProperty(styleName, value, priority); 218 return this; 219 } else { 220 // Get style property 221 return style.getPropertyValue(styleName); 222 } 223 } else { 224 // Get CSSStyleDeclaration 225 return style; 226 } 227 }; 228})(jQuery); 229 230EIC_Responsive.init();
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.