Comparing version 0.1.4 to 1.0.0
@@ -1,1 +0,7 @@ | ||
{"name":"Rainbow.js","tagline":"Tiny & beautiful progress indicator for JavaScript","body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} | ||
{ | ||
"name": "topbar.js", | ||
"tagline": "Tiny & beautiful progress indicator for JavaScript", | ||
"body": "### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.\r\n", | ||
"google": "", | ||
"note": "Don't delete this file! It's used internally to help with page regeneration." | ||
} |
{ | ||
"name": "topbar", | ||
"main": "topbar.js", | ||
"version": "0.1.4", | ||
"main": "topbar.min.js", | ||
"version": "1.0.0", | ||
"description": "Tiny & beautiful site-wide progress indicator", | ||
@@ -11,2 +11,5 @@ "homepage": "http://buunguyen.github.io/topbar", | ||
}, | ||
"scripts": { | ||
"build": "uglifyjs --comments -c -o topbar.min.js topbar.js" | ||
}, | ||
"keywords": [ | ||
@@ -21,9 +24,7 @@ "progress", | ||
"author": { | ||
"name": "Buu Nguyen", | ||
"email": "buunguyen@gmail.com" | ||
}, | ||
"name": "Buu Nguyen" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"grunt-contrib-uglify": "~0.2.2" | ||
"uglify-js": "~3.12.4" | ||
} | ||
} |
287
topbar.js
@@ -1,142 +0,157 @@ | ||
/*! topbar 0.1.4, 2020-04-27 | ||
* http://buunguyen.github.io/topbar | ||
* Copyright (c) 2019 Buu Nguyen | ||
* Licensed under the MIT License */ | ||
;(function(window, document) { | ||
'use strict' | ||
/** | ||
* @license MIT | ||
* topbar 1.0.0, 2021-01-06 | ||
* http://buunguyen.github.io/topbar | ||
* Copyright (c) 2021 Buu Nguyen | ||
*/ | ||
(function (window, document) { | ||
"use strict"; | ||
// https://gist.github.com/paulirish/1579671 | ||
;(function() { | ||
var lastTime = 0; | ||
var vendors = ['ms', 'moz', 'webkit', 'o']; | ||
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | ||
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; | ||
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] | ||
|| window[vendors[x]+'CancelRequestAnimationFrame']; | ||
} | ||
if (!window.requestAnimationFrame) | ||
window.requestAnimationFrame = function(callback, element) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = window.setTimeout(function() { callback(currTime + timeToCall); }, | ||
timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
if (!window.cancelAnimationFrame) | ||
window.cancelAnimationFrame = function(id) { | ||
clearTimeout(id); | ||
}; | ||
}()); | ||
// https://gist.github.com/paulirish/1579671 | ||
(function () { | ||
var lastTime = 0; | ||
var vendors = ["ms", "moz", "webkit", "o"]; | ||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | ||
window.requestAnimationFrame = | ||
window[vendors[x] + "RequestAnimationFrame"]; | ||
window.cancelAnimationFrame = | ||
window[vendors[x] + "CancelAnimationFrame"] || | ||
window[vendors[x] + "CancelRequestAnimationFrame"]; | ||
} | ||
if (!window.requestAnimationFrame) | ||
window.requestAnimationFrame = function (callback, element) { | ||
var currTime = new Date().getTime(); | ||
var timeToCall = Math.max(0, 16 - (currTime - lastTime)); | ||
var id = window.setTimeout(function () { | ||
callback(currTime + timeToCall); | ||
}, timeToCall); | ||
lastTime = currTime + timeToCall; | ||
return id; | ||
}; | ||
if (!window.cancelAnimationFrame) | ||
window.cancelAnimationFrame = function (id) { | ||
clearTimeout(id); | ||
}; | ||
})(); | ||
var canvas, progressTimerId, fadeTimerId, currentProgress, showing, | ||
addEvent = function(elem, type, handler) { | ||
if (elem.addEventListener) elem.addEventListener(type, handler, false) | ||
else if (elem.attachEvent) elem.attachEvent('on' + type, handler) | ||
else elem['on' + type] = handler | ||
}, | ||
options = { | ||
autoRun : true, | ||
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, | ||
}, | ||
repaint = function() { | ||
canvas.width = window.innerWidth | ||
canvas.height = options.barThickness * 5 // need space for shadow | ||
var canvas, | ||
progressTimerId, | ||
fadeTimerId, | ||
currentProgress, | ||
showing, | ||
addEvent = function (elem, type, handler) { | ||
if (elem.addEventListener) elem.addEventListener(type, handler, false); | ||
else if (elem.attachEvent) elem.attachEvent("on" + type, handler); | ||
else elem["on" + type] = handler; | ||
}, | ||
options = { | ||
autoRun: true, | ||
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, | ||
}, | ||
repaint = function () { | ||
canvas.width = window.innerWidth; | ||
canvas.height = options.barThickness * 5; // need space for shadow | ||
var ctx = canvas.getContext('2d') | ||
ctx.shadowBlur = options.shadowBlur | ||
ctx.shadowColor = options.shadowColor | ||
var ctx = canvas.getContext("2d"); | ||
ctx.shadowBlur = options.shadowBlur; | ||
ctx.shadowColor = options.shadowColor; | ||
var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0) | ||
for (var stop in options.barColors) | ||
lineGradient.addColorStop(stop, options.barColors[stop]) | ||
ctx.lineWidth = options.barThickness | ||
ctx.beginPath() | ||
ctx.moveTo(0, options.barThickness/2) | ||
ctx.lineTo(Math.ceil(currentProgress * canvas.width), options.barThickness/2) | ||
ctx.strokeStyle = lineGradient | ||
ctx.stroke() | ||
}, | ||
createCanvas = function() { | ||
canvas = document.createElement('canvas') | ||
var style = canvas.style | ||
style.position = 'fixed' | ||
style.top = style.left = style.right = style.margin = style.padding = 0 | ||
style.zIndex = 100001 | ||
style.display = 'none' | ||
if (options.className) | ||
canvas.classList.add(options.className) | ||
document.body.appendChild(canvas) | ||
addEvent(window, 'resize', repaint) | ||
}, | ||
topbar = { | ||
config: function(opts) { | ||
for (var key in opts) | ||
if (options.hasOwnProperty(key)) | ||
options[key] = opts[key] | ||
}, | ||
show: function() { | ||
if (showing) return | ||
showing = true | ||
if (fadeTimerId !== null) | ||
window.cancelAnimationFrame(fadeTimerId) | ||
if (!canvas) createCanvas() | ||
canvas.style.opacity = 1 | ||
canvas.style.display = 'block' | ||
topbar.progress(0) | ||
if (options.autoRun) { | ||
(function loop() { | ||
progressTimerId = window.requestAnimationFrame(loop) | ||
topbar.progress('+' + (.05 * Math.pow(1-Math.sqrt(currentProgress), 2))) | ||
})() | ||
} | ||
}, | ||
progress: function(to) { | ||
if (typeof to === "undefined") | ||
return currentProgress | ||
if (typeof to === "string") { | ||
to = (to.indexOf('+') >= 0 || to.indexOf('-') >= 0 ? currentProgress : 0) + parseFloat(to) | ||
} | ||
currentProgress = to > 1 ? 1 : to | ||
repaint() | ||
return currentProgress | ||
}, | ||
hide: function() { | ||
if (!showing) return | ||
showing = false | ||
if (progressTimerId != null) { | ||
window.cancelAnimationFrame(progressTimerId) | ||
progressTimerId = null | ||
} | ||
(function loop() { | ||
if (topbar.progress('+.1') >= 1) { | ||
canvas.style.opacity -= .05 | ||
if (canvas.style.opacity <= .05) { | ||
canvas.style.display = 'none' | ||
fadeTimerId = null | ||
return | ||
} | ||
} | ||
fadeTimerId = window.requestAnimationFrame(loop) | ||
})() | ||
var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0); | ||
for (var stop in options.barColors) | ||
lineGradient.addColorStop(stop, options.barColors[stop]); | ||
ctx.lineWidth = options.barThickness; | ||
ctx.beginPath(); | ||
ctx.moveTo(0, options.barThickness / 2); | ||
ctx.lineTo( | ||
Math.ceil(currentProgress * canvas.width), | ||
options.barThickness / 2 | ||
); | ||
ctx.strokeStyle = lineGradient; | ||
ctx.stroke(); | ||
}, | ||
createCanvas = function () { | ||
canvas = document.createElement("canvas"); | ||
var style = canvas.style; | ||
style.position = "fixed"; | ||
style.top = style.left = style.right = style.margin = style.padding = 0; | ||
style.zIndex = 100001; | ||
style.display = "none"; | ||
if (options.className) canvas.classList.add(options.className); | ||
document.body.appendChild(canvas); | ||
addEvent(window, "resize", repaint); | ||
}, | ||
topbar = { | ||
config: function (opts) { | ||
for (var key in opts) | ||
if (options.hasOwnProperty(key)) options[key] = opts[key]; | ||
}, | ||
show: function () { | ||
if (showing) return; | ||
showing = true; | ||
if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); | ||
if (!canvas) createCanvas(); | ||
canvas.style.opacity = 1; | ||
canvas.style.display = "block"; | ||
topbar.progress(0); | ||
if (options.autoRun) { | ||
(function loop() { | ||
progressTimerId = window.requestAnimationFrame(loop); | ||
topbar.progress( | ||
"+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2) | ||
); | ||
})(); | ||
} | ||
}, | ||
progress: function (to) { | ||
if (typeof to === "undefined") return currentProgress; | ||
if (typeof to === "string") { | ||
to = | ||
(to.indexOf("+") >= 0 || to.indexOf("-") >= 0 | ||
? currentProgress | ||
: 0) + parseFloat(to); | ||
} | ||
currentProgress = to > 1 ? 1 : to; | ||
repaint(); | ||
return currentProgress; | ||
}, | ||
hide: function () { | ||
if (!showing) return; | ||
showing = false; | ||
if (progressTimerId != null) { | ||
window.cancelAnimationFrame(progressTimerId); | ||
progressTimerId = null; | ||
} | ||
(function loop() { | ||
if (topbar.progress("+.1") >= 1) { | ||
canvas.style.opacity -= 0.05; | ||
if (canvas.style.opacity <= 0.05) { | ||
canvas.style.display = "none"; | ||
fadeTimerId = null; | ||
return; | ||
} | ||
} | ||
} | ||
fadeTimerId = window.requestAnimationFrame(loop); | ||
})(); | ||
}, | ||
}; | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
module.exports = topbar | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(function() { return topbar }) | ||
} else { | ||
this.topbar = topbar | ||
} | ||
}).call(this, window, document) | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
module.exports = topbar; | ||
} else if (typeof define === "function" && define.amd) { | ||
define(function () { | ||
return topbar; | ||
}); | ||
} else { | ||
this.topbar = topbar; | ||
} | ||
}.call(this, window, document)); |
@@ -1,5 +0,7 @@ | ||
/*! topbar 0.1.4, 2020-04-27 | ||
* http://buunguyen.github.io/topbar | ||
* 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)",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); | ||
/** | ||
* @license MIT | ||
* topbar 1.0.0, 2021-01-06 | ||
* http://buunguyen.github.io/topbar | ||
* Copyright (c) 2021 Buu Nguyen | ||
*/ | ||
(function(window,document){"use strict";!function(){for(var lastTime=0,vendors=["ms","moz","webkit","o"],x=0;x<vendors.length&&!window.requestAnimationFrame;++x)window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[vendors[x]+"CancelAnimationFrame"]||window[vendors[x]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(callback,element){var currTime=(new Date).getTime(),timeToCall=Math.max(0,16-(currTime-lastTime)),id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);return lastTime=currTime+timeToCall,id}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(id){clearTimeout(id)})}();function repaint(){canvas.width=window.innerWidth,canvas.height=5*options.barThickness;var ctx=canvas.getContext("2d");ctx.shadowBlur=options.shadowBlur,ctx.shadowColor=options.shadowColor;var stop,lineGradient=ctx.createLinearGradient(0,0,canvas.width,0);for(stop in options.barColors)lineGradient.addColorStop(stop,options.barColors[stop]);ctx.lineWidth=options.barThickness,ctx.beginPath(),ctx.moveTo(0,options.barThickness/2),ctx.lineTo(Math.ceil(currentProgress*canvas.width),options.barThickness/2),ctx.strokeStyle=lineGradient,ctx.stroke()}var canvas,progressTimerId,fadeTimerId,currentProgress,showing,options={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},topbar={config:function(opts){for(var key in opts)options.hasOwnProperty(key)&&(options[key]=opts[key])},show:function(){var type,handler,elem;showing||(showing=!0,null!==fadeTimerId&&window.cancelAnimationFrame(fadeTimerId),canvas||((elem=(canvas=document.createElement("canvas")).style).position="fixed",elem.top=elem.left=elem.right=elem.margin=elem.padding=0,elem.zIndex=100001,elem.display="none",options.className&&canvas.classList.add(options.className),document.body.appendChild(canvas),type="resize",handler=repaint,(elem=window).addEventListener?elem.addEventListener(type,handler,!1):elem.attachEvent?elem.attachEvent("on"+type,handler):elem["on"+type]=handler),canvas.style.opacity=1,canvas.style.display="block",topbar.progress(0),options.autoRun&&function loop(){progressTimerId=window.requestAnimationFrame(loop),topbar.progress("+"+.05*Math.pow(1-Math.sqrt(currentProgress),2))}())},progress:function(to){return void 0===to||("string"==typeof to&&(to=(0<=to.indexOf("+")||0<=to.indexOf("-")?currentProgress:0)+parseFloat(to)),currentProgress=1<to?1:to,repaint()),currentProgress},hide:function(){showing&&(showing=!1,null!=progressTimerId&&(window.cancelAnimationFrame(progressTimerId),progressTimerId=null),function loop(){return 1<=topbar.progress("+.1")&&(canvas.style.opacity-=.05,canvas.style.opacity<=.05)?(canvas.style.display="none",void(fadeTimerId=null)):void(fadeTimerId=window.requestAnimationFrame(loop))}())}};"object"==typeof module&&"object"==typeof module.exports?module.exports=topbar:"function"==typeof define&&define.amd?define(function(){return topbar}):this.topbar=topbar}).call(this,window,document); |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1255
0
189870
18