| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- function pgsh() {
- this.prompt = '$'
- this.responses = {
- 'about': function() {
- return 'This website belongs to Weiyi Lou ' + new Date().getFullYear()
- },
- 'version': function() {
- return 'Parsley Gardens Shell (pgsh) 1.0.0'
- },
- 'git': function() {
- return 'Self-Hosted Code repository at <a target="_blank" href="https://code.parsleygardens.net">code.parsleygardens.net</a>'
- },
- 'hello': function() {
- return 'Hello to you too'
- },
- 'magic': function() {
- return 'Animation and Illustration at <a target="_blank" href="http://slightlymagic.com.au">slightlymagic.com.au</a>'
- },
- 'su': function() {
- this.Parent.prompt = '%'
- return 'With Great Power comes Great'
- },
- 'exit': function() {
- if (this.Parent.prompt == '%') {
- this.Parent.prompt = '$'
- return ''
- }
- return 'Close browser window to exit'
- },
- 'help': function() {
- var functions = [];
- for(var name in this.Parent.responses) {
- if (name !== 'Parent') {
- functions.push(name);
- }
- }
- functions.sort();
- return 'Available commands:\n' + functions.join(' ')
- }
- }
- this.process = function(input) {
- var output = ''
- if (input in this.responses) {
- this.responses.Parent = this
- output += this.responses[input]()
- }
- return output
- }
- }
- var pgsh = new pgsh()
|