diff --git a/NEWS b/NEWS index 768a45e08..584836317 100644 --- a/NEWS +++ b/NEWS @@ -18,7 +18,7 @@ - improved support for multiple selection in tables and lists; - improved IE7 and Safari support: attendees selector, email file attachments; - updated PrototypeJS to version 1.6.0; -- improved address completion in attendees selector; +- improved address completion and freebusy timeline in attendees selector; - changed look of message composition window to Thunderbird 2.0; - countless bugfixes; diff --git a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar index a2ba2dbef..804c01e12 100644 --- a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar +++ b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar @@ -56,12 +56,12 @@ cssClass = "tbicon_delete"; label = "Delete"; tooltip = "Delete selected message or folder"; }, - { link = "#"; - isSafe = NO; - image = "tb-mail-junk-flat-24x24.png"; - cssClass = "tbicon_junk"; - label = "Junk"; - tooltip = "Mark the selected messages as junk"; }, +// { link = "#"; +// isSafe = NO; +// image = "tb-mail-junk-flat-24x24.png"; +// cssClass = "tbicon_junk"; +// label = "Junk"; +// tooltip = "Mark the selected messages as junk"; }, ), ( { link = "#"; diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 8eec9b4d4..e9e478c6a 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -59,6 +59,7 @@ NSString *componentOwner; NSString *attendeesNames; + NSString *attendeesUIDs; NSString *attendeesEmails; } @@ -107,6 +108,9 @@ - (void) setAttendeesNames: (NSString *) newAttendeesNames; - (NSString *) attendeesNames; +- (void) setAttendeesUIDs: (NSString *) newAttendeesUIDs; +- (NSString *) attendeesUIDs; + - (void) setAttendeesEmails: (NSString *) newAttendeesEmails; - (NSString *) attendeesEmails; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 5f108ba8c..2cc2db436 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -45,6 +45,7 @@ #import #import #import +#import #import #import #import @@ -65,6 +66,7 @@ componentOwner = @""; organizer = nil; attendeesNames = nil; + attendeesUIDs = nil; attendeesEmails = nil; calendarList = nil; } @@ -86,6 +88,7 @@ [cycleEnd release]; [url release]; [attendeesNames release]; + [attendeesUIDs release]; [attendeesEmails release]; [calendarList release]; @@ -96,10 +99,14 @@ { NSEnumerator *attendees; iCalPerson *currentAttendee; - NSMutableString *names, *emails; + NSMutableString *names, *uids, *emails; + NSString *uid; + LDAPUserManager *um; names = [NSMutableString new]; + uids = [NSMutableString new]; emails = [NSMutableString new]; + um = [LDAPUserManager sharedUserManager]; attendees = [[component attendees] objectEnumerator]; currentAttendee = [attendees nextObject]; @@ -107,12 +114,18 @@ { [names appendFormat: @"%@,", [currentAttendee cn]]; [emails appendFormat: @"%@,", [currentAttendee rfc822Email]]; + uid = [um getUIDForEmail: [currentAttendee rfc822Email]]; + if (uid != nil) + [uids appendFormat: @"%@,", uid]; + else + [uids appendString: @","]; currentAttendee = [attendees nextObject]; } if ([names length] > 0) { ASSIGN (attendeesNames, [names substringToIndex: [names length] - 1]); + ASSIGN (attendeesUIDs, [uids substringToIndex: [uids length] - 1]); ASSIGN (attendeesEmails, [emails substringToIndex: [emails length] - 1]); } @@ -242,6 +255,16 @@ return attendeesNames; } +- (void) setAttendeesUIDs: (NSString *) newAttendeesUIDs +{ + ASSIGN (attendeesUIDs, newAttendeesUIDs); +} + +- (NSString *) attendeesUIDs +{ + return attendeesUIDs; +} + - (void) setAttendeesEmails: (NSString *) newAttendeesEmails { ASSIGN (attendeesEmails, newAttendeesEmails); diff --git a/UI/Templates/SchedulerUI/UIxComponentEditor.wox b/UI/Templates/SchedulerUI/UIxComponentEditor.wox index 16ad19fcd..ec1610904 100644 --- a/UI/Templates/SchedulerUI/UIxComponentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxComponentEditor.wox @@ -75,6 +75,8 @@ var:value="privacy"/> + + diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index a58c509d5..31da8b177 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -764,4 +764,4 @@ function initContacts(event) { } } -addEvent(window, 'load', initContacts); +FastInit.addOnLoad(initContacts); diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index bce12ad7f..ea83dc471 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -1169,8 +1169,8 @@ function openInbox(node) { mailboxTree.o(1); } -function initMailer(event) { - if (!document.body.hasClassName("popup")) { +function initMailer(event) { log ("initMailer"); + if (!$(document.body).hasClassName("popup")) { // initDnd(); initMailboxTree(); initMessageCheckTimer(); @@ -1652,7 +1652,7 @@ function getMenus() { return menus; } -addEvent(window, 'load', initMailer); +FastInit.addOnLoad(initMailer); function Mailbox(type, name) { this.type = type; diff --git a/UI/WebServerResources/SOGoRootPage.js b/UI/WebServerResources/SOGoRootPage.js index 6f4392d0a..cad1169e0 100644 --- a/UI/WebServerResources/SOGoRootPage.js +++ b/UI/WebServerResources/SOGoRootPage.js @@ -38,4 +38,4 @@ function onLoginCallback(http) { } } -addEvent(window, 'load', initLogin); +FastInit.addOnLoad(initLogin); diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index d68fa0c79..c1b1f1d34 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1660,4 +1660,4 @@ function initCalendars() { } } -addEvent(window, 'load', initCalendars); +FastInit.addOnLoad(initCalendars); diff --git a/UI/WebServerResources/UIxAclEditor.js b/UI/WebServerResources/UIxAclEditor.js index 4bce62136..2aee3cfc7 100644 --- a/UI/WebServerResources/UIxAclEditor.js +++ b/UI/WebServerResources/UIxAclEditor.js @@ -142,4 +142,4 @@ function onAclLoadHandler() { this.userRightsWidth = window.opener.getUsersRightsWindowWidth(); } -addEvent(window, 'load', onAclLoadHandler); +FastInit.addOnLoad(onAclLoadHandler); diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index 3fbb57584..6dd1cd4a9 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -286,4 +286,4 @@ function onAppointmentEditorLoad() { initTimeWidgets(widgets); } -addEvent(window, 'load', onAppointmentEditorLoad); +FastInit.addOnLoad(onAppointmentEditorLoad); diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index dff86b27b..297151aef 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -1,9 +1,9 @@ var resultsDiv; -var searchField; var running = false; var address; var delay = 500; var requestField; +var searchField; var awaitingFreeBusyRequests = new Array(); var additionalDays = 2; @@ -11,6 +11,7 @@ var dayStartHour = 8; var dayEndHour = 18; var attendeesNames; +var attendeesUIDs; var attendeesEmails; function onContactKeydown(event) { @@ -57,16 +58,17 @@ function onContactKeydown(event) { } function triggerRequest() { - if (document.contactLookupAjaxRequest) { - document.contactLookupAjaxRequest.aborted = yes; - document.contactLookupAjaxRequest.abort(); + if (requestField) { + if (document.contactLookupAjaxRequest) { + document.contactLookupAjaxRequest.aborted = yes; + document.contactLookupAjaxRequest.abort(); + } + var urlstr = ( UserFolderURL + "Contacts/contactSearch?search=" + + escape(requestField.value) ); + document.contactLookupAjaxRequest = triggerAjaxRequest(urlstr, + updateResults, + requestField); } - var urlstr = ( UserFolderURL + "Contacts/contactSearch?search=" - + escape(requestField.value) ); - //log (urlstr); - document.contactLookupAjaxRequest = triggerAjaxRequest(urlstr, - updateResults, - requestField); } function updateResults(http) { @@ -74,7 +76,7 @@ function updateResults(http) { var menu = $('attendeesMenu'); var list = menu.down("ul"); - searchField = http.callbackData; + searchField = http.callbackData; // requestField searchField.hasfreebusy = false; if (http.status == 200) { @@ -123,9 +125,9 @@ function updateResults(http) { if (data.length == 1) { var contact = data[0]; if (contact["uid"].length > 0) - searchField.uid = contact["uid"]; + searchField.setAttribute("uid", contact["uid"]); else - searchField.uid = null; + searchField.setAttribute("uid", null); var completeEmail = contact["name"] + " <" + contact["email"] + ">"; if (contact["name"].substring(0, searchField.value.length).toUpperCase() == searchField.value.toUpperCase()) @@ -153,29 +155,13 @@ function updateResults(http) { function onAttendeeResultClick(event) { if (searchField) { - searchField.uid = this.uid; + searchField.setAttribute("uid", this.getAttribute("uid")); searchField.value = this.firstChild.nodeValue.trim(); searchField.confirmedValue = searchField.value; searchField.blur(); // triggers checkAttendee function call } } -function UIDLookupCallback(http) { - if (http.readyState == 4) { - if (http.status == 200) { - var searchField = http.callbackData; - var start = searchField.value.length; - var text = http.responseText.split(":"); - if (text[0].length > 0) { - searchField.uid = text[0]; - displayFreeBusyForNode(searchField); - } - else - searchField.uid = null - } - } -} - function resetFreeBusyZone() { var table = $("freeBusy"); var row = table.tHead.rows[2]; @@ -270,6 +256,9 @@ function newAttendee(event) { } function checkAttendee() { + if (document.currentPopupMenu) + hideMenu(document.currentPopupMenu); + if (document.currentPopupMenu && !this.confirmedValue) { // Hack for IE7; blur event is triggered on input field when // selecting a menu item @@ -277,53 +266,56 @@ function checkAttendee() { if (visible) return; } + this.focussed = false; - var th = this.parentNode.parentNode; - var tbody = th.parentNode; + var row = this.parentNode.parentNode; + var tbody = row.parentNode; if (tbody && this.value.trim().length == 0) - tbody.removeChild(th); + tbody.removeChild(row); else if (!this.hasfreebusy) { if (this.confirmedValue) this.value = this.confirmedValue; displayFreeBusyForNode(this); this.hasfreebusy = true; } - resetAttendeesValue(); + + requestField = null; + searchField = null; } function displayFreeBusyForNode(node) { - if (document.contactFreeBusyAjaxRequest) + var nodes = node.parentNode.parentNode.cells; + if (node.getAttribute("uid")) { + if (document.contactFreeBusyAjaxRequest) awaitingFreeBusyRequests.push(node); - else { - var nodes = node.parentNode.parentNode.cells; - if (node.uid) { - for (var i = 1; i < nodes.length; i++) { - $(nodes[i]).removeClassName("noFreeBusy"); - nodes[i].innerHTML = ('' - + '' - + '' - + ''); - } - if (document.contactFreeBusyAjaxRequest) { - document.contactFreeBusyAjaxRequest.aborted = true; - document.contactFreeBusyAjaxRequest.abort(); - } - var sd = $('startTime_date').valueAsShortDateString(); - var ed = $('endTime_date').valueAsShortDateString(); - var urlstr = ( UserFolderURL + "../" + node.uid + "/freebusy.ifb/ajaxRead?" - + "sday=" + sd + "&eday=" + ed + "&additional=" + - additionalDays ); - document.contactFreeBusyAjaxRequest - = triggerAjaxRequest(urlstr, - updateFreeBusyData, - node); - } else { - for (var i = 1; i < nodes.length; i++) { - $(nodes[i]).addClassName("noFreeBusy"); - nodes[i].innerHTML = ''; - } + else { + for (var i = 1; i < nodes.length; i++) { + $(nodes[i]).removeClassName("noFreeBusy"); + $(nodes[i]).innerHTML = ('' + + '' + + '' + + ''); } - } + if (document.contactFreeBusyAjaxRequest) { + document.contactFreeBusyAjaxRequest.aborted = true; + document.contactFreeBusyAjaxRequest.abort(); + } + var sd = $('startTime_date').valueAsShortDateString(); + var ed = $('endTime_date').valueAsShortDateString(); + var urlstr = ( UserFolderURL + "../" + node.getAttribute("uid") + "/freebusy.ifb/ajaxRead?" + + "sday=" + sd + "&eday=" + ed + "&additional=" + + additionalDays ); + document.contactFreeBusyAjaxRequest + = triggerAjaxRequest(urlstr, + updateFreeBusyData, + node); + } + } else { + for (var i = 1; i < nodes.length; i++) { + $(nodes[i]).addClassName("noFreeBusy"); + $(nodes[i]).update(); + } + } } function setSlot(tds, nbr, status) { @@ -362,22 +354,6 @@ function updateFreeBusyData(http) { } } -function resetAttendeesValue() { - var table = $("freeBusy"); - var inputs = table.getElementsByTagName("input"); - for (var i = 0; i < inputs.length - 2; i++) { - var currentInput = inputs[i]; - var uid = currentInput.getAttribute("uid"); - if (uid) { - currentInput.uid = uid; - currentInput.setAttribute("uid", null); - } - currentInput.setAttribute("autocomplete", "off"); - } - inputs[inputs.length - 2].setAttribute("autocomplete", "off"); - Event.observe(inputs[inputs.length - 2], "click", newAttendee); -} - function resetAllFreeBusys() { var table = $("freeBusy"); var inputs = table.getElementsByTagName("input"); @@ -409,25 +385,33 @@ function initializeWindowButtons() { function onEditorOkClick(event) { preventDefault(event); - + attendeesNames = new Array(); + attendeesUIDs = new Array(); attendeesEmails = new Array(); - + var table = $("freeBusy"); var inputs = table.getElementsByTagName("input"); for (var i = 0; i < inputs.length - 2; i++) { var name = extractEmailName(inputs[i].value); - if (!(name && name.length > 0)) - name = inputs[i].uid; var email = extractEmailAddress(inputs[i].value); + var uid = ""; + if (inputs[i].getAttribute("uid")) + uid = inputs[i].getAttribute("uid"); + if (!(name && name.length > 0)) + if (inputs[i].uid) + name = inputs[i].uid; + else + name = email; var pos = attendeesEmails.indexOf(email); if (pos == -1) pos = attendeesEmails.length; attendeesNames[pos] = name; + attendeesUIDs[pos] = uid; attendeesEmails[pos] = email; } - parent$("attendeesNames").value = attendeesNames.join(","); + parent$("attendeesUIDs").value = attendeesUIDs.join(","); parent$("attendeesEmails").value = attendeesEmails.join(","); window.opener.refreshAttendees(); @@ -507,7 +491,6 @@ function onTimeDateWidgetChange(event) { prepareTableHeaders(); prepareTableRows(); redisplayFreeBusyZone(); - resetAttendeesValue(); resetAllFreeBusys(); } @@ -563,53 +546,52 @@ function prepareTableRows() { function prepareAttendees() { var value = parent$("attendeesNames").value; + var table = $("freeBusy"); if (value.length > 0) { attendeesNames = parent$("attendeesNames").value.split(","); + attendeesUIDs = parent$("attendeesUIDs").value.split(","); attendeesEmails = parent$("attendeesEmails").value.split(","); - var body = $("freeBusy").tBodies[0]; + var tbody = table.tBodies[0]; + var model = tbody.rows[tbody.rows.length - 1]; + var newAttendeeRow = tbody.rows[tbody.rows.length - 2]; for (var i = 0; i < attendeesNames.length; i++) { - var tr = body.insertRow(i); - var td = document.createElement("td"); - $(td).addClassName("attendees"); - var input = document.createElement("input"); + var row = model.cloneNode(true); + tbody.insertBefore(row, newAttendeeRow); + $(row).removeClassName("attendeeModel"); + var input = $(row).down("input"); var value = ""; - if (attendeesNames[i].length > 0) + if (attendeesNames[i].length > 0 && attendeesNames[i] != attendeesEmails[i]) value += attendeesNames[i] + " "; value += "<" + attendeesEmails[i] + ">"; input.value = value; - $(input).addClassName("textField"); + if (attendeesUIDs[i].length > 0) + input.setAttribute("uid", attendeesUIDs[i]); + input.setAttribute("name", ""); input.setAttribute("modified", "0"); input.observe("blur", checkAttendee); input.observe("keydown", onContactKeydown); - tr.appendChild(td); - td.appendChild(input); displayFreeBusyForNode(input); } } else { attendeesNames = new Array(); + attendeesUIDs = new Array(); attendeesEmails = new Array(); } -} -function initializeFreebusys() { - var inputs = $("freeBusy").getElementsByTagName("input"); - var baseUrl = UserFolderURL + "Contacts/contactSearch?search="; - for (var i = 0; i < attendeesEmails.length; i++) - triggerAjaxRequest(baseUrl + attendeesEmails[i], - UIDLookupCallback, inputs[i]); + var inputs = table.getElementsByTagName("input"); + inputs[inputs.length - 2].setAttribute("autocomplete", "off"); + Event.observe(inputs[inputs.length - 2], "click", newAttendee); } function onFreeBusyLoadHandler() { initializeWindowButtons(); initializeTimeWidgets(); - prepareAttendees(); prepareTableHeaders(); prepareTableRows(); redisplayFreeBusyZone(); - resetAttendeesValue(); - initializeFreebusys(); + prepareAttendees(); } -document.observe("dom:loaded", onFreeBusyLoadHandler); +FastInit.addOnLoad(onFreeBusyLoadHandler); diff --git a/UI/WebServerResources/UIxCalUserRightsEditor.js b/UI/WebServerResources/UIxCalUserRightsEditor.js index 174cf154c..1c739b5ca 100644 --- a/UI/WebServerResources/UIxCalUserRightsEditor.js +++ b/UI/WebServerResources/UIxCalUserRightsEditor.js @@ -6,4 +6,4 @@ function initACLButtons() { Event.observe($("cancelButton"), "click", onCancelClick); } -addEvent(window, "load", initACLButtons); +FastInit.addOnLoad(initACLButtons); diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js index 6ff4d3f00..94a458b92 100644 --- a/UI/WebServerResources/UIxComponentEditor.js +++ b/UI/WebServerResources/UIxComponentEditor.js @@ -158,4 +158,4 @@ function onComponentEditorLoad(event) { false); } -addEvent(window, 'load', onComponentEditorLoad); +FastInit.addOnLoad(onComponentEditorLoad); diff --git a/UI/WebServerResources/UIxContactEditor.js b/UI/WebServerResources/UIxContactEditor.js index 23f334a7a..76910d032 100644 --- a/UI/WebServerResources/UIxContactEditor.js +++ b/UI/WebServerResources/UIxContactEditor.js @@ -134,4 +134,4 @@ function initEditorForm() { $("givenName").onkeyup = onFnNewValue; } -addEvent(window, 'load', initEditorForm); +FastInit.addOnLoad(initEditorForm); diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js index 1734da55a..62faa6c68 100644 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ b/UI/WebServerResources/UIxContactsUserFolders.js @@ -141,4 +141,4 @@ function initUserFoldersWindow() { Event.observe($("addButton"), "click", onConfirmFolderSelection); } -addEvent(window, 'load', initUserFoldersWindow); +FastInit.addOnLoad(initUserFoldersWindow); diff --git a/UI/WebServerResources/UIxContactsUserRightsEditor.js b/UI/WebServerResources/UIxContactsUserRightsEditor.js index ee8e8fccb..a38422dc4 100644 --- a/UI/WebServerResources/UIxContactsUserRightsEditor.js +++ b/UI/WebServerResources/UIxContactsUserRightsEditor.js @@ -7,4 +7,4 @@ function initACLButtons() { Event.observe(button, "click", onCancelClick); } -addEvent(window, "load", initACLButtons); +FastInit.addOnLoad(initACLButtons); diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 212f17152..5876bf275 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -368,4 +368,4 @@ function onMailEditorClose(event) { Event.stopObserving(window, "beforeunload", onMailEditorClose); } -addEvent(window, 'load', initMailEditor); +FastInit.addOnLoad(initMailEditor); diff --git a/UI/WebServerResources/UIxMailPopupView.js b/UI/WebServerResources/UIxMailPopupView.js index b9cb5946c..dd1974867 100644 --- a/UI/WebServerResources/UIxMailPopupView.js +++ b/UI/WebServerResources/UIxMailPopupView.js @@ -9,4 +9,4 @@ function initPopupMailer(event) { resizeMailContent(); } -addEvent(window, 'load', initPopupMailer); +FastInit.addOnLoad(initPopupMailer); diff --git a/UI/WebServerResources/UIxMailUserRightsEditor.js b/UI/WebServerResources/UIxMailUserRightsEditor.js index 6ef7e2fd6..65d471b6c 100644 --- a/UI/WebServerResources/UIxMailUserRightsEditor.js +++ b/UI/WebServerResources/UIxMailUserRightsEditor.js @@ -6,4 +6,4 @@ function initACLButtons() { $("cancelButton").addEventListener("click", onCancelClick, false); } -addEvent(window, "load", initACLButtons); +FastInit.addOnLoad(initACLButtons); diff --git a/UI/WebServerResources/UIxTaskEditor.js b/UI/WebServerResources/UIxTaskEditor.js index 5d98047af..c49cc7183 100644 --- a/UI/WebServerResources/UIxTaskEditor.js +++ b/UI/WebServerResources/UIxTaskEditor.js @@ -297,4 +297,4 @@ function onTaskEditorLoad() { initializeStatusLine(); } -addEvent(window, 'load', onTaskEditorLoad); +FastInit.addOnLoad(onTaskEditorLoad); diff --git a/UI/WebServerResources/fastinit.js b/UI/WebServerResources/fastinit.js new file mode 100644 index 000000000..c457cb073 --- /dev/null +++ b/UI/WebServerResources/fastinit.js @@ -0,0 +1,84 @@ +/* +* +* Copyright (c) 2007 Andrew Tetlaw +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, +* modify, merge, publish, distribute, sublicense, and/or sell copies +* of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* * +* +* +* FastInit +* http://tetlaw.id.au/view/javascript/fastinit +* Andrew Tetlaw +* Version 1.4.1 (2007-03-15) +* Based on: +* http://dean.edwards.name/weblog/2006/03/faster +* http://dean.edwards.name/weblog/2006/06/again/ +* Help from: +* http://www.cherny.com/webdev/26/domloaded-object-literal-updated +* +*/ +var FastInit = { + onload : function() { + if (FastInit.done) { return; } + FastInit.done = true; + for(var x = 0, al = FastInit.f.length; x < al; x++) { + FastInit.f[x](); + } + }, + addOnLoad : function() { + var a = arguments; + for(var x = 0, al = a.length; x < al; x++) { + if(typeof a[x] === 'function') { + if (FastInit.done ) { + a[x](); + } else { + FastInit.f.push(a[x]); + } + } + } + }, + listen : function() { + if (/WebKit|khtml/i.test(navigator.userAgent)) { + FastInit.timer = setInterval(function() { + if (/loaded|complete/.test(document.readyState)) { + clearInterval(FastInit.timer); + delete FastInit.timer; + FastInit.onload(); + }}, 10); + } else if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', FastInit.onload, false); + } else if(!FastInit.iew32) { + if(window.addEventListener) { + window.addEventListener('load', FastInit.onload, false); + } else if (window.attachEvent) { + return window.attachEvent('onload', FastInit.onload); + } + } + }, + f:[],done:false,timer:null,iew32:false +}; +/*@cc_on @*/ +/*@if (@_win32) +FastInit.iew32 = true; +document.write('