jQuery Ext: $.cursor()

by SpYk3

HTML

<h1> H 1 </h1>
<br />
<h2> H 2 </h2>
<br />
<h3> H 3 Hover over me within 3-4 seconds of page load and watch console for proof of concept work</h3>
<br />
<h4> <div> <p> H 4 Hover here on 2 seconds after page loads, then check console to see results! </p> </div> </h4>
<br />
<h5>Hover Over H1</h5>

CSS

body * { width: 100%; text-align: center; }
h1, h2, h3, h4, h5 { padding: 1em; }
h1 { background-color: #CCFFFF; }
h2 { background-color: #FF9999; }
h3 { background-color: #FFFF99; }
h4 { background-color: #CCCCFF; }
h5 { background-color: #009999; }

JavaScript

;(function(b){b.cursor||(b.extend({cursor:function(d,e,c){if(d)if("string"===typeof d){if(0>=b(d).length){switch(d.toLowerCase()){case "clear":document.body.style.cursor="default";break;case "ishover":var f=[];b("*").each(function(){var d=b.cursor.styles.position,c=b(this).position(),e=b(this).outerHeight(),j=b(this).outerWidth();0<d.x-c.left&&0<d.y-c.top&&0<c.left+j-d.x&&0<c.top+e-d.y&&(f[f.length]=this)});console.log({pos:f});return f;case "position":return b.cursor.styles.position;case "url":document.body.style.cursor=
e?"string"===typeof e?e:"default":"default";break;case "x":return b.cursor.styles.position.x;case "y":return b.cursor.styles.position.y;default:document.body.style.cursor=d}return document.body.style.cursor}if(0<b(d).length)return b(d).cursor(e,c)}else if("object"===typeof d)return b(d).cursor(e,c);return document.body.style.cursor}}),b.fn.extend({cursor:function(d){Array.prototype.slice.call(arguments,1);var e=d,c=b(this);if(void 0===e)return c.css("cursor");if("position"===e.toLowerCase()){var f=
[];c.each(function(d){var c=b.cursor.styles.position,e=b(this).position();f[d]={ele:b(this),x:c.x-e.left,y:c.y-e.top}});return f}if("ishover"===e.toLowerCase()){if(1===c.length)var g=b.cursor.styles.position,h=b(c).position(),i=b(c).outerHeight(),c=b(c).outerWidth(),f=0<g.x-h.left&&0<g.y-h.top&&0<h.left+c-g.x&&0<h.top+i-g.y;else 1<c.length&&(f=!0,c.each(function(){var c=b.cursor.styles.position,d=b(this).position(),e=b(this).outerHeight(),g=b(this).outerWidth();0<c.x-d.left&&0<c.y-d.top&&0<d.left+
g-c.x&&0<d.top+e-c.y||(f=!1)}));return f}return c.each(function(){if("string"===typeof e)switch(e){case "clear":b(this).css("cursor","");break;case...