Created
August 18, 2012 19:59
-
-
Save Tehnix/3389412 to your computer and use it in GitHub Desktop.
Example of usage of Terminal.js (https://github.com/Tehnix/Terminal.js)
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
$(document).ready(function() { | |
var githubDir = { | |
__name__: 'github', | |
Tehnix: { | |
__name__: 'Tehnix' | |
}, | |
ZealDev: { | |
__name__: 'ZealDev' | |
} | |
}; | |
// Fetch my repository information from github. The reason I call a local .php file instead of | |
// directly to the github API, is because AJAX calls are limited to your own domain. The php files basically just | |
// does a call to the API with curl... | |
$.get('/github-repos-Tehnix.php').done(function(data) { | |
data = $.parseJSON(data); | |
for (var i=0; i < data.length; i++) { | |
githubDir.Tehnix[data[i].name] = { | |
__name__: data[i].name, | |
link: { | |
__name__: 'link', | |
__type__: 'link', | |
__link__: data[i].html_url | |
}, | |
'Description.txt': { | |
__name__: 'Description.txt', | |
__type__: 'file', | |
__text__: data[i].description | |
} | |
} | |
} | |
}); | |
$.get('/github-repos-ZealDev.php').done(function(data) { | |
data = $.parseJSON(data); | |
for (var i=0; i < data.length; i++) { | |
githubDir.ZealDev[data[i].name] = { | |
__name__: data[i].name, | |
link: { | |
__name__: 'link', | |
__type__: 'link', | |
__link__: data[i].html_url | |
}, | |
'Description.txt': { | |
__name__: 'Description.txt', | |
__type__: 'file', | |
__text__: data[i].description | |
} | |
} | |
} | |
}); | |
// Instantiate the terminal plugin on the container with id terminal | |
$("#terminal").terminal({ | |
domain: 'zealdev.dk', | |
startText: 'Welcome! Take a look around, who knows, maybe you\'ll find something interesting :) !...', | |
filesystem: { | |
root: { | |
__name__: '/', | |
home: { | |
__name__: 'home', | |
www: { | |
__name__: 'www', | |
github: githubDir, | |
'about.txt': { | |
__name__: 'about.txt', | |
__type__: 'file', | |
__text__: 'Hey there :) I see you\'ve manage to figure out how this operates. If you\'re interested in the plugin itself, it is hosted on github (or very soon will be) and you can check it out there...' | |
} | |
} | |
} | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment