motorscript.com

Hacking TweetDeck for Chrome to show tweet source/client

Published:
Note: This is an archived post. Information may not be relevant now.

TweetDeck extension for Chrome doesn’t show the client or source application for each tweet.
Here’s a little dirty hack to add this feature on TweetDeck for Chrome.

Go to Chrome/Chromium User Data Directory
Refer here to find your Data Directory:
https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md
e.g. mine is ~/.config/google-chrome/Default

Change directory to Extensions/[tweetdeck-extension-id]/
[tweetdeck-extension-id] can be known from Chrome/Chromium -> Tools -> Extensions -> TweetDeck -> ID

Change directory to the only folder inside the current folder which is named after the current version of the extension, 0.9.7.12_0 at the time this is being written.

We are editing the files- default.js inside scripts folder and status_twitter.ejs file inside EJSTemplates/status/ folder. Open them on your favorite text editor.

In the default.js file:
Find:
this.isFavorite=a.favorited;
Add after it:
this.source=a.source;

In the same file,
Find:

return a.decklyID?a.decklyURL:"http://twitter.com/"+a.user.screenName+"/status/"+a.id};
Add after it:
TD.services.TwitterStatus.prototype.getChirpSource=function(){
  var p=this.getMainTweet().source.replace('nofollow','url').split('>');
  if (p.length==1) return p;
  var c=p[1].split('<')[0];
  return p[0]+'title="'+c+'">'+c.split(' ')[0]+'</a>';
};
Save and close default.js

In the status_twitter.ejs file:
Find:

</time> </a>

Add after it:

via <%= tweet.getChirpSource() %>

Save and close status_twitter.ejs

Open or refresh TweetDeck on Chrome. The hack should be now visible.

Thank you.