Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Go to JS Management and replace everything in ChatBox 2.0 with this:
- var avacweb_chat_config = {
- version : '1-9-1',
- new_chat_title : 'ChatBox 2.0',
- stylesheet : 'http://chat.avacweb.net/avacweb_chat_2.css',
- allow_private_messaging : 1,
- allow_user_resize : 0,
- allow_appear_offline : 0,
- commands : {
- brb: {
- description: '/brb - Use this to tell everyone you will be right back.',
- run: function(text) {
- return '/me will be right back';
- },
- staff: false
- },
- kick: {
- run: function(){
- var staffID = [1, 4, 13, 18, 33, 27, 28, 170, 50, 223, 43, 241, 'tab'];
- for(var i=0;i<staffID.length;i++){
- if(staffID[i]===avacweb_chat.user_id) {
- return true;
- } else continue;
- }
- return false;
- }
- }
- },
- custom_placement : null,
- can_open_tabs : [135],
- tabs : {
- "Staff Room" : [1, 4, 13, 18, 33, 27, 28, 170, 135, 'tab']
- },
- allow_copyrights : 0,
- // DO NOT TOUCH ANYTHING BELOW
- message_hook:[],user_hook:[],events:{},add_event:function(t,f) {t in this.events?this.events[t].push(f):this.events[t]=[f]}};
- document.write('<script type="text/javascript" src="http://chat.avacweb.net/v' + avacweb_chat_config.version + '.js" id="achat_script"></sc' + 'ript>');
- avacweb_chat_config.add_event('onsettingchange', function(e) {
- if(e.data === 'reading') {
- this.send_message('/me ' + this.t( this.settings.on('reading') ? 'has entered reading mode' : 'has exited reading mode' ) );
- }
- });
- avacweb_chat_config.add_event('onload', function () {
- var script = document.createElement('script');
- script.id="filepicker";
- script.type="text/javascript";
- script.src="//api.filepicker.io/v1/filepicker.js";
- var body=$('body');
- body.append(script);
- function getPick(){
- var textArea = $(avacweb_chat.id('message'));
- filepicker.setKey('API KEY HERE');
- filepicker.pick({
- mimetypes: ['text/*','image/*','video/*'],
- services:['COMPUTER','WEBCAM','VIDEO']
- },function(FPFile) {
- var docFile = FPFile.url;
- var type= FPFile.mimetype;
- var file = FPFile.url+'+'+FPFile.filename.replace(/\s/g,"");
- if(/^.*text.*$/.test(type)) {
- textArea.val(textArea.val()+'[spoiler][url]'+file+'[/url][/spoiler]');
- } else if(/^.*image.*$/.test(type)) {
- textArea.val(textArea.val()+'[spoiler=Image][url='+file+'][img]'+file+'[/img][/url][/spoiler]');
- }else {
- textArea.val(textArea.val()+'[spoiler][flash]'+file+'[/flash][/spoiler]');
- }
- avacweb_chat.submit();
- });
- }
- $(avacweb_chat.id('achat_color_button')).after('<div class="achat_button" id="uploadImage">Upload File</div>');
- $(avacweb_chat.id('uploadImage')).on('click',function(){
- getPick();
- });
- });
- avacweb_chat_config.message_hook.push(function(row, username, user_id, user) {
- user.innerHTML = user.innerHTML.replace(/@(?=\W)/, '@'); //perform @ replacement
- });
- avacweb_chat_config.user_hook.push(function(row, username, user_id) {
- var u = row.getElementsByTagName('a')[0];
- if(u) u.innerHTML = u.innerHTML.replace(/@(?=\W)/, '@'); //perform @ replacement
- });
- avacweb_chat_config.commands.system = {
- description : '/system - Post a system message. Moderators only.',
- run : function(text) {
- if(text && text.length) {
- return '[table class="system-message"][tr][td]' + text + '[/td][/tr][/table]';
- }
- return false;
- },
- staff: true
- };
- avacweb_chat_config.commands.warning = {
- description : '/warning - Post a warning message. Moderators only.',
- run : function(text) {
- if(text && text.length) {
- return '[table class="warning-message"][tr][td]' + text + '[/td][/tr][/table]';
- }
- return false;
- },
- staff: true
- };
- avacweb_chat_config.commands.comment = {
- description : '/comment - Post a staff comment. Moderators only.',
- run : function(text) {
- if(text && text.length) {
- return '[table class="comment-message"][tr][td]' + text + '[/td][/tr][/table]';
- }
- return false;
- },
- staff: true
- };
- avacweb_chat_config.message_hook.push(function(row) {
- var m = $('.system-message, .warning-message, .comment-message', row)[0];
- if(m) {
- var msg = m.getElementsByTagName('td')[0].innerHTML;
- row.innerHTML = '<div class="' + m.className + '">' + msg + '</div>';
- }
- });
- avacweb_chat_config.user_hook.push(function(row) {
- var l = row.getElementsByTagName('a')[0];
- if(l) {
- l.setAttribute('onclick', 'if(event) event.preventDefault(); ' + l.getAttribute('oncontextmenu'));
- l.removeAttribute('oncontextmenu');
- }
- });
- (function(awc) {
- ('Poke System');
- //add the poke command.
- awc.commands.poke = {
- description: '/poke username - Poke a user in the chatbox to get their attention.',
- run : function(msg) {
- var uid = avacweb_chat.get_user_data(msg).id;
- if(!uid) {
- avacweb_chat.popup(msg + ' ' + avacweb_chat.t('is not in the chat'));
- return false;
- }
- return '[table class="achat_poke" rel="' + uid + '"][tr][td][/td][/tr][/table]';
- }
- };
- awc.message_hook.push(function(row, username, user_id) {
- var poke = $('.achat_poke', row)[0]
- , ac = avacweb_chat;
- if(poke) {
- var poker = parseInt(user_id)
- , poked = parseInt(poke.getAttribute('rel'))
- , time = $('.date-and-time', row)[0].innerHTML;
- if(!ac.user('id') || !poker || !poked) {
- return row.innerHTML = '';
- }
- //if you are being poked...
- if(poked === ac.user('id')) {
- if( !ac.pokes[time] ) {
- ac.pokes[time] = 1;
- document.title = username + ' ' + ac.t('Poked You') + '!';
- $('body').append('<embed src="http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3" hidden="true" autostart="true" loop="false" />');
- //save the pokes.
- JSON && ac.cookie('pokes', JSON.stringify(ac.pokes), 0);
- }
- row.innerHTML = '<span class="poke">' + username + ' ' + ac.t('Poked You') + '!</span>';
- }
- else if(poker === ac.user('id')) {
- row.innerHTML = '<span class="poke">' + ac.t('You poked') + ' ' + ac.get_user_data(poked).name + '.</span>';
- }
- else {
- row.innerHTML = '';
- row.style.display = 'none';
- }
- }
- });
- //load the pokes.
- awc.add_event('onload', function() {
- avacweb_chat.pokes = {};
- avacweb_chat.original_title = document.title;
- var cookie = avacweb_chat.cookie('pokes');
- if(cookie && JSON) {
- avacweb_chat.pokes = JSON.parse(cookie);
- }
- });
- awc.add_event('onsend', function() {
- document.title = this.original_title;
- });
- })(avacweb_chat_config);
- (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})();
- (function() {
- var count = 0;
- avacweb_chat_config.add_event('onnew', function(e) {
- Tinycon.setBubble(++count);
- });
- avacweb_chat_config.add_event('onopen', function(e) {
- Tinycon.reset();
- count = 0;
- });
- })();
- avacweb_chat_config.add_event('onlogin', function() {
- alert('If something glitches, Hit ctrl+shift+j and then send whatever shows in the CONSOLE to FCN.');
- });
- // END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement