Skip to content

Instantly share code, notes, and snippets.

@cevhyruz
Created August 16, 2020 00:56
Show Gist options
  • Save cevhyruz/3167585333cec7ab065687a24a512100 to your computer and use it in GitHub Desktop.
Save cevhyruz/3167585333cec7ab065687a24a512100 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Facebook Elements Grabber
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.facebook.com/abestexpressph/inbox*
// @grant none
// ==/UserScript==
(function(window) {
let fb = {
name: document.getElementsByClassName('ellipsis'),
copyToClipboard: function(string) {
var el = document.createElement('textarea');
el.value = string;
el.setAttribute('readonly', '');
el.style = {position: 'absolute', left: '-9999px'};
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
},
focusTextarea: function() {
let textbox = document.getElementsByClassName('uiTextareaAutogrow')[0];
textbox.style.border = 'solid 5px solid #ff0000 !important';
textbox.focus();
setTimeout ( textbox.style.border = '', 500);
},
focusThread: function() {
document.getElementsByClassName('uiScrollableAreaContent')[0].focus();
},
getName: function(error) {
let sender_name = this.name[1].textContent;
if (sender_name != '') {
this.copyToClipboard(sender_name);
}
},
foobar: function() {
alert('foobar');
},
testigo: function() {
alert('testigo');
}
};
window.fb = fb;
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment