Beautified html, sticky chat, dynamic inputs, beautified qr-code, fixed chat bug

This commit is contained in:
Robin 2012-01-26 17:22:44 +01:00
parent 622068183a
commit 57075d1545
8 changed files with 371 additions and 421 deletions

View file

@ -110,24 +110,6 @@ var padutils = {
var x = ua.split(' ')[0];
return clean(x);
},
// "func" is a function over 0..(numItems-1) that is monotonically
// "increasing" with index (false, then true). Finds the boundary
// between false and true, a number between 0 and numItems inclusive.
binarySearch: function(numItems, func)
{
if (numItems < 1) return 0;
if (func(0)) return 0;
if (!func(numItems - 1)) return numItems;
var low = 0; // func(low) is always false
var high = numItems - 1; // func(high) is always true
while ((high - low) > 1)
{
var x = Math.floor((low + high) / 2); // x != low, x != high
if (func(x)) high = x;
else low = x;
}
return high;
},
// e.g. "Thu Jun 18 2009 13:09"
simpleDateTime: function(date)
{
@ -489,4 +471,6 @@ window.onerror = function test (msg, url, linenumber)
return false;
};
padutils.binarySearch = require('/ace2_common').binarySearch;
exports.padutils = padutils;