Skip to content

Commit 577a044

Browse files
committed
Include configuration for eager.io.
1 parent ac97860 commit 577a044

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

install.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
This file is, together with install.json, the configuration for eager.io,
3+
which allows testing the library on webpages.
4+
It is not necessary for running birdman.js
5+
*/
6+
(function(){
7+
// First of all, let's load jQuery
8+
if(typeof(jQuery) == 'undefined') {
9+
window.jQuery = 'loading';
10+
var jq = document.createElement('script');
11+
jq.type = 'text/javascript';
12+
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js';
13+
jq.onload = function() {
14+
// JQuery is loaded...
15+
console.log('jQuery ' + jQuery.fn.jquery + ' loaded successfully.');
16+
// Now load the actual script (which requires $)
17+
$.getScript('https://cdn.rawgit.com/chrisma/birdman.js/v1.0.0/birdman.js')
18+
.done(function( script, textStatus ) {
19+
console.log('Birdman.js loaded successfully.');
20+
console.log(INSTALL_OPTIONS.advanced);
21+
$(INSTALL_OPTIONS.location).birdman({
22+
'delay': parseInt(INSTALL_OPTIONS.advanced.delay),
23+
'speedUp': INSTALL_OPTIONS.speedUp
24+
});
25+
})
26+
};
27+
jq.onerror = function () {
28+
delete jQuery;
29+
console.error('Error while loading jQuery!');
30+
};
31+
document.getElementsByTagName('head')[0].appendChild(jq);
32+
} else {
33+
if (typeof (jQuery) == 'function') {
34+
console.log('jQuery (' + jQuery.fn.jquery + ') is already loaded!');
35+
} else {
36+
console.log('jQuery is already loading...');
37+
}
38+
}
39+
})();

install.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"resources": {
3+
"body": [
4+
{
5+
"type": "script",
6+
"src": "install.js"
7+
}
8+
]
9+
},
10+
"options": {
11+
"properties": {
12+
"location": {
13+
"order": 1,
14+
"title": "Location",
15+
"type": "string",
16+
"format": "selector",
17+
"description": "Select the text that you would like to animate birdman-style."
18+
},
19+
"advanced":{
20+
"order": 10,
21+
"title": "Optional parameters",
22+
"type": "object",
23+
"properties": {
24+
"delay": {
25+
"order": 11,
26+
"title": "Animation speed",
27+
"type": "string",
28+
"description": "The speed at which letters are shown.",
29+
"enum": [
30+
"150",
31+
"300",
32+
"600"
33+
],
34+
"enumNames": {
35+
"150": "fast",
36+
"300": "normal",
37+
"600": "slow"
38+
},
39+
"default": "300"
40+
},
41+
"speedUp": {
42+
"order": 12,
43+
"title": "Speed up",
44+
"description": "Whether the animation should become faster towards the end.",
45+
"type": "boolean"
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)