This bookmarklet will mark all of you Twitter direct messages as read simply by deleting the entry in local storage.
The Code:
//Get the URL
var urlistwitter=window.location.href.split('/')[2].split('.');
// Check to see if the domain is twitter
if(urlistwitter[urlistwitter.length-2]==='twitter') {
// remove the local storage item of unread DM references
localStorage.removeItem('__DM__:lastReadMessageId');
}
// remove the icon that makes them appear unread
document.querySelector('.profile.new').classList.remove('new');
Drag this link to your toolbar. When you need to, click it when your Twitter window has focus to remove the localStorage entry and that annoying blue 'unread' icon:
Created by @estellevw. Pull request for improvements welcome.