Arrow Fix[Temporary] + Added new Emoticons and Memes
![]() ![]() |
To fix the arrow, open who you want to chat, then click the arrow down, so you can see the emoticons, then close the chat box and open it again :D repeat this if u accidentally close the chatbox while the emoticons is hidden. Source:
// ==UserScript==
// @name Facebook Chat Emoticons Bar
// @description Adds an emoticon/meme/anime bar to Facebook chat editted by morizuki
// @include http://facebook.com/*
// @include http://*.facebook.com/*
// @include https://facebook.com/*
// @include https://*.facebook.com/*
// @exclude http://*.channel.facebook.com/*
// @exclude https://*.channel.facebook.com/*
// @author bitMAN
// @version 0.0.183.1
// @versionnumber 0.183.1
// @license Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0); http://creativecommons.org/licenses/by-nc-nd/3.0/
// @namespace http://userscripts.org/scripts/show/50826
// ==/UserScript==
//
// List of emoticons
// :) :( :D >:( -_- :/ o.O :p :'( >:O :v 3:) :o :3 ;) :* :|] 8) <3><(") :42:
var version, CImagesURL, HttpsOn, ImagesURL, ResourcesURL, storage, emotsInfo, spemotsInfo, headTag, styleTag, ArrowStyleUp, ArrowStyleDown, fEmotBarDom, fEmotsListDom, fArrow, cemotsInfo;
version = 0.183;
HttpsOn = window.location.href.match('https://')?true:false;
ImagesURL = HttpsOn?'https://s-static.ak.fbcdn.net/images/':'http://static.ak.fbcdn.net/images/';
CImagesURL = HttpsOn?'https://profile.ak.fbcdn.net/hprofile-ak-snc4/':'http://profile.ak.fbcdn.net/hprofile-ak-snc4/';
ResourcesURL = HttpsOn?'https://s-static.ak.fbcdn.net/rsrc.php/':'http://static.ak.fbcdn.net/rsrc.php/';
/* START: This part of the code was written (partialy) by Vaughan Chandler for FFixer, special thanks to him :) */
storage = 'none';
try {
if (typeof GM_getValue === 'function' && typeof GM_setValue === 'function') {
GM_setValue('testkey', 'testvalue');
if (GM_getValue('testkey', false) === 'testvalue') { storage='greasemonkey'; }
}
} catch(x) {}
if (storage=='none' && typeof localStorage == 'object') { storage='localstorage'; }
function setValue(key, value) {
switch (storage) {
case 'greasemonkey':
GM_setValue('0-'+key, value);
break;
case 'localstorage':
localStorage['femotbar-0-'+key] = value;
break;
}
}
function getValue(key, value) {
switch (storage) {
case 'greasemonkey':
return GM_getValue('0-'+key, value);
case 'localstorage':
var val = localStorage['femotbar-0-'+key];
if (val=='true') { return true; }
else if (val=='false') { return false; }
else if (val) { return val; }
break;
}
return value;
}
function xmlhttpRequest(params, callBack) {
if (typeof GM_xmlhttpRequest !== 'undefined') {
params['onload'] = callBack;
return GM_xmlhttpRequest(params);
}
return null;
}
function openInTab(url) {
if (typeof GM_openInTab !== 'undefined') { GM_openInTab(url); }
else { window.open(url); }
}
function UpdateCheck() {
if(parseInt(getValue('LastUpdate', '0')) + 86400000 <= (new Date().getTime())) {
try {
xmlhttpRequest( { method: 'GET',
url: 'http://userscripts.org/scripts/source/50826.meta.js?' + new Date().getTime(),
headers: {'Cache-Control': 'no-cache'} },
handleUpdateResponse);
}
catch (err) {
alert('An error occurred while checking for updates:\n' + err);
}
}
}
function handleUpdateResponse(r) {
setValue('LastUpdate', new Date().getTime() + '');
if (r.responseText.match(/@versionnumber\s+(\d+\.\d+)/)[1] > version) {
if(confirm("There's an update available for 'Facebook Chat Emoticons Bar'.\nDo you wish to install it?")) openInTab('http://userscripts.org/scripts/source/50826.user.js');
}
}
/* END */
function createSelection(field, start, end) {
if( field.createTextRange ) {
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart('character', start);
selRange.moveEnd('character', end);
selRange.select();
} else if( field.setSelectionRange ) {
field.setSelectionRange(start, end);
} else if( field.selectionStart ) {
field.selectionStart = start;
field.selectionEnd = end;
}
field.focus();
}
function getCursorPosition(field) {
var CursorPos = 0;
if (field.selectionStart || field.selectionStart == '0') CursorPos = field.selectionStart;
return (CursorPos);
}
UpdateCheck();
emotsInfo = [':)', ':(', ':p', ':D', ':o', ';)', '8)', '8|', '>:(', ':/', ':\'(', '3:)', 'O:)', ':*', '<3>:O', ':v', ':3', '(y)'];
spemotsInfo = [':|]', 'emote/robot.gif', '(^^^)', 'emote/shark.gif', ':putnam:', 'emote/putnam.gif', '<(")', 'emote/penguin.gif', ':42:', 'emote/42.gif'];
cemotsInfo = [
'[[MeGustaMeme]]', '372854_207653152590784_2008108456_q.jpg',
'[[ForeverAloneComics]]', '372893_221969944541836_311514372_q.jpg',
'[[trafileswmegusta]]', '203579_147452525332700_5478172_q.jpg',
'[[YaoMingMeme]]', '373398_208095089214676_140450066_q.jpg',
'[[TroolFaces]]', '372997_254391157946791_1329668557_q.jpg',
'[[FFFFFFUUUU]]', '50335_124721064983_2252_q.jpg',
'[[LOL.Oficial]]', '373232_197759556926014_2144795913_q.jpg',
'[[FapFapFapMeme]]', '373053_166377960087575_1747489243_q.jpg',
'[[Y.U.NO.MEME]]', '187833_128956450513605_1606309_q.jpg',
'[[nothingtodoherememe]]', '373703_250516428349499_2111780166_q.jpg',
'[[Poker.Face.B]]', '373002_201618786585175_1873263195_q.jpg',
'[[Challenge.accepted.PageOficial]]', '277058_259548204069438_1500997118_q.jpg',
'[[Okaay.B]]', '261085_293633844000947_1343273138_q.jpg',
'[[Fuuck.yeahh]]', '27522_354014573130_4149_q.jpg',
'[[224812970902314]]', '373590_224812970902314_980683470_q.jpg',
'[[MissDerpina]]', '203477_192141754166618_3998850_q.jpg',
'[[CerealesGuy]]', '162038_161570823888430_211437_q.jpg',
'[[142670085793927]]', '203500_142670085793927_3334212_q.jpg',
'[[168040846586189]]', '373509_168040846586189_1627905796_q.jpg',
'[[249199828481201]]', '276585_249199828481201_728550539_q.jpg',
'[[250128751720149]]', '276944_250128751720149_613074181_q.jpg',
'[[236147243124900]]', '373608_236147243124900_662723173_q.jpg',
'[[196431117116365]]', '373523_196431117116365_279923093_q.jpg',
'[[334954663181745]]', '373064_334954663181745_52998512_q.jpg',
'[[144685078974802]]', '211148_144685078974802_823703752_q.jpg',
'[[224502284290679]]', '276920_224502284290679_224731356_q.jpg',
'[[155393057897143]]', '373350_155393057897143_1264728363_q.jpg',
'[[326134990738733]]', '276589_326134990738733_188635450_q.jpg',
'[[Otaku.no.Saigo.Clan]]', '174718_118224871522002_3701997_q.jpg'
];
headTag = document.getElementsByTagName('head')[0];
if (headTag) {
styleTag = document.createElement('style');
styleTag.type = 'text/css';
styleTag.innerHTML =
'.chat_tab_emot_bar {padding-top: 2px; padding-bottom: 6px; line-height: 16px; padding-left: 2px; background:#EEEEEE none repeat scroll 0 0; border-style: solid; border-width: 0px 0px 1px 0px; border-color: #C9D0DA; position: static; }'+
'.chatstylesbut {width: 15px; height:15px; background-image: url("' + ResourcesURL + 'zx/r/FbCyXQSrD4-.png"); cursor: pointer; border-color: rgb(153, 153, 153) rgb(153, 153, 153) rgb(136, 136, 136); border-style: solid; border-width: 1px; }'+
'.chat_arrow { background-image: url("'+ ResourcesURL + 'v1/zp/r/SBNTDM0S-7U.png"); background-position: 0 -48px; height: 5px; width: 9px; }';
headTag.appendChild(styleTag);
}
ArrowStyleUp = 'cursor: pointer; position: absolute; right: 2px; -moz-transform: rotate(180deg); -webkit-transform: rotate(180deg);'
ArrowStyleDown = 'cursor: pointer; position: absolute; right: 2px;'
fEmotBarDom = document.createElement('div');
fEmotBarDom.setAttribute('class','chat_tab_emot_bar');
fEmotsListDom = document.createElement('div');
fEmotsListDom.setAttribute('name','EmotsList');
fEmotBarDom.appendChild(fEmotsListDom);
for(i=0;i<emotsInfo.length;i+=1) {
var fEmotsDom = document.createElement('img');
fEmotsDom.setAttribute('alt',emotsInfo[i]);
fEmotsDom.setAttribute('style','cursor: pointer; background-position: -'+ 16*i +'px 0px;');
fEmotsDom.setAttribute('src',ImagesURL + 'blank.gif');
fEmotsDom.setAttribute('class','emote_img');
fEmotsListDom.appendChild(fEmotsDom);
}
for(i=0;i<spemotsInfo.length;i+=2) {
var fEmotsDom = document.createElement('img');
fEmotsDom.setAttribute('alt',spemotsInfo[i]);
fEmotsDom.setAttribute('src',ImagesURL + spemotsInfo[i+1]);
fEmotsDom.setAttribute('style','cursor: pointer;');
fEmotsDom.setAttribute('class','emote_custom');
fEmotsListDom.appendChild(fEmotsDom);
}
for(i=0;i<cemotsInfo.length;i+=2) {
var fEmotsDom = document.createElement('img');
fEmotsDom.setAttribute('alt',cemotsInfo[i]);
fEmotsDom.setAttribute('src',CImagesURL + cemotsInfo[i+1]);
fEmotsDom.setAttribute('style','cursor: pointer;');
fEmotsDom.setAttribute('class','emote_custom');
fEmotsListDom.appendChild(fEmotsDom);
}
var fEmotsDom = document.createElement('img');
fEmotsDom.setAttribute('alt','*bold*');
fEmotsDom.setAttribute('src',ImagesURL + 'blank.gif');
fEmotsDom.setAttribute('class','chatstylesbut');
fEmotsDom.setAttribute('style','background-position: -2px -2px;');
fEmotsListDom.appendChild(fEmotsDom);
var fEmotsDom = document.createElement('img');
fEmotsDom.setAttribute('alt','_underline_');
fEmotsDom.setAttribute('src',ImagesURL + 'blank.gif');
fEmotsDom.setAttribute('class','chatstylesbut');
fEmotsDom.setAttribute('style','background-position: -2px -42px;');
fEmotsListDom.appendChild(fEmotsDom);
fArrow = document.createElement('i');
fArrow.setAttribute('alt','');
fArrow.setAttribute('class','img chat_arrow');
fArrow.setAttribute('style',ArrowStyleUp);
fEmotBarDom.appendChild(fArrow);
var setting_visible = getValue('visible',true);
document.addEventListener('DOMNodeInserted', fInsertedNodeHandler, false);
function fInsertedNodeHandler(event) {
if(event.target.getElementsByClassName && event.target.getElementsByClassName('fbNubFlyout fbDockChatTabFlyout')[0])
fInsertEmotBar(event.target);
}
function fInsertEmotBar(fChatWrapper) {
fChatToolBox = fChatWrapper.getElementsByClassName('fbNubFlyoutHeader')[0]
fNewEmotBar = fEmotBarDom.cloneNode(true);
setVisibility(fNewEmotBar);
for(i=0;i<fNewEmotBar.firstChild.childNodes.length-2;i++) fNewEmotBar.firstChild.childNodes[i].addEventListener('click', fEmotClickHandler , false);
fNewEmotBar.firstChild.childNodes[i].addEventListener('click' , fStyleClickHandler , false);
fNewEmotBar.firstChild.childNodes[i+1].addEventListener('click' , fStyleClickHandler , false);
fNewEmotBar.childNodes[1].addEventListener('click', fHideShowEmotBar , false);
if(fChatToolBox.childNodes) fChatToolBox.insertBefore(fNewEmotBar,fChatToolBox.childNodes[1]);
}
function fEmotClickHandler(event){
var fChatInput = event.target.parentNode.parentNode.parentNode.parentNode.getElementsByClassName('fbNubFlyoutFooter')[0].getElementsByClassName('inputContainer')[0].getElementsByClassName('uiTextareaAutogrow input')[0];
var pos = getCursorPosition(fChatInput);
var txtbef = ''; var txtaft = '';
if (fChatInput.value.charAt(pos-1) != ' ' && pos-1 > 0) txtbef = ' ';
if (fChatInput.value.charAt(pos) != ' ') txtaft = ' ';
fChatInput.value = fChatInput.value.substring(0,pos) + txtbef + event.target.getAttribute('alt') + txtaft + fChatInput.value.substring(pos);
createSelection(fChatInput,pos + event.target.getAttribute('alt').length + txtaft.length + txtbef.length,pos + event.target.getAttribute('alt').length + txtaft.length + txtbef.length);
}
function fStyleClickHandler(event){
var fChatInput = event.target.parentNode.parentNode.parentNode.parentNode.getElementsByClassName('fbNubFlyoutFooter')[0].getElementsByClassName('inputContainer')[0].getElementsByClassName('uiTextareaAutogrow input')[0];
var selectedText = fChatInput.value.substring(fChatInput.selectionStart, fChatInput.selectionEnd);
var pos = getCursorPosition(fChatInput);
var txtlen = selectedText.length;
if (txtlen == 0) {
fChatInput.value = fChatInput.value.substring(0,pos) + event.target.getAttribute('alt') + fChatInput.value.substring(pos);
createSelection(fChatInput,pos + 1,pos + event.target.getAttribute('alt').length-1);
}
else {
var txtbef = event.target.getAttribute('alt').charAt(0);
var txtaft = event.target.getAttribute('alt').charAt(0);
while (fChatInput.value.charAt(pos) == ' ') { pos += 1; txtlen -= 1; }
while (fChatInput.value.charAt(pos+txtlen-1) == ' ') txtlen -= 1;
if (fChatInput.value.charAt(pos-1) != ' ' && pos-1 > 0) txtbef = ' ' + txtbef;
if (fChatInput.value.charAt(pos+txtlen) != ' ') txtaft += ' ';
fChatInput.value = fChatInput.value.substring(0,pos) + txtbef + fChatInput.value.substring(pos,pos+txtlen) + txtaft + fChatInput.value.substring(pos + txtlen);
createSelection(fChatInput, pos + txtlen + 2, pos + txtlen + 2);
}
}
function fHideShowEmotBar(event){
fChatBar = document.getElementsByName('EmotsList');
if(fChatBar[0].getAttribute('style') == 'display: none;') {
for(i=0;i<fChatBar.length;i++) {
fChatBar[i].setAttribute('style','display: block;');
fChatBar[i].parentNode.childNodes[1].setAttribute('style',ArrowStyleUp);
}
}
else {
for(i=0;i<fChatBar.length;i++) {
fChatBar[i].setAttribute('style','display: none;');
fChatBar[i].parentNode.childNodes[1].setAttribute('style',ArrowStyleDown);
}
}
setValue('visible',!setting_visible);
setting_visible = !setting_visible;
}
function setVisibility(DOM) {
if(setting_visible) {
DOM.firstChild.setAttribute('style','display: block;');
DOM.childNodes[1].setAttribute('style',ArrowStyleUp);
}
else {
DOM.firstChild.setAttribute('style','display: none;');
DOM.childNodes[1].setAttribute('style',ArrowStyleDown);
}
}
|
![]() ![]() |
Thanks, but I won't add memes to the bar.
|

