From b6ea18a70222f5b3ced405d88d5fb262bfd85d0a Mon Sep 17 00:00:00 2001 From: Kenneth Cachia Date: Mon, 28 Oct 2013 21:54:16 -0400 Subject: [PATCH] Update version. --- background-check.js | 2 +- background-check.min.js | 2 +- examples/background-check.min.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/background-check.js b/background-check.js index baa9070..1f95987 100755 --- a/background-check.js +++ b/background-check.js @@ -3,7 +3,7 @@ * BackgroundCheck * http://kennethcachia.com/background-check * - * v1.1.1 + * v1.1.2 */ (function (root, factory) { diff --git a/background-check.min.js b/background-check.min.js index 0ce8b0d..fe3cbd3 100644 --- a/background-check.min.js +++ b/background-check.min.js @@ -1,5 +1,5 @@ /* BackgroundCheck http://kennethcachia.com/background-check - v1.1.1 */ + v1.1.2 */ !function(a,b){"function"==typeof define&&define.amd?define(b):a.BackgroundCheck=b(a)}(this,function(){"use strict";function a(a){if(void 0===a||void 0===a.targets)throw"Missing attributes";A.targets=f(a.targets),A.images=f(a.images||"img"),A.changeParent=d(a.changeParent,!1),A.threshold=d(a.threshold,50),A.minComplexity=d(a.minComplexity,30),A.minOverlap=d(a.minOverlap,50),A.windowEvents=d(a.windowEvents,!0),A.maxDuration=d(a.maxDuration,500),A.debug=d(a.debug,!1),A.mask=d(a.mask,{r:0,g:255,b:0}),A.classes=d(a.classes,{dark:"background--dark",light:"background--light",complex:"background--complex"}),void 0===u&&(g(),u&&(v.style.position="fixed",v.style.top="0px",v.style.left="0px",v.style.width="100%",v.style.height="100%",window.addEventListener(z,r.bind(null,function(){i(),q()})),window.addEventListener("scroll",r.bind(null,q)),i(),q()))}function b(){u=null,v=null,w=null,A={},x&&clearTimeout(x)}function c(a){t("debug")&&console.log(a)}function d(a,b){return e(a,typeof b),void 0===a?b:a}function e(a,b){if(void 0!==a&&typeof a!==b)throw"Incorrect attribute type"}function f(a){var b=a;if("string"==typeof a?b=document.querySelectorAll(a):a&&1===a.nodeType&&(b=[a]),!b||0===b.length||void 0===b.length)throw"Elements not found";return b=Array.prototype.slice.call(b)}function g(){v=document.createElement("canvas"),v&&v.getContext?(w=v.getContext("2d"),u=!0):u=!1}function h(a){var d=(new Date).getTime()-a;c("Duration: "+d+"ms"),d>t("maxDuration")&&(console.log("BackgroundCheck - Killed"),k(),b())}function i(){y={left:0,top:0,right:document.body.clientWidth,bottom:window.innerHeight},v.width=document.body.clientWidth,v.height=window.innerHeight}function j(a){var b=a.getBoundingClientRect();w.drawImage(a,b.left,b.top,b.width,b.height)}function k(a){for(var b,c=a?[a]:t("targets"),d=0;d0&&g.height>0){k(a),a=t("changeParent")?a.parentNode:a,d=w.getImageData(g.left,g.top,g.width,g.height).data;for(var n=0;nt("minComplexity")/100&&a.classList.add(t("classes").complex))}}function m(a,b){return a=a.getBoundingClientRect(),b=b===y?b:b.getBoundingClientRect(),!(a.rightb.right||a.top>b.bottom||a.bottomg;g++)b=t("targets")[g],m(b,y)&&("targets"!==d||a&&a!==b?"image"===d&&m(b,a)&&l(b):(e=!0,l(b)));if("targets"===d&&!e)throw a+" is not a target";h(c)}function o(a){var b,c,d=a.parentNode,e=function(a){var b=0;return"static"!==window.getComputedStyle(a).position&&(b=parseInt(window.getComputedStyle(a).zIndex,10)||0,b>=0&&b++),b};return c=d?e(d):0,b=e(a),1e5*c+b}function p(a){var b=!1;return a.sort(function(a,c){var d=a.compareDocumentPosition(c),e=0;return a=o(a),c=o(c),a>c&&(b=!0),a===c&&2===d?e=1:a===c&&4===d&&(e=-1),e||a-c}),c("Sorted: "+b),b&&c(a),b}function q(a,b,d){var e,f,g=!1,h=t("mask"),i=d?[d]:t("images");if(c("--- BackgroundCheck ---"),c("onLoad event: "+(d&&d.src)),u){b!==!0&&(w.clearRect(0,0,v.width,v.height),w.fillStyle="rgb("+h.r+", "+h.g+", "+h.b+")",w.fillRect(0,0,v.width,v.height)),f=p(i);for(var k=0;kt("maxDuration")&&(console.log("BackgroundCheck - Killed"),k(),b())}function i(){y={left:0,top:0,right:document.body.clientWidth,bottom:window.innerHeight},v.width=document.body.clientWidth,v.height=window.innerHeight}function j(a){var b=a.getBoundingClientRect();w.drawImage(a,b.left,b.top,b.width,b.height)}function k(a){for(var b,c=a?[a]:t("targets"),d=0;d0&&g.height>0){k(a),a=t("changeParent")?a.parentNode:a,d=w.getImageData(g.left,g.top,g.width,g.height).data;for(var n=0;nt("minComplexity")/100&&a.classList.add(t("classes").complex))}}function m(a,b){return a=a.getBoundingClientRect(),b=b===y?b:b.getBoundingClientRect(),!(a.rightb.right||a.top>b.bottom||a.bottomg;g++)b=t("targets")[g],m(b,y)&&("targets"!==d||a&&a!==b?"image"===d&&m(b,a)&&l(b):(e=!0,l(b)));if("targets"===d&&!e)throw a+" is not a target";h(c)}function o(a){var b,c,d=a.parentNode,e=function(a){var b=0;return"static"!==window.getComputedStyle(a).position&&(b=parseInt(window.getComputedStyle(a).zIndex,10)||0,b>=0&&b++),b};return c=d?e(d):0,b=e(a),1e5*c+b}function p(a){var b=!1;return a.sort(function(a,c){var d=a.compareDocumentPosition(c),e=0;return a=o(a),c=o(c),a>c&&(b=!0),a===c&&2===d?e=1:a===c&&4===d&&(e=-1),e||a-c}),c("Sorted: "+b),b&&c(a),b}function q(a,b,d){var e,f,g=!1,h=t("mask"),i=d?[d]:t("images");if(c("--- BackgroundCheck ---"),c("onLoad event: "+(d&&d.src)),u){b!==!0&&(w.clearRect(0,0,v.width,v.height),w.fillStyle="rgb("+h.r+", "+h.g+", "+h.b+")",w.fillRect(0,0,v.width,v.height)),f=p(i);for(var k=0;k