added external skrollr and first structure in index.html

This commit is contained in:
Van Fanel
2014-07-05 18:56:34 +02:00
parent 7d95d4c864
commit 2a4679207a
58 changed files with 7484 additions and 1 deletions

95
external/skrollr/test/index.html vendored Normal file
View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html class="no-skrollr">
<head>
<meta charset="utf-8" />
<title>skrollr test suite</title>
<link rel="stylesheet" type="text/css" href="qunit.css" />
<style type="text/css">
#qunit {
position:fixed;
bottom:0;
left:0;
right:0;
height:50%;
overflow:auto;
z-index:101;
}
#anchor-1, #anchor-2 {
height:1000px;
background:#ccc;
position:absolute;
top:0;
}
#foreign-anchor {
margin:100px;
padding:100px;
background:#ff0;
position:fixed;
}
#relative-percentage-offset {
top:100%;
}
#float {
position:static !important;
}
div {position:absolute;}
</style>
<script src="../src/skrollr.js" type="text/javascript"></script>
</head>
<body class="notransition">
<div id="end" data-start="font-size:10px;" data-end="font-size:90px;">TEST</div>
<div id="simple-numeric" data-_myconst--300=" left:-100px; top:0px " data-_myconst-200-start=" top:50px; left:100px; ">TEST</div>
<div id="compound-numeric" data-_my500--500="margin:0px 10px 20px 30px;" data-_my500="margin:30px 20px 10px 0px;">TEST</div>
<div id="rgb-color" data-0="color:rgb(0,0,0);" data-500="color:rgb(50,100,150);">TEST</div>
<div id="rgba-color" data-0="color:rgba(0,0,0,.2);" data-500="color:rgba(50,100,150,.5);">TEST</div>
<div id="hsl-color" data-0="color:hsl(0,0%,0%);" data-500="color:hsl(3600,50%,50%);">TEST</div>
<div id="hsla-color" data-0="color:hsla(0,0%,0%,.0);" data-500="color:hsla(3600,50%,50%,.5);">TEST</div>
<div id="no-interpolation" data-0="right:!0px;" data-499="right:!100px;">TEST</div>
<div id="anchor-1" data-top-bottom="right:100px;" data-top="right:0px;">TEST</div>
<div id="anchor-2" data-top="right:0px;" data-top-center="right:200px;">TEST</div>
<div id="foreign-anchor" data-top="padding:200px;" data-top-center="padding:100px;" data-anchor-target="#anchor-2"></div>
<div id="float" data-start="float:none;" data-499="float:left;" style="background:red;">TEST</div>
<svg version="1.1" width="200px" height="200px">
<rect
width="200" height="200" style="fill:#0000ff;fill-rule:evenodd;stroke:none"
id="svg-relative-mode"
data-top="margin:100px;" data-top-bottom="margin:200px;" />
</svg>
<div id="colon-url" data-250="background-image:!none;" data-499='background-image:!url("https://secure.travis-ci.org/Prinzhorn/skrollr.png");'>TEST</div>
<div id="period-number" data-250="background-image:!none;" data-499='background-image:!url("https://secure.travis-ci.org/Prinzhorn/skrollr.png?1337");'>TEST</div>
<div id="easing" data-0="left[half1]:0px;" data-500="left[half1]:50px;">TEST</div>
<div id="easing_with_easing_strategy" data-0="left[half1]:0px;" data-500="left[half1]:50px;" data-edge-strategy="ease">TEST</div>
<div id="reset-strategy" data-0="left:0px;" data-500="left:50px;" data-edge-strategy="reset" style="left:1337px;">TEST</div>
<div id="percentage-offset" data-0="left:0px;" data-200p="left:500px;">TEST</div>
<div id="relative-percentage-offset" data-0="left:0px;" data--100p-bottom-top="left:500px;">TEST</div>
<div id="auto-z-index" data-0="z-index:!1;" data-250="z-index:auto;">TEST</div>
<div id="attr" data-0="@title:500;@data-test:skrollr" data-250="@title:250" data-500="@title:0;@data-test:skrollr-test">TEST</div>
<div id="qunit"></div>
<script src="qunit.js" type="text/javascript"></script>
<script src="qunit-numeric-css-property-equals.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="../src/plugins/skrollr.ie.js"></script>
<![endif]-->
<script src="tests.js" type="text/javascript"></script>
</body>
</html>

4
external/skrollr/test/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

57
external/skrollr/test/loading-tests.js vendored Normal file
View File

@ -0,0 +1,57 @@
/*
* Test to see if skrollr is loaded properly
* - module support with require
* - global variable exposure without module
*/
/*global $:false, require:false, start:false, ok:false, QUnit:false, asyncTest:false */
$(function(){
'use strict';
// a helper to load a script specified by the path argument
// onLoaded is called once the script is loaded
function loadScript(path, onLoaded){
$.getScript( path, function() {
if(typeof onLoaded === 'function'){
onLoaded.call();
}
});
}
// remove skrollr from the global scope after each test is run
QUnit.testDone(function() {
if(typeof window.skrollr !== 'undefined'){
delete window.skrollr;
}
});
//tests
asyncTest('skrollr is available through global scope without require', function(){
ok(typeof skrollr === 'undefined', 'skrollr is not available before the script is loaded');
loadScript('../src/skrollr.js', function() {
ok(typeof skrollr !== 'undefined', 'skrollr is available through global scope');
start();
});
});
asyncTest('skrollr is available as a module when require.js is present', function(){
ok(typeof skrollr === 'undefined', 'skrollr is not available before the script is loaded');
loadScript('require.js', function(){
require.config({
baseUrl: '../src',
waitSeconds: 15
});
require(['skrollr'], function(skrollr){
ok(typeof skrollr !== 'undefined', 'skrollr is available as a module');
start();
});
});
});
});

17
external/skrollr/test/loading.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html class="no-skrollr">
<head>
<meta charset="utf-8" />
<title>skrollr test suite</title>
<link rel="stylesheet" type="text/css" href="qunit.css" />
</head>
<body class="notransition">
<div id="qunit"></div>
<script src="qunit.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="../src/plugins/skrollr.ie.js"></script>
<![endif]-->
<script src="loading-tests.js"></script>
</body>
</html>

View File

@ -0,0 +1,36 @@
QUnit.extend(QUnit, {
rxNumericCSSProperty: /[0-9.]+/g,
numericCSSPropertyEquals: function(actual, expected, message) {
//Simple case, both strings already match.
if(actual === expected) {
QUnit.push(true, actual, expected, message);
return;
}
//Now extract all numbers from the property string.
//e.g. "0.5px 100px" will result in ["0.5", "100"]
var actualArray = actual.match(QUnit.rxNumericCSSProperty);
var expectedArray = expected.match(QUnit.rxNumericCSSProperty);
var passes = actualArray !== null && expectedArray !== null && actualArray.length === expectedArray.length;
for(var i = 0; passes && i < actualArray.length; i++) {
var curActual = actualArray[i];
var curExpected = expectedArray[i];
var delta = 0.01;
//Use 0.01 for floats and 1 for ints.
if(curActual.indexOf('.') === -1 && curExpected.indexOf('.') === -1) {
delta = 1;
}
curActual = parseFloat(curActual);
curExpected = parseFloat(curExpected);
passes = (curActual === curExpected) || Math.abs(curActual - curExpected) <= delta;
}
QUnit.push(passes, actual, expected, message);
}
});

235
external/skrollr/test/qunit.css vendored Normal file
View File

