Skip to content

Instantly share code, notes, and snippets.

@0mg
Last active November 1, 2016 10:50
Show Gist options
  • Save 0mg/3fe7b67058b01a632c1fa880349795cd to your computer and use it in GitHub Desktop.
Save 0mg/3fe7b67058b01a632c1fa880349795cd to your computer and use it in GitHub Desktop.
twchvs.zip\omittr.html
<!DOCTYPE html>
<style>
#node_conts{font-family:monospace}
p{word-wrap:break-word;white-space:pre;margin:1ex 0;padding:0 0 1ex;border-bottom:1px solid #000;}
p[data-omit="1"]{color:#ccc}
</style>
<script>
var Grailbird = {data:{}};
var stt_ok = false;
try {
var sto = JSON.parse(localStorage.twchvsomittr);
stt_ok = true;
} catch(e) {
var sto = {};
stt_ok = false;
if (confirm("localStorage is broken. reset it?") && confirm("!!DANGER!! SURE?")) stt_ok = true;
}
</script>
<script src="data/js/tweet_index.js"></script>
<script>
addEventListener("load", function() {
for(var i=0; i<tweet_index.length; ++i){
var script = document.createElement("script");
script.src = tweet_index[i].file_name;
document.body.appendChild(script);
}
var mt = Date.now();
var tmr = setInterval(function() {
if (Object.keys(Grailbird.data).length >= tweet_index.length ||
Date.now() - mt > 1000 * 10) {
clearInterval(tmr);
mkbtns();
}
}, 300);
});
function mkbtns() {
var ts = Grailbird.data;
for (var i in ts) {
var btn = document.createElement("input");
btn.type = "button";
btn.value = i.slice(7);
btn.name = i;
btn.addEventListener("click", function(e) {
var it = e.target;
document.title = it.value;
node_conts.textContent = "";
ts[it.name].forEach(function(e){
var p = document.createElement("p");
p.id = "t" + e.id_str;
p.innerHTML = e.text;
if (sto[p.id]) p.dataset.omit = 1;
if (stt_ok) p.addEventListener("click", function() {
if (p.dataset.omit ^= 1) sto[p.id] = 1;
else delete sto[p.id];
localStorage.twchvsomittr = JSON.stringify(sto);
});
node_conts.appendChild(p);
});
});
node_btns.appendChild(btn);
}
}
</script>
<title>init</title>
<div id="node_btns"></div>
<div id="node_conts"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment