By 22century
—
Last update
Aug 5, 2008
—
Installed
49 times.
// ==UserScript==
// @name chatview
// @namespace 22century.cute.bz
// @include http://twitter.com/home*
// @include http://twitter.com/favorites*
// ==/UserScript==
var d = document;
var ents = class(id("content"), "hentry");
var ents_len = ents.length;
var stot = "";
var ent;
var run = d.createElement("a");
tag( id("navigation"), "ul" )[0].appendChild( d.createElement("li") ).appendChild(run);
run.textContent = "Chat view";
run.style.cssText = "cursor:pointer;";
run.addEventListener("click", function()
{
for ( var i=0; i<ents_len; i++ ) {
ent = ents[i];
stot = [ trim(tag(ent,"strong")[0].textContent)
+ " : " + trim(class(ent,"entry-content")[0].textContent)
+ " [" + trim(class(ent,"entry-date")[0].href + "]") , stot].join("\n");
}
var pop = d.createElement("div");
var close = d.createElement("a");
var area = d.createElement("textarea");
pop.style.cssText = "position:absolute;left:10px;top:10px;width:400px;height:400px;background:#f8f8f8;border:solid 1px #a9a9a9;padding:0 1em 1em 1em;";
area.style.cssText = "font:10pt sans-serif;width:100%;height:95%;";
area.value = stot;
close.textContent = "close";
close.style.cssText = "cursor:pointer;";
close.addEventListener("click", function(){d.body.removeChild(pop)}, false);
d.body.appendChild(pop);
pop.appendChild(close);
pop.appendChild(area);
}
, false);
function id(v){return d.getElementById(v)}
function class(e,v){return e.getElementsByClassName(v)}
function tag(e,v){return e.getElementsByTagName(v)}
function trim(v){return v.replace(/^\s+|\s+$/g,"")}