@ -0,0 +1,235 @@
/**
* QUnit v1.5.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2012 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
-webkit-border-top-left-radius: 15px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-header label {
display: inline-block;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests ol {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
margin: 0.5em;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #5E740B;
background-color: #fff;
border-left: 26px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 15px 15px;
-moz-border-radius: 0 0 15px 15px;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}

1669
external/skrollr/test/qunit.js vendored Normal file

File diff suppressed because it is too large Load Diff

36
external/skrollr/test/require.js vendored Normal file
View File

@ -0,0 +1,36 @@
/*
RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
Available via the MIT or new BSD license.
see: http://github.com/jrburke/requirejs for details
*/
var requirejs,require,define;
(function(Z){function H(b){return"[object Function]"===L.call(b)}function I(b){return"[object Array]"===L.call(b)}function y(b,c){if(b){var e;for(e=0;e<b.length&&(!b[e]||!c(b[e],e,b));e+=1);}}function M(b,c){if(b){var e;for(e=b.length-1;-1<e&&(!b[e]||!c(b[e],e,b));e-=1);}}function t(b,c){return ga.call(b,c)}function l(b,c){return t(b,c)&&b[c]}function F(b,c){for(var e in b)if(t(b,e)&&c(b[e],e))break}function Q(b,c,e,h){c&&F(c,function(c,j){if(e||!t(b,j))h&&"string"!==typeof c?(b[j]||(b[j]={}),Q(b[j],
c,e,h)):b[j]=c});return b}function u(b,c){return function(){return c.apply(b,arguments)}}function aa(b){throw b;}function ba(b){if(!b)return b;var c=Z;y(b.split("."),function(b){c=c[b]});return c}function A(b,c,e,h){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=h;e&&(c.originalError=e);return c}function ha(b){function c(a,f,b){var d,m,c,g,e,h,j,i=f&&f.split("/");d=i;var n=k.map,p=n&&n["*"];if(a&&"."===a.charAt(0))if(f){d=l(k.pkgs,f)?i=[f]:i.slice(0,i.length-
1);f=a=d.concat(a.split("/"));for(d=0;f[d];d+=1)if(m=f[d],"."===m)f.splice(d,1),d-=1;else if(".."===m)if(1===d&&(".."===f[2]||".."===f[0]))break;else 0<d&&(f.splice(d-1,2),d-=2);d=l(k.pkgs,f=a[0]);a=a.join("/");d&&a===f+"/"+d.main&&(a=f)}else 0===a.indexOf("./")&&(a=a.substring(2));if(b&&n&&(i||p)){f=a.split("/");for(d=f.length;0<d;d-=1){c=f.slice(0,d).join("/");if(i)for(m=i.length;0<m;m-=1)if(b=l(n,i.slice(0,m).join("/")))if(b=l(b,c)){g=b;e=d;break}if(g)break;!h&&(p&&l(p,c))&&(h=l(p,c),j=d)}!g&&
h&&(g=h,e=j);g&&(f.splice(0,e,g),a=f.join("/"))}return a}function e(a){z&&y(document.getElementsByTagName("script"),function(f){if(f.getAttribute("data-requiremodule")===a&&f.getAttribute("data-requirecontext")===i.contextName)return f.parentNode.removeChild(f),!0})}function h(a){var f=l(k.paths,a);if(f&&I(f)&&1<f.length)return f.shift(),i.require.undef(a),i.require([a]),!0}function $(a){var f,b=a?a.indexOf("!"):-1;-1<b&&(f=a.substring(0,b),a=a.substring(b+1,a.length));return[f,a]}function n(a,f,
b,d){var m,B,g=null,e=f?f.name:null,h=a,j=!0,k="";a||(j=!1,a="_@r"+(L+=1));a=$(a);g=a[0];a=a[1];g&&(g=c(g,e,d),B=l(r,g));a&&(g?k=B&&B.normalize?B.normalize(a,function(a){return c(a,e,d)}):c(a,e,d):(k=c(a,e,d),a=$(k),g=a[0],k=a[1],b=!0,m=i.nameToUrl(k)));b=g&&!B&&!b?"_unnormalized"+(M+=1):"";return{prefix:g,name:k,parentMap:f,unnormalized:!!b,url:m,originalName:h,isDefine:j,id:(g?g+"!"+k:k)+b}}function q(a){var f=a.id,b=l(p,f);b||(b=p[f]=new i.Module(a));return b}function s(a,f,b){var d=a.id,m=l(p,
d);if(t(r,d)&&(!m||m.defineEmitComplete))"defined"===f&&b(r[d]);else if(m=q(a),m.error&&"error"===f)b(m.error);else m.on(f,b)}function v(a,f){var b=a.requireModules,d=!1;if(f)f(a);else if(y(b,function(f){if(f=l(p,f))f.error=a,f.events.error&&(d=!0,f.emit("error",a))}),!d)j.onError(a)}function w(){R.length&&(ia.apply(G,[G.length-1,0].concat(R)),R=[])}function x(a){delete p[a];delete T[a]}function E(a,f,b){var d=a.map.id;a.error?a.emit("error",a.error):(f[d]=!0,y(a.depMaps,function(d,c){var g=d.id,
e=l(p,g);e&&(!a.depMatched[c]&&!b[g])&&(l(f,g)?(a.defineDep(c,r[g]),a.check()):E(e,f,b))}),b[d]=!0)}function C(){var a,f,b,d,m=(b=1E3*k.waitSeconds)&&i.startTime+b<(new Date).getTime(),c=[],g=[],j=!1,l=!0;if(!U){U=!0;F(T,function(b){a=b.map;f=a.id;if(b.enabled&&(a.isDefine||g.push(b),!b.error))if(!b.inited&&m)h(f)?j=d=!0:(c.push(f),e(f));else if(!b.inited&&(b.fetched&&a.isDefine)&&(j=!0,!a.prefix))return l=!1});if(m&&c.length)return b=A("timeout","Load timeout for modules: "+c,null,c),b.contextName=
i.contextName,v(b);l&&y(g,function(a){E(a,{},{})});if((!m||d)&&j)if((z||da)&&!V)V=setTimeout(function(){V=0;C()},50);U=!1}}function D(a){t(r,a[0])||q(n(a[0],null,!0)).init(a[1],a[2])}function J(a){var a=a.currentTarget||a.srcElement,b=i.onScriptLoad;a.detachEvent&&!W?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=i.onScriptError;(!a.detachEvent||W)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function K(){var a;for(w();G.length;){a=
G.shift();if(null===a[0])return v(A("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));D(a)}}var U,X,i,N,V,k={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},p={},T={},Y={},G=[],r={},S={},L=1,M=1;N={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=r[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){var b=
l(k.pkgs,a.map.id);return(b?l(k.config,a.map.id+"/"+b.main):l(k.config,a.map.id))||{}},exports:r[a.map.id]}}};X=function(a){this.events=l(Y,a.id)||{};this.map=a;this.shim=l(k.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};X.prototype={init:function(a,b,c,d){d=d||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=u(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;
this.ignore=d.ignore;d.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
this.map.url;S[a]||(S[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var d=this.exports,m=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(H(m)){if(this.events.error&&this.map.isDefine||j.onError!==aa)try{d=i.execCb(c,m,b,d)}catch(e){a=e}else d=i.execCb(c,m,b,d);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==
this.exports?d=b.exports:void 0===d&&this.usingExports&&(d=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",v(this.error=a)}else d=m;this.exports=d;if(this.map.isDefine&&!this.ignore&&(r[c]=d,j.onResourceLoad))j.onResourceLoad(i,this.map,this.depMaps);x(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=
!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,e=n(a.prefix);this.depMaps.push(e);s(e,"defined",u(this,function(d){var m,e;e=this.map.name;var g=this.map.parentMap?this.map.parentMap.name:null,h=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(d.normalize&&(e=d.normalize(e,function(a){return c(a,g,!0)})||""),d=n(a.prefix+"!"+e,this.map.parentMap),s(d,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),
e=l(p,d.id)){this.depMaps.push(d);if(this.events.error)e.on("error",u(this,function(a){this.emit("error",a)}));e.enable()}}else m=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),m.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];F(p,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&x(a.map.id)});v(a)}),m.fromText=u(this,function(d,c){var e=a.name,g=n(e),B=O;c&&(d=c);B&&(O=!1);q(g);t(k.config,b)&&(k.config[e]=k.config[b]);try{j.exec(d)}catch(ca){return v(A("fromtexteval",
"fromText eval for "+b+" failed: "+ca,ca,[b]))}B&&(O=!0);this.depMaps.push(g);i.completeLoad(e);h([e],m)}),d.load(a.name,h,m,k)}));i.enable(e,this);this.pluginMaps[e.id]=e},enable:function(){T[this.map.id]=this;this.enabling=this.enabled=!0;y(this.depMaps,u(this,function(a,b){var c,d;if("string"===typeof a){a=n(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=l(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",u(this,function(a){this.defineDep(b,
a);this.check()}));this.errback&&s(a,"error",u(this,this.errback))}c=a.id;d=p[c];!t(N,c)&&(d&&!d.enabled)&&i.enable(a,this)}));F(this.pluginMaps,u(this,function(a){var b=l(p,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){y(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:k,contextName:b,registry:p,defined:r,urlFetched:S,defQueue:G,Module:X,makeModuleMap:n,
nextTick:j.nextTick,onError:v,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=k.pkgs,c=k.shim,d={paths:!0,config:!0,map:!0};F(a,function(a,b){d[b]?"map"===b?(k.map||(k.map={}),Q(k[b],a,!0,!0)):Q(k[b],a,!0):k[b]=a});a.shim&&(F(a.shim,function(a,b){I(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);c[b]=a}),k.shim=c);a.packages&&(y(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,
location:a.location||a.name,main:(a.main||"main").replace(ja,"").replace(ea,"")}}),k.pkgs=b);F(p,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=n(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(Z,arguments));return b||a.exports&&ba(a.exports)}},makeRequire:function(a,f){function h(d,c,e){var g,k;f.enableBuildCallback&&(c&&H(c))&&(c.__requireJsBuild=!0);if("string"===typeof d){if(H(c))return v(A("requireargs",
"Invalid require call"),e);if(a&&t(N,d))return N[d](p[a.id]);if(j.get)return j.get(i,d,a,h);g=n(d,a,!1,!0);g=g.id;return!t(r,g)?v(A("notloaded",'Module name "'+g+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[g]}K();i.nextTick(function(){K();k=q(n(null,a));k.skipMap=f.skipMap;k.init(d,c,e,{enabled:!0});C()});return h}f=f||{};Q(h,{isBrowser:z,toUrl:function(b){var f,e=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==e&&(!("."===g||".."===g)||1<e))f=b.substring(e,b.length),b=
b.substring(0,e);return i.nameToUrl(c(b,a&&a.id,!0),f,!0)},defined:function(b){return t(r,n(b,a,!1,!0).id)},specified:function(b){b=n(b,a,!1,!0).id;return t(r,b)||t(p,b)}});a||(h.undef=function(b){w();var c=n(b,a,!0),f=l(p,b);e(b);delete r[b];delete S[c.url];delete Y[b];f&&(f.events.defined&&(Y[b]=f.events),x(b))});return h},enable:function(a){l(p,a.id)&&q(a).enable()},completeLoad:function(a){var b,c,d=l(k.shim,a)||{},e=d.exports;for(w();G.length;){c=G.shift();if(null===c[0]){c[0]=a;if(b)break;b=
!0}else c[0]===a&&(b=!0);D(c)}c=l(p,a);if(!b&&!t(r,a)&&c&&!c.inited){if(k.enforceDefine&&(!e||!ba(e)))return h(a)?void 0:v(A("nodefine","No define call for "+a,null,[a]));D([a,d.deps||[],d.exportsFn])}C()},nameToUrl:function(a,b,c){var d,e,h,g,i,n;if(j.jsExtRegExp.test(a))g=a+(b||"");else{d=k.paths;e=k.pkgs;g=a.split("/");for(i=g.length;0<i;i-=1)if(n=g.slice(0,i).join("/"),h=l(e,n),n=l(d,n)){I(n)&&(n=n[0]);g.splice(0,i,n);break}else if(h){a=a===h.name?h.location+"/"+h.main:h.location;g.splice(0,i,
a);break}g=g.join("/");g+=b||(/^data\:|\?/.test(g)||c?"":".js");g=("/"===g.charAt(0)||g.match(/^[\w\+\.\-]+:/)?"":k.baseUrl)+g}return k.urlArgs?g+((-1===g.indexOf("?")?"?":"&")+k.urlArgs):g},load:function(a,b){j.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ka.test((a.currentTarget||a.srcElement).readyState))P=null,a=J(a),i.completeLoad(a.id)},onScriptError:function(a){var b=J(a);if(!h(b.id))return v(A("scripterror","Script error for: "+b.id,
a,[b.id]))}};i.require=i.makeRequire();return i}var j,w,x,C,J,D,P,K,q,fa,la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ma=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ea=/\.js$/,ja=/^\.\//;w=Object.prototype;var L=w.toString,ga=w.hasOwnProperty,ia=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),da=!z&&"undefined"!==typeof importScripts,ka=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,W="undefined"!==typeof opera&&
"[object Opera]"===opera.toString(),E={},s={},R=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(H(requirejs))return;s=requirejs;requirejs=void 0}"undefined"!==typeof require&&!H(require)&&(s=require,require=void 0);j=requirejs=function(b,c,e,h){var q,n="_";!I(b)&&"string"!==typeof b&&(q=b,I(c)?(b=c,c=e,e=h):b=[]);q&&q.context&&(n=q.context);(h=l(E,n))||(h=E[n]=j.s.newContext(n));q&&h.configure(q);return h.require(b,c,e)};j.config=function(b){return j(b)};j.nextTick="undefined"!==
typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=j);j.version="2.1.9";j.jsExtRegExp=/^\/|:|\?|\.js$/;j.isBrowser=z;w=j.s={contexts:E,newContext:ha};j({});y(["toUrl","undef","defined","specified"],function(b){j[b]=function(){var c=E._;return c.require[b].apply(c,arguments)}});if(z&&(x=w.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0]))x=w.head=C.parentNode;j.onError=aa;j.createNode=function(b){var c=b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml",
"html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};j.load=function(b,c,e){var h=b&&b.config||{};if(z)return h=j.createNode(h,c,e),h.setAttribute("data-requirecontext",b.contextName),h.setAttribute("data-requiremodule",c),h.attachEvent&&!(h.attachEvent.toString&&0>h.attachEvent.toString().indexOf("[native code"))&&!W?(O=!0,h.attachEvent("onreadystatechange",b.onScriptLoad)):(h.addEventListener("load",b.onScriptLoad,!1),h.addEventListener("error",
b.onScriptError,!1)),h.src=e,K=h,C?x.insertBefore(h,C):x.appendChild(h),K=null,h;if(da)try{importScripts(e),b.completeLoad(c)}catch(l){b.onError(A("importscripts","importScripts failed for "+c+" at "+e,l,[c]))}};z&&!s.skipDataMain&&M(document.getElementsByTagName("script"),function(b){x||(x=b.parentNode);if(J=b.getAttribute("data-main"))return q=J,s.baseUrl||(D=q.split("/"),q=D.pop(),fa=D.length?D.join("/")+"/":"./",s.baseUrl=fa),q=q.replace(ea,""),j.jsExtRegExp.test(q)&&(q=J),s.deps=s.deps?s.deps.concat(q):
[q],!0});define=function(b,c,e){var h,j;"string"!==typeof b&&(e=c,c=b,b=null);I(c)||(e=c,c=null);!c&&H(e)&&(c=[],e.length&&(e.toString().replace(la,"").replace(ma,function(b,e){c.push(e)}),c=(1===e.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(h=K))P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),h=P;h&&(b||(b=h.getAttribute("data-requiremodule")),j=E[h.getAttribute("data-requirecontext")])}(j?
j.defQueue:R).push([b,c,e])};define.amd={jQuery:!0};j.exec=function(b){return eval(b)};j(s)}})(this);

