Greasy Fork is available in English.

Twitter last read

Keep track of your read tweets.

  1. // ==UserScript==
  2. // @name Twitter last read
  3. // @namespace http://armeagle.nl
  4. // @description Keep track of your read tweets.
  5. // @include http*://twitter.com/*
  6. // @version 2.8
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. // This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License by Alex Haan (http://creativecommons.org/licenses/by-nc-sa/3.0/)
  11.  
  12. /*
  13. - Adds buttons to the top tab list (with the Home and Connect buttons). Clicking the icon on the left that mark all (visible) tweets as read and stores that. Upon clicking the second icon the right the page will scroll down until the last read tweet is found (or stops at the 100th tweet).
  14.  
  15. Whenever read tweets are loaded and displayed they will be marked (background color changed). Also works separately on the notifications tab.
  16.  
  17. - Hides "While you were away" and "Who to follow" sections.
  18. - Adds overlay to embedded YouTube videos so you can simply open them in a new tab/window. Can be disabled with the 'addYoutubeOverlay' setting.
  19.  
  20. - Only tested on Firefox.
  21. */
  22.  
  23. function DOM_script() {
  24. // 2014-08-13: Twitter introduced (more) hotkeys that now break normal interaction (Ctrl+r), fixing that!
  25. window.addEventListener("keypress", function(event) { event.stopPropagation(); }, true);
  26. // var script = document.getElementsByTagName('head')[0].appendChild(document.createElement('script'));
  27. // script.setAttribute('type', 'text/javascript');
  28. // return script.textContent=DOM_script.toString().replace(/[\s\S]*"\$1"\);([\s\S]*)}/,"$1");
  29.  
  30. // create container Object to prevent variables and function from going global
  31. var AEG = {};
  32. // Whether to show the confirm dialog when marking tweets read (for when the last-read tweet isn't loaded).
  33. AEG.markTweetsUseConfirm = true;
  34. // Whether to add an overlay to embedded YouTube videos that forces opening of the youtube video in a new tab.
  35. AEG.addYoutubeOverlay = true;
  36.  
  37. AEG.debug = false;
  38. // is scrolling
  39. AEG.isScrolling = false;
  40. // prevent (near) infinite loops when scrolling to last read tweet
  41. AEG.maxScrollInjects = 100;
  42. // counter for above
  43. AEG.countScrollInjects = -1;
  44. // timeout, so not calling scrollintoview too often, reset on new inject and start new timer
  45. AEG.scrollInjectTimer = null;
  46.  
  47. AEG.streamItemCount = -1;
  48.  
  49. /* Hook on nodeinsert events for the timeline
  50. * Do it a few steps up, cause switching 'tabs' causes it to rebuild the tree.
  51. * Checking for the actualy tweet elements anyway.
  52. */
  53. //document.querySelector('.stream-manager')
  54. //alert(document.getElementsByTagName("body")[0]);
  55. document.getElementsByTagName("body")[0].addEventListener("DOMNodeInserted", function(event) {AEG.tweetInsertHandler(event)}, false);
  56.  
  57. AEG.addButtonBar = function() {
  58. // add "Mark All Read" to the top of the timeline, next to the Tweets header
  59. var buttonbar = document.querySelector('#global-actions');
  60. var li_buttonbar = document.createElement('li');
  61. li_buttonbar.setAttribute('id', 'AEG-button-bar');
  62.  
  63. var li_buttonbar_box = document.createElement('div');
  64. li_buttonbar_box.className = 'box';
  65.  
  66. var li_markall = document.createElement('i');
  67. li_markall.className = 'button';
  68. li_markall.setAttribute('id', 'mark-all');
  69. li_markall.setAttribute('title', 'Mark all tweets read');
  70. li_buttonbar_box.appendChild(li_markall);
  71. var li_scrolltolast = document.createElement('i');
  72. li_scrolltolast.className = 'button';
  73. li_scrolltolast.setAttribute('id', 'scroll-to-last');
  74. li_scrolltolast.setAttribute('title', 'Scroll to last read tweet');
  75. li_buttonbar_box.appendChild(li_scrolltolast);
  76.  
  77. li_buttonbar.appendChild(li_buttonbar_box);
  78.  
  79. buttonbar.appendChild(li_buttonbar);
  80.  
  81. li_scrolltolast.addEventListener('click', function(event) {AEG.scrollToLastReadHandler(event)}, false);
  82. li_markall.addEventListener('click', function(event) {AEG.setLastRead(event)}, false);
  83. }
  84.  
  85. AEG.addButtonBarOrig = function() {
  86. // add "Mark All Read" to the top of the timeline, next to the Tweets header
  87. var buttonbar = document.querySelector('#global-actions');
  88.  
  89. var li_buttonbar = document.createElement('li');
  90. li_buttonbar.setAttribute('id', 'AEG-button-bar');
  91.  
  92. var li_buttonbar_box = document.createElement('div');
  93. li_buttonbar_box.className = 'box';
  94.  
  95. var li_markall = document.createElement('i');
  96. li_markall.className = 'button';
  97. li_markall.setAttribute('id', 'mark-all');
  98. li_markall.setAttribute('title', 'Mark all tweets read');
  99. li_buttonbar_box.appendChild(li_markall);
  100. var li_scrolltolast = document.createElement('i');
  101. li_scrolltolast.className = 'button';
  102. li_scrolltolast.setAttribute('id', 'scroll-to-last');
  103. li_scrolltolast.setAttribute('title', 'Scroll to last read tweet');
  104. li_buttonbar_box.appendChild(li_scrolltolast);
  105.  
  106. li_buttonbar.appendChild(li_buttonbar_box);
  107.  
  108. buttonbar.appendChild(li_buttonbar);
  109.  
  110. li_scrolltolast.addEventListener('click', function(event) {AEG.scrollToLastReadHandler(event)}, false);
  111. li_markall.addEventListener('click', function(event) {AEG.setLastRead(event)}, false);
  112. }
  113.  
  114. AEG.tweetInsertHandler = function(event) {
  115. var tweet = event.target;
  116. if ( ! tweet || ! tweet.className || tweet.className.indexOf("stream-item") < 0) {
  117. return;
  118. }
  119. //AEG.quotedRetweetLinkifier(tweet);
  120. // mark if old
  121. var lastReadID = AEG.getLastUrlReadID();
  122. if ( lastReadID != null ) {
  123. AEG.testAndMarkTweet(tweet, MyBigNumber(lastReadID));
  124. //console.log('post');
  125. } else {
  126. //console.log(['post', event.target, event.target.className.indexOf("stream-item")]);
  127. }
  128. // YouTube clickable
  129. AEG.makeClickableYoutube(tweet);
  130. }
  131. // handle quoted retweets and allow opening of the base tweet manually.
  132. AEG.quotedRetweetLinkifier = function(tweet) {
  133. //console.log(['aa', tweet, typeof tweet ]);
  134. /*return;
  135. // find quotedTweet
  136. var quotedTweet = tweet.querySelector('.QuoteTweet');
  137. if ( ! quotedTweet ) {
  138. return;
  139. }
  140. console.log(['bb', tweet, quotedTweet]);*/
  141. }
  142.  
  143. // lookup the last tweet and store that ID in a cookie, then color all those tweets as read
  144. AEG.setLastRead = function(event) {
  145. try {
  146. // check whether the last read tweet is loaded, to prevent marking by accident
  147. var lastChild = document.querySelector('.stream > .stream-items > .stream-item:last-child');
  148. var oldestTweetID = AEG.getTweetIDFromElement(lastChild);
  149. if ( oldestTweetID <= AEG.getLastUrlReadID() || !AEG.markTweetsUseConfirm || confirm('Are you sure you want to mark all tweets read? \nThe last read tweet is not loaded.') ) {
  150. var firstChild = document.querySelector('.stream > .stream-items > .stream-item:first-child');
  151. while (firstChild.querySelector('div.tweet').hasAttribute('data-promoted')
  152. || firstChild.className.indexOf('before-expanded') >= 0
  153. || firstChild.className.indexOf('has-recap') >= 0) {
  154. firstChild = firstChild.nextElementSibling;
  155. }
  156. var lastTweetID = AEG.getTweetIDFromElement(firstChild);
  157.  
  158. AEG.setLastUrlReadID(lastTweetID);
  159. AEG.markRead(lastTweetID);
  160. }
  161. } catch (exc) {
  162. AEG.debugHandleException('AEG.setLastRead', exc);
  163. }
  164. event.stopPropagation();
  165. }
  166.  
  167. /*
  168. * Mark tweets with ID equal or lower than 'id' as read. If 'true' is passed as second parameter, promoted tweets will not be marked as we'l' hide them anyway.
  169. * Also make tweets with YouTube video clickable.
  170. * param id MyBigNumber or null
  171. */
  172. AEG.markRead = function(id) {
  173. try {
  174. var tweets = document.querySelectorAll('.stream > .stream-items > .stream-item');
  175. // from last to first
  176. for ( var ind = tweets.length-1; ind >= 0; ind-- ) {
  177. var tweet = tweets[ind];
  178. // skip non-tweets
  179. if ( tweet.className.indexOf('separated-module') >= 0 ) {
  180. continue;
  181. }
  182. if ( null !== id ) {
  183. AEG.testAndMarkTweet(tweet, id);
  184. }
  185. // YouTube clickable
  186. AEG.makeClickableYoutube(tweet);
  187. }
  188. } catch (exc) {
  189. AEG.debugHandleException('AEG.markAllRead', exc);
  190. }
  191. }
  192. // mark the tweet if its ID is lower or equal to id
  193. // @element : the insterted DOM element
  194. // @id : lastReadID
  195. AEG.testAndMarkTweet = function(element, id) {
  196. try {
  197. var tweetID = AEG.getTweetIDFromElement(element);
  198. if (tweetID == 0) {
  199. // could be liked tweet, test (again)
  200. if (AEG.isLikedTweet(element)) {
  201. element.classList.add('is-read-liked');
  202. }
  203. // skip promoted tweets
  204. if (AEG.isPromotedTweet(element)) {
  205. element.classList.add('is-promoted');
  206. }
  207. // happens with newly injected tweets. Since they're new, they don't have to be marked anyway.
  208. return;
  209. }
  210. //console.log(['tt', element]);
  211.  
  212. // mark tweet if it's old
  213. if ( tweetID <= id ) {
  214. try {
  215. element.classList.add('is-read');
  216. } catch ( e2 ) {
  217. return; // error for some reason // TODO ignore instead of return? doesn't seem to happen anymore anyway
  218. }
  219. }
  220. if ( AEG.isScrolling ) {
  221. if ( element.querySelector('div.tweet').hasAttribute('data-promoted') || tweetID >= id ) {
  222. // Scroll this element into view, would automatically stop when the tweet we're looking for is found.
  223. // But just limit it to prevent an endless run
  224. if ( AEG.countScrollInjects++ < AEG.maxScrollInjects ) {
  225. window.clearTimeout(AEG.scrollInjectTimer);
  226. AEG.scrollInjectTimer = window.setTimeout(function(elem) {
  227. elem.scrollIntoView(false);
  228. }, 100, element);
  229. } else {
  230. window.clearTimeout(AEG.scrollInjectTimer);
  231. // didn't find the torrent in time, add a notice in the timeline
  232. AEG.isScrolling = false;
  233. var d = document.createElement('div');
  234. d.setAttribute('style', 'color: red; padding-left: 5px; font-weight: bold; border-bottom: 1px solid #EBEBEB');
  235. d.appendChild(document.createTextNode('max amount of repeats ('+ AEG.maxScrollInjects +') exceeded, tweet not found'));
  236. document.querySelector('.stream-items').insertBefore(d, element.nextSibling);
  237. d.scrollIntoView(false);
  238. }
  239. } else {
  240. AEG.isScrolling = false;
  241. // scroll this one into view
  242. window.clearTimeout(AEG.scrollInjectTimer);
  243. element.scrollIntoView(false);
  244. }
  245. }
  246. } catch (exc) {
  247. AEG.debugHandleException('AEG.testAndMarkTweet', exc);
  248. }
  249. }
  250. /*
  251. * Keep scrolling down till the last read tweet is in view (or should be, scrolling till we find
  252. * a tweet with ID smaller or equal to the stored one.
  253. *
  254. * Use the 'dom-inserted-handler in a few ways:
  255. * - checking for 'old' tweet(s) and marking that, also stopping the search
  256. * - when scrolling we scroll to the last tweet in the timeline, then wait for tweets to be injected;
  257. * - we scroll every new tweet into view, until we hit a max (to prevent endless loop), or find
  258. * an 'old' tweet and then stop scrolling them into view.
  259. *
  260. * Using the following 'global' settings:
  261. * AEG.maxScrollInjects : (int) sets the max amount of tweets we allow to be loaded before we stop to scroll
  262. */
  263. AEG.scrollToLastReadHandler = function(event) {
  264. var lastReadID = AEG.getLastUrlReadID();
  265. if ( lastReadID === undefined ) {
  266. return;
  267. }
  268.  
  269. // Only initiate if the last read tweet isn't already in the list (last tweet is newer (larger ID than) lastTweet(ID)).
  270. var lastChild = document.querySelector('.stream > .stream-items > .stream-item:last-child');
  271.  
  272. //var tweetChild = lastChild.querySelector('div.js-stream-tweet');
  273. var tweetID = AEG.getTweetIDFromElement(lastChild, false); // 3 Nov 2012, before this used to use tweetChild
  274.  
  275. if ( tweetID > lastReadID ) {
  276. AEG.countScrollInjects = 0;
  277. AEG.isScrolling = true;
  278.  
  279. lastChild.scrollIntoView(false);
  280. } else {
  281. // the last-read tweet is on the current page already, find it and scroll to it
  282. // Ignore retweets, liked tweets and the "while you were away" block.
  283. var lastReadTweet = document.querySelector('.stream > .stream-items > .stream-item.is-read:not([data-component-context="follow_activity"]):not(.has-recap):not(.is-liked)');
  284. lastReadTweet.scrollIntoView(false);
  285. }
  286.  
  287. // stop the other click listener (on parent 'a' element) from being called
  288. event.stopPropagation();
  289. }
  290. AEG.createCookie = function(name,value,days) {
  291. try {
  292. var expires = "";
  293. if (days) {
  294. var date = new Date();
  295. date.setTime(date.getTime()+(days*24*60*60*1000));
  296. expires = "; expires="+date.toGMTString();
  297. }
  298. document.cookie = name+"="+value.replace(/"/g,'\'')+expires+"; path=/"; // replace the JSON double quotes with single ones
  299. } catch (exc) {
  300. AEG.debugHandleException('AEG.createCookie', exc);
  301. }
  302. };
  303. AEG.readCookie = function(name) {
  304. try {
  305. var nameEQ = name + "=";
  306. var ca = document.cookie.split(';');
  307. for( var i=0; i < ca.length; i++ ) {
  308. var c = ca[i];
  309. while ( c.charAt(0) == ' ' ) {
  310. c = c.substring(1,c.length);
  311. }
  312. if ( c.indexOf(nameEQ) === 0 ) {
  313. return c.substring(nameEQ.length,c.length).replace(/'/g, '"');
  314. }
  315. }
  316. return null;
  317. } catch (exc) {
  318. AEG.debugHandleException('AEG.readCookie', exc);
  319. }
  320. };
  321. AEG.eraseCookie = function(name) {
  322. try {
  323. createCookie(name,"",-1);
  324. } catch (exc) {
  325. AEG.debugHandleException('AEG.eraseCookie', exc);
  326. }
  327. };
  328. AEG.debugHandleException = function(title, message) {
  329. if ( AEG.debug ) {
  330. alert(title +'\n\n'+ message);
  331. }
  332. }
  333. AEG.log = function(log) {
  334. try {
  335. if ( AEG.debug && console != null ) {
  336. console.log(log);
  337. }
  338. } catch (e) {
  339. // silent
  340. }
  341. }
  342. // get the last read Tweet ID based on the URL (to support lists)
  343. AEG.getLastUrlReadID = function() {
  344. try {
  345. var lastRead = AEG.getLastReadID();
  346. return lastRead[AEG.getPageKey()];
  347. } catch (e) {
  348. AEG.log(e);
  349. }
  350. }
  351. // set the last read Tweet ID based on the URL (to support lists)
  352. AEG.setLastUrlReadID = function(id) {
  353. try {
  354. var lastRead = AEG.getLastReadID();
  355. lastRead[AEG.getPageKey()] = id;
  356. AEG.createCookie('AEG_lastReadID', JSON.stringify(lastRead), 365);
  357. } catch (e) {
  358. AEG.log(e);
  359. }
  360. }
  361. // returns the object from a cookie, used by both get and set
  362. AEG.getLastReadID = function() {
  363. try {
  364. // if this is just a number, convert it to the new structure
  365. var lastRead = AEG.readCookie('AEG_lastReadID');
  366. if (null == lastRead) {
  367. return {};
  368. } else if ( !isNaN(MyBigNumber(lastRead)) ) {
  369. lastRead = {'twitter.com/': lastRead};
  370. AEG.createCookie('AEG_lastReadID', JSON.stringify(lastRead), 365);
  371. return lastRead;
  372. } else {
  373. return JSON.parse(lastRead);
  374. }
  375. } catch (e) {
  376. AEG.log(e);
  377. }
  378. return {};
  379. }
  380. // get key of lastRead by 'page'
  381. AEG.getPageKey = function() {
  382. var key = location.href.replace('http://','').replace('https://','').replace('#', '').replace('!/', '');
  383. return key;
  384. }
  385.  
  386. // get the correct tweet ID from a tweet div
  387. /**
  388. * param element DOM_Element : to get the ID from
  389. * param use_base boolean : return the 'data-item-id' even when this element is a retweet. This is needed for checking whether the last-read tweet is in view, because the retweet-id will be higher than the data-item-id
  390. * return int|MyBigNumber : MyBigNumber for normal tweets, or 0
  391. */
  392. AEG.getTweetIDFromElement = function(element, use_base) {
  393. var child = element.querySelector('div.original-tweet');
  394. if ( ! child || ! child.hasAttribute('data-item-id')) {
  395. return 0;
  396. }
  397. // Ignore liked tweets
  398. if (AEG.isLikedTweet(element)) {
  399. return 0;
  400. }
  401. // Ignore promoted tweets
  402. if (AEG.isPromotedTweet(element)) {
  403. return 0;
  404. }
  405. var tweetID = child.getAttribute('data-item-id').replace('-promoted', ''); //default value
  406. if ( tweetID.indexOf('_') > 0 ) {
  407. tweetID = tweetID.split('_')[3]; //@todo don't know what this is for anymore
  408. } else if ( !use_base ) {
  409. // try to see whether this is a retweet, if so set this tweet's id to the original ID
  410. if ( child.hasAttribute('data-retweet-id') ) {
  411. tweetID = child.getAttribute('data-retweet-id').replace('-promoted', '');
  412. }
  413. }
  414. return MyBigNumber(tweetID);
  415. }
  416. /**
  417. * param element DOM_Element : root tweet element to test
  418. * return boolean : true if the tweet is a retweet (and the tweet id can be very old, so needs special treatment).
  419. */
  420. AEG.isLikedTweet = function(element) {
  421. // Test liked tweets. See https://github.com/ArmEagle/userscripts/issues/3
  422. var context = element.querySelector('.context');
  423. return context && context.textContent.indexOf(' liked') >= 0;
  424. }
  425. /**
  426. * param element DOM_Element : root tweet element to test
  427. * return boolean : true if the tweet is a promoted tweet
  428. */
  429. AEG.isPromotedTweet = function(element) {
  430. return element.querySelector('div.tweet').hasAttribute('data-promoted');
  431. }
  432. /**
  433. * Make youtube embeds in tweets clickable such that you can open it in a new tab instead of opening
  434. * a local version (first).
  435. * Lazy overlay so the link isn't somehow hijacked. That completely disables the default funtionality.
  436. * Whereas the initial goal was to only have middle-click do its default job and keep the original
  437. * functionality on normal click. But I won't be using that anyway.
  438. * param element DOM_Element : tweet element to look for youtube video in.
  439. */
  440. AEG.makeClickableYoutube = function(element) {
  441. // Check script setting
  442. if (!AEG.addYoutubeOverlay) { return; }
  443. var player = element.querySelector('.card-type-player');
  444. if (!player) { return; }
  445. var url = player.getAttribute('data-card-url');
  446. if (!url) { return; }
  447. // no duplicates on rerun
  448. if (element.querySelector('.aeg-tweet-youtube-link')) {
  449. return;
  450. }
  451. var el_a = document.createElement('a');
  452. el_a.setAttribute('href', url);
  453. el_a.setAttribute('target', '_blank');
  454. el_a.setAttribute('class', 'aeg-tweet-youtube-link');
  455. // store parent of element so we can wrap it in our el_a.
  456. var el_parent = player.parentNode;
  457. el_a.appendChild(player);
  458. el_parent.appendChild(el_a);
  459. // add the transparent overlay.
  460. el_overlay = document.createElement('div');
  461. el_overlay.setAttribute('class', 'aeg-tweet-youtube-overlay');
  462. el_a.appendChild(el_overlay);
  463. }
  464.  
  465. // mark all read tweets (static content loaded with the page itself)
  466. var lastReadID = AEG.getLastUrlReadID();
  467. AEG.markRead(MyBigNumber(lastReadID), false);
  468.  
  469. function MyBigNumber(value) {
  470. function BigNumber(value) {
  471. var valueSize = 24; // number of 'digits' to use so we can always do string comparison of tweet id's by prepending zero's
  472. var value = String(value);
  473.  
  474. this.padzeros = function(val) {
  475. while (val.length < valueSize) {
  476. val = '0' + val;
  477. }
  478. return val;
  479. }
  480. this.toJSON = this.toString = this.valueOf = function() {
  481. return this.padzeros(value);
  482. }
  483. }
  484. return new BigNumber(value);
  485. }
  486.  
  487. AEG.addButtonBar();
  488. }
  489.  
  490. function CSS_script() {
  491. var style = document.getElementsByTagName('head')[0].appendChild(document.createElement('style'));
  492. style.textContent = "\
  493. .stream-item.is-read {\
  494. opacity: 0.8;\
  495. border-top: 1px solid #e8e8e8;\
  496. border-left: 3px solid #3377ee;\
  497. }\
  498. .stream-item.is-read ~ .stream-item.is-read-liked {\
  499. border-left: 3px solid #9955ee;\
  500. }\
  501. .stream-item.is-read:hover {\
  502. opacity: 1.0;\
  503. }\
  504. .stream-item:first-child,\
  505. .stream-item.is-read ~ .stream-item.is-read {\
  506. border-top: 0;\
  507. margin-top: 0 !important;\
  508. }\
  509. .stream-item.is-read.open {\
  510. opacity: 0.9;\
  511. }\
  512. .stream-item.open > .expansion-container > .original-tweet {\
  513. border-left: 3px solid;\
  514. border-right: 3px solid;\
  515. border-radius: 0;\
  516. }\
  517. #AEG-button-bar .box {\
  518. padding: 3px 12px 15px;\
  519. }\
  520. #AEG-button-bar .button {\
  521. display: inline-block;\
  522. margin: 10px 5px;\
  523. width: 24px;\
  524. height: 24px;\
  525. cursor: pointer;\
  526. }\
  527. #AEG-button-bar .button:hover {\
  528. opacity:0.7;\
  529. }\
  530. #AEG-button-bar #scroll-to-last {\
  531. background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAC9UlEQVRIid2VQYgcRRSGv38RCSGEJeSwrMsyIHhTNBACXgQxRBYRYsSjojCNIqLiNBEXu+mRGEJPQDCg1EDQmwbjIYgYIupNYyQQyEEwyBDWJSyyhCUMewj5PUz3TO3MhA3etKCp5tX//v+9V/Wq4L8+tB2g2cp3STwF7Lc9D0JixXBR8EMoi/6/EkjSfDewbPtVYLcE9gTspqRTwIlQFrfuWaDZyvZJOgs0MJuGc4gLgh4wAzSMDwk9A9wPXLN9uNtpX91WIEmzfTY/DqLW1zZvdDvF6vQss0XMJ0hLwLrNE91OsUVEWx3yWdtXgEVJH4KXQ9mexh2LzNg6CX4LuCb0WOiMynXfGD6XtAicAZZD2abZyh6V9Mg0ctuXQ9m+mqT5O6CHgCXgKPD+RAZV9H9JwvaD3U77RmVfsH1F0h7bVOtIWgMeDmWxVpfL5g9JfeCB+nTNRNE8Dey0/VVNDhDKYkXweoSrf5s1+QDXvg58Y3vW9pO1fSgg6YAkEOcnSoG+AM5IovpOh7I4N46TdL5aPzAhACzYRqY37tjtFBi/BqwCf9p+exxTZdcbzCzUti2bLAngTmxrptmc0GxFcALoS5pP0nzeeL1bttcigjuDaeQfC6xWm9cAfhn6oAXbP4OG2GofNoX2A2sjLI2KY9g3cYkuVc4H4wxCWfwGfFBHpVF4y2GsqcAHq/VL0wS+lbQp6YWkle2N3QZNx681uaSfJH0UY5ppNg96FtgAvp8QCGWxDpy22QWcTNIszuI28JLtvu0NzMuhLIZ7laQ5mI9t77D9aXzxxRkA5BI3DC+C3k3SPBb5HTgqeDN0it6IPAM4Juk5oCfpWEy4RSCUxd+2j1TdeBz4PC6XpFNIn0VlmQN9CbxXleZIKIuNmHPqdZ2k+eO2z4LmwLcYNNmF6pzPSGrYPgQ8D+wErks6HMri8jjX3R+cVr4XUdh+BdgR3UGjGfqCABShLG5O49n+yUzzPbKXkKonEyStABeB7+5G/P8Z/wACzV4hetnLFgAAAABJRU5ErkJggg==);\
  532. }\
  533. #AEG-button-bar #mark-all {\
  534. background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAC5ElEQVRIidWVT2gdVRTGf18IEksIQbqQUMpDshEqSKAUuhRDpahQKll2EXiDoKLiuypG5jJTqi3zCm8p80AQ3RjUIkqwRBQ3QikIUtyIiyAlZFFKCSGELPK5ePPa92doirseuByY+53vO+fMuffC4246DJCEOAt+CXTK9jEkBJuGm4K1ssju/i+BHjHRdgIckcAeg+0Bnwti2c7vPLJAs5UuSLoGHMfsGn+DdF2wARwYGphFiSVgGtiyfb7bzn8/VCAJccH2r8CMpFXbb3fb+VZtla30KOIq6AKwa3txVGRIIAlxxvafQAP4RNJKWWR13IPVIvGhzafAFvBcd6BdkyP4FUkN4DvwSllkJCHO256qI5e0XxbZ30krvQx6VuICkAFv9DET9zMJcdr268CezVtlkQNg/D1wS9KtGr8OULZzhN+zvQMsJyE+NVaB7BcNM7ZXu+1880EPFcCz1QA9Y/tJ0F+V+k4fV7bzO0krXbW9DJwFvhpukXRSAPb6YBvKIlsDSFrpJNJvwBSQlUW2X9OzdcEycLIvMDGwPWcb90Zx3KSW7dPAAhDrILY3Kj/X/zYogCQkTYzEkYT4PJBJ94fu/STE02M50IsdwA0J3HbvqDYGg5ohTtn+0uYJ21Rr0vYXzVY6PaLQqDhu1wncqMo7MxzDReBEP6l+dpLmQcVIEWeq/Rt1Ar9Iuifp5WYrPQ6QhHTG9gTQ6S/bHUkd2x3wXhLi0Qr7NPAasAv8NJDgA0tCvGjzsfAa4pWyyA94BEtCxPbXwBLQ6bbzd+sqALgi8Y/hrNHVJMSxH15HDlyStAT8K2nobhkiKItsB/ucpLuCd4AfmqHXrnrydA74FvgI2AbOlUV2bxBTf12HeAL7GmgevA/8KOl6NecHkhq2F4FX6R28DUnnyyL7Y5TrYQ/ONPCB7TeBWUnYZsjDtuAz4FJZZNt1PIc+mc0QjwheAE7ZHAMjaRO4CfxcFtnOIRSPuf0HkqRKoOco5hIAAAAASUVORK5CYII=);\
  535. }\
  536. .aeg-tweet-youtube-link {\
  537. position:relative;\
  538. width:100%;\
  539. display:inline-block;\
  540. }\
  541. .aeg-tweet-youtube-overlay {\
  542. position: absolute;\
  543. left:0;\
  544. top:0;\
  545. width:100%;\
  546. height:100%;\
  547. }\
  548. .separated-module.has-recap, .tweet.promoted-tweet {\
  549. display: none;\
  550. }\
  551. li[data-component-context=suggest_who_to_follow] {\
  552. display: none;\
  553. }\
  554. ";
  555. }
  556. CSS_script();
  557.  
  558. function init() {
  559. trigger = document.querySelector('.stream > .stream-items > .stream-item:first-child div.tweet');
  560. if ( trigger != null ) {
  561. // if (document.querySelector('.stream > .stream-items > .stream-item:first-child div.tweet')) {
  562. try {
  563. DOM_script();
  564. console.log('twitter last read user is done loading');
  565. } catch(e) {
  566. console.log(e);
  567. }
  568. // }
  569. } else {
  570. window.setTimeout(function() {init();}, 1000);
  571. }
  572. }
  573. init();