Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Last active December 20, 2015 14:59
Show Gist options
  • Save rudiedirkx/6151310 to your computer and use it in GitHub Desktop.
Save rudiedirkx/6151310 to your computer and use it in GitHub Desktop.
rweb://twitter.com
html, body {
background: white !important;
line-height: 1.4;
}
.wrapper, .wrapper-narrow, .wrapper-permalink {
width: 1100px;
}
.content-main {
width: 787px;
}
.stats {
display: -webkit-flex;
}
.stats > li {
display: block;
overflow: hidden;
}
.stats > li:not(.avatar-row) {
width: 100px;
}
.stats > li > a {
padding: 4px 6px;
}
.rudie-read-it-button,
.what-has-rudie-read {
float: right;
padding: 2px 10px;
background-color: red;
color: white;
font-weight: bold;
border-radius: 6px;
cursor: pointer;
}
.what-has-rudie-read {
background-color: green;
padding: 2px 5px;
margin-right: 10px;
}
.rudie-read-it-button.loading:before,
.what-has-rudie-read.loading:before {
content: "? ";
}
#stream-items-id > li.rudie-read-it,
#stream-items-id > li.rudie-read-it ~ li {
background-color: rgba(255, 255, 255, 0.5);
}
#timeline-load-timer:before {
content: ' (';
}
#timeline-load-timer:after {
content: ' s)';
}
.tweet:hover {
background: transparent none;
}
.tweet-actions, .tweet-actions * {
display: inline;
}
.tweet-actions .more-tweet-actions {
display: none;
}
.stream .stream-item .tweet-actions, .stream .stream-item.open .tweet-actions, .stream .stream-item-activity .stream-item-footer .tweet-actions, .stream .stream-item.open .expanded-conversation .original-tweet-container .tweet-actions {
background: none;
box-shadow: none;
}
ready(function() {
(function(XHR) {
var oOpen = XHR.open;
XHR.open = function(method, url, async) {
this.method = method;
this.url = url;
window.jQuery && jQuery(window).trigger(jQuery.Event('xhrOpen', {target: this}));
return oOpen.apply(this, arguments);
};
var oSend = XHR.send;
XHR.send = function(data) {
this.data = data;
window.jQuery && jQuery(window).trigger(jQuery.Event('xhrSend', {target: this}));
return oSend.apply(this, arguments);
};
})(XMLHttpRequest.prototype);
});
load(function() {
if (console.log != console.constructor.prototype.log) {
console.log = console.constructor.prototype.log;
}
jQuery('.js-timeline-title').append('<span id="timeline-load-timer">?</span> <span id="timeline-load-timer-avg">?</span>');
window.timelineLoadTimerReset = Date.now();
window.timelineLoadTimerAvg = [];
setInterval(function() {
var time = ~~((Date.now() - window.timelineLoadTimerReset)/1000),
$timer = document.getElementById('timeline-load-timer');
$timer.textContent = time;
}, 100);
jQuery(window).on('xhrOpen', function(e) {
e.target.intercept = e.target.url.indexOf('/timeline') != -1;
});
jQuery(window).on('xhrOpen', function(e) {
if (e.target.intercept) {
setTimeout(function() {
window.timelineLoadTimerAvg.push(~~((Date.now() - window.timelineLoadTimerReset)/1000));
document.getElementById('timeline-load-timer-avg').textContent =
~~(window.timelineLoadTimerAvg.reduce(function(a, b) {
return a + b;
}) / window.timelineLoadTimerAvg.length);
window.timelineLoadTimerReset = Date.now();
}, 1234);
// setTimeout("document.querySelector('.what-has-rudie-read').click()", 2000);
}
});
});
ready(function() {
var $title = document.querySelector('.js-timeline-title');
var $mark = document.createElement('button');
$mark.innerHTML = 'Mark all READ';
$mark.className = 'rudie-read-it-button';
$title.parentNode.insertBefore($mark, $title.parentNode.firstElementChild);
$title.parentNode.classList.add('clearfix');
$mark.addEventListener('click', function(e) {
var $list = document.querySelector('#stream-items-id'),
$li = $list.firstElementChild;
$li.classList.add('rudie-read-it');
$mark.classList.add('loading');
var lastRead = $li.dataset.itemId;
var xhr = new XMLHttpRequest;
xhr.open('post', 'http://hotblocks.nl/object-store.php', true);
xhr.onreadystatechange = function(e) {
if ( this.readyState == 4 && this.status == 200 ) {
$mark.classList.remove('loading');
}
};
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.send('put=twitter.lastread&value=' + encodeURIComponent(JSON.stringify(lastRead)));
});
var $update = document.createElement('button');
$update.innerHTML = 'R';
$update.className = 'what-has-rudie-read';
$title.parentNode.insertBefore($update, $title.parentNode.lastElementChild);
$update.addEventListener('click', updateReadItems);
$update.classList.add('loading');
updateReadItems();
function updateReadItems() {
$update.classList.add('loading');
var xhr = new XMLHttpRequest;
xhr.open('get', 'http://hotblocks.nl/object-store.php?get=twitter.lastread', true);
xhr.onreadystatechange = function(e) {
if ( this.readyState == 4 && this.status == 200 ) {
var lastRead = JSON.parse(this.responseText).value;
var $li = document.querySelector('li[data-item-id="' + lastRead + '"]');
$li && $li.classList.add('rudie-read-it');
$update.classList.remove('loading');
}
};
xhr.send();
}
});
{"host": "twitter.com"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment