omnomirc.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. OmnomIRC COPYRIGHT 2010,2011 Netham45
  3. OmnomIRC3 rewrite COPYRIGHT 2013 Nathaniel 'Eeems' van Diepen
  4. This file is part of OmnomIRC.
  5. OmnomIRC is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. OmnomIRC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with OmnomIRC. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. (function(window,$,undefined){
  17. var $o = window.OmnomIRC = window.$o = function(){
  18. return 'Version: '+$o.version
  19. },$i,log=console.log;
  20. $.extend($o,{
  21. version: '0.1',
  22. send: function(msg){
  23. if(msg !== ''){
  24. $o.event('send',msg);
  25. }
  26. },
  27. event: function(event_name,message){
  28. switch(event_name){
  29. case 'ready':
  30. log('[DOCUMENT_READY]');
  31. break;
  32. default:
  33. log('['+event_name.toUpperCase()+'] '+message);
  34. }
  35. }
  36. });
  37. $(document).ready(function(){
  38. $i = $('#input');
  39. $('#send').click(function(){
  40. $o.send($i.val());
  41. $i.val('');
  42. });
  43. $i.keypress(function(e){
  44. if(e.keyCode == 13){
  45. $o.send($i.val());
  46. $i.val('');
  47. }
  48. });
  49. $o.event('ready');
  50. });
  51. })(window,jQuery);