File: /var/www/html/wpprm_old/wp-content/themes/ronneby/assets/js/pixastic.custom.js
/*
* Pixastic - JavaScript Image Processing Library
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* MIT License [http://www.pixastic.com/lib/license.txt]
*/
var Pixastic=function(){function a(t,e,a){var n=new Array;null==e&&(e=document),null==a&&(a="*");var r=e.getElementsByTagName(a),s=r.length,o=new RegExp("(^|\\s)"+t+"(\\s|$)");for(i=0,j=0;i<s;i++)o.test(r[i].className)&&(n[j]=r[i],j++);return n}function x(t,e){if(Pixastic.debug){try{switch(e){case"warn":console.warn("Pixastic:",t);break;case"error":console.error("Pixastic:",t);break;default:console.log("Pixastic:",t)}}catch(t){}1}}"undefined"!=typeof pixastic_parseonload&&pixastic_parseonload&&function(t){var e=!1,a=function(){e||(e=!0,t())};document.write('<script defer src="//:" id="__onload_ie_pixastic__"><\/script>');var i,n,r,s=document.getElementById("__onload_ie_pixastic__");s.onreadystatechange=function(){"complete"==s.readyState&&(s.parentNode.removeChild(s),a())},document.addEventListener&&document.addEventListener("DOMContentLoaded",a,!1),i=window,n="load",r=a,i.addEventListener?i.addEventListener(n,r,!1):i.attachEvent&&i.attachEvent("on"+n,r)}(function(){for(var t=a("pixastic",null,"img"),e=a("pixastic",null,"canvas"),l=t.concat(e),d=0;d<l.length;d++)!function(){for(var a=l[d],i=[],t=a.className.split(" "),e=0;e<t.length;e++){var n=t[e];if("pixastic-"==n.substring(0,9)){var r=n.substring(9);""!=r&&i.push(r)}}if(i.length)if("img"==a.tagName.toLowerCase()){var s=new Image;if(s.src=a.src,s.complete)for(var o=0;o<i.length;o++){var c=Pixastic.applyAction(a,a,i[o],null);c&&(a=c)}else s.onload=function(){for(var t=0;t<i.length;t++){var e=Pixastic.applyAction(a,a,i[t],null);e&&(a=e)}}}else setTimeout(function(){for(var t=0;t<i.length;t++){var e=Pixastic.applyAction(a,a,i[t],null);e&&(a=e)}},1)}()});var s=function(){var t=document.createElement("canvas"),e=!1;try{e=!("function"!=typeof t.getContext||!t.getContext("2d"))}catch(t){}return function(){return e}}(),o=function(){var t,e=document.createElement("canvas"),a=!1;try{"function"==typeof e.getContext&&(t=e.getContext("2d"))&&(a="function"==typeof t.getImageData)}catch(t){}return function(){return a}}(),t=function(){var t=!1,e=document.createElement("canvas");if(s()&&o()){e.width=e.height=1;var a=e.getContext("2d");a.fillStyle="rgb(255,0,0)",a.fillRect(0,0,1,1);var i=document.createElement("canvas");i.width=i.height=1;var n=i.getContext("2d");n.fillStyle="rgb(0,0,255)",n.fillRect(0,0,1,1),a.globalAlpha=.5,a.drawImage(i,0,0);var r=a.getImageData(0,0,1,1).data;t=255!=r[2]}return function(){return t}}();return{parseOnLoad:!1,debug:!1,applyAction:function(t,e,a,i){i=i||{};var n,r,s="canvas"==t.tagName.toLowerCase();if(s&&Pixastic.Client.isIE())return Pixastic.debug&&x("Tried to process a canvas element but browser is IE."),!1;var o=!1;Pixastic.Client.hasCanvas()&&(o=!!i.resultCanvas,r=(n=i.resultCanvas||document.createElement("canvas")).getContext("2d"));var c=t.offsetWidth,l=t.offsetHeight;if(s&&(c=t.width,l=t.height),0==c||0==l){if(null!=t.parentNode)return void(Pixastic.debug&&x("Image has 0 width and/or height."));var d=t.style.position,g=t.style.left;t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),c=t.offsetWidth,l=t.offsetHeight,document.body.removeChild(t),t.style.position=d,t.style.left=g}if(-1<a.indexOf("(")){var h=a;a=h.substr(0,h.indexOf("("));var p=h.match(/\((.*?)\)/);if(p[1]){p=p[1].split(";");for(var u=0;u<p.length;u++)if(thisArg=p[u].split("="),2==thisArg.length)if("rect"==thisArg[0]){var _=thisArg[1].split(",");i[thisArg[0]]={left:parseInt(_[0],10)||0,top:parseInt(_[1],10)||0,width:parseInt(_[2],10)||0,height:parseInt(_[3],10)||0}}else i[thisArg[0]]=thisArg[1]}}i.rect?(i.rect.left=Math.round(i.rect.left),i.rect.top=Math.round(i.rect.top),i.rect.width=Math.round(i.rect.width),i.rect.height=Math.round(i.rect.height)):i.rect={left:0,top:0,width:c,height:l};var f=!1;if(Pixastic.Actions[a]&&"function"==typeof Pixastic.Actions[a].process&&(f=!0),!f)return Pixastic.debug&&x('Invalid action "'+a+'". Maybe file not included?'),!1;if(!Pixastic.Actions[a].checkSupport())return Pixastic.debug&&x('Action "'+a+'" not supported by this browser.'),!1;Pixastic.Client.hasCanvas()?(n!==t&&(n.width=c,n.height=l),o||(n.style.width=c+"px",n.style.height=l+"px"),r.drawImage(e,0,0,c,l),t.__pixastic_org_image?(n.__pixastic_org_image=t.__pixastic_org_image,n.__pixastic_org_width=t.__pixastic_org_width,n.__pixastic_org_height=t.__pixastic_org_height):(n.__pixastic_org_image=t,n.__pixastic_org_width=c,n.__pixastic_org_height=l)):Pixastic.Client.isIE()&&void 0===t.__pixastic_org_style&&(t.__pixastic_org_style=t.style.cssText);var v={image:t,canvas:n,width:c,height:l,useData:!0,options:i};return!!Pixastic.Actions[a].process(v)&&(Pixastic.Client.hasCanvas()?(v.useData&&Pixastic.Client.hasCanvasImageData()&&(n.getContext("2d").putImageData(v.canvasData,i.rect.left,i.rect.top),n.getContext("2d").fillRect(0,0,0,0)),i.leaveDOM||(n.title=t.title,n.imgsrc=t.imgsrc,s||(n.alt=t.alt),s||(n.imgsrc=t.src),n.className=t.className,n.style.cssText=t.style.cssText,n.name=t.name,n.tabIndex=t.tabIndex,n.id=t.id,t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(n,t)),i.resultCanvas=n):t)},prepareData:function(t,e){var a=t.canvas.getContext("2d"),i=t.options.rect,n=a.getImageData(i.left,i.top,i.width,i.height),r=n.data;return e||(t.canvasData=n),r},process:function(e,a,i,n){if("img"==e.tagName.toLowerCase()){var r=new Image;if(r.src=e.src,r.complete){var t=Pixastic.applyAction(e,r,a,i);return n&&n(t),t}r.onload=function(){var t=Pixastic.applyAction(e,r,a,i);n&&n(t)}}if("canvas"==e.tagName.toLowerCase()){t=Pixastic.applyAction(e,e,a,i);return n&&n(t),t}},revert:function(t){if(Pixastic.Client.hasCanvas()){if("canvas"==t.tagName.toLowerCase()&&t.__pixastic_org_image)return t.width=t.__pixastic_org_width,t.height=t.__pixastic_org_height,t.getContext("2d").drawImage(t.__pixastic_org_image,0,0),t.parentNode&&t.parentNode.replaceChild&&t.parentNode.replaceChild(t.__pixastic_org_image,t),t}else Pixastic.Client.isIE()&&void 0!==t.__pixastic_org_style&&(t.style.cssText=t.__pixastic_org_style)},Client:{hasCanvas:s,hasCanvasImageData:o,hasGlobalAlpha:t,isIE:function(){return!!document.all&&!!window.attachEvent&&!window.opera}},Actions:{}}}();
/*
* Pixastic - JavaScript Image Processing Library
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* MIT License [http://www.pixastic.com/lib/license.txt]
*/
Pixastic.Actions.blurfast={process:function(t){var a=parseFloat(t.options.amount)||0,e=!(!t.options.clear||"false"==t.options.clear);if(a=Math.max(0,Math.min(5,a)),Pixastic.Client.hasCanvas()){var i=t.options.rect,r=t.canvas.getContext("2d");r.save(),r.beginPath(),r.rect(i.left,i.top,i.width,i.height),r.clip();var n=Math.round(t.width/2),s=Math.round(t.height/2),o=document.createElement("canvas");o.width=n,o.height=s;e=!1;for(var h=Math.round(20*a),c=o.getContext("2d"),g=0;g<h;g++){var l=Math.max(1,Math.round(n-g)),d=Math.max(1,Math.round(s-g));c.clearRect(0,0,n,s),c.drawImage(t.canvas,0,0,t.width,t.height,0,0,l,d),e&&r.clearRect(i.left,i.top,i.width,i.height),r.drawImage(o,0,0,l,d,0,0,t.width,t.height)}return r.restore(),!(t.useData=!1)}if(Pixastic.Client.isIE()){var m=10*a;return t.image.style.filter+=" progid:DXImageTransform.Microsoft.Blur(pixelradius="+m+")",t.options.fixMargin,t.image.style.marginLeft=(parseInt(t.image.style.marginLeft,10)||0)-Math.round(m)+"px",t.image.style.marginTop=(parseInt(t.image.style.marginTop,10)||0)-Math.round(m)+"px",!0}},checkSupport:function(){return Pixastic.Client.hasCanvas()||Pixastic.Client.isIE()}};