From e9cef70f892bfbf4aad0e4471a958367766d849a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 3 Jan 2009 03:30:03 +0000 Subject: * Updates the sim stats module. Cleans out some of the rot. * Adds a prototype web stats module which is disabled by default. It's functional with one report right now, however, the database structure may change, so I don't recommend enabling this to keep actual stats right now. I'll let you know when it's safe. * Adds Prototype for ajaxy web content * removed a warning or two. --- bin/data/updater.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bin/data/updater.js (limited to 'bin/data/updater.js') diff --git a/bin/data/updater.js b/bin/data/updater.js new file mode 100644 index 0000000..20201f8 --- /dev/null +++ b/bin/data/updater.js @@ -0,0 +1,20 @@ +var updater = Class.create({ + initialize: function(divToUpdate, interval, file) { + this.divToUpdate = divToUpdate; + this.interval = interval; + this.file = file; + new PeriodicalExecuter(this.getUpdate.bind(this), this.interval); + }, + + getUpdate: function() { + var oOptions = { + method: "POST", + parameters: "intervalPeriod="+this.interval, + asynchronous: true, + onComplete: function (oXHR, Json) { + $(this.divToUpdate).innerHTML = oXHR.responseText; + } + }; + var oRequest = new Ajax.Updater(this.divToUpdate, this.file, oOptions); + } +}); \ No newline at end of file -- cgit v1.1