Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- //A random piece of JS that could be placed in a user script for Chrome / Greasemonkey and make it easier to post tweets to FB.
- //@wcdolphin
- myTest = function(cl) {
- var retnode = [];
- var myclass = 'tweet-actions js-actions'
- var elem = document.getElementsByTagName('*');
- for (var i = 0; i < elem.length; i++) {
- if (myclass == elem[i].className) retnode.push(elem[i]);
- }
- return retnode;
- };
- postToFacebook = function(what){
- //Wouldn't that be cool? I don't think it is too hard...
- alert('It would be really cool if I actually finished this someday...');
- };
- addElements = function(){
- for(var i =0, myTweets = myTest(),myElement,child; i < myTweets.length; i ++){ //need to actually check if node exists... Will add multiple otherwise.
- myElement =document.createElement('span');
- myElement.setAttribute('class','tweet-action action-retweet');
- child = document.createElement('a');
- child.setAttribute('href','#');
- child.setAttribute('class','retweet-action');
- child.setAttribute('title','RT@FB');
- child.innerHTML = '<span><i></i><b>RT@FB</b></span>';
- myElement.appendChild(child);
- myElement.addEventListener('click',postToFacebook,false)
- myTweets[i].appendChild(myElement);
- }
- }
- addElements();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement