1/** 2 * copyright Copyright (C) 2015 Cedric KEIFLIN alias ced1870 3 * http://www.joomlack.fr - http://www.wp-pluginsck.com 4 * http://www.template-creator.com 5 * license GNU/GPL 6 * Image Effect CK 7 **/ 8 9(function($) { 10 $.fn.ImageEffectck = function(options) { 11 var defaults = { 12 // duration : 1000 // duration of the image effect 13 }; 14 var options = $.extend(defaults, options); 15 // var image.wrap; 16 $("img[class^='effectck'], img.fadeck, img.edafck, img.puffck").each(function(i, image) { 17 // do only if the image is not yet wrapped 18 if (! $(image).parent().is('figure')) { 19 20 var w = $(image).attr('width'); 21 var fl = $(image).css('float'); 22 23 $(image).wrap('<figure class="imageeffectck ' + $(image).attr('class') + '" />'); 24 image.wrap = $(image).parent(); 25 26 var props = Array('border-top-left-radius' 27 , 'border-top-right-radius' 28 , 'border-bottom-left-radius' 29 , 'border-bottom-right-radius' 30 , 'float' 31 ); 32 33 for (i=0;i<props.length;i++) { 34 catchCssProperty(image, props[i]); 35 } 36 37 // fix for Chrome 38 if (parseInt(w) > 0) { 39 image.wrap.width(w).css('max-width', '100%'); 40 } 41 // if (fl) image.wrap.css('float', fl); 42 43 // get the the text from the image title 44 var imgtitle, txt_title, txt_desc; 45 if (imgtitle = $(image).attr('title')) { 46 imgtitle = imgtitle.split('::'); 47 if (imgtitle.length >= 1) { 48 txt_title = imgtitle[0]; 49 } 50 if (imgtitle.length >= 2) { 51 txt_desc = imgtitle[1]; 52 } 53 } 54var title_color, cption_color; 55title_color = 'FFFFFF'; 56caption_color = 'FFFFFF'; 57 title_color = $(image).attr('data-titlecolor'); 58 caption_color = $(image).attr('data-captioncolor'); 59 60 61 // remove the attribute on the image to avoid conflicts 62 $(image).attr('class', '') 63 .attr('width', '') 64 .attr('height', '') 65 .attr('title', '') 66 .attr('alt', txt_title) 67 .css('float', ''); 68 69 70 // create the final code 71 image.wrap.append('<figcaption>' 72 +'<div>' 73 + ( txt_title ? '<div style="color:#'+ title_color + '" class="imageeffectck_title">' + txt_title + '</div>' : '' ) 74 + ( txt_desc ? '<div style="color:#'+ caption_color + '" class="imageeffectck_desc">' + txt_desc + '</div>' : '' ) 75 // + ( $(image).attr('href', '') ? '<a href="' + $(image).attr('href') + '"></a>' : '' ) // il faut d�tecter parent ancre >> pas besoin l'ancre s'applique sur figure 76 +'</div>' 77 +'</figcaption>') 78 } 79 }); 80 81 function catchCssProperty(image, prop) { 82 var v = $(image).css(prop); 83 if (parseInt(v)) { 84 $(image).css(prop, ''); 85 $(image.wrap).css(prop, v); 86 } 87 } 88 } 89 90})(jQuery); 91
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.