Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Facebook Chat Bracket Emoticons
- // @description Replaces [[xxx]] expressions with their respective pictures on facebook chat. "The New Edition"
- // @author Omar Abou Elmagd (http://www.facebook.com/omareco14)
- // @version 1.0
- // @include https://*.facebook.*/*
- // @include http://*.facebook.*/*
- // @include https://www.facebook.com/*
- // @run-at document-end
- // @grant metadata
- // ==/UserScript==
- /*
- KeyboardShortcuts : خاصية تقوم بتحويل اختصار للكلام الي كلام معين
- مثال : فاكس تتحول الي [[faksse]]
- لتفعيل هذه الخاصيه
- قم بتغير الكلمه في السطر التالي من
- True الي False
- */
- var KeyboardShortcuts = false;
- /*
- TurningTo : خاصية تقوم بتحويل الايموشن من
- :] الي :D
- لتفعيل هذه الخاصيه
- قم بتغير الكلمه في السطر التالي من
- True الي False
- */
- var TurningTo = false;
- var allElements = ["_5yl5", "UFICommentBody", "_5pbx userContent", "_38 direction_rtl"];
- var OldMemes = ["fakss", "atmz7", "8abyy", "wes5a"];
- var NewMemes = ["faksse", "atmz77", "8abbyy", "weth5a"];
- var OldWords = [":]", "فاكس", "هيرب ديرب"];
- var NewWords = [":D", "[[faksse]]", "[[8abbyy]]"];
- function KeyboardShortcutsFunction(){
- if(KeyboardShortcuts==false){return;}
- var Emot = document.getElementsByClassName("uiTextareaAutogrow _552m");
- for(var i = 0; i<Emot.length;i++){
- for (var iix = 0; iix < OldWords.length; iix++) {
- if(Emot[i].value.indexOf(OldWords[iix]) != -1) {
- Emot[i].value = Emot[i].value.replace(OldWords[iix],NewWords[iix]);
- }
- }
- }
- }
- function TurningToFunction(){
- if(TurningTo==false){return;}
- var Emotion = document.getElementsByClassName("emoticon emoticon_smile");
- for(var i = 0; i<Emotion.length;i++){
- if(Emotion[i].getAttribute("title")==":]"){
- Emotion[i].setAttribute("class","emoticon emoticon_grin");
- Emotion[i].setAttribute("title",":D");
- }
- }
- }
- setInterval(function(){
- for (var ii = 0; ii < allElements.length; ii++) {
- var all = document.getElementsByClassName(allElements[ii]);
- for(var i = 0; i<all.length;i++){
- if(all[i].innerHTML.indexOf("[[") != -1){
- var meme = all[i].innerHTML.substring(all[i].innerHTML.indexOf("[[")+2,all[i].innerHTML.indexOf("]]"));
- var newmeme = meme;for(var l=0;l<OldMemes.length;l++){if(meme==OldMemes[l]){newmeme=NewMemes[l];}}
- all[i].innerHTML = all[i].innerHTML.replace("[["+meme+"]]", '<img title="'+newmeme+'" alt="'+newmeme+'" height=16 width=16 src="https://graph.facebook.com/'+newmeme+'/picture?width=10&height=10">');
- }
- }
- }
- KeyboardShortcutsFunction();
- TurningToFunction();
- },10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement