/*! jquery-awesome-cursor - v0.3.1 - 2016-04-23 * https://jwarby.github.io/jquery-awesome-cursor * Copyright (c) 2016 ; Licensed MIT */ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery)}(this,function(a){"use strict";function b(b,c){-1===a.inArray(c,["horizontal","vertical","both"])&&a.error("Flip value must be one of horizontal, vertical or both");var d,e=a("")[0];return e.width=b.width,e.height=b.height,d=e.getContext("2d"),"horizontal"!==c&&"both"!==c||(d.translate(b.width,0),d.scale(-1,1)),"vertical"!==c&&"both"!==c||(d.translate(0,b.height),d.scale(1,-1)),d.drawImage(b,0,0,b.width,b.height),e}var c=function(b,c){var d=0,e=0;return"string"!=typeof b&&a.error("Hotspot value is not a string and could not be parsed"),"number"!=typeof c&&a.error("Cursor size must be a number"),b.split(" ").forEach(function(a){switch(a){case"center":d=c/2,e=c/2;break;case"top":e=0;break;case"bottom":e=c-1;break;case"left":d=0;break;case"right":d=c-1}}),[d,e]};a.fn.extend({awesomeCursor:function(d,e){e=a.extend({},a.fn.awesomeCursor.defaults,e),"string"==typeof d&&d||a.error("First parameter must be the icon name, e.g. 'pencil'"),e.size="string"==typeof e.size?parseInt(e.size,10):e.size,"string"==typeof e.hotspot&&(e.hotspot=c(e.hotspot,e.size)),e.hotspot=a.map(e.hotspot,function(a){return Math.min(e.size-1,Math.max(0,a))});var f=function(a,b){return"string"==typeof b?b.replace(/%s/g,a):"function"==typeof b?b(a):a}(d,e.font.cssClass),g=a("",{"class":f,style:"display: inline; font-size: "+e.size+"px;"}),h=a("
",{style:"position: absolute; left: -9999px; top: -9999px;"}).append(g);a("body").append(h);var i,j,k,l=window.getComputedStyle(g[0],":before").getPropertyValue("content"),m=g[0].getBoundingClientRect(),n=a("")[0],o=Math.max(m.width,m.height);return g.remove(),e.outline&&(o+=2),e.rotate?(o=Math.ceil(Math.sqrt(Math.pow(o,2)+Math.pow(o,2))),i=(o-e.size)/2,n.width=o,n.height=o,k=n.getContext("2d"),k.translate(n.width/2,n.height/2),k.rotate(e.rotate*Math.PI/180),k.translate(-n.width/2,-n.height/2),e.hotspot[0]+=e.hotspot[0]!==n.width/2?i:0,e.hotspot[1]+=e.hotspot[1]!==n.height/2?i:0):(n.height=o,n.width=o,k=n.getContext("2d")),l=l.replace(/['"]/g,""),k.fillStyle=e.color,k.font=e.size+"px "+e.font.family,k.textAlign="center",k.textBaseline="middle",k.fillText(l,o/2,o/2),e.outline&&(k.lineWidth=.5,k.strokeStyle=e.outline,k.strokeText(l,o/2,o/2)),e.flip&&(n=b(n,e.flip)),j=n.toDataURL("image/png"),a(this).css("cursor","").css("cursor",["url("+j+")",e.hotspot[0],e.hotspot[1],",","auto"].join(" ")),this}}),a.fn.awesomeCursor.defaults={color:"#000000",size:18,hotspot:[0,0],flip:"",rotate:0,outline:null,font:{family:"FontAwesome",cssClass:"fa fa-%s"}}});