Skip to content

Commit

Permalink
Include configuration for eager.io.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisma committed Mar 6, 2016
1 parent ac97860 commit 577a044
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
39 changes: 39 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
This file is, together with install.json, the configuration for eager.io,
which allows testing the library on webpages.
It is not necessary for running birdman.js
*/
(function(){
// First of all, let's load jQuery
if(typeof(jQuery) == 'undefined') {
window.jQuery = 'loading';
var jq = document.createElement('script');
jq.type = 'text/javascript';
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js';
jq.onload = function() {
// JQuery is loaded...
console.log('jQuery ' + jQuery.fn.jquery + ' loaded successfully.');
// Now load the actual script (which requires $)
$.getScript('https://cdn.rawgit.com/chrisma/birdman.js/v1.0.0/birdman.js')
.done(function( script, textStatus ) {
console.log('Birdman.js loaded successfully.');
console.log(INSTALL_OPTIONS.advanced);
$(INSTALL_OPTIONS.location).birdman({
'delay': parseInt(INSTALL_OPTIONS.advanced.delay),
'speedUp': INSTALL_OPTIONS.speedUp
});
})
};
jq.onerror = function () {
delete jQuery;
console.error('Error while loading jQuery!');
};
document.getElementsByTagName('head')[0].appendChild(jq);
} else {
if (typeof (jQuery) == 'function') {
console.log('jQuery (' + jQuery.fn.jquery + ') is already loaded!');
} else {
console.log('jQuery is already loading...');
}
}
})();
51 changes: 51 additions & 0 deletions install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"resources": {
"body": [
{
"type": "script",
"src": "install.js"
}
]
},
"options": {
"properties": {
"location": {
"order": 1,
"title": "Location",
"type": "string",
"format": "selector",
"description": "Select the text that you would like to animate birdman-style."
},
"advanced":{
"order": 10,
"title": "Optional parameters",
"type": "object",
"properties": {
"delay": {
"order": 11,
"title": "Animation speed",
"type": "string",
"description": "The speed at which letters are shown.",
"enum": [
"150",
"300",
"600"
],
"enumNames": {
"150": "fast",
"300": "normal",
"600": "slow"
},
"default": "300"
},
"speedUp": {
"order": 12,
"title": "Speed up",
"description": "Whether the animation should become faster towards the end.",
"type": "boolean"
}
}
}
}
}
}

0 comments on commit 577a044

Please sign in to comment.