Skip to content

Instantly share code, notes, and snippets.

@negipo
Created June 6, 2009 10:04
Show Gist options
  • Save negipo/124794 to your computer and use it in GitHub Desktop.
Save negipo/124794 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name TinyIkeda
// @namespace http://polog.org/
// @include http://*
// @include https://*
// ==/UserScript==
GM_addStyle('body{margin:0;padding:0;color:black;background-color:white;line-height:1;margin:0;padding:0;font-family:Gill Sans;font-size:10px;width: 100%;text-align: center;height:1em;overflow:hidden;}div.ikeda_box{line-height:1;}');
var cols = 500;
var rows = 100;
var char_codes = document.body.innerHTML.slice(0, cols).split('').map(function(e){
var char_code = ("" + e.charCodeAt());
return char_code.slice(char_code.length - 1);
}).join('');
var charsAt = function(){
var cache = {};
return function(i){
if(!!cache[i])
return cache[i];
return cache[i] = char_codes.slice(i) + char_codes.slice(0,i);
}
}();
var ats = [];
for(var j = 0; j <= rows; j++){
ats.push(Math.floor(Math.random() * cols));
}
setInterval(function(){
var i = 0;
var html = '';
for(var j = 0; j <= rows; j++){
i++;
ats[j] += (i % 2 == 0) ? 1 : -1;
if(ats[j] > cols)
ats[j] = 0;
if(ats[j] < 0)
ats[j] = cols - 1;
html += '<div class="ikeda_box">' + charsAt(ats[j]) + '</div>';
}
document.body.innerHTML = html;
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment