UNPKG

website-archana

Version:

This is small website with html,js,css

58 lines (53 loc) 1.6 kB
//(function(win, doc, $){ (function(){ var chatModule = (function() { var _leadself = 'Me: ', _leadcomputer = "PC: ", _aSaid = ["This is a Cyber Chat"], _msgYes = "Yes, that's a great idea.", _msgNo = "No, that must be a mistake.", _aSassyStuff = ["Like mold on books, grow myths on history.", "She moved like a poem and smiled like a sphinx.", "As long as we don’t die, this is gonna be one hell of a story.", "She laughed, and the desert sang.", "You’ve got about as much charm as a dead slug."]; function _talk(msg){ _echo(_leadself + msg); } function _replyYesNo() { var msg = Math.random() > 0.5 ? _msgYes : _msgNo; _echo(_leadcomputer + msg); } function _saySassyStuff() { var msg = _aSassyStuff[Math.floor(Math.random() * _aSassyStuff.length)]; _echo(_leadcomputer + msg); } function _echo(msg) { _aSaid.push("<div>"+msg+"</div>"); var aSaidLength = _aSaid.length, start = Math.max(aSaidLength - 6, 0), out = ""; for(var i=start; i<aSaidLength; i++) { out += _aSaid[i]; } $(".advert").html(out); $("#talk span").text(msg); } return { talk : _talk, replyYesNo : _replyYesNo, saySassyStuff : _saySassyStuff }; })(); $(document).ready(function(){ chatModule.talk("This is much better..."); chatModule.replyYesNo(); chatModule.saySassyStuff(); chatModule.saySassyStuff(); }); //if(!win.chatModule) win.chatModule = chatModule; })();//(window, document, jQuery);