-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.wd_picmark.min.js
1 lines (1 loc) · 1.3 KB
/
jquery.wd_picmark.min.js
1
;(function($){$.fn.wd_picmark=function(d){var e={useAlt:true,dataAttrVar:'mark',defaultText:'',useExternalStyle:false,positionX:'right',positionY:'bottom',marginX:'2px',marginY:'2px',font:{fontFamily:'"Lekton", arial, sans-serif',fontSize:'10px',color:'#dddddd',backgroundColor:'transparent',shadow:'0px 1px 1px #4d4d4d',padding:'2px'}};var f=$.extend(true,{},e,d);var g="wd_picmark";var h=g+"_wrapper";var i=g+"_mark";var j=function(a){a.wrap("<div style='position:relative'><div class='"+h+"'></div></div>")};var k=function(a,b){a.after("<span class='"+i+"'>"+b+"</span>")};var l=function(a){var b=a.parent();b.css({'float':'left','position':'relative'});var c=b.find('.wd_picmark_mark');c.css({'position':'absolute',});c.css(f.positionX,f.marginX);c.css(f.positionY,f.marginY);c.css('font-size',f.font.fontSize);c.css('font-family',f.font.fontFamily);c.css('background-color',f.font.backgroundColor);c.css('color',f.font.color);c.css('text-shadow',f.font.shadow);c.css('padding',f.font.padding)};return this.each(function(){var a=$(this);var b="";a.bind('load',function(){if(a.get(0).tagName!=="IMG")return;if(f.useAlt===true){if(a.get(0).hasAttribute("alt")!==false){b=a.attr("alt")}}else{b=a.data(f.dataAttrVar)}if(b==""&&f.defaultText!==""){b=f.defaultText}if(b=="")return;j(a);k(a,b);if(!f.useExternalStyle)l(a)})})}})(jQuery);