1'use strict'; 2 3var Flexboxes = function(){ 4 5 var $ = jQuery; 6 var instances = []; 7 8 function onReady() { 9 $('.module.flexboxes').each(function () { 10 instances.push(initInstance($(this))); 11 }); 12 } 13 14 function initInstance(view) { 15 16 // Private properties 17 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 18 19 var $view = view; 20 // id = $view.data('id'); 21 22 // Private methods 23 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 24 25 // function flexboxes 26 27 var instance = { 28 init: function () { 29 // console.log('Module|Flexboxes::init: id{' + id + '}'); 30 31 // Vemos si el navegador tiene soporte para flexboxes 32 33 if (!Modernizr.flexbox && !Modernizr.flexwrap) { 34 $view.find('.flex-boxes').addClass('no-flex-support'); 35 } 36 37 // Vemos si hay cajas con la clase [flex-box-small] para darle la funcionalidad 38 39 var $smallestBox = $view.find('.flex-box-small'); 40 41 if ($smallestBox.length > 0){ 42 $smallestBox.each(function () { 43 var $this = $(this); 44 45 $this.on('mouseover', function () { 46 var $image = $(this).find('img'); 47 var src = $image.attr('src'); 48 var filename = $image.data('name'); 49 var filenameHover = filename; 50 filenameHover = filename.split('.'); 51 filenameHover = filenameHover[0] + '_hover.' + filenameHover[1]; 52 src = src.replace(filename, filenameHover); 53 $image.attr('src', src); 54 }); 55 56 $this.on('mouseout', function () { 57 var $image = $(this).find('img'); 58 var src = $image.attr('src'); 59 src = src.replace('_hover', ''); 60 $image.attr('src', src); 61 }); 62 }); 63 } 64 } 65 }; 66 67 instance.init(); 68 69 return instance; 70 } 71 72 // Subscribe to WINDOW_LOADED event 73 $(onReady); 74} 75 76Flexboxes(); 77
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.