438
external/skrollr/test/tests.js vendored Normal file
View File

@ -0,0 +1,438 @@
$(window).on('load', function() {
//Initialize skrollr and save the instance.
var s = skrollr.init({
edgeStrategy: 'set',
constants: {
myconst: 300,
my500: function() {
return 500;
}
},
easing: {
half1: function() {
return 0.5
}
}
});
//Counts how many assertions will be needed for the tests.
var countAssertions = function(tests) {
var counter = 0;
for(var i = 0; i < tests.length; i++) {
var curTest = tests[i];
if(curTest.styles) {
$.each(curTest.styles, function() {
counter++;
});
}
if(curTest.attributes) {
$.each(curTest.attributes, function() {
counter++;
});
}
counter += !!curTest.selector;
}
return counter;
};
//A meta-test which runs common tests
//which need synchronization of scrolling and rendering.
var scrollTests = function(offset, tests) {
module('at scroll position ' + offset);
asyncTest('rendering', function() {
//We can't run them in parallel,
//because they would interfere with each others scroll top offset.
stop();
expect(countAssertions(tests));
//Scroll to offset, which will cause rendering (sooner or later)
s.setScrollTop(offset, true);
s.on('render', function(info) {
//Prevent another render event. Only need one for test.
s.off('render');
for(var i = 0; i < tests.length; i++) {
var curTest = tests[i];
if(curTest.styles) {
$.each(curTest.styles, function(k) {
QUnit.numericCSSPropertyEquals(curTest.element.css(k), curTest.styles[k], curTest.message || 'element\'s (#' + curTest.element[0].id + ') "' + k + '" CSS property is correct');
});
}
if(curTest.attributes) {
$.each(curTest.attributes, function(k, value) {
console.log(curTest.element.prop(k));
QUnit.numericCSSPropertyEquals(curTest.element.attr(k), curTest.attributes[k], curTest.message || 'element\'s (#' + curTest.element[0].id + ') "' + k + '" attribute is correct');
});
}
if(curTest.selector) {
ok(curTest.element.is(curTest.selector), 'element matches "' + curTest.selector + '"');
}
}
start(2);
});
});
};
//
// Now the actual tests.
//
//Add one element dynamically
var newElement = $('<div id="dynamic" data-0="bottom:0px;" data-250="bottom:100px;">TEST</div>').appendTo('body');
s.refresh(newElement[0]);
module('basic stuff');
test('CSS classes present', function() {
strictEqual($('.skrollable').length, 23, 'All elements have the .skrollable class');
ok($('html').is('.skrollr'), 'HTML element has skrollr class');
ok($('html').is(':not(.no-skrollr)'), 'HTML element does not have no-skrollr class');
});
scrollTests(500, [
{
message: 'colons inside urls are preserved (#73)',
element: $('#colon-url'),
styles: {
backgroundImage: 'url(https://secure.travis-ci.org/Prinzhorn/skrollr.png)'
}
},
{
message: 'a single period is no number (#74)',
element: $('#period-number'),
styles: {
backgroundImage: 'url(https://secure.travis-ci.org/Prinzhorn/skrollr.png?1337)'
}
},
{
element: $('#simple-numeric'),
styles: {
left: '100px',
top: '50px'
}
},
{
element: $('#easing'),
styles: {
left: '25px'
}
},
{
element: $('#compound-numeric'),
styles: {
marginTop: '30px',
marginRight: '20px',
marginBottom: '10px',
marginLeft: '0px'
}
},
{
element: $('#rgb-color'),
styles: {
color: 'rgb(50, 100, 150)'
}
},
{
element: $('#rgba-color'),
styles: {
color: 'rgba(50, 100, 150, 0.5)'
}
},
{
element: $('#hsl-color'),
styles: {
color: 'rgb(191, 63, 63)'
}
},
{
element: $('#no-interpolation'),
styles: {
right: '100px'
}
},
{
element: $('#anchor-2'),
styles: {
right: '200px'
}
},
{
element: $('#foreign-anchor'),
styles: {
paddingTop: '100px',
paddingRight: '100px',
paddingBottom: '100px',
paddingLeft: '100px'
}
},
{
element: $('#float'),
styles: {
float: 'left'
}
},
{
message: 'z-index "auto" is no converted to a number (#351)',
element: $('#auto-z-index'),
styles: {
zIndex: 'auto'
}
},
{
message: 'attribute interpolation',
element: $('#attr'),
attributes: {
title: '0'
}
}
]);
scrollTests(0, [
{
element: $('#simple-numeric'),
styles: {
left: '-100px',
top: '0px'
}
},
{
element: $('#easing'),
styles: {
left: '25px'
}
},
{
element: $('#compound-numeric'),
styles: {
marginTop: '0px',
marginRight: '10px',
marginBottom: '20px',
marginLeft: '30px'
}
},
{
element: $('#rgb-color'),
styles: {
color: 'rgb(0, 0, 0)'
}
},
{
element: $('#rgba-color'),
styles: {
color: 'rgba(0, 0, 0, 0.2)'
}
},
{
element: $('#hsl-color'),
styles: {
color: 'rgb(0, 0, 0)'
}
},
{
element: $('#no-interpolation'),
styles: {
right: '0px'
}
},
{
element: $('#end'),
styles: {
fontSize: '10px'
}
},
{
element: newElement,
styles: {
bottom: '0px'
}
},
{
element: $('#float'),
styles: {
float: 'none'
}
},
{
message: 'z-index "auto" is no converted to a number (#351)',
element: $('#auto-z-index'),
styles: {
zIndex: '1'
}
},
{
message: 'attribute interpolation',
element: $('#attr'),
attributes: {
title: '500',
'data-test': 'skrollr'
}
}
]);
scrollTests(250, [
{
element: $('#simple-numeric'),
styles: {
left: '0px',
top: '25px'
}
},
{
element: $('#easing'),
styles: {
left: '25px'
}
},
{
element: $('#compound-numeric'),
styles: {
marginTop: '15px',
marginRight: '15px',
marginBottom: '15px',
marginLeft: '15px'
}
},
{
element: $('#rgb-color'),
styles: {
color: 'rgb(25, 50, 75)'
}
},
{
element: $('#rgba-color'),
styles: {
color: 'rgba(25, 50, 75, 0.35)'
}
},
{
element: $('#hsl-color'),
styles: {
color: 'rgb(79, 47, 47)'
}
},
{
element: $('#no-interpolation'),
styles: {
right: '0px'
}
},
{
element: $('#anchor-2'),
styles: {
right: '100px'
}
},
{
element: newElement,
styles: {
bottom: '100px'
}
},
{
element: $('#foreign-anchor'),
styles: {
paddingTop: '150px',
paddingRight: '150px',
paddingBottom: '150px',
paddingLeft: '150px'
}
},
{
element: $('#float'),
styles: {
float: 'none'
}
},
{
message: 'attribute interpolation',
element: $('#attr'),
attributes: {
title: '250',
'data-test': 'skrollr'
}
}
]);
//bottom-top + 50%
scrollTests(150, [
{
element: $('#relative-percentage-offset'),
styles: {
left: '250px'
}
}
]);
//200%
scrollTests(600, [
{
element: $('#percentage-offset'),
styles: {
left: '500px'
}
},
{
message: 'attribute interpolation',
element: $('#attr'),
attributes: {
'data-test': 'skrollr-test'
}
}
]);
//100%
scrollTests(300, [
{
element: $('#percentage-offset'),
styles: {
left: '250px'
}
}
]);
//We scroll to a ridiculous large position so that the browser cuts it at the actual position.
var maxScrollHeight = s.setScrollTop(1e5) && s.getScrollTop();
scrollTests(maxScrollHeight, [
{
element: $('#anchor-1'),
styles: {
right: '100px'
}
},
{
element: $('#easing'),
styles: {
left: '50px'
}
},
{
element: $('#easing_with_easing_strategy'),
styles: {
left: '25px'
}
},
{
element: $('#reset-strategy'),
styles: {
left: '1337px'
}
}
]);
});//DOM ready