diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-cleanup.gif b/main/NOVA_0.4.4/templates/static/images/icon-history-cleanup.gif deleted file mode 100644 index e9382ae..0000000 Binary files a/main/NOVA_0.4.4/templates/static/images/icon-history-cleanup.gif and /dev/null differ diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/controls.js b/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/controls.js deleted file mode 100644 index 6783bd0..0000000 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/controls.js +++ /dev/null @@ -1,875 +0,0 @@ -// script.aculo.us controls.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 - -// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = {} -Autocompleter.Base = function() {}; -Autocompleter.Base.prototype = { - baseInitialize: function(element, update, options) { - element = $(element) - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || {}; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this)); - - // Turn autocomplete back on when the user leaves the page, so that the - // field's value will be remembered on Mozilla-based browsers. - Event.observe(window, 'beforeunload', function(){ - element.setAttribute('autocomplete', 'on'); - }); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (Prototype.Browser.IE) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - if(Prototype.Browser.WebKit) Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - if(Prototype.Browser.WebKit) Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index-- - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++ - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var lastTokenPos = this.findLastToken(); - if (lastTokenPos != -1) { - var newValue = this.element.value.substr(0, lastTokenPos + 1); - var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value; - } else { - this.element.value = value; - } - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - if(this.getToken().length>=this.options.minChars) { - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - }, - - getToken: function() { - var tokenPos = this.findLastToken(); - if (tokenPos != -1) - var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,''); - else - var ret = this.element.value; - - return /\n/.test(ret) ? '' : ret; - }, - - findLastToken: function() { - var lastTokenPos = -1; - - for (var i=0; i lastTokenPos) - lastTokenPos = thisTokenPos; - } - return lastTokenPos; - } -} - -Ajax.Autocompleter = Class.create(); -Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } - -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(); -Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
  • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
  • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
  • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
  • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) - return ""; - } - }, options || {}); - } -}); - -// AJAX in-place editor -// -// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -} - -Ajax.InPlaceEditor = Class.create(); -Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99"; -Ajax.InPlaceEditor.prototype = { - initialize: function(element, url, options) { - this.url = url; - this.element = $(element); - - this.options = Object.extend({ - paramName: "value", - okButton: true, - okLink: false, - okText: "ok", - cancelButton: false, - cancelLink: true, - cancelText: "cancel", - textBeforeControls: '', - textBetweenControls: '', - textAfterControls: '', - savingText: "Saving...", - clickToEditText: "Click to edit", - okText: "ok", - rows: 1, - onComplete: function(transport, element) { - new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); - }, - onFailure: function(transport) { - alert("Error communicating with the server: " + transport.responseText.stripTags()); - }, - callback: function(form) { - return Form.serialize(form); - }, - handleLineBreaks: true, - loadingText: 'Loading...', - savingClassName: 'inplaceeditor-saving', - loadingClassName: 'inplaceeditor-loading', - formClassName: 'inplaceeditor-form', - highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor, - highlightendcolor: "#FFFFFF", - externalControl: null, - submitOnBlur: false, - ajaxOptions: {}, - evalScripts: false - }, options || {}); - - if(!this.options.formId && this.element.id) { - this.options.formId = this.element.id + "-inplaceeditor"; - if ($(this.options.formId)) { - // there's already a form with that name, don't specify an id - this.options.formId = null; - } - } - - if (this.options.externalControl) { - this.options.externalControl = $(this.options.externalControl); - } - - this.originalBackground = Element.getStyle(this.element, 'background-color'); - if (!this.originalBackground) { - this.originalBackground = "transparent"; - } - - this.element.title = this.options.clickToEditText; - - this.onclickListener = this.enterEditMode.bindAsEventListener(this); - this.mouseoverListener = this.enterHover.bindAsEventListener(this); - this.mouseoutListener = this.leaveHover.bindAsEventListener(this); - Event.observe(this.element, 'click', this.onclickListener); - Event.observe(this.element, 'mouseover', this.mouseoverListener); - Event.observe(this.element, 'mouseout', this.mouseoutListener); - if (this.options.externalControl) { - Event.observe(this.options.externalControl, 'click', this.onclickListener); - Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener); - Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener); - } - }, - enterEditMode: function(evt) { - if (this.saving) return; - if (this.editing) return; - this.editing = true; - this.onEnterEditMode(); - if (this.options.externalControl) { - Element.hide(this.options.externalControl); - } - Element.hide(this.element); - this.createForm(); - this.element.parentNode.insertBefore(this.form, this.element); - if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField); - // stop the event to avoid a page refresh in Safari - if (evt) { - Event.stop(evt); - } - return false; - }, - createForm: function() { - this.form = document.createElement("form"); - this.form.id = this.options.formId; - Element.addClassName(this.form, this.options.formClassName) - this.form.onsubmit = this.onSubmit.bind(this); - - this.createEditField(); - - if (this.options.textarea) { - var br = document.createElement("br"); - this.form.appendChild(br); - } - - if (this.options.textBeforeControls) - this.form.appendChild(document.createTextNode(this.options.textBeforeControls)); - - if (this.options.okButton) { - var okButton = document.createElement("input"); - okButton.type = "submit"; - okButton.value = this.options.okText; - okButton.className = 'editor_ok_button'; - this.form.appendChild(okButton); - } - - if (this.options.okLink) { - var okLink = document.createElement("a"); - okLink.href = "#"; - okLink.appendChild(document.createTextNode(this.options.okText)); - okLink.onclick = this.onSubmit.bind(this); - okLink.className = 'editor_ok_link'; - this.form.appendChild(okLink); - } - - if (this.options.textBetweenControls && - (this.options.okLink || this.options.okButton) && - (this.options.cancelLink || this.options.cancelButton)) - this.form.appendChild(document.createTextNode(this.options.textBetweenControls)); - - if (this.options.cancelButton) { - var cancelButton = document.createElement("input"); - cancelButton.type = "submit"; - cancelButton.value = this.options.cancelText; - cancelButton.onclick = this.onclickCancel.bind(this); - cancelButton.className = 'editor_cancel_button'; - this.form.appendChild(cancelButton); - } - - if (this.options.cancelLink) { - var cancelLink = document.createElement("a"); - cancelLink.href = "#"; - cancelLink.appendChild(document.createTextNode(this.options.cancelText)); - cancelLink.onclick = this.onclickCancel.bind(this); - cancelLink.className = 'editor_cancel editor_cancel_link'; - this.form.appendChild(cancelLink); - } - - if (this.options.textAfterControls) - this.form.appendChild(document.createTextNode(this.options.textAfterControls)); - }, - hasHTMLLineBreaks: function(string) { - if (!this.options.handleLineBreaks) return false; - return string.match(/
    /i); - }, - convertHTMLLineBreaks: function(string) { - return string.replace(/
    /gi, "\n").replace(//gi, "\n").replace(/<\/p>/gi, "\n").replace(/

    /gi, ""); - }, - createEditField: function() { - var text; - if(this.options.loadTextURL) { - text = this.options.loadingText; - } else { - text = this.getText(); - } - - var obj = this; - - if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) { - this.options.textarea = false; - var textField = document.createElement("input"); - textField.obj = this; - textField.type = "text"; - textField.name = this.options.paramName; - textField.value = text; - textField.style.backgroundColor = this.options.highlightcolor; - textField.className = 'editor_field'; - var size = this.options.size || this.options.cols || 0; - if (size != 0) textField.size = size; - if (this.options.submitOnBlur) - textField.onblur = this.onSubmit.bind(this); - this.editField = textField; - } else { - this.options.textarea = true; - var textArea = document.createElement("textarea"); - textArea.obj = this; - textArea.name = this.options.paramName; - textArea.value = this.convertHTMLLineBreaks(text); - textArea.rows = this.options.rows; - textArea.cols = this.options.cols || 40; - textArea.className = 'editor_field'; - if (this.options.submitOnBlur) - textArea.onblur = this.onSubmit.bind(this); - this.editField = textArea; - } - - if(this.options.loadTextURL) { - this.loadExternalText(); - } - this.form.appendChild(this.editField); - }, - getText: function() { - return this.element.innerHTML; - }, - loadExternalText: function() { - Element.addClassName(this.form, this.options.loadingClassName); - this.editField.disabled = true; - new Ajax.Request( - this.options.loadTextURL, - Object.extend({ - asynchronous: true, - onComplete: this.onLoadedExternalText.bind(this) - }, this.options.ajaxOptions) - ); - }, - onLoadedExternalText: function(transport) { - Element.removeClassName(this.form, this.options.loadingClassName); - this.editField.disabled = false; - this.editField.value = transport.responseText.stripTags(); - Field.scrollFreeActivate(this.editField); - }, - onclickCancel: function() { - this.onComplete(); - this.leaveEditMode(); - return false; - }, - onFailure: function(transport) { - this.options.onFailure(transport); - if (this.oldInnerHTML) { - this.element.innerHTML = this.oldInnerHTML; - this.oldInnerHTML = null; - } - return false; - }, - onSubmit: function() { - // onLoading resets these so we need to save them away for the Ajax call - var form = this.form; - var value = this.editField.value; - - // do this first, sometimes the ajax call returns before we get a chance to switch on Saving... - // which means this will actually switch on Saving... *after* we've left edit mode causing Saving... - // to be displayed indefinitely - this.onLoading(); - - if (this.options.evalScripts) { - new Ajax.Request( - this.url, Object.extend({ - parameters: this.options.callback(form, value), - onComplete: this.onComplete.bind(this), - onFailure: this.onFailure.bind(this), - asynchronous:true, - evalScripts:true - }, this.options.ajaxOptions)); - } else { - new Ajax.Updater( - { success: this.element, - // don't update on failure (this could be an option) - failure: null }, - this.url, Object.extend({ - parameters: this.options.callback(form, value), - onComplete: this.onComplete.bind(this), - onFailure: this.onFailure.bind(this) - }, this.options.ajaxOptions)); - } - // stop the event to avoid a page refresh in Safari - if (arguments.length > 1) { - Event.stop(arguments[0]); - } - return false; - }, - onLoading: function() { - this.saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - showSaving: function() { - this.oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - Element.addClassName(this.element, this.options.savingClassName); - this.element.style.backgroundColor = this.originalBackground; - Element.show(this.element); - }, - removeForm: function() { - if(this.form) { - if (this.form.parentNode) Element.remove(this.form); - this.form = null; - } - }, - enterHover: function() { - if (this.saving) return; - this.element.style.backgroundColor = this.options.highlightcolor; - if (this.effect) { - this.effect.cancel(); - } - Element.addClassName(this.element, this.options.hoverClassName) - }, - leaveHover: function() { - if (this.options.backgroundColor) { - this.element.style.backgroundColor = this.oldBackground; - } - Element.removeClassName(this.element, this.options.hoverClassName) - if (this.saving) return; - this.effect = new Effect.Highlight(this.element, { - startcolor: this.options.highlightcolor, - endcolor: this.options.highlightendcolor, - restorecolor: this.originalBackground - }); - }, - leaveEditMode: function() { - Element.removeClassName(this.element, this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this.originalBackground; - Element.show(this.element); - if (this.options.externalControl) { - Element.show(this.options.externalControl); - } - this.editing = false; - this.saving = false; - this.oldInnerHTML = null; - this.onLeaveEditMode(); - }, - onComplete: function(transport) { - this.leaveEditMode(); - this.options.onComplete.bind(this)(transport, this.element); - }, - onEnterEditMode: function() {}, - onLeaveEditMode: function() {}, - dispose: function() { - if (this.oldInnerHTML) { - this.element.innerHTML = this.oldInnerHTML; - } - this.leaveEditMode(); - Event.stopObserving(this.element, 'click', this.onclickListener); - Event.stopObserving(this.element, 'mouseover', this.mouseoverListener); - Event.stopObserving(this.element, 'mouseout', this.mouseoutListener); - if (this.options.externalControl) { - Event.stopObserving(this.options.externalControl, 'click', this.onclickListener); - Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener); - Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener); - } - } -}; - -Ajax.InPlaceCollectionEditor = Class.create(); -Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); -Object.extend(Ajax.InPlaceCollectionEditor.prototype, { - createEditField: function() { - if (!this.cached_selectTag) { - var selectTag = document.createElement("select"); - var collection = this.options.collection || []; - var optionTag; - collection.each(function(e,i) { - optionTag = document.createElement("option"); - optionTag.value = (e instanceof Array) ? e[0] : e; - if((typeof this.options.value == 'undefined') && - ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true; - if(this.options.value==optionTag.value) optionTag.selected = true; - optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e)); - selectTag.appendChild(optionTag); - }.bind(this)); - this.cached_selectTag = selectTag; - } - - this.editField = this.cached_selectTag; - if(this.options.loadTextURL) this.loadExternalText(); - this.form.appendChild(this.editField); - this.options.callback = function(form, value) { - return "value=" + encodeURIComponent(value); - } - } -}); - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create(); -Form.Element.DelayedObserver.prototype = { - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}; diff --git a/main/NOVA_0.4.4/LICENSE.txt b/main/NOVA_0.4.5/LICENCE.TXT similarity index 100% rename from main/NOVA_0.4.4/LICENSE.txt rename to main/NOVA_0.4.5/LICENCE.TXT diff --git a/main/NOVA_0.4.4/README.txt b/main/NOVA_0.4.5/README.TXT similarity index 89% rename from main/NOVA_0.4.4/README.txt rename to main/NOVA_0.4.5/README.TXT index fc029d3..9125c55 100644 --- a/main/NOVA_0.4.4/README.txt +++ b/main/NOVA_0.4.5/README.TXT @@ -1,12 +1,12 @@ ================================ -NOVA 0.4.4 README - Oct 10, 2007 +NOVA 0.4.5 README - Oct 26, 2007 http://sabnzbd.organixdesign.com ======= AUTHORS -* Nathan Langlois => complete rewrite of NOVA for version 0.4 +* Nathan => complete rewrite of NOVA for version 0.4 * Dana Woodman => original NOVA + concept design -* ShyPike => modified for SABnzbd-0.2.7 +* ShyPike => modified for SABnzbd-0.2.7up ============ INTRODUCTION @@ -28,6 +28,13 @@ WHAT IS NEW * Much much more! ================== +NOVA 0.4.5 UPDATES +* Added +Script Dirscan options in Config->Switches for SABnzbdPlus (blackhole directory) +* New Cleanup icon for History Verbosity +* Updated integrated components +* Didn't do any testing, good luck! + +================== NOVA 0.4.4 UPDATES * History Verbosity has been drastically cleaned up (1) Details are now hidden behind icons (hover icon with cursor to view) @@ -88,9 +95,4 @@ A: Yes, stay tuned. Our ultimate goal is to allow for straightforward customizat ============== SPECIAL THANKS -* Pim for the Dutch translation => http://www.pimspage.nl/ -* Prototype Core Team => http://www.prototypejs.org/ -* script.aculo.us => http://script.aculo.us/ -* Lytebox => http://www.dolem.com/lytebox/ -* Nuvola icon set => http://www.icon-king.com/?p=15 -* Everyone in the community who left so much valuable feedback - we appreciate it greatly! +* Everyone in the community who left so much valuable feedback - we appreciate it greatly! \ No newline at end of file diff --git a/main/NOVA_0.4.4/templates/config.tmpl b/main/NOVA_0.4.5/templates/config.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config.tmpl rename to main/NOVA_0.4.5/templates/config.tmpl diff --git a/main/NOVA_0.4.4/templates/config_directories.tmpl b/main/NOVA_0.4.5/templates/config_directories.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_directories.tmpl rename to main/NOVA_0.4.5/templates/config_directories.tmpl diff --git a/main/NOVA_0.4.4/templates/config_general.tmpl b/main/NOVA_0.4.5/templates/config_general.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_general.tmpl rename to main/NOVA_0.4.5/templates/config_general.tmpl diff --git a/main/NOVA_0.4.4/templates/config_rss.tmpl b/main/NOVA_0.4.5/templates/config_rss.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_rss.tmpl rename to main/NOVA_0.4.5/templates/config_rss.tmpl diff --git a/main/NOVA_0.4.4/templates/config_scheduling.tmpl b/main/NOVA_0.4.5/templates/config_scheduling.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_scheduling.tmpl rename to main/NOVA_0.4.5/templates/config_scheduling.tmpl diff --git a/main/NOVA_0.4.4/templates/config_server.tmpl b/main/NOVA_0.4.5/templates/config_server.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_server.tmpl rename to main/NOVA_0.4.5/templates/config_server.tmpl diff --git a/main/NOVA_0.4.4/templates/config_switches.tmpl b/main/NOVA_0.4.5/templates/config_switches.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/config_switches.tmpl rename to main/NOVA_0.4.5/templates/config_switches.tmpl diff --git a/main/NOVA_0.4.4/templates/connection_info.tmpl b/main/NOVA_0.4.5/templates/connection_info.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/connection_info.tmpl rename to main/NOVA_0.4.5/templates/connection_info.tmpl diff --git a/main/NOVA_0.4.4/templates/history.tmpl b/main/NOVA_0.4.5/templates/history.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/history.tmpl rename to main/NOVA_0.4.5/templates/history.tmpl diff --git a/main/NOVA_0.4.4/templates/main.tmpl b/main/NOVA_0.4.5/templates/main.tmpl similarity index 93% rename from main/NOVA_0.4.4/templates/main.tmpl rename to main/NOVA_0.4.5/templates/main.tmpl index 1913987..7939d1a 100644 --- a/main/NOVA_0.4.4/templates/main.tmpl +++ b/main/NOVA_0.4.5/templates/main.tmpl @@ -11,13 +11,13 @@ NOVA (Loading...?) - + - - - + + + @@ -25,7 +25,7 @@

    - + diff --git a/main/NOVA_0.4.4/templates/nzo.tmpl b/main/NOVA_0.4.5/templates/nzo.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/nzo.tmpl rename to main/NOVA_0.4.5/templates/nzo.tmpl diff --git a/main/NOVA_0.4.4/templates/queue.tmpl b/main/NOVA_0.4.5/templates/queue.tmpl similarity index 100% rename from main/NOVA_0.4.4/templates/queue.tmpl rename to main/NOVA_0.4.5/templates/queue.tmpl diff --git a/main/NOVA_0.4.4/templates/static/images/bg_dataBar.png b/main/NOVA_0.4.5/templates/static/images/bg_dataBar.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_dataBar.png rename to main/NOVA_0.4.5/templates/static/images/bg_dataBar.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_downloaded.png b/main/NOVA_0.4.5/templates/static/images/bg_downloaded.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_downloaded.png rename to main/NOVA_0.4.5/templates/static/images/bg_downloaded.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_downloaded_minibar.png b/main/NOVA_0.4.5/templates/static/images/bg_downloaded_minibar.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_downloaded_minibar.png rename to main/NOVA_0.4.5/templates/static/images/bg_downloaded_minibar.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_lonelyhearts.png b/main/NOVA_0.4.5/templates/static/images/bg_lonelyhearts.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_lonelyhearts.png rename to main/NOVA_0.4.5/templates/static/images/bg_lonelyhearts.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_thead_tr.png b/main/NOVA_0.4.5/templates/static/images/bg_thead_tr.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_thead_tr.png rename to main/NOVA_0.4.5/templates/static/images/bg_thead_tr.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_thead_tr_heading.png b/main/NOVA_0.4.5/templates/static/images/bg_thead_tr_heading.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_thead_tr_heading.png rename to main/NOVA_0.4.5/templates/static/images/bg_thead_tr_heading.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_thead_tr_orig.png b/main/NOVA_0.4.5/templates/static/images/bg_thead_tr_orig.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_thead_tr_orig.png rename to main/NOVA_0.4.5/templates/static/images/bg_thead_tr_orig.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_topBar.png b/main/NOVA_0.4.5/templates/static/images/bg_topBar.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_topBar.png rename to main/NOVA_0.4.5/templates/static/images/bg_topBar.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_tr_hover.png b/main/NOVA_0.4.5/templates/static/images/bg_tr_hover.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_tr_hover.png rename to main/NOVA_0.4.5/templates/static/images/bg_tr_hover.png diff --git a/main/NOVA_0.4.4/templates/static/images/bg_tr_odd.png b/main/NOVA_0.4.5/templates/static/images/bg_tr_odd.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/bg_tr_odd.png rename to main/NOVA_0.4.5/templates/static/images/bg_tr_odd.png diff --git a/main/NOVA_0.4.5/templates/static/images/blank.gif b/main/NOVA_0.4.5/templates/static/images/blank.gif new file mode 100644 index 0000000..1d11fa9 Binary files /dev/null and b/main/NOVA_0.4.5/templates/static/images/blank.gif differ diff --git a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/images/close_grey.png b/main/NOVA_0.4.5/templates/static/images/close_grey.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/javascripts/lytebox/images/close_grey.png rename to main/NOVA_0.4.5/templates/static/images/close_grey.png diff --git a/main/NOVA_0.4.4/templates/static/images/favicon.ico b/main/NOVA_0.4.5/templates/static/images/favicon.ico similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/favicon.ico rename to main/NOVA_0.4.5/templates/static/images/favicon.ico diff --git a/main/NOVA_0.4.4/templates/static/images/icon-blank.png b/main/NOVA_0.4.5/templates/static/images/icon-blank.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-blank.png rename to main/NOVA_0.4.5/templates/static/images/icon-blank.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-addnzb.png b/main/NOVA_0.4.5/templates/static/images/icon-header-addnzb.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-addnzb.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-addnzb.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-currenthistorysize.png b/main/NOVA_0.4.5/templates/static/images/icon-header-currenthistorysize.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-currenthistorysize.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-currenthistorysize.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-freespacecom.png b/main/NOVA_0.4.5/templates/static/images/icon-header-freespacecom.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-freespacecom.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-freespacecom.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-freespaceinc.png b/main/NOVA_0.4.5/templates/static/images/icon-header-freespaceinc.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-freespaceinc.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-freespaceinc.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-history.png b/main/NOVA_0.4.5/templates/static/images/icon-header-history.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-history.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-history.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-knowndownloaded.png b/main/NOVA_0.4.5/templates/static/images/icon-header-knowndownloaded.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-knowndownloaded.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-knowndownloaded.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-mbleft.png b/main/NOVA_0.4.5/templates/static/images/icon-header-mbleft.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-mbleft.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-mbleft.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-queue.png b/main/NOVA_0.4.5/templates/static/images/icon-header-queue.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-queue.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-queue.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-sidebyside.png b/main/NOVA_0.4.5/templates/static/images/icon-header-sidebyside.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-sidebyside.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-sidebyside.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-speed.png b/main/NOVA_0.4.5/templates/static/images/icon-header-speed.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-speed.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-speed.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-timeleft.png b/main/NOVA_0.4.5/templates/static/images/icon-header-timeleft.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-timeleft.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-timeleft.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-header-topbottom.png b/main/NOVA_0.4.5/templates/static/images/icon-header-topbottom.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-header-topbottom.png rename to main/NOVA_0.4.5/templates/static/images/icon-header-topbottom.png diff --git a/main/NOVA_0.4.5/templates/static/images/icon-history-cleanup.png b/main/NOVA_0.4.5/templates/static/images/icon-history-cleanup.png new file mode 100644 index 0000000..3b3ccb9 Binary files /dev/null and b/main/NOVA_0.4.5/templates/static/images/icon-history-cleanup.png differ diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-fucked.png b/main/NOVA_0.4.5/templates/static/images/icon-history-fucked.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-fucked.png rename to main/NOVA_0.4.5/templates/static/images/icon-history-fucked.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-join.png b/main/NOVA_0.4.5/templates/static/images/icon-history-join.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-join.png rename to main/NOVA_0.4.5/templates/static/images/icon-history-join.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-par2.png b/main/NOVA_0.4.5/templates/static/images/icon-history-par2.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-par2.png rename to main/NOVA_0.4.5/templates/static/images/icon-history-par2.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-postprocessing.gif b/main/NOVA_0.4.5/templates/static/images/icon-history-postprocessing.gif similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-postprocessing.gif rename to main/NOVA_0.4.5/templates/static/images/icon-history-postprocessing.gif diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-unrar.png b/main/NOVA_0.4.5/templates/static/images/icon-history-unrar.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-unrar.png rename to main/NOVA_0.4.5/templates/static/images/icon-history-unrar.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-history-unzip.gif b/main/NOVA_0.4.5/templates/static/images/icon-history-unzip.gif similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-history-unzip.gif rename to main/NOVA_0.4.5/templates/static/images/icon-history-unzip.gif diff --git a/main/NOVA_0.4.4/templates/static/images/icon-newzbin.png b/main/NOVA_0.4.5/templates/static/images/icon-newzbin.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-newzbin.png rename to main/NOVA_0.4.5/templates/static/images/icon-newzbin.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-1downarrow.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-1downarrow.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-1downarrow.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-1downarrow.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-1uparrow.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-1uparrow.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-1uparrow.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-1uparrow.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-2downarrow.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-2downarrow.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-2downarrow.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-2downarrow.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-2uparrow.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-2uparrow.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-2uparrow.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-2uparrow.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-drop.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-drop.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-drop.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-drop.png diff --git a/main/NOVA_0.4.4/templates/static/images/icon-queue-order.png b/main/NOVA_0.4.5/templates/static/images/icon-queue-order.png similarity index 100% rename from main/NOVA_0.4.4/templates/static/images/icon-queue-order.png rename to main/NOVA_0.4.5/templates/static/images/icon-queue-order.png diff --git a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/images/loading.gif b/main/NOVA_0.4.5/templates/static/images/loading.gif similarity index 100% rename from main/NOVA_0.4.4/templates/static/javascripts/lytebox/images/loading.gif rename to main/NOVA_0.4.5/templates/static/images/loading.gif diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/builder.js b/main/NOVA_0.4.5/templates/static/javascripts/builder.js similarity index 98% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/builder.js rename to main/NOVA_0.4.5/templates/static/javascripts/builder.js index 5b4ce87..301087d 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/builder.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/builder.js @@ -1,4 +1,4 @@ -// script.aculo.us builder.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us builder.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // diff --git a/main/NOVA_0.4.5/templates/static/javascripts/controls.js b/main/NOVA_0.4.5/templates/static/javascripts/controls.js new file mode 100644 index 0000000..9cbeae9 --- /dev/null +++ b/main/NOVA_0.4.5/templates/static/javascripts/controls.js @@ -0,0 +1,972 @@ +// script.aculo.us controls.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 + +// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) +// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) +// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) +// Contributors: +// Richard Livsey +// Rahul Bhargava +// Rob Wills +// +// script.aculo.us is freely distributable under the terms of an MIT-style license. +// For details, see the script.aculo.us web site: http://script.aculo.us/ + +// Autocompleter.Base handles all the autocompletion functionality +// that's independent of the data source for autocompletion. This +// includes drawing the autocompletion menu, observing keyboard +// and mouse events, and similar. +// +// Specific autocompleters need to provide, at the very least, +// a getUpdatedChoices function that will be invoked every time +// the text inside the monitored textbox changes. This method +// should get the text for which to provide autocompletion by +// invoking this.getToken(), NOT by directly accessing +// this.element.value. This is to allow incremental tokenized +// autocompletion. Specific auto-completion logic (AJAX, etc) +// belongs in getUpdatedChoices. +// +// Tokenized incremental autocompletion is enabled automatically +// when an autocompleter is instantiated with the 'tokens' option +// in the options parameter, e.g.: +// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); +// will incrementally autocomplete with a comma as the token. +// Additionally, ',' in the above example can be replaced with +// a token array, e.g. { tokens: [',', '\n'] } which +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it +// allows smart autocompletion after linebreaks. +// +// vim:expandtab ts=8 sw=2 + +if(typeof Effect == 'undefined') + throw("controls.js requires including script.aculo.us' effects.js library"); + +var Autocompleter = { } +Autocompleter.Base = function() { }; +Autocompleter.Base.prototype = { + baseInitialize: function(element, update, options) { + element = $(element) + this.element = element; + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; + this.entryCount = 0; + this.oldElementValue = this.element.value; + + if(this.setOptions) + this.setOptions(options); + else + this.options = options || { }; + + this.options.paramName = this.options.paramName || this.element.name; + this.options.tokens = this.options.tokens || []; + this.options.frequency = this.options.frequency || 0.4; + this.options.minChars = this.options.minChars || 1; + this.options.onShow = this.options.onShow || + function(element, update){ + if(!update.style.position || update.style.position=='absolute') { + update.style.position = 'absolute'; + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight + }); + } + Effect.Appear(update,{duration:0.15}); + }; + this.options.onHide = this.options.onHide || + function(element, update){ new Effect.Fade(update,{duration:0.15}) }; + + if(typeof(this.options.tokens) == 'string') + this.options.tokens = new Array(this.options.tokens); + // Force carriage returns as token delimiters anyway + if (!this.options.tokens.include('\n')) + this.options.tokens.push('\n'); + + this.observer = null; + + this.element.setAttribute('autocomplete','off'); + + Element.hide(this.update); + + Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); + Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this)); + }, + + show: function() { + if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); + if(!this.iefix && + (Prototype.Browser.IE) && + (Element.getStyle(this.update, 'position')=='absolute')) { + new Insertion.After(this.update, + ''); + this.iefix = $(this.update.id+'_iefix'); + } + if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); + }, + + fixIEOverlapping: function() { + Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); + this.iefix.style.zIndex = 1; + this.update.style.zIndex = 2; + Element.show(this.iefix); + }, + + hide: function() { + this.stopIndicator(); + if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); + if(this.iefix) Element.hide(this.iefix); + }, + + startIndicator: function() { + if(this.options.indicator) Element.show(this.options.indicator); + }, + + stopIndicator: function() { + if(this.options.indicator) Element.hide(this.options.indicator); + }, + + onKeyPress: function(event) { + if(this.active) + switch(event.keyCode) { + case Event.KEY_TAB: + case Event.KEY_RETURN: + this.selectEntry(); + Event.stop(event); + case Event.KEY_ESC: + this.hide(); + this.active = false; + Event.stop(event); + return; + case Event.KEY_LEFT: + case Event.KEY_RIGHT: + return; + case Event.KEY_UP: + this.markPrevious(); + this.render(); + if(Prototype.Browser.WebKit) Event.stop(event); + return; + case Event.KEY_DOWN: + this.markNext(); + this.render(); + if(Prototype.Browser.WebKit) Event.stop(event); + return; + } + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; + + this.changed = true; + this.hasFocus = true; + + if(this.observer) clearTimeout(this.observer); + this.observer = + setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); + }, + + activate: function() { + this.changed = false; + this.hasFocus = true; + this.getUpdatedChoices(); + }, + + onHover: function(event) { + var element = Event.findElement(event, 'LI'); + if(this.index != element.autocompleteIndex) + { + this.index = element.autocompleteIndex; + this.render(); + } + Event.stop(event); + }, + + onClick: function(event) { + var element = Event.findElement(event, 'LI'); + this.index = element.autocompleteIndex; + this.selectEntry(); + this.hide(); + }, + + onBlur: function(event) { + // needed to make click events working + setTimeout(this.hide.bind(this), 250); + this.hasFocus = false; + this.active = false; + }, + + render: function() { + if(this.entryCount > 0) { + for (var i = 0; i < this.entryCount; i++) + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : + Element.removeClassName(this.getEntry(i),"selected"); + if(this.hasFocus) { + this.show(); + this.active = true; + } + } else { + this.active = false; + this.hide(); + } + }, + + markPrevious: function() { + if(this.index > 0) this.index-- + else this.index = this.entryCount-1; + this.getEntry(this.index).scrollIntoView(true); + }, + + markNext: function() { + if(this.index < this.entryCount-1) this.index++ + else this.index = 0; + this.getEntry(this.index).scrollIntoView(false); + }, + + getEntry: function(index) { + return this.update.firstChild.childNodes[index]; + }, + + getCurrentEntry: function() { + return this.getEntry(this.index); + }, + + selectEntry: function() { + this.active = false; + this.updateElement(this.getCurrentEntry()); + }, + + updateElement: function(selectedElement) { + if (this.options.updateElement) { + this.options.updateElement(selectedElement); + return; + } + var value = ''; + if (this.options.select) { + var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; + if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); + } else + value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); + + var bounds = this.getTokenBounds(); + if (bounds[0] != -1) { + var newValue = this.element.value.substr(0, bounds[0]); + var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); + if (whitespace) + newValue += whitespace[0]; + this.element.value = newValue + value + this.element.value.substr(bounds[1]); + } else { + this.element.value = value; + } + this.oldElementValue = this.element.value; + this.element.focus(); + + if (this.options.afterUpdateElement) + this.options.afterUpdateElement(this.element, selectedElement); + }, + + updateChoices: function(choices) { + if(!this.changed && this.hasFocus) { + this.update.innerHTML = choices; + Element.cleanWhitespace(this.update); + Element.cleanWhitespace(this.update.down()); + + if(this.update.firstChild && this.update.down().childNodes) { + this.entryCount = + this.update.down().childNodes.length; + for (var i = 0; i < this.entryCount; i++) { + var entry = this.getEntry(i); + entry.autocompleteIndex = i; + this.addObservers(entry); + } + } else { + this.entryCount = 0; + } + + this.stopIndicator(); + this.index = 0; + + if(this.entryCount==1 && this.options.autoSelect) { + this.selectEntry(); + this.hide(); + } else { + this.render(); + } + } + }, + + addObservers: function(element) { + Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); + Event.observe(element, "click", this.onClick.bindAsEventListener(this)); + }, + + onObserverEvent: function() { + this.changed = false; + this.tokenBounds = null; + if(this.getToken().length>=this.options.minChars) { + this.getUpdatedChoices(); + } else { + this.active = false; + this.hide(); + } + this.oldElementValue = this.element.value; + }, + + getToken: function() { + var bounds = this.getTokenBounds(); + return this.element.value.substring(bounds[0], bounds[1]).strip(); + }, + + getTokenBounds: function() { + if (null != this.tokenBounds) return this.tokenBounds; + var value = this.element.value; + if (value.strip().empty()) return [-1, 0]; + var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); + var offset = (diff == this.oldElementValue.length ? 1 : 0); + var prevTokenPos = -1, nextTokenPos = value.length; + var tp; + for (var index = 0, l = this.options.tokens.length; index < l; ++index) { + tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); + if (tp > prevTokenPos) prevTokenPos = tp; + tp = value.indexOf(this.options.tokens[index], diff + offset); + if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; + } + return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); + } +} + +Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { + var boundary = Math.min(newS.length, oldS.length); + for (var index = 0; index < boundary; ++index) + if (newS[index] != oldS[index]) + return index; + return boundary; +}; + +Ajax.Autocompleter = Class.create(); +Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { + initialize: function(element, update, url, options) { + this.baseInitialize(element, update, options); + this.options.asynchronous = true; + this.options.onComplete = this.onComplete.bind(this); + this.options.defaultParams = this.options.parameters || null; + this.url = url; + }, + + getUpdatedChoices: function() { + this.startIndicator(); + + var entry = encodeURIComponent(this.options.paramName) + '=' + + encodeURIComponent(this.getToken()); + + this.options.parameters = this.options.callback ? + this.options.callback(this.element, entry) : entry; + + if(this.options.defaultParams) + this.options.parameters += '&' + this.options.defaultParams; + + new Ajax.Request(this.url, this.options); + }, + + onComplete: function(request) { + this.updateChoices(request.responseText); + } + +}); + +// The local array autocompleter. Used when you'd prefer to +// inject an array of autocompletion options into the page, rather +// than sending out Ajax queries, which can be quite slow sometimes. +// +// The constructor takes four parameters. The first two are, as usual, +// the id of the monitored textbox, and id of the autocompletion menu. +// The third is the array you want to autocomplete from, and the fourth +// is the options block. +// +// Extra local autocompletion options: +// - choices - How many autocompletion choices to offer +// +// - partialSearch - If false, the autocompleter will match entered +// text only at the beginning of strings in the +// autocomplete array. Defaults to true, which will +// match text at the beginning of any *word* in the +// strings in the autocomplete array. If you want to +// search anywhere in the string, additionally set +// the option fullSearch to true (default: off). +// +// - fullSsearch - Search anywhere in autocomplete array strings. +// +// - partialChars - How many characters to enter before triggering +// a partial match (unlike minChars, which defines +// how many characters are required to do any match +// at all). Defaults to 2. +// +// - ignoreCase - Whether to ignore case when autocompleting. +// Defaults to true. +// +// It's possible to pass in a custom function as the 'selector' +// option, if you prefer to write your own autocompletion logic. +// In that case, the other options above will not apply unless +// you support them. + +Autocompleter.Local = Class.create(); +Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { + initialize: function(element, update, array, options) { + this.baseInitialize(element, update, options); + this.options.array = array; + }, + + getUpdatedChoices: function() { + this.updateChoices(this.options.selector(this)); + }, + + setOptions: function(options) { + this.options = Object.extend({ + choices: 10, + partialSearch: true, + partialChars: 2, + ignoreCase: true, + fullSearch: false, + selector: function(instance) { + var ret = []; // Beginning matches + var partial = []; // Inside matches + var entry = instance.getToken(); + var count = 0; + + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { + + var elem = instance.options.array[i]; + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : + elem.indexOf(entry); + + while (foundPos != -1) { + if (foundPos == 0 && elem.length != entry.length) { + ret.push("
  • " + elem.substr(0, entry.length) + "" + + elem.substr(entry.length) + "
  • "); + break; + } else if (entry.length >= instance.options.partialChars && + instance.options.partialSearch && foundPos != -1) { + if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { + partial.push("
  • " + elem.substr(0, foundPos) + "" + + elem.substr(foundPos, entry.length) + "" + elem.substr( + foundPos + entry.length) + "
  • "); + break; + } + } + + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + elem.indexOf(entry, foundPos + 1); + + } + } + if (partial.length) + ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) + return "
      " + ret.join('') + "
    "; + } + }, options || { }); + } +}); + +// AJAX in-place editor and collection editor +// Full rewrite by Christophe Porteneuve (April 2007). + +// Use this if you notice weird scrolling problems on some browsers, +// the DOM might be a bit confused when this gets called so do this +// waits 1 ms (with setTimeout) until it does the activation +Field.scrollFreeActivate = function(field) { + setTimeout(function() { + Field.activate(field); + }, 1); +} + +Ajax.InPlaceEditor = Class.create(); +Object.extend(Ajax.InPlaceEditor, { + DefaultOptions: { + ajaxOptions: { }, + autoRows: 3, // Use when multi-line w/ rows == 1 + cancelControl: 'link', // 'link'|'button'|false + cancelText: 'cancel', + clickToEditText: 'Click to edit', + externalControl: null, // id|elt + externalControlOnly: false, + fieldPostCreation: 'activate', // 'activate'|'focus'|false + formClassName: 'inplaceeditor-form', + formId: null, // id|elt + highlightColor: '#ffff99', + highlightEndColor: '#ffffff', + hoverClassName: '', + htmlResponse: true, + loadingClassName: 'inplaceeditor-loading', + loadingText: 'Loading...', + okControl: 'button', // 'link'|'button'|false + okText: 'ok', + paramName: 'value', + rows: 1, // If 1 and multi-line, uses autoRows + savingClassName: 'inplaceeditor-saving', + savingText: 'Saving...', + size: 0, + stripLoadedTextTags: false, + submitOnBlur: false, + textAfterControls: '', + textBeforeControls: '', + textBetweenControls: '' + }, + DefaultCallbacks: { + callback: function(form) { + return Form.serialize(form); + }, + onComplete: function(transport, element) { + // For backward compatibility, this one is bound to the IPE, and passes + // the element directly. It was too often customized, so we don't break it. + new Effect.Highlight(element, { + startcolor: this.options.highlightColor, keepBackgroundImage: true }); + }, + onEnterEditMode: null, + onEnterHover: function(ipe) { + ipe.element.style.backgroundColor = ipe.options.highlightColor; + if (ipe._effect) + ipe._effect.cancel(); + }, + onFailure: function(transport, ipe) { + alert('Error communication with the server: ' + transport.responseText.stripTags()); + }, + onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. + onLeaveEditMode: null, + onLeaveHover: function(ipe) { + ipe._effect = new Effect.Highlight(ipe.element, { + startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, + restorecolor: ipe._originalBackground, keepBackgroundImage: true + }); + } + }, + Listeners: { + click: 'enterEditMode', + keydown: 'checkForEscapeOrReturn', + mouseover: 'enterHover', + mouseout: 'leaveHover' + } +}); +Ajax.InPlaceEditor.prototype = { + initialize: function(element, url, options) { + this.url = url; + this.element = element = $(element); + this.prepareOptions(); + this._controls = { }; + arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! + Object.extend(this.options, options || { }); + if (!this.options.formId && this.element.id) { + this.options.formId = this.element.id + '-inplaceeditor'; + if ($(this.options.formId)) + this.options.formId = ''; + } + if (this.options.externalControl) + this.options.externalControl = $(this.options.externalControl); + if (!this.options.externalControl) + this.options.externalControlOnly = false; + this._originalBackground = this.element.getStyle('background-color') || 'transparent'; + this.element.title = this.options.clickToEditText; + this._boundCancelHandler = this.handleFormCancellation.bind(this); + this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); + this._boundFailureHandler = this.handleAJAXFailure.bind(this); + this._boundSubmitHandler = this.handleFormSubmission.bind(this); + this._boundWrapperHandler = this.wrapUp.bind(this); + this.registerListeners(); + }, + checkForEscapeOrReturn: function(e) { + if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; + if (Event.KEY_ESC == e.keyCode) + this.handleFormCancellation(e); + else if (Event.KEY_RETURN == e.keyCode) + this.handleFormSubmission(e); + }, + createControl: function(mode, handler, extraClasses) { + var control = this.options[mode + 'Control']; + var text = this.options[mode + 'Text']; + if ('button' == control) { + var btn = document.createElement('input'); + btn.type = 'submit'; + btn.value = text; + btn.className = 'editor_' + mode + '_button'; + if ('cancel' == mode) + btn.onclick = this._boundCancelHandler; + this._form.appendChild(btn); + this._controls[mode] = btn; + } else if ('link' == control) { + var link = document.createElement('a'); + link.href = '#'; + link.appendChild(document.createTextNode(text)); + link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; + link.className = 'editor_' + mode + '_link'; + if (extraClasses) + link.className += ' ' + extraClasses; + this._form.appendChild(link); + this._controls[mode] = link; + } + }, + createEditField: function() { + var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); + var fld; + if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { + fld = document.createElement('input'); + fld.type = 'text'; + var size = this.options.size || this.options.cols || 0; + if (0 < size) fld.size = size; + } else { + fld = document.createElement('textarea'); + fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); + fld.cols = this.options.cols || 40; + } + fld.name = this.options.paramName; + fld.value = text; // No HTML breaks conversion anymore + fld.className = 'editor_field'; + if (this.options.submitOnBlur) + fld.onblur = this._boundSubmitHandler; + this._controls.editor = fld; + if (this.options.loadTextURL) + this.loadExternalText(); + this._form.appendChild(this._controls.editor); + }, + createForm: function() { + var ipe = this; + function addText(mode, condition) { + var text = ipe.options['text' + mode + 'Controls']; + if (!text || condition === false) return; + ipe._form.appendChild(document.createTextNode(text)); + }; + this._form = $(document.createElement('form')); + this._form.id = this.options.formId; + this._form.addClassName(this.options.formClassName); + this._form.onsubmit = this._boundSubmitHandler; + this.createEditField(); + if ('textarea' == this._controls.editor.tagName.toLowerCase()) + this._form.appendChild(document.createElement('br')); + if (this.options.onFormCustomization) + this.options.onFormCustomization(this, this._form); + addText('Before', this.options.okControl || this.options.cancelControl); + this.createControl('ok', this._boundSubmitHandler); + addText('Between', this.options.okControl && this.options.cancelControl); + this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); + addText('After', this.options.okControl || this.options.cancelControl); + }, + destroy: function() { + if (this._oldInnerHTML) + this.element.innerHTML = this._oldInnerHTML; + this.leaveEditMode(); + this.unregisterListeners(); + }, + enterEditMode: function(e) { + if (this._saving || this._editing) return; + this._editing = true; + this.triggerCallback('onEnterEditMode'); + if (this.options.externalControl) + this.options.externalControl.hide(); + this.element.hide(); + this.createForm(); + this.element.parentNode.insertBefore(this._form, this.element); + if (!this.options.loadTextURL) + this.postProcessEditField(); + if (e) Event.stop(e); + }, + enterHover: function(e) { + if (this.options.hoverClassName) + this.element.addClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onEnterHover'); + }, + getText: function() { + return this.element.innerHTML; + }, + handleAJAXFailure: function(transport) { + this.triggerCallback('onFailure', transport); + if (this._oldInnerHTML) { + this.element.innerHTML = this._oldInnerHTML; + this._oldInnerHTML = null; + } + }, + handleFormCancellation: function(e) { + this.wrapUp(); + if (e) Event.stop(e); + }, + handleFormSubmission: function(e) { + var form = this._form; + var value = $F(this._controls.editor); + this.prepareSubmission(); + var params = this.options.callback(form, value); + params = (params ? params + '&' : '?') + 'editorId=' + this.element.id; + if (this.options.htmlResponse) { + var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Updater({ success: this.element }, this.url, options); + } else { + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: params, + onComplete: this._boundWrapperHandler, + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.url, options); + } + if (e) Event.stop(e); + }, + leaveEditMode: function() { + this.element.removeClassName(this.options.savingClassName); + this.removeForm(); + this.leaveHover(); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + if (this.options.externalControl) + this.options.externalControl.show(); + this._saving = false; + this._editing = false; + this._oldInnerHTML = null; + this.triggerCallback('onLeaveEditMode'); + }, + leaveHover: function(e) { + if (this.options.hoverClassName) + this.element.removeClassName(this.options.hoverClassName); + if (this._saving) return; + this.triggerCallback('onLeaveHover'); + }, + loadExternalText: function() { + this._form.addClassName(this.options.loadingClassName); + this._controls.editor.disabled = true; + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._form.removeClassName(this.options.loadingClassName); + var text = transport.responseText; + if (this.options.stripLoadedTextTags) + text = text.stripTags(); + this._controls.editor.value = text; + this._controls.editor.disabled = false; + this.postProcessEditField(); + }.bind(this), + onFailure: this._boundFailureHandler + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + postProcessEditField: function() { + var fpc = this.options.fieldPostCreation; + if (fpc) + $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); + }, + prepareOptions: function() { + this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); + Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); + [this._extraDefaultOptions].flatten().compact().each(function(defs) { + Object.extend(this.options, defs); + }.bind(this)); + }, + prepareSubmission: function() { + this._saving = true; + this.removeForm(); + this.leaveHover(); + this.showSaving(); + }, + registerListeners: function() { + this._listeners = { }; + var listener; + $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { + listener = this[pair.value].bind(this); + this._listeners[pair.key] = listener; + if (!this.options.externalControlOnly) + this.element.observe(pair.key, listener); + if (this.options.externalControl) + this.options.externalControl.observe(pair.key, listener); + }.bind(this)); + }, + removeForm: function() { + if (!this._form) return; + this._form.remove(); + this._form = null; + this._controls = { }; + }, + showSaving: function() { + this._oldInnerHTML = this.element.innerHTML; + this.element.innerHTML = this.options.savingText; + this.element.addClassName(this.options.savingClassName); + this.element.style.backgroundColor = this._originalBackground; + this.element.show(); + }, + triggerCallback: function(cbName, arg) { + if ('function' == typeof this.options[cbName]) { + this.options[cbName](this, arg); + } + }, + unregisterListeners: function() { + $H(this._listeners).each(function(pair) { + if (!this.options.externalControlOnly) + this.element.stopObserving(pair.key, pair.value); + if (this.options.externalControl) + this.options.externalControl.stopObserving(pair.key, pair.value); + }.bind(this)); + }, + wrapUp: function(transport) { + this.leaveEditMode(); + // Can't use triggerCallback due to backward compatibility: requires + // binding + direct element + this._boundComplete(transport, this.element); + } +}; +Object.extend(Ajax.InPlaceEditor.prototype, { + dispose: Ajax.InPlaceEditor.prototype.destroy +}); + + +Ajax.InPlaceCollectionEditor = Class.create(); +Ajax.InPlaceCollectionEditor.DefaultOptions = { + loadingCollectionText: 'Loading options...' +}; +Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); +Object.extend(Ajax.InPlaceCollectionEditor.prototype, { + initialize: function(element, url, options) { + this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; + Ajax.InPlaceEditor.prototype.initialize.call(this, element, url, options); + }, + + createEditField: function() { + var list = document.createElement('select'); + list.name = this.options.paramName; + list.size = 1; + this._controls.editor = list; + this._collection = this.options.collection || []; + if (this.options.loadCollectionURL) + this.loadCollection(); + else + this.checkForExternalText(); + this._form.appendChild(this._controls.editor); + }, + + loadCollection: function() { + this._form.addClassName(this.options.loadingClassName); + this.showLoadingText(this.options.loadingCollectionText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + var js = transport.responseText.strip(); + if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check + throw 'Server returned an invalid collection representation.'; + this._collection = eval(js); + this.checkForExternalText(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadCollectionURL, options); + }, + + showLoadingText: function(text) { + this._controls.editor.disabled = true; + var tempOption = this._controls.editor.firstChild; + if (!tempOption) { + tempOption = document.createElement('option'); + tempOption.value = ''; + this._controls.editor.appendChild(tempOption); + tempOption.selected = true; + } + tempOption.update((text || '').stripScripts().stripTags()); + }, + + checkForExternalText: function() { + this._text = this.getText(); + if (this.options.loadTextURL) + this.loadExternalText(); + else + this.buildOptionList(); + }, + + loadExternalText: function() { + this.showLoadingText(this.options.loadingText); + var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); + Object.extend(options, { + parameters: 'editorId=' + encodeURIComponent(this.element.id), + onComplete: Prototype.emptyFunction, + onSuccess: function(transport) { + this._text = transport.responseText.strip(); + this.buildOptionList(); + }.bind(this), + onFailure: this.onFailure + }); + new Ajax.Request(this.options.loadTextURL, options); + }, + + buildOptionList: function() { + this._form.removeClassName(this.options.loadingClassName); + this._collection = this._collection.map(function(entry) { + return 2 === entry.length ? entry : [entry, entry].flatten(); + }); + var marker = ('value' in this.options) ? this.options.value : this._text; + var textFound = this._collection.any(function(entry) { + return entry[0] == marker; + }.bind(this)); + this._controls.editor.update(''); + var option; + this._collection.each(function(entry, index) { + option = document.createElement('option'); + option.value = entry[0]; + option.selected = textFound ? entry[0] == marker : 0 == index; + option.appendChild(document.createTextNode(entry[1])); + this._controls.editor.appendChild(option); + }.bind(this)); + this._controls.editor.disabled = false; + Field.scrollFreeActivate(this._controls.editor); + } +}); + +//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** +//**** This only exists for a while, in order to let **** +//**** users adapt to the new API. Read up on the new **** +//**** API and convert your code to it ASAP! **** + +Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { + if (!options) return; + function fallback(name, expr) { + if (name in options || expr === undefined) return; + options[name] = expr; + }; + fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : + options.cancelLink == options.cancelButton == false ? false : undefined))); + fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : + options.okLink == options.okButton == false ? false : undefined))); + fallback('highlightColor', options.highlightcolor); + fallback('highlightEndColor', options.highlightendcolor); +}; + + +// Delayed observer, like Form.Element.Observer, +// but waits for delay after last key input +// Ideal for live-search fields + +Form.Element.DelayedObserver = Class.create(); +Form.Element.DelayedObserver.prototype = { + initialize: function(element, delay, callback) { + this.delay = delay || 0.5; + this.element = $(element); + this.callback = callback; + this.timer = null; + this.lastValue = $F(this.element); + Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); + }, + delayedListener: function(event) { + if(this.lastValue == $F(this.element)) return; + if(this.timer) clearTimeout(this.timer); + this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); + this.lastValue = $F(this.element); + }, + onTimerEvent: function() { + this.timer = null; + this.callback(this.element, $F(this.element)); + } +}; diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/dragdrop.js b/main/NOVA_0.4.5/templates/static/javascripts/dragdrop.js similarity index 94% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/dragdrop.js rename to main/NOVA_0.4.5/templates/static/javascripts/dragdrop.js index 108dd66..96eba90 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/dragdrop.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/dragdrop.js @@ -1,4 +1,4 @@ -// script.aculo.us dragdrop.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us dragdrop.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) @@ -6,7 +6,7 @@ // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ -if(typeof Effect == 'undefined') +if(Object.isUndefined(Effect)) throw("dragdrop.js requires including script.aculo.us' effects.js library"); var Droppables = { @@ -22,14 +22,13 @@ var Droppables = { greedy: true, hoverclass: null, tree: false - }, arguments[1] || {}); + }, arguments[1] || { }); // cache containers if(options.containment) { options._containers = []; var containment = options.containment; - if((typeof containment == 'object') && - (containment.constructor == Array)) { + if(Object.isArray(containment)) { containment.each( function(c) { options._containers.push($(c)) }); } else { options._containers.push($(containment)); @@ -89,21 +88,23 @@ var Droppables = { show: function(point, element) { if(!this.drops.length) return; - var affected = []; + var drop, affected = []; - if(this.last_active) this.deactivate(this.last_active); this.drops.each( function(drop) { if(Droppables.isAffected(point, element, drop)) affected.push(drop); }); - if(affected.length>0) { + if(affected.length>0) drop = Droppables.findDeepestChild(affected); + + if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); + if (drop) { Position.within(drop.element, point[0], point[1]); if(drop.onHover) drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - Droppables.activate(drop); + if (drop != this.last_active) Droppables.activate(drop); } }, @@ -224,7 +225,7 @@ var Draggables = { /*--------------------------------------------------------------------------*/ var Draggable = Class.create(); -Draggable._dragging = {}; +Draggable._dragging = { }; Draggable.prototype = { initialize: function(element) { @@ -237,7 +238,7 @@ Draggable.prototype = { }); }, endeffect: function(element) { - var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0; + var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, queue: {scope:'_draggable', position:'end'}, afterFinish: function(){ @@ -255,7 +256,7 @@ Draggable.prototype = { delay: 0 }; - if(!arguments[1] || typeof arguments[1].endeffect == 'undefined') + if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) Object.extend(defaults, { starteffect: function(element) { element._opacity = Element.getOpacity(element); @@ -264,11 +265,11 @@ Draggable.prototype = { } }); - var options = Object.extend(defaults, arguments[1] || {}); + var options = Object.extend(defaults, arguments[1] || { }); this.element = $(element); - if(options.handle && (typeof options.handle == 'string')) + if(options.handle && Object.isString(options.handle)) this.handle = this.element.down('.'+options.handle, 0); if(!this.handle) this.handle = $(options.handle); @@ -281,7 +282,6 @@ Draggable.prototype = { Element.makePositioned(this.element); // fix IE - this.delta = this.currentDelta(); this.options = options; this.dragging = false; @@ -303,7 +303,7 @@ Draggable.prototype = { }, initDrag: function(event) { - if(typeof Draggable._dragging[this.element] != 'undefined' && + if(!Object.isUndefined(Draggable._dragging[this.element]) && Draggable._dragging[this.element]) return; if(Event.isLeftClick(event)) { // abort on form elements, fixes a Firefox issue @@ -326,6 +326,8 @@ Draggable.prototype = { startDrag: function(event) { this.dragging = true; + if(!this.delta) + this.delta = this.currentDelta(); if(this.options.zindex) { this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); @@ -334,7 +336,9 @@ Draggable.prototype = { if(this.options.ghosting) { this._clone = this.element.cloneNode(true); - Position.absolutize(this.element); + this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); + if (!this.element._originallyAbsolute) + Position.absolutize(this.element); this.element.parentNode.insertBefore(this._clone, this.element); } @@ -404,7 +408,9 @@ Draggable.prototype = { } if(this.options.ghosting) { - Position.relativize(this.element); + if (!this.element._originallyAbsolute) + Position.relativize(this.element); + delete this.element._originallyAbsolute; Element.remove(this._clone); this._clone = null; } @@ -418,7 +424,7 @@ Draggable.prototype = { Draggables.notify('onEnd', this, event); var revert = this.options.revert; - if(revert && typeof revert == 'function') revert = revert(this.element); + if(revert && Object.isFunction(revert)) revert = revert(this.element); var d = this.currentDelta(); if(revert && this.options.reverteffect) { @@ -472,15 +478,15 @@ Draggable.prototype = { }.bind(this)); if(this.options.snap) { - if(typeof this.options.snap == 'function') { + if(Object.isFunction(this.options.snap)) { p = this.options.snap(p[0],p[1],this); } else { - if(this.options.snap instanceof Array) { + if(Object.isArray(this.options.snap)) { p = p.map( function(v, i) { - return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this)) + return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)) } else { p = p.map( function(v) { - return Math.round(v/this.options.snap)*this.options.snap }.bind(this)) + return (v/this.options.snap).round()*this.options.snap }.bind(this)) } }} @@ -590,7 +596,7 @@ SortableObserver.prototype = { var Sortable = { SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - sortables: {}, + sortables: { }, _findRootElement: function(element) { while (element.tagName.toUpperCase() != "BODY") { @@ -646,7 +652,7 @@ var Sortable = { onChange: Prototype.emptyFunction, onUpdate: Prototype.emptyFunction - }, arguments[1] || {}); + }, arguments[1] || { }); // clear any old sortable with same element this.destroy(element); @@ -870,7 +876,7 @@ var Sortable = { only: sortableOptions.only, name: element.id, format: sortableOptions.format - }, arguments[1] || {}); + }, arguments[1] || { }); var root = { id: null, @@ -894,7 +900,7 @@ var Sortable = { sequence: function(element) { element = $(element); - var options = Object.extend(this.options(element), arguments[1] || {}); + var options = Object.extend(this.options(element), arguments[1] || { }); return $(this.findElements(element, options) || []).map( function(item) { return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; @@ -903,9 +909,9 @@ var Sortable = { setSequence: function(element, new_sequence) { element = $(element); - var options = Object.extend(this.options(element), arguments[2] || {}); + var options = Object.extend(this.options(element), arguments[2] || { }); - var nodeMap = {}; + var nodeMap = { }; this.findElements(element, options).each( function(n) { if (n.id.match(options.format)) nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; @@ -923,7 +929,7 @@ var Sortable = { serialize: function(element) { element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || {}); + var options = Object.extend(Sortable.options(element), arguments[1] || { }); var name = encodeURIComponent( (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/effects.js b/main/NOVA_0.4.5/templates/static/javascripts/effects.js similarity index 70% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/effects.js rename to main/NOVA_0.4.5/templates/static/javascripts/effects.js index 70d0752..2862f6f 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/effects.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/effects.js @@ -1,4 +1,4 @@ -// script.aculo.us effects.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us effects.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Contributors: @@ -13,17 +13,17 @@ // returns self (or first argument) if not convertable String.prototype.parseColor = function() { var color = '#'; - if(this.slice(0,4) == 'rgb(') { + if (this.slice(0,4) == 'rgb(') { var cols = this.slice(4,this.length-1).split(','); var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); } else { - if(this.slice(0,1) == '#') { - if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if(this.length==7) color = this.toLowerCase(); + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); } } - return(color.length==7 ? color : (arguments[0] || this)); -} + return (color.length==7 ? color : (arguments[0] || this)); +}; /*--------------------------------------------------------------------------*/ @@ -32,7 +32,7 @@ Element.collectTextNodes = function(element) { return (node.nodeType==3 ? node.nodeValue : (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); }).flatten().join(''); -} +}; Element.collectTextNodesIgnoreClass = function(element, className) { return $A($(element).childNodes).collect( function(node) { @@ -40,18 +40,18 @@ Element.collectTextNodesIgnoreClass = function(element, className) { ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? Element.collectTextNodesIgnoreClass(node, className) : '')); }).flatten().join(''); -} +}; Element.setContentZoom = function(element, percent) { element = $(element); element.setStyle({fontSize: (percent/100) + 'em'}); - if(Prototype.Browser.WebKit) window.scrollBy(0,0); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); return element; -} +}; Element.getInlineOpacity = function(element){ return $(element).style.opacity || ''; -} +}; Element.forceRerendering = function(element) { try { @@ -64,31 +64,63 @@ Element.forceRerendering = function(element) { /*--------------------------------------------------------------------------*/ -Array.prototype.call = function() { - var args = arguments; - this.each(function(f){ f.apply(this, args) }); -} - -/*--------------------------------------------------------------------------*/ - var Effect = { _elementDoesNotExistError: { name: 'ElementDoesNotExistError', message: 'The specified DOM element does not exist, but is required for this effect to operate' }, + Transitions: { + linear: Prototype.K, + sinoidal: function(pos) { + return (-Math.cos(pos*Math.PI)/2) + 0.5; + }, + reverse: function(pos) { + return 1-pos; + }, + flicker: function(pos) { + var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; + return pos > 1 ? 1 : pos; + }, + wobble: function(pos) { + return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; + }, + pulse: function(pos, pulses) { + pulses = pulses || 5; + return ( + ((pos % (1/pulses)) * pulses).round() == 0 ? + ((pos * pulses * 2) - (pos * pulses * 2).floor()) : + 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) + ); + }, + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + }, + none: function(pos) { + return 0; + }, + full: function(pos) { + return 1; + } + }, + DefaultOptions: { + duration: 1.0, // seconds + fps: 100, // 100= assume 66fps max. + sync: false, // true for combining + from: 0.0, + to: 1.0, + delay: 0.0, + queue: 'parallel' + }, tagifyText: function(element) { - if(typeof Builder == 'undefined') - throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); - var tagifyStyle = 'position:relative'; - if(Prototype.Browser.IE) tagifyStyle += ';zoom:1'; + if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; element = $(element); $A(element.childNodes).each( function(child) { - if(child.nodeType==3) { + if (child.nodeType==3) { child.nodeValue.toArray().each( function(character) { element.insertBefore( - Builder.node('span',{style: tagifyStyle}, + new Element('span', {style: tagifyStyle}).update( character == ' ' ? String.fromCharCode(160) : character), child); }); @@ -98,8 +130,8 @@ var Effect = { }, multiple: function(element, effect) { var elements; - if(((typeof element == 'object') || - (typeof element == 'function')) && + if (((typeof element == 'object') || + Object.isFunction(element)) && (element.length)) elements = element; else @@ -108,7 +140,7 @@ var Effect = { var options = Object.extend({ speed: 0.1, delay: 0.0 - }, arguments[2] || {}); + }, arguments[2] || { }); var masterDelay = options.delay; $A(elements).each( function(element, index) { @@ -125,51 +157,17 @@ var Effect = { effect = (effect || 'appear').toLowerCase(); var options = Object.extend({ queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, arguments[2] || {}); + }, arguments[2] || { }); Effect[element.visible() ? Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); } }; -var Effect2 = Effect; // deprecated - -/* ------------- transitions ------------- */ - -Effect.Transitions = { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + 0.5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; - return (pos > 1 ? 1 : pos); - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; - }, - pulse: function(pos, pulses) { - pulses = pulses || 5; - return ( - Math.round((pos % (1/pulses)) * pulses) == 0 ? - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) : - 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) - ); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } -}; +Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; /* ------------- core effects ------------- */ -Effect.ScopedQueue = Class.create(); -Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { +Effect.ScopedQueue = Class.create(Enumerable, { initialize: function() { this.effects = []; this.interval = null; @@ -180,7 +178,7 @@ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { add: function(effect) { var timestamp = new Date().getTime(); - var position = (typeof effect.options.queue == 'string') ? + var position = Object.isString(effect.options.queue) ? effect.options.queue : effect.options.queue.position; switch(position) { @@ -203,15 +201,15 @@ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { effect.startOn += timestamp; effect.finishOn += timestamp; - if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) + if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) this.effects.push(effect); - if(!this.interval) + if (!this.interval) this.interval = setInterval(this.loop.bind(this), 15); }, remove: function(effect) { this.effects = this.effects.reject(function(e) { return e==effect }); - if(this.effects.length == 0) { + if (this.effects.length == 0) { clearInterval(this.interval); this.interval = null; } @@ -226,28 +224,17 @@ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { Effect.Queues = { instances: $H(), get: function(queueName) { - if(typeof queueName != 'string') return queueName; + if (!Object.isString(queueName)) return queueName; - if(!this.instances[queueName]) + if (!this.instances[queueName]) this.instances[queueName] = new Effect.ScopedQueue(); return this.instances[queueName]; } -} +}; Effect.Queue = Effect.Queues.get('global'); -Effect.DefaultOptions = { - transition: Effect.Transitions.sinoidal, - duration: 1.0, // seconds - fps: 100, // 100= assume 66fps max. - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' -} - -Effect.Base = function() {}; +Effect.Base = Class.create(); Effect.Base.prototype = { position: null, start: function(options) { @@ -257,8 +244,8 @@ Effect.Base.prototype = { (options[eventName] ? 'this.options.'+eventName+'(this);' : '') ); } - if(options.transition === false) options.transition = Effect.Transitions.linear; - this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {}); + if (options && options.transition === false) options.transition = Effect.Transitions.linear; + this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); this.currentFrame = 0; this.state = 'idle'; this.startOn = this.options.delay*1000; @@ -268,61 +255,60 @@ Effect.Base.prototype = { this.totalFrames = this.options.fps*this.options.duration; eval('this.render = function(pos){ '+ - 'if(this.state=="idle"){this.state="running";'+ - codeForEvent(options,'beforeSetup')+ + 'if (this.state=="idle"){this.state="running";'+ + codeForEvent(this.options,'beforeSetup')+ (this.setup ? 'this.setup();':'')+ - codeForEvent(options,'afterSetup')+ - '};if(this.state=="running"){'+ + codeForEvent(this.options,'afterSetup')+ + '};if (this.state=="running"){'+ 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+ 'this.position=pos;'+ - codeForEvent(options,'beforeUpdate')+ + codeForEvent(this.options,'beforeUpdate')+ (this.update ? 'this.update(pos);':'')+ - codeForEvent(options,'afterUpdate')+ + codeForEvent(this.options,'afterUpdate')+ '}}'); this.event('beforeStart'); - if(!this.options.sync) - Effect.Queues.get(typeof this.options.queue == 'string' ? + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? 'global' : this.options.queue.scope).add(this); }, loop: function(timePos) { - if(timePos >= this.startOn) { - if(timePos >= this.finishOn) { + if (timePos >= this.startOn) { + if (timePos >= this.finishOn) { this.render(1.0); this.cancel(); this.event('beforeFinish'); - if(this.finish) this.finish(); + if (this.finish) this.finish(); this.event('afterFinish'); return; } var pos = (timePos - this.startOn) / this.totalTime, - frame = Math.round(pos * this.totalFrames); - if(frame > this.currentFrame) { + frame = (pos * this.totalFrames).round(); + if (frame > this.currentFrame) { this.render(pos); this.currentFrame = frame; } } }, cancel: function() { - if(!this.options.sync) - Effect.Queues.get(typeof this.options.queue == 'string' ? + if (!this.options.sync) + Effect.Queues.get(Object.isString(this.options.queue) ? 'global' : this.options.queue.scope).remove(this); this.state = 'finished'; }, event: function(eventName) { - if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if(this.options[eventName]) this.options[eventName](this); + if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); + if (this.options[eventName]) this.options[eventName](this); }, inspect: function() { var data = $H(); for(property in this) - if(typeof this[property] != 'function') data[property] = this[property]; + if (!Object.isFunction(this[property])) data[property] = this[property]; return '#'; } -} +}; -Effect.Parallel = Class.create(); -Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { +Effect.Parallel = Class.create(Effect.Base, { initialize: function(effects) { this.effects = effects || []; this.start(arguments[1]); @@ -335,35 +321,45 @@ Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { effect.render(1.0); effect.cancel(); effect.event('beforeFinish'); - if(effect.finish) effect.finish(position); + if (effect.finish) effect.finish(position); effect.event('afterFinish'); }); } }); -Effect.Event = Class.create(); -Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), { +Effect.Tween = Class.create(Effect.Base, { + initialize: function(object, from, to) { + object = Object.isString(object) ? $(object) : object; + var args = $A(arguments), method = args.last(), + options = args.length == 5 ? args[3] : null; + this.method = Object.isFunction(method) ? method.bind(object) : + Object.isFunction(object[method]) ? object[method].bind(object) : + function(value) { object[method] = value }; + this.start(Object.extend({ from: from, to: to }, options || { })); + }, + update: function(position) { + this.method(position); + } +}); + +Effect.Event = Class.create(Effect.Base, { initialize: function() { - var options = Object.extend({ - duration: 0 - }, arguments[0] || {}); - this.start(options); + this.start(Object.extend({ duration: 0 }, arguments[0] || { })); }, update: Prototype.emptyFunction }); -Effect.Opacity = Class.create(); -Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { +Effect.Opacity = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); + if (!this.element) throw(Effect._elementDoesNotExistError); // make this work on IE on elements without 'layout' - if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom: 1}); var options = Object.extend({ from: this.element.getOpacity() || 0.0, to: 1.0 - }, arguments[1] || {}); + }, arguments[1] || { }); this.start(options); }, update: function(position) { @@ -371,36 +367,30 @@ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { } }); -Effect.Move = Class.create(); -Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { +Effect.Move = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); + if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ x: 0, y: 0, mode: 'relative' - }, arguments[1] || {}); + }, arguments[1] || { }); this.start(options); }, setup: function() { - // Bug in Opera: Opera returns the "real" position of a static element or - // relative element that does not have top/left explicitly set. - // ==> Always set top and left for position relative elements in your stylesheets - // (to 0 if you do not need them) this.element.makePositioned(); this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if(this.options.mode == 'absolute') { - // absolute movement, so we need to calc deltaX and deltaY + if (this.options.mode == 'absolute') { this.options.x = this.options.x - this.originalLeft; this.options.y = this.options.y - this.originalTop; } }, update: function(position) { this.element.setStyle({ - left: Math.round(this.options.x * position + this.originalLeft) + 'px', - top: Math.round(this.options.y * position + this.originalTop) + 'px' + left: (this.options.x * position + this.originalLeft).round() + 'px', + top: (this.options.y * position + this.originalTop).round() + 'px' }); } }); @@ -408,30 +398,29 @@ Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { // for backwards compatibility Effect.MoveBy = function(element, toTop, toLeft) { return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || {})); + Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); }; -Effect.Scale = Class.create(); -Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { +Effect.Scale = Class.create(Effect.Base, { initialize: function(element, percent) { this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); + if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ scaleX: true, scaleY: true, scaleContent: true, scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or {} with provided values + scaleMode: 'box', // 'box' or 'contents' or { } with provided values scaleFrom: 100.0, scaleTo: percent - }, arguments[2] || {}); + }, arguments[2] || { }); this.start(options); }, setup: function() { this.restoreAfterFinish = this.options.restoreAfterFinish || false; this.elementPositioning = this.element.getStyle('position'); - this.originalStyle = {}; + this.originalStyle = { }; ['top','left','width','height','fontSize'].each( function(k) { this.originalStyle[k] = this.element.style[k]; }.bind(this)); @@ -441,7 +430,7 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { var fontSize = this.element.getStyle('font-size') || '100%'; ['em','px','%','pt'].each( function(fontSizeType) { - if(fontSize.indexOf(fontSizeType)>0) { + if (fontSize.indexOf(fontSizeType)>0) { this.fontSize = parseFloat(fontSize); this.fontSizeType = fontSizeType; } @@ -450,62 +439,61 @@ Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; this.dims = null; - if(this.options.scaleMode=='box') + if (this.options.scaleMode=='box') this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if(/^content/.test(this.options.scaleMode)) + if (/^content/.test(this.options.scaleMode)) this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if(!this.dims) + if (!this.dims) this.dims = [this.options.scaleMode.originalHeight, this.options.scaleMode.originalWidth]; }, update: function(position) { var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if(this.options.scaleContent && this.fontSize) + if (this.options.scaleContent && this.fontSize) this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); }, finish: function(position) { - if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle); + if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); }, setDimensions: function(height, width) { - var d = {}; - if(this.options.scaleX) d.width = Math.round(width) + 'px'; - if(this.options.scaleY) d.height = Math.round(height) + 'px'; - if(this.options.scaleFromCenter) { + var d = { }; + if (this.options.scaleX) d.width = width.round() + 'px'; + if (this.options.scaleY) d.height = height.round() + 'px'; + if (this.options.scaleFromCenter) { var topd = (height - this.dims[0])/2; var leftd = (width - this.dims[1])/2; - if(this.elementPositioning == 'absolute') { - if(this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; + if (this.elementPositioning == 'absolute') { + if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; + if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; } else { - if(this.options.scaleY) d.top = -topd + 'px'; - if(this.options.scaleX) d.left = -leftd + 'px'; + if (this.options.scaleY) d.top = -topd + 'px'; + if (this.options.scaleX) d.left = -leftd + 'px'; } } this.element.setStyle(d); } }); -Effect.Highlight = Class.create(); -Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { +Effect.Highlight = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {}); + if (!this.element) throw(Effect._elementDoesNotExistError); + var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); this.start(options); }, setup: function() { // Prevent executing on elements not in the layout flow - if(this.element.getStyle('display')=='none') { this.cancel(); return; } + if (this.element.getStyle('display')=='none') { this.cancel(); return; } // Disable background image during the effect - this.oldStyle = {}; + this.oldStyle = { }; if (!this.options.keepBackgroundImage) { this.oldStyle.backgroundImage = this.element.getStyle('background-image'); this.element.setStyle({backgroundImage: 'none'}); } - if(!this.options.endcolor) + if (!this.options.endcolor) this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if(!this.options.restorecolor) + if (!this.options.restorecolor) this.options.restorecolor = this.element.getStyle('background-color'); // init color calculations this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); @@ -513,7 +501,7 @@ Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), }, update: function(position) { this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) }); + return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); }, finish: function() { this.element.setStyle(Object.extend(this.oldStyle, { @@ -522,30 +510,21 @@ Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), } }); -Effect.ScrollTo = Class.create(); -Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - this.start(arguments[1] || {}); - }, - setup: function() { - Position.prepare(); - var offsets = Position.cumulativeOffset(this.element); - if(this.options.offset) offsets[1] += this.options.offset; - var max = window.innerHeight ? - window.height - window.innerHeight : - document.body.scrollHeight - - (document.documentElement.clientHeight ? - document.documentElement.clientHeight : document.body.clientHeight); - this.scrollStart = Position.deltaY; - this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart; - }, - update: function(position) { - Position.prepare(); - window.scrollTo(Position.deltaX, - this.scrollStart + (position*this.delta)); - } -}); +Effect.ScrollTo = function(element) { + var options = arguments[1] || { }, + scrollOffsets = document.viewport.getScrollOffsets(), + elementOffsets = $(element).cumulativeOffset(), + max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + + if (options.offset) elementOffsets[1] += options.offset; + + return new Effect.Tween(null, + scrollOffsets.top, + elementOffsets[1] > max ? max : elementOffsets[1], + options, + function(p){ scrollTo(scrollOffsets.left, p.round()) } + ); +}; /* ------------- combination effects ------------- */ @@ -553,14 +532,15 @@ Effect.Fade = function(element) { element = $(element); var oldOpacity = element.getInlineOpacity(); var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if(effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - }}, arguments[1] || {}); + from: element.getOpacity() || 1.0, + to: 0.0, + afterFinishInternal: function(effect) { + if (effect.options.to!=0) return; + effect.element.hide().setStyle({opacity: oldOpacity}); + } + }, arguments[1] || { }); return new Effect.Opacity(element,options); -} +}; Effect.Appear = function(element) { element = $(element); @@ -573,9 +553,9 @@ Effect.Appear = function(element) { }, beforeSetup: function(effect) { effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || {}); + }}, arguments[1] || { }); return new Effect.Opacity(element,options); -} +}; Effect.Puff = function(element) { element = $(element); @@ -597,9 +577,9 @@ Effect.Puff = function(element) { }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || {}) + }, arguments[1] || { }) ); -} +}; Effect.BlindUp = function(element) { element = $(element); @@ -611,9 +591,9 @@ Effect.BlindUp = function(element) { afterFinishInternal: function(effect) { effect.element.hide().undoClipping(); } - }, arguments[1] || {}) + }, arguments[1] || { }) ); -} +}; Effect.BlindDown = function(element) { element = $(element); @@ -630,8 +610,8 @@ Effect.BlindDown = function(element) { afterFinishInternal: function(effect) { effect.element.undoClipping(); } - }, arguments[1] || {})); -} + }, arguments[1] || { })); +}; Effect.SwitchOff = function(element) { element = $(element); @@ -652,8 +632,8 @@ Effect.SwitchOff = function(element) { } }) } - }, arguments[1] || {})); -} + }, arguments[1] || { })); +}; Effect.DropOut = function(element) { element = $(element); @@ -672,8 +652,8 @@ Effect.DropOut = function(element) { afterFinishInternal: function(effect) { effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); } - }, arguments[1] || {})); -} + }, arguments[1] || { })); +}; Effect.Shake = function(element) { element = $(element); @@ -694,7 +674,7 @@ Effect.Shake = function(element) { { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { effect.element.undoPositioned().setStyle(oldStyle); }}) }}) }}) }}) }}) }}); -} +}; Effect.SlideDown = function(element) { element = $(element).cleanWhitespace(); @@ -710,7 +690,7 @@ Effect.SlideDown = function(element) { afterSetup: function(effect) { effect.element.makePositioned(); effect.element.down().makePositioned(); - if(window.opera) effect.element.setStyle({top: ''}); + if (window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping().setStyle({height: '0px'}).show(); }, afterUpdateInternal: function(effect) { @@ -720,23 +700,25 @@ Effect.SlideDown = function(element) { afterFinishInternal: function(effect) { effect.element.undoClipping().undoPositioned(); effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || {}) + }, arguments[1] || { }) ); -} +}; Effect.SlideUp = function(element) { element = $(element).cleanWhitespace(); var oldInnerBottom = element.down().getStyle('bottom'); + var elementDimensions = element.getDimensions(); return new Effect.Scale(element, window.opera ? 0 : 1, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'box', scaleFrom: 100, + scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, - beforeStartInternal: function(effect) { + afterSetup: function(effect) { effect.element.makePositioned(); effect.element.down().makePositioned(); - if(window.opera) effect.element.setStyle({top: ''}); + if (window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping().show(); }, afterUpdateInternal: function(effect) { @@ -744,12 +726,12 @@ Effect.SlideUp = function(element) { (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom}); - effect.element.down().undoPositioned(); + effect.element.hide().undoClipping().undoPositioned(); + effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || {}) + }, arguments[1] || { }) ); -} +}; // Bug in opera makes the TD containing this element expand for a instance after finish Effect.Squish = function(element) { @@ -762,7 +744,7 @@ Effect.Squish = function(element) { effect.element.hide().undoClipping(); } }); -} +}; Effect.Grow = function(element) { element = $(element); @@ -771,7 +753,7 @@ Effect.Grow = function(element) { moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.full - }, arguments[1] || {}); + }, arguments[1] || { }); var oldStyle = { top: element.style.top, left: element.style.left, @@ -836,7 +818,7 @@ Effect.Grow = function(element) { ) } }); -} +}; Effect.Shrink = function(element) { element = $(element); @@ -845,7 +827,7 @@ Effect.Shrink = function(element) { moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.none - }, arguments[1] || {}); + }, arguments[1] || { }); var oldStyle = { top: element.style.top, left: element.style.left, @@ -890,11 +872,11 @@ Effect.Shrink = function(element) { effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } }, options) ); -} +}; Effect.Pulsate = function(element) { element = $(element); - var options = arguments[1] || {}; + var options = arguments[1] || { }; var oldOpacity = element.getInlineOpacity(); var transition = options.transition || Effect.Transitions.sinoidal; var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; @@ -903,7 +885,7 @@ Effect.Pulsate = function(element) { Object.extend(Object.extend({ duration: 2.0, from: 0, afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } }, options), {transition: reverser})); -} +}; Effect.Fold = function(element) { element = $(element); @@ -923,46 +905,43 @@ Effect.Fold = function(element) { afterFinishInternal: function(effect) { effect.element.hide().undoClipping().setStyle(oldStyle); } }); - }}, arguments[1] || {})); + }}, arguments[1] || { })); }; -Effect.Morph = Class.create(); -Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { +Effect.Morph = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); + if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ - style: {} - }, arguments[1] || {}); - if (typeof options.style == 'string') { - if(options.style.indexOf(':') == -1) { - var cssText = '', selector = '.' + options.style; - $A(document.styleSheets).reverse().each(function(styleSheet) { - if (styleSheet.cssRules) cssRules = styleSheet.cssRules; - else if (styleSheet.rules) cssRules = styleSheet.rules; - $A(cssRules).reverse().each(function(rule) { - if (selector == rule.selectorText) { - cssText = rule.style.cssText; - throw $break; - } - }); - if (cssText) throw $break; + style: { } + }, arguments[1] || { }); + + if (!Object.isString(options.style)) this.style = $H(options.style); + else { + if (options.style.include(':')) + this.style = options.style.parseStyle(); + else { + this.element.addClassName(options.style); + this.style = $H(this.element.getStyles()); + this.element.removeClassName(options.style); + var css = this.element.getStyles(); + this.style = this.style.reject(function(style) { + return style.value == css[style.key]; }); - this.style = cssText.parseStyle(); - options.afterFinishInternal = function(effect){ + options.afterFinishInternal = function(effect) { effect.element.addClassName(effect.options.style); effect.transforms.each(function(transform) { - if(transform.style != 'opacity') - effect.element.style[transform.style] = ''; + effect.element.style[transform.style] = ''; }); } - } else this.style = options.style.parseStyle(); - } else this.style = $H(options.style) + } + } this.start(options); }, + setup: function(){ function parseColor(color){ - if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; + if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; color = color.parseColor(); return $R(0,2).map(function(i){ return parseInt( color.slice(i*2+1,i*2+3), 16 ) @@ -971,14 +950,14 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { this.transforms = this.style.map(function(pair){ var property = pair[0], value = pair[1], unit = null; - if(value.parseColor('#zzzzzz') != '#zzzzzz') { + if (value.parseColor('#zzzzzz') != '#zzzzzz') { value = value.parseColor(); unit = 'color'; - } else if(property == 'opacity') { + } else if (property == 'opacity') { value = parseFloat(value); - if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) + if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom: 1}); - } else if(Element.CSS_LENGTH.test(value)) { + } else if (Element.CSS_LENGTH.test(value)) { var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); value = parseFloat(components[1]); unit = (components.length == 3) ? components[2] : null; @@ -1002,7 +981,7 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { }); }, update: function(position) { - var style = {}, transform, i = this.transforms.length; + var style = { }, transform, i = this.transforms.length; while(i--) style[(transform = this.transforms[i]).style] = transform.unit=='color' ? '#'+ @@ -1012,17 +991,17 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + (Math.round(transform.originalValue[2]+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : - transform.originalValue + Math.round( - ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit; + (transform.originalValue + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.unit === null ? '' : transform.unit); this.element.setStyle(style, true); } }); -Effect.Transform = Class.create(); -Object.extend(Effect.Transform.prototype, { +Effect.Transform = Class.create({ initialize: function(tracks){ this.tracks = []; - this.options = arguments[1] || {}; + this.options = arguments[1] || { }; this.addTracks(tracks); }, addTracks: function(tracks){ @@ -1060,35 +1039,79 @@ Element.CSS_PROPERTIES = $w( Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; +String.__parseStyleElement = document.createElement('div'); String.prototype.parseStyle = function(){ - var element = document.createElement('div'); - element.innerHTML = '
    '; - var style = element.childNodes[0].style, styleRules = $H(); + var style, styleRules = $H(); + if (Prototype.Browser.WebKit) + style = new Element('div',{style:this}).style; + else { + String.__parseStyleElement.innerHTML = '
    '; + style = String.__parseStyleElement.childNodes[0].style; + } Element.CSS_PROPERTIES.each(function(property){ - if(style[property]) styleRules[property] = style[property]; + if (style[property]) styleRules[property] = style[property]; }); - if(Prototype.Browser.IE && this.indexOf('opacity') > -1) { + + if (Prototype.Browser.IE && this.include('opacity')) styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]; - } + return styleRules; }; -Element.morph = function(element, style) { - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {})); - return element; +if (document.defaultView && document.defaultView.getComputedStyle) { + Element.getStyles = function(element) { + var css = document.defaultView.getComputedStyle($(element), null); + return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { + styles[property] = css[property]; + return styles; + }); + }; +} else { + Element.getStyles = function(element) { + element = $(element); + var css = element.currentStyle, styles; + styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) { + hash[property] = css[property]; + return hash; + }); + if (!styles.opacity) styles.opacity = element.getOpacity(); + return styles; + }; +}; + +Effect.Methods = { + morph: function(element, style) { + element = $(element); + new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); + return element; + }, + visualEffect: function(element, effect, options) { + element = $(element) + var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); + new Effect[klass](element, options); + return element; + }, + highlight: function(element, options) { + element = $(element); + new Effect.Highlight(element, options); + return element; + } }; -['getInlineOpacity','forceRerendering','setContentZoom', - 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each( - function(f) { Element.Methods[f] = Element[f]; } +$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ + 'pulsate shake puff squish switchOff dropOut').each( + function(effect) { + Effect.Methods[effect] = function(element, options){ + element = $(element); + Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); + return element; + } + } ); -Element.Methods.visualEffect = function(element, effect, options) { - s = effect.dasherize().camelize(); - effect_class = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[effect_class](element, options); - return $(element); -}; +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( + function(f) { Effect.Methods[f] = Element[f]; } +); -Element.addMethods(); \ No newline at end of file +Element.addMethods(Effect.Methods); \ No newline at end of file diff --git a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.js b/main/NOVA_0.4.5/templates/static/javascripts/lytebox.js similarity index 94% rename from main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.js rename to main/NOVA_0.4.5/templates/static/javascripts/lytebox.js index 6f27c1a..78b389a 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/lytebox.js @@ -1,17 +1,19 @@ //***********************************************************************************************************************************/ -// LyteBox v3.20 +// LyteBox v3.22 // // Author: Markus F. Hay // Website: http://www.dolem.com/lytebox -// Date: July 12, 2007 +// Date: October 2, 2007 // License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/) -// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE, Strict DOCTYPE, and Transitional DOCTYPE): -// * Firefox: 2.0.0.4, 1.5.0.12 +// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES): +// * Firefox: 2.0.0.7, 1.5.0.12 // * Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2 -// * Opera: 9.21 +// * Opera: 9.23 // // Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62 -// * v3.20 (07/11/07) +// * v3.22 (10/02/07) +// * v3.21 (09/30/07) +// * v3.20 (07/12/07) // * v3.10 (05/28/07) // * v3.00 (05/15/07) // * v2.02 (11/13/06) @@ -28,18 +30,18 @@ function LyteBox() { this.theme = 'grey'; // themes: grey (default), red, green, blue, gold this.hideFlash = true; // controls whether or not Flash objects should be hidden this.outerBorder = false; // controls whether to show the outer grey (or theme) border - this.resizeSpeed = 8; // controls the speed of the image resizing (1=slowest and 10=fastest) + this.resizeSpeed = 10; // controls the speed of the image resizing (1=slowest and 10=fastest) this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay this.navType = 1; // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number - this.autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions + this.autoResize = false; // controls whether or not images should be resized if larger than the browser window dimensions this.doAnimations = false; // controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc. this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone... /*** End Global Configuration ***/ /*** Configure Slideshow Options ***/ - this.slideInterval = 4000; // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds) - this.showNavigation = true; // true to display Next/Prev buttons/text during slideshow, false to hide + this.slideInterval = 0; // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds) + this.showNavigation = false; // true to display Next/Prev buttons/text during slideshow, false to hide this.showClose = true; // true to display the Close button, false to hide this.showDetails = true; // true to display image details (caption, count), false to hide this.showPlayPause = true; // true to display pause/play buttons next to close button, false to hide @@ -81,7 +83,7 @@ function LyteBox() { this.ie = false; /*@end @*/ - this.ie7 = (this.ie && window.XMLHttpRequest); + this.ie7 = (this.ie && window.XMLHttpRequest); this.initialize(); } LyteBox.prototype.initialize = function() { @@ -94,6 +96,9 @@ LyteBox.prototype.initialize = function() { var objOverlay = this.doc.createElement("div"); objOverlay.setAttribute('id','lbOverlay'); objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme); + if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) { + objOverlay.style.position = 'absolute'; + } objOverlay.style.display = 'none'; objBody.appendChild(objOverlay); var objLytebox = this.doc.createElement("div"); @@ -278,7 +283,7 @@ LyteBox.prototype.start = function(imageLink, doSlide, doFrame) { } this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; } this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; } - this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; } + this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; } this.isSlideshow = doSlide; this.isPaused = (this.slideNum != 0 ? true : false); if (this.isSlideshow && this.showPlayPause && this.isPaused) { @@ -340,7 +345,6 @@ LyteBox.prototype.changeContent = function(imageNum) { //iframe.style.border = b.trim(); } } - iframe.src = this.frameArray[this.activeFrame][0]; this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height)); } else { imgPreloader = new Image(); @@ -449,6 +453,9 @@ LyteBox.prototype.showContent = function() { } this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : ''); this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none'); + try { + this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0]; + } catch(e) { } } else { this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200); } @@ -635,6 +642,9 @@ LyteBox.prototype.end = function(caller) { if (this.isSlideshow) { for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } } + if (this.isLyteframe) { + this.initialize(); + } }; LyteBox.prototype.checkFrame = function() { if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { @@ -665,11 +675,13 @@ LyteBox.prototype.appear = function(id, opacity) { object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + (opacity + 10) + ")"; if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) { + try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ this.updateDetails(); } else if (opacity >= this.maxOpacity && id == 'lbOverlay') { for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); } return; } else if (opacity >= 100 && id == 'lbDetailsContainer') { + try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); } this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px"; } else { diff --git a/main/NOVA_0.4.4/templates/static/javascripts/nova.js b/main/NOVA_0.4.5/templates/static/javascripts/nova.js similarity index 99% rename from main/NOVA_0.4.4/templates/static/javascripts/nova.js rename to main/NOVA_0.4.5/templates/static/javascripts/nova.js index 544dd72..b025bae 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/nova.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/nova.js @@ -215,7 +215,7 @@ function MainLoop(){ verbosity += ''; break; case "DEL": - verbosity += ''; + verbosity += ''; break; case "FJN": verbosity += ''; diff --git a/main/NOVA_0.4.4/templates/static/javascripts/prototype/prototype.js b/main/NOVA_0.4.5/templates/static/javascripts/prototype.js similarity index 90% rename from main/NOVA_0.4.4/templates/static/javascripts/prototype/prototype.js rename to main/NOVA_0.4.5/templates/static/javascripts/prototype.js index 5c10c3c..b65cbcd 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/prototype/prototype.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.6.0_rc0 +/* Prototype JavaScript framework, version 1.6.0_rc1 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,14 +7,14 @@ *--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.6.0_rc0', + Version: '1.6.0_rc1', 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(/iPhone.*Mobile.*Safari/) + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) }, BrowserFeatures: { @@ -35,75 +35,70 @@ var Prototype = { if (Prototype.Browser.MobileSafari) Prototype.BrowserFeatures.SpecificElementExtensions = false; +if (Prototype.Browser.WebKit) + Prototype.BrowserFeatures.XPath = false; + /* Based on Alex Arnell's inheritance implementation. */ var Class = { - create: function(parent, methods) { - if (arguments.length == 1 && !Object.isFunction(parent)) - methods = parent, parent = null; - - var method = function() { - if (!Class.extending) this.initialize.apply(this, arguments); - }; - - method.superclass = parent; - method.subclasses = []; + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); - if (Object.isFunction(parent)) { - Class.extending = true; - method.prototype = new parent(); + function klass() { + this.initialize.apply(this, arguments); + } - parent.subclasses.push(method); + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; - delete Class.extending; + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); } - if (methods) Class.extend(method, methods); - method.prototype.constructor = method; + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); - return method; - }, + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; - extend: function(destination, source) { - for (var name in source) Class.inherit(destination, source, name); - return destination; - }, + klass.prototype.constructor = klass; - inherit: function(destination, source, name) { - var prototype = destination.prototype, ancestor = prototype[name], - descendant = source[name]; - if (ancestor && Object.isFunction(descendant) && - descendant.argumentNames().first() == "$super") { - var method = descendant, descendant = ancestor.wrap(method); - Object.extend(descendant, { - valueOf: function() { return method }, - toString: function() { return method.toString() } - }); - } - - prototype[name] = descendant; + return klass; + } +}; - if (destination.subclasses && destination.subclasses.length > 0) { - for (var i = 0, subclass; subclass = destination.subclasses[i]; i++) { - Class.extending = true; - Object.extend(subclass.prototype, new destination()); - subclass.prototype.constructor = subclass; - delete Class.extending; - Class.inherit(subclass, destination.prototype, name); +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + + for (var property in source) { + var value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value, value = Object.extend((function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method), { + valueOf: function() { return method }, + toString: function() { return method.toString() } + }); } + this.prototype[property] = value; } - }, - mixin: function(destination, source) { - return Object.extend(destination, source); + return this; } }; var Abstract = { }; Object.extend = function(destination, source) { - for (var property in source) { + for (var property in source) destination[property] = source[property]; - } return destination; }; @@ -142,6 +137,10 @@ Object.extend(Object, { return '{' + results.join(', ') + '}'; }, + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + toHTML: function(object) { return object && object.toHTML ? object.toHTML() : String.interpret(object); }, @@ -172,6 +171,10 @@ Object.extend(Object, { return object && object.constructor === Array; }, + isHash: function(object) { + return object instanceof Hash; + }, + isFunction: function(object) { return typeof object == "function"; }, @@ -191,7 +194,7 @@ Object.extend(Object, { Object.extend(Function.prototype, { argumentNames: function() { - var names = this.toString().match(/^[\s\(]*function\s*\((.*?)\)/)[1].split(",").invoke("strip"); + var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); return names.length == 1 && !names[0] ? [] : names; }, @@ -244,12 +247,12 @@ Object.extend(Function.prototype, { Function.prototype.defer = Function.prototype.delay.curry(0.01); Date.prototype.toJSON = function() { - return '"' + this.getFullYear() + '-' + - (this.getMonth() + 1).toPaddedString(2) + '-' + - this.getDate().toPaddedString(2) + 'T' + - this.getHours().toPaddedString(2) + ':' + - this.getMinutes().toPaddedString(2) + ':' + - this.getSeconds().toPaddedString(2) + '"'; + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; }; var Try = { @@ -289,6 +292,10 @@ var PeriodicalExecuter = Class.create({ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, + execute: function() { + this.callback(this); + }, + stop: function() { if (!this.timer) return; clearInterval(this.timer); @@ -299,7 +306,7 @@ var PeriodicalExecuter = Class.create({ if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; - this.callback(this); + this.execute(); } finally { this.currentlyExecuting = false; } @@ -427,9 +434,7 @@ Object.extend(String.prototype, { }, times: function(count) { - var result = ''; - for (var i = 0; i < count; i++) result += this; - return result; + return count < 1 ? '' : new Array(count + 1).join(this); }, camelize: function() { @@ -538,9 +543,7 @@ Object.extend(String.prototype.escapeHTML, { with (String.prototype.escapeHTML) div.appendChild(text); -var Template = Class.create(); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; -Template.prototype = { +var Template = Class.create({ initialize: function(template, pattern) { this.template = template.toString(); this.pattern = pattern || Template.Pattern; @@ -571,7 +574,8 @@ Template.prototype = { return before + String.interpret(ctx); }.bind(this)); } -}; +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; var $break = { }; @@ -664,11 +668,11 @@ var Enumerable = { include: function(object) { if (Object.isFunction(this.indexOf)) - return this.indexOf(object) != -1; + if (this.indexOf(object) != -1) return true; var found = false; this.each(function(value) { - if (value === object) { + if (value == object) { found = true; throw $break; } @@ -796,26 +800,19 @@ Object.extend(Enumerable, { function $A(iterable) { if (!iterable) return []; if (iterable.toArray) return iterable.toArray(); - else { - var results = []; - for (var i = 0, length = iterable.length; i < length; i++) - results.push(iterable[i]); - return results; - } + var length = iterable.length, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; } if (Prototype.Browser.WebKit) { function $A(iterable) { if (!iterable) return []; if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && - iterable.toArray) { - return iterable.toArray(); - } else { - var results = []; - for (var i = 0, length = iterable.length; i < length; i++) - results.push(iterable[i]); - return results; - } + iterable.toArray) return iterable.toArray(); + var length = iterable.length, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; } } @@ -882,7 +879,7 @@ Object.extend(Array.prototype, { intersect: function(array) { return this.uniq().findAll(function(item) { - return array.include(item); + return array.detect(function(value) { return item === value }); }); }, @@ -930,6 +927,7 @@ if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i Array.prototype.toArray = Array.prototype.clone; function $w(string) { + if (!Object.isString(string)) return []; string = string.strip(); return string ? string.split(/\s+/) : []; } @@ -976,141 +974,126 @@ Object.extend(Number.prototype, { $w('abs round ceil floor').each(function(method){ Number.prototype[method] = Math[method].methodize(); }); -var Hash = function(object) { - if (object instanceof Hash) this.merge(object); - else Object.extend(this, object || { }); +function $H(object) { + return new Hash(object); }; -Object.extend(Hash, { - toQueryString: function(obj) { - var parts = []; - parts.add = arguments.callee.addPair; +var Hash = Class.create(Enumerable, (function() { + if (function() { + var i = 0, Test = function(value) { this.key = value }; + Test.prototype.key = 'foo'; + for (var property in new Test('bar')) i++; + return i > 1; + }()) { + function each(iterator) { + var cache = []; + for (var key in this._object) { + var value = this._object[key]; + if (cache.include(key)) continue; + cache.push(key); + var pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + } + } else { + function each(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + } + } - this.prototype._each.call(obj, function(pair) { - if (!pair.key) return; - var value = pair.value; + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } - if (value && typeof value == 'object') { - if (Object.isArray(value)) value.each(function(value) { - parts.add(pair.key, value); - }); - return; - } - parts.add(pair.key, value); - }); + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, - return parts.join('&'); - }, + _each: each, - toJSON: function(object) { - var results = []; - this.prototype._each.call(object, function(pair) { - var value = Object.toJSON(pair.value); - if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value); - }); - return '{' + results.join(', ') + '}'; - } -}); + set: function(key, value) { + return this._object[key] = value; + }, -Hash.toQueryString.addPair = function(key, value, prefix) { - key = encodeURIComponent(key); - if (value === undefined) this.push(key); - else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value))); -}; + get: function(key) { + return this._object[key]; + }, -Object.extend(Hash.prototype, Enumerable); -Object.extend(Hash.prototype, { - _each: function(iterator) { - for (var key in this) { - var value = this[key]; - if (value && value == Hash.prototype[key]) continue; - - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, - keys: function() { - return this.pluck('key'); - }, + toObject: function() { + return Object.clone(this._object); + }, - values: function() { - return this.pluck('value'); - }, + keys: function() { + return this.pluck('key'); + }, - index: function(value) { - var match = this.detect(function(pair) { - return pair.value === value; - }); - return match && match.key; - }, + values: function() { + return this.pluck('value'); + }, - merge: function(hash) { - return $H(hash).inject(this, function(mergedHash, pair) { - mergedHash[pair.key] = pair.value; - return mergedHash; - }); - }, + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, - remove: function() { - var result; - for(var i = 0, length = arguments.length; i < length; i++) { - var value = this[arguments[i]]; - if (value !== undefined){ - if (result === undefined) result = value; - else { - if (!Object.isArray(result)) result = [result]; - result.push(value); - } - } - delete this[arguments[i]]; - } - return result; - }, + merge: function(object) { + return this.clone().update(object); + }, - toQueryString: function() { - return Hash.toQueryString(this); - }, + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, - inspect: function() { - return '#'; - }, + toQueryString: function() { + return this.map(function(pair) { + var key = encodeURIComponent(pair.key), values = pair.value; - toJSON: function() { - return Hash.toJSON(this); - } -}); + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return values.map(toQueryPair.curry(key)).join('&'); + } + return toQueryPair(key, values); + }).join('&'); + }, -function $H(object) { - if (object instanceof Hash) return object; - return new Hash(object); -}; + inspect: function() { + return '#'; + }, -// Safari iterates over shadowed properties -if (function() { - var i = 0, Test = function(value) { this.key = value }; - Test.prototype.key = 'foo'; - for (var property in new Test('bar')) i++; - return i > 1; -}()) Hash.prototype._each = function(iterator) { - var cache = []; - for (var key in this) { - var value = this[key]; - if ((value && value == Hash.prototype[key]) || cache.include(key)) continue; - cache.push(key); - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } } -}; -ObjectRange = Class.create(); -Object.extend(ObjectRange.prototype, Enumerable); -Object.extend(ObjectRange.prototype, { +})()); + +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { initialize: function(start, end, exclusive) { this.start = start; this.end = end; @@ -1180,17 +1163,12 @@ Ajax.Responders = { Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ - onCreate: function() { - Ajax.activeRequestCount++; - }, - onComplete: function() { - Ajax.activeRequestCount--; - } + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } }); -Ajax.Base = function() { }; -Ajax.Base.prototype = { - setOptions: function(options) { +Ajax.Base = Class.create({ + initialize: function(options) { this.options = { method: 'post', asynchronous: true, @@ -1206,18 +1184,14 @@ Ajax.Base.prototype = { if (Object.isString(this.options.parameters)) this.options.parameters = this.options.parameters.toQueryParams(); } -}; - -Ajax.Request = Class.create(); -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; +}); -Ajax.Request.prototype = Object.extend(new Ajax.Base(), { +Ajax.Request = Class.create(Ajax.Base, { _complete: false, - initialize: function(url, options) { + initialize: function($super, url, options) { + $super(options); this.transport = Ajax.getTransport(); - this.setOptions(options); this.request(url); }, @@ -1234,7 +1208,7 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { this.parameters = params; - if (params = Hash.toQueryString(params)) { + if (params = Object.toQueryString(params)) { // when GET, append parameters to URL if (this.method == 'get') this.url += (this.url.include('?') ? '&' : '?') + params; @@ -1373,8 +1347,10 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { } }); -Ajax.Response = Class.create(); -Ajax.Response.prototype = { +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ initialize: function(request){ this.request = request; var transport = this.transport = request.transport, @@ -1384,13 +1360,13 @@ Ajax.Response.prototype = { this.status = this.getStatus(); this.statusText = this.getStatusText(); this.responseText = String.interpret(transport.responseText); - this.headerJSON = this.getHeaderJSON(); + this.headerJSON = this._getHeaderJSON(); } if(readyState == 4) { var xml = transport.responseXML; this.responseXML = xml === undefined ? null : xml; - this.responseJSON = this.getResponseJSON(); + this.responseJSON = this._getResponseJSON(); } }, @@ -1421,7 +1397,7 @@ Ajax.Response.prototype = { return this.transport.getAllResponseHeaders(); }, - getHeaderJSON: function() { + _getHeaderJSON: function() { var json = this.getHeader('X-JSON'); try { return json ? json.evalJSON(this.request.options.sanitizeJSON) : null; @@ -1430,7 +1406,7 @@ Ajax.Response.prototype = { } }, - getResponseJSON: function() { + _getResponseJSON: function() { var options = this.request.options; try { if (options.evalJSON == 'force' || (options.evalJSON && @@ -1441,27 +1417,23 @@ Ajax.Response.prototype = { this.request.dispatchException(e); } } -}; - -Ajax.Updater = Class.create(); +}); -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { - initialize: function(container, url, options) { +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) }; - this.transport = Ajax.getTransport(); - this.setOptions(options); - - var onComplete = this.options.onComplete || Prototype.emptyFunction; - this.options.onComplete = (function(response, param) { + options = options || { }; + var onComplete = options.onComplete; + options.onComplete = (function(response, param) { this.updateContent(response.responseText); - onComplete(response, param); + if (Object.isFunction(onComplete)) onComplete(response, param); }).bind(this); - this.request(url); + $super(url, options); }, updateContent: function(responseText) { @@ -1487,10 +1459,9 @@ Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { } }); -Ajax.PeriodicalUpdater = Class.create(); -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { - initialize: function(container, url, options) { - this.setOptions(options); +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); @@ -1514,12 +1485,12 @@ Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, - updateComplete: function(responseText) { + updateComplete: function(response) { if (this.options.decay) { - this.decay = (responseText == this.lastText ? + this.decay = (response.responseText == this.lastText ? this.decay * this.options.decay : 1); - this.lastText = responseText; + this.lastText = response.responseText; } this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); }, @@ -1545,30 +1516,32 @@ if (Prototype.BrowserFeatures.XPath) { var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(query.snapshotItem(i)); + results.push(Element.extend(query.snapshotItem(i))); return results; }; } /*--------------------------------------------------------------------------*/ -if (!window.Node) - var Node = { }; - -Object.extend(Node, { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 -}); +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} (function() { var element = this.Element; @@ -1681,7 +1654,7 @@ Element.Methods = { if (element.parentNode) element.parentNode.replaceChild(wrapper, element); wrapper.appendChild(element); - return element; + return wrapper; }, inspect: function(element) { @@ -1994,8 +1967,8 @@ Element.Methods = { makeClipping: function(element) { element = $(element); if (element._overflow) return element; - element._overflow = element.style.overflow || 'auto'; - if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') element.style.overflow = 'hidden'; return element; }, @@ -2161,39 +2134,6 @@ Element.Methods = { Element.Methods.identify.counter = 1; -if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ - function iter(name) { - return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; - } - - instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? - function(element, className) { - className = className.toString().strip(); - var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); - return cond ? document._getElementsByXPath('.//*' + cond, element) : []; - } : function(element, className) { - className = className.toString().strip(); - var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); - if (!classNames && !className) return elements; - - var nodes = $(element).getElementsByTagName('*'); - className = ' ' + className + ' '; - - for (var i = 0, child, cn; child = nodes[i]; i++) { - if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || - (classNames && classNames.all(function(name) { - return !name.toString().blank() && cn.include(' ' + name + ' '); - })))) - elements.push(Element.extend(child)); - } - return elements; - }; - - return function(className, parentElement) { - return $(parentElement || document.body).getElementsByClassName(className); - }; -}(Element.Methods); - Object.extend(Element.Methods, { getElementsBySelector: Element.Methods.select, childElements: Element.Methods.immediateDescendants @@ -2308,6 +2248,7 @@ else if (Prototype.Browser.IE) { return filter.replace(/alpha\([^\)]*\)/gi,''); } element = $(element); + if (!element.currentStyle.hasLayout) element.style.zoom = 1; var filter = element.getStyle('filter'), style = element.style; if (value == 1 || value === '') { (filter = stripAlpha(filter)) ? @@ -2746,9 +2687,7 @@ document.viewport = { * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style * license. Please see http://www.yui-ext.com/ for more information. */ -var Selector = Class.create(); - -Selector.prototype = { +var Selector = Class.create({ initialize: function(expression) { this.expression = expression.strip(); this.compileMatcher(); @@ -2756,7 +2695,7 @@ Selector.prototype = { compileMatcher: function() { // Selectors with namespaced attributes can't use the XPath version - if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression)) + if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression)) return this.compileXPathMatcher(); var e = this.expression, ps = Selector.patterns, h = Selector.handlers, @@ -2862,7 +2801,7 @@ Selector.prototype = { inspect: function() { return "#"; } -}; +}); Object.extend(Selector, { _cache: { }, @@ -2996,7 +2935,7 @@ Object.extend(Selector, { tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, id: /^#([\w\-\*]+)(\b|$)/, className: /^\.([\w\-\*]+)(\b|$)/, - pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/, + pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/, attrPresence: /^\[([\w]+)\]/, attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }, @@ -3054,7 +2993,7 @@ Object.extend(Selector, { parentNode._counted = true; if (reverse) { for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { - node = nodes[i]; + var node = nodes[i]; if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; } } else { @@ -3400,7 +3339,7 @@ var Form = { return result; }); - return options.hash ? data : Hash.toQueryString(data); + return options.hash ? data : Object.toQueryString(data); } }; @@ -3507,7 +3446,7 @@ Form.Element.Methods = { if (value != undefined) { var pair = { }; pair[element.name] = value; - return Hash.toQueryString(pair); + return Object.toQueryString(pair); } } return ''; @@ -3632,41 +3571,30 @@ Form.Element.Serializers = { /*--------------------------------------------------------------------------*/ -Abstract.TimedObserver = function() { }; -Abstract.TimedObserver.prototype = { - initialize: function(element, frequency, callback) { - this.frequency = frequency; +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); this.element = $(element); - this.callback = callback; - this.lastValue = this.getValue(); - this.registerCallback(); }, - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { + execute: function() { var value = this.getValue(); - var changed = (Object.isString(this.lastValue) && Object.isString(value) - ? this.lastValue != value : String(this.lastValue) != String(value)); - if (changed) { + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { this.callback(this.element, value); this.lastValue = value; } } -}; +}); -Form.Element.Observer = Class.create(); -Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { +Form.Element.Observer = Class.create(Abstract.TimedObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); -Form.Observer = Class.create(); -Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { +Form.Observer = Class.create(Abstract.TimedObserver, { getValue: function() { return Form.serialize(this.element); } @@ -3674,8 +3602,7 @@ Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { /*--------------------------------------------------------------------------*/ -Abstract.EventObserver = function() { }; -Abstract.EventObserver.prototype = { +Abstract.EventObserver = Class.create({ initialize: function(element, callback) { this.element = $(element); this.callback = callback; @@ -3696,7 +3623,7 @@ Abstract.EventObserver.prototype = { }, registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback.bind(this)); + Form.getElements(this.element).each(this.registerCallback, this); }, registerCallback: function(element) { @@ -3712,17 +3639,15 @@ Abstract.EventObserver.prototype = { } } } -}; +}); -Form.Element.EventObserver = Class.create(); -Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { getValue: function() { return Form.Element.getValue(this.element); } }); -Form.EventObserver = Class.create(); -Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { +Form.EventObserver = Class.create(Abstract.EventObserver, { getValue: function() { return Form.serialize(this.element); } @@ -3745,11 +3670,6 @@ Object.extend(Event, { KEY_PAGEDOWN: 34, KEY_INSERT: 45, - DOMEvents: ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', - 'mousemove', 'mouseout', 'keypress', 'keydown', 'keyup', - 'load', 'unload', 'abort', 'error', 'resize', 'scroll', - 'select', 'change', 'submit', 'reset', 'focus', 'blur'], - cache: { }, relatedTarget: function(event) { @@ -3763,39 +3683,61 @@ Object.extend(Event, { } }); -Event.Methods = { - element: function(event) { - var node = event.target; - return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); - }, +Event.Methods = (function() { + if (Prototype.Browser.IE) { + function isButton(event, code) { + return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; + } - findElement: function(event, expression) { - var element = Event.element(event); - return element.match(expression) ? element : element.up(expression); - }, + } else if (Prototype.Browser.WebKit) { + function isButton(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + } - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, + } else { + function isButton(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + } + } - pointer: function(event) { - return { - x: event.pageX || (event.clientX + - (document.documentElement.scrollLeft || document.body.scrollLeft)), - y: event.pageY || (event.clientY + - (document.documentElement.scrollTop || document.body.scrollTop)) - }; - }, + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, - pointerX: function(event) { return Event.pointer(event).x }, - pointerY: function(event) { return Event.pointer(event).y }, + element: function(event) { + var node = Event.extend(event).target; + return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); + }, - stop: function(event) { - event.preventDefault(); - event.stopPropagation(); - } -}; + findElement: function(event, expression) { + var element = Event.element(event); + return element.match(expression) ? element : element.up(expression); + }, + + pointer: function(event) { + return { + x: event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)), + y: event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + } + }; +})(); Event.extend = (function() { var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { @@ -3842,8 +3784,8 @@ Object.extend(Event, (function() { } function getDOMEventName(eventName) { - if (!Event.DOMEvents.include(eventName)) return "dataavailable"; - return { keypress: "keydown" }[eventName] || eventName; + if (eventName && eventName.match(/:/)) return "dataavailable"; + return eventName; } function getCacheForID(id) { @@ -3855,7 +3797,8 @@ Object.extend(Event, (function() { return c[eventName] = c[eventName] || []; } - function createWrapper(id, eventName, handler) { + function createWrapper(element, eventName, handler) { + var id = getEventID(element); var c = getWrappersForEventName(id, eventName); if (c.pluck("handler").include(handler)) return false; @@ -3864,7 +3807,7 @@ Object.extend(Event, (function() { return false; Event.extend(event); - handler.call(event.target, event); + handler.call(element, event) }; wrapper.handler = handler; @@ -3896,9 +3839,9 @@ Object.extend(Event, (function() { return { observe: function(element, eventName, handler) { element = $(element); - var id = getEventID(element), name = getDOMEventName(eventName); + var name = getDOMEventName(eventName); - var wrapper = createWrapper(id, eventName, handler); + var wrapper = createWrapper(element, eventName, handler); if (!wrapper) return element; if (element.addEventListener) { @@ -3991,7 +3934,7 @@ Object.extend(document, { function fireContentLoadedEvent() { if (fired) return; if (timer) window.clearInterval(timer); - document.fire("contentloaded"); + document.fire("dom:loaded"); fired = true; } @@ -4010,9 +3953,7 @@ Object.extend(document, { } } else { - document.write("'); }, - REQUIRED_PROTOTYPE: '1.5.1', + REQUIRED_PROTOTYPE: '1.6.0', load: function() { function convertVersionString(versionString){ var r = versionString.split('.'); diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/slider.js b/main/NOVA_0.4.5/templates/static/javascripts/slider.js similarity index 83% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/slider.js rename to main/NOVA_0.4.5/templates/static/javascripts/slider.js index c1a84eb..46c6673 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/slider.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/slider.js @@ -1,11 +1,11 @@ -// script.aculo.us slider.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us slider.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ -if(!Control) var Control = {}; +if (!Control) var Control = { }; Control.Slider = Class.create(); // options: @@ -18,14 +18,14 @@ Control.Slider.prototype = { initialize: function(handle, track, options) { var slider = this; - if(handle instanceof Array) { + if (Object.isArray(handle)) { this.handles = handle.collect( function(e) { return $(e) }); } else { this.handles = [$(handle)]; } this.track = $(track); - this.options = options || {}; + this.options = options || { }; this.axis = this.options.axis || 'horizontal'; this.increment = this.options.increment || 1; @@ -59,11 +59,11 @@ Control.Slider.prototype = { this.dragging = false; this.disabled = false; - if(this.options.disabled) this.setDisabled(); + if (this.options.disabled) this.setDisabled(); // Allowed values array this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; - if(this.allowedValues) { + if (this.allowedValues) { this.minimum = this.allowedValues.min(); this.maximum = this.allowedValues.max(); } @@ -76,16 +76,15 @@ Control.Slider.prototype = { this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( - (slider.options.sliderValue instanceof Array ? + (Object.isArray(slider.options.sliderValue) ? slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); - Element.makePositioned(h); // fix IE - Event.observe(h, "mousedown", slider.eventMouseDown); + h.makePositioned().observe("mousedown", slider.eventMouseDown); }); - Event.observe(this.track, "mousedown", this.eventMouseDown); - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); + this.track.observe("mousedown", this.eventMouseDown); + document.observe("mouseup", this.eventMouseUp); + document.observe("mousemove", this.eventMouseMove); this.initialized = true; }, @@ -105,36 +104,36 @@ Control.Slider.prototype = { this.disabled = false; }, getNearestValue: function(value){ - if(this.allowedValues){ - if(value >= this.allowedValues.max()) return(this.allowedValues.max()); - if(value <= this.allowedValues.min()) return(this.allowedValues.min()); + if (this.allowedValues){ + if (value >= this.allowedValues.max()) return(this.allowedValues.max()); + if (value <= this.allowedValues.min()) return(this.allowedValues.min()); var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; this.allowedValues.each( function(v) { var currentOffset = Math.abs(v - value); - if(currentOffset <= offset){ + if (currentOffset <= offset){ newValue = v; offset = currentOffset; } }); return newValue; } - if(value > this.range.end) return this.range.end; - if(value < this.range.start) return this.range.start; + if (value > this.range.end) return this.range.end; + if (value < this.range.start) return this.range.start; return value; }, setValue: function(sliderValue, handleIdx){ - if(!this.active) { + if (!this.active) { this.activeHandleIdx = handleIdx || 0; this.activeHandle = this.handles[this.activeHandleIdx]; this.updateStyles(); } handleIdx = handleIdx || this.activeHandleIdx || 0; - if(this.initialized && this.restricted) { - if((handleIdx>0) && (sliderValue0) && (sliderValuethis.values[handleIdx+1])) + if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) sliderValue = this.values[handleIdx+1]; } sliderValue = this.getNearestValue(sliderValue); @@ -145,7 +144,7 @@ Control.Slider.prototype = { this.translateToPx(sliderValue); this.drawSpans(); - if(!this.dragging || !this.event) this.updateFinished(); + if (!this.dragging || !this.event) this.updateFinished(); }, setValueBy: function(delta, handleIdx) { this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, @@ -180,17 +179,17 @@ Control.Slider.prototype = { }, drawSpans: function() { var slider = this; - if(this.spans) + if (this.spans) $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); - if(this.options.startSpan) + if (this.options.startSpan) this.setSpan(this.options.startSpan, $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); - if(this.options.endSpan) + if (this.options.endSpan) this.setSpan(this.options.endSpan, $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); }, setSpan: function(span, range) { - if(this.isVertical()) { + if (this.isVertical()) { span.style.top = this.translateToPx(range.start); span.style.height = this.translateToPx(range.end - range.start + this.range.start); } else { @@ -203,14 +202,14 @@ Control.Slider.prototype = { Element.addClassName(this.activeHandle, 'selected'); }, startDrag: function(event) { - if(Event.isLeftClick(event)) { - if(!this.disabled){ + if (Event.isLeftClick(event)) { + if (!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; - if(track==this.track) { + if (track==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( @@ -224,7 +223,7 @@ Control.Slider.prototype = { while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; - if(this.handles.indexOf(handle)!=-1) { + if (this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); @@ -239,10 +238,10 @@ Control.Slider.prototype = { } }, update: function(event) { - if(this.active) { - if(!this.dragging) this.dragging = true; + if (this.active) { + if (!this.dragging) this.dragging = true; this.draw(event); - if(Prototype.Browser.WebKit) window.scrollBy(0,0); + if (Prototype.Browser.WebKit) window.scrollBy(0,0); Event.stop(event); } }, @@ -253,11 +252,11 @@ Control.Slider.prototype = { pointer[1] -= this.offsetY + offsets[1]; this.event = event; this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); - if(this.initialized && this.options.onSlide) + if (this.initialized && this.options.onSlide) this.options.onSlide(this.values.length>1 ? this.values : this.value, this); }, endDrag: function(event) { - if(this.active && this.dragging) { + if (this.active && this.dragging) { this.finishDrag(event, true); Event.stop(event); } @@ -270,7 +269,7 @@ Control.Slider.prototype = { this.updateFinished(); }, updateFinished: function() { - if(this.initialized && this.options.onChange) + if (this.initialized && this.options.onChange) this.options.onChange(this.values.length>1 ? this.values : this.value, this); this.event = null; } diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/sound.js b/main/NOVA_0.4.5/templates/static/javascripts/sound.js similarity index 76% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/sound.js rename to main/NOVA_0.4.5/templates/static/javascripts/sound.js index 164c79a..1277b63 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/sound.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/sound.js @@ -1,4 +1,4 @@ -// script.aculo.us sound.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us sound.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // @@ -39,16 +39,11 @@ Sound = { this.tracks[options.track].id++; options.id = this.tracks[options.track].id; - if (Prototype.Browser.IE) { - var sound = document.createElement('bgsound'); - sound.setAttribute('id','sound_'+options.track+'_'+options.id); - sound.setAttribute('src',options.url); - sound.setAttribute('loop','1'); - sound.setAttribute('autostart','true'); - $$('body')[0].appendChild(sound); - } - else - new Insertion.Bottom($$('body')[0], Sound.template.evaluate(options)); + $$('body')[0].insert( + Prototype.Browser.IE ? new Element('bgsound',{ + id: 'sound_'+options.track+'_'+options.id, + src: options.url, loop: 1, autostart: true + }) : Sound.template.evaluate(options)); } }; diff --git a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/unittest.js b/main/NOVA_0.4.5/templates/static/javascripts/unittest.js similarity index 97% rename from main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/unittest.js rename to main/NOVA_0.4.5/templates/static/javascripts/unittest.js index d2dff8b..b5e9005 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/scriptaculous/unittest.js +++ b/main/NOVA_0.4.5/templates/static/javascripts/unittest.js @@ -1,4 +1,4 @@ -// script.aculo.us unittest.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007 +// script.aculo.us unittest.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) @@ -524,15 +524,19 @@ Test.setupBDDExtensionMethods = function(){ shouldNotBe: 'assertReturnsFalse', shouldRespondTo: 'assertRespondsTo' }; - Test.BDDMethods = {}; - for(m in METHODMAP) { - Test.BDDMethods[m] = eval( - 'function(){'+ - 'var args = $A(arguments);'+ - 'var scope = args.shift();'+ - 'scope.'+METHODMAP[m]+'.apply(scope,(args || []).concat([this])); }'); + var makeAssertion = function(assertion, args, object) { + this[assertion].apply(this,(args || []).concat([object])); } - [Array.prototype, String.prototype, Number.prototype].each( + + Test.BDDMethods = {}; + $H(METHODMAP).each(function(pair) { + Test.BDDMethods[pair.key] = function() { + var args = $A(arguments); + var scope = args.shift(); + makeAssertion.apply(scope, [pair.value, args, this]); }; + }); + + [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each( function(p){ Object.extend(p, Test.BDDMethods) } ); } diff --git a/main/NOVA_0.4.4/templates/static/stylesheets/default.css b/main/NOVA_0.4.5/templates/static/stylesheets/default.css similarity index 100% rename from main/NOVA_0.4.4/templates/static/stylesheets/default.css rename to main/NOVA_0.4.5/templates/static/stylesheets/default.css diff --git a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.css b/main/NOVA_0.4.5/templates/static/stylesheets/lytebox.css similarity index 65% rename from main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.css rename to main/NOVA_0.4.5/templates/static/stylesheets/lytebox.css index f437739..76b3f6f 100644 --- a/main/NOVA_0.4.4/templates/static/javascripts/lytebox/lytebox.css +++ b/main/NOVA_0.4.5/templates/static/stylesheets/lytebox.css @@ -1,4 +1,4 @@ -#lbOverlay { position: absolute; top: 0; left: 0; z-index: 99998; width: 100%; height: 500px; } +#lbOverlay { position: fixed; top: 0; left: 0; z-index: 99998; width: 100%; height: 500px; } #lbOverlay.grey { background-color: #000000; } #lbOverlay.red { background-color: #330000; } #lbOverlay.green { background-color: #003300; } @@ -24,26 +24,26 @@ #lbImageContainer, #lbIframeContainer { padding: 10px; } #lbLoading { - position: absolute; top: 45%; left: 0%; height: 32px; width: 100%; text-align: center; line-height: 0; background: url(images/loading.gif) center no-repeat; + position: absolute; top: 45%; left: 0%; height: 32px; width: 100%; text-align: center; line-height: 0; background: url(../images/loading.gif) center no-repeat; } #lbHoverNav { position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; } #lbImageContainer>#lbHoverNav { left: 0; } #lbHoverNav a { outline: none; } -#lbPrev { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; left: 0; float: left; } - #lbPrev.grey:hover, #lbPrev.grey:visited:hover { background: url(images/prev_grey.gif) left 15% no-repeat; } - #lbPrev.red:hover, #lbPrev.red:visited:hover { background: url(images/prev_red.gif) left 15% no-repeat; } - #lbPrev.green:hover, #lbPrev.green:visited:hover { background: url(images/prev_green.gif) left 15% no-repeat; } - #lbPrev.blue:hover, #lbPrev.blue:visited:hover { background: url(images/prev_blue.gif) left 15% no-repeat; } - #lbPrev.gold:hover, #lbPrev.gold:visited:hover { background: url(images/prev_gold.gif) left 15% no-repeat; } +#lbPrev { width: 49%; height: 100%; background: transparent url(../images/blank.gif) no-repeat; display: block; left: 0; float: left; } + #lbPrev.grey:hover, #lbPrev.grey:visited:hover { background: url(../images/prev_grey.gif) left 15% no-repeat; } + #lbPrev.red:hover, #lbPrev.red:visited:hover { background: url(../images/prev_red.gif) left 15% no-repeat; } + #lbPrev.green:hover, #lbPrev.green:visited:hover { background: url(../images/prev_green.gif) left 15% no-repeat; } + #lbPrev.blue:hover, #lbPrev.blue:visited:hover { background: url(../images/prev_blue.gif) left 15% no-repeat; } + #lbPrev.gold:hover, #lbPrev.gold:visited:hover { background: url(../images/prev_gold.gif) left 15% no-repeat; } -#lbNext { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; right: 0; float: right; } - #lbNext.grey:hover, #lbNext.grey:visited:hover { background: url(images/next_grey.gif) right 15% no-repeat; } - #lbNext.red:hover, #lbNext.red:visited:hover { background: url(images/next_red.gif) right 15% no-repeat; } - #lbNext.green:hover, #lbNext.green:visited:hover { background: url(images/next_green.gif) right 15% no-repeat; } - #lbNext.blue:hover, #lbNext.blue:visited:hover { background: url(images/next_blue.gif) right 15% no-repeat; } - #lbNext.gold:hover, #lbNext.gold:visited:hover { background: url(images/next_gold.gif) right 15% no-repeat; } +#lbNext { width: 49%; height: 100%; background: transparent url(../images/blank.gif) no-repeat; display: block; right: 0; float: right; } + #lbNext.grey:hover, #lbNext.grey:visited:hover { background: url(../images/next_grey.gif) right 15% no-repeat; } + #lbNext.red:hover, #lbNext.red:visited:hover { background: url(../images/next_red.gif) right 15% no-repeat; } + #lbNext.green:hover, #lbNext.green:visited:hover { background: url(../images/next_green.gif) right 15% no-repeat; } + #lbNext.blue:hover, #lbNext.blue:visited:hover { background: url(../images/next_blue.gif) right 15% no-repeat; } + #lbNext.gold:hover, #lbNext.gold:visited:hover { background: url(../images/next_gold.gif) right 15% no-repeat; } #lbPrev2, #lbNext2 { text-decoration: none; font-weight: bold; } #lbPrev2.grey, #lbNext2.grey, #lbSpacer.grey { color: #333333; } @@ -72,22 +72,22 @@ #lbNavDisplay { float: left; display: block; padding-bottom: 1.0em; } #lbClose { width: 64px; height: 28px; float: right; margin-bottom: 1px; } - #lbClose.grey { background: url(images/close_grey.png) no-repeat; } - #lbClose.red { background: url(images/close_red.png) no-repeat; } - #lbClose.green { background: url(images/close_green.png) no-repeat; } - #lbClose.blue { background: url(images/close_blue.png) no-repeat; } - #lbClose.gold { background: url(images/close_gold.png) no-repeat; } + #lbClose.grey { background: url(../images/close_grey.png) no-repeat; } + #lbClose.red { background: url(../images/close_red.png) no-repeat; } + #lbClose.green { background: url(../images/close_green.png) no-repeat; } + #lbClose.blue { background: url(../images/close_blue.png) no-repeat; } + #lbClose.gold { background: url(../images/close_gold.png) no-repeat; } #lbPlay { width: 64px; height: 28px; float: right; margin-bottom: 1px; } - #lbPlay.grey { background: url(images/play_grey.png) no-repeat; } - #lbPlay.red { background: url(images/play_red.png) no-repeat; } - #lbPlay.green { background: url(images/play_green.png) no-repeat; } - #lbPlay.blue { background: url(images/play_blue.png) no-repeat; } - #lbPlay.gold { background: url(images/play_gold.png) no-repeat; } + #lbPlay.grey { background: url(../images/play_grey.png) no-repeat; } + #lbPlay.red { background: url(../images/play_red.png) no-repeat; } + #lbPlay.green { background: url(../images/play_green.png) no-repeat; } + #lbPlay.blue { background: url(../images/play_blue.png) no-repeat; } + #lbPlay.gold { background: url(../images/play_gold.png) no-repeat; } #lbPause { width: 64px; height: 28px; float: right; margin-bottom: 1px; } - #lbPause.grey { background: url(images/pause_grey.png) no-repeat; } - #lbPause.red { background: url(images/pause_red.png) no-repeat; } - #lbPause.green { background: url(images/pause_green.png) no-repeat; } - #lbPause.blue { background: url(images/pause_blue.png) no-repeat; } - #lbPause.gold { background: url(images/pause_gold.png) no-repeat; } \ No newline at end of file + #lbPause.grey { background: url(../images/pause_grey.png) no-repeat; } + #lbPause.red { background: url(../images/pause_red.png) no-repeat; } + #lbPause.green { background: url(../images/pause_green.png) no-repeat; } + #lbPause.blue { background: url(../images/pause_blue.png) no-repeat; } + #lbPause.gold { background: url(../images/pause_gold.png) no-repeat; } \ No newline at end of file diff --git a/main/NOVA_0.4.4/templates/static/stylesheets/nova.css b/main/NOVA_0.4.5/templates/static/stylesheets/nova.css similarity index 100% rename from main/NOVA_0.4.4/templates/static/stylesheets/nova.css rename to main/NOVA_0.4.5/templates/static/stylesheets/nova.css