Something like this could be interesting for beehive...
Ignore the shoddyness of the code - i was just trying to knock something up quickly.
javascript code: <!DOCTYPE html>
<html>
<head>
<title>Page</title>
<script type="text/javascript" src="../gears_init.js"></script>
<script>
var db;
function initDatabase() {
if (window.google && google.gears) {
try {
db = google.gears.factory.create('beta.database');
if (db) {
db.open('database-usernames');
db.execute('create table if not exists Usernames (Username varchar(255),DisplayName varchar(255), Timestamp int)');
db.execute('create unique index if not exists username_unique_1 on Usernames (Username)');
}
} catch (ex) {}
}
}
function parsePage(){
initDatabase();
if (db) {
var regex = /openProfile.*\>(.*?)\s*(\((.*)\))?<\/a\>/gi;
var matches = document.body.innerHTML.match();
while((m = regex.exec(document.body.innerHTML)) != null){
var displayname = m[1];
var username = (m[3]!=null?m[3]:m[1]).toUpperCase();
db.execute('insert or ignore into Usernames values (?, ?, ?)', [username, displayname, new Date().getTime()]);
}
}
}
function autoComplete (e){
if (db){
if( e == null ) e = window.event
if( e.keyCode == 16 )
return;
var box = document.getElementById('namebox');
var boxvalue = box.value;
if ( e.keyCode == 8)
return;
if (boxvalue.length > 0){
var rs = db.execute('select * from Usernames where Username like ? order by Username asc limit 0,1', [boxvalue+'%']);
while (rs.isValidRow()) {
var returnval = rs.field(0);
box.value = returnval;
if( box.createTextRange )
{
hRange = hElement.createTextRange()
hRange.findText( returnval.substr(boxvalue.length) )
hRange.select()
}else{
box.setSelectionRange( boxvalue.length, returnval.length)
}
rs.next();
}
rs.close();
}
}
}
</script>
</head>
<body onload="parsePage();">
<span class="posttofrom"><a href="user_profile.php?webtag=DEFAULT&uid=95" target="_blank" onclick="return openProfile(95, 'DEFAULT')">Mouse</a></span>
<span class="posttofrom"><a href="user_profile.php?webtag=DEFAULT&uid=19" target="_blank" onclick="return openProfile(19, 'DEFAULT')">Matt</a></span>
<a href="user_profile.php?webtag=DEFAULT&uid=27" target="_blank" onclick="return openProfile(27, 'DEFAULT')">Mikee</a></span>
<span class="posttofrom"><a href="user_profile.php?webtag=DEFAULT&uid=454" target="_blank" onclick="return openProfile(454, 'DEFAULT')">Peter (BOUGHTONP)</a></span>
<br /><br /><input type="text" id="namebox" style="width: 400px;" onkeyup="autoComplete()" />
</body>
</html>
It finds all the usernames on the page and puts them into a local database. Over time it could just keep collecting these..
On search boxes you could do a kind of autocomplete to automatically suggest the username they've started typing.
The way I see it, it wont matter if they don't have gears installed because it won't break any current functionality.
They're only likely to reply to someone who's post they've read, so it should always suggest the name they're trying to type.
Dunno, just an idea. quite simple way to add a tiny tweak to the functionality without any backend code.
|