mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
javascript: apply whitespace cleanups
This commit is contained in:
parent
b50b4cd7a3
commit
120f379ca7
@ -100,7 +100,7 @@ function NetUtils_loadMaskIPv6(obj, sel, min, max) {
|
||||
max = max - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = max; i >= min; i -= 4) {
|
||||
@ -111,4 +111,3 @@ function NetUtils_loadMaskIPv6(obj, sel, min, max) {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @class
|
||||
* @scope public
|
||||
*/
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
oProvider /*:SuggestionProvider*/) {
|
||||
|
||||
|
||||
/**
|
||||
* The currently selected suggestions.
|
||||
* @scope private
|
||||
*/
|
||||
*/
|
||||
this.cur /*:int*/ = -1;
|
||||
|
||||
/**
|
||||
@ -18,22 +18,22 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
* @scope private
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
|
||||
/**
|
||||
* Suggestion provider for the autosuggest feature.
|
||||
* @scope private.
|
||||
*/
|
||||
this.provider /*:SuggestionProvider*/ = oProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The textbox to capture.
|
||||
* @scope private
|
||||
*/
|
||||
this.textbox /*:HTMLInputElement*/ = oTextbox;
|
||||
|
||||
|
||||
//initialize the control
|
||||
this.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
*/
|
||||
AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
|
||||
bTypeAhead /*:boolean*/) {
|
||||
|
||||
|
||||
//make sure there's at least one suggestion
|
||||
if (aSuggestions.length > 0) {
|
||||
if (bTypeAhead) {
|
||||
this.typeAhead(aSuggestions[0]);
|
||||
}
|
||||
|
||||
|
||||
this.showSuggestions(aSuggestions);
|
||||
} else {
|
||||
this.hideSuggestions();
|
||||
@ -71,11 +71,11 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
this.layer.className = "suggestions";
|
||||
this.layer.style.visibility = "hidden";
|
||||
this.layer.style.width = this.textbox.offsetWidth;
|
||||
|
||||
|
||||
//when the user clicks on the a suggestion, get the text (innerHTML)
|
||||
//and place it into a textbox
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmouseover = function (oEvent) {
|
||||
oEvent = oEvent || window.event;
|
||||
oTarget = oEvent.target || oEvent.srcElement;
|
||||
@ -89,8 +89,8 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
oThis.textbox.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(this.layer);
|
||||
};
|
||||
|
||||
@ -103,12 +103,12 @@ AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iLeft = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iLeft += oNode.offsetLeft;
|
||||
oNode = oNode.offsetParent;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iLeft;
|
||||
};
|
||||
|
||||
@ -121,12 +121,12 @@ AutoSuggestControl.prototype.getTop = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iTop = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iTop += oNode.offsetTop;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iTop;
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
|
||||
case 38: //up arrow
|
||||
this.previousSuggestion();
|
||||
break;
|
||||
case 40: //down arrow
|
||||
case 40: //down arrow
|
||||
this.nextSuggestion();
|
||||
break;
|
||||
case 13: //enter
|
||||
@ -163,7 +163,7 @@ AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
|
||||
//for backspace (8) and delete (46), shows suggestions without typeahead
|
||||
if (iKeyCode == 8 || iKeyCode == 46) {
|
||||
this.provider.requestSuggestions(this, false);
|
||||
|
||||
|
||||
//make sure not to interfere with non-character keys
|
||||
} else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
|
||||
//ignore
|
||||
@ -187,7 +187,7 @@ AutoSuggestControl.prototype.hideSuggestions = function () {
|
||||
* @param oSuggestionNode The node representing a suggestion in the dropdown.
|
||||
*/
|
||||
AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
|
||||
|
||||
|
||||
for (var i=0; i < this.layer.childNodes.length; i++) {
|
||||
var oNode = this.layer.childNodes[i];
|
||||
if (oNode == oSuggestionNode) {
|
||||
@ -207,36 +207,36 @@ AutoSuggestControl.prototype.init = function () {
|
||||
|
||||
//save a reference to this object
|
||||
var oThis = this;
|
||||
|
||||
|
||||
//assign the onkeyup event handler
|
||||
this.textbox.onkeyup = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyUp() method with the event object
|
||||
oThis.handleKeyUp(oEvent);
|
||||
};
|
||||
|
||||
|
||||
//assign onkeydown event handler
|
||||
this.textbox.onkeydown = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyDown() method with the event object
|
||||
oThis.handleKeyDown(oEvent);
|
||||
};
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
this.textbox.onblur = function () {
|
||||
oThis.hideSuggestions();
|
||||
};
|
||||
|
||||
|
||||
//create the suggestions dropdown
|
||||
this.createDropDown();
|
||||
};
|
||||
@ -252,7 +252,7 @@ AutoSuggestControl.prototype.nextSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
|
||||
var oNode = cSuggestionNodes[++this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,7 +267,7 @@ AutoSuggestControl.prototype.previousSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur > 0) {
|
||||
var oNode = cSuggestionNodes[--this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,19 +281,19 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
|
||||
//use text ranges for Internet Explorer
|
||||
if (this.textbox.createTextRange) {
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
oRange.select();
|
||||
|
||||
|
||||
//use setSelectionRange() for Mozilla
|
||||
} else if (this.textbox.setSelectionRange) {
|
||||
this.textbox.setSelectionRange(iStart, iLength);
|
||||
}
|
||||
}
|
||||
|
||||
//set focus back to the textbox
|
||||
this.textbox.focus();
|
||||
};
|
||||
this.textbox.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the suggestion layer contents, moves it into position,
|
||||
@ -302,16 +302,16 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
* @param aSuggestions An array of suggestions for the control.
|
||||
*/
|
||||
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
|
||||
|
||||
|
||||
var oDiv = null;
|
||||
this.layer.innerHTML = ""; //clear contents of the layer
|
||||
|
||||
|
||||
for (var i=0; i < aSuggestions.length; i++) {
|
||||
oDiv = document.createElement("div");
|
||||
oDiv.appendChild(document.createTextNode(aSuggestions[i]));
|
||||
this.layer.appendChild(oDiv);
|
||||
}
|
||||
|
||||
|
||||
this.layer.style.left = this.getLeft() + "px";
|
||||
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
|
||||
this.layer.style.visibility = "visible";
|
||||
@ -319,7 +319,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* suggested part of the text.
|
||||
* @scope private
|
||||
* @param sSuggestion The suggestion for the textbox.
|
||||
@ -328,9 +328,8 @@ AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
|
||||
|
||||
//check for support of typeahead functionality
|
||||
if (this.textbox.createTextRange || this.textbox.setSelectionRange){
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
this.selectRange(iLen, sSuggestion.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -4,92 +4,92 @@
|
||||
* http://www.webtoolkit.info/
|
||||
* http://www.webtoolkit.info/licence
|
||||
**/
|
||||
|
||||
|
||||
var Base64 = {
|
||||
|
||||
|
||||
// private property
|
||||
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
|
||||
|
||||
// public method for encoding
|
||||
encode : function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
|
||||
output = output +
|
||||
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
|
||||
// public method for decoding
|
||||
decode : function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
|
||||
while (i < input.length) {
|
||||
|
||||
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
output = Base64._utf8_decode(output);
|
||||
|
||||
|
||||
return output;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode : function (string) {
|
||||
string = string.replace(/\r\n/g,"\n");
|
||||
var utftext = "";
|
||||
|
||||
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
|
||||
|
||||
var c = string.charCodeAt(n);
|
||||
|
||||
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
@ -102,22 +102,22 @@ var Base64 = {
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode : function (utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
|
||||
while ( i < utftext.length ) {
|
||||
|
||||
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
@ -133,10 +133,10 @@ var Base64 = {
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
/*
|
||||
Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
|
||||
Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
|
||||
Copyright (c) 2011 by Harvest
|
||||
*/ var $, Chosen, SelectParser, get_side_border_padding, root;
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
/*
|
||||
Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
|
||||
Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
|
||||
Copyright (c) 2011 by Harvest
|
||||
*/ var Chosen, SelectParser, get_side_border_padding, root;
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
@ -21,7 +21,7 @@ class Chosen
|
||||
|
||||
constructor: (elmn) ->
|
||||
this.set_default_values()
|
||||
|
||||
|
||||
@form_field = elmn
|
||||
@form_field_jq = $ @form_field
|
||||
@is_multiple = @form_field.multiple
|
||||
@ -33,7 +33,7 @@ class Chosen
|
||||
@form_field_jq.addClass "chzn-done"
|
||||
|
||||
set_default_values: ->
|
||||
|
||||
|
||||
@click_test_action = (evt) => this.test_active_click(evt)
|
||||
@active_field = false
|
||||
@mouse_on_container = false
|
||||
@ -44,17 +44,17 @@ class Chosen
|
||||
|
||||
set_up_html: ->
|
||||
@container_id = @form_field.id + "_chzn"
|
||||
|
||||
|
||||
@f_width = @form_field_jq.width()
|
||||
|
||||
|
||||
@default_text = if @form_field_jq.attr 'title' then @form_field_jq.attr 'title' else @default_text_default
|
||||
|
||||
|
||||
container_div = ($ "<div />", {
|
||||
id: @container_id
|
||||
class: 'chzn-container'
|
||||
style: 'width: ' + (@f_width) + 'px;' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
|
||||
})
|
||||
|
||||
|
||||
if @is_multiple
|
||||
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
|
||||
else
|
||||
@ -64,10 +64,10 @@ class Chosen
|
||||
@container = ($ '#' + @container_id)
|
||||
@container.addClass( "chzn-container-" + (if @is_multiple then "multi" else "single") )
|
||||
@dropdown = @container.find('div.chzn-drop').first()
|
||||
|
||||
|
||||
dd_top = @container.height()
|
||||
dd_width = (@f_width - get_side_border_padding(@dropdown))
|
||||
|
||||
|
||||
@dropdown.css({"width": dd_width + "px", "top": dd_top + "px"})
|
||||
|
||||
@search_field = @container.find('input').first()
|
||||
@ -75,7 +75,7 @@ class Chosen
|
||||
this.search_field_scale()
|
||||
|
||||
@search_no_results = @container.find('li.no-results').first()
|
||||
|
||||
|
||||
if @is_multiple
|
||||
@search_choices = @container.find('ul.chzn-choices').first()
|
||||
@search_container = @container.find('li.search-field').first()
|
||||
@ -84,7 +84,7 @@ class Chosen
|
||||
@selected_item = @container.find('.chzn-single').first()
|
||||
sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
|
||||
@search_field.css( {"width" : sf_width + "px"} )
|
||||
|
||||
|
||||
this.results_build()
|
||||
this.set_tab_index()
|
||||
|
||||
@ -93,7 +93,7 @@ class Chosen
|
||||
@container.click (evt) => this.container_click(evt)
|
||||
@container.mouseenter (evt) => this.mouse_enter(evt)
|
||||
@container.mouseleave (evt) => this.mouse_leave(evt)
|
||||
|
||||
|
||||
@search_results.click (evt) => this.search_results_click(evt)
|
||||
@search_results.mouseover (evt) => this.search_results_mouseover(evt)
|
||||
@search_results.mouseout (evt) => this.search_results_mouseout(evt)
|
||||
@ -131,7 +131,7 @@ class Chosen
|
||||
|
||||
input_focus: (evt) ->
|
||||
setTimeout (=> this.container_click()), 50 unless @active_field
|
||||
|
||||
|
||||
input_blur: (evt) ->
|
||||
if not @mouse_on_container
|
||||
@active_field = false
|
||||
@ -142,11 +142,11 @@ class Chosen
|
||||
|
||||
close_field: ->
|
||||
$(document).unbind "click", @click_test_action
|
||||
|
||||
|
||||
if not @is_multiple
|
||||
@selected_item.attr "tabindex", @search_field.attr("tabindex")
|
||||
@search_field.attr "tabindex", -1
|
||||
|
||||
|
||||
@active_field = false
|
||||
this.results_hide()
|
||||
|
||||
@ -174,7 +174,7 @@ class Chosen
|
||||
@active_field = true
|
||||
else
|
||||
this.close_field()
|
||||
|
||||
|
||||
results_build: ->
|
||||
startTime = new Date()
|
||||
@parsing = true
|
||||
@ -199,7 +199,7 @@ class Chosen
|
||||
|
||||
this.show_search_field_default()
|
||||
this.search_field_scale()
|
||||
|
||||
|
||||
@search_results.html content
|
||||
@parsing = false
|
||||
|
||||
@ -210,15 +210,15 @@ class Chosen
|
||||
'<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>'
|
||||
else
|
||||
""
|
||||
|
||||
|
||||
result_add_option: (option) ->
|
||||
if not option.disabled
|
||||
option.dom_id = @form_field.id + "chzn_o_" + option.array_index
|
||||
|
||||
|
||||
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
||||
classes.push "result-selected" if option.selected
|
||||
classes.push "group-option" if option.group_array_index?
|
||||
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + $("<div />").text(option.text).html() + '</li>'
|
||||
else
|
||||
""
|
||||
@ -238,7 +238,7 @@ class Chosen
|
||||
maxHeight = parseInt @search_results.css("maxHeight"), 10
|
||||
visible_top = @search_results.scrollTop()
|
||||
visible_bottom = maxHeight + visible_top
|
||||
|
||||
|
||||
high_top = @result_highlight.position().top + @search_results.scrollTop()
|
||||
high_bottom = high_top + @result_highlight.outerHeight()
|
||||
|
||||
@ -246,7 +246,7 @@ class Chosen
|
||||
@search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
|
||||
else if high_top < visible_top
|
||||
@search_results.scrollTop high_top
|
||||
|
||||
|
||||
result_clear_highlight: ->
|
||||
@result_highlight.removeClass "highlighted" if @result_highlight
|
||||
@result_highlight = null
|
||||
@ -342,16 +342,16 @@ class Chosen
|
||||
if @result_highlight
|
||||
high = @result_highlight
|
||||
high_id = high.attr "id"
|
||||
|
||||
|
||||
this.result_clear_highlight()
|
||||
|
||||
high.addClass "result-selected"
|
||||
|
||||
|
||||
if @is_multiple
|
||||
this.result_deactivate high
|
||||
else
|
||||
@result_single_selected = high
|
||||
|
||||
|
||||
position = high_id.substr(high_id.lastIndexOf("_") + 1 )
|
||||
item = @results_data[position]
|
||||
item.selected = true
|
||||
@ -398,7 +398,7 @@ class Chosen
|
||||
winnow_results: ->
|
||||
startTime = new Date()
|
||||
this.no_results_clear()
|
||||
|
||||
|
||||
results = 0
|
||||
|
||||
searchText = if @search_field.val() is @default_text then "" else $.trim @search_field.val()
|
||||
@ -412,7 +412,7 @@ class Chosen
|
||||
else if not (@is_multiple and option.selected)
|
||||
found = false
|
||||
result_id = option.dom_id
|
||||
|
||||
|
||||
if regex.test option.text
|
||||
found = true
|
||||
results += 1
|
||||
@ -441,7 +441,7 @@ class Chosen
|
||||
else
|
||||
this.result_clear_highlight() if @result_highlight and result_id is @result_highlight.attr 'id'
|
||||
this.result_deactivate $("#" + result_id)
|
||||
|
||||
|
||||
if results < 1 and searchText.length
|
||||
this.no_results searchText
|
||||
else
|
||||
@ -463,13 +463,13 @@ class Chosen
|
||||
do_high = @search_results.find(".active-result").first()
|
||||
if(do_high)
|
||||
this.result_do_highlight do_high
|
||||
|
||||
|
||||
no_results: (terms) ->
|
||||
no_results_html = $('<li class="no-results">No results match "<span></span>"</li>')
|
||||
no_results_html.find("span").first().text(terms)
|
||||
|
||||
@search_results.append no_results_html
|
||||
|
||||
|
||||
no_results_clear: ->
|
||||
@search_results.find(".no-results").remove()
|
||||
|
||||
@ -487,7 +487,7 @@ class Chosen
|
||||
this.results_show()
|
||||
else if @result_highlight
|
||||
prev_sibs = @result_highlight.prevAll("li.active-result")
|
||||
|
||||
|
||||
if prev_sibs.length
|
||||
this.result_do_highlight prev_sibs.first()
|
||||
else
|
||||
@ -532,7 +532,7 @@ class Chosen
|
||||
this.search_field_scale()
|
||||
|
||||
this.clear_backstroke() if stroke != 8 and this.pending_backstroke
|
||||
|
||||
|
||||
switch stroke
|
||||
when 8
|
||||
@backstroke_length = this.search_field.val().length
|
||||
@ -559,10 +559,10 @@ class Chosen
|
||||
|
||||
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
|
||||
styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
|
||||
|
||||
|
||||
for style in styles
|
||||
style_block += style + ":" + @search_field.css(style) + ";"
|
||||
|
||||
|
||||
div = $('<div />', { 'style' : style_block })
|
||||
div.text @search_field.val()
|
||||
$('body').append div
|
||||
@ -584,7 +584,7 @@ get_side_border_padding = (elmt) ->
|
||||
root.get_side_border_padding = get_side_border_padding
|
||||
|
||||
class SelectParser
|
||||
|
||||
|
||||
constructor: ->
|
||||
@options_index = 0
|
||||
@parsed = []
|
||||
@ -629,5 +629,5 @@ SelectParser.select_to_array = (select) ->
|
||||
parser = new SelectParser()
|
||||
parser.add_node( child ) for child in select.childNodes
|
||||
parser.parsed
|
||||
|
||||
|
||||
root.SelectParser = SelectParser
|
||||
|
||||
@ -13,7 +13,7 @@ class Chosen
|
||||
|
||||
constructor: (elmn) ->
|
||||
this.set_default_values()
|
||||
|
||||
|
||||
@form_field = elmn
|
||||
@is_multiple = @form_field.multiple
|
||||
|
||||
@ -24,7 +24,7 @@ class Chosen
|
||||
|
||||
|
||||
set_default_values: ->
|
||||
|
||||
|
||||
@click_test_action = (evt) => this.test_active_click(evt)
|
||||
@active_field = false
|
||||
@mouse_on_container = false
|
||||
@ -42,26 +42,26 @@ class Chosen
|
||||
|
||||
set_up_html: ->
|
||||
@container_id = @form_field.id + "_chzn"
|
||||
|
||||
|
||||
@f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()
|
||||
|
||||
|
||||
container_props =
|
||||
'id': @container_id
|
||||
'class': 'chzn-container'
|
||||
'style': 'width: ' + (@f_width) + 'px' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
|
||||
|
||||
|
||||
@default_text = if @form_field.readAttribute 'title' then @form_field.readAttribute 'title' else @default_text_default
|
||||
|
||||
|
||||
base_template = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
|
||||
|
||||
@form_field.hide().insert({ after: base_template })
|
||||
@container = $(@container_id)
|
||||
@container.addClassName( "chzn-container-" + (if @is_multiple then "multi" else "single") )
|
||||
@dropdown = @container.down('div.chzn-drop')
|
||||
|
||||
|
||||
dd_top = @container.getHeight()
|
||||
dd_width = (@f_width - get_side_border_padding(@dropdown))
|
||||
|
||||
|
||||
@dropdown.setStyle({"width": dd_width + "px", "top": dd_top + "px"})
|
||||
|
||||
@search_field = @container.down('input')
|
||||
@ -69,7 +69,7 @@ class Chosen
|
||||
this.search_field_scale()
|
||||
|
||||
@search_no_results = @container.down('li.no-results')
|
||||
|
||||
|
||||
if @is_multiple
|
||||
@search_choices = @container.down('ul.chzn-choices')
|
||||
@search_container = @container.down('li.search-field')
|
||||
@ -78,7 +78,7 @@ class Chosen
|
||||
@selected_item = @container.down('.chzn-single')
|
||||
sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
|
||||
@search_field.setStyle( {"width" : sf_width + "px"} )
|
||||
|
||||
|
||||
this.results_build()
|
||||
this.set_tab_index()
|
||||
|
||||
@ -87,11 +87,11 @@ class Chosen
|
||||
@container.observe "click", (evt) => this.container_click(evt)
|
||||
@container.observe "mouseenter", (evt) => this.mouse_enter(evt)
|
||||
@container.observe "mouseleave", (evt) => this.mouse_leave(evt)
|
||||
|
||||
|
||||
@search_results.observe "click", (evt) => this.search_results_click(evt)
|
||||
@search_results.observe "mouseover", (evt) => this.search_results_mouseover(evt)
|
||||
@search_results.observe "mouseout", (evt) => this.search_results_mouseout(evt)
|
||||
|
||||
|
||||
@form_field.observe "liszt:updated", (evt) => this.results_update_field(evt)
|
||||
|
||||
@search_field.observe "blur", (evt) => this.input_blur(evt)
|
||||
@ -125,7 +125,7 @@ class Chosen
|
||||
|
||||
input_focus: (evt) ->
|
||||
setTimeout this.container_click.bind(this), 50 unless @active_field
|
||||
|
||||
|
||||
input_blur: (evt) ->
|
||||
if not @mouse_on_container
|
||||
@active_field = false
|
||||
@ -136,11 +136,11 @@ class Chosen
|
||||
|
||||
close_field: ->
|
||||
document.stopObserving "click", @click_test_action
|
||||
|
||||
|
||||
if not @is_multiple
|
||||
@selected_item.tabIndex = @search_field.tabIndex
|
||||
@search_field.tabIndex = -1
|
||||
|
||||
|
||||
@active_field = false
|
||||
this.results_hide()
|
||||
|
||||
@ -193,7 +193,7 @@ class Chosen
|
||||
|
||||
this.show_search_field_default()
|
||||
this.search_field_scale()
|
||||
|
||||
|
||||
@search_results.update content
|
||||
@parsing = false
|
||||
|
||||
@ -204,15 +204,15 @@ class Chosen
|
||||
'<li id="' + group.dom_id + '" class="group-result">' + group.label.escapeHTML() + '</li>'
|
||||
else
|
||||
""
|
||||
|
||||
|
||||
result_add_option: (option) ->
|
||||
if not option.disabled
|
||||
option.dom_id = @form_field.id + "chzn_o_" + option.array_index
|
||||
|
||||
|
||||
classes = if option.selected and @is_multiple then [] else ["active-result"]
|
||||
classes.push "result-selected" if option.selected
|
||||
classes.push "group-option" if option.group_array_index?
|
||||
|
||||
|
||||
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text.escapeHTML() + '</li>'
|
||||
else
|
||||
""
|
||||
@ -239,7 +239,7 @@ class Chosen
|
||||
@search_results.scrollTop = if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
|
||||
else if high_top < visible_top
|
||||
@search_results.scrollTop = high_top
|
||||
|
||||
|
||||
result_clear_highlight: ->
|
||||
@result_highlight.removeClassName('highlighted') if @result_highlight
|
||||
@result_highlight = null
|
||||
@ -337,12 +337,12 @@ class Chosen
|
||||
this.result_clear_highlight()
|
||||
|
||||
high.addClassName("result-selected")
|
||||
|
||||
|
||||
if @is_multiple
|
||||
this.result_deactivate high
|
||||
else
|
||||
@result_single_selected = high
|
||||
|
||||
|
||||
position = high.id.substr(high.id.lastIndexOf("_") + 1 )
|
||||
item = @results_data[position]
|
||||
item.selected = true
|
||||
@ -403,7 +403,7 @@ class Chosen
|
||||
else if not (@is_multiple and option.selected)
|
||||
found = false
|
||||
result_id = option.dom_id
|
||||
|
||||
|
||||
if regex.test option.text
|
||||
found = true
|
||||
results += 1
|
||||
@ -453,10 +453,10 @@ class Chosen
|
||||
do_high = @search_results.down(".active-result")
|
||||
if(do_high)
|
||||
this.result_do_highlight do_high
|
||||
|
||||
|
||||
no_results: (terms) ->
|
||||
@search_results.insert @no_results_temp.evaluate({"terms":terms.escapeHTML()})
|
||||
|
||||
|
||||
no_results_clear: ->
|
||||
nr = null
|
||||
nr.remove() while nr = @search_results.down(".no-results")
|
||||
@ -525,7 +525,7 @@ class Chosen
|
||||
this.search_field_scale()
|
||||
|
||||
this.clear_backstroke() if stroke != 8 and this.pending_backstroke
|
||||
|
||||
|
||||
switch stroke
|
||||
when 8
|
||||
@backstroke_length = this.search_field.value.length
|
||||
@ -547,10 +547,10 @@ class Chosen
|
||||
|
||||
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
|
||||
styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
|
||||
|
||||
|
||||
for style in styles
|
||||
style_block += style + ":" + @search_field.getStyle(style) + ";"
|
||||
|
||||
|
||||
div = new Element('div', { 'style' : style_block }).update(@search_field.value)
|
||||
document.body.appendChild(div)
|
||||
|
||||
@ -580,7 +580,7 @@ root.get_side_border_padding = get_side_border_padding
|
||||
root = exports ? this
|
||||
|
||||
class SelectParser
|
||||
|
||||
|
||||
constructor: ->
|
||||
@options_index = 0
|
||||
@parsed = []
|
||||
@ -625,5 +625,5 @@ SelectParser.select_to_array = (select) ->
|
||||
parser = new SelectParser()
|
||||
parser.add_node( child ) for child in select.childNodes
|
||||
parser.parsed
|
||||
|
||||
|
||||
root.SelectParser = SelectParser
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
/*
|
||||
Quirksmode necessity
|
||||
--------------------
|
||||
|
||||
|
||||
If your HTML document renders in quirksmode (i.e. has no doctype declaration)
|
||||
then uncomment the following CSS rule or the datePicker will be HUGE...
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Released under a creative commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/)
|
||||
|
||||
Please credit frequency-decoder in any derivative work - thanks.
|
||||
|
||||
|
||||
You are free:
|
||||
|
||||
* to copy, distribute, display, and perform the work
|
||||
@ -99,11 +99,11 @@ datePicker.getDaysPerMonth = function (nMonth, nYear) {
|
||||
function datePicker(options) {
|
||||
|
||||
this.defaults = {};
|
||||
|
||||
|
||||
for(opt in options) {
|
||||
this[opt] = this.defaults[opt] = options[opt];
|
||||
};
|
||||
|
||||
|
||||
this.date = new Date();
|
||||
this.yearinc = 1;
|
||||
this.timer = null;
|
||||
@ -147,7 +147,7 @@ function datePicker(options) {
|
||||
};
|
||||
o.killEvent = function(e) {
|
||||
if (e == null) e = document.parentWindow.event;
|
||||
|
||||
|
||||
if (e.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
@ -263,7 +263,7 @@ function datePicker(options) {
|
||||
onmousedown: function(e) {
|
||||
if ( e == null ) e = document.parentWindow.event;
|
||||
var el = e.target != null ? e.target : e.srcElement;
|
||||
|
||||
|
||||
var found = false;
|
||||
|
||||
while(el.parentNode) {
|
||||
@ -311,9 +311,9 @@ function datePicker(options) {
|
||||
if(o.timerSet) {
|
||||
o.stopTimer();
|
||||
};
|
||||
|
||||
|
||||
datePickerController.addEvent(document, "mouseup", o.events.clearTimer);
|
||||
|
||||
|
||||
o.timerInc = 1000;
|
||||
o.dayInc = arguments[1];
|
||||
o.yearInc = arguments[2];
|
||||
@ -387,20 +387,20 @@ function datePicker(options) {
|
||||
};
|
||||
o.resize = function() {
|
||||
if(!o.created || !o.getElem()) return;
|
||||
|
||||
|
||||
o.div.style.visibility = "hidden";
|
||||
o.div.style.display = "block";
|
||||
|
||||
|
||||
var osh = o.div.offsetHeight;
|
||||
var osw = o.div.offsetWidth;
|
||||
|
||||
|
||||
o.div.style.visibility = "visible";
|
||||
o.div.style.display = "none";
|
||||
|
||||
|
||||
var elem = document.getElementById('fd-but-' + o.id);
|
||||
var pos = datePickerController.findPosition(elem);
|
||||
var trueBody = (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
|
||||
|
||||
|
||||
if ( parseInt(trueBody.clientWidth+trueBody.scrollLeft) < parseInt(osw+pos[0])) {
|
||||
o.div.style.left = Math.abs(parseInt((trueBody.clientWidth+trueBody.scrollLeft) - osw)) + "px";
|
||||
} else {
|
||||
@ -427,18 +427,18 @@ function datePicker(options) {
|
||||
};
|
||||
o.outOfRange = function(tmpDate) {
|
||||
if(!o.low && !o.high) return false;
|
||||
|
||||
|
||||
var level = false;
|
||||
if(!tmpDate) {
|
||||
level = true;
|
||||
tmpDate = o.date;
|
||||
};
|
||||
|
||||
|
||||
var d = (tmpDate.getDate() < 10) ? "0" + tmpDate.getDate() : tmpDate.getDate();
|
||||
var m = ((tmpDate.getMonth() + 1) < 10) ? "0" + (tmpDate.getMonth() + 1) : tmpDate.getMonth() + 1;
|
||||
var y = tmpDate.getFullYear();
|
||||
var dt = (y+' '+m+' '+d).replace(/ /g,'');
|
||||
|
||||
|
||||
if(o.low) {
|
||||
if(parseInt(dt) < parseInt(o.low)) {
|
||||
if(!level) return true;
|
||||
@ -479,7 +479,7 @@ function datePicker(options) {
|
||||
o.iePopUp = document.getElementById("iePopUpHack");
|
||||
};
|
||||
/*@end@*/
|
||||
|
||||
|
||||
if(typeof(fdLocale) == "object" && o.locale) {
|
||||
datePicker.titles = fdLocale.titles;
|
||||
datePicker.months = fdLocale.months;
|
||||
@ -488,14 +488,14 @@ function datePicker(options) {
|
||||
if(fdLocale.dayAbbr) datePicker.dayAbbr = fdLocale.dayAbbr;
|
||||
if(fdLocale.firstDayOfWeek) o.firstDayOfWeek = o.defaults.firstDayOfWeek = fdLocale.firstDayOfWeek;
|
||||
};
|
||||
|
||||
|
||||
o.div = document.createElement('div');
|
||||
o.div.style.zIndex = 9999;
|
||||
o.div.id = "fd-"+o.id;
|
||||
var tableBody = document.createElement('tbody');
|
||||
var tableHead = document.createElement('thead');
|
||||
var nbsp = String.fromCharCode( 160 );
|
||||
|
||||
|
||||
o.table = document.createElement('table');
|
||||
o.div.className = "datePicker";
|
||||
|
||||
@ -511,7 +511,7 @@ function datePicker(options) {
|
||||
tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,-1,0); };
|
||||
tmpelem.onmouseup = o.events.clearTimer;
|
||||
th.appendChild( tmpelem );
|
||||
|
||||
|
||||
// previous month
|
||||
var tmpelem = document.createElement('button');
|
||||
tmpelem.setAttribute("type", "button");
|
||||
@ -559,13 +559,13 @@ function datePicker(options) {
|
||||
tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,1,0); };
|
||||
tmpelem.onmouseup = o.events.clearTimer;
|
||||
th.appendChild( tmpelem );
|
||||
|
||||
|
||||
tr.appendChild( th );
|
||||
|
||||
tableHead.appendChild(tr);
|
||||
|
||||
var row, col;
|
||||
|
||||
|
||||
for(var rows = 0; rows < 7; rows++) {
|
||||
row = document.createElement('tr');
|
||||
for(var cols = 0; cols < 7; cols++) {
|
||||
@ -584,7 +584,7 @@ function datePicker(options) {
|
||||
};
|
||||
o.table.appendChild( tableHead );
|
||||
o.table.appendChild( tableBody );
|
||||
|
||||
|
||||
o.div.appendChild( o.table );
|
||||
o.created = true;
|
||||
|
||||
@ -592,10 +592,10 @@ function datePicker(options) {
|
||||
};
|
||||
o.setDateFromInput = function() {
|
||||
o.dateSet = null;
|
||||
|
||||
|
||||
var elem = o.getElem();
|
||||
if(!elem) return;
|
||||
|
||||
|
||||
var date = elem.value;
|
||||
|
||||
var d,m,y,dt,dates;
|
||||
@ -609,7 +609,7 @@ function datePicker(options) {
|
||||
|
||||
dates[m] = document.getElementById(o.id+'-mm').value;
|
||||
if(dates[m] < 1 || dates[m] > 12) dates[m] = "";
|
||||
|
||||
|
||||
dates[d] = document.getElementById(o.id+'-dd').value;
|
||||
if(dates[d] < 1 || dates[d] > datePicker.daysPerMonth[dates[m]-1]) dates[d] = "";
|
||||
|
||||
@ -621,9 +621,9 @@ function datePicker(options) {
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
dates = date.split(o.divider);
|
||||
|
||||
|
||||
if(dates.length != 3) {
|
||||
o.date = new Date();
|
||||
return;
|
||||
@ -639,13 +639,13 @@ function datePicker(options) {
|
||||
o.date.setMonth(dates[m]-1);
|
||||
o.date.setFullYear(dates[y]);
|
||||
o.date.setDate(dates[d]);
|
||||
|
||||
|
||||
o.dateSet = new Date(o.date);
|
||||
};
|
||||
o.returnFormattedDate = function() {
|
||||
var elem = o.getElem();
|
||||
if(!elem) return;
|
||||
|
||||
|
||||
var d = (o.date.getDate() < 10) ? "0" + o.date.getDate() : o.date.getDate();
|
||||
var m = ((o.date.getMonth() + 1) < 10) ? "0" + (o.date.getMonth() + 1) : o.date.getMonth() + 1;
|
||||
var yyyy = o.date.getFullYear();
|
||||
@ -657,7 +657,7 @@ function datePicker(options) {
|
||||
document.getElementById(o.id+"-dd").value = d;
|
||||
document.getElementById(o.id+"-mm").value = m;
|
||||
elem.value = yyyy;
|
||||
|
||||
|
||||
document.getElementById(o.id+"-dd").focus();
|
||||
if(document.getElementById(o.id+"-dd").onchange) document.getElementById(o.id+"-dd").onchange();
|
||||
if(document.getElementById(o.id+"-mm").onchange) document.getElementById(o.id+"-mm").onchange();
|
||||
@ -669,10 +669,10 @@ function datePicker(options) {
|
||||
};
|
||||
};
|
||||
// Credit where credit's due:
|
||||
|
||||
|
||||
// Most of the logic for this method from the webfx date-picker
|
||||
// http://webfx.eae.net/
|
||||
|
||||
|
||||
o.updateTable = function() {
|
||||
|
||||
if(document.getElementById("date-picker-hover")) {
|
||||
@ -704,14 +704,14 @@ function datePicker(options) {
|
||||
o.titleBar.appendChild(document.createTextNode(titleText));
|
||||
|
||||
for ( i = 1; i < 32; i++ ) {
|
||||
|
||||
|
||||
tmpDate.setDate( i );
|
||||
var weekDay = ( tmpDate.getDay() + 6 ) % 7;
|
||||
var colIndex = ( (weekDay - o.firstDayOfWeek) + 7 ) % 7;
|
||||
var cell = { text:"", className:"", id:"" };
|
||||
|
||||
|
||||
if ( tmpDate.getMonth() == o.date.getMonth() ) {
|
||||
|
||||
|
||||
cells[currentWeek][colIndex] = { text:"", className:"", id:"" };
|
||||
|
||||
var isToday = tmpDate.getDate() == today.getDate() &&
|
||||
@ -780,9 +780,9 @@ function datePicker(options) {
|
||||
if ( typeof cells[y][x] != "undefined" ) {
|
||||
tmpCell.className = cells[y][x].className;
|
||||
tmpCell.id = cells[y][x].id;
|
||||
|
||||
|
||||
tmpCell.appendChild(document.createTextNode(cells[y][x].text));
|
||||
|
||||
|
||||
if(cells[y][x].className != "out-of-range") {
|
||||
tmpCell.onmouseover = o.events.onmouseover;
|
||||
tmpCell.onclick = cells[y][x].className == "day-disabled" ? o.killEvent : o.events.onclick;
|
||||
@ -835,9 +835,9 @@ function datePicker(options) {
|
||||
|
||||
datePickerController.addEvent(document, "mousedown", o.events.onmousedown);
|
||||
datePickerController.addEvent(document, "keypress", o.events.onkeydown);
|
||||
|
||||
|
||||
// Internet Explorer requires the keydown event in order to catch arrow keys
|
||||
|
||||
|
||||
/*@cc_on@*/
|
||||
/*@if(@_win32)
|
||||
datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
|
||||
@ -857,7 +857,7 @@ function datePicker(options) {
|
||||
datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
|
||||
datePickerController.removeEvent(document, "keydown", o.events.onkeydown);
|
||||
} catch(e) {
|
||||
|
||||
|
||||
};
|
||||
if(o.iePopUp) {
|
||||
o.iePopUp.style.display = "none";
|
||||
@ -895,7 +895,7 @@ datePickerController = {
|
||||
var curleft = 0;
|
||||
var curtop = 0;
|
||||
var orig = obj;
|
||||
|
||||
|
||||
if(obj.offsetParent) {
|
||||
while(obj.offsetParent) {
|
||||
curleft += obj.offsetLeft;
|
||||
@ -936,7 +936,7 @@ datePickerController = {
|
||||
|
||||
var start;
|
||||
var cnt = 0;
|
||||
|
||||
|
||||
while(cnt < 3) {
|
||||
start = (cnt + (favourMDY ? 4 : 3)) % 3;
|
||||
|
||||
@ -951,7 +951,7 @@ datePickerController = {
|
||||
|
||||
return y+m+d;
|
||||
};
|
||||
|
||||
|
||||
cnt++;
|
||||
};
|
||||
|
||||
@ -961,7 +961,7 @@ datePickerController = {
|
||||
if(!datePicker.isSupported) return;
|
||||
|
||||
datePickerController.cleanUp();
|
||||
|
||||
|
||||
var inputs = document.getElementsByTagName('input');
|
||||
|
||||
var regExp1 = /disable-days-([1-7]){1,6}/g; // the days to disable
|
||||
@ -999,12 +999,12 @@ datePickerController = {
|
||||
options.splitDate = 1;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Date format(variations of d-m-y)
|
||||
if(inp.className.search(regExp6) != -1) {
|
||||
options.format = inp.className.match(regExp6)[0].replace('format-','');
|
||||
};
|
||||
|
||||
|
||||
// What divider to use, a "/", "-", "." or " "
|
||||
if(inp.className.search(regExp7) != -1) {
|
||||
var divider = inp.className.match(regExp7)[0].replace('divider-','');
|
||||
@ -1040,7 +1040,7 @@ datePickerController = {
|
||||
options.disableDays[tmp.charAt(j) - 1] = 1;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// The lower limit
|
||||
if(inp.className.search(regExp4) != -1) {
|
||||
options.low = datePickerController.dateFormat(inp.className.match(regExp4)[0].replace(/range-low-/, ''), options.format.charAt(0) == "m");
|
||||
@ -1063,7 +1063,7 @@ datePickerController = {
|
||||
datePickerController.datePickers[inp.id].defaults[opt] = options[opt];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Create the button (if needs be)
|
||||
if(!document.getElementById("fd-but-" + inp.id)) {
|
||||
var but = document.createElement('button');
|
||||
@ -1072,7 +1072,7 @@ datePickerController = {
|
||||
|
||||
but.id = "fd-but-" + inp.id;
|
||||
but.appendChild(document.createTextNode(String.fromCharCode( 160 )));
|
||||
|
||||
|
||||
if(inp.nextSibling) {
|
||||
inp.parentNode.insertBefore(but, inp.nextSibling);
|
||||
} else {
|
||||
@ -1082,7 +1082,7 @@ datePickerController = {
|
||||
} else {
|
||||
var but = document.getElementById("fd-but-" + inp.id);
|
||||
};
|
||||
|
||||
|
||||
// Add button events
|
||||
but.onclick = but.onpress = function() {
|
||||
var inpId = this.id.replace('fd-but-','');
|
||||
@ -1093,7 +1093,7 @@ datePickerController = {
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
// Create the datePicker (if needs be)
|
||||
if(!document.getElementById('fd-'+inp.id)) {
|
||||
datePickerController.datePickers[inp.id] = new datePicker(options);
|
||||
@ -1108,4 +1108,3 @@ datePickerController = {
|
||||
})();
|
||||
|
||||
datePickerController.addEvent(window, 'load', datePickerController.create);
|
||||
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
of Simon Willison (see comments by Simon below).
|
||||
|
||||
Description:
|
||||
|
||||
Uses css selectors to apply javascript behaviours to enable
|
||||
unobtrusive javascript in html documents.
|
||||
|
||||
Usage:
|
||||
|
||||
|
||||
Uses css selectors to apply javascript behaviours to enable
|
||||
unobtrusive javascript in html documents.
|
||||
|
||||
Usage:
|
||||
|
||||
var myrules = {
|
||||
'b.someclass' : function(element){
|
||||
element.onclick = function(){
|
||||
@ -21,40 +21,40 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Behaviour.register(myrules);
|
||||
|
||||
|
||||
// Call Behaviour.apply() to re-apply the rules (if you
|
||||
// update the dom, etc).
|
||||
|
||||
License:
|
||||
|
||||
This file is entirely BSD licensed.
|
||||
|
||||
|
||||
This file is entirely BSD licensed.
|
||||
|
||||
More information:
|
||||
|
||||
http://ripcord.co.nz/behaviour/
|
||||
|
||||
*/
|
||||
|
||||
http://ripcord.co.nz/behaviour/
|
||||
|
||||
*/
|
||||
|
||||
var Behaviour = {
|
||||
list : new Array,
|
||||
|
||||
|
||||
register : function(sheet){
|
||||
Behaviour.list.push(sheet);
|
||||
},
|
||||
|
||||
|
||||
start : function(){
|
||||
Behaviour.addLoadEvent(function(){
|
||||
Behaviour.apply();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
apply : function(){
|
||||
for (h=0;sheet=Behaviour.list[h];h++){
|
||||
for (selector in sheet){
|
||||
list = document.getElementsBySelector(selector);
|
||||
|
||||
|
||||
if (!list){
|
||||
continue;
|
||||
}
|
||||
@ -65,10 +65,10 @@ var Behaviour = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
addLoadEvent : function(func){
|
||||
var oldonload = window.onload;
|
||||
|
||||
|
||||
if (typeof window.onload != 'function') {
|
||||
window.onload = func;
|
||||
} else {
|
||||
@ -87,13 +87,13 @@ Behaviour.start();
|
||||
|
||||
document.getElementsBySelector(selector)
|
||||
- returns an array of element objects from the current document
|
||||
matching the CSS selector. Selectors can contain element names,
|
||||
matching the CSS selector. Selectors can contain element names,
|
||||
class names and ids and can be nested. For example:
|
||||
|
||||
|
||||
elements = document.getElementsBySelect('div#main p a.external')
|
||||
|
||||
Will return an array of all 'a' elements with 'external' in their
|
||||
class attribute that are contained inside 'p' elements that are
|
||||
|
||||
Will return an array of all 'a' elements with 'external' in their
|
||||
class attribute that are contained inside 'p' elements that are
|
||||
contained inside the 'div' element which has id="main"
|
||||
|
||||
New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
|
||||
@ -101,7 +101,7 @@ Behaviour.start();
|
||||
|
||||
Version 0.4 - Simon Willison, March 25th 2003
|
||||
-- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
|
||||
-- Opera 7 fails
|
||||
-- Opera 7 fails
|
||||
*/
|
||||
|
||||
function getAllChildren(e) {
|
||||
@ -194,7 +194,7 @@ document.getElementsBySelector = function(selector) {
|
||||
case '=': // Equality
|
||||
checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
|
||||
break;
|
||||
case '~': // Match one of space separated words
|
||||
case '~': // Match one of space separated words
|
||||
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
|
||||
break;
|
||||
case '|': // Match start with value followed by optional hyphen
|
||||
@ -223,11 +223,11 @@ document.getElementsBySelector = function(selector) {
|
||||
// alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
|
||||
continue; // Skip to next token
|
||||
}
|
||||
|
||||
|
||||
if (!currentContext[0]){
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If we get here, token is JUST an element (not a class or ID selector)
|
||||
tagName = token;
|
||||
var found = new Array;
|
||||
@ -243,12 +243,12 @@ document.getElementsBySelector = function(selector) {
|
||||
return currentContext;
|
||||
}
|
||||
|
||||
/* That revolting regular expression explained
|
||||
/* That revolting regular expression explained
|
||||
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
|
||||
\---/ \---/\-------------/ \-------/
|
||||
| | | |
|
||||
| | | The value
|
||||
| | ~,|,^,$,* or =
|
||||
| Attribute
|
||||
| Attribute
|
||||
Tag
|
||||
*/
|
||||
|
||||
@ -133,7 +133,7 @@ function domLib_clone(obj)
|
||||
function domTT_Hash()
|
||||
{
|
||||
this.length = 0;
|
||||
this.numericLength = 0;
|
||||
this.numericLength = 0;
|
||||
this.elementData = [];
|
||||
for (var i = 0; i < arguments.length; i += 2)
|
||||
{
|
||||
@ -141,7 +141,7 @@ function domTT_Hash()
|
||||
{
|
||||
this.elementData[arguments[i]] = arguments[i + 1];
|
||||
this.length++;
|
||||
if (arguments[i] == parseInt(arguments[i]))
|
||||
if (arguments[i] == parseInt(arguments[i]))
|
||||
{
|
||||
this.numericLength++;
|
||||
}
|
||||
@ -149,7 +149,7 @@ function domTT_Hash()
|
||||
}
|
||||
}
|
||||
|
||||
// using prototype as opposed to inner functions saves on memory
|
||||
// using prototype as opposed to inner functions saves on memory
|
||||
domTT_Hash.prototype.get = function(in_key)
|
||||
{
|
||||
if (typeof(this.elementData[in_key]) != 'undefined') {
|
||||
@ -166,7 +166,7 @@ domTT_Hash.prototype.set = function(in_key, in_value)
|
||||
if (typeof(this.elementData[in_key]) == 'undefined')
|
||||
{
|
||||
this.length++;
|
||||
if (in_key == parseInt(in_key))
|
||||
if (in_key == parseInt(in_key))
|
||||
{
|
||||
this.numericLength++;
|
||||
}
|
||||
@ -184,7 +184,7 @@ domTT_Hash.prototype.remove = function(in_key)
|
||||
if (typeof(this.elementData[in_key]) != 'undefined')
|
||||
{
|
||||
this.length--;
|
||||
if (in_key == parseInt(in_key))
|
||||
if (in_key == parseInt(in_key))
|
||||
{
|
||||
this.numericLength--;
|
||||
}
|
||||
@ -208,9 +208,9 @@ domTT_Hash.prototype.has = function(in_key)
|
||||
|
||||
domTT_Hash.prototype.find = function(in_obj)
|
||||
{
|
||||
for (var tmp_key in this.elementData)
|
||||
for (var tmp_key in this.elementData)
|
||||
{
|
||||
if (this.elementData[tmp_key] == in_obj)
|
||||
if (this.elementData[tmp_key] == in_obj)
|
||||
{
|
||||
return tmp_key;
|
||||
}
|
||||
@ -221,12 +221,12 @@ domTT_Hash.prototype.find = function(in_obj)
|
||||
|
||||
domTT_Hash.prototype.merge = function(in_hash)
|
||||
{
|
||||
for (var tmp_key in in_hash.elementData)
|
||||
for (var tmp_key in in_hash.elementData)
|
||||
{
|
||||
if (typeof(this.elementData[tmp_key]) == 'undefined')
|
||||
if (typeof(this.elementData[tmp_key]) == 'undefined')
|
||||
{
|
||||
this.length++;
|
||||
if (tmp_key == parseInt(tmp_key))
|
||||
if (tmp_key == parseInt(tmp_key))
|
||||
{
|
||||
this.numericLength++;
|
||||
}
|
||||
@ -238,19 +238,19 @@ domTT_Hash.prototype.merge = function(in_hash)
|
||||
|
||||
domTT_Hash.prototype.compare = function(in_hash)
|
||||
{
|
||||
if (this.length != in_hash.length)
|
||||
if (this.length != in_hash.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var tmp_key in this.elementData)
|
||||
for (var tmp_key in this.elementData)
|
||||
{
|
||||
if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
|
||||
if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@ -390,7 +390,7 @@ function domLib_detectCollisions(in_object, in_recover, in_useCache)
|
||||
thisElement.hideList = new domTT_Hash();
|
||||
}
|
||||
|
||||
var selectOffsets = domLib_getOffsets(thisElement);
|
||||
var selectOffsets = domLib_getOffsets(thisElement);
|
||||
var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
|
||||
var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
|
||||
// the encompassing circles are overlapping, get in for a closer look
|
||||
@ -469,7 +469,7 @@ function domLib_getOffsets(in_object, in_preserveScroll)
|
||||
'bottom', offsetTop + originalHeight,
|
||||
'leftCenter', offsetLeft + originalWidth/2,
|
||||
'topCenter', offsetTop + originalHeight/2,
|
||||
'radius', Math.max(originalWidth, originalHeight)
|
||||
'radius', Math.max(originalWidth, originalHeight)
|
||||
);
|
||||
}
|
||||
|
||||
@ -612,8 +612,8 @@ function domLib_getIFrameReference(in_frame)
|
||||
|
||||
function domLib_getElementsByClass(in_class)
|
||||
{
|
||||
var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
|
||||
var matches = [];
|
||||
var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
|
||||
var matches = [];
|
||||
var cnt = 0;
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
{
|
||||
@ -658,7 +658,7 @@ function domLib_getElementsByTagNames(in_list, in_excludeHidden)
|
||||
continue;
|
||||
}
|
||||
|
||||
elements[elements.length] = matches[j];
|
||||
elements[elements.length] = matches[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*
|
||||
* Maintainer: Dan Allen <dan.allen@mojavelinux.com>
|
||||
* Contributors:
|
||||
* Josh Gross <josh@jportalhome.com>
|
||||
* Josh Gross <josh@jportalhome.com>
|
||||
* Jason Rust <jason@rustyparts.com>
|
||||
*
|
||||
* License: Apache 2.0
|
||||
@ -473,7 +473,7 @@ function domTT_create(in_options)
|
||||
{
|
||||
var left = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-left-width');
|
||||
var right = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-right-width');
|
||||
|
||||
|
||||
left = left.substring(left.indexOf(':') + 2, left.indexOf(';'));
|
||||
right = right.substring(right.indexOf(':') + 2, right.indexOf(';'));
|
||||
var correction = 2 * ((left ? parseInt(left) : 0) + (right ? parseInt(right) : 0));
|
||||
@ -804,7 +804,7 @@ function domTT_close(in_handle)
|
||||
while (!obj.id || !domTT_tooltips.get(obj.id))
|
||||
{
|
||||
obj = obj.parentNode;
|
||||
|
||||
|
||||
if (obj.nodeType != document.ELEMENT_NODE) { return; }
|
||||
}
|
||||
|
||||
@ -885,7 +885,7 @@ function domTT_deactivate(in_id)
|
||||
if (domTT_detectCollisions) {
|
||||
// unhide all of the selects that are owned by this object
|
||||
// utilize original collision element cache
|
||||
domLib_detectCollisions(tipObj, true, true);
|
||||
domLib_detectCollisions(tipObj, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
|
||||
this._maxOpacity = this._minOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typeof initialOpacity != 'undefined') {
|
||||
if (initialOpacity > this._maxOpacity) {
|
||||
this._opacity = this._maxOpacity;
|
||||
@ -81,7 +81,7 @@ function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
|
||||
}
|
||||
|
||||
this._updateOpacity = this._updateOpacityMSIE;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
this._updateOpacity = this._updateVisibility;
|
||||
@ -157,7 +157,7 @@ Fadomatic.prototype._tickFade = function () {
|
||||
};
|
||||
|
||||
Fadomatic.prototype._updateVisibility = function () {
|
||||
|
||||
|
||||
if (this._opacity > 0) {
|
||||
this._element.style.visibility = 'visible';
|
||||
} else {
|
||||
@ -166,13 +166,13 @@ Fadomatic.prototype._updateVisibility = function () {
|
||||
};
|
||||
|
||||
Fadomatic.prototype._updateOpacityW3c = function () {
|
||||
|
||||
|
||||
this._element.style.opacity = this._opacity/100;
|
||||
this._updateVisibility();
|
||||
};
|
||||
|
||||
Fadomatic.prototype._updateOpacityMSIE = function () {
|
||||
|
||||
|
||||
this._element.filters.alpha.opacity = this._opacity;
|
||||
this._updateVisibility();
|
||||
};
|
||||
|
||||
@ -91,7 +91,7 @@ function update_table_rows(data) {
|
||||
if (isIE) {
|
||||
showanim = 0;
|
||||
}
|
||||
|
||||
|
||||
var startat = data.length - nentries;
|
||||
if (startat < 0) {
|
||||
startat = 0;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* firebug lite <http://www.getfirebug.com/lite.html>
|
||||
* v1.0
|
||||
* 04.11.2008, 8:25 PM ~
|
||||
* 04.11.2008, 8:25 PM ~
|
||||
* v1.0a
|
||||
* 03.27.2008, 5:44 AM ~ 04.01.2008, 21:32 PM
|
||||
* Azer Koçulu <http://azer.kodfabrik.com>
|
||||
@ -13,12 +13,12 @@ var firebug = {
|
||||
firebug.el = {}; // elements
|
||||
firebug.el.content = {};
|
||||
with(firebug){
|
||||
|
||||
|
||||
document.documentElement.childNodes[0].appendChild(
|
||||
new pi.element("link").attribute.set("rel","stylesheet").attribute.set("href","http://firebuglite.appspot.com/firebug-lite.css").environment.getElement()
|
||||
);
|
||||
|
||||
/*
|
||||
/*
|
||||
* main interface
|
||||
*/
|
||||
el.main = new pi.element("DIV").attribute.set("id","Firebug").environment.addStyle({ "width":pi.util.GetWindowSize().width+"px" }).insert(document.body);
|
||||
@ -28,7 +28,7 @@ var firebug = {
|
||||
el.right = {};
|
||||
el.right.container = new pi.element("DIV").attribute.addClass("Right").insert(el.main);
|
||||
el.main.child.add(new pi.element("DIV").environment.addStyle({ "clear":"both" }));
|
||||
|
||||
|
||||
/*
|
||||
* buttons
|
||||
*/
|
||||
@ -39,11 +39,11 @@ var firebug = {
|
||||
el.button.maximize = new pi.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container);
|
||||
el.button.minimize = new pi.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container);
|
||||
el.button.close = new pi.element("A").attribute.addClass("Button Close").event.addListener("click",win.close).insert(el.button.container);
|
||||
|
||||
|
||||
if(pi.env.ie||pi.env.webkit){
|
||||
el.button.container.environment.addStyle({ "paddingTop":"12px" });
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* navigation
|
||||
*/
|
||||
@ -55,14 +55,14 @@ var firebug = {
|
||||
el.nav.scripts = new pi.element("A").attribute.addClass("Tab").update("Script").event.addListener("click",d.navigate.curry(window,"scripts")).insert(el.nav.container);
|
||||
el.nav.dom = new pi.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",d.navigate.curry(window,"dom")).insert(el.nav.container);
|
||||
el.nav.xhr = new pi.element("A").attribute.addClass("Tab").update("XHR").event.addListener("click",d.navigate.curry(window,"xhr")).insert(el.nav.container);
|
||||
|
||||
|
||||
/*
|
||||
* inspector
|
||||
*/
|
||||
|
||||
|
||||
el.borderInspector = new pi.element("DIV").attribute.set("id","FirebugBorderInspector").event.addListener("click",listen.inspector).insert(document.body);
|
||||
el.bgInspector = new pi.element("DIV").attribute.set("id","FirebugBGInspector").insert(document.body);
|
||||
|
||||
|
||||
/*
|
||||
* console
|
||||
*/
|
||||
@ -78,103 +78,103 @@ var firebug = {
|
||||
el.left.console.input = new pi.element("INPUT").attribute.set("type","text").attribute.addClass("Input").event.addListener("keydown",listen.consoleTextbox).insert(
|
||||
new pi.element("DIV").attribute.addClass("InputContainer").insert(el.left.console.container)
|
||||
);
|
||||
|
||||
|
||||
el.right.console = {};
|
||||
el.right.console.container = new pi.element("DIV").attribute.addClass("Console Container").insert(el.right.container);
|
||||
el.right.console.mlButton = new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.console.container);
|
||||
el.right.console.input = new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.console.container);
|
||||
el.right.console.run = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runMultiline).update("Run").insert(el.right.console.container);
|
||||
|
||||
|
||||
el.right.console.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.console.input)).update("Clear").insert(el.right.console.container);
|
||||
|
||||
|
||||
el.button.console = {};
|
||||
el.button.console.container = new pi.element("DIV").attribute.addClass("ButtonSet").insert(el.button.container);
|
||||
el.button.console.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.left.console.monitor)).update("Clear").insert(el.button.console.container);
|
||||
|
||||
|
||||
/*
|
||||
* html
|
||||
*/
|
||||
|
||||
|
||||
el.left.html = {};
|
||||
el.left.html.container = new pi.element("DIV").attribute.addClass("HTML").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.html = {};
|
||||
el.right.html.container = new pi.element("DIV").attribute.addClass("HTML Container").insert(el.right.container);
|
||||
|
||||
|
||||
el.right.html.nav = {};
|
||||
el.right.html.nav.container = new pi.element("DIV").attribute.addClass("Nav").insert(el.right.html.container);
|
||||
el.right.html.nav.computedStyle = new pi.element("A").attribute.addClass("Tab Selected").event.addListener("click",d.html.navigate.curry(firebug,"computedStyle")).update("Computed Style").insert(el.right.html.nav.container);
|
||||
if(!pi.env.ie6)
|
||||
el.right.html.nav.dom = new pi.element("A").attribute.addClass("Tab").event.addListener("click",d.html.navigate.curry(firebug,"dom")).update("DOM").insert(el.right.html.nav.container);
|
||||
|
||||
|
||||
el.right.html.content = new pi.element("DIV").attribute.addClass("Content").insert(el.right.html.container);
|
||||
|
||||
|
||||
el.button.html = {};
|
||||
el.button.html.container = new pi.element("DIV").attribute.addClass("ButtonSet HTML").insert(el.button.container);
|
||||
|
||||
|
||||
/*
|
||||
* css
|
||||
*/
|
||||
|
||||
|
||||
el.left.css = {};
|
||||
el.left.css.container = new pi.element("DIV").attribute.addClass("CSS").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.css = {};
|
||||
el.right.css.container = new pi.element("DIV").attribute.addClass("CSS Container").insert(el.right.container);
|
||||
|
||||
|
||||
el.right.css.nav = {};
|
||||
el.right.css.nav.container = new pi.element("DIV").attribute.addClass("Nav").insert(el.right.css.container);
|
||||
el.right.css.nav.runCSS = new pi.element("A").attribute.addClass("Tab Selected").update("Run CSS").insert(el.right.css.nav.container);
|
||||
|
||||
|
||||
el.right.css.mlButton = new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.css.container);
|
||||
el.right.css.input = new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.css.container);
|
||||
el.right.css.run = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runCSS).update("Run").insert(el.right.css.container);
|
||||
el.right.css.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.css.input)).update("Clear").insert(el.right.css.container);
|
||||
|
||||
|
||||
el.button.css = {};
|
||||
el.button.css.container = new pi.element("DIV").attribute.addClass("ButtonSet CSS").insert(el.button.container);
|
||||
el.button.css.selectbox = new pi.element("SELECT").event.addListener("change",listen.cssSelectbox).insert(el.button.css.container);
|
||||
|
||||
|
||||
/*
|
||||
* scripts
|
||||
*/
|
||||
|
||||
|
||||
el.left.scripts = {};
|
||||
el.left.scripts.container = new pi.element("DIV").attribute.addClass("Scripts").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.scripts = {};
|
||||
el.right.scripts.container = new pi.element("DIV").attribute.addClass("Scripts Container").insert(el.right.container);
|
||||
|
||||
|
||||
el.button.scripts = {};
|
||||
el.button.scripts.container = new pi.element("DIV").attribute.addClass("ButtonSet Scripts").insert(el.button.container);
|
||||
el.button.scripts.selectbox = new pi.element("SELECT").event.addListener("change",listen.scriptsSelectbox).insert(el.button.scripts.container);
|
||||
el.button.scripts.lineNumbers = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.scripts.toggleLineNumbers).update("Show Line Numbers").insert(el.button.scripts.container);
|
||||
|
||||
|
||||
/*
|
||||
* dom
|
||||
*/
|
||||
|
||||
|
||||
el.left.dom = {};
|
||||
el.left.dom.container = new pi.element("DIV").attribute.addClass("DOM").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.dom = {};
|
||||
el.right.dom.container = new pi.element("DIV").attribute.addClass("DOM Container").insert(el.right.container);
|
||||
|
||||
|
||||
el.button.dom = {};
|
||||
el.button.dom.container = new pi.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container);
|
||||
el.button.dom.label = new pi.element("LABEL").update("Object Path:").insert(el.button.dom.container);
|
||||
el.button.dom.textbox = new pi.element("INPUT").event.addListener("keydown",listen.domTextbox).update("window").insert(el.button.dom.container);
|
||||
|
||||
|
||||
/*
|
||||
* str
|
||||
*/
|
||||
|
||||
|
||||
el.left.str = {};
|
||||
el.left.str.container = new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.str = {};
|
||||
el.right.str.container = new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);
|
||||
|
||||
|
||||
el.button.str = {};
|
||||
el.button.str.container = new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
|
||||
el.button.str.watch = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.navigate.curry(window,"xhr")).update("Back").insert(el.button.str.container);
|
||||
@ -182,20 +182,20 @@ var firebug = {
|
||||
/*
|
||||
* xhr
|
||||
*/
|
||||
|
||||
|
||||
el.left.xhr = {};
|
||||
el.left.xhr.container = new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);
|
||||
|
||||
|
||||
el.right.xhr = {};
|
||||
el.right.xhr.container = new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);
|
||||
|
||||
|
||||
|
||||
|
||||
el.button.xhr = {};
|
||||
el.button.xhr.container = new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
|
||||
el.button.xhr.label = new pi.element("LABEL").update("XHR Path:").insert(el.button.xhr.container);
|
||||
el.button.xhr.textbox = new pi.element("INPUT").event.addListener("keydown",listen.xhrTextbox).insert(el.button.xhr.container);
|
||||
el.button.xhr.watch = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.addXhrObject).update("Watch").insert(el.button.xhr.container);
|
||||
|
||||
|
||||
// fix ie6 a:hover bug
|
||||
if(pi.env.ie6)
|
||||
{
|
||||
@ -213,14 +213,14 @@ var firebug = {
|
||||
buttons[i].attribute.set("href","#");
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
env.init = true;
|
||||
|
||||
|
||||
for(var i=0; i<env.ctmp.length; i++)
|
||||
{
|
||||
d.console.log.apply(window,env.ctmp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
win:{
|
||||
close:function(){
|
||||
@ -286,15 +286,15 @@ var firebug = {
|
||||
env.ctmp.push(arguments);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var value = "";
|
||||
for(var i=0; i<arguments.length; i++){
|
||||
value += (i>0?" ":"")+d.highlight(arguments[i],false,false,true);
|
||||
}
|
||||
|
||||
|
||||
d.console.addLine().update(value);
|
||||
d.console.scroll();
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
print: function(_cmd,_text){
|
||||
@ -309,7 +309,7 @@ var firebug = {
|
||||
with(firebug){
|
||||
if(cmd.length==0)return;
|
||||
el.left.console.input.environment.getElement().value = "";
|
||||
try {
|
||||
try {
|
||||
var result = eval.call(window,cmd);
|
||||
d.console.print(cmd,result);
|
||||
} catch(e){
|
||||
@ -326,7 +326,7 @@ var firebug = {
|
||||
d.console.scroll();
|
||||
}
|
||||
d.console.scroll();
|
||||
}
|
||||
}
|
||||
},
|
||||
scroll:function(){
|
||||
with(firebug){
|
||||
@ -404,7 +404,7 @@ var firebug = {
|
||||
with (firebug) {
|
||||
var obj = _object || window, parentElement = _parent;
|
||||
parentElement.update("");
|
||||
|
||||
|
||||
if(parentElement.opened&&parentElement!=el.left.dom.container){
|
||||
parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.removeClass("Opened");
|
||||
parentElement.opened = false;
|
||||
@ -414,30 +414,30 @@ var firebug = {
|
||||
if(_inTree)
|
||||
parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.addClass("Opened");
|
||||
parentElement.opened = true;
|
||||
|
||||
|
||||
for (var key in obj) {
|
||||
try {
|
||||
|
||||
try {
|
||||
|
||||
var value = obj[key], property = key, container = new pi.element("DIV").attribute.addClass("DOMRow").insert(parentElement),
|
||||
left = new pi.element("DIV").attribute.addClass("DOMRowLeft").insert(container), right = new pi.element("DIV").attribute.addClass("DOMRowRight").insert(container);
|
||||
|
||||
|
||||
container.child.add(
|
||||
new pi.element("DIV").environment.addStyle({ "clear":"both" })
|
||||
);
|
||||
|
||||
|
||||
var link = new pi.element("A").attribute.addClass(
|
||||
typeof value=="object"&&Boolean(value)?"Property Object":"Property"
|
||||
).update(property).insert(left);
|
||||
|
||||
|
||||
right.update(
|
||||
d.highlight(value,false,true)
|
||||
);
|
||||
|
||||
|
||||
var subContainer = new pi.element("DIV").attribute.addClass("DOMRowSubContainer").insert(container);
|
||||
|
||||
|
||||
if(typeof value!="object"||Boolean(value)==false)
|
||||
continue;
|
||||
|
||||
|
||||
link.event.addListener("click",d.dom.print.curry(window,value, subContainer, true));
|
||||
}catch(e){
|
||||
}
|
||||
@ -453,31 +453,31 @@ var firebug = {
|
||||
isArray = pi.util.IsArray(_value);
|
||||
isElement = _value!=undefined&&Boolean(_value.nodeName)&&Boolean(_value.nodeType);
|
||||
}catch(e){};
|
||||
|
||||
|
||||
// number, string, boolean, null, function
|
||||
if(_value==null||["boolean","function","number","string"].indexOf(typeof _value)>-1){
|
||||
// NULL
|
||||
if(_value==null){
|
||||
return "<span class='Null'>null</span>";
|
||||
}
|
||||
|
||||
|
||||
// BOOLEAN & NUMBER
|
||||
if (["boolean", "number"].indexOf(typeof _value) > -1) {
|
||||
return "<span class='DarkBlue'>" + _value + "</span>";
|
||||
}
|
||||
|
||||
|
||||
// FUNCTION
|
||||
if(typeof _value=="function"){
|
||||
return "<span class='"+(_inObject?"Italic Gray":"Green")+"'>function()</span>";
|
||||
}
|
||||
|
||||
|
||||
// STRING
|
||||
return "<span class='Red'>\""+( !_inObject&&!_inArray?_value : _value.substring(0,35) ).replace(/\n/g,"\\n").replace(/\s/g," ").replace(/>/g,">").replace(/</g,"<")+"\"</span>";
|
||||
}
|
||||
// element
|
||||
// element
|
||||
else if(isElement){
|
||||
if(_value.nodeType==3)return d.highlight(_value.nodeValue);
|
||||
|
||||
|
||||
if(_inArray||_inObject){
|
||||
var result = "<span class='Blue'>"+_value.nodeName.toLowerCase();
|
||||
if(_value.getAttribute&&_value.getAttribute("id"))result += "<span class='DarkBlue'>#"+_value.getAttribute("id")+"</span>";
|
||||
@ -485,7 +485,7 @@ var firebug = {
|
||||
if(elClass)result += "<span class='Red'>."+elClass.split(" ")[0]+"</span>";
|
||||
return result+"</span>";
|
||||
}
|
||||
|
||||
|
||||
var result = "<span class='Blue'><"+_value.nodeName.toLowerCase()+"";
|
||||
if(_value.attributes)
|
||||
for(var i=0; i<_value.attributes.length; i++){
|
||||
@ -502,7 +502,7 @@ var firebug = {
|
||||
if(isArray||_value instanceof Array){
|
||||
if(_inObject)return "<span class='Gray Italic'>["+_value.length+"]</span>";
|
||||
result += "<span class='Strong'>[ ";
|
||||
|
||||
|
||||
for(var i=0; i<_value.length; i++){
|
||||
if((_inObject||_inArray)&&pi.env.ie&&i>3)break;
|
||||
result += (i > 0 ? ", " : "") + d.highlight(_value[i], false, true, true);
|
||||
@ -527,7 +527,7 @@ var firebug = {
|
||||
return "<span class='Gray Italic'>"+_value+"</span>";
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
html:{
|
||||
@ -555,14 +555,14 @@ var firebug = {
|
||||
var parentLayer = el.left.html.container.child.get()[1].childNodes[1].pi;
|
||||
for(var t=0; map[t];){
|
||||
if(t==map.length-1){
|
||||
|
||||
|
||||
var link = parentLayer.environment.getElement().previousSibling.pi;
|
||||
link.attribute.addClass("Selected");
|
||||
|
||||
|
||||
if(d.html.current)d.html.current[1].attribute.removeClass("Selected");
|
||||
|
||||
|
||||
d.html.current = [_element,link];
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
parentLayer = d.html.openHtmlTree(map[t],parentLayer,map[t+1]);
|
||||
@ -576,25 +576,25 @@ var firebug = {
|
||||
el.right.html.nav[_index].attribute.addClass("Selected");
|
||||
d.html.nIndex = _index;
|
||||
d.html.openProperties();
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){
|
||||
with(firebug){
|
||||
var element = _element || document.documentElement,
|
||||
parent = _parent || el.left.html.container,
|
||||
returnParentEl = _returnParentElementByElement || null,
|
||||
returnParentVal = null;
|
||||
|
||||
var element = _element || document.documentElement,
|
||||
parent = _parent || el.left.html.container,
|
||||
returnParentEl = _returnParentElementByElement || null,
|
||||
returnParentVal = null;
|
||||
|
||||
if(parent!=el.left.html.container){
|
||||
var nodeLink = parent.environment.getParent().pi.child.get()[0].pi;
|
||||
if(d.html.current)d.html.current[1].attribute.removeClass("Selected");
|
||||
nodeLink.attribute.addClass("Selected");
|
||||
|
||||
|
||||
d.html.current = [_element,nodeLink];
|
||||
d.html.openProperties();
|
||||
}
|
||||
|
||||
|
||||
if(element.childNodes&&(element.childNodes.length==0||(element.childNodes.length==1&&element.childNodes[0].nodeType==3)))return;
|
||||
parent.clean();
|
||||
|
||||
@ -606,12 +606,12 @@ var firebug = {
|
||||
if (parent != el.left.html.container) {
|
||||
parent.environment.getParent().pi.child.get()[0].pi.attribute.addClass("Open");
|
||||
parent.opened = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
for(var i=0; i<element.childNodes.length; i++){
|
||||
var item = element.childNodes[i];
|
||||
|
||||
|
||||
if(item.nodeType==3)continue;
|
||||
var container = new pi.element().attribute.addClass("Block").insert(parent);
|
||||
var link = new pi.element("A").attribute.addClass("Link").update(d.highlight(item)).insert(container);
|
||||
@ -619,15 +619,15 @@ var firebug = {
|
||||
link.event.addListener("click",d.html.openHtmlTree.curry(window,item,subContainer,false));
|
||||
link.event.addListener("mouseover",d.html.highlight.curry(window,item, false));
|
||||
link.event.addListener("mouseout",d.html.highlight.curry(window,item,true));
|
||||
|
||||
|
||||
returnParentVal = returnParentEl==item?subContainer:returnParentVal;
|
||||
|
||||
|
||||
if(d.html.current==null&&item==document.body){
|
||||
link.attribute.addClass("Selected");
|
||||
d.html.current = [item,link];
|
||||
d.html.openHtmlTree(item,subContainer);
|
||||
}
|
||||
|
||||
|
||||
if(item.childNodes&&item.childNodes.length==1&&item.childNodes[0].nodeType==3){
|
||||
link.child.get()[0].appendChild(document.createTextNode(item.childNodes[0].nodeValue.substring(0,100)));
|
||||
link.child.get()[0].appendChild(document.createTextNode("</"));
|
||||
@ -637,14 +637,14 @@ var firebug = {
|
||||
}
|
||||
else if(item.childNodes&&item.childNodes.length==0)continue;
|
||||
link.attribute.addClass("ParentLink");
|
||||
|
||||
|
||||
}
|
||||
return returnParentVal;
|
||||
}
|
||||
},
|
||||
openProperties:function(){
|
||||
with(firebug){
|
||||
|
||||
|
||||
var index = d.html.nIndex;
|
||||
var node = d.html.current[0];
|
||||
d.clean(el.right.html.content);
|
||||
@ -678,9 +678,9 @@ var firebug = {
|
||||
parent = parent.offsetParent;
|
||||
if(parent==document.body)break;
|
||||
};
|
||||
|
||||
|
||||
with(firebug){
|
||||
el[_bgInspector?"bgInspector":"borderInspector"].environment.addStyle({
|
||||
el[_bgInspector?"bgInspector":"borderInspector"].environment.addStyle({
|
||||
"width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px",
|
||||
"top":top-(_bgInspector?0:2)+"px", "left":left-(_bgInspector?0:2)+"px",
|
||||
"display":"block"
|
||||
@ -712,12 +712,12 @@ var firebug = {
|
||||
d.scripts.index = _index;
|
||||
el.left.scripts.container.update("");
|
||||
var script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source;
|
||||
|
||||
|
||||
if(uri.indexOf("http:\/\/")>-1&&getDomain(uri)!=document.domain){
|
||||
el.left.scripts.container.update("<em>Access to restricted URI denied</em>");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(uri!=document.location.href){
|
||||
source = env.cache[uri]||pi.xhr.get(uri).responseText;
|
||||
env.cache[uri] = source;
|
||||
@ -726,8 +726,8 @@ var firebug = {
|
||||
source = source.replace(/\n|\t|<|>/g,function(_ch){
|
||||
return ({"<":"<",">":">","\t":" ","\n":"<br />"})[_ch];
|
||||
});
|
||||
|
||||
if (!d.scripts.lineNumbers)
|
||||
|
||||
if (!d.scripts.lineNumbers)
|
||||
el.left.scripts.container.child.add(
|
||||
new pi.element("DIV").attribute.addClass("CodeContainer").update(source)
|
||||
);
|
||||
@ -746,8 +746,8 @@ var firebug = {
|
||||
d.scripts.lineNumbers = !d.scripts.lineNumbers;
|
||||
el.button.scripts.lineNumbers.attribute[(d.scripts.lineNumbers ? "add" : "remove") + "Class"]("Enabled");
|
||||
d.scripts.open( d.scripts.index );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
refresh:function(){
|
||||
with(firebug){
|
||||
@ -822,7 +822,7 @@ var firebug = {
|
||||
el.left.xhr.statusContent.child.add(new pi.element("span").update(item[1].status));
|
||||
} catch(e){ el.left.xhr.statusContent.child.add(new pi.element("span").update(" ")); }
|
||||
el.left.xhr.readystateContent.child.add(new pi.element("span").update(item[1].readyState));
|
||||
|
||||
|
||||
el.left.xhr.responseContent.child.add(new pi.element("span").child.add(
|
||||
new pi.element("A").event.addListener("click",d.str.open.curry(window,response)).update(" "+response.substring(0,50))
|
||||
));
|
||||
@ -840,23 +840,23 @@ var firebug = {
|
||||
},
|
||||
navigate:function(_index){
|
||||
with(firebug){
|
||||
|
||||
|
||||
var open = _index, close = env.dIndex;
|
||||
env.dIndex = open;
|
||||
|
||||
|
||||
el.button[close].container.environment.addStyle({ "display":"none" });
|
||||
el.left[close].container.environment.addStyle({ "display":"none" });
|
||||
el.right[close].container.environment.addStyle({ "display":"none" });
|
||||
|
||||
|
||||
el.button[open].container.environment.addStyle({ "display":"inline" });
|
||||
el.left[open].container.environment.addStyle({ "display":"block" });
|
||||
el.right[open].container.environment.addStyle({ "display":"block" });
|
||||
|
||||
|
||||
if(el.nav[close])
|
||||
el.nav[close].attribute.removeClass("Selected");
|
||||
if(el.nav[open])
|
||||
el.nav[open].attribute.addClass("Selected");
|
||||
|
||||
|
||||
switch(open){
|
||||
case "console":
|
||||
d.navigateRightColumn(_index);
|
||||
@ -883,7 +883,7 @@ var firebug = {
|
||||
d.xhr.open();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
refreshSize:function(){
|
||||
@ -997,4 +997,4 @@ window.console = firebug.d.console;
|
||||
pi.util.AddEvent(window,"resize",firebug.d.refreshSize);
|
||||
pi.util.AddEvent(document,"mousemove",firebug.listen.mouse);
|
||||
pi.util.AddEvent(document,"keydown",firebug.listen.keyboard);
|
||||
pi.util.DOMContentLoaded.push(firebug.init);
|
||||
pi.util.DOMContentLoaded.push(firebug.init);
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @class
|
||||
* @scope public
|
||||
*/
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
oProvider /*:SuggestionProvider*/) {
|
||||
|
||||
|
||||
/**
|
||||
* The currently selected suggestions.
|
||||
* @scope private
|
||||
*/
|
||||
*/
|
||||
this.cur /*:int*/ = -1;
|
||||
|
||||
/**
|
||||
@ -18,22 +18,22 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
* @scope private
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
|
||||
/**
|
||||
* Suggestion provider for the autosuggest feature.
|
||||
* @scope private.
|
||||
*/
|
||||
this.provider /*:SuggestionProvider*/ = oProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The textbox to capture.
|
||||
* @scope private
|
||||
*/
|
||||
this.textbox /*:HTMLInputElement*/ = oTextbox;
|
||||
|
||||
|
||||
//initialize the control
|
||||
this.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
*/
|
||||
AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
|
||||
bTypeAhead /*:boolean*/) {
|
||||
|
||||
|
||||
//make sure there's at least one suggestion
|
||||
if (aSuggestions.length > 0) {
|
||||
if (bTypeAhead) {
|
||||
this.typeAhead(aSuggestions[0]);
|
||||
}
|
||||
|
||||
|
||||
this.showSuggestions(aSuggestions);
|
||||
} else {
|
||||
this.hideSuggestions();
|
||||
@ -71,11 +71,11 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
this.layer.className = "suggestions";
|
||||
this.layer.style.visibility = "hidden";
|
||||
this.layer.style.width = this.textbox.offsetWidth;
|
||||
|
||||
|
||||
//when the user clicks on the a suggestion, get the text (innerHTML)
|
||||
//and place it into a textbox
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmouseover = function (oEvent) {
|
||||
oEvent = oEvent || window.event;
|
||||
oTarget = oEvent.target || oEvent.srcElement;
|
||||
@ -89,8 +89,8 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
oThis.textbox.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(this.layer);
|
||||
};
|
||||
|
||||
@ -103,12 +103,12 @@ AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iLeft = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iLeft += oNode.offsetLeft;
|
||||
oNode = oNode.offsetParent;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iLeft;
|
||||
};
|
||||
|
||||
@ -121,12 +121,12 @@ AutoSuggestControl.prototype.getTop = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iTop = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iTop += oNode.offsetTop;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iTop;
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
|
||||
case 38: //up arrow
|
||||
this.previousSuggestion();
|
||||
break;
|
||||
case 40: //down arrow
|
||||
case 40: //down arrow
|
||||
this.nextSuggestion();
|
||||
break;
|
||||
case 13: //enter
|
||||
@ -163,7 +163,7 @@ AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
|
||||
//for backspace (8) and delete (46), shows suggestions without typeahead
|
||||
if (iKeyCode == 8 || iKeyCode == 46) {
|
||||
this.provider.requestSuggestions(this, false);
|
||||
|
||||
|
||||
//make sure not to interfere with non-character keys
|
||||
} else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
|
||||
//ignore
|
||||
@ -187,7 +187,7 @@ AutoSuggestControl.prototype.hideSuggestions = function () {
|
||||
* @param oSuggestionNode The node representing a suggestion in the dropdown.
|
||||
*/
|
||||
AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
|
||||
|
||||
|
||||
for (var i=0; i < this.layer.childNodes.length; i++) {
|
||||
var oNode = this.layer.childNodes[i];
|
||||
if (oNode == oSuggestionNode) {
|
||||
@ -207,36 +207,36 @@ AutoSuggestControl.prototype.init = function () {
|
||||
|
||||
//save a reference to this object
|
||||
var oThis = this;
|
||||
|
||||
|
||||
//assign the onkeyup event handler
|
||||
this.textbox.onkeyup = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyUp() method with the event object
|
||||
oThis.handleKeyUp(oEvent);
|
||||
};
|
||||
|
||||
|
||||
//assign onkeydown event handler
|
||||
this.textbox.onkeydown = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyDown() method with the event object
|
||||
oThis.handleKeyDown(oEvent);
|
||||
};
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
this.textbox.onblur = function () {
|
||||
oThis.hideSuggestions();
|
||||
};
|
||||
|
||||
|
||||
//create the suggestions dropdown
|
||||
this.createDropDown();
|
||||
};
|
||||
@ -252,7 +252,7 @@ AutoSuggestControl.prototype.nextSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
|
||||
var oNode = cSuggestionNodes[++this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,7 +267,7 @@ AutoSuggestControl.prototype.previousSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur > 0) {
|
||||
var oNode = cSuggestionNodes[--this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,19 +281,19 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
|
||||
//use text ranges for Internet Explorer
|
||||
if (this.textbox.createTextRange) {
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
oRange.select();
|
||||
|
||||
|
||||
//use setSelectionRange() for Mozilla
|
||||
} else if (this.textbox.setSelectionRange) {
|
||||
this.textbox.setSelectionRange(iStart, iLength);
|
||||
}
|
||||
}
|
||||
|
||||
//set focus back to the textbox
|
||||
this.textbox.focus();
|
||||
};
|
||||
this.textbox.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the suggestion layer contents, moves it into position,
|
||||
@ -302,16 +302,16 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
* @param aSuggestions An array of suggestions for the control.
|
||||
*/
|
||||
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
|
||||
|
||||
|
||||
var oDiv = null;
|
||||
this.layer.innerHTML = ""; //clear contents of the layer
|
||||
|
||||
|
||||
for (var i=0; i < aSuggestions.length; i++) {
|
||||
oDiv = document.createElement("div");
|
||||
oDiv.appendChild(document.createTextNode(aSuggestions[i]));
|
||||
this.layer.appendChild(oDiv);
|
||||
}
|
||||
|
||||
|
||||
this.layer.style.left = this.getLeft() + "px";
|
||||
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
|
||||
this.layer.style.visibility = "visible";
|
||||
@ -319,7 +319,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* suggested part of the text.
|
||||
* @scope private
|
||||
* @param sSuggestion The suggestion for the textbox.
|
||||
@ -328,9 +328,8 @@ AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
|
||||
|
||||
//check for support of typeahead functionality
|
||||
if (this.textbox.createTextRange || this.textbox.setSelectionRange){
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
this.selectRange(iLen, sSuggestion.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -3,4 +3,4 @@ function kH(e) {
|
||||
return pK != 13;
|
||||
}
|
||||
document.onkeypress = kH;
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
|
||||
@ -9,7 +9,7 @@ function StateSuggestions(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* @scope protected
|
||||
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*
|
||||
bTypeAhead /*:boolean*/) {
|
||||
var aSuggestions = [];
|
||||
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
||||
|
||||
|
||||
if (sTextboxValue.length > 0){
|
||||
|
||||
|
||||
//search for matching states
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
|
||||
aSuggestions.push(this.states[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @class
|
||||
* @scope public
|
||||
*/
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
oProvider /*:SuggestionProvider*/) {
|
||||
|
||||
|
||||
/**
|
||||
* The currently selected suggestions.
|
||||
* @scope private
|
||||
*/
|
||||
*/
|
||||
this.cur /*:int*/ = -1;
|
||||
|
||||
/**
|
||||
@ -18,22 +18,22 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
* @scope private
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
|
||||
/**
|
||||
* Suggestion provider for the autosuggest feature.
|
||||
* @scope private.
|
||||
*/
|
||||
this.provider /*:SuggestionProvider*/ = oProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The textbox to capture.
|
||||
* @scope private
|
||||
*/
|
||||
this.textbox /*:HTMLInputElement*/ = oTextbox;
|
||||
|
||||
|
||||
//initialize the control
|
||||
this.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
*/
|
||||
AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
|
||||
bTypeAhead /*:boolean*/) {
|
||||
|
||||
|
||||
//make sure there's at least one suggestion
|
||||
if (aSuggestions.length > 0) {
|
||||
if (bTypeAhead) {
|
||||
this.typeAhead(aSuggestions[0]);
|
||||
}
|
||||
|
||||
|
||||
this.showSuggestions(aSuggestions);
|
||||
} else {
|
||||
this.hideSuggestions();
|
||||
@ -71,11 +71,11 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
this.layer.className = "suggestions";
|
||||
this.layer.style.visibility = "hidden";
|
||||
this.layer.style.width = this.textbox.offsetWidth;
|
||||
|
||||
|
||||
//when the user clicks on the a suggestion, get the text (innerHTML)
|
||||
//and place it into a textbox
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmouseover = function (oEvent) {
|
||||
oEvent = oEvent || window.event;
|
||||
oTarget = oEvent.target || oEvent.srcElement;
|
||||
@ -89,8 +89,8 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
oThis.textbox.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(this.layer);
|
||||
};
|
||||
|
||||
@ -103,12 +103,12 @@ AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iLeft = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iLeft += oNode.offsetLeft;
|
||||
oNode = oNode.offsetParent;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iLeft;
|
||||
};
|
||||
|
||||
@ -121,12 +121,12 @@ AutoSuggestControl.prototype.getTop = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iTop = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iTop += oNode.offsetTop;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iTop;
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
|
||||
case 38: //up arrow
|
||||
this.previousSuggestion();
|
||||
break;
|
||||
case 40: //down arrow
|
||||
case 40: //down arrow
|
||||
this.nextSuggestion();
|
||||
break;
|
||||
case 13: //enter
|
||||
@ -163,7 +163,7 @@ AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
|
||||
//for backspace (8) and delete (46), shows suggestions without typeahead
|
||||
if (iKeyCode == 8 || iKeyCode == 46) {
|
||||
this.provider.requestSuggestions(this, false);
|
||||
|
||||
|
||||
//make sure not to interfere with non-character keys
|
||||
} else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
|
||||
//ignore
|
||||
@ -187,7 +187,7 @@ AutoSuggestControl.prototype.hideSuggestions = function () {
|
||||
* @param oSuggestionNode The node representing a suggestion in the dropdown.
|
||||
*/
|
||||
AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
|
||||
|
||||
|
||||
for (var i=0; i < this.layer.childNodes.length; i++) {
|
||||
var oNode = this.layer.childNodes[i];
|
||||
if (oNode == oSuggestionNode) {
|
||||
@ -207,36 +207,36 @@ AutoSuggestControl.prototype.init = function () {
|
||||
|
||||
//save a reference to this object
|
||||
var oThis = this;
|
||||
|
||||
|
||||
//assign the onkeyup event handler
|
||||
this.textbox.onkeyup = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyUp() method with the event object
|
||||
oThis.handleKeyUp(oEvent);
|
||||
};
|
||||
|
||||
|
||||
//assign onkeydown event handler
|
||||
this.textbox.onkeydown = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyDown() method with the event object
|
||||
oThis.handleKeyDown(oEvent);
|
||||
};
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
this.textbox.onblur = function () {
|
||||
oThis.hideSuggestions();
|
||||
};
|
||||
|
||||
|
||||
//create the suggestions dropdown
|
||||
this.createDropDown();
|
||||
};
|
||||
@ -252,7 +252,7 @@ AutoSuggestControl.prototype.nextSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
|
||||
var oNode = cSuggestionNodes[++this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,7 +267,7 @@ AutoSuggestControl.prototype.previousSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur > 0) {
|
||||
var oNode = cSuggestionNodes[--this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,19 +281,19 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
|
||||
//use text ranges for Internet Explorer
|
||||
if (this.textbox.createTextRange) {
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
oRange.select();
|
||||
|
||||
|
||||
//use setSelectionRange() for Mozilla
|
||||
} else if (this.textbox.setSelectionRange) {
|
||||
this.textbox.setSelectionRange(iStart, iLength);
|
||||
}
|
||||
}
|
||||
|
||||
//set focus back to the textbox
|
||||
this.textbox.focus();
|
||||
};
|
||||
this.textbox.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the suggestion layer contents, moves it into position,
|
||||
@ -302,16 +302,16 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
* @param aSuggestions An array of suggestions for the control.
|
||||
*/
|
||||
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
|
||||
|
||||
|
||||
var oDiv = null;
|
||||
this.layer.innerHTML = ""; //clear contents of the layer
|
||||
|
||||
|
||||
for (var i=0; i < aSuggestions.length; i++) {
|
||||
oDiv = document.createElement("div");
|
||||
oDiv.appendChild(document.createTextNode(aSuggestions[i]));
|
||||
this.layer.appendChild(oDiv);
|
||||
}
|
||||
|
||||
|
||||
this.layer.style.left = this.getLeft() + "px";
|
||||
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
|
||||
this.layer.style.visibility = "visible";
|
||||
@ -319,7 +319,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* suggested part of the text.
|
||||
* @scope private
|
||||
* @param sSuggestion The suggestion for the textbox.
|
||||
@ -328,9 +328,8 @@ AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
|
||||
|
||||
//check for support of typeahead functionality
|
||||
if (this.textbox.createTextRange || this.textbox.setSelectionRange){
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
this.selectRange(iLen, sSuggestion.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -3,4 +3,4 @@ function kH(e) {
|
||||
return pK != 13;
|
||||
}
|
||||
document.onkeypress = kH;
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
|
||||
@ -150,7 +150,7 @@ function show_dsdiv() {
|
||||
function show_advanced_noxmlrpc() {
|
||||
document.getElementById("showadvnoxmlrpcsyncbox").innerHTML='';
|
||||
aodiv = document.getElementById('shownoxmlrpcadv');
|
||||
aodiv.style.display = "block";
|
||||
aodiv.style.display = "block";
|
||||
}
|
||||
|
||||
function show_advanced_vlanprio() {
|
||||
|
||||
@ -9,7 +9,7 @@ function StateSuggestions(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* @scope protected
|
||||
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*
|
||||
bTypeAhead /*:boolean*/) {
|
||||
var aSuggestions = [];
|
||||
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
||||
|
||||
|
||||
if (sTextboxValue.length > 0){
|
||||
|
||||
|
||||
//search for matching states
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
|
||||
aSuggestions.push(this.states[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @class
|
||||
* @scope public
|
||||
*/
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
oProvider /*:SuggestionProvider*/) {
|
||||
|
||||
|
||||
/**
|
||||
* The currently selected suggestions.
|
||||
* @scope private
|
||||
*/
|
||||
*/
|
||||
this.cur /*:int*/ = -1;
|
||||
|
||||
/**
|
||||
@ -18,22 +18,22 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
* @scope private
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
|
||||
/**
|
||||
* Suggestion provider for the autosuggest feature.
|
||||
* @scope private.
|
||||
*/
|
||||
this.provider /*:SuggestionProvider*/ = oProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The textbox to capture.
|
||||
* @scope private
|
||||
*/
|
||||
this.textbox /*:HTMLInputElement*/ = oTextbox;
|
||||
|
||||
|
||||
//initialize the control
|
||||
this.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
*/
|
||||
AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
|
||||
bTypeAhead /*:boolean*/) {
|
||||
|
||||
|
||||
//make sure there's at least one suggestion
|
||||
if (aSuggestions.length > 0) {
|
||||
if (bTypeAhead) {
|
||||
this.typeAhead(aSuggestions[0]);
|
||||
}
|
||||
|
||||
|
||||
this.showSuggestions(aSuggestions);
|
||||
} else {
|
||||
this.hideSuggestions();
|
||||
@ -71,11 +71,11 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
this.layer.className = "suggestions";
|
||||
this.layer.style.visibility = "hidden";
|
||||
this.layer.style.width = this.textbox.offsetWidth;
|
||||
|
||||
|
||||
//when the user clicks on the a suggestion, get the text (innerHTML)
|
||||
//and place it into a textbox
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmouseover = function (oEvent) {
|
||||
oEvent = oEvent || window.event;
|
||||
oTarget = oEvent.target || oEvent.srcElement;
|
||||
@ -89,8 +89,8 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
oThis.textbox.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(this.layer);
|
||||
};
|
||||
|
||||
@ -103,12 +103,12 @@ AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iLeft = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iLeft += oNode.offsetLeft;
|
||||
oNode = oNode.offsetParent;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iLeft;
|
||||
};
|
||||
|
||||
@ -121,12 +121,12 @@ AutoSuggestControl.prototype.getTop = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iTop = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iTop += oNode.offsetTop;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iTop;
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
|
||||
case 38: //up arrow
|
||||
this.previousSuggestion();
|
||||
break;
|
||||
case 40: //down arrow
|
||||
case 40: //down arrow
|
||||
this.nextSuggestion();
|
||||
break;
|
||||
case 13: //enter
|
||||
@ -163,7 +163,7 @@ AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
|
||||
//for backspace (8) and delete (46), shows suggestions without typeahead
|
||||
if (iKeyCode == 8 || iKeyCode == 46) {
|
||||
this.provider.requestSuggestions(this, false);
|
||||
|
||||
|
||||
//make sure not to interfere with non-character keys
|
||||
} else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
|
||||
//ignore
|
||||
@ -187,7 +187,7 @@ AutoSuggestControl.prototype.hideSuggestions = function () {
|
||||
* @param oSuggestionNode The node representing a suggestion in the dropdown.
|
||||
*/
|
||||
AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
|
||||
|
||||
|
||||
for (var i=0; i < this.layer.childNodes.length; i++) {
|
||||
var oNode = this.layer.childNodes[i];
|
||||
if (oNode == oSuggestionNode) {
|
||||
@ -207,36 +207,36 @@ AutoSuggestControl.prototype.init = function () {
|
||||
|
||||
//save a reference to this object
|
||||
var oThis = this;
|
||||
|
||||
|
||||
//assign the onkeyup event handler
|
||||
this.textbox.onkeyup = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyUp() method with the event object
|
||||
oThis.handleKeyUp(oEvent);
|
||||
};
|
||||
|
||||
|
||||
//assign onkeydown event handler
|
||||
this.textbox.onkeydown = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyDown() method with the event object
|
||||
oThis.handleKeyDown(oEvent);
|
||||
};
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
this.textbox.onblur = function () {
|
||||
oThis.hideSuggestions();
|
||||
};
|
||||
|
||||
|
||||
//create the suggestions dropdown
|
||||
this.createDropDown();
|
||||
};
|
||||
@ -252,7 +252,7 @@ AutoSuggestControl.prototype.nextSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
|
||||
var oNode = cSuggestionNodes[++this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,7 +267,7 @@ AutoSuggestControl.prototype.previousSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur > 0) {
|
||||
var oNode = cSuggestionNodes[--this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,19 +281,19 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
|
||||
//use text ranges for Internet Explorer
|
||||
if (this.textbox.createTextRange) {
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
oRange.select();
|
||||
|
||||
|
||||
//use setSelectionRange() for Mozilla
|
||||
} else if (this.textbox.setSelectionRange) {
|
||||
this.textbox.setSelectionRange(iStart, iLength);
|
||||
}
|
||||
}
|
||||
|
||||
//set focus back to the textbox
|
||||
this.textbox.focus();
|
||||
};
|
||||
this.textbox.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the suggestion layer contents, moves it into position,
|
||||
@ -302,16 +302,16 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
* @param aSuggestions An array of suggestions for the control.
|
||||
*/
|
||||
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
|
||||
|
||||
|
||||
var oDiv = null;
|
||||
this.layer.innerHTML = ""; //clear contents of the layer
|
||||
|
||||
|
||||
for (var i=0; i < aSuggestions.length; i++) {
|
||||
oDiv = document.createElement("div");
|
||||
oDiv.appendChild(document.createTextNode(aSuggestions[i]));
|
||||
this.layer.appendChild(oDiv);
|
||||
}
|
||||
|
||||
|
||||
this.layer.style.left = this.getLeft() + "px";
|
||||
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
|
||||
this.layer.style.visibility = "visible";
|
||||
@ -319,7 +319,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* suggested part of the text.
|
||||
* @scope private
|
||||
* @param sSuggestion The suggestion for the textbox.
|
||||
@ -328,9 +328,8 @@ AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
|
||||
|
||||
//check for support of typeahead functionality
|
||||
if (this.textbox.createTextRange || this.textbox.setSelectionRange){
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
this.selectRange(iLen, sSuggestion.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -3,4 +3,4 @@ function kH(e) {
|
||||
return pK != 13;
|
||||
}
|
||||
document.onkeypress = kH;
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
|
||||
@ -34,4 +34,4 @@ window.onload = function () {
|
||||
var oTextbox3 = new AutoSuggestControl(document.getElementById("dstendport_cust"), new StateSuggestions(customarray));
|
||||
};
|
||||
|
||||
//]]>
|
||||
//]]>
|
||||
|
||||
@ -9,7 +9,7 @@ function StateSuggestions(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* @scope protected
|
||||
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*
|
||||
bTypeAhead /*:boolean*/) {
|
||||
var aSuggestions = [];
|
||||
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
||||
|
||||
|
||||
if (sTextboxValue.length > 0){
|
||||
|
||||
|
||||
//search for matching states
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
|
||||
aSuggestions.push(this.states[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ var AjaxQueue = {
|
||||
if(this.currentRequest == null && this.urlQueue.length > 0) // Check if the currently processing request count is less than batch size
|
||||
{
|
||||
// Call jQuery.ajax on the first item in the queue and remove it from the queue
|
||||
AjaxQueue.currentRequest = jQuery.ajax(AjaxQueue.urlQueue.shift(), AjaxQueue.optionsQueue.shift());
|
||||
AjaxQueue.currentRequest = jQuery.ajax(AjaxQueue.urlQueue.shift(), AjaxQueue.optionsQueue.shift());
|
||||
AjaxQueue.currentRequest.complete( function() {
|
||||
//Call AjaxQueue._processNext on completion ( success / failure) of this AJAX request.
|
||||
AjaxQueue.currentRequest = null;
|
||||
@ -40,4 +40,3 @@ var AjaxQueue = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@ function updateMeters() {
|
||||
setTimer();
|
||||
}
|
||||
|
||||
function setTimer() {
|
||||
timeout = window.setTimeout('updateMeters()', update_interval);
|
||||
function setTimer() {
|
||||
timeout = window.setTimeout('updateMeters()', update_interval);
|
||||
}
|
||||
|
||||
function stats(x) {
|
||||
@ -131,7 +131,7 @@ function updateInterfaceStats(x){
|
||||
for (var y=0; y<statistics_split.length-1; y++){
|
||||
if(jQuery('#stat' + counter)) {
|
||||
jQuery('#stat' + counter).html(statistics_split[y]);
|
||||
counter++;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,4 +200,3 @@ function widgetActive(x) {
|
||||
jQuery(document).ready(function(){
|
||||
setTimer();
|
||||
});
|
||||
|
||||
|
||||
@ -66,10 +66,10 @@ function show_hide_linkfields(options){
|
||||
subnet = "#subnet" + count;
|
||||
gateway = "#gateway" + count;
|
||||
gatewaylabel = "#gatewaylabel" + count;
|
||||
|
||||
|
||||
jQuery(ipfields + ',' + gwfields + ',' + link).hide();
|
||||
jQuery(subnet).prop('disabled',true);
|
||||
|
||||
|
||||
jQuery(bw).attr("name","bandwidth[]");
|
||||
jQuery(mtu).attr("name","mtu[]");
|
||||
jQuery(mru).attr("name","mru[]");
|
||||
@ -77,7 +77,7 @@ function show_hide_linkfields(options){
|
||||
jQuery(localip).attr("name","localip[]");
|
||||
jQuery(subnet).attr("name","subnet[]");
|
||||
jQuery(gateway).attr("name","gateway[]");
|
||||
|
||||
|
||||
while(i < options.length){
|
||||
if (options[i].selected ){
|
||||
jQuery(lnklabel).html("Link Parameters (" + options[i].value + ")");
|
||||
@ -149,11 +149,11 @@ function updateType(t){
|
||||
}
|
||||
|
||||
function show_reset_settings(reset_type) {
|
||||
if (reset_type == 'preset') {
|
||||
if (reset_type == 'preset') {
|
||||
jQuery('#pppoepresetwrap').show(0);
|
||||
jQuery('#pppoecustomwrap').hide(0);
|
||||
}
|
||||
else if (reset_type == 'custom') {
|
||||
}
|
||||
else if (reset_type == 'custom') {
|
||||
jQuery('#pppoecustomwrap').show(0);
|
||||
jQuery('#pppoepresetwrap').hide(0);
|
||||
} else {
|
||||
@ -167,7 +167,7 @@ function country_list() {
|
||||
jQuery('#provider option').remove();
|
||||
jQuery('#providerplan option').remove();
|
||||
jQuery('#country').append(new Option('', ''));
|
||||
|
||||
|
||||
jQuery.ajax("getserviceproviders.php",{
|
||||
success: function(responseText) {
|
||||
var responseTextArr = responseText.split("\n");
|
||||
@ -186,7 +186,7 @@ function country_list() {
|
||||
}
|
||||
});
|
||||
jQuery('#trcountry').css("display","table-row");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function providers_list() {
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
* By: Trent Richardson [http://trentrichardson.com]
|
||||
* Version 0.9.9
|
||||
* Last Modified: 02/05/2012
|
||||
*
|
||||
*
|
||||
* Copyright 2012 Trent Richardson
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
|
||||
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
|
||||
*
|
||||
*
|
||||
* HERES THE CSS:
|
||||
* .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
|
||||
* .ui-timepicker-div dl { text-align: left; }
|
||||
@ -133,7 +133,7 @@ $.extend(Timepicker.prototype, {
|
||||
_newInst: function($input, o) {
|
||||
var tp_inst = new Timepicker(),
|
||||
inlineSettings = {};
|
||||
|
||||
|
||||
for (var attrName in this._defaults) {
|
||||
var attrValue = $input.attr('time:' + attrName);
|
||||
if (attrValue) {
|
||||
@ -188,7 +188,7 @@ $.extend(Timepicker.prototype, {
|
||||
tp_inst.$altInput = $(o.altField)
|
||||
.css({ cursor: 'pointer' })
|
||||
.focus(function(){ $input.trigger("focus"); });
|
||||
|
||||
|
||||
if(tp_inst._defaults.minDate==0 || tp_inst._defaults.minDateTime==0)
|
||||
{
|
||||
tp_inst._defaults.minDate=new Date();
|
||||
@ -197,7 +197,7 @@ $.extend(Timepicker.prototype, {
|
||||
{
|
||||
tp_inst._defaults.maxDate=new Date();
|
||||
}
|
||||
|
||||
|
||||
// datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
|
||||
if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
|
||||
tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
|
||||
@ -215,7 +215,7 @@ $.extend(Timepicker.prototype, {
|
||||
//########################################################################
|
||||
_addTimePicker: function(dp_inst) {
|
||||
var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
|
||||
this.$input.val() + ' ' + this.$altInput.val() :
|
||||
this.$input.val() + ' ' + this.$altInput.val() :
|
||||
this.$input.val();
|
||||
|
||||
this.timeDefined = this._parseTime(currDT);
|
||||
@ -249,7 +249,7 @@ $.extend(Timepicker.prototype, {
|
||||
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
|
||||
regstr = '^.{' + dp_dateFormat.length + ',}?' + this._defaults.separator.replace(specials, "\\$&") + regstr;
|
||||
}
|
||||
|
||||
|
||||
treg = timeString.match(new RegExp(regstr, 'i'));
|
||||
|
||||
if (treg) {
|
||||
@ -297,7 +297,7 @@ $.extend(Timepicker.prototype, {
|
||||
}
|
||||
this.timezone = tz;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -366,7 +366,7 @@ $.extend(Timepicker.prototype, {
|
||||
millisecGridSize = 0,
|
||||
size;
|
||||
|
||||
// Hours
|
||||
// Hours
|
||||
html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
|
||||
((o.showHour) ? '' : noDisplay) + '></div>';
|
||||
if (o.showHour && o.hourGrid > 0) {
|
||||
@ -472,7 +472,7 @@ $.extend(Timepicker.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Updated by Peter Medeiros:
|
||||
// - Pass in Event and UI instance into slide function
|
||||
this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
|
||||
@ -634,7 +634,7 @@ $.extend(Timepicker.prototype, {
|
||||
this.minute_slider.bind('slidestop',onSelectDelegate);
|
||||
this.second_slider.bind('slidestop',onSelectDelegate);
|
||||
this.millisec_slider.bind('slidestop',onSelectDelegate);
|
||||
|
||||
|
||||
// slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
|
||||
if (this._defaults.addSliderAccess){
|
||||
var sliderAccessArgs = this._defaults.sliderAccessArgs;
|
||||
@ -651,7 +651,7 @@ $.extend(Timepicker.prototype, {
|
||||
oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
|
||||
newWidth = oldWidth - sliderAccessWidth,
|
||||
newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
|
||||
|
||||
|
||||
$g.css({ width: newWidth, marginLeft: newMarginLeft });
|
||||
});
|
||||
}
|
||||
@ -659,7 +659,7 @@ $.extend(Timepicker.prototype, {
|
||||
},0);
|
||||
}
|
||||
// end slideAccess integration
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -770,7 +770,7 @@ $.extend(Timepicker.prototype, {
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
//########################################################################
|
||||
// when a slider moves, set the internal time...
|
||||
// on time change is also called when the time is updated in the text field
|
||||
@ -803,7 +803,7 @@ $.extend(Timepicker.prototype, {
|
||||
|| (this.ampm.length > 0
|
||||
&& (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
|
||||
|| timezone != this.timezone);
|
||||
|
||||
|
||||
if (hasChanged) {
|
||||
|
||||
if (hour !== false)this.hour = hour;
|
||||
@ -811,22 +811,22 @@ $.extend(Timepicker.prototype, {
|
||||
if (second !== false) this.second = second;
|
||||
if (millisec !== false) this.millisec = millisec;
|
||||
if (timezone !== false) this.timezone = timezone;
|
||||
|
||||
|
||||
if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
|
||||
|
||||
|
||||
this._limitMinMaxDateTime(this.inst, true);
|
||||
}
|
||||
if (o.ampm) this.ampm = ampm;
|
||||
|
||||
|
||||
//this._formatTime();
|
||||
this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
|
||||
if (this.$timeObj) this.$timeObj.text(this.formattedTime + o.timeSuffix);
|
||||
this.timeDefined = true;
|
||||
if (hasChanged) this._updateDateTime();
|
||||
},
|
||||
|
||||
|
||||
//########################################################################
|
||||
// call custom onSelect.
|
||||
// call custom onSelect.
|
||||
// bind to sliders slidestop, and grid click.
|
||||
//########################################################################
|
||||
_onSelectHandler: function() {
|
||||
@ -845,7 +845,7 @@ $.extend(Timepicker.prototype, {
|
||||
var tmptime = (format || this._defaults.timeFormat).toString();
|
||||
|
||||
tmptime = $.datepicker.formatTime(tmptime, time, this._defaults);
|
||||
|
||||
|
||||
if (arguments.length) return tmptime;
|
||||
else this.formattedTime = tmptime;
|
||||
},
|
||||
@ -883,7 +883,7 @@ $.extend(Timepicker.prototype, {
|
||||
} else {
|
||||
this.$input.val(formattedDateTime);
|
||||
}
|
||||
|
||||
|
||||
this.$input.trigger("change");
|
||||
}
|
||||
|
||||
@ -913,9 +913,9 @@ $.fn.extend({
|
||||
tmp_args = arguments;
|
||||
|
||||
if (typeof(o) == 'string'){
|
||||
if(o == 'getDate')
|
||||
if(o == 'getDate')
|
||||
return $.fn.datepicker.apply($(this[0]), tmp_args);
|
||||
else
|
||||
else
|
||||
return this.each(function() {
|
||||
var $t = $(this);
|
||||
$t.datepicker.apply($t, tmp_args);
|
||||
@ -930,7 +930,7 @@ $.fn.extend({
|
||||
});
|
||||
|
||||
//########################################################################
|
||||
// format the time all pretty...
|
||||
// format the time all pretty...
|
||||
// format = string format of the time
|
||||
// time = a {}, not a Date() for timezones
|
||||
// options = essentially the regional[].. amNames, pmNames, ampm
|
||||
@ -939,7 +939,7 @@ $.datepicker.formatTime = function(format, time, options) {
|
||||
options = options || {};
|
||||
options = $.extend($.timepicker._defaults, options);
|
||||
time = $.extend({hour:0, minute:0, second:0, millisec:0, timezone:'+0000'}, time);
|
||||
|
||||
|
||||
var tmptime = format;
|
||||
var ampmName = options['amNames'][0];
|
||||
|
||||
@ -1015,9 +1015,9 @@ $.datepicker._updateDatepicker = function(inst) {
|
||||
}
|
||||
|
||||
if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
|
||||
|
||||
|
||||
this._base_updateDatepicker(inst);
|
||||
|
||||
|
||||
// Reload the time control when changing something in the input text field.
|
||||
var tp_inst = this._get(inst, 'timepicker');
|
||||
if(tp_inst) tp_inst._addTimePicker(inst);
|
||||
@ -1055,7 +1055,7 @@ $.datepicker._doKeyPress = function(event) {
|
||||
return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $.datepicker._base_doKeyPress(event);
|
||||
};
|
||||
|
||||
@ -1102,7 +1102,7 @@ $.datepicker._gotoToday = function(id) {
|
||||
tp_inst.timezone_select.val(tzoffset);
|
||||
}
|
||||
this._setTime(inst, now);
|
||||
$( '.ui-datepicker-today', $dp).click();
|
||||
$( '.ui-datepicker-today', $dp).click();
|
||||
};
|
||||
|
||||
//#######################################################################################
|
||||
@ -1252,7 +1252,7 @@ $.datepicker._formatDate = function(inst, day, month, year){
|
||||
{
|
||||
if(day)
|
||||
var b = this._base_formatDate(inst, day, month, year);
|
||||
tp_inst._updateDateTime(inst);
|
||||
tp_inst._updateDateTime(inst);
|
||||
return tp_inst.$input.val();
|
||||
}
|
||||
return this._base_formatDate(inst);
|
||||
@ -1289,7 +1289,7 @@ $.datepicker._optionDatepicker = function(target, name, value) {
|
||||
min=new Date();
|
||||
else
|
||||
min= new Date(min);
|
||||
|
||||
|
||||
tp_inst._defaults.minDate = min;
|
||||
tp_inst._defaults.minDateTime = min;
|
||||
} else if (max){ //if max was set
|
||||
@ -1323,4 +1323,3 @@ $.timepicker = new Timepicker(); // singleton instance
|
||||
$.timepicker.version = "0.9.9";
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ if (!Array.prototype.some) {
|
||||
was_ipv4 = is_ipv4;
|
||||
is_ipv4 = /\./.test(input1.value) && !/\:/.test(input1.value);
|
||||
// handle state transitions to gracefully change the
|
||||
// value in the dropdown.
|
||||
// value in the dropdown.
|
||||
var bits = parseInt($(input2).val(), 10);
|
||||
if (was_ipv4 === false && is_ipv4 === true) {
|
||||
restrict_bits_to_ipv4();
|
||||
@ -137,4 +137,3 @@ if (!Array.prototype.some) {
|
||||
$(document).ipv4v6ify();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ function addOption(theSel, theText, theValue)
|
||||
}
|
||||
|
||||
function deleteOption(theSel, theIndex)
|
||||
{
|
||||
{
|
||||
var selLength = theSel.length;
|
||||
if(selLength>0)
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@ function copyOption(theSrc, theDst)
|
||||
}
|
||||
|
||||
function deleteOption(theSel)
|
||||
{
|
||||
{
|
||||
var theIndex = theSel.selectedIndex;
|
||||
var selLength = theSel.length;
|
||||
if(selLength>0)
|
||||
@ -53,4 +53,3 @@ function AllOptions(el, selectAll) {
|
||||
opt.selected = selectAll;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ if(!el.passed){
|
||||
}
|
||||
el.passed=true;
|
||||
}
|
||||
|
||||
|
||||
function AddTop(el,bk,color,bc,cn){
|
||||
var i,lim=4,d=CreateEl("b");
|
||||
|
||||
@ -171,4 +171,4 @@ for(i=0;i<3;i++){
|
||||
r[i]=Math.floor((x*50+y*50)/100);
|
||||
}
|
||||
return("#"+r[0].toString(16)+r[1].toString(16)+r[2].toString(16));
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,4 +284,4 @@ incremetalInputController = {
|
||||
// Close and call anonymous function
|
||||
})();
|
||||
|
||||
addEvent(window, 'load', incremetalInputController.constructor, true);
|
||||
addEvent(window, 'load', incremetalInputController.constructor, true);
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
(function(_scope){
|
||||
|
||||
|
||||
/*
|
||||
* pi.js
|
||||
* 1.0
|
||||
* Azer Koçulu <http://azer.kodfabrik.com>
|
||||
* http://pi-js.googlecode.com
|
||||
*/
|
||||
|
||||
|
||||
_scope.pi = Object(3.14159265358979323846);
|
||||
var pi = _scope.pi;
|
||||
pi.version = 1.0;
|
||||
|
||||
|
||||
pi.env = {
|
||||
ie: /MSIE/i.test(navigator.userAgent),
|
||||
ie6: /MSIE 6/i.test(navigator.userAgent),
|
||||
@ -20,7 +20,7 @@
|
||||
opera: /Opera/i.test(navigator.userAgent),
|
||||
webkit: /Webkit/i.test(navigator.userAgent)
|
||||
};
|
||||
|
||||
|
||||
pi.util = {
|
||||
IsArray:function(_object){
|
||||
return _object && _object != window && ( _object instanceof Array || ( typeof _object.length == "number" && typeof _object.item =="function" ) );
|
||||
@ -67,7 +67,7 @@
|
||||
removeClass:function(_element,_class){
|
||||
if( pi.util.Element.hasClass(_element,_class) )
|
||||
pi.util.Element.setClass(
|
||||
_element,
|
||||
_element,
|
||||
pi.util.Element.getClass(_element,_class).split(" ").removeValue(_class).join(" ")
|
||||
);
|
||||
},
|
||||
@ -84,7 +84,7 @@
|
||||
var styleObject = _styleObject;
|
||||
if(!pi.env.ie)
|
||||
return styleObject["opacity"];
|
||||
|
||||
|
||||
var alpha = styleObject["filter"].match(/opacity\=(\d+)/i);
|
||||
return alpha?alpha[1]/100:1;
|
||||
},
|
||||
@ -173,7 +173,7 @@
|
||||
else
|
||||
value = _source[key].clone();
|
||||
}
|
||||
else
|
||||
else
|
||||
if (pi.util.IsHash(_source[key])) {
|
||||
if (pi.util.IsHash(_object[key])) {
|
||||
value = pi.util.MergeObjects(_object[key], _source[key]);
|
||||
@ -186,7 +186,7 @@
|
||||
return _object;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
pi.get = function(){
|
||||
return document.getElementById(arguments[0]);
|
||||
};
|
||||
@ -194,23 +194,23 @@
|
||||
return document.getElementsByTagName(arguments[0]);
|
||||
};
|
||||
pi.get.byClass = function(){ return document.getElementsByClassName.apply(document,arguments); };
|
||||
|
||||
|
||||
pi.base = function(){
|
||||
this.body = {};
|
||||
this.constructor = null;
|
||||
|
||||
|
||||
this.build = function(_skipClonning){
|
||||
var base = this, skipClonning = _skipClonning||false, _private = {},
|
||||
fn = function(){
|
||||
var _p = pi.util.CloneObject(_private);
|
||||
if(!skipClonning){
|
||||
for(var key in this){
|
||||
|
||||
|
||||
if(pi.util.IsArray( this[ key ] ) ){
|
||||
this[key] = Array.prototype.clone.apply( this[key] );
|
||||
} else
|
||||
if( pi.util.IsHash(this[key]) ){
|
||||
this[key] = pi.util.CloneObject(
|
||||
this[key] = pi.util.CloneObject(
|
||||
this[ key ],
|
||||
function(_key,_object){
|
||||
this[ _key ]._parent_ = this;
|
||||
@ -232,35 +232,35 @@
|
||||
fn.prototype = this.body;
|
||||
return fn;
|
||||
};
|
||||
|
||||
|
||||
this.createAccessors = function(_p, _branch){
|
||||
var getter = function(_property){ return this[_property]; },
|
||||
setter = function(_property,_value){ this[_property] = _value; return _branch._parent_||_branch; };
|
||||
|
||||
|
||||
for (var name in _p) {
|
||||
var isPrivate = name.substring(0, 1) == "_", title = name.substring(1, 2).toUpperCase() + name.substring(2);
|
||||
if (isPrivate) {
|
||||
_branch["get" + title] = getter.curry(_p,name);
|
||||
_branch["set" + title] = setter.curry(_p,name);
|
||||
}
|
||||
else
|
||||
else
|
||||
if (pi.util.IsHash(_p[name])){
|
||||
if(!_branch[name])
|
||||
_branch[name] = {};
|
||||
this.createAccessors(_p[name], _branch[name]);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
this.movePrivateMembers = function(_object, _branch){
|
||||
for (var name in _object) {
|
||||
var isPrivate = name.substring(0, 1) == "_";
|
||||
|
||||
|
||||
if (isPrivate) {
|
||||
_branch[name] = _object[name];
|
||||
delete _object[name];
|
||||
}
|
||||
else
|
||||
else
|
||||
if (pi.util.IsHash(_object[name])){
|
||||
_branch[name] = {};
|
||||
this.movePrivateMembers(_object[name], _branch[name]);
|
||||
@ -268,30 +268,30 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Function.prototype.extend = function(_prototype,_skipClonning){
|
||||
var object = new pi.base, superClass = this;
|
||||
if(_prototype["$Constructor"]){
|
||||
object.constructor = _prototype["$Constructor"];
|
||||
delete _prototype["$Constructor"];
|
||||
};
|
||||
|
||||
|
||||
object.body = superClass==pi.base?_prototype:pi.util.MergeObjects(_prototype,superClass.prototype,2);
|
||||
object.constructor=object.constructor||function(){
|
||||
if(superClass!=pi.base)
|
||||
superClass.apply(this,arguments);
|
||||
};
|
||||
|
||||
|
||||
return object.build(_skipClonning);
|
||||
};
|
||||
|
||||
|
||||
Function.prototype.curry = function(_scope){
|
||||
var fn = this, scope = _scope||window, args = Array.prototype.slice.call(arguments,1);
|
||||
return function(){
|
||||
return fn.apply(scope,args.concat( Array.prototype.slice.call(arguments,0) ));
|
||||
return function(){
|
||||
return fn.apply(scope,args.concat( Array.prototype.slice.call(arguments,0) ));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
pi.element = pi.base.extend({
|
||||
"$Constructor":function(_tag){
|
||||
this.environment.setElement(document.createElement(_tag||"DIV"));
|
||||
@ -460,7 +460,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pi.xhr = new pi.base;
|
||||
pi.xhr.constructor = function(){
|
||||
var api;
|
||||
@ -483,16 +483,16 @@
|
||||
this.environment.getApi().abort();
|
||||
},
|
||||
"send":function(){
|
||||
var url = this.environment.getUrl(), data = this.environment.getData(),dataUrl = "";
|
||||
var url = this.environment.getUrl(), data = this.environment.getData(),dataUrl = "";
|
||||
|
||||
for (var key in data)
|
||||
dataUrl += "{0}={1}&".format(key, data[key]);
|
||||
|
||||
|
||||
if (this.environment.getType()=="GET")
|
||||
url += (url.search("\\?")==-1?"?":"&")+"{0}".format(dataUrl);
|
||||
|
||||
|
||||
this.environment.getApi().open(this.environment.getType(),url,this.environment.getAsync());
|
||||
|
||||
|
||||
for(var key in this.environment.getHeader())
|
||||
this.environment.getApi().setRequestHeader(key,this.environment.getHeader()[key]);
|
||||
|
||||
@ -535,11 +535,11 @@
|
||||
}
|
||||
};
|
||||
pi.xhr = pi.xhr.build();
|
||||
|
||||
|
||||
/*
|
||||
* xml.xhr.get
|
||||
*/
|
||||
|
||||
|
||||
pi.xhr.get = function(_url,_returnPiObject){
|
||||
var request = new pi.xhr();
|
||||
request.environment.setAsync(false);
|
||||
@ -547,26 +547,26 @@
|
||||
request.send();
|
||||
return _returnPiObject?request:request.environment.getApi();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* pi.xpath
|
||||
*/
|
||||
|
||||
|
||||
pi.xpath = function(_expression,_resultType,_contextNode,_namespaceResolver,_result){
|
||||
var contextNode = _contextNode||document,
|
||||
var contextNode = _contextNode||document,
|
||||
expression = _expression||"",
|
||||
namespaceResolver = _namespaceResolver||null,
|
||||
namespaceResolver = _namespaceResolver||null,
|
||||
result=_result||null,
|
||||
resultType=_resultType||"ANY_TYPE";
|
||||
return document.evaluate(expression, contextNode, namespaceResolver, XPathResult[resultType], result);
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.clone = function(){
|
||||
var tmp = [];
|
||||
Array.prototype.push.apply(tmp,this);
|
||||
tmp.forEach(function(item,index,object){
|
||||
if(item instanceof Array)
|
||||
object[index] = object[index].clone();
|
||||
object[index] = object[index].clone();
|
||||
});
|
||||
return tmp;
|
||||
};
|
||||
@ -577,16 +577,16 @@
|
||||
});
|
||||
return count;
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.forEach = Array.prototype.forEach||function(_function){
|
||||
for(var i=0; i<this.length; i++)
|
||||
_function.apply(this,[this[i],i,this]);
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.getLastItem = function(){
|
||||
return this[this.length-1];
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.indexOf = Array.prototype.indexOf||function(_value){
|
||||
var index = -1;
|
||||
for(var i=0; i<this.length; i++)
|
||||
@ -596,13 +596,13 @@
|
||||
}
|
||||
return index;
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.remove = function(_index){
|
||||
var array = this.slice(0,_index);
|
||||
Array.prototype.push.apply(array,this.slice(_index+1));
|
||||
return array;
|
||||
};
|
||||
|
||||
|
||||
Array.prototype.removeValue = function(_value){
|
||||
return this.remove(this.indexOf(_value));
|
||||
};
|
||||
@ -627,9 +627,9 @@
|
||||
};
|
||||
Number.prototype.range = function(_pattern){
|
||||
for(
|
||||
var value = String(this), isFloat = /\./i.test(value),
|
||||
i = isFloat.toggle(parseInt(value.split(".")[0]),0),
|
||||
end = parseInt(value.split(".")[isFloat.toggle(1,0)]),
|
||||
var value = String(this), isFloat = /\./i.test(value),
|
||||
i = isFloat.toggle(parseInt(value.split(".")[0]),0),
|
||||
end = parseInt(value.split(".")[isFloat.toggle(1,0)]),
|
||||
array = []; i<end; i++
|
||||
){
|
||||
array.push(
|
||||
@ -649,7 +649,7 @@
|
||||
return values[arguments[1]];
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
String.prototype.leftpad = function(_len,_ch){
|
||||
var str=this;
|
||||
var ch = Boolean(_ch)==false?" ":_ch;
|
||||
@ -657,18 +657,18 @@
|
||||
str=ch+str;
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
String.prototype.toggle = function(_value,_other){
|
||||
return this==_value?_value:_other;
|
||||
};
|
||||
|
||||
|
||||
String.prototype.unicode = function(){
|
||||
var str="", obj = this.split("");
|
||||
for(var i=obj.length-1; i>=0; i--)
|
||||
str="\\u{0}{1}".format(String(obj[i].charCodeAt(0).base(16)).leftpad(4,"0"),str);
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
pi.util.AddEvent(
|
||||
pi.env.ie?window:document,
|
||||
pi.env.ie?"load":"DOMContentLoaded",
|
||||
@ -678,5 +678,5 @@
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
})(window);
|
||||
|
||||
})(window);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
// Global Variables
|
||||
var rowname = new Array(99);
|
||||
var rowtype = new Array(99);
|
||||
var newrow = new Array(99);
|
||||
var rowsize = new Array(99);
|
||||
var newrow = new Array(99);
|
||||
var rowsize = new Array(99);
|
||||
|
||||
// Global variables. Set to javascript code
|
||||
// that will be eval() after change, add & delete.
|
||||
var rowhelper_onChange = '';
|
||||
var rowhelper_onChange = '';
|
||||
var rowhelper_onAdd = '';
|
||||
var rowhelper_onDelete = '';
|
||||
|
||||
@ -63,7 +63,7 @@ var addRowTo = (function() {
|
||||
td.innerHTML = '<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/' + theme + '/images/icons/icon_x.gif" /></a>';
|
||||
tr.appendChild(td);
|
||||
tbody.appendChild(tr);
|
||||
if(rowhelper_onAdd != '')
|
||||
if(rowhelper_onAdd != '')
|
||||
eval(rowhelper_onAdd);
|
||||
if($(tr).ipv4v6ify)
|
||||
$(tr).ipv4v6ify();
|
||||
@ -79,7 +79,7 @@ function removeRow(el) {
|
||||
cel = el.getElementsByTagName("td").item(0);
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
if(rowhelper_onDelete != '')
|
||||
if(rowhelper_onDelete != '')
|
||||
eval(rowhelper_onDelete);
|
||||
}
|
||||
|
||||
|
||||
@ -36,9 +36,9 @@ function fr_insline(id, on, prefix) {
|
||||
prevrow = document.getElementById(prefix + 'header');
|
||||
}
|
||||
|
||||
var cells = row.getElementsByTagName("td");
|
||||
var cells = row.getElementsByTagName("td");
|
||||
var prevcells = prevrow.getElementsByTagName("td");
|
||||
|
||||
|
||||
for (i = 0; i <= prevcells.length - 1; i++) {
|
||||
if (prevcells[i].id == prefix + 'd' + (id-1)) {
|
||||
if (on) {
|
||||
|
||||
@ -133,4 +133,4 @@ var Builder = {
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
2
src/www/javascript/scriptaculous/controls.js
vendored
2
src/www/javascript/scriptaculous/controls.js
vendored
@ -962,4 +962,4 @@ Form.Element.DelayedObserver = Class.create({
|
||||
this.timer = null;
|
||||
this.callback(this.element, $F(this.element));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
2
src/www/javascript/scriptaculous/dragdrop.js
vendored
2
src/www/javascript/scriptaculous/dragdrop.js
vendored
@ -971,4 +971,4 @@ Element.findChildren = function(element, only, recursive, tagName) {
|
||||
|
||||
Element.offsetSize = function (element, type) {
|
||||
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
|
||||
};
|
||||
};
|
||||
|
||||
4
src/www/javascript/scriptaculous/effects.js
vendored
4
src/www/javascript/scriptaculous/effects.js
vendored
@ -150,7 +150,7 @@ var Effect = {
|
||||
toggle: function(element, effect, options) {
|
||||
element = $(element);
|
||||
effect = (effect || 'appear').toLowerCase();
|
||||
|
||||
|
||||
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
|
||||
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
|
||||
}, options || {}));
|
||||
@ -1120,4 +1120,4 @@ $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTex
|
||||
function(f) { Effect.Methods[f] = Element[f]; }
|
||||
);
|
||||
|
||||
Element.addMethods(Effect.Methods);
|
||||
Element.addMethods(Effect.Methods);
|
||||
|
||||
@ -65,4 +65,4 @@ var Scriptaculous = {
|
||||
}
|
||||
};
|
||||
|
||||
Scriptaculous.load();
|
||||
Scriptaculous.load();
|
||||
|
||||
@ -272,4 +272,4 @@ Control.Slider = Class.create({
|
||||
this.options.onChange(this.values.length>1 ? this.values : this.value, this);
|
||||
this.event = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -56,4 +56,4 @@ if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
|
||||
Sound.template = new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');
|
||||
else
|
||||
Sound.play = function(){};
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,10 +19,10 @@ Event.simulateMouse = function(element, eventName) {
|
||||
metaKey: false
|
||||
}, arguments[2] || {});
|
||||
var oEvent = document.createEvent("MouseEvents");
|
||||
oEvent.initMouseEvent(eventName, true, true, document.defaultView,
|
||||
options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
||||
oEvent.initMouseEvent(eventName, true, true, document.defaultView,
|
||||
options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
||||
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element));
|
||||
|
||||
|
||||
if(this.mark) Element.remove(this.mark);
|
||||
this.mark = document.createElement('div');
|
||||
this.mark.appendChild(document.createTextNode(" "));
|
||||
@ -34,10 +34,10 @@ Event.simulateMouse = function(element, eventName) {
|
||||
this.mark.style.height = "5px;";
|
||||
this.mark.style.borderTop = "1px solid red;";
|
||||
this.mark.style.borderLeft = "1px solid red;";
|
||||
|
||||
|
||||
if(this.step)
|
||||
alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
|
||||
|
||||
|
||||
$(element).dispatchEvent(oEvent);
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@ Event.simulateKey = function(element, eventName) {
|
||||
}, arguments[2] || {});
|
||||
|
||||
var oEvent = document.createEvent("KeyEvents");
|
||||
oEvent.initKeyEvent(eventName, true, true, window,
|
||||
oEvent.initKeyEvent(eventName, true, true, window,
|
||||
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
|
||||
options.keyCode, options.charCode );
|
||||
$(element).dispatchEvent(oEvent);
|
||||
@ -123,7 +123,7 @@ Test.Unit.Logger.prototype = {
|
||||
_toHTML: function(txt) {
|
||||
return txt.escapeHTML().replace(/\n/g,"<br />");
|
||||
},
|
||||
addLinksToResults: function(){
|
||||
addLinksToResults: function(){
|
||||
$$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
|
||||
td.title = "Run only this test";
|
||||
Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
|
||||
@ -162,7 +162,7 @@ Test.Unit.Runner.prototype = {
|
||||
if(/^test/.test(testcase)) {
|
||||
this.tests.push(
|
||||
new Test.Unit.Testcase(
|
||||
this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
|
||||
this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
|
||||
testcases[testcase], testcases["setup"], testcases["teardown"]
|
||||
));
|
||||
}
|
||||
@ -203,7 +203,7 @@ Test.Unit.Runner.prototype = {
|
||||
},
|
||||
postResults: function() {
|
||||
if (this.options.resultsURL) {
|
||||
new Ajax.Request(this.options.resultsURL,
|
||||
new Ajax.Request(this.options.resultsURL,
|
||||
{ method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
|
||||
}
|
||||
},
|
||||
@ -240,9 +240,9 @@ Test.Unit.Runner.prototype = {
|
||||
errors += this.tests[i].errors;
|
||||
}
|
||||
return (
|
||||
(this.options.context ? this.options.context + ': ': '') +
|
||||
this.tests.length + " tests, " +
|
||||
assertions + " assertions, " +
|
||||
(this.options.context ? this.options.context + ': ': '') +
|
||||
this.tests.length + " tests, " +
|
||||
assertions + " assertions, " +
|
||||
failures + " failures, " +
|
||||
errors + " errors");
|
||||
}
|
||||
@ -258,7 +258,7 @@ Test.Unit.Assertions.prototype = {
|
||||
},
|
||||
summary: function() {
|
||||
return (
|
||||
this.assertions + " assertions, " +
|
||||
this.assertions + " assertions, " +
|
||||
this.failures + " failures, " +
|
||||
this.errors + " errors" + "\n" +
|
||||
this.messages.join("\n"));
|
||||
@ -284,55 +284,55 @@ Test.Unit.Assertions.prototype = {
|
||||
},
|
||||
assert: function(expression) {
|
||||
var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
|
||||
try { expression ? this.pass() :
|
||||
try { expression ? this.pass() :
|
||||
this.fail(message); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertEqual: function(expected, actual) {
|
||||
var message = arguments[2] || "assertEqual";
|
||||
try { (expected == actual) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertInspect: function(expected, actual) {
|
||||
var message = arguments[2] || "assertInspect";
|
||||
try { (expected == actual.inspect()) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertEnumEqual: function(expected, actual) {
|
||||
var message = arguments[2] || "assertEnumEqual";
|
||||
try { $A(expected).length == $A(actual).length &&
|
||||
try { $A(expected).length == $A(actual).length &&
|
||||
expected.zip(actual).all(function(pair) { return pair[0] == pair[1]; }) ?
|
||||
this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) +
|
||||
this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) +
|
||||
', actual ' + Test.Unit.inspect(actual)); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertNotEqual: function(expected, actual) {
|
||||
var message = arguments[2] || "assertNotEqual";
|
||||
try { (expected != actual) ? this.pass() :
|
||||
try { (expected != actual) ? this.pass() :
|
||||
this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertIdentical: function(expected, actual) {
|
||||
var message = arguments[2] || "assertIdentical";
|
||||
try { (expected === actual) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
assertIdentical: function(expected, actual) {
|
||||
var message = arguments[2] || "assertIdentical";
|
||||
try { (expected === actual) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertNotIdentical: function(expected, actual) {
|
||||
var message = arguments[2] || "assertNotIdentical";
|
||||
try { !(expected === actual) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
assertNotIdentical: function(expected, actual) {
|
||||
var message = arguments[2] || "assertNotIdentical";
|
||||
try { !(expected === actual) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + Test.Unit.inspect(actual) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertNull: function(obj) {
|
||||
var message = arguments[1] || 'assertNull';
|
||||
try { (obj==null) ? this.pass() :
|
||||
try { (obj==null) ? this.pass() :
|
||||
this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
@ -353,38 +353,38 @@ Test.Unit.Assertions.prototype = {
|
||||
},
|
||||
assertType: function(expected, actual) {
|
||||
var message = arguments[2] || 'assertType';
|
||||
try {
|
||||
(actual.constructor == expected) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
try {
|
||||
(actual.constructor == expected) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + (actual.constructor) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertNotOfType: function(expected, actual) {
|
||||
var message = arguments[2] || 'assertNotOfType';
|
||||
try {
|
||||
(actual.constructor != expected) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
try {
|
||||
(actual.constructor != expected) ? this.pass() :
|
||||
this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
|
||||
'", actual "' + (actual.constructor) + '"'); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertInstanceOf: function(expected, actual) {
|
||||
var message = arguments[2] || 'assertInstanceOf';
|
||||
try {
|
||||
(actual instanceof expected) ? this.pass() :
|
||||
try {
|
||||
(actual instanceof expected) ? this.pass() :
|
||||
this.fail(message + ": object was not an instance of the expected type"); }
|
||||
catch(e) { this.error(e); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertNotInstanceOf: function(expected, actual) {
|
||||
var message = arguments[2] || 'assertNotInstanceOf';
|
||||
try {
|
||||
!(actual instanceof expected) ? this.pass() :
|
||||
try {
|
||||
!(actual instanceof expected) ? this.pass() :
|
||||
this.fail(message + ": object was an instance of the not expected type"); }
|
||||
catch(e) { this.error(e); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertRespondsTo: function(method, obj) {
|
||||
var message = arguments[2] || 'assertRespondsTo';
|
||||
try {
|
||||
(obj[method] && typeof obj[method] == 'function') ? this.pass() :
|
||||
(obj[method] && typeof obj[method] == 'function') ? this.pass() :
|
||||
this.fail(message + ": object doesn't respond to [" + method + "]"); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
@ -393,7 +393,7 @@ Test.Unit.Assertions.prototype = {
|
||||
try {
|
||||
var m = obj[method];
|
||||
if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
|
||||
m() ? this.pass() :
|
||||
m() ? this.pass() :
|
||||
this.fail(message + ": method returned false"); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
@ -402,17 +402,17 @@ Test.Unit.Assertions.prototype = {
|
||||
try {
|
||||
var m = obj[method];
|
||||
if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)];
|
||||
!m() ? this.pass() :
|
||||
!m() ? this.pass() :
|
||||
this.fail(message + ": method returned true"); }
|
||||
catch(e) { this.error(e); }
|
||||
},
|
||||
assertRaise: function(exceptionName, method) {
|
||||
var message = arguments[2] || 'assertRaise';
|
||||
try {
|
||||
try {
|
||||
method();
|
||||
this.fail(message + ": exception expected but none was raised"); }
|
||||
catch(e) {
|
||||
((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e);
|
||||
((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e);
|
||||
}
|
||||
},
|
||||
assertElementsMatch: function() {
|
||||
@ -434,7 +434,7 @@ Test.Unit.Assertions.prototype = {
|
||||
var startAt = new Date();
|
||||
(iterations || 1).times(operation);
|
||||
var timeTaken = ((new Date())-startAt);
|
||||
this.info((arguments[2] || 'Operation') + ' finished ' +
|
||||
this.info((arguments[2] || 'Operation') + ' finished ' +
|
||||
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
|
||||
return timeTaken;
|
||||
},
|
||||
@ -444,7 +444,7 @@ Test.Unit.Assertions.prototype = {
|
||||
this.assertNotNull(element);
|
||||
if(element.style && Element.getStyle(element, 'display') == 'none')
|
||||
return false;
|
||||
|
||||
|
||||
return this._isVisible(element.parentNode);
|
||||
},
|
||||
assertNotVisible: function(element) {
|
||||
@ -457,7 +457,7 @@ Test.Unit.Assertions.prototype = {
|
||||
var startAt = new Date();
|
||||
(iterations || 1).times(operation);
|
||||
var timeTaken = ((new Date())-startAt);
|
||||
this.info((arguments[2] || 'Operation') + ' finished ' +
|
||||
this.info((arguments[2] || 'Operation') + ' finished ' +
|
||||
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
|
||||
return timeTaken;
|
||||
}
|
||||
@ -468,7 +468,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p
|
||||
initialize: function(name, test, setup, teardown) {
|
||||
Test.Unit.Assertions.prototype.initialize.bind(this)();
|
||||
this.name = name;
|
||||
|
||||
|
||||
if(typeof test == 'string') {
|
||||
test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,');
|
||||
test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)');
|
||||
@ -478,7 +478,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p
|
||||
} else {
|
||||
this.test = test || function() {};
|
||||
}
|
||||
|
||||
|
||||
this.setup = setup || function() {};
|
||||
this.teardown = teardown || function() {};
|
||||
this.isWaiting = false;
|
||||
@ -519,23 +519,23 @@ Test.setupBDDExtensionMethods = function(){
|
||||
shouldNotBeAn: 'assertNotOfType',
|
||||
shouldBeNull: 'assertNull',
|
||||
shouldNotBeNull: 'assertNotNull',
|
||||
|
||||
|
||||
shouldBe: 'assertReturnsTrue',
|
||||
shouldNotBe: 'assertReturnsFalse',
|
||||
shouldRespondTo: 'assertRespondsTo'
|
||||
};
|
||||
var makeAssertion = function(assertion, args, object) {
|
||||
this[assertion].apply(this,(args || []).concat([object]));
|
||||
var makeAssertion = function(assertion, args, object) {
|
||||
this[assertion].apply(this,(args || []).concat([object]));
|
||||
};
|
||||
|
||||
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]); };
|
||||
|
||||
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); }
|
||||
);
|
||||
@ -543,7 +543,7 @@ Test.setupBDDExtensionMethods = function(){
|
||||
|
||||
Test.context = function(name, spec, log){
|
||||
Test.setupBDDExtensionMethods();
|
||||
|
||||
|
||||
var compiledSpec = {};
|
||||
var titles = {};
|
||||
for(specName in spec) {
|
||||
@ -557,7 +557,7 @@ Test.context = function(name, spec, log){
|
||||
var body = spec[specName].toString().split('\n').slice(1);
|
||||
if(/^\{/.test(body[0])) body = body.slice(1);
|
||||
body.pop();
|
||||
body = body.map(function(statement){
|
||||
body = body.map(function(statement){
|
||||
return statement.strip();
|
||||
});
|
||||
compiledSpec[testName] = body.join('\n');
|
||||
@ -565,4 +565,4 @@ Test.context = function(name, spec, log){
|
||||
}
|
||||
}
|
||||
new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name });
|
||||
};
|
||||
};
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
version 2
|
||||
7th April 2007
|
||||
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
|
||||
|
||||
|
||||
Instructions:
|
||||
Download this file
|
||||
Add <script src="sorttable.js"></script> to your HTML
|
||||
Add class="sortable" to any table you'd like to make sortable
|
||||
Click on the headers to sort
|
||||
|
||||
|
||||
Thanks to many, many people for contributions and suggestions.
|
||||
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
|
||||
This basically means: do what you want with it.
|
||||
@ -22,7 +22,7 @@
|
||||
2012-11-05 Allow sorting of IP:Port and *:port texts toghether also AAA_23 AAA_123 in 'numeric order' (used in Diagnostics\Sockets column LOCAL)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var stIsIE = /*@cc_on!@*/false;
|
||||
|
||||
sorttable = {
|
||||
@ -33,19 +33,19 @@ sorttable = {
|
||||
arguments.callee.done = true;
|
||||
// kill the timer
|
||||
if (_timer) clearInterval(_timer);
|
||||
|
||||
|
||||
if (!document.createElement || !document.getElementsByTagName) return;
|
||||
|
||||
|
||||
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
|
||||
|
||||
|
||||
forEach(document.getElementsByTagName('table'), function(table) {
|
||||
if (table.className.search(/\bsortable\b/) != -1) {
|
||||
sorttable.makeSortable(table);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
makeSortable: function(table) {
|
||||
if (table.getElementsByTagName('thead').length == 0) {
|
||||
// table doesn't have a tHead. Since it should have, create one and
|
||||
@ -56,12 +56,12 @@ sorttable = {
|
||||
}
|
||||
// Safari doesn't support table.tHead, sigh
|
||||
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
|
||||
|
||||
|
||||
headrow = undefined;
|
||||
if (table.tHead.rows.length == 1)
|
||||
headrow = table.tHead.rows[0].cells;
|
||||
else
|
||||
{
|
||||
{
|
||||
//if multiple rows are found one must be marked with class <tr class="sortableHeaderRowIdentifier">
|
||||
for (var i=0; i<table.tHead.rows.length; i++) {
|
||||
if (table.tHead.rows[i].className.search(/\bsortableHeaderRowIdentifier\b/) != -1)
|
||||
@ -73,12 +73,12 @@ sorttable = {
|
||||
}
|
||||
if (headrow == undefined)
|
||||
return;
|
||||
|
||||
|
||||
if (table.getAttribute("sortableMultirow") != undefined)
|
||||
sortableMultirow = parseInt(table.getAttribute("sortableMultirow"));
|
||||
else
|
||||
sortableMultirow = 1;
|
||||
|
||||
|
||||
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
|
||||
// "total" rows, for example). This is B&R, since what you're supposed
|
||||
// to do is put them in a tfoot. So, if there are sortbottom rows,
|
||||
@ -100,7 +100,7 @@ sorttable = {
|
||||
}
|
||||
delete sortbottomrows;
|
||||
}
|
||||
|
||||
|
||||
// work through each column and calculate its type
|
||||
for (var i=0; i<headrow.length; i++) {
|
||||
// manually override the type with a sorttable_type attribute
|
||||
@ -118,7 +118,7 @@ sorttable = {
|
||||
dean_addEvent(headrow[i],"click", function(e) {
|
||||
|
||||
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
|
||||
// if we're already sorted by this column, just
|
||||
// if we're already sorted by this column, just
|
||||
// reverse the table, which is quicker
|
||||
sorttable.reverse(this.sorttable_tbody, sortableMultirow);
|
||||
this.className = this.className.replace('sorttable_sorted',
|
||||
@ -131,7 +131,7 @@ sorttable = {
|
||||
return;
|
||||
}
|
||||
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
|
||||
// if we're already sorted by this column in reverse, just
|
||||
// if we're already sorted by this column in reverse, just
|
||||
// re-reverse the table, which is quicker
|
||||
sorttable.reverse(this.sorttable_tbody, sortableMultirow);
|
||||
this.className = this.className.replace('sorttable_sorted_reverse',
|
||||
@ -143,7 +143,7 @@ sorttable = {
|
||||
this.appendChild(sortfwdind);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// remove sorttable_sorted classes
|
||||
theadrow = this.parentNode;
|
||||
forEach(theadrow.childNodes, function(cell) {
|
||||
@ -156,7 +156,7 @@ sorttable = {
|
||||
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
|
||||
sortrevind = document.getElementById('sorttable_sortrevind');
|
||||
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
|
||||
|
||||
|
||||
this.className += ' sorttable_sorted';
|
||||
sortfwdind = document.createElement('span');
|
||||
sortfwdind.id = "sorttable_sortfwdind";
|
||||
@ -181,7 +181,7 @@ sorttable = {
|
||||
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
|
||||
/* and comment out this one */
|
||||
row_array.sort(this.sorttable_sortfunction);
|
||||
|
||||
|
||||
tb = this.sorttable_tbody;
|
||||
for (var j=0; j<row_array.length; j++) {
|
||||
for(var k=0; k<sortableMultirow; k++) {
|
||||
@ -194,26 +194,26 @@ sorttable = {
|
||||
tb.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete row_array;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
guessType: function(table, column, sortableMultirow) {
|
||||
// guess the type of a column based on its first non-blank row
|
||||
sortfn = sorttable.sort_alpha;
|
||||
for (var i=0; i<table.tBodies[0].rows.length; i+=sortableMultirow) {
|
||||
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
|
||||
if (text != '') {
|
||||
if (text.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:[0-9]{1,5})?\b/)) {
|
||||
return sorttable.sort_ipaddr;
|
||||
}
|
||||
if (text.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:[0-9]{1,5})?\b/)) {
|
||||
return sorttable.sort_ipaddr;
|
||||
}
|
||||
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
|
||||
return sorttable.sort_numeric;
|
||||
}
|
||||
// check for a date: dd/mm/yyyy or dd/mm/yy
|
||||
// check for a date: dd/mm/yyyy or dd/mm/yy
|
||||
// can have / or . or - as separator
|
||||
// can be mm/dd as well
|
||||
possdate = text.match(sorttable.DATE_RE);
|
||||
@ -236,17 +236,17 @@ sorttable = {
|
||||
}
|
||||
return sortfn;
|
||||
},
|
||||
|
||||
|
||||
getInnerText: function(node) {
|
||||
// gets the text we want to use for sorting for a cell.
|
||||
// strips leading and trailing whitespace.
|
||||
// this is *not* a generic getInnerText function; it's special to sorttable.
|
||||
// for example, you can override the cell text with a customkey attribute.
|
||||
// it also gets .value for <input> fields.
|
||||
|
||||
|
||||
hasInputs = (typeof node.getElementsByTagName == 'function') &&
|
||||
node.getElementsByTagName('input').length;
|
||||
|
||||
|
||||
if (node.getAttribute("sorttable_customkey") != null) {
|
||||
return node.getAttribute("sorttable_customkey");
|
||||
}
|
||||
@ -281,7 +281,7 @@ sorttable = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
reverse: function(tbody, sortableMultirow) {
|
||||
// reverse the rows in a tbody
|
||||
newrows = [];
|
||||
@ -296,14 +296,14 @@ sorttable = {
|
||||
}
|
||||
delete newrows;
|
||||
},
|
||||
|
||||
|
||||
/* sort functions
|
||||
each sort function takes two parameters, a and b
|
||||
you are comparing a[0] and b[0] */
|
||||
sort_numeric: function(a,b) {
|
||||
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
|
||||
if (isNaN(aa)) aa = 0;
|
||||
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
|
||||
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
|
||||
if (isNaN(bb)) bb = 0;
|
||||
return aa-bb;
|
||||
},
|
||||
@ -344,7 +344,7 @@ sorttable = {
|
||||
},
|
||||
sortWithNumber: function(a,b) {
|
||||
amatch = a[0].match(/.*?(?=[0-9])/);
|
||||
bmatch = b[0].match(/.*?(?=[0-9])/);
|
||||
bmatch = b[0].match(/.*?(?=[0-9])/);
|
||||
if (amatch && bmatch && amatch[0] == bmatch[0])
|
||||
{
|
||||
anumber = a[0].substring(amatch.length+1);
|
||||
@ -370,12 +370,12 @@ sorttable = {
|
||||
if (aip !== false || bip !== false)
|
||||
return aip === false ? -1 : 1;
|
||||
else
|
||||
{
|
||||
{
|
||||
return sorttable.sortWithNumber(a,b);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
shaker_sort: function(list, comp_func) {
|
||||
// A stable sort function to allow multi-level sorting of data
|
||||
// see: http://en.wikipedia.org/wiki/Cocktail_sort
|
||||
@ -405,7 +405,7 @@ sorttable = {
|
||||
b++;
|
||||
|
||||
} // while(swap)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* ******************************************************************
|
||||
@ -581,4 +581,3 @@ var forEach = function(object, block, context) {
|
||||
resolve.forEach(object, block, context);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ function StateSuggestions(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* @scope protected
|
||||
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*
|
||||
bTypeAhead /*:boolean*/) {
|
||||
var aSuggestions = [];
|
||||
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
||||
|
||||
|
||||
if (sTextboxValue.length > 0){
|
||||
|
||||
|
||||
//search for matching states
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
|
||||
aSuggestions.push(this.states[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,4 +59,4 @@ function alias_popup(alias_id,theme,loading) {
|
||||
domTT_update('ttalias_'+alias_id,'<div>'+response.match(/<h1>.*<\/table>/i)+'<div>');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @class
|
||||
* @scope public
|
||||
*/
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
oProvider /*:SuggestionProvider*/) {
|
||||
|
||||
|
||||
/**
|
||||
* The currently selected suggestions.
|
||||
* @scope private
|
||||
*/
|
||||
*/
|
||||
this.cur /*:int*/ = -1;
|
||||
|
||||
/**
|
||||
@ -18,22 +18,22 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
* @scope private
|
||||
*/
|
||||
this.layer = null;
|
||||
|
||||
|
||||
/**
|
||||
* Suggestion provider for the autosuggest feature.
|
||||
* @scope private.
|
||||
*/
|
||||
this.provider /*:SuggestionProvider*/ = oProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The textbox to capture.
|
||||
* @scope private
|
||||
*/
|
||||
this.textbox /*:HTMLInputElement*/ = oTextbox;
|
||||
|
||||
|
||||
//initialize the control
|
||||
this.init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,13 +45,13 @@ function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
|
||||
*/
|
||||
AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
|
||||
bTypeAhead /*:boolean*/) {
|
||||
|
||||
|
||||
//make sure there's at least one suggestion
|
||||
if (aSuggestions.length > 0) {
|
||||
if (bTypeAhead) {
|
||||
this.typeAhead(aSuggestions[0]);
|
||||
}
|
||||
|
||||
|
||||
this.showSuggestions(aSuggestions);
|
||||
} else {
|
||||
this.hideSuggestions();
|
||||
@ -71,11 +71,11 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
this.layer.className = "suggestions";
|
||||
this.layer.style.visibility = "hidden";
|
||||
this.layer.style.width = this.textbox.offsetWidth;
|
||||
|
||||
|
||||
//when the user clicks on the a suggestion, get the text (innerHTML)
|
||||
//and place it into a textbox
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmousedown =
|
||||
this.layer.onmouseup =
|
||||
this.layer.onmouseover = function (oEvent) {
|
||||
oEvent = oEvent || window.event;
|
||||
oTarget = oEvent.target || oEvent.srcElement;
|
||||
@ -89,8 +89,8 @@ AutoSuggestControl.prototype.createDropDown = function () {
|
||||
oThis.textbox.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(this.layer);
|
||||
};
|
||||
|
||||
@ -103,12 +103,12 @@ AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iLeft = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iLeft += oNode.offsetLeft;
|
||||
oNode = oNode.offsetParent;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iLeft;
|
||||
};
|
||||
|
||||
@ -121,12 +121,12 @@ AutoSuggestControl.prototype.getTop = function () /*:int*/ {
|
||||
|
||||
var oNode = this.textbox;
|
||||
var iTop = 0;
|
||||
|
||||
|
||||
while(oNode.tagName != "BODY") {
|
||||
iTop += oNode.offsetTop;
|
||||
oNode = oNode.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
return iTop;
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
|
||||
case 38: //up arrow
|
||||
this.previousSuggestion();
|
||||
break;
|
||||
case 40: //down arrow
|
||||
case 40: //down arrow
|
||||
this.nextSuggestion();
|
||||
break;
|
||||
case 13: //enter
|
||||
@ -163,7 +163,7 @@ AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
|
||||
//for backspace (8) and delete (46), shows suggestions without typeahead
|
||||
if (iKeyCode == 8 || iKeyCode == 46) {
|
||||
this.provider.requestSuggestions(this, false);
|
||||
|
||||
|
||||
//make sure not to interfere with non-character keys
|
||||
} else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
|
||||
//ignore
|
||||
@ -187,7 +187,7 @@ AutoSuggestControl.prototype.hideSuggestions = function () {
|
||||
* @param oSuggestionNode The node representing a suggestion in the dropdown.
|
||||
*/
|
||||
AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
|
||||
|
||||
|
||||
for (var i=0; i < this.layer.childNodes.length; i++) {
|
||||
var oNode = this.layer.childNodes[i];
|
||||
if (oNode == oSuggestionNode) {
|
||||
@ -207,36 +207,36 @@ AutoSuggestControl.prototype.init = function () {
|
||||
|
||||
//save a reference to this object
|
||||
var oThis = this;
|
||||
|
||||
|
||||
//assign the onkeyup event handler
|
||||
this.textbox.onkeyup = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyUp() method with the event object
|
||||
oThis.handleKeyUp(oEvent);
|
||||
};
|
||||
|
||||
|
||||
//assign onkeydown event handler
|
||||
this.textbox.onkeydown = function (oEvent) {
|
||||
|
||||
|
||||
//check for the proper location of the event object
|
||||
if (!oEvent) {
|
||||
oEvent = window.event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//call the handleKeyDown() method with the event object
|
||||
oThis.handleKeyDown(oEvent);
|
||||
};
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
|
||||
//assign onblur event handler (hides suggestions)
|
||||
this.textbox.onblur = function () {
|
||||
oThis.hideSuggestions();
|
||||
};
|
||||
|
||||
|
||||
//create the suggestions dropdown
|
||||
this.createDropDown();
|
||||
};
|
||||
@ -252,7 +252,7 @@ AutoSuggestControl.prototype.nextSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
|
||||
var oNode = cSuggestionNodes[++this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,7 +267,7 @@ AutoSuggestControl.prototype.previousSuggestion = function () {
|
||||
if (cSuggestionNodes.length > 0 && this.cur > 0) {
|
||||
var oNode = cSuggestionNodes[--this.cur];
|
||||
this.highlightSuggestion(oNode);
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
this.textbox.value = oNode.firstChild.nodeValue;
|
||||
}
|
||||
};
|
||||
|
||||
@ -281,19 +281,19 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
|
||||
//use text ranges for Internet Explorer
|
||||
if (this.textbox.createTextRange) {
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
var oRange = this.textbox.createTextRange();
|
||||
oRange.moveStart("character", iStart);
|
||||
oRange.moveEnd("character", iLength - this.textbox.value.length);
|
||||
oRange.select();
|
||||
|
||||
|
||||
//use setSelectionRange() for Mozilla
|
||||
} else if (this.textbox.setSelectionRange) {
|
||||
this.textbox.setSelectionRange(iStart, iLength);
|
||||
}
|
||||
}
|
||||
|
||||
//set focus back to the textbox
|
||||
this.textbox.focus();
|
||||
};
|
||||
this.textbox.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the suggestion layer contents, moves it into position,
|
||||
@ -302,16 +302,16 @@ AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*
|
||||
* @param aSuggestions An array of suggestions for the control.
|
||||
*/
|
||||
AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
|
||||
|
||||
|
||||
var oDiv = null;
|
||||
this.layer.innerHTML = ""; //clear contents of the layer
|
||||
|
||||
|
||||
for (var i=0; i < aSuggestions.length; i++) {
|
||||
oDiv = document.createElement("div");
|
||||
oDiv.appendChild(document.createTextNode(aSuggestions[i]));
|
||||
this.layer.appendChild(oDiv);
|
||||
}
|
||||
|
||||
|
||||
this.layer.style.left = this.getLeft() + "px";
|
||||
this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
|
||||
this.layer.style.visibility = "visible";
|
||||
@ -319,7 +319,7 @@ AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* Inserts a suggestion into the textbox, highlighting the
|
||||
* suggested part of the text.
|
||||
* @scope private
|
||||
* @param sSuggestion The suggestion for the textbox.
|
||||
@ -328,9 +328,8 @@ AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
|
||||
|
||||
//check for support of typeahead functionality
|
||||
if (this.textbox.createTextRange || this.textbox.setSelectionRange){
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
var iLen = this.textbox.value.length;
|
||||
this.textbox.value = sSuggestion;
|
||||
this.selectRange(iLen, sSuggestion.length);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -3,4 +3,4 @@ function kH(e) {
|
||||
return pK != 13;
|
||||
}
|
||||
document.onkeypress = kH;
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
if (document.layers) document.captureEvents(Event.KEYPRESS);
|
||||
|
||||
@ -9,7 +9,7 @@ function StateSuggestions(text) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* Request suggestions for the given autosuggest control.
|
||||
* @scope protected
|
||||
* @param oAutoSuggestControl The autosuggest control to provide suggestions for.
|
||||
*/
|
||||
@ -17,14 +17,14 @@ StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*
|
||||
bTypeAhead /*:boolean*/) {
|
||||
var aSuggestions = [];
|
||||
var sTextboxValue = oAutoSuggestControl.textbox.value;
|
||||
|
||||
|
||||
if (sTextboxValue.length > 0){
|
||||
|
||||
|
||||
//search for matching states
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
for (var i=0; i < this.states.length; i++) {
|
||||
if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
|
||||
aSuggestions.push(this.states[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user