forked from seajs/examples
-
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.
Update Sea.js to 2.1.0 and make all examples runnable
- Loading branch information
1 parent
c0d2d73
commit 0da53e6
Showing
92 changed files
with
16,134 additions
and
4,006 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
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 |
---|---|---|
@@ -1,8 +1,25 @@ | ||
Examples for SeaJS | ||
=== | ||
# Examples for Sea.js | ||
|
||
<http://seajs.github.com/examples> | ||
<http://seajs.github.io/examples> | ||
|
||
__注意__ | ||
|
||
如果你想构建示例,需要使用 [Gruntjs](http://gruntjs.com/) 与 [spm](https://github.com/spmjs/spm/wiki)。 | ||
How to Build | ||
------------ | ||
|
||
First, you should install `spm` and `spm-build`: | ||
|
||
``` | ||
$ npm install spm -g | ||
$ npm install spm-build -g | ||
``` | ||
|
||
Then, build it: | ||
|
||
``` | ||
$ cd static/hello | ||
$ make build | ||
$ make deploy | ||
``` | ||
|
||
Visit <http://docs.spmjs.org/> for detail information. | ||
|
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
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,41 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Lucky Ball</title> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="../static/lucky/src/style.css"> | ||
</head> | ||
<body> | ||
<button id="go" data-text-start="Space to Start" data-text-stop="Space to Stop" data-action="start"></button> | ||
|
||
<div id="container"> | ||
<ul id="balls"> | ||
</ul> | ||
<ul id="lucky-balls"> | ||
</ul> | ||
</div> | ||
|
||
<script src="../sea-modules/seajs/seajs/2.1.0/sea.js"></script> | ||
<script> | ||
|
||
// Set configuration | ||
seajs.config({ | ||
base: "../sea-modules/", | ||
alias: { | ||
"jquery": "jquery/jquery/1.10.1/jquery.js", | ||
"jquery-easing": "jquery/easing/1.3.0/easing.js" | ||
} | ||
}); | ||
|
||
// For development | ||
if (location.href.indexOf("?dev") > 0) { | ||
seajs.use("../static/lucky/src/main"); | ||
} | ||
// For production | ||
else { | ||
seajs.use("examples/lucky/1.0.0/main"); | ||
} | ||
</script> | ||
|
||
</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
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
This file was deleted.
Oops, something went wrong.
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,54 @@ | ||
define("examples/hello/1.0.0/main-debug", [ "./spinning-debug", "jquery-debug" ], function(require) { | ||
var Spinning = require("./spinning-debug"); | ||
var s = new Spinning("#container"); | ||
s.render(); | ||
}); | ||
|
||
define("examples/hello/1.0.0/spinning-debug", [ "jquery-debug" ], function(require, exports, module) { | ||
var $ = require("jquery-debug"); | ||
function Spinning(container) { | ||
this.container = $(container); | ||
this.icons = this.container.children(); | ||
this.spinnings = []; | ||
} | ||
module.exports = Spinning; | ||
Spinning.prototype.render = function() { | ||
this._init(); | ||
this.container.css("background", "none"); | ||
this.icons.show(); | ||
this._spin(); | ||
}; | ||
Spinning.prototype._init = function() { | ||
var spinnings = this.spinnings; | ||
$(this.icons).each(function(n) { | ||
var startDeg = random(360); | ||
var node = $(this); | ||
var timer; | ||
node.css({ | ||
top: random(40), | ||
left: n * 50 + random(10), | ||
zIndex: 1e3 | ||
}).hover(function() { | ||
node.fadeTo(250, 1).css("zIndex", 1001).css("transform", "rotate(0deg)"); | ||
}, function() { | ||
node.fadeTo(250, .6).css("zIndex", 1e3); | ||
timer && clearTimeout(timer); | ||
timer = setTimeout(spin, Math.ceil(random(1e4))); | ||
}); | ||
function spin() { | ||
node.css("transform", "rotate(" + startDeg + "deg)"); | ||
} | ||
spinnings[n] = spin; | ||
}); | ||
return this; | ||
}; | ||
Spinning.prototype._spin = function() { | ||
$(this.spinnings).each(function(i, fn) { | ||
setTimeout(fn, Math.ceil(random(3e3))); | ||
}); | ||
return this; | ||
}; | ||
function random(x) { | ||
return Math.random() * x; | ||
} | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,36 @@ | ||
/*! define examples/hello/1.0.0/style-debug.css */ | ||
html, body, div, span, h1, h2, h3, h4, p, img, strong, ol, ul, li { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
vertical-align: baseline; | ||
background: transparent; | ||
} | ||
|
||
body { | ||
background: #F4F4F4; | ||
} | ||
|
||
#container { | ||
position: relative; | ||
margin: 40px 120px; | ||
background: url(https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif) no-repeat; | ||
min-height: 32px; | ||
} | ||
|
||
#container img { | ||
position: absolute; | ||
cursor: pointer; | ||
opacity: .6; | ||
display: none; | ||
|
||
-webkit-transition-property: -webkit-transform; | ||
-moz-transition-property: -moz-transform; | ||
-o-transition-property: -o-transform; | ||
transition-property: transform; | ||
-webkit-transition-duration: 0.8s; | ||
-moz-transition-duration: 0.8s; | ||
-o-transition-duration: 0.8s; | ||
transition-duration: 0.8s; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.