From 72e5fa568ed44c0903dd845118214c9009792eae Mon Sep 17 00:00:00 2001
From: erdgeist <>
Date: Tue, 10 Jun 2008 19:47:32 +0000
Subject: Now we do Ajax ourselves, no need for the expensive prototype
framwork.
---
ajax.html | 3 +-
parsemail.js | 32 +-
prototype-1.6.0.2.js | 4222 --------------------------------------------------
3 files changed, 31 insertions(+), 4226 deletions(-)
delete mode 100644 prototype-1.6.0.2.js
diff --git a/ajax.html b/ajax.html
index bed9ce1..13120dd 100644
--- a/ajax.html
+++ b/ajax.html
@@ -7,8 +7,7 @@
anonbox mail reader :: Chaos Computer Club
-
-
+
diff --git a/parsemail.js b/parsemail.js
index fe75f75..e25e573 100644
--- a/parsemail.js
+++ b/parsemail.js
@@ -1,9 +1,37 @@
window.onload=function() {
var url = "/" + window.location.search.substring(1);
+ var xmlHttp = null;
+
+ if (typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); }
+ if (!xmlHttp ) {
+ try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch(e) {
+ try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch(e) { xmlHttp = null; }
+ }
+ }
+
+ if (xmlHttp) {
+ xmlHttp.open('GET', url, true);
+ xmlHttp.onreadystatechange = function () { if( xmlHttp.readyState == 4 ) { handleComplete(xmlHttp); } };
+ if( xmlHttp.overrideMimeType != null ) {
+ xmlHttp.overrideMimeType('text/plain; charset=x-user-defined');
+ }
+ xmlHttp.send(null);
+ }
- document.getElementById( "content" ).innerHTML = "Fetching Mailbox... (this may take a while, please be patient...)
";
+ document.getElementById( "content" ).innerHTML = "Fetching Mailbox... " + url + " (this may take a while, please be patient...)
";
+}
- new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { parsemail(transport.responseText); } });
+function handleComplete(transport) {
+ switch ( transport.status ) {
+ case 200: case 304:
+ parsemail(transport.responseText);
+ break;
+ default:
+ alert( "Oech" + transport.status + " " + transport.responseText );
+ break;
+ }
}
var myStates = {
diff --git a/prototype-1.6.0.2.js b/prototype-1.6.0.2.js
deleted file mode 100644
index 0b2f69f..0000000
--- a/prototype-1.6.0.2.js
+++ /dev/null
@@ -1,4222 +0,0 @@
-/* Prototype JavaScript framework, version 1.6.0.2
- * (c) 2005-2008 Sam Stephenson
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://www.prototypejs.org/
- *
- *--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.6.0.2',
-
- Browser: {
- IE: !!(window.attachEvent && !window.opera),
- Opera: !!window.opera,
- WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
- Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
- MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
- },
-
- BrowserFeatures: {
- XPath: !!document.evaluate,
- ElementExtensions: !!window.HTMLElement,
- SpecificElementExtensions:
- document.createElement('div').__proto__ &&
- document.createElement('div').__proto__ !==
- document.createElement('form').__proto__
- },
-
- ScriptFragment: '