Command=defineClass({name:"Command",construct:function(a,c){this.command=a;this.attributes=c;this.save_to_history()},methods:{execute:function(){Command.POSITION_IN_HISTORY=-1;with(this){if(typeof Command.commands[command]=="function"){result=Command.commands[command](attributes);return result}else{return command+lang.undefined_command}}},save_to_history:function(){command_string=this.command;if(this.attributes.length!=0){command_string+=" "+this.attributes.join(" ")}if(command_string!=Command.HISTORY[0]){Command.HISTORY.unshift(command_string)}}},statics:{find_previous:function(){Command.POSITION_IN_HISTORY=Command.POSITION_IN_HISTORY+1;if(Command.HISTORY[Command.POSITION_IN_HISTORY]){return Command.HISTORY[Command.POSITION_IN_HISTORY]}else{Command.POSITION_IN_HISTORY=Command.POSITION_IN_HISTORY-1;return Command.HISTORY[Command.POSITION_IN_HISTORY]}},find_next:function(){Command.POSITION_IN_HISTORY=Command.POSITION_IN_HISTORY-1;if(Command.HISTORY[Command.POSITION_IN_HISTORY]){return Command.HISTORY[Command.POSITION_IN_HISTORY]}else{Command.POSITION_IN_HISTORY=Command.POSITION_IN_HISTORY+1;return Command.HISTORY[Command.POSITION_IN_HISTORY]}}}});Command.HISTORY=[];Command.POSITION_IN_HISTORY=-1;Command.commands={help:function(a){return lang.help},portfolio:function(a){return lang.portfolio},about:function(a){return lang.about},clear:function(a){out.innerHTML="";return""},lang:function(a){lang=new Language(a[0]);document.getElementById('intro').innerHTML=lang.intro;return lang.language_changed},egg:function(a){return lang.egg}};Console=defineClass({name:"Console",construct:function(a){this.keycode=a;this.input_string=input.value;this.map();this.scroll_page()},methods:{process_input:function(){this.show_input();if(this.input_string==""){return true}var a=this.input_string.split(" ");var c=a.shift();var g=a;var c=new Command(c,g);this.result=c.execute();this.show_result();setTimeout(function(){input.value=""},0)},map:function(){switch(this.keycode){case 13:this.process_input();break;case 38:input.value=Command.find_previous();break;case 40:input.value=Command.find_next();break;case 9:this.autocomplete();break}},show_input:function(){var a=document.createElement('div');a.setAttribute("class","input-row");var c=document.createElement('span');c.setAttribute("class","output-welcome");var g=document.getElementById("input-welcome");var h=document.createTextNode(g.firstChild.nodeValue+" ");var k=document.createTextNode(this.input_string);out.appendChild(a);a.appendChild(c);c.appendChild(h);a.appendChild(k)},show_result:function(){var a=document.createElement('div');a.setAttribute("class","output-row");out.appendChild(a);a.innerHTML=this.result},autocomplete:function(){var a=new RegExp('^'+this.input_string);for(var c in Command.commands){if(c.match(a)!=null){input.value=c;break}}setTimeout(function(){input.focus()},0)},scroll_page:function(){var a=this._get_scroll_height()+this._get_window_height();window.scroll(0,a)},_get_window_height:function(){height=0;if(typeof(window.innerWidth)=='number'){height=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){height=document.documentElement.clientHeight}return height},_get_scroll_height:function(){var a=0;if(typeof(window.pageYOffset)=='number'){a=window.pageYOffset}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){a=document.body.scrollTop}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){a=document.documentElement.scrollTop}return a}}});function defineClass(a){var c=a.name;var g=a.extend||Object;var h=a.construct||function(){};var k=a.methods||{};var l=a.statics||{};var i;var j;if(!a.borrows)i=[];else if(a.borrows instanceof Array)i=a.borrows;else i=[a.borrows];if(!a.provides)j=[];else if(a.provides instanceof Array)j=a.provides;else j=[a.provides];var d=new g();for(var b in d)if(d.hasOwnProperty(b))delete d[b];for(var f=0;f<i.length;f++){var e=a.borrows[f];i[f]=e;for(var b in e.prototype){if(typeof e.prototype[b]!="function")continue;d[b]=e.prototype[b]}}for(var b in k)d[b]=k[b];d.constructor=h;d.superclass=g;if(c)d.classname=c;for(var f=0;f<j.length;f++){var e=j[f];for(var b in e.prototype){if(typeof e.prototype[b]!="function")continue;if(b=="constructor"||b=="superclass")continue;if(b in d&&typeof d[b]=="function"&&d[b].length==e.prototype[b].length)continue;throw new Error("Class "+c+" does not provide method "+e.classname+"."+b);}}h.prototype=d;for(var b in l)h[b]=a.statics[b];return h}window.onload=function(){input=document.getElementById('input');out=document.getElementById('output');var c=document.getElementById('input-form');input.focus();lang=new Language('en');c.onsubmit=function(){return false};input.onkeydown=function(a){if(!a){var a=window.event};new Console(a.keyCode)}};function Language(a){switch(a){case'ru':return new Russian();break;case'en':return new English();break}}function English(){this.help="You can use these commands: <br /><strong>help</strong> - what you are reading now,<br /><strong>portfolio</strong> - a list of my projects,<br /><strong>about</strong> - read about me and my skills.<br /><strong>clear</strong> - clear the screen.<br /><strong>lang</strong> - change language. You can use it with <em>'en'</em> or <em>'ru'</em>  - <strong>lang en</strong> or <strong>lang ru</strong>.<br />You can use 'up' and 'down' arrow keys to navigate through commands history<br />and Tab for autocompleting of commands.";this.portfolio="<h3>My projects:</h3><div class='project'>  <a href='http://www.astrology.com'>    <img src='images/astrology.png' alt='astrology.com' title='Popular astrology site' />  </a>  <p><a href='http://www.astrology.com'>astrology.com</a></p>  <p>    Astrology.com is the Internet's most popular astrology destination.<br />    Thousands of content pages, over 100 personalized free and paid readings, etc, etc.  </p>  <p>Written on Ruby on Rails.</p></div><div class='project'>  <p>    Some open-source extensions for the RadiantCMS:<br />    <em><a href='http://github.com/astashov/page_versioning'>page_versioning</a></em> - for versioining pages, snippets and layouts. So, you can rollback to any changes you did before.<br />    <em><a href='http://github.com/astashov/radiant-route-handler-extension'>route_handler</a></em> - adds dynamical parameters to routes<br />    <em><a href='http://github.com/astashov/radiant-webservices-extension'>webservices</a></em> - adds tags for making remote requests to webservices<br />    And many others (whole list you can see <a href='http://github.com/astashov'>on the github</a>).  </p></div><div class='project'>  <a href='images/vim_ruby_debugger.png'>   <img src='images/vim_ruby_debugger_small.png' alt='Vim Ruby Debugger Screenshot' title='Vim Ruby Debugger' />  </a>  <p><a href='http://github.com/astashov/vim-ruby-debugger'>Vim Ruby Debugger</a></p>  <p>    Open Source Vim plugin that implements interactive Ruby Debugger. You can set <br />    breakpoints, navigate through the code, see variables - like in serious IDE.  </p>  <p>    Written on Ruby + VimL  </p></div><div class='project'>  <a href='http://www.sibcactus.ru'>    <img src='images/sibcactus.jpeg' alt='sibcactus.ru' title='Photogallery of cactuses' />  </a>  <p><a href='http://www.sibcactus.ru'>sibcactus.ru</a></p>  <p>    This is photogallery of big private collection of cactuses.<br />You can look at the beautiful     cactuses, or buy it.  </p>  <p>The gallery is built on PHP/Zend Framework.</p></div><div class='project'>  <a href='http://www.sibargo.ru/en'>    <img src='images/sibargo.png' alt='sibargo.ru' title='Site of travel company' />  </a>  <p><a href='http://www.sibargo.ru/en'>sibargo.ru</a></p>  <p>    This site advertises travel company, it proposes guided tours by sailed or<br />    motor catamarans throught Enisey river.<br />  </p>  <p>The site is built on Ruby on Rails, MySQL, JavaScript</p></div><div class='project'>  <a href='http://www.sportraadamsterdam.nl'>    <img src='images/sportraadamsterdam.png' alt='sportraadamsterdam.nl' title='Site of the Sports Council of Amsterdam' />  </a>  <p><a href='http://www.sportraadamsterdam.nl'>sportraadamsterdam.nl</a></p>  <p>    Site of The Sports Council of Amsterdam.<br />  </p>  <p>The site is built on Ruby on Rails, MySQL, JavaScript</p></div>";this.about="<h3>About me</h3><div class='about'><p>I am Ruby on Rails developer.<br />I write quality, good and test-covered code, and use <a href='http://en.wikipedia.org/wiki/Test-driven_development'>TDD</a><br />everywhere I can. If you ask me about my skills, I will answer this way:<br /><em>Ruby</em>, <em>Ruby on Rails</em>, <em>RSpec</em>, <em>(x)HTML</em>, <em>CSS</em>, <em>JavaScript</em>,<br /><em>jQuery</em>, <em>SQLite</em>, <em>Memcached</em>, <em>MySQL</em> and maybe some more.<br /></p><p>So, if you are looking for Ruby-programmer, maybe I'm exactly that man you are looking for.<br />Please, write to anton/at/astashov.net, where /at/ is '@', and we'll discuss our collaboration!</p></div>";this.language_changed="Language was changed";this.undefined_command=" is undefined command. Look at help (<strong>help</strong> command)";this.intro="<h1>Welcome to Astashov.net - a portfolio page of Astashov Anton</h1><p>This is a place where you can read about me and look at my projects.<br />An interface behaves similar to unix-shell, you type commands and results are shown on this page.</p><p>Type <strong>help</strong> for a list of commands.</p><p>You can choose <em>'en'</em> or <em>'ru'</em> language.<br />Just type <strong>lang en</strong> or <strong>lang ru</strong> and language will be changed.</p>";this.egg="Hey, thank you for reading my code. If you have some critics or wishes about my code,<br />you can write them to me. It would be great! :)"}function Russian(){this.help="Вы можете использовать следующие команды: <br /><strong>help</strong> - вы сейчас это читаете,<br /><strong>portfolio</strong> - список моих проектов,<br /><strong>about</strong> - прочитать обо мне и о моих навыках,<br /><strong>clear</strong> - очистка экрана,<br /><strong>lang</strong> - смена языка. Команду можно использовать с аттрибутами <em>'en'</em> или <em>'ru'</em>  - <strong>lang en</strong> или <strong>lang ru</strong>.<br />Для навигации по истории команд вы можете использовать клавиши курсора 'вверх' и 'вниз'<br />и клавишу &lt;Tab&gt; для автодополнения команд.";this.portfolio="<h3>Мои проекты:</h3><div class='project'>  <a href='http://www.astrology.com'>    <img src='images/astrology.png' alt='astrology.com' title='Популярный сайт, посвященный астрологии' />  </a>  <p><a href='http://www.astrology.com'>astrology.com</a></p>  <p>    Astrology.com - это один из самых популярных в Интернете сайтов, посвященных астрологии.<br />    Тысячи страниц контента, более 100 персонализированных платных и бесплатных горосков, и т.д. и т.п.  </p>  <p>Написан на Ruby on Rails.</p></div><div class='project'>  <p>    Несколько open-source extension'ов для RadiantCMS:<br />    <em><a href='http://github.com/astashov/page_versioning'>page_versioning</a></em> - Для версионирования данных (сохраняет все изменения Pages, Snippets и Layouts). Так, пользователь может вернуться к любому изменению, сделанному ранее.<br />    <em><a href='http://github.com/astashov/radiant-route-handler-extension'>route_handler</a></em> - позволяет добавляет динамические параметры к роутам. Их впоследствии можно использовать в тэгах<br />    <em><a href='http://github.com/astashov/radiant-webservices-extension'>webservices</a></em> - Добавляет тэги для осуществления удаленных запросов к веб сервисам<br />    И ещё множество других (весь список вы можете посмотреть <a href='http://github.com/astashov'>на github'e</a>).  </p></div><div class='project'>  <a href='images/vim_ruby_debugger.png'>   <img src='images/vim_ruby_debugger_small.png' alt='Скриншот отладчика Ruby под Vim' title='Ruby отладчик под Vim' />  </a>  <p><a href='http://github.com/astashov/vim-ruby-debugger'>Vim Ruby Debugger</a></p>  <p>    Ruby отладчик с открытым исходным кодом для редактора Vim. Можно ставить брейкпоинты, <br />    перемещаться по коду, смотреть состояние переменных - всё как в больших IDE.  </p>  <p>    Написан на Ruby + VimL  </p></div><div class='project'>  <a href='http://www.sibcactus.ru'>    <img src='images/sibcactus.jpeg' alt='sibcactus.ru' title='Фотогалерея кактусов' />  </a>  <p><a href='http://www.sibcactus.ru'>sibcactus.ru</a></p>  <p>    Это фотогалерея большой частной коллекции кактусов. <br />    На сайте можно посмотреть фотографии кактусов, а понравившиеся купить.  </p>  <p>Галерея написана на PHP/Zend Framework.</p></div><div class='project'>  <a href='http://www.sibargo.ru'>    <img src='images/sibargo.png' alt='sibargo.ru' title='Сайт туристической компании  </a>  <p><a href='http://www.sibargo.ru'>sibargo.ru</a></p>  <p>    Это сайт туристической компании, занимающейся организацией туров на парусных или <br />    моторных катамаранах по Енисею.<br />  </p>  <p>Написан на Ruby on Rails, MySQL, JavaScript</p></div><div class='project'>  <a href='http://www.sportraadamsterdam.nl'>    <img src='images/sportraadamsterdam.png' alt='sportraadamsterdam.nl' title='Сайт спорт-совета Амстердама' />  </a>  <p><a href='http://www.sportraadamsterdam.nl'>sportraadamsterdam.nl</a></p>  <p>    Сайт спорт-совета Амстердама<br />  </p>  <p>Написан на Ruby on Rails, MySQL, JavaScript</p></div>";this.about="<h3>Обо мне</h3><div class='about'><p>Я занимаюсь тем, что пишу всякие интересные проекты на Ruby on Rails.<br />Код получается хороший, качественный, тщательно покрытый тестами.<br />Активно применяю <a href='http://ru.wikipedia.org/wiki/Разработка_через_тестирование'>TDD</a>. Если составить список моих навыков и умений, <br />может получится вот такое:<br /><em>Ruby</em>, <em>Ruby on Rails</em>, <em>RSpec</em>, <em>(x)HTML</em>, <em>CSS</em>, <em>JavaScript</em>,<br /><em>jQuery</em>, <em>SQLite</em>, <em>MySQL</em>, <em>PHP</em>, ну и может ещё что-нибудь.<br /></p><p>Так что если вы ищете Ruby-программиста, возможно я именно тот, <br />кто вам нужен. Пишите на anton/at/astashov.net, где /at/ - это такая '@',<br />и мы с вами договоримся.</p></div>";this.language_changed="Язык изменён.";this.undefined_command=" - такой команды не существует. Обратитесь к помощи (команда <strong>help</strong>)";this.intro="<h1>Добро пожаловать на Astashov.net - страничку-портфолио Асташова Антона</h1><p>Здесь вы можете почитать обо мне и ознакомиться с моими проектами.<br />Интерфейс навигации по сайту похож на unix-shell, вы вводите команды, жмёте Enter<br />и видите результаты выполнения. Для получения списка команд наберите <stong>help</strong>.</p><p>Вы можете выбрать язык, <em>'en'</em> или <em>'ru'</em>.<br />Наберите <strong>lang en</strong> или <strong>lang ru</strong> для смены языка.</p>";this.egg="Большое спасибо за то, что почитали мой код. Если у вас есть какие-нибудь пожелания<br />или конструктивная критика по поводу кода, можете написать мне, это будет просто здорово!"}