Advertisement
Guest User

For Crax #2

a guest
Sep 17th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Go to JS Management and replace everything in ChatBox 2.0 with this:
  2.  
  3.  
  4. var avacweb_chat_config = {
  5.    version : '1-9-1',
  6.    new_chat_title : 'ChatBox 2.0',
  7.    stylesheet : 'http://chat.avacweb.net/avacweb_chat_2.css',
  8.    allow_private_messaging : 1,
  9.    allow_user_resize : 0,
  10.    allow_appear_offline : 0,
  11.    commands : {
  12. brb: {
  13.     description: '/brb - Use this to tell everyone you will be right back.',
  14.     run: function(text) {
  15.         return '/me will be right back';
  16.     },
  17.     staff: false
  18. },
  19. kick: {
  20.  run: function(){
  21.   var staffID = [1, 4, 13, 18, 33, 27, 28, 170, 50, 223, 43, 241, 'tab'];
  22.   for(var i=0;i<staffID.length;i++){
  23.     if(staffID[i]===avacweb_chat.user_id) {
  24.      return true;
  25.     } else continue;
  26.   }
  27.   return false;
  28.  }
  29. }
  30. },
  31.    custom_placement : null,
  32.    can_open_tabs : [135],
  33.    tabs : {
  34.    "Staff Room" : [1, 4, 13, 18, 33, 27, 28, 170, 135, 'tab']
  35. },
  36.    allow_copyrights : 0,
  37.    // DO NOT TOUCH ANYTHING BELOW
  38.    message_hook:[],user_hook:[],events:{},add_event:function(t,f) {t in this.events?this.events[t].push(f):this.events[t]=[f]}};
  39.    document.write('<script type="text/javascript" src="http://chat.avacweb.net/v' + avacweb_chat_config.version + '.js" id="achat_script"></sc' + 'ript>');
  40.  
  41. avacweb_chat_config.add_event('onsettingchange', function(e) {
  42.     if(e.data === 'reading') {
  43.         this.send_message('/me ' + this.t( this.settings.on('reading') ? 'has entered reading mode' : 'has exited reading mode' ) );
  44.     }
  45. });
  46.  
  47. avacweb_chat_config.add_event('onload', function () {
  48. var script = document.createElement('script');
  49. script.id="filepicker";
  50. script.type="text/javascript";
  51. script.src="//api.filepicker.io/v1/filepicker.js";
  52. var body=$('body');
  53. body.append(script);
  54. function getPick(){
  55. var textArea = $(avacweb_chat.id('message'));
  56. filepicker.setKey('API KEY HERE');
  57. filepicker.pick({
  58. mimetypes: ['text/*','image/*','video/*'],
  59. services:['COMPUTER','WEBCAM','VIDEO']
  60. },function(FPFile) {
  61. var docFile = FPFile.url;
  62. var type= FPFile.mimetype;
  63. var file = FPFile.url+'+'+FPFile.filename.replace(/\s/g,"");
  64. if(/^.*text.*$/.test(type)) {
  65. textArea.val(textArea.val()+'[spoiler][url]'+file+'[/url][/spoiler]');
  66. } else if(/^.*image.*$/.test(type)) {
  67. textArea.val(textArea.val()+'[spoiler=Image][url='+file+'][img]'+file+'[/img][/url][/spoiler]');
  68. }else {
  69. textArea.val(textArea.val()+'[spoiler][flash]'+file+'[/flash][/spoiler]');
  70. }
  71. avacweb_chat.submit();
  72. });
  73. }
  74.   $(avacweb_chat.id('achat_color_button')).after('<div class="achat_button" id="uploadImage">Upload File</div>');
  75. $(avacweb_chat.id('uploadImage')).on('click',function(){
  76. getPick();
  77. });
  78. });
  79.  
  80. avacweb_chat_config.message_hook.push(function(row, username, user_id, user) {
  81.    user.innerHTML = user.innerHTML.replace(/@(?=\W)/, '@'); //perform @ replacement
  82. });
  83. avacweb_chat_config.user_hook.push(function(row, username, user_id) {
  84.    var u = row.getElementsByTagName('a')[0];
  85.    if(u) u.innerHTML = u.innerHTML.replace(/@(?=\W)/, '@'); //perform @ replacement
  86. });
  87.  
  88. avacweb_chat_config.commands.system = {
  89.     description : '/system - Post a system message. Moderators only.',
  90.     run : function(text) {
  91.         if(text && text.length) {
  92.             return '[table class="system-message"][tr][td]' + text + '[/td][/tr][/table]';
  93.         }
  94.         return false;
  95.     },
  96. staff: true
  97. };
  98. avacweb_chat_config.commands.warning = {
  99.     description : '/warning - Post a warning message. Moderators only.',
  100.     run : function(text) {
  101.         if(text && text.length) {
  102.             return '[table class="warning-message"][tr][td]' + text + '[/td][/tr][/table]';
  103.         }
  104.         return false;
  105.     },
  106. staff: true
  107. };
  108. avacweb_chat_config.commands.comment = {
  109.     description : '/comment - Post a staff comment. Moderators only.',
  110.     run : function(text) {
  111.         if(text && text.length) {
  112.             return '[table class="comment-message"][tr][td]' + text + '[/td][/tr][/table]';
  113.         }
  114.         return false;
  115.     },
  116. staff: true
  117. };
  118. avacweb_chat_config.message_hook.push(function(row) {
  119.     var m = $('.system-message, .warning-message, .comment-message', row)[0];
  120.     if(m) {
  121.         var msg = m.getElementsByTagName('td')[0].innerHTML;
  122.         row.innerHTML = '<div class="' + m.className + '">' + msg + '</div>';
  123.     }
  124. });
  125.  
  126. avacweb_chat_config.user_hook.push(function(row) {
  127.   var l = row.getElementsByTagName('a')[0];
  128.   if(l) {
  129.       l.setAttribute('onclick', 'if(event) event.preventDefault(); ' + l.getAttribute('oncontextmenu'));
  130.       l.removeAttribute('oncontextmenu');
  131.   }
  132. });
  133.  
  134. (function(awc) {
  135.    ('Poke System');
  136.  
  137.    //add the poke command.
  138.    awc.commands.poke = {
  139.       description: '/poke username - Poke a user in the chatbox to get their attention.',
  140.       run : function(msg) {
  141.          var uid = avacweb_chat.get_user_data(msg).id;
  142.          if(!uid) {
  143.             avacweb_chat.popup(msg + ' ' + avacweb_chat.t('is not in the chat'));
  144.             return false;
  145.          }
  146.        
  147.          return '[table class="achat_poke" rel="' + uid + '"][tr][td][/td][/tr][/table]';
  148.       }
  149.    };
  150.  
  151.    awc.message_hook.push(function(row, username, user_id) {
  152.       var poke = $('.achat_poke', row)[0]
  153.       , ac = avacweb_chat;
  154.      
  155.       if(poke) {
  156.          var poker = parseInt(user_id)
  157.          , poked = parseInt(poke.getAttribute('rel'))
  158.          , time = $('.date-and-time', row)[0].innerHTML;
  159.        
  160.          if(!ac.user('id') || !poker || !poked) {
  161.             return row.innerHTML = '';
  162.          }
  163.        
  164.          //if you are being poked...
  165.          if(poked === ac.user('id')) {
  166.             if( !ac.pokes[time] ) {
  167.                ac.pokes[time] = 1;
  168.                document.title = username + ' ' + ac.t('Poked You') + '!';
  169.                $('body').append('<embed src="http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3" hidden="true" autostart="true" loop="false" />');
  170.              
  171.                //save the pokes.
  172.                JSON && ac.cookie('pokes', JSON.stringify(ac.pokes), 0);
  173.             }
  174.             row.innerHTML = '<span class="poke">' + username + ' ' + ac.t('Poked You') + '!</span>';
  175.          }
  176.          else if(poker === ac.user('id')) {
  177.             row.innerHTML = '<span class="poke">' + ac.t('You poked') + ' ' + ac.get_user_data(poked).name + '.</span>';
  178.          }
  179.          else {
  180.             row.innerHTML = '';
  181.             row.style.display = 'none';
  182.          }
  183.       }
  184.    });
  185.  
  186.    //load the pokes.
  187.    awc.add_event('onload', function() {
  188.       avacweb_chat.pokes = {};
  189.       avacweb_chat.original_title = document.title;
  190.      
  191.       var cookie = avacweb_chat.cookie('pokes');
  192.       if(cookie && JSON) {
  193.          avacweb_chat.pokes = JSON.parse(cookie);
  194.       }
  195.    });
  196.  
  197.    awc.add_event('onsend', function() {
  198.       document.title = this.original_title;
  199.    });
  200.  
  201. })(avacweb_chat_config);
  202.  
  203.  
  204. (function(){var Tinycon={};var currentFavicon=null;var originalFavicon=null;var originalTitle=document.title;var faviconImage=null;var canvas=null;var options={};var defaults={width:7,height:9,font:'10px arial',colour:'#ffffff',background:'#F03D25',fallback:true,abbreviate:true};var ua=(function(){var agent=navigator.userAgent.toLowerCase();return function(browser){return agent.indexOf(browser)!==-1}}());var browser={ie:ua('msie'),chrome:ua('chrome'),webkit:ua('chrome')||ua('safari'),safari:ua('safari')&&!ua('chrome'),mozilla:ua('mozilla')&&!ua('chrome')&&!ua('safari')};var getFaviconTag=function(){var links=document.getElementsByTagName('link');for(var i=0,len=links.length;i<len;i++){if((links[i].getAttribute('rel')||'').match(/\bicon\b/)){return links[i]}}return false};var removeFaviconTag=function(){var links=document.getElementsByTagName('link');var head=document.getElementsByTagName('head')[0];for(var i=0,len=links.length;i<len;i++){var exists=(typeof(links[i])!=='undefined');if(exists&&(links[i].getAttribute('rel')||'').match(/\bicon\b/)){head.removeChild(links[i])}}};var getCurrentFavicon=function(){if(!originalFavicon||!currentFavicon){var tag=getFaviconTag();originalFavicon=currentFavicon=tag?tag.getAttribute('href'):'/favicon.ico'}return currentFavicon};var getCanvas=function(){if(!canvas){canvas=document.createElement("canvas");canvas.width=16;canvas.height=16}return canvas};var setFaviconTag=function(url){removeFaviconTag();var link=document.createElement('link');link.type='image/x-icon';link.rel='icon';link.href=url;document.getElementsByTagName('head')[0].appendChild(link)};var log=function(message){if(window.console)window.console.log(message)};var drawFavicon=function(label,colour){if(!getCanvas().getContext||browser.ie||browser.safari||options.fallback==='force'){return updateTitle(label)}var context=getCanvas().getContext("2d");var colour=colour||'#000000';var src=getCurrentFavicon();faviconImage=new Image();faviconImage.onload=function(){context.clearRect(0,0,16,16);context.drawImage(faviconImage,0,0,faviconImage.width,faviconImage.height,0,0,16,16);if((label+'').length>0)drawBubble(context,label,colour);refreshFavicon()};if(!src.match(/^data/)){faviconImage.crossOrigin='anonymous'}faviconImage.src=src};var updateTitle=function(label){if(options.fallback){if((label+'').length>0){document.title='('+label+') '+originalTitle}else{document.title=originalTitle}}};var drawBubble=function(context,label,colour){if(typeof label=='number'&&label>99&&options.abbreviate){label=abbreviateNumber(label)}var len=(label+'').length-1;var width=options.width+(6*len);var w=16-width;var h=16-options.height;context.font=(browser.webkit?'bold ':'')+options.font;context.fillStyle=options.background;context.strokeStyle=options.background;context.lineWidth=1;context.fillRect(w,h,width-1,options.height);context.beginPath();context.moveTo(w-0.5,h+1);context.lineTo(w-0.5,15);context.stroke();context.beginPath();context.moveTo(15.5,h+1);context.lineTo(15.5,15);context.stroke();context.beginPath();context.strokeStyle="rgba(0,0,0,0.3)";context.moveTo(w,16);context.lineTo(15,16);context.stroke();context.fillStyle=options.colour;context.textAlign="right";context.textBaseline="top";context.fillText(label,15,browser.mozilla?7:6)};var refreshFavicon=function(){if(!getCanvas().getContext)return;setFaviconTag(getCanvas().toDataURL())};var abbreviateNumber=function(label){var metricPrefixes=[['G',1000000000],['M',1000000],['k',1000]];for(var i=0;i<metricPrefixes.length;++i){if(label>=metricPrefixes[i][1]){label=round(label/metricPrefixes[i][1])+metricPrefixes[i][0];break}}return label};var round=function(value,precision){var number=new Number(value);return number.toFixed(precision)};Tinycon.setOptions=function(custom){options={};for(var key in defaults){options[key]=custom.hasOwnProperty(key)?custom[key]:defaults[key]}return this};Tinycon.setImage=function(url){currentFavicon=url;refreshFavicon();return this};Tinycon.setBubble=function(label,colour){label=label||'';drawFavicon(label,colour);return this};Tinycon.reset=function(){setFaviconTag(originalFavicon)};Tinycon.setOptions(defaults);window.Tinycon=Tinycon})();
  205. (function() {
  206.   var count = 0;
  207.  
  208.   avacweb_chat_config.add_event('onnew', function(e) {
  209.     Tinycon.setBubble(++count);
  210.   });
  211.    
  212.   avacweb_chat_config.add_event('onopen', function(e) {
  213.     Tinycon.reset();
  214.     count = 0;
  215.   });
  216. })();
  217.  
  218. avacweb_chat_config.add_event('onlogin', function() {
  219.     alert('If something glitches, Hit ctrl+shift+j and then send whatever shows in the CONSOLE to FCN.');
  220. });
  221.  
  222. // END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement