forked from arquillian/arquillian.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f947b27
commit 22abcd2
Showing
2 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | ||
<script type="text/javascript" src="/javascripts/jquery-timer.js"></script> | ||
|
||
<script type="text/javascript"> | ||
function d2h(dec) { | ||
return dec.toString(16); | ||
} | ||
function h2d(hex) { | ||
return parseInt(hex,16); | ||
} | ||
function rgb2h(r,g,b) { | ||
return [d2h(r),d2h(g),d2h(b)]; | ||
} | ||
function h2rgb(h,e,x) { | ||
return [h2d(h),h2d(e),h2d(x)]; | ||
} | ||
|
||
function cssColor2rgb(color) { | ||
if(color.indexOf('rgb')<=-1) { | ||
return h2rgb(color.substring(1,3),color.substring(3,5),color.substring(5,7)); | ||
} | ||
return color.substring(4,color.length-1).split(','); | ||
} | ||
|
||
function animateColor(elm, attr, begin, end, duration, fps) { | ||
|
||
if(!duration) duration = 1000; | ||
if(!fps) fps = 20; | ||
duration=parseFloat(duration); | ||
fps=parseFloat(fps); | ||
var interval = Math.ceil(1000/fps); | ||
var totalframes = Math.ceil(duration/interval); | ||
|
||
for(i=1;i <= totalframes;i++) { | ||
(function() { | ||
var frame=i; | ||
var b = cssColor2rgb(begin); | ||
var e = cssColor2rgb(end); | ||
var change0=e[0]-b[0]; | ||
var change1=e[1]-b[1]; | ||
var change2=e[2]-b[2]; | ||
|
||
function color() { | ||
var increase0=ease(frame, b[0], change0, totalframes); | ||
var increase1=ease(frame, b[1], change1, totalframes); | ||
var increase2=ease(frame, b[2], change2, totalframes); | ||
|
||
elm.attr(attr, 'rgb('+parseInt(increase0)+','+parseInt(increase1)+','+parseInt(increase2)+')'); | ||
} | ||
timer = setTimeout(color,interval*frame); | ||
})(); | ||
} | ||
} | ||
function ease(frame,begin,change,totalframes) { | ||
return begin+change*(frame/totalframes); | ||
} | ||
|
||
$(this).oneTime(5000, function() { | ||
jQuery.ajax({ | ||
url: 'https://arquillian.ci.cloudbees.com/job/Arquillian-Core/api/json', | ||
dataType: 'jsonp', | ||
jsonp: 'jsonp', | ||
jsonpCallback: 'animateIkeBuildStatus' | ||
}) | ||
}) | ||
|
||
function animateIkeBuildStatus(data) | ||
{ | ||
var start = '#425B64'; | ||
var end = getEndColor(data.healthReport[0].score); | ||
animateColor($('#right_eye'), 'fill', start, end, 1000, 20); | ||
animateColor($('#left_eye'), 'fill', start, end, 1000, 20); | ||
$(this).oneTime(2000, function() { | ||
animateColor($('#outer_ring'), 'fill', start, end, 1000, 20); | ||
}) | ||
|
||
} | ||
|
||
function getEndColor(healtScore) { | ||
var score = parseInt(healtScore) | ||
|
||
if(score == 100) { | ||
return '#7E9B02'; | ||
} | ||
if(score >= 80) { | ||
return '#BF8821'; | ||
} | ||
return '#7E1F02'; | ||
} | ||
|
||
</script> | ||
</head> | ||
<body> | ||
|
||
<div id="colors"></div> | ||
|
||
<svg id="ike" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="256px" height="256px"> | ||
<defs> | ||
|
||
<radialGradient id="SVGID_3_" cx="105.3413" cy="217.77" r="68.8747" gradientTransform="matrix(2.5388 0 0 2.5388 -182.7675 -401.8617)" gradientUnits="userSpaceOnUse"> | ||
<stop offset="0" style="stop-color:#FFFFFF"/> | ||
<stop offset="0.2218" style="stop-color:#FCFDF6"/> | ||
<stop offset="0.5765" style="stop-color:#F4F7DF"/> | ||
<stop offset="1" style="stop-color:#E7EEBB"/> | ||
</radialGradient> | ||
|
||
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="84.5137" y1="174.688" x2="85.6903" y2="121.7404"> | ||
<stop offset="0" style="stop-color:#2B464D"/> | ||
<stop offset="0.6047" style="stop-color:#425B64"/> | ||
<stop offset="1" style="stop-color:#4C636E"/> | ||
</linearGradient> | ||
|
||
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="91.7075" y1="174.8413" x2="92.8839" y2="121.9027"> | ||
<stop offset="0" style="stop-color:#2B464D"/> | ||
<stop offset="0.6047" style="stop-color:#425B64"/> | ||
<stop offset="1" style="stop-color:#4C636E"/> | ||
</linearGradient> | ||
</defs> | ||
|
||
<path id="outer_ring" fill="#425B64" d="M105.147,0C47.173,0,0,47.164,0,105.139c0,59.476,48.151,109.714,105.147,109.714 c56.992,0,105.14-50.238,105.14-109.714C210.287,47.164,163.121,0,105.147,0z"/> | ||
|
||
<path fill="#CCD584" d="M21.564,114.483c0,44.434,36.013,85.151,80.448,85.151c44.429,0,80.437-40.718,80.437-85.151 c0-44.435-36.008-80.451-80.437-80.451C57.578,34.032,21.564,70.048,21.564,114.483z"/> | ||
<path fill="url(#SVGID_3_)" d="M27.608,118.107c0,40.083,32.5,77.292,72.583,77.292c40.084,0,72.593-37.208,72.593-77.292 c0-40.084-32.509-72.583-72.593-72.583C60.109,45.524,27.608,78.023,27.608,118.107z"/> | ||
<path fill="#F7FAEF" d="M106.07,131.489c24.814-14.697,38.647-8.478,38.647-8.478c13.209,7.626,7.717,21.991,7.717,21.991 c-14.596,43.631-49.269,21.198-49.269,21.198s-4.609-2.71-6.941-4.828C91.969,142.783,99.451,135.409,106.07,131.489z"/> | ||
<path fill="#F7FAEF" d="M74.321,137.449c-17.846-14.903-29.662-11.746-29.662-11.746c-11.483,4.364-8.984,16.502-8.984,16.502 c5.968,36.624,36.478,23.243,36.478,23.243s4.016-1.558,6.136-2.936C84.089,148.272,79.09,141.431,74.321,137.449z"/> | ||
<path fill="#DFE677" d="M149.513,128.937c0,0,7.904,33.273-25.933,34.939c0,0-13.236,0.416-25.429-1.923L149.513,128.937z"/> | ||
<path fill="#DFE677" d="M38.916,134.027c0,0-8.74,24.597,18.504,27.684c0,0,8.62,1.013,19.709,0.693L38.916,134.027z"/> | ||
|
||
<path id="left_eye" fill="#425B64" d="M39.159,133.251l0.862,0.082c15.558,2.461,24.436,3.917,28.528,6.287 c8.405,4.879,11.755,11.999,10.385,20.824c-0.233,1.46-0.826,2.104-1.805,1.959l-14.611-2.282 c-17.997-2.79-25.874-11.484-23.603-26.095L39.159,133.251z"/> | ||
<path id="right_eye" fill="#425B64" d="M149.513,128.937l-1.116,0.009c-20.051,1.476-31.462,2.375-36.923,4.96 c-11.19,5.307-16.212,14-15.402,25.356c0.132,1.881,0.825,2.78,2.079,2.69l18.795-1.344c23.185-1.643,34.117-11.87,32.781-30.664 L149.513,128.937z"/> | ||
|
||
<path fill="url(#SVGID_6_)" d="M82.75,173.819l0.136,0.047l2.612-1.457l0.705-0.622c0.888-1.078,1.032-2.184,0.417-3.302 c-0.105-0.172-0.21-0.222-0.334-0.156l-1.799,0.99c-2.211,1.245-2.827,2.752-1.83,4.555L82.75,173.819z"/> | ||
<path fill="url(#SVGID_7_)" d="M89.897,168.267c-1.027,1.791-0.436,3.316,1.76,4.582l1.783,1.024 c0.117,0.065,0.234,0.016,0.339-0.156c0.626-1.098,0.506-2.199-0.354-3.302l-0.716-0.631l-2.581-1.502l-0.137,0.039L89.897,168.267z"/> | ||
|
||
|
||
<!-- Error Hands | ||
<path fill="#FFFFFF" d="M140.812,194.278c0.132-3.193,1.907-6.464,2.4-7.315c0.695-1.852,4.35-5.54,21.712-7.787 c7.769-1.006,11.357-1.71,13.284-2.089c2.826-0.558,3.008-0.558,6.461-0.024c0.496,0.075,1.068,0.166,1.737,0.265l0.221,0.031 l0.204,0.086c0.4,0.165,3.919,1.809,3.646,8.415c-0.022,0.521-0.068,1.065-0.137,1.625c0.001,0.051-0.001,0.109-0.002,0.17 c-0.021,0.51-0.152,1.304-0.632,2.317c2.209,0.275,4.928,1.366,7.456,4.461c1.844,2.254,2.697,4.331,2.613,6.349 c-0.107,2.559-1.734,4.357-2.923,5.67c-0.269,0.297-0.522,0.577-0.737,0.841l-0.282,0.35c-0.723,0.892-1.368,1.642-2.154,2.211 c1.354,0.93,3.303,2.899,3.151,6.497c-0.079,1.931-0.788,4.077-2.104,6.383c-1.557,2.724-2.963,4.653-4.273,5.849 c0.773,1.063,1.387,2.589,1.297,4.73c-0.034,0.869-0.188,1.805-0.452,2.782c-1.818,6.705-2.655,7.282-11.13,11.425 c-0.651,0.318-1.353,0.663-2.106,1.032l-0.302,0.15l-0.336,0.03c-1.815,0.165-5.392-0.501-7.357-3.859 c-2.224,0.452-6.55,0.849-12.242-0.942c-7.195-2.26-9.706-4.133-9.457-10.142c0.022-0.504,0.062-1.071,0.123-1.734 c0.022-0.393,0.133-0.74,0.319-1.044c-0.25-0.144-0.496-0.31-0.737-0.509l-0.119-0.097c-2.576-2.104-3.733-3.258-4.174-8.584 c-0.021-0.262-0.027-0.521-0.018-0.775c0.099-2.365,1.425-3.893,3.555-5.017c-1.512-0.225-2.61-0.825-3.249-1.928 c-1.135-1.96-1.736-4.281-1.65-6.368c0.074-1.772,0.704-4.611,3.647-6.627c-1.128-0.208-2.171-0.659-3.092-1.432 C141.92,198.793,140.692,197.142,140.812,194.278L140.812,194.278z"/> | ||
<path fill="#771A01" d="M197.961,200.705c-0.1,2.383-2.04,3.955-3.251,5.437c-1.916,2.344-2.571,3.527-7.7,3.013 c-1.05-0.106-1.471-0.098-1.475-0.015c-0.013,0.317,6.251,1.728,6.251,1.728s3.4,1.293,3.229,5.407 c-0.062,1.469-0.578,3.299-1.868,5.557c-3.022,5.292-4.832,6.373-5.776,6.423c-0.481-0.253-0.839-0.337-0.839-0.337 s0.253,0.368,0.839,0.337c1.049,0.55,2.695,1.907,2.565,4.98c-0.027,0.702-0.149,1.493-0.391,2.383 c-1.788,6.592-2.079,6.275-12.286,11.306c0,0-4.562,0.416-6.188-4.195c0,0-4.928,1.916-12.702-0.53 c-6.99-2.196-8.38-3.672-8.186-8.335c0.023-0.522,0.063-1.084,0.119-1.694c0,0,0.074-1.814,8.544-1.462 c8.469,0.352,12.815-2.195,12.815-2.195s-1.802-0.378-9.388-0.087c-7.587,0.29-10.711,2.584-13.056,0.669 c-2.344-1.916-3.227-2.558-3.63-7.422c-0.016-0.19-0.021-0.373-0.012-0.55c0.181-4.365,7.263-5.013,16.091-7.264 c9.188-2.346,13.132-2.485,16.572-5.068c0,0-6.1,0.959-10.977,1.664c-4.878,0.706-19.646,6.152-21.624,2.736 c-0.837-1.443-1.489-3.419-1.408-5.382c0.111-2.678,1.593-5.329,5.842-6.552c7.361-2.118,23.036-7.524,23.036-7.524 s-4.84-0.203-11.279,1.651c-6.438,1.854-13.887,6.087-17.691,2.898c-1.208-1.011-1.574-2.444-1.513-3.929 c0.135-3.201,2.254-6.643,2.254-6.643s0.781-4.21,20.277-6.731c19.494-2.521,12.551-3.114,20.98-1.854c0,0,2.753,1.133,2.523,6.659 c-0.021,0.501-0.065,1.04-0.141,1.618c0,0,0.008,0.062,0.002,0.178c-0.021,0.523-0.294,2.179-2.623,4.562 c0,0,5.243-2.206,9.856,3.439C197.451,197.657,198.019,199.318,197.961,200.705 M201.59,200.855 c0.103-2.479-0.886-4.957-3.022-7.573c-2.162-2.645-4.492-3.981-6.525-4.631c0.07-0.357,0.101-0.666,0.11-0.922 c0.002-0.043,0.002-0.089,0.003-0.132c0.067-0.569,0.113-1.128,0.136-1.663c0.325-7.841-4.247-9.954-4.77-10.17l-0.408-0.169 l-0.439-0.064c-0.664-0.1-1.233-0.189-1.728-0.263c-3.541-0.549-3.958-0.579-7.089,0.036c-1.906,0.375-5.457,1.073-13.166,2.07 c-8.511,1.102-14.787,2.68-18.658,4.691c-2.731,1.418-3.94,2.894-4.448,4.081c-0.643,1.123-2.442,4.552-2.588,8.053 c-0.149,3.605,1.443,5.724,2.809,6.866c0.304,0.253,0.615,0.481,0.935,0.681c-1.304,1.639-2.042,3.641-2.138,5.911 c-0.1,2.424,0.59,5.103,1.894,7.353c0.342,0.592,0.766,1.08,1.262,1.477c-1.133,1.258-1.739,2.756-1.811,4.482 c-0.013,0.327-0.006,0.664,0.022,1.002c0.471,5.682,1.741,7.301,4.729,9.753c-0.015,0.112-0.021,0.209-0.025,0.283 c0.004-0.058,0.006-0.113,0.011-0.173c-0.063,0.716-0.106,1.329-0.13,1.878c-0.299,7.2,3.219,9.591,10.725,11.951 c5.183,1.629,9.311,1.569,11.942,1.201c2.494,3.208,6.329,3.861,8.368,3.676l0.671-0.062l0.605-0.297 c0.751-0.372,1.449-0.713,2.097-1.029c4.348-2.126,6.742-3.299,8.487-5.024c1.978-1.963,2.682-4.165,3.602-7.558 c0.3-1.109,0.475-2.18,0.516-3.185c0.068-1.667-0.222-3.198-0.836-4.522c1.135-1.287,2.306-3.014,3.571-5.23 c1.463-2.56,2.251-4.985,2.344-7.207c0.123-2.943-0.934-5.12-2.27-6.617c0.29-0.324,0.577-0.664,0.865-1.022l0.281-0.346 c0.185-0.228,0.425-0.492,0.679-0.772C199.497,206.236,201.457,204.073,201.59,200.855L201.59,200.855z M172.971,197.36 L172.971,197.36L172.971,197.36L172.971,197.36z"/> | ||
<path fill="#FFFFFF" d="M70.029,192.126c-0.792-3.066-4.063-4.322-6.456-5.003c-3.282-0.933-5.823-0.892-7.548,0.121 c-1.424,0.837-1.768,2.033-1.825,2.266l-0.031,0.135l-0.009,0.137c-0.406,5.646,0.654,9.879,1.505,13.279 c0.457,1.824,0.852,3.397,0.883,4.719c0.043,1.688,0.241,3.228,0.587,4.575c0.926,3.583,2.992,5.891,5.524,6.172 c1.837,0.205,3.523-0.731,4.4-2.438c1.043-2.038,1.506-6.837,2.047-13.4c0.226-2.739,0.459-5.577,0.707-6.521 C70.124,194.966,70.395,193.544,70.029,192.126L70.029,192.126z"/> | ||
<path fill="#771A01" d="M58.796,211.924c-0.299-1.16-0.492-2.548-0.533-4.187c-0.103-4.106-3.002-9.335-2.393-17.832 c0,0,0.703-2.987,7.234-1.134c3.49,0.992,4.876,2.287,5.262,3.783c0.254,0.983,0.079,2.052-0.215,3.182 c-0.74,2.848-1.049,16.506-2.62,19.567C64.231,217.845,60.252,217.559,58.796,211.924 M55.476,212.782 c1.112,4.303,3.725,7.085,6.994,7.45c2.524,0.279,4.924-1.041,6.115-3.359c1.19-2.325,1.656-7.066,2.23-14.037 c0.199-2.423,0.448-5.433,0.656-6.236c0.369-1.415,0.683-3.105,0.218-4.9c-1.13-4.374-6.036-5.768-7.646-6.226 c-3.752-1.065-6.742-0.968-8.886,0.291c-1.977,1.164-2.51,2.861-2.626,3.354l-0.063,0.267l-0.018,0.275 c-0.425,5.918,0.717,10.484,1.552,13.816c0.431,1.725,0.804,3.215,0.833,4.345C54.879,209.64,55.097,211.311,55.476,212.782 L55.476,212.782z"/> | ||
<path fill="#FFFFFF" d="M55.879,192.187c-0.755-2.921-3.042-5.591-3.665-6.278c-1.009-1.571-5.112-4.252-21.587-2.891 c-7.373,0.612-10.827,0.67-12.68,0.703c-2.72,0.045-2.888,0.081-5.969,1.257c-0.443,0.168-0.954,0.364-1.553,0.588l-0.196,0.073 l-0.171,0.118c-0.339,0.233-3.261,2.446-1.7,8.491c0.123,0.478,0.273,0.972,0.447,1.477c0.008,0.046,0.022,0.099,0.035,0.155 c0.122,0.466,0.399,1.173,1.042,2.013c-1.983,0.692-4.279,2.238-6,5.596c-1.255,2.446-1.632,4.533-1.156,6.379 c0.606,2.342,2.464,3.68,3.82,4.657c0.308,0.219,0.598,0.43,0.849,0.629l0.331,0.268c0.845,0.681,1.587,1.243,2.426,1.615 c-1.066,1.126-2.475,3.331-1.624,6.623c0.457,1.766,1.536,3.606,3.208,5.475c1.975,2.207,3.656,3.711,5.103,4.554 c-0.504,1.133-0.768,2.666-0.261,4.625c0.205,0.796,0.53,1.629,0.969,2.479c3.007,5.831,3.894,6.197,12.539,8.344 c0.663,0.167,1.378,0.345,2.147,0.537l0.308,0.079l0.317-0.039c1.709-0.207,4.879-1.53,6.028-5.021 c2.143-0.024,6.216-0.514,11.117-3.293c6.195-3.513,8.142-5.739,6.723-11.236c-0.119-0.461-0.268-0.978-0.455-1.578 c-0.1-0.359-0.271-0.656-0.503-0.9c0.203-0.182,0.397-0.385,0.581-0.616l0.09-0.112c1.961-2.449,2.801-3.746,2.153-8.752 c-0.032-0.247-0.077-0.487-0.137-0.719c-0.56-2.165-2.087-3.312-4.276-3.929c1.352-0.504,2.247-1.276,2.618-2.423 c0.66-2.034,0.756-4.296,0.263-6.205c-0.418-1.621-1.562-4.116-4.679-5.396c0.999-0.417,1.873-1.038,2.571-1.933 C55.75,196.577,56.557,194.81,55.879,192.187L55.879,192.187z"/> | ||
<path fill="#771A01" d="M4.387,209.438c-0.327-1.27-0.134-2.913,1.022-5.166c3.141-6.127,8.418-5.127,8.418-5.127 c-2.623-1.738-3.202-3.215-3.326-3.694c-0.027-0.105-0.033-0.164-0.033-0.164c-0.185-0.516-0.332-1.006-0.451-1.466 c-1.306-5.057,1.011-6.648,1.011-6.648c7.534-2.832,1.24-0.91,19.738-2.443c18.499-1.532,20.054,2.2,20.054,2.2 s2.639,2.759,3.396,5.686c0.351,1.359,0.296,2.757-0.618,3.928c-2.883,3.697-10.596,1.263-16.908,0.826 c-6.313-0.437-10.741,0.709-10.741,0.709s15.543,1.889,22.759,2.388c4.166,0.285,6.058,2.44,6.691,4.893 c0.462,1.795,0.252,3.749-0.234,5.247c-1.149,3.543-15.865,1.44-20.507,1.755c-4.644,0.313-10.464,0.637-10.464,0.637 c3.688,1.704,7.357,1.054,16.305,1.396c8.596,0.333,15.263-0.473,16.295,3.522c0.042,0.163,0.073,0.333,0.096,0.511 c0.592,4.572-0.096,5.338-1.881,7.571c-1.785,2.233-5.125,0.731-12.187,1.966c-7.061,1.234-8.65,1.94-8.65,1.94 s4.518,1.491,12.267-0.511c7.75-2.003,8.178-0.342,8.178-0.342c0.172,0.551,0.321,1.062,0.446,1.541 c1.102,4.266,0.112,5.901-5.907,9.315c-6.693,3.797-11.623,3.003-11.623,3.003c-0.588,4.581-4.883,5.101-4.883,5.101 c-10.419-2.622-10.625-2.272-13.582-8.006c-0.399-0.772-0.667-1.479-0.833-2.121c-0.727-2.813,0.523-4.391,1.383-5.108 c0.547-0.086,0.708-0.477,0.708-0.477s-0.313,0.147-0.708,0.477c-0.882,0.142-2.767-0.496-6.605-4.785 c-1.639-1.829-2.477-3.416-2.825-4.76c-0.973-3.766,1.912-5.632,1.912-5.632s5.503-2.54,5.428-2.833 c-0.02-0.076-0.41-0.001-1.358,0.306c-4.633,1.49-5.473,0.527-7.707-1.258C7.055,212.685,4.95,211.619,4.387,209.438 M1.066,210.294 c0.762,2.945,2.997,4.555,4.477,5.62c0.291,0.208,0.565,0.404,0.78,0.579l0.327,0.264c0.339,0.273,0.669,0.53,1.002,0.771 c-0.938,1.646-1.481,3.866-0.786,6.559c0.526,2.035,1.735,4.118,3.591,6.192c1.607,1.794,3.031,3.157,4.333,4.12 c-0.305,1.345-0.271,2.816,0.124,4.342c0.237,0.919,0.609,1.875,1.106,2.838c1.522,2.949,2.608,4.845,4.824,6.264 c1.952,1.249,4.394,1.856,8.83,2.961c0.661,0.164,1.373,0.34,2.141,0.534l0.616,0.154l0.632-0.075 c1.92-0.232,5.331-1.595,6.998-5.053c2.504-0.18,6.327-0.943,10.789-3.473c6.461-3.664,9.237-6.569,7.535-13.159 c-0.129-0.5-0.29-1.057-0.493-1.706c0.016,0.054,0.031,0.105,0.045,0.157c-0.019-0.068-0.045-0.156-0.08-0.256 c2.273-2.856,3.125-4.602,2.435-9.943c-0.039-0.314-0.101-0.63-0.178-0.929c-0.407-1.578-1.265-2.841-2.558-3.78 c0.378-0.464,0.672-0.998,0.872-1.611c0.759-2.337,0.865-4.946,0.291-7.163c-0.537-2.078-1.617-3.78-3.144-5.035 c0.255-0.246,0.499-0.518,0.728-0.815c1.034-1.322,2.087-3.594,1.234-6.893c-0.828-3.206-3.168-6.014-3.984-6.923 c-0.704-0.996-2.114-2.12-4.915-2.887c-3.973-1.092-10.081-1.305-18.155-0.638c-7.316,0.606-10.732,0.665-12.567,0.695 c-3.013,0.052-3.392,0.164-6.551,1.371c-0.443,0.166-0.951,0.362-1.544,0.584l-0.393,0.146l-0.343,0.237 c-0.439,0.302-4.243,3.159-2.389,10.335c0.126,0.489,0.279,0.997,0.454,1.509c0.009,0.038,0.02,0.08,0.029,0.121 c0.06,0.233,0.15,0.512,0.284,0.827c-1.748,1.004-3.635,2.698-5.105,5.569C0.902,205.543,0.48,208.026,1.066,210.294L1.066,210.294z M26.798,201.402L26.798,201.402L26.798,201.402L26.798,201.402z"/> | ||
--> | ||
</svg> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/** | ||
* jQuery.timers - Timer abstractions for jQuery | ||
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) | ||
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). | ||
* Date: 2009/10/16 | ||
* | ||
* @author Blair Mitchelmore | ||
* @version 1.2 | ||
* | ||
**/ | ||
|
||
jQuery.fn.extend({ | ||
everyTime: function(interval, label, fn, times) { | ||
return this.each(function() { | ||
jQuery.timer.add(this, interval, label, fn, times); | ||
}); | ||
}, | ||
oneTime: function(interval, label, fn) { | ||
return this.each(function() { | ||
jQuery.timer.add(this, interval, label, fn, 1); | ||
}); | ||
}, | ||
stopTime: function(label, fn) { | ||
return this.each(function() { | ||
jQuery.timer.remove(this, label, fn); | ||
}); | ||
} | ||
}); | ||
|
||
jQuery.extend({ | ||
timer: { | ||
global: [], | ||
guid: 1, | ||
dataKey: "jQuery.timer", | ||
regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/, | ||
powers: { | ||
// Yeah this is major overkill... | ||
'ms': 1, | ||
'cs': 10, | ||
'ds': 100, | ||
's': 1000, | ||
'das': 10000, | ||
'hs': 100000, | ||
'ks': 1000000 | ||
}, | ||
timeParse: function(value) { | ||
if (value == undefined || value == null) | ||
return null; | ||
var result = this.regex.exec(jQuery.trim(value.toString())); | ||
if (result[2]) { | ||
var num = parseFloat(result[1]); | ||
var mult = this.powers[result[2]] || 1; | ||
return num * mult; | ||
} else { | ||
return value; | ||
} | ||
}, | ||
add: function(element, interval, label, fn, times) { | ||
var counter = 0; | ||
|
||
if (jQuery.isFunction(label)) { | ||
if (!times) | ||
times = fn; | ||
fn = label; | ||
label = interval; | ||
} | ||
|
||
interval = jQuery.timer.timeParse(interval); | ||
|
||
if (typeof interval != 'number' || isNaN(interval) || interval < 0) | ||
return; | ||
|
||
if (typeof times != 'number' || isNaN(times) || times < 0) | ||
times = 0; | ||
|
||
times = times || 0; | ||
|
||
var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {}); | ||
|
||
if (!timers[label]) | ||
timers[label] = {}; | ||
|
||
fn.timerID = fn.timerID || this.guid++; | ||
|
||
var handler = function() { | ||
if ((++counter > times && times !== 0) || fn.call(element, counter) === false) | ||
jQuery.timer.remove(element, label, fn); | ||
}; | ||
|
||
handler.timerID = fn.timerID; | ||
|
||
if (!timers[label][fn.timerID]) | ||
timers[label][fn.timerID] = window.setInterval(handler,interval); | ||
|
||
this.global.push( element ); | ||
|
||
}, | ||
remove: function(element, label, fn) { | ||
var timers = jQuery.data(element, this.dataKey), ret; | ||
|
||
if ( timers ) { | ||
|
||
if (!label) { | ||
for ( label in timers ) | ||
this.remove(element, label, fn); | ||
} else if ( timers[label] ) { | ||
if ( fn ) { | ||
if ( fn.timerID ) { | ||
window.clearInterval(timers[label][fn.timerID]); | ||
delete timers[label][fn.timerID]; | ||
} | ||
} else { | ||
for ( var fn in timers[label] ) { | ||
window.clearInterval(timers[label][fn]); | ||
delete timers[label][fn]; | ||
} | ||
} | ||
|
||
for ( ret in timers[label] ) break; | ||
if ( !ret ) { | ||
ret = null; | ||
delete timers[label]; | ||
} | ||
} | ||
|
||
for ( ret in timers ) break; | ||
if ( !ret ) | ||
jQuery.removeData(element, this.dataKey); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
jQuery(window).bind("unload", function() { | ||
jQuery.each(jQuery.timer.global, function(index, item) { | ||
jQuery.timer.remove(item); | ||
}); | ||
}); |