Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "topbar", | ||
"main": "topbar.min.js", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Tiny & beautiful site-wide progress indicator", | ||
@@ -6,0 +6,0 @@ "homepage": "http://buunguyen.github.io/topbar", |
{ | ||
"name": "topbar", | ||
"main": "topbar.js", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Tiny & beautiful site-wide progress indicator", | ||
@@ -6,0 +6,0 @@ "homepage": "http://buunguyen.github.io/topbar", |
@@ -0,1 +1,3 @@ | ||
[![Code Shelter](https://www.codeshelter.co/static/badges/badge-flat.svg)](https://www.codeshelter.co/) | ||
topbar | ||
@@ -12,2 +14,2 @@ ==== | ||
MIT license. Copyright 2014 Buu Nguyen. | ||
MIT license. Copyright 2019 Buu Nguyen. |
@@ -1,8 +0,8 @@ | ||
/*! topbar 0.1.3, 2014-12-09 | ||
/*! topbar 0.1.4, 2020-04-27 | ||
* http://buunguyen.github.io/topbar | ||
* Copyright (c) 2014 Buu Nguyen | ||
* Copyright (c) 2019 Buu Nguyen | ||
* Licensed under the MIT License */ | ||
;(function(window, document) { | ||
'use strict' | ||
// https://gist.github.com/paulirish/1579671 | ||
@@ -49,3 +49,4 @@ ;(function() { | ||
shadowBlur : 10, | ||
shadowColor : 'rgba(0, 0, 0, .6)' | ||
shadowColor : 'rgba(0, 0, 0, .6)', | ||
className : null, | ||
}, | ||
@@ -77,2 +78,4 @@ repaint = function() { | ||
style.display = 'none' | ||
if (options.className) | ||
canvas.classList.add(options.className) | ||
document.body.appendChild(canvas) | ||
@@ -91,3 +94,3 @@ addEvent(window, 'resize', repaint) | ||
if (fadeTimerId !== null) | ||
window.cancelAnimationFrame(fadeTimerId) | ||
window.cancelAnimationFrame(fadeTimerId) | ||
if (!canvas) createCanvas() | ||
@@ -128,3 +131,3 @@ canvas.style.opacity = 1 | ||
return | ||
} | ||
} | ||
} | ||
@@ -143,2 +146,2 @@ fadeTimerId = window.requestAnimationFrame(loop) | ||
} | ||
}).call(this, window, document) | ||
}).call(this, window, document) |
@@ -1,5 +0,5 @@ | ||
/*! topbar 0.1.3, 2014-12-09 | ||
/*! topbar 0.1.4, 2020-04-27 | ||
* http://buunguyen.github.io/topbar | ||
* Copyright (c) 2014 Buu Nguyen | ||
* Copyright (c) 2020 Buu Nguyen | ||
* Licensed under the MIT License */ | ||
(function(a,b){"use strict";!function(){for(var b=0,c=["ms","moz","webkit","o"],d=0;d<c.length&&!a.requestAnimationFrame;++d)a.requestAnimationFrame=a[c[d]+"RequestAnimationFrame"],a.cancelAnimationFrame=a[c[d]+"CancelAnimationFrame"]||a[c[d]+"CancelRequestAnimationFrame"];a.requestAnimationFrame||(a.requestAnimationFrame=function(c){var d=(new Date).getTime(),e=Math.max(0,16-(d-b)),f=a.setTimeout(function(){c(d+e)},e);return b=d+e,f}),a.cancelAnimationFrame||(a.cancelAnimationFrame=function(a){clearTimeout(a)})}();var c,d,e,f,g,h=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},i={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)"},j=function(){c.width=a.innerWidth,c.height=5*i.barThickness;var b=c.getContext("2d");b.shadowBlur=i.shadowBlur,b.shadowColor=i.shadowColor;var d=b.createLinearGradient(0,0,c.width,0);for(var e in i.barColors)d.addColorStop(e,i.barColors[e]);b.lineWidth=i.barThickness,b.beginPath(),b.moveTo(0,i.barThickness/2),b.lineTo(Math.ceil(f*c.width),i.barThickness/2),b.strokeStyle=d,b.stroke()},k=function(){c=b.createElement("canvas");var d=c.style;d.position="fixed",d.top=d.left=d.right=d.margin=d.padding=0,d.zIndex=100001,d.display="none",b.body.appendChild(c),h(a,"resize",j)},l={config:function(a){for(var b in a)i.hasOwnProperty(b)&&(i[b]=a[b])},show:function(){g||(g=!0,null!==e&&a.cancelAnimationFrame(e),c||k(),c.style.opacity=1,c.style.display="block",l.progress(0),i.autoRun&&!function b(){d=a.requestAnimationFrame(b),l.progress("+"+.05*Math.pow(1-Math.sqrt(f),2))}())},progress:function(a){return"undefined"==typeof a?f:("string"==typeof a&&(a=(a.indexOf("+")>=0||a.indexOf("-")>=0?f:0)+parseFloat(a)),f=a>1?1:a,j(),f)},hide:function(){g&&(g=!1,null!=d&&(a.cancelAnimationFrame(d),d=null),function b(){return l.progress("+.1")>=1&&(c.style.opacity-=.05,c.style.opacity<=.05)?(c.style.display="none",void(e=null)):void(e=a.requestAnimationFrame(b))}())}};"object"==typeof module&&"object"==typeof module.exports?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):this.topbar=l}).call(this,window,document); | ||
(function(a,b){"use strict";!function(){for(var b=0,c=["ms","moz","webkit","o"],d=0;d<c.length&&!a.requestAnimationFrame;++d)a.requestAnimationFrame=a[c[d]+"RequestAnimationFrame"],a.cancelAnimationFrame=a[c[d]+"CancelAnimationFrame"]||a[c[d]+"CancelRequestAnimationFrame"];a.requestAnimationFrame||(a.requestAnimationFrame=function(c){var d=(new Date).getTime(),e=Math.max(0,16-(d-b)),f=a.setTimeout(function(){c(d+e)},e);return b=d+e,f}),a.cancelAnimationFrame||(a.cancelAnimationFrame=function(a){clearTimeout(a)})}();var c,d,e,f,g,h=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},i={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},j=function(){c.width=a.innerWidth,c.height=5*i.barThickness;var b=c.getContext("2d");b.shadowBlur=i.shadowBlur,b.shadowColor=i.shadowColor;var d=b.createLinearGradient(0,0,c.width,0);for(var e in i.barColors)d.addColorStop(e,i.barColors[e]);b.lineWidth=i.barThickness,b.beginPath(),b.moveTo(0,i.barThickness/2),b.lineTo(Math.ceil(f*c.width),i.barThickness/2),b.strokeStyle=d,b.stroke()},k=function(){c=b.createElement("canvas");var d=c.style;d.position="fixed",d.top=d.left=d.right=d.margin=d.padding=0,d.zIndex=100001,d.display="none",i.className&&c.classList.add(i.className),b.body.appendChild(c),h(a,"resize",j)},l={config:function(a){for(var b in a)i.hasOwnProperty(b)&&(i[b]=a[b])},show:function(){g||(g=!0,null!==e&&a.cancelAnimationFrame(e),c||k(),c.style.opacity=1,c.style.display="block",l.progress(0),i.autoRun&&!function b(){d=a.requestAnimationFrame(b),l.progress("+"+.05*Math.pow(1-Math.sqrt(f),2))}())},progress:function(a){return"undefined"==typeof a?f:("string"==typeof a&&(a=(a.indexOf("+")>=0||a.indexOf("-")>=0?f:0)+parseFloat(a)),f=a>1?1:a,j(),f)},hide:function(){g&&(g=!1,null!=d&&(a.cancelAnimationFrame(d),d=null),function b(){return l.progress("+.1")>=1&&(c.style.opacity-=.05,c.style.opacity<=.05)?(c.style.display="none",void(e=null)):void(e=a.requestAnimationFrame(b))}())}};"object"==typeof module&&"object"==typeof module.exports?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):this.topbar=l}).call(this,window,document); |
Sorry, the diff of this file is not supported yet
194760
1159
15