Moved under "trunk" to be able to track releases under "tags"
SVN:trunk[55]
112
js/LinksWidget.js
Normal file
@@ -0,0 +1,112 @@
|
||||
// JavaScript Document
|
||||
|
||||
function LinksWidget(id, sLinkedClass, sExtKeyToMe, sExtKeyToRemote, aAttributes)
|
||||
{
|
||||
this.id = id;
|
||||
this.sLinkedClass = sLinkedClass;
|
||||
this.sExtKeyToMe = sExtKeyToMe;
|
||||
this.sExtKeyToRemote = sExtKeyToRemote;
|
||||
this.aAttributes = aAttributes;
|
||||
this.aLinks = new Array();
|
||||
|
||||
this.Init = function()
|
||||
{
|
||||
sLinks = $('#'+this.id).val();
|
||||
if (sLinks.length > 0)
|
||||
{
|
||||
this.aLinks = JSON.parse(sLinks);
|
||||
}
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
this.Refresh = function ()
|
||||
{
|
||||
if (this.aLinks.length == 0)
|
||||
{
|
||||
$('#'+this.id+'_values').empty();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLinks = JSON.stringify(this.aLinks);
|
||||
$('#'+this.id).val(sLinks);
|
||||
$('#'+this.id+'_values').load('ajax.render.php?operation=ui.linkswidget.linkedset&sclass='+this.sLinkedClass+'&sextkeytome='+this.sExtKeyToMe,
|
||||
{'sset' : sLinks});
|
||||
}
|
||||
}
|
||||
|
||||
this.OnOk = function()
|
||||
{
|
||||
this.aObjectBeingLinked = new Array();
|
||||
sSelected = 'selected_objects_'+this.id;
|
||||
oSelected = document.getElementById(sSelected);
|
||||
for(i=0; i<oSelected.length; i++)
|
||||
{
|
||||
this.aObjectBeingLinked[i] = oSelected.options[i].value;
|
||||
}
|
||||
this.aPreviousLinks = this.aLinks; // Save the list in case of cancellation
|
||||
this.aLinks = new Array(); // rebuild the list of links from scratch
|
||||
$('#LinkDlg_'+this.id).jqmShow();
|
||||
}
|
||||
|
||||
this.OnCancel = function()
|
||||
{
|
||||
// Restore the links to their previous value (just in case)
|
||||
this.aLinks = this.aPreviousLinks;
|
||||
}
|
||||
|
||||
this.OnLinkOk = function()
|
||||
{
|
||||
$('#LinkDlg_'+this.id).jqmHide();
|
||||
for(i=0; i<this.aObjectBeingLinked.length; i++)
|
||||
{
|
||||
oLink = {};
|
||||
oLink[this.sExtKeyToRemote] = this.aObjectBeingLinked[i];
|
||||
for(j=0; j<this.aAttributes.length; j++)
|
||||
{
|
||||
oLink[aAttributes[j]] = $('#'+this.id+'_'+j).val();
|
||||
}
|
||||
this.aLinks.push(oLink);
|
||||
}
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
this.OnLinkCancel = function()
|
||||
{
|
||||
// Restore the links to their previous value (just in case)
|
||||
this.aLinks = this.aPreviousLinks;
|
||||
}
|
||||
|
||||
this.RemoveLink = function(index)
|
||||
{
|
||||
this.aLinks.splice(index, 1); // Remove the element at position 'index'
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
this.AddObject = function()
|
||||
{
|
||||
linkedObjId = $('#id_ac_'+this.id).val();
|
||||
// Clears the selection
|
||||
$('#id_ac_'+this.id).val('');
|
||||
$('#ac_'+this.id).val('');
|
||||
// Add the object to the list
|
||||
this.aObjectBeingLinked = new Array();
|
||||
this.aObjectBeingLinked[0] = linkedObjId;
|
||||
// Add the object to the list of links
|
||||
this.aPreviousLinks = this.aLinks; // Save the list in case of cancellation
|
||||
$('#LinkDlg_'+this.id).jqmShow();
|
||||
}
|
||||
|
||||
this.ModifyLink = function(index)
|
||||
{
|
||||
this.aObjectBeingLinked = new Array();
|
||||
this.aObjectBeingLinked[0] = this.aLinks[index][this.sExtKeyToRemote];
|
||||
this.aPreviousLinks = this.aLinks; // Save the list in case of cancellation
|
||||
// Set the default values of the dialog to the current ones
|
||||
for(j=0; j<this.aAttributes.length; j++)
|
||||
{
|
||||
$('#'+this.id+'_'+j).val(aLinks[index][aAttributes[j]]);
|
||||
}
|
||||
this.aLinks.splice(index, 1); // Remove the element at position 'index'
|
||||
$('#LinkDlg_'+this.id).jqmShow(); // And add it again
|
||||
}
|
||||
}
|
||||
467
js/date.js
Normal file
@@ -0,0 +1,467 @@
|
||||
/*
|
||||
* Date prototype extensions. Doesn't depend on any
|
||||
* other code. Doens't overwrite existing methods.
|
||||
*
|
||||
* Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
|
||||
* isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
|
||||
* setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
|
||||
*
|
||||
* Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*
|
||||
* Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
|
||||
* I've added my name to these methods so you know who to blame if they are broken!
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* An Array of day names starting with Sunday.
|
||||
*
|
||||
* @example dayNames[0]
|
||||
* @result 'Sunday'
|
||||
*
|
||||
* @name dayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated day names starting with Sun.
|
||||
*
|
||||
* @example abbrDayNames[0]
|
||||
* @result 'Sun'
|
||||
*
|
||||
* @name abbrDayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
|
||||
/**
|
||||
* An Array of month names starting with Janurary.
|
||||
*
|
||||
* @example monthNames[0]
|
||||
* @result 'January'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated month names starting with Jan.
|
||||
*
|
||||
* @example abbrMonthNames[0]
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
/**
|
||||
* The first day of the week for this locale.
|
||||
*
|
||||
* @name firstDayOfWeek
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.firstDayOfWeek = 1;
|
||||
|
||||
/**
|
||||
* The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
//Date.format = 'dd/mm/yyyy';
|
||||
//Date.format = 'mm/dd/yyyy';
|
||||
Date.format = 'yyyy-mm-dd';
|
||||
//Date.format = 'dd mmm yy';
|
||||
|
||||
/**
|
||||
* The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
|
||||
* only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fullYearStart = '20';
|
||||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Adds a given method under the given name
|
||||
* to the Date prototype if it doesn't
|
||||
* currently exist.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function add(name, method) {
|
||||
if( !Date.prototype[name] ) {
|
||||
Date.prototype[name] = method;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the year is a leap year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isLeapYear();
|
||||
* @result true
|
||||
*
|
||||
* @name isLeapYear
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isLeapYear", function() {
|
||||
var y = this.getFullYear();
|
||||
return (y%4==0 && y%100!=0) || y%400==0;
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks if the day is a weekend day (Sat or Sun).
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekend();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekend
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekend", function() {
|
||||
return this.getDay()==0 || this.getDay()==6;
|
||||
});
|
||||
|
||||
/**
|
||||
* Check if the day is a day of the week (Mon-Fri)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekDay();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekDay
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekDay", function() {
|
||||
return !this.isWeekend();
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the number of days in the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDaysInMonth();
|
||||
* @result 31
|
||||
*
|
||||
* @name getDaysInMonth
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDaysInMonth", function() {
|
||||
return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the day.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName();
|
||||
* @result 'Saturday'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName(true);
|
||||
* @result 'Sat'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName();
|
||||
* @result 'Janurary'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName(true);
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getMonthName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayOfYear();
|
||||
* @result 11
|
||||
*
|
||||
* @name getDayOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayOfYear", function() {
|
||||
var tmpdtm = new Date("1/1/" + this.getFullYear());
|
||||
return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the week of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getWeekOfYear();
|
||||
* @result 2
|
||||
*
|
||||
* @name getWeekOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getWeekOfYear", function() {
|
||||
return Math.ceil(this.getDayOfYear() / 7);
|
||||
});
|
||||
|
||||
/**
|
||||
* Set the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.setDayOfYear(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Jan 01 2008 00:00:00'
|
||||
*
|
||||
* @name setDayOfYear
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("setDayOfYear", function(day) {
|
||||
this.setMonth(0);
|
||||
this.setDate(day);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of years to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addYears(1);
|
||||
* dtm.toString();
|
||||
* @result 'Mon Jan 12 2009 00:00:00'
|
||||
*
|
||||
* @name addYears
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addYears", function(num) {
|
||||
this.setFullYear(this.getFullYear() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of months to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMonths(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Feb 12 2008 00:00:00'
|
||||
*
|
||||
* @name addMonths
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMonths", function(num) {
|
||||
var tmpdtm = this.getDate();
|
||||
|
||||
this.setMonth(this.getMonth() + num);
|
||||
|
||||
if (tmpdtm > this.getDate())
|
||||
this.addDays(-this.getDate());
|
||||
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of days to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addDays(1);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addDays
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addDays", function(num) {
|
||||
this.setDate(this.getDate() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of hours to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addHours(24);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addHours
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addHours", function(num) {
|
||||
this.setHours(this.getHours() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of minutes to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMinutes(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 01:00:00'
|
||||
*
|
||||
* @name addMinutes
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMinutes", function(num) {
|
||||
this.setMinutes(this.getMinutes() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of seconds to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addSeconds(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name addSeconds
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addSeconds", function(num) {
|
||||
this.setSeconds(this.getSeconds() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
|
||||
*
|
||||
* @example var dtm = new Date();
|
||||
* dtm.zeroTime();
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name zeroTime
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("zeroTime", function() {
|
||||
this.setMilliseconds(0);
|
||||
this.setSeconds(0);
|
||||
this.setMinutes(0);
|
||||
this.setHours(0);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a string representation of the date object according to Date.format.
|
||||
* (Date.toString may be used in other places so I purposefully didn't overwrite it)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.asString();
|
||||
* @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name asString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("asString", function() {
|
||||
var r = Date.format;
|
||||
return r
|
||||
.split('yyyy').join(this.getFullYear())
|
||||
.split('yy').join((this.getFullYear() + '').substring(2))
|
||||
.split('mmm').join(this.getMonthName(true))
|
||||
.split('mm').join(_zeroPad(this.getMonth()+1))
|
||||
.split('dd').join(_zeroPad(this.getDate()));
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
|
||||
* (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
|
||||
*
|
||||
* @example var dtm = Date.fromString("12/01/2008");
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name fromString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fromString = function(s)
|
||||
{
|
||||
var f = Date.format;
|
||||
var d = new Date('01/01/1977');
|
||||
var iY = f.indexOf('yyyy');
|
||||
if (iY > -1) {
|
||||
d.setFullYear(Number(s.substr(iY, 4)));
|
||||
} else {
|
||||
// TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
|
||||
d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
|
||||
}
|
||||
var iM = f.indexOf('mmm');
|
||||
if (iM > -1) {
|
||||
var mStr = s.substr(iM, 3);
|
||||
for (var i=0; i<Date.abbrMonthNames.length; i++) {
|
||||
if (Date.abbrMonthNames[i] == mStr) break;
|
||||
}
|
||||
d.setMonth(i);
|
||||
} else {
|
||||
d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
|
||||
}
|
||||
d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
|
||||
if (isNaN(d.getTime())) {
|
||||
return false;
|
||||
}
|
||||
return d;
|
||||
};
|
||||
|
||||
// utility method
|
||||
var _zeroPad = function(num) {
|
||||
var s = '0'+num;
|
||||
return s.substring(s.length-2)
|
||||
//return ('0'+num).substring(-2); // doesn't work on IE :(
|
||||
};
|
||||
|
||||
})();
|
||||
317
js/dimensions.js
Normal file
@@ -0,0 +1,317 @@
|
||||
/**
|
||||
* This plugin overrides jQuery's height() and width() functions and
|
||||
* adds more handy stuff for cross-browser compatibility.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the css height value for the first matched element.
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
*
|
||||
* @example $("#testdiv").height()
|
||||
* @result "200px"
|
||||
*
|
||||
* @example $(document).height();
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).height();
|
||||
* @result 400
|
||||
*
|
||||
* @name height
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.height = function() {
|
||||
if ( this.get(0) == window )
|
||||
return self.innerHeight ||
|
||||
jQuery.boxModel && document.documentElement.clientHeight ||
|
||||
document.body.clientHeight;
|
||||
if ( this.get(0) == document )
|
||||
return Math.max( document.body.scrollHeight, document.body.offsetHeight );
|
||||
|
||||
return this.css("height", arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the css width value for the first matched element.
|
||||
* If used on document, returns the document's width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
*
|
||||
* @example $("#testdiv").width()
|
||||
* @result "200px"
|
||||
*
|
||||
* @example $(document).width();
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).width();
|
||||
* @result 400
|
||||
*
|
||||
* @name width
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.width = function() {
|
||||
if ( this.get(0) == window )
|
||||
return self.innerWidth ||
|
||||
jQuery.boxModel && document.documentElement.clientWidth ||
|
||||
document.body.clientWidth;
|
||||
|
||||
if ( this.get(0) == document )
|
||||
return Math.max( document.body.scrollWidth, document.body.offsetWidth );
|
||||
|
||||
return this.css("width", arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner height value (without border) for the first matched element.
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
*
|
||||
* @example $("#testdiv").innerHeight()
|
||||
* @result 800
|
||||
*
|
||||
* @name innerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerHeight = function() {
|
||||
return this.get(0) == window || this.get(0) == document ?
|
||||
this.height() :
|
||||
this.get(0).offsetHeight - parseInt(this.css("borderTop") || 0) - parseInt(this.css("borderBottom") || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner width value (without border) for the first matched element.
|
||||
* If used on document, returns the document's Width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
*
|
||||
* @example $("#testdiv").innerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name innerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerWidth = function() {
|
||||
return this.get(0) == window || this.get(0) == document ?
|
||||
this.width() :
|
||||
this.get(0).offsetWidth - parseInt(this.css("borderLeft") || 0) - parseInt(this.css("borderRight") || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer height value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerHeight()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerHeight = function() {
|
||||
return this.get(0) == window || this.get(0) == document ?
|
||||
this.height() :
|
||||
this.get(0).offsetHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer width value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerWidth = function() {
|
||||
return this.get(0) == window || this.get(0) == document ?
|
||||
this.width() :
|
||||
this.get(0).offsetWidth;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the right (scrollLeft).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollLeft()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollLeft
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollLeft = function() {
|
||||
if ( this.get(0) == window || this.get(0) == document )
|
||||
return self.pageXOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollLeft ||
|
||||
document.body.scrollLeft;
|
||||
|
||||
return this.get(0).scrollLeft;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the bottom (scrollTop).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollTop()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollTop
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollTop = function() {
|
||||
if ( this.get(0) == window || this.get(0) == document )
|
||||
return self.pageYOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollTop ||
|
||||
document.body.scrollTop;
|
||||
|
||||
return this.get(0).scrollTop;
|
||||
};
|
||||
|
||||
/**
|
||||
* This returns an object with top, left, width, height, borderLeft,
|
||||
* borderTop, marginLeft, marginTop, scrollLeft, scrollTop,
|
||||
* pageXOffset, pageYOffset.
|
||||
*
|
||||
* The top and left values include the scroll offsets but the
|
||||
* scrollLeft and scrollTop properties of the returned object
|
||||
* are the combined scroll offets of the parent elements
|
||||
* (not including the window scroll offsets). This is not the
|
||||
* same as the element's scrollTop and scrollLeft.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values.
|
||||
*
|
||||
* @name offset
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
/**
|
||||
* This returns an object with top, left, width, height, borderLeft,
|
||||
* borderTop, marginLeft, marginTop, scrollLeft, scrollTop,
|
||||
* pageXOffset, pageYOffset.
|
||||
*
|
||||
* The top and left values include the scroll offsets but the
|
||||
* scrollLeft and scrollTop properties of the returned object
|
||||
* are the combined scroll offets of the parent elements
|
||||
* (not including the window scroll offsets). This is not the
|
||||
* same as the element's scrollTop and scrollLeft.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values.
|
||||
*
|
||||
* @name offset
|
||||
* @type Object
|
||||
* @param String refElement This is an expression. The offset returned will be relative to the first matched element.
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
/**
|
||||
* This returns an object with top, left, width, height, borderLeft,
|
||||
* borderTop, marginLeft, marginTop, scrollLeft, scrollTop,
|
||||
* pageXOffset, pageYOffset.
|
||||
*
|
||||
* The top and left values include the scroll offsets but the
|
||||
* scrollLeft and scrollTop properties of the returned object
|
||||
* are the combined scroll offets of the parent elements
|
||||
* (not including the window scroll offsets). This is not the
|
||||
* same as the element's scrollTop and scrollLeft.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values.
|
||||
*
|
||||
* @name offset
|
||||
* @type Object
|
||||
* @param jQuery refElement The offset returned will be relative to the first matched element.
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
/**
|
||||
* This returns an object with top, left, width, height, borderLeft,
|
||||
* borderTop, marginLeft, marginTop, scrollLeft, scrollTop,
|
||||
* pageXOffset, pageYOffset.
|
||||
*
|
||||
* The top and left values include the scroll offsets but the
|
||||
* scrollLeft and scrollTop properties of the returned object
|
||||
* are the combined scroll offets of the parent elements
|
||||
* (not including the window scroll offsets). This is not the
|
||||
* same as the element's scrollTop and scrollLeft.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values.
|
||||
*
|
||||
* @name offset
|
||||
* @type Object
|
||||
* @param HTMLElement refElement The offset returned will be relative to this element.
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
jQuery.fn.offset = function(refElem) {
|
||||
if (!this[0]) throw 'jQuery.fn.offset requires an element.';
|
||||
|
||||
refElem = (refElem) ? jQuery(refElem)[0] : null;
|
||||
var x = 0, y = 0, elem = this[0], parent = this[0], sl = 0, st = 0;
|
||||
do {
|
||||
if (parent.tagName == 'BODY' || parent.tagName == 'HTML') {
|
||||
// Safari and IE don't add margin for static and relative
|
||||
if ((jQuery.browser.safari || jQuery.browser.msie) && jQuery.css(parent, 'position') != 'absolute') {
|
||||
x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'marginTop')) || 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
x += parent.offsetLeft || 0;
|
||||
y += parent.offsetTop || 0;
|
||||
|
||||
// Mozilla and IE do not add the border
|
||||
if (jQuery.browser.mozilla || jQuery.browser.msie) {
|
||||
x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
}
|
||||
|
||||
// Mozilla removes the border if the parent has overflow hidden
|
||||
if (jQuery.browser.mozilla && jQuery.css(parent, 'overflow') == 'hidden') {
|
||||
x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
}
|
||||
|
||||
// Need to get scroll offsets in-between offsetParents
|
||||
var op = parent.offsetParent;
|
||||
do {
|
||||
sl += parent.scrollLeft || 0;
|
||||
st += parent.scrollTop || 0;
|
||||
parent = parent.parentNode;
|
||||
} while (parent != op);
|
||||
} while (parent);
|
||||
|
||||
if (refElem) { // Get the relative offset
|
||||
var offset = jQuery(refElem).offset();
|
||||
x = x - offset.left;
|
||||
y = y - offset.top;
|
||||
sl = sl - offset.scrollLeft;
|
||||
st = st - offset.scrollTop;
|
||||
}
|
||||
|
||||
// Safari and Opera do not add the border for the element
|
||||
if (jQuery.browser.safari || jQuery.browser.opera) {
|
||||
x += parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
|
||||
}
|
||||
|
||||
return {
|
||||
top: y - st,
|
||||
left: x - sl,
|
||||
width: elem.offsetWidth,
|
||||
height: elem.offsetHeight,
|
||||
borderTop: parseInt(jQuery.css(elem, 'borderTopWidth')) || 0,
|
||||
borderLeft: parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0,
|
||||
marginTop: parseInt(jQuery.css(elem, 'marginTopWidth')) || 0,
|
||||
marginLeft: parseInt(jQuery.css(elem, 'marginLeftWidth')) || 0,
|
||||
scrollTop: st,
|
||||
scrollLeft: sl,
|
||||
pageYOffset: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
|
||||
pageXOffset: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0
|
||||
};
|
||||
};
|
||||
106
js/forms-json-utils.js
Normal file
@@ -0,0 +1,106 @@
|
||||
// ID of the (hidden) form field used to store the JSON representation of the
|
||||
// object being edited in this page
|
||||
var sJsonFieldId = 'json_object';
|
||||
|
||||
// The memory representation of the object
|
||||
var oObj = {};
|
||||
|
||||
// Mapping between the fields of the form and the attribute of the current object
|
||||
// If aFieldsMap[2] contains 'foo' it means that oObj.foo corresponds to the field
|
||||
// of Id 'att_2' in the form
|
||||
var aFieldsMap = new Array;
|
||||
|
||||
// Update the whole object from the form and also update its
|
||||
// JSON (serialized) representation in the (hidden) field
|
||||
function UpdateObjectFromForm(aFieldsMap, oObj)
|
||||
{
|
||||
for(i=0; i<aFieldsMap.length; i++)
|
||||
{
|
||||
var oElement = document.getElementById('att_'+i);
|
||||
var sFieldName = aFieldsMap[i];
|
||||
oObj['m_aCurrValues'][sFieldName] = oElement.value;
|
||||
sJSON = JSON.stringify(oObj);
|
||||
var oJSON = document.getElementById(sJsonFieldId);
|
||||
oJSON.value = sJSON;
|
||||
}
|
||||
return oObj;
|
||||
}
|
||||
|
||||
// Update the specified field from the current object
|
||||
function UpdateFieldFromObject(idField, aFieldsMap, oObj)
|
||||
{
|
||||
var oElement = document.getElementById('att_'+idField);
|
||||
oElement.value = oObj['m_aCurrValues'][aFieldsMap[idField]];
|
||||
}
|
||||
// Update all the fields of the Form from the current object
|
||||
function UpdateFormFromObject(aFieldsMap, oObj)
|
||||
{
|
||||
for(i=0; i<aFieldsMap.length; i++)
|
||||
{
|
||||
UpdateFieldFromForm(i, aFieldsMap, oObj);
|
||||
}
|
||||
}
|
||||
|
||||
// This function is meant to be called from the AJAX page
|
||||
// It reloads the object (oObj) from the JSON representation
|
||||
// and also updates the form field that contains the JSON
|
||||
// representation of the object
|
||||
function ReloadObjectFromServer(sJSON)
|
||||
{
|
||||
//console.log('JSON value:', sJSON);
|
||||
var oJSON = document.getElementById(sJsonFieldId);
|
||||
oJSON.value = sJSON;
|
||||
oObj = JSON.parse( '(' + sJSON + ')' );
|
||||
return oObj;
|
||||
}
|
||||
|
||||
function GoToStep(iCurrentStep, iNextStep)
|
||||
{
|
||||
var oCurrentStep = document.getElementById('wizStep'+iCurrentStep);
|
||||
oCurrentStep.style.display = 'none';
|
||||
ActivateStep(iNextStep);
|
||||
}
|
||||
|
||||
function ActivateStep(iTargetStep)
|
||||
{
|
||||
UpdateObjectFromForm(aFieldsMap, oObj);
|
||||
var oNextStep = document.getElementById('wizStep'+(iTargetStep));
|
||||
window.location.href='#step'+iTargetStep;
|
||||
// If a handler for entering this step exists, call it
|
||||
if (typeof(this['OnEnterStep'+iTargetStep]) == 'function')
|
||||
{
|
||||
eval( 'OnEnterStep'+iTargetStep+'();');
|
||||
}
|
||||
oNextStep.style.display = '';
|
||||
G_iCurrentStep = iTargetStep;
|
||||
$('#wizStep'+(iTargetStep)).block({ message: null });
|
||||
}
|
||||
|
||||
|
||||
function AjaxGetValuesDef(oObj, sClass, sAttCode, iFieldId)
|
||||
{
|
||||
var oJSON = document.getElementById(sJsonFieldId);
|
||||
$.get('ajax.render.php?class=' + sClass + '&json_obj=' + oJSON.value + '&att_code=' + sAttCode,
|
||||
{ operation: "allowed_values" },
|
||||
function(data){
|
||||
//$('#field_'+iFieldId).html(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function AjaxGetDefaultValue(oObj, sClass, sAttCode, iFieldId)
|
||||
{
|
||||
// Asynchronously call the server to provide a default value if the field is
|
||||
// empty
|
||||
if (oObj['m_aCurrValues'][sAttCode] == '')
|
||||
{
|
||||
var oJSON = document.getElementById(sJsonFieldId);
|
||||
$.get('ajax.render.php?class=' + sClass + '&json_obj=' + oJSON.value + '&att_code=' + sAttCode,
|
||||
{ operation: "default_value" },
|
||||
function(json_data){
|
||||
var oObj = ReloadObjectFromServer(json_data);
|
||||
UpdateFieldFromObject(iFieldId, aFieldsMap, oObj)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
458
js/hovertip.js
Normal file
@@ -0,0 +1,458 @@
|
||||
/**
|
||||
* Hovertip - easy and elegant tooltips
|
||||
*
|
||||
* By Dave Cohen <http://dave-cohen.com>
|
||||
* With ideas and and javascript code borrowed from many folks.
|
||||
* (See URLS in the comments)
|
||||
*
|
||||
* Licensed under GPL.
|
||||
* Requires jQuery.js. <http://jquery.com>,
|
||||
* which may be distributed under a different licence.
|
||||
*
|
||||
* $Date: 2006-09-15 12:49:19 -0700 (Fri, 15 Sep 2006) $
|
||||
* $Rev: $
|
||||
* $Id:$
|
||||
*
|
||||
* This plugin helps you create tooltips. It supports:
|
||||
*
|
||||
* hovertips - these appear under the mouse when mouse is over the target
|
||||
* element.
|
||||
*
|
||||
* clicktips - these appear in the document when the target element is
|
||||
* clicked.
|
||||
*
|
||||
* You may define behaviors for additional types of tooltips.
|
||||
*
|
||||
* There are a variety of ways to add tooltips. Each of the following is
|
||||
* supported:
|
||||
*
|
||||
* <p>blah blah blah
|
||||
* <span>important term</span>
|
||||
* <span class="tooltip">text that appears.</span>
|
||||
* blah blah blah</p>
|
||||
*
|
||||
* or,
|
||||
*
|
||||
* <p>blah blah blah
|
||||
* <span hovertip="termdefinition">important term</span>
|
||||
* blah blah blah</p>
|
||||
* <div id="termdefinition" class="hovertip"><h1>term definition</h1><p>the term means...</p></div>
|
||||
*
|
||||
* or,
|
||||
*
|
||||
* <p>blah blah blah
|
||||
* <span id="term">important term</span>
|
||||
* blah blah blah</p>
|
||||
* <div target="term" class="hovertip"><h1>term definition</h1><p>the term means...</p></div>
|
||||
*
|
||||
*
|
||||
* Hooks are available to customize both the behavior of activated tooltips,
|
||||
* and the syntax used to mark them up.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
//// mouse events ////
|
||||
/**
|
||||
* To make hovertips appear correctly we need the exact mouse position.
|
||||
* These functions make that possible.
|
||||
*/
|
||||
|
||||
// use globals to track mouse position
|
||||
var hovertipMouseX;
|
||||
var hovertipMouseY;
|
||||
function hovertipMouseUpdate(e) {
|
||||
var mouse = hovertipMouseXY(e);
|
||||
hovertipMouseX = mouse[0];
|
||||
hovertipMouseY = mouse[1];
|
||||
}
|
||||
|
||||
// http://www.howtocreate.co.uk/tutorials/javascript/eventinfo
|
||||
function hovertipMouseXY(e) {
|
||||
if( !e ) {
|
||||
if( window.event ) {
|
||||
//Internet Explorer
|
||||
e = window.event;
|
||||
} else {
|
||||
//total failure, we have no way of referencing the event
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( typeof( e.pageX ) == 'number' ) {
|
||||
//most browsers
|
||||
var xcoord = e.pageX;
|
||||
var ycoord = e.pageY;
|
||||
} else if( typeof( e.clientX ) == 'number' ) {
|
||||
//Internet Explorer and older browsers
|
||||
//other browsers provide this, but follow the pageX/Y branch
|
||||
var xcoord = e.clientX;
|
||||
var ycoord = e.clientY;
|
||||
var badOldBrowser = ( window.navigator.userAgent.indexOf( 'Opera' ) + 1 ) ||
|
||||
( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ||
|
||||
( navigator.vendor == 'KDE' );
|
||||
if( !badOldBrowser ) {
|
||||
if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
|
||||
//IE 4, 5 & 6 (in non-standards compliant mode)
|
||||
xcoord += document.body.scrollLeft;
|
||||
ycoord += document.body.scrollTop;
|
||||
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
|
||||
//IE 6 (in standards compliant mode)
|
||||
xcoord += document.documentElement.scrollLeft;
|
||||
ycoord += document.documentElement.scrollTop;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//total failure, we have no way of obtaining the mouse coordinates
|
||||
return;
|
||||
}
|
||||
return [xcoord, ycoord];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// target selectors ////
|
||||
|
||||
/**
|
||||
* These selectors find the targets for a given tooltip element.
|
||||
* Several methods are supported.
|
||||
*
|
||||
* You may write your own selector functions to customize.
|
||||
*/
|
||||
|
||||
/**
|
||||
* For this model:
|
||||
* <span hovertip="ht1">target term</span>...
|
||||
* <div class="hovertip" id="ht1">tooltip text</div>
|
||||
*/
|
||||
targetSelectById = function(el, config) {
|
||||
var id;
|
||||
var selector;
|
||||
if (id = el.getAttribute('id')) {
|
||||
selector = '*[@'+config.attribute+'=\''+id+'\']';
|
||||
return $(selector);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For this model:
|
||||
* <span id="ht1">target term</span>...
|
||||
* <div class="hovertip" target="ht1">tooltip text</div>
|
||||
*/
|
||||
targetSelectByTargetAttribute = function(el, config) {
|
||||
target_list = el.getAttribute('target');
|
||||
if (target_list) {
|
||||
// use for attribute to specify targets
|
||||
target_ids = target_list.split(' ');
|
||||
var selector = '#' + target_ids.join(',#');
|
||||
return $(selector);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For this model:
|
||||
* <span>target term</span><span class="hovertip">tooltip text</span>
|
||||
*/
|
||||
targetSelectByPrevious = function(el, config) {
|
||||
return $(el.previousSibling);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make all siblings targets. Experimental.
|
||||
*/
|
||||
targetSelectBySiblings = function(el, config) {
|
||||
return $(el).siblings();
|
||||
}
|
||||
|
||||
//// prepare tip elements ////
|
||||
|
||||
/**
|
||||
* The tooltip element needs special preparation. You may define your own
|
||||
* prepare functions to cusomize the behavior.
|
||||
*/
|
||||
|
||||
// adds a close link to clicktips
|
||||
clicktipPrepareWithCloseLink = function(o, config) {
|
||||
return o.append("<a class='clicktip_close'><span>close</span></a>")
|
||||
.find('a.clicktip_close').click(function(e) {
|
||||
o.hide();
|
||||
return false;
|
||||
}).end();
|
||||
};
|
||||
|
||||
// ensure that hovertips do not disappear when the mouse is over them.
|
||||
// also position the hovertip as an absolutely positioned child of body.
|
||||
hovertipPrepare = function(o, config) {
|
||||
return o.hover(function() {
|
||||
hovertipHideCancel(this);
|
||||
}, function() {
|
||||
hovertipHideLater(this);
|
||||
}).css('position', 'absolute').each(hovertipPosition);
|
||||
};
|
||||
|
||||
// do not modify tooltips when preparing
|
||||
hovertipPrepareNoOp = function(o, config) {
|
||||
return o;
|
||||
}
|
||||
|
||||
//// manipulate tip elements /////
|
||||
/**
|
||||
* A variety of functions to modify tooltip elements
|
||||
*/
|
||||
|
||||
// move tooltips to body, so they are not descended from other absolutely
|
||||
// positioned elements.
|
||||
hovertipPosition = function(i) {
|
||||
document.body.appendChild(this);
|
||||
}
|
||||
|
||||
hovertipIsVisible = function(el) {
|
||||
return (jQuery.css(el, 'display') != 'none');
|
||||
}
|
||||
|
||||
// show the tooltip under the mouse.
|
||||
// Introduce a delay, so tip appears only if cursor rests on target for more than an instant.
|
||||
hovertipShowUnderMouse = function(el) {
|
||||
hovertipHideCancel(el);
|
||||
if (!hovertipIsVisible(el)) {
|
||||
el.ht.showing = // keep reference to timer
|
||||
window.setTimeout(function() {
|
||||
el.ht.tip.css({
|
||||
'position':'absolute',
|
||||
'top': hovertipMouseY + 'px',
|
||||
'left': hovertipMouseX + 'px'})
|
||||
.show();
|
||||
}, el.ht.config.showDelay);
|
||||
}
|
||||
};
|
||||
|
||||
// do not hide
|
||||
hovertipHideCancel = function(el) {
|
||||
if (el.ht.hiding) {
|
||||
window.clearTimeout(el.ht.hiding);
|
||||
el.ht.hiding = null;
|
||||
}
|
||||
};
|
||||
|
||||
// Hide a tooltip, but only after a delay.
|
||||
// The delay allow the tip to remain when user moves mouse from target to tooltip
|
||||
hovertipHideLater = function(el) {
|
||||
if (el.ht.showing) {
|
||||
window.clearTimeout(el.ht.showing);
|
||||
el.ht.showing = null;
|
||||
}
|
||||
if (el.ht.hiding) {
|
||||
window.clearTimeout(el.ht.hiding);
|
||||
el.ht.hiding = null;
|
||||
}
|
||||
el.ht.hiding =
|
||||
window.setTimeout(function() {
|
||||
if (el.ht.hiding) {
|
||||
// fadeOut, slideUp do not work on Konqueror
|
||||
el.ht.tip.hide();
|
||||
}
|
||||
}, el.ht.config.hideDelay);
|
||||
};
|
||||
|
||||
|
||||
//// prepare target elements ////
|
||||
/**
|
||||
* As we prepared the tooltip elements, the targets also need preparation.
|
||||
*
|
||||
* You may define your own custom behavior.
|
||||
*/
|
||||
|
||||
// when clicked on target, toggle visibilty of tooltip
|
||||
clicktipTargetPrepare = function(o, el, config) {
|
||||
return o.addClass(config.attribute + '_target')
|
||||
.click(function() {
|
||||
el.ht.tip.toggle();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// when hover over target, make tooltip appear
|
||||
hovertipTargetPrepare = function(o, el, config) {
|
||||
return o.addClass(config.attribute + '_target')
|
||||
.hover(function() {
|
||||
// show tip when mouse over target
|
||||
hovertipShowUnderMouse(el);
|
||||
},
|
||||
function() {
|
||||
// hide the tip
|
||||
// add a delay so user can move mouse from the target to the tip
|
||||
hovertipHideLater(el);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* hovertipActivate() is our jQuery plugin function. It turns on hovertip or
|
||||
* clicktip behavior for a set of elements.
|
||||
*
|
||||
* @param config
|
||||
* controls aspects of tooltip behavior. Be sure to define
|
||||
* 'attribute', 'showDelay' and 'hideDelay'.
|
||||
*
|
||||
* @param targetSelect
|
||||
* function finds the targets of a given tooltip element.
|
||||
*
|
||||
* @param tipPrepare
|
||||
* function alters the tooltip to display and behave properly
|
||||
*
|
||||
* @param targetPrepare
|
||||
* function alters the target to display and behave properly.
|
||||
*/
|
||||
jQuery.fn.hovertipActivate = function(config, targetSelect, tipPrepare, targetPrepare) {
|
||||
//alert('activating ' + this.size());
|
||||
// unhide so jquery show/hide will work.
|
||||
return this.css('display', 'block')
|
||||
.hide() // don't show it until click
|
||||
.each(function() {
|
||||
if (!this.ht)
|
||||
this.ht = new Object();
|
||||
this.ht.config = config;
|
||||
|
||||
// find our targets
|
||||
var targets = targetSelect(this, config);
|
||||
if (targets && targets.size()) {
|
||||
if (!this.ht.targets)
|
||||
this.ht.targets = targetPrepare(targets, this, config);
|
||||
else
|
||||
this.ht.targets.add(targetPrepare(targets, this, config));
|
||||
|
||||
// listen to mouse move events so we know exatly where to place hovetips
|
||||
targets.mousemove(hovertipMouseUpdate);
|
||||
|
||||
// prepare the tooltip element
|
||||
// is it bad form to call $(this) here?
|
||||
if (!this.ht.tip)
|
||||
this.ht.tip = tipPrepare($(this), config);
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
/**
|
||||
* Here's an example ready function which shows how to enable tooltips.
|
||||
*
|
||||
* You can make this considerably shorter by choosing only the markup style(s)
|
||||
* you will use.
|
||||
*
|
||||
* You may also remove the code that wraps hovertips to produce drop-shadow FX
|
||||
*
|
||||
* Invoke this function or one like it from your $(document).ready().
|
||||
*
|
||||
* Here, we break the action up into several timout callbacks, to avoid
|
||||
* locking up browsers.
|
||||
*/
|
||||
function hovertipInit() {
|
||||
// specify the attribute name we use for our clicktips
|
||||
var clicktipConfig = {'attribute':'clicktip'};
|
||||
|
||||
/**
|
||||
* To enable this style of markup (id on tooltip):
|
||||
* <span clicktip="foo">target</span>...
|
||||
* <div id="foo" class="clicktip">blah blah</div>
|
||||
*/
|
||||
window.setTimeout(function() {
|
||||
$('.clicktip').hovertipActivate(clicktipConfig,
|
||||
targetSelectById,
|
||||
clicktipPrepareWithCloseLink,
|
||||
clicktipTargetPrepare);
|
||||
}, 0);
|
||||
|
||||
/**
|
||||
* To enable this style of markup (id on target):
|
||||
* <span id="foo">target</span>...
|
||||
* <div target="foo" class="clicktip">blah blah</div>
|
||||
*/
|
||||
window.setTimeout(function() {
|
||||
$('.clicktip').hovertipActivate(clicktipConfig,
|
||||
targetSelectByTargetAttribute,
|
||||
clicktipPrepareWithCloseLink,
|
||||
clicktipTargetPrepare);
|
||||
}, 0);
|
||||
|
||||
// specify our configuration for hovertips, including delay times (millisec)
|
||||
var hovertipConfig = {'attribute':'hovertip',
|
||||
'showDelay': 300,
|
||||
'hideDelay': 700};
|
||||
|
||||
// use <div class='hovertip'>blah blah</div>
|
||||
var hovertipSelect = 'div.hovertip';
|
||||
|
||||
// OPTIONAL: here we wrap each hovertip to apply special effect. (i.e. drop shadow):
|
||||
$(hovertipSelect).css('display', 'block').addClass('hovertip_wrap3').
|
||||
wrap("<div class='hovertip_wrap0'><div class='hovertip_wrap1'><div class='hovertip_wrap2'>" +
|
||||
"</div></div></div>").each(function() {
|
||||
// fix class and attributes for newly wrapped elements
|
||||
var tooltip = this.parentNode.parentNode.parentNode;
|
||||
if (this.getAttribute('target'))
|
||||
tooltip.setAttribute('target', this.getAttribute('target'));
|
||||
if (this.getAttribute('id')) {
|
||||
var id = this.getAttribute('id');
|
||||
this.removeAttribute('id');
|
||||
tooltip.setAttribute('id', id);
|
||||
}
|
||||
});
|
||||
hovertipSelect = 'div.hovertip_wrap0';
|
||||
|
||||
// end optional FX section
|
||||
|
||||
/**
|
||||
* To enable this style of markup (id on tooltip):
|
||||
* <span hovertip="foo">target</span>...
|
||||
* <div id="foo" class="hovertip">blah blah</div>
|
||||
*/
|
||||
window.setTimeout(function() {
|
||||
$(hovertipSelect).hovertipActivate(hovertipConfig,
|
||||
targetSelectById,
|
||||
hovertipPrepare,
|
||||
hovertipTargetPrepare);
|
||||
}, 0);
|
||||
|
||||
/**
|
||||
* To enable this style of markup (id on target):
|
||||
* <span id="foo">target</span>...
|
||||
* <div target="foo" class="hovertip">blah blah</div>
|
||||
*/
|
||||
window.setTimeout(function() {
|
||||
$(hovertipSelect).hovertipActivate(hovertipConfig,
|
||||
targetSelectByTargetAttribute,
|
||||
hovertipPrepare,
|
||||
hovertipTargetPrepare);
|
||||
}, 0);
|
||||
|
||||
/**
|
||||
* This next section enables this style of markup:
|
||||
* <foo><span>target</span><span class="hovertip">blah blah</span></foo>
|
||||
*
|
||||
* With drop shadow effect.
|
||||
*
|
||||
*/
|
||||
var hovertipSpanSelect = 'span.hovertip';
|
||||
// activate hovertips with wrappers for FX (drop shadow):
|
||||
$(hovertipSpanSelect).css('display', 'block').addClass('hovertip_wrap3').
|
||||
wrap("<span class='hovertip_wrap0'><span class='hovertip_wrap1'><span class='hovertip_wrap2'>" +
|
||||
"</span></span></span>").each(function() {
|
||||
// fix class and attributes for newly wrapped elements
|
||||
var tooltip = this.parentNode.parentNode.parentNode;
|
||||
if (this.getAttribute('target'))
|
||||
tooltip.setAttribute('target', this.getAttribute('target'));
|
||||
if (this.getAttribute('id')) {
|
||||
var id = this.getAttribute('id');
|
||||
this.removeAttribute('id');
|
||||
tooltip.setAttribute('id', id);
|
||||
}
|
||||
});
|
||||
hovertipSpanSelect = 'span.hovertip_wrap0';
|
||||
|
||||
window.setTimeout(function() {
|
||||
$(hovertipSpanSelect)
|
||||
.hovertipActivate(hovertipConfig,
|
||||
targetSelectByPrevious,
|
||||
hovertipPrepare,
|
||||
hovertipTargetPrepare);
|
||||
}, 0);
|
||||
}
|
||||
67
js/jqModal.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* jqModal - Minimalist Modaling with jQuery
|
||||
*
|
||||
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* $Version: 2007.08.17 +r11
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.jqm=function(o){
|
||||
var _o = {
|
||||
zIndex: 3000,
|
||||
overlay: 50,
|
||||
overlayClass: 'jqmOverlay',
|
||||
closeClass: 'jqmClose',
|
||||
trigger: '.jqModal',
|
||||
ajax: false,
|
||||
target: false,
|
||||
modal: false,
|
||||
toTop: false,
|
||||
onShow: false,
|
||||
onHide: false,
|
||||
onLoad: false
|
||||
};
|
||||
return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
|
||||
H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
|
||||
if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
|
||||
});};
|
||||
|
||||
$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
|
||||
$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
|
||||
$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
|
||||
$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};
|
||||
|
||||
$.jqm = {
|
||||
hash:{},
|
||||
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
|
||||
if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
|
||||
else if(c.overlay > 0)h.w.jqmAddClose(o);
|
||||
else o=false;
|
||||
|
||||
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
|
||||
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
|
||||
|
||||
if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
|
||||
r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
|
||||
else if(cc)h.w.jqmAddClose($(cc,h.w));
|
||||
|
||||
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
|
||||
(c.onShow)?c.onShow(h):h.w.show();e(h);return false;
|
||||
},
|
||||
close:function(s){var h=H[s];h.a=false;
|
||||
if(A[0]){A.pop();if(!A[0])F('unbind');}
|
||||
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
|
||||
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
|
||||
}};
|
||||
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
|
||||
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
|
||||
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
|
||||
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
|
||||
F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
|
||||
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
|
||||
hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
|
||||
$(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
|
||||
})(jQuery);
|
||||
513
js/jquery.autocomplete.js
Normal file
@@ -0,0 +1,513 @@
|
||||
jQuery.autocomplete = function(input, options) {
|
||||
// Create a link to self
|
||||
var me = this;
|
||||
var $key = null; //DF: modif
|
||||
|
||||
// Create jQuery object for input element
|
||||
var $input = $(input).attr("autocomplete", "off");
|
||||
|
||||
// Apply inputClass if necessary
|
||||
if (options.inputClass) $input.addClass(options.inputClass);
|
||||
|
||||
// DF: begin modif
|
||||
// For combo with key/value pairs
|
||||
if (options.keyHolder) $key = $(options.keyHolder);
|
||||
// DF: end modif
|
||||
|
||||
// Create results
|
||||
var results = document.createElement("div");
|
||||
// Create jQuery object for results
|
||||
var $results = $(results);
|
||||
$results.hide().addClass(options.resultsClass).css("position", "absolute");
|
||||
if( options.width > 0 ) $results.css("width", options.width);
|
||||
|
||||
// Add to body element
|
||||
$("body").append(results);
|
||||
|
||||
input.autocompleter = me;
|
||||
|
||||
var timeout = null;
|
||||
var prev = "";
|
||||
var active = -1;
|
||||
var cache = {};
|
||||
var keyb = false;
|
||||
var hasFocus = false;
|
||||
var lastKeyPressCode = null;
|
||||
|
||||
// flush cache
|
||||
function flushCache(){
|
||||
cache = {};
|
||||
cache.data = {};
|
||||
cache.length = 0;
|
||||
};
|
||||
|
||||
// flush cache
|
||||
flushCache();
|
||||
|
||||
// if there is a data array supplied
|
||||
if( options.data != null ){
|
||||
var sFirstChar = "", stMatchSets = {}, row = [];
|
||||
|
||||
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
|
||||
if( typeof options.url != "string" ) options.cacheLength = 1;
|
||||
|
||||
// loop through the array and create a lookup structure
|
||||
for( var i=0; i < options.data.length; i++ ){
|
||||
// if row is a string, make an array otherwise just reference the array
|
||||
row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);
|
||||
|
||||
// if the length is zero, don't add to list
|
||||
if( row[0].length > 0 ){
|
||||
// get the first character
|
||||
sFirstChar = row[0].substring(0, 1).toLowerCase();
|
||||
// if no lookup array for this character exists, look it up now
|
||||
if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
|
||||
// if the match is a string
|
||||
stMatchSets[sFirstChar].push(row);
|
||||
}
|
||||
}
|
||||
|
||||
// add the data items to the cache
|
||||
for( var k in stMatchSets ){
|
||||
// increase the cache size
|
||||
options.cacheLength++;
|
||||
// add to the cache
|
||||
addToCache(k, stMatchSets[k]);
|
||||
}
|
||||
}
|
||||
|
||||
$input
|
||||
.keydown(function(e) {
|
||||
// track last key pressed
|
||||
lastKeyPressCode = e.keyCode;
|
||||
switch(e.keyCode) {
|
||||
case 38: // up
|
||||
e.preventDefault();
|
||||
moveSelect(-1);
|
||||
break;
|
||||
case 40: // down
|
||||
e.preventDefault();
|
||||
moveSelect(1);
|
||||
break;
|
||||
case 9: // tab
|
||||
case 13: // return
|
||||
if( selectCurrent() ){
|
||||
// make sure to blur off the current field
|
||||
$input.get(0).blur();
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
active = -1;
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = setTimeout(function(){onChange();}, options.delay);
|
||||
break;
|
||||
}
|
||||
})
|
||||
.focus(function(){
|
||||
// track whether the field has focus, we shouldn't process any results if the field no longer has focus
|
||||
hasFocus = true;
|
||||
})
|
||||
.blur(function() {
|
||||
// track whether the field has focus
|
||||
hasFocus = false;
|
||||
hideResults();
|
||||
});
|
||||
|
||||
hideResultsNow();
|
||||
|
||||
function onChange() {
|
||||
// ignore if the following keys are pressed: [del] [shift] [capslock]
|
||||
if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
|
||||
var v = $input.val();
|
||||
if (v == prev) return;
|
||||
prev = v;
|
||||
if (v.length >= options.minChars) {
|
||||
$input.addClass(options.loadingClass);
|
||||
requestData(v);
|
||||
} else {
|
||||
$input.removeClass(options.loadingClass);
|
||||
$results.hide();
|
||||
}
|
||||
};
|
||||
|
||||
function moveSelect(step) {
|
||||
|
||||
var lis = $("li", results);
|
||||
if (!lis) return;
|
||||
|
||||
active += step;
|
||||
|
||||
if (active < 0) {
|
||||
active = 0;
|
||||
} else if (active >= lis.size()) {
|
||||
active = lis.size() - 1;
|
||||
}
|
||||
|
||||
lis.removeClass("ac_over");
|
||||
|
||||
$(lis[active]).addClass("ac_over");
|
||||
|
||||
// Weird behaviour in IE
|
||||
// if (lis[active] && lis[active].scrollIntoView) {
|
||||
// lis[active].scrollIntoView(false);
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
function selectCurrent() {
|
||||
var li = $("li.ac_over", results)[0];
|
||||
if (!li) {
|
||||
var $li = $("li", results);
|
||||
if (options.selectOnly) {
|
||||
if ($li.length == 1) li = $li[0];
|
||||
} else if (options.selectFirst) {
|
||||
li = $li[0];
|
||||
}
|
||||
}
|
||||
if (li) {
|
||||
selectItem(li);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function selectItem(li) {
|
||||
if (!li) {
|
||||
li = document.createElement("li");
|
||||
li.extra = [];
|
||||
li.selectValue = "";
|
||||
}
|
||||
var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
|
||||
input.lastSelected = v;
|
||||
prev = v;
|
||||
$results.html("");
|
||||
$input.val(v);
|
||||
// DF: begin modif
|
||||
if ($key)
|
||||
{
|
||||
$key.val(li.extra[0]);
|
||||
}
|
||||
// DF: end modif
|
||||
hideResultsNow();
|
||||
if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
|
||||
};
|
||||
|
||||
// selects a portion of the input string
|
||||
function createSelection(start, end){
|
||||
// get a reference to the input element
|
||||
var field = $input.get(0);
|
||||
if( field.createTextRange ){
|
||||
var selRange = field.createTextRange();
|
||||
selRange.collapse(true);
|
||||
selRange.moveStart("character", start);
|
||||
selRange.moveEnd("character", end);
|
||||
selRange.select();
|
||||
} else if( field.setSelectionRange ){
|
||||
field.setSelectionRange(start, end);
|
||||
} else {
|
||||
if( field.selectionStart ){
|
||||
field.selectionStart = start;
|
||||
field.selectionEnd = end;
|
||||
}
|
||||
}
|
||||
field.focus();
|
||||
};
|
||||
|
||||
// fills in the input box w/the first match (assumed to be the best match)
|
||||
function autoFill(sValue){
|
||||
// if the last user key pressed was backspace, don't autofill
|
||||
if( lastKeyPressCode != 8 ){
|
||||
// fill in the value (keep the case the user has typed)
|
||||
$input.val($input.val() + sValue.substring(prev.length));
|
||||
// select the portion of the value not typed by the user (so the next character will erase)
|
||||
createSelection(prev.length, sValue.length);
|
||||
}
|
||||
};
|
||||
|
||||
function showResults() {
|
||||
// get the position of the input field right now (in case the DOM is shifted)
|
||||
var pos = findPos(input);
|
||||
// either use the specified width, or autocalculate based on form element
|
||||
var iWidth = (options.width > 0) ? options.width : $input.width();
|
||||
// reposition
|
||||
$results.css({
|
||||
width: parseInt(iWidth) + "px",
|
||||
top: (pos.y + input.offsetHeight) + "px",
|
||||
left: pos.x + "px"
|
||||
}).show();
|
||||
};
|
||||
|
||||
function hideResults() {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = setTimeout(hideResultsNow, 200);
|
||||
};
|
||||
|
||||
function hideResultsNow() {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
$input.removeClass(options.loadingClass);
|
||||
if ($results.is(":visible")) {
|
||||
$results.hide();
|
||||
}
|
||||
if (options.mustMatch) {
|
||||
var v = $input.val();
|
||||
if (v != input.lastSelected) {
|
||||
selectItem(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function receiveData(q, data) {
|
||||
if (data) {
|
||||
$input.removeClass(options.loadingClass);
|
||||
results.innerHTML = "";
|
||||
|
||||
// if the field no longer has focus or if there are no matches, do not display the drop down
|
||||
if( !hasFocus || data.length == 0 ) return hideResultsNow();
|
||||
|
||||
if ($.browser.msie) {
|
||||
// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
|
||||
$results.append(document.createElement('iframe'));
|
||||
}
|
||||
results.appendChild(dataToDom(data));
|
||||
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
|
||||
if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
|
||||
showResults();
|
||||
} else {
|
||||
hideResultsNow();
|
||||
}
|
||||
};
|
||||
|
||||
function parseData(data) {
|
||||
if (!data) return null;
|
||||
var parsed = [];
|
||||
var rows = data.split(options.lineSeparator);
|
||||
for (var i=0; i < rows.length; i++) {
|
||||
var row = $.trim(rows[i]);
|
||||
if (row) {
|
||||
parsed[parsed.length] = row.split(options.cellSeparator);
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
function dataToDom(data) {
|
||||
var ul = document.createElement("ul");
|
||||
var num = data.length;
|
||||
|
||||
// limited results to a max number
|
||||
if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;
|
||||
|
||||
for (var i=0; i < num; i++) {
|
||||
var row = data[i];
|
||||
if (!row) continue;
|
||||
var li = document.createElement("li");
|
||||
if (options.formatItem) {
|
||||
li.innerHTML = options.formatItem(row, i, num);
|
||||
li.selectValue = row[0];
|
||||
} else {
|
||||
li.innerHTML = row[0];
|
||||
li.selectValue = row[0];
|
||||
}
|
||||
var extra = null;
|
||||
if (row.length > 1) {
|
||||
extra = [];
|
||||
for (var j=1; j < row.length; j++) {
|
||||
extra[extra.length] = row[j];
|
||||
}
|
||||
}
|
||||
li.extra = extra;
|
||||
ul.appendChild(li);
|
||||
$(li).hover(
|
||||
function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
|
||||
function() { $(this).removeClass("ac_over"); }
|
||||
).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
|
||||
}
|
||||
return ul;
|
||||
};
|
||||
|
||||
function requestData(q) {
|
||||
if (!options.matchCase) q = q.toLowerCase();
|
||||
var data = options.cacheLength ? loadFromCache(q) : null;
|
||||
// recieve the cached data
|
||||
if (data) {
|
||||
receiveData(q, data);
|
||||
// if an AJAX url has been supplied, try loading the data now
|
||||
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||||
$.get(makeUrl(q), function(data) {
|
||||
data = parseData(data);
|
||||
addToCache(q, data);
|
||||
receiveData(q, data);
|
||||
});
|
||||
// if there's been no data found, remove the loading class
|
||||
} else {
|
||||
$input.removeClass(options.loadingClass);
|
||||
}
|
||||
};
|
||||
|
||||
function makeUrl(q) {
|
||||
var url = options.url + "?q=" + encodeURI(q);
|
||||
for (var i in options.extraParams) {
|
||||
url += "&" + i + "=" + encodeURI(options.extraParams[i]);
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
function loadFromCache(q) {
|
||||
if (!q) return null;
|
||||
if (cache.data[q]) return cache.data[q];
|
||||
if (options.matchSubset) {
|
||||
for (var i = q.length - 1; i >= options.minChars; i--) {
|
||||
var qs = q.substr(0, i);
|
||||
var c = cache.data[qs];
|
||||
if (c) {
|
||||
var csub = [];
|
||||
for (var j = 0; j < c.length; j++) {
|
||||
var x = c[j];
|
||||
var x0 = x[0];
|
||||
if (matchSubset(x0, q)) {
|
||||
csub[csub.length] = x;
|
||||
}
|
||||
}
|
||||
return csub;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
function matchSubset(s, sub) {
|
||||
if (!options.matchCase) s = s.toLowerCase();
|
||||
var i = s.indexOf(sub);
|
||||
if (i == -1) return false;
|
||||
return i == 0 || options.matchContains;
|
||||
};
|
||||
|
||||
this.flushCache = function() {
|
||||
flushCache();
|
||||
};
|
||||
|
||||
this.setExtraParams = function(p) {
|
||||
options.extraParams = p;
|
||||
};
|
||||
|
||||
this.findValue = function(){
|
||||
var q = $input.val();
|
||||
|
||||
if (!options.matchCase) q = q.toLowerCase();
|
||||
var data = options.cacheLength ? loadFromCache(q) : null;
|
||||
if (data) {
|
||||
findValueCallback(q, data);
|
||||
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||||
$.get(makeUrl(q), function(data) {
|
||||
data = parseData(data)
|
||||
addToCache(q, data);
|
||||
findValueCallback(q, data);
|
||||
});
|
||||
} else {
|
||||
// no matches
|
||||
findValueCallback(q, null);
|
||||
}
|
||||
}
|
||||
|
||||
function findValueCallback(q, data){
|
||||
if (data) $input.removeClass(options.loadingClass);
|
||||
|
||||
var num = (data) ? data.length : 0;
|
||||
var li = null;
|
||||
|
||||
for (var i=0; i < num; i++) {
|
||||
var row = data[i];
|
||||
|
||||
if( row[0].toLowerCase() == q.toLowerCase() ){
|
||||
li = document.createElement("li");
|
||||
if (options.formatItem) {
|
||||
li.innerHTML = options.formatItem(row, i, num);
|
||||
li.selectValue = row[0];
|
||||
} else {
|
||||
li.innerHTML = row[0];
|
||||
}
|
||||
var extra = null;
|
||||
if( row.length > 1 ){
|
||||
extra = [];
|
||||
for (var j=1; j < row.length; j++) {
|
||||
extra[extra.length] = row[j];
|
||||
}
|
||||
}
|
||||
li.extra = extra;
|
||||
}
|
||||
}
|
||||
|
||||
if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
|
||||
}
|
||||
|
||||
function addToCache(q, data) {
|
||||
if (!data || !q || !options.cacheLength) return;
|
||||
if (!cache.length || cache.length > options.cacheLength) {
|
||||
flushCache();
|
||||
cache.length++;
|
||||
} else if (!cache[q]) {
|
||||
cache.length++;
|
||||
}
|
||||
cache.data[q] = data;
|
||||
};
|
||||
|
||||
function findPos(obj) {
|
||||
var curleft = obj.offsetLeft || 0;
|
||||
var curtop = obj.offsetTop || 0;
|
||||
while (obj = obj.offsetParent) {
|
||||
curleft += obj.offsetLeft
|
||||
curtop += obj.offsetTop
|
||||
}
|
||||
return {x:curleft,y:curtop};
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.fn.autocomplete = function(url, options, data) {
|
||||
// Make sure options exists
|
||||
options = options || {};
|
||||
// Set url as option
|
||||
options.url = url;
|
||||
// set some bulk local data
|
||||
options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;
|
||||
|
||||
// Set default values for required options
|
||||
options.inputClass = options.inputClass || "ac_input";
|
||||
options.resultsClass = options.resultsClass || "ac_results";
|
||||
options.lineSeparator = options.lineSeparator || "\n";
|
||||
options.cellSeparator = options.cellSeparator || "|";
|
||||
options.minChars = options.minChars || 1;
|
||||
options.delay = options.delay || 400;
|
||||
options.matchCase = options.matchCase || 0;
|
||||
options.matchSubset = options.matchSubset || 1;
|
||||
options.matchContains = options.matchContains || 0;
|
||||
options.cacheLength = options.cacheLength || 1;
|
||||
options.mustMatch = options.mustMatch || 0;
|
||||
options.extraParams = options.extraParams || {};
|
||||
options.loadingClass = options.loadingClass || "ac_loading";
|
||||
options.selectFirst = options.selectFirst || false;
|
||||
options.selectOnly = options.selectOnly || false;
|
||||
options.maxItemsToShow = options.maxItemsToShow || -1;
|
||||
options.autoFill = options.autoFill || false;
|
||||
options.width = parseInt(options.width, 10) || 0;
|
||||
|
||||
this.each(function() {
|
||||
var input = this;
|
||||
new jQuery.autocomplete(input, options);
|
||||
});
|
||||
|
||||
// Don't break the chain
|
||||
return this;
|
||||
}
|
||||
|
||||
jQuery.fn.autocompleteArray = function(data, options) {
|
||||
return this.autocomplete(null, options, data);
|
||||
}
|
||||
|
||||
jQuery.fn.indexOf = function(e){
|
||||
for( var i=0; i<this.length; i++ ){
|
||||
if( this[i] == e ) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
49
js/jquery.bgiframe.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate: 2007-02-18 22:09:54 -0600 (Sun, 18 Feb 2007) $
|
||||
* $Rev: 1379 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* The bgiframe is chainable and applies the iframe hack to get
|
||||
* around zIndex issues in IE6. It will only apply itself in IE
|
||||
* and adds a class to the iframe called 'bgiframe'.
|
||||
*
|
||||
* It does take borders into consideration but all values
|
||||
* need to be in pixels and the element needs to have
|
||||
* position relative or absolute.
|
||||
*
|
||||
* NOTICE: This plugin uses CSS expersions in order to work
|
||||
* with an element's borders, height and with and can result in poor
|
||||
* performance when used on an element that changes properties
|
||||
* like size and position a lot. Two of these expressions can be
|
||||
* removed if border doesn't matter and performance does.
|
||||
* See lines 39 and 40 below and set top: 0 and left: 0
|
||||
* instead of their current values.
|
||||
*
|
||||
* @example $('div').bgiframe();
|
||||
* @before <div><p>Paragraph</p></div>
|
||||
* @result <div><iframe class="bgiframe".../><p>Paragraph</p></div>
|
||||
*
|
||||
* @name bgiframe
|
||||
* @type jQuery
|
||||
* @cat Plugins/bgiframe
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
jQuery.fn.bgIframe = jQuery.fn.bgiframe = function() {
|
||||
// This is only for IE6
|
||||
if ( !(jQuery.browser.msie && typeof XMLHttpRequest == 'function') ) return this;
|
||||
var html = '<iframe class="bgiframe" src="javascript:false;document.write(\'\');" tabindex="-1" '
|
||||
+'style="display:block; position:absolute; '
|
||||
+'top: expression(((parseInt(this.parentNode.currentStyle.borderTopWidth) || 0) * -1) + \'px\'); '
|
||||
+'left:expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth) || 0) * -1) + \'px\'); '
|
||||
+'z-index:-1; filter:Alpha(Opacity=\'0\'); '
|
||||
+'width:expression(this.parentNode.offsetWidth + \'px\'); '
|
||||
+'height:expression(this.parentNode.offsetHeight + \'px\')"/>';
|
||||
return this.each(function() {
|
||||
if ( !jQuery('iframe.bgiframe', this)[0] )
|
||||
this.insertBefore( document.createElement(html), this.firstChild );
|
||||
});
|
||||
};
|
||||
312
js/jquery.blockUI.js
Normal file
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* jQuery blockUI plugin
|
||||
* Version 2.07 (05/17/2008)
|
||||
* @requires jQuery v1.2.3 or later
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/block/
|
||||
* Copyright (c) 2007-2008 M. Alsup
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
|
||||
alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
|
||||
return;
|
||||
}
|
||||
|
||||
// global $ methods for blocking/unblocking the entire page
|
||||
$.blockUI = function(opts) { install(window, opts); };
|
||||
$.unblockUI = function(opts) { remove(window, opts); };
|
||||
|
||||
// plugin method for blocking element content
|
||||
$.fn.block = function(opts) {
|
||||
return this.each(function() {
|
||||
if ($.css(this,'position') == 'static')
|
||||
this.style.position = 'relative';
|
||||
if ($.browser.msie)
|
||||
this.style.zoom = 1; // force 'hasLayout'
|
||||
install(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
// plugin method for unblocking element content
|
||||
$.fn.unblock = function(opts) {
|
||||
return this.each(function() {
|
||||
remove(this, opts);
|
||||
});
|
||||
};
|
||||
|
||||
$.blockUI.version = 2.07; // 2nd generation blocking at no extra cost!
|
||||
|
||||
// override these in your code to change the default behavior and style
|
||||
$.blockUI.defaults = {
|
||||
// message displayed when blocking (use null for no message)
|
||||
message: '<h1>Please wait...</h1>',
|
||||
|
||||
// styles for the message when blocking; if you wish to disable
|
||||
// these and use an external stylesheet then do this in your code:
|
||||
// $.blockUI.defaults.css = {};
|
||||
css: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
width: '30%',
|
||||
top: '40%',
|
||||
left: '35%',
|
||||
textAlign: 'center',
|
||||
color: '#000',
|
||||
border: '3px solid #aaa',
|
||||
backgroundColor:'#fff',
|
||||
cursor: 'wait'
|
||||
},
|
||||
|
||||
// styles for the overlay
|
||||
overlayCSS: {
|
||||
backgroundColor:'#000',
|
||||
opacity: '0.6'
|
||||
},
|
||||
|
||||
// z-index for the blocking overlay
|
||||
baseZ: 1000,
|
||||
|
||||
// set these to true to have the message automatically centered
|
||||
centerX: true, // <-- only effects element blocking (page block controlled via css above)
|
||||
centerY: true,
|
||||
|
||||
// allow body element to be stetched in ie6; this makes blocking look better
|
||||
// on "short" pages. disable if you wish to prevent changes to the body height
|
||||
allowBodyStretch: true,
|
||||
|
||||
// be default blockUI will supress tab navigation from leaving blocking content;
|
||||
constrainTabKey: true,
|
||||
|
||||
// fadeOut time in millis; set to 0 to disable fadeout on unblock
|
||||
fadeOut: 400,
|
||||
|
||||
// if true, focus will be placed in the first available input field when
|
||||
// page blocking
|
||||
focusInput: true,
|
||||
|
||||
// suppresses the use of overlay styles on FF/Linux (due to significant performance issues with opacity)
|
||||
applyPlatformOpacityRules: true,
|
||||
|
||||
// callback method invoked when unblocking has completed; the callback is
|
||||
// passed the element that has been unblocked (which is the window object for page
|
||||
// blocks) and the options that were passed to the unblock call:
|
||||
// onUnblock(element, options)
|
||||
onUnblock: null
|
||||
};
|
||||
|
||||
// private data and functions follow...
|
||||
|
||||
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
|
||||
var pageBlock = null;
|
||||
var pageBlockEls = [];
|
||||
|
||||
function install(el, opts) {
|
||||
var full = (el == window);
|
||||
var msg = opts && opts.message !== undefined ? opts.message : undefined;
|
||||
opts = $.extend({}, $.blockUI.defaults, opts || {});
|
||||
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
|
||||
var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
|
||||
msg = msg === undefined ? opts.message : msg;
|
||||
|
||||
// remove the current block (if there is one)
|
||||
if (full && pageBlock)
|
||||
remove(window, {fadeOut:0});
|
||||
|
||||
// if an existing element is being used as the blocking content then we capture
|
||||
// its current place in the DOM (and current display style) so we can restore
|
||||
// it when we unblock
|
||||
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
|
||||
var node = msg.jquery ? msg[0] : msg;
|
||||
var data = {};
|
||||
$(el).data('blockUI.history', data);
|
||||
data.el = node;
|
||||
data.parent = node.parentNode;
|
||||
data.display = node.style.display;
|
||||
data.position = node.style.position;
|
||||
data.parent.removeChild(node);
|
||||
}
|
||||
|
||||
var z = opts.baseZ;
|
||||
|
||||
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
|
||||
// layer1 is the iframe layer which is used to supress bleed through of underlying content
|
||||
// layer2 is the overlay layer which has opacity and a wait cursor
|
||||
// layer3 is the message content that is displayed while blocking
|
||||
|
||||
var lyr1 = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:'+ z++ +';border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
|
||||
: $('<div class="blockUI" style="display:none"></div>');
|
||||
var lyr2 = $('<div class="blockUI" style="z-index:'+ z++ +';cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
|
||||
var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';position:fixed"></div>')
|
||||
: $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');
|
||||
|
||||
// if we have a message, style it
|
||||
if (msg)
|
||||
lyr3.css(css);
|
||||
|
||||
// style the overlay
|
||||
if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
|
||||
lyr2.css(opts.overlayCSS);
|
||||
lyr2.css('position', full ? 'fixed' : 'absolute');
|
||||
|
||||
// make iframe layer transparent in IE
|
||||
if ($.browser.msie)
|
||||
lyr1.css('opacity','0.0');
|
||||
|
||||
$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
|
||||
|
||||
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
|
||||
var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
|
||||
if (ie6 || expr) {
|
||||
// give body 100% height
|
||||
if (full && opts.allowBodyStretch && $.boxModel)
|
||||
$('html,body').css('height','100%');
|
||||
|
||||
// fix ie6 issue when blocked element has a border width
|
||||
if ((ie6 || !$.boxModel) && !full) {
|
||||
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
|
||||
var fixT = t ? '(0 - '+t+')' : 0;
|
||||
var fixL = l ? '(0 - '+l+')' : 0;
|
||||
}
|
||||
|
||||
// simulate fixed position
|
||||
$.each([lyr1,lyr2,lyr3], function(i,o) {
|
||||
var s = o[0].style;
|
||||
s.position = 'absolute';
|
||||
if (i < 2) {
|
||||
full ? s.setExpression('height','document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + "px"')
|
||||
: s.setExpression('height','this.parentNode.offsetHeight + "px"');
|
||||
full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
|
||||
: s.setExpression('width','this.parentNode.offsetWidth + "px"');
|
||||
if (fixL) s.setExpression('left', fixL);
|
||||
if (fixT) s.setExpression('top', fixT);
|
||||
}
|
||||
else if (opts.centerY) {
|
||||
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
|
||||
s.marginTop = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// show the message
|
||||
lyr3.append(msg).show();
|
||||
if (msg && (msg.jquery || msg.nodeType))
|
||||
$(msg).show();
|
||||
|
||||
// bind key and mouse events
|
||||
bind(1, el, opts);
|
||||
|
||||
if (full) {
|
||||
pageBlock = lyr3[0];
|
||||
pageBlockEls = $(':input:enabled:visible',pageBlock);
|
||||
if (opts.focusInput)
|
||||
setTimeout(focus, 20);
|
||||
}
|
||||
else
|
||||
center(lyr3[0], opts.centerX, opts.centerY);
|
||||
};
|
||||
|
||||
// remove the block
|
||||
function remove(el, opts) {
|
||||
var full = el == window;
|
||||
var data = $(el).data('blockUI.history');
|
||||
opts = $.extend(true, {}, $.blockUI.defaults, opts);
|
||||
bind(0, el, opts); // unbind events
|
||||
var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
|
||||
|
||||
if (full)
|
||||
pageBlock = pageBlockEls = null;
|
||||
|
||||
if (opts.fadeOut) {
|
||||
els.fadeOut(opts.fadeOut);
|
||||
setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
|
||||
}
|
||||
else
|
||||
reset(els, data, opts, el);
|
||||
};
|
||||
|
||||
// move blocking element back into the DOM where it started
|
||||
function reset(els,data,opts,el) {
|
||||
els.each(function(i,o) {
|
||||
// remove via DOM calls so we don't lose event handlers
|
||||
if (this.parentNode)
|
||||
this.parentNode.removeChild(this);
|
||||
});
|
||||
if (data && data.el) {
|
||||
data.el.style.display = data.display;
|
||||
data.el.style.position = data.position;
|
||||
data.parent.appendChild(data.el);
|
||||
$(data.el).removeData('blockUI.history');
|
||||
}
|
||||
if (typeof opts.onUnblock == 'function')
|
||||
opts.onUnblock(el,opts);
|
||||
};
|
||||
|
||||
// bind/unbind the handler
|
||||
function bind(b, el, opts) {
|
||||
var full = el == window, $el = $(el);
|
||||
|
||||
// don't bother unbinding if there is nothing to unbind
|
||||
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
|
||||
return;
|
||||
if (!full)
|
||||
$el.data('blockUI.isBlocked', b);
|
||||
|
||||
// bind anchors and inputs for mouse and key events
|
||||
var events = 'mousedown mouseup keydown keypress click';
|
||||
b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
|
||||
|
||||
// former impl...
|
||||
// var $e = $('a,:input');
|
||||
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
|
||||
};
|
||||
|
||||
// event handler to suppress keyboard/mouse events when blocking
|
||||
function handler(e) {
|
||||
// allow tab navigation (conditionally)
|
||||
if (e.keyCode && e.keyCode == 9) {
|
||||
if (pageBlock && e.data.constrainTabKey) {
|
||||
var els = pageBlockEls;
|
||||
var fwd = !e.shiftKey && e.target == els[els.length-1];
|
||||
var back = e.shiftKey && e.target == els[0];
|
||||
if (fwd || back) {
|
||||
setTimeout(function(){focus(back)},10);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// allow events within the message content
|
||||
if ($(e.target).parents('div.blockMsg').length > 0)
|
||||
return true;
|
||||
|
||||
// allow events for content that is not being blocked
|
||||
return $(e.target).parents().children().filter('div.blockUI').length == 0;
|
||||
};
|
||||
|
||||
function focus(back) {
|
||||
if (!pageBlockEls)
|
||||
return;
|
||||
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
|
||||
if (e)
|
||||
e.focus();
|
||||
};
|
||||
|
||||
function center(el, x, y) {
|
||||
var p = el.parentNode, s = el.style;
|
||||
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
|
||||
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
|
||||
if (x) s.left = l > 0 ? (l+'px') : '0';
|
||||
if (y) s.top = t > 0 ? (t+'px') : '0';
|
||||
};
|
||||
|
||||
function sz(el, p) {
|
||||
return parseInt($.css(el,p))||0;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1056
js/jquery.date.picker.js
Normal file
308
js/jquery.dimensions.js
Normal file
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate: 2007-03-04 20:15:11 -0600 (Sun, 04 Mar 2007) $
|
||||
* $Rev: 1485 $
|
||||
*/
|
||||
|
||||
jQuery.fn._height = jQuery.fn.height;
|
||||
jQuery.fn._width = jQuery.fn.width;
|
||||
|
||||
/**
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
* See core docs on height() to see what happens when used on an element.
|
||||
*
|
||||
* @example $("#testdiv").height()
|
||||
* @result 200
|
||||
*
|
||||
* @example $(document).height()
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).height()
|
||||
* @result 400
|
||||
*
|
||||
* @name height
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.height = function() {
|
||||
if ( this[0] == window )
|
||||
return self.innerHeight ||
|
||||
jQuery.boxModel && document.documentElement.clientHeight ||
|
||||
document.body.clientHeight;
|
||||
|
||||
if ( this[0] == document )
|
||||
return Math.max( document.body.scrollHeight, document.body.offsetHeight );
|
||||
|
||||
return this._height(arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* If used on document, returns the document's width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
* See core docs on height() to see what happens when used on an element.
|
||||
*
|
||||
* @example $("#testdiv").width()
|
||||
* @result 200
|
||||
*
|
||||
* @example $(document).width()
|
||||
* @result 800
|
||||
*
|
||||
* @example $(window).width()
|
||||
* @result 400
|
||||
*
|
||||
* @name width
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.width = function() {
|
||||
if ( this[0] == window )
|
||||
return self.innerWidth ||
|
||||
jQuery.boxModel && document.documentElement.clientWidth ||
|
||||
document.body.clientWidth;
|
||||
|
||||
if ( this[0] == document )
|
||||
return Math.max( document.body.scrollWidth, document.body.offsetWidth );
|
||||
|
||||
return this._width(arguments[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner height value (without border) for the first matched element.
|
||||
* If used on document, returns the document's height (innerHeight)
|
||||
* If used on window, returns the viewport's (window) height
|
||||
*
|
||||
* @example $("#testdiv").innerHeight()
|
||||
* @result 800
|
||||
*
|
||||
* @name innerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerHeight = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.height() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetHeight - (parseInt(this.css("borderTopWidth")) || 0) - (parseInt(this.css("borderBottomWidth")) || 0) :
|
||||
this.height() + (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the inner width value (without border) for the first matched element.
|
||||
* If used on document, returns the document's Width (innerWidth)
|
||||
* If used on window, returns the viewport's (window) width
|
||||
*
|
||||
* @example $("#testdiv").innerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name innerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.innerWidth = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.width() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetWidth - (parseInt(this.css("borderLeftWidth")) || 0) - (parseInt(this.css("borderRightWidth")) || 0) :
|
||||
this.height() + (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer height value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerHeight()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerHeight
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerHeight = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.height() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetHeight :
|
||||
this.height() + (parseInt(this.css("borderTopWidth")) || 0) + (parseInt(this.css("borderBottomWidth")) || 0)
|
||||
+ (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the outer width value (including border) for the first matched element.
|
||||
* Cannot be used on document or window.
|
||||
*
|
||||
* @example $("#testdiv").outerWidth()
|
||||
* @result 1000
|
||||
*
|
||||
* @name outerWidth
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.outerWidth = function() {
|
||||
return this[0] == window || this[0] == document ?
|
||||
this.width() :
|
||||
this.css('display') != 'none' ?
|
||||
this[0].offsetWidth :
|
||||
this.height() + (parseInt(this.css("borderLeftWidth")) || 0) + (parseInt(this.css("borderRightWidth")) || 0)
|
||||
+ (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the right (scrollLeft).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollLeft()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollLeft
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollLeft = function() {
|
||||
if ( this[0] == window || this[0] == document )
|
||||
return self.pageXOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollLeft ||
|
||||
document.body.scrollLeft;
|
||||
|
||||
return this[0].scrollLeft;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns how many pixels the user has scrolled to the bottom (scrollTop).
|
||||
* Works on containers with overflow: auto and window/document.
|
||||
*
|
||||
* @example $("#testdiv").scrollTop()
|
||||
* @result 100
|
||||
*
|
||||
* @name scrollTop
|
||||
* @type Number
|
||||
* @cat Plugins/Dimensions
|
||||
*/
|
||||
jQuery.fn.scrollTop = function() {
|
||||
if ( this[0] == window || this[0] == document )
|
||||
return self.pageYOffset ||
|
||||
jQuery.boxModel && document.documentElement.scrollTop ||
|
||||
document.body.scrollTop;
|
||||
|
||||
return this[0].scrollTop;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the location of the element in pixels from the top left corner of the viewport.
|
||||
*
|
||||
* For accurate readings make sure to use pixel values for margins, borders and padding.
|
||||
*
|
||||
* @example $("#testdiv").offset()
|
||||
* @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
|
||||
*
|
||||
* @example $("#testdiv").offset({ scroll: false })
|
||||
* @result { top: 90, left: 90 }
|
||||
*
|
||||
* @example var offset = {}
|
||||
* $("#testdiv").offset({ scroll: false }, offset)
|
||||
* @result offset = { top: 90, left: 90 }
|
||||
*
|
||||
* @name offset
|
||||
* @param Object options A hash of options describing what should be included in the final calculations of the offset.
|
||||
* The options include:
|
||||
* margin: Should the margin of the element be included in the calculations? True by default.
|
||||
* If set to false the margin of the element is subtracted from the total offset.
|
||||
* border: Should the border of the element be included in the calculations? True by default.
|
||||
* If set to false the border of the element is subtracted from the total offset.
|
||||
* padding: Should the padding of the element be included in the calculations? False by default.
|
||||
* If set to true the padding of the element is added to the total offset.
|
||||
* scroll: Should the scroll offsets of the parent elements be included in the calculations?
|
||||
* True by default. When true, it adds the total scroll offsets of all parents to the
|
||||
* total offset and also adds two properties to the returned object, scrollTop and
|
||||
* scrollLeft. If set to false the scroll offsets of parent elements are ignored.
|
||||
* If scroll offsets are not needed, set to false to get a performance boost.
|
||||
* @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
|
||||
* chain will not be broken and the result will be assigned to this object.
|
||||
* @type Object
|
||||
* @cat Plugins/Dimensions
|
||||
* @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*/
|
||||
jQuery.fn.offset = function(options, returnObject) {
|
||||
var x = 0, y = 0, elem = this[0], parent = this[0], op, sl = 0, st = 0, options = jQuery.extend({ margin: true, border: true, padding: false, scroll: true }, options || {});
|
||||
do {
|
||||
x += parent.offsetLeft || 0;
|
||||
y += parent.offsetTop || 0;
|
||||
|
||||
// Mozilla and IE do not add the border
|
||||
if (jQuery.browser.mozilla || jQuery.browser.msie) {
|
||||
// get borders
|
||||
var bt = parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
var bl = parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
|
||||
// add borders to offset
|
||||
x += bl;
|
||||
y += bt;
|
||||
|
||||
// Mozilla removes the border if the parent has overflow property other than visible
|
||||
if (jQuery.browser.mozilla && parent != elem && jQuery.css(parent, 'overflow') != 'visible') {
|
||||
x += bl;
|
||||
y += bt;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.scroll) {
|
||||
// Need to get scroll offsets in-between offsetParents
|
||||
op = parent.offsetParent;
|
||||
do {
|
||||
sl += parent.scrollLeft || 0;
|
||||
st += parent.scrollTop || 0;
|
||||
|
||||
parent = parent.parentNode;
|
||||
|
||||
// Mozilla removes the border if the parent has overflow property other than visible
|
||||
if (jQuery.browser.mozilla && parent != elem && parent != op && jQuery.css(parent, 'overflow') != 'visible') {
|
||||
y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
|
||||
x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
|
||||
}
|
||||
} while (parent != op);
|
||||
} else
|
||||
parent = parent.offsetParent;
|
||||
|
||||
if (parent && (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html')) {
|
||||
// Safari doesn't add the body margin for elments positioned with static or relative
|
||||
if ((jQuery.browser.safari || (jQuery.browser.msie && jQuery.boxModel)) && jQuery.css(parent, 'position') != 'absolute') {
|
||||
x += parseInt(jQuery.css(op, 'marginLeft')) || 0;
|
||||
y += parseInt(jQuery.css(op, 'marginTop')) || 0;
|
||||
}
|
||||
break; // Exit the loop
|
||||
}
|
||||
} while (parent);
|
||||
|
||||
if ( !options.margin) {
|
||||
x -= parseInt(jQuery.css(elem, 'marginLeft')) || 0;
|
||||
y -= parseInt(jQuery.css(elem, 'marginTop')) || 0;
|
||||
}
|
||||
|
||||
// Safari and Opera do not add the border for the element
|
||||
if ( options.border && (jQuery.browser.safari || jQuery.browser.opera) ) {
|
||||
x += parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
|
||||
y += parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
|
||||
} else if ( !options.border && !(jQuery.browser.safari || jQuery.browser.opera) ) {
|
||||
x -= parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
|
||||
y -= parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
|
||||
}
|
||||
|
||||
if ( options.padding ) {
|
||||
x += parseInt(jQuery.css(elem, 'paddingLeft')) || 0;
|
||||
y += parseInt(jQuery.css(elem, 'paddingTop')) || 0;
|
||||
}
|
||||
|
||||
// Opera thinks offset is scroll offset for display: inline elements
|
||||
if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {
|
||||
sl -= elem.scrollLeft || 0;
|
||||
st -= elem.scrollTop || 0;
|
||||
}
|
||||
|
||||
var returnValue = options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl }
|
||||
: { top: y, left: x };
|
||||
|
||||
if (returnObject) { jQuery.extend(returnObject, returnValue); return this; }
|
||||
else { return returnValue; }
|
||||
};
|
||||
1
js/jquery.history_remote.pack.js
Normal file
@@ -0,0 +1 @@
|
||||
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(4($){$.H=1f 4(){3 h=\'19\';3 6=7.2;3 F=U;3 l;b.n=4(){};3 C=4(){$(\'.s-p\').1a()};$(9).Q(h,C);5($.y.1b){3 u,m=q;$(4(){u=$(\'<8 1s="1c: 1d;"></8>\').L(9.M).1e(0);3 8=u.E.9;8.V();8.R();5(6&&6!=\'#\'){8.7.2=6.S(\'#\',\'\')}});b.n=4(2){6=2;3 8=u.E.9;8.V();8.R();8.7.2=2.S(\'#\',\'\')};l=4(){3 8=u.E.9;3 k=8.7.2;5(k!=6){6=k;5(k&&k!=\'#\'){$(\'a[@d$="\'+k+\'"]\').f();7.2=k}g 5(m){7.2=\'\';$(9).A(h)}}m=B}}g 5($.y.1g||$.y.1h){b.n=4(2){6=2};l=4(){5(7.2){5(6!=7.2){6=7.2;$(\'a[@d$="\'+6+\'"]\').f()}}g 5(6){6=\'\';$(9).A(h)}}}g 5($.y.1i){3 c,o,x;$(4(){c=[];c.j=z.j;o=[]});3 r=q,m=q;x=4(2){c.Z(2);o.j=0;r=q};b.n=4(2){6=2;x(6)};l=4(){3 t=z.j-c.j;5(t){r=q;5(t<0){X(3 i=0;i<1j.1k(t);i++)o.1m(c.1n())}g{X(3 i=0;i<t;i++)c.Z(o.11())}3 K=c[c.j-1];$(\'a[@d$="\'+K+\'"]\').f();6=7.2}g 5(c[c.j-1]==T&&!r){5(9.N.13(\'#\')>=0){$(\'a[@d$="\'+\'#\'+9.N.14(\'#\')[1]+\'"]\').f()}g 5(m){$(9).A(h)}r=B}m=B}}b.16=4(D){5(W D==\'4\'){$(9).18(h,C).Q(h,D)}5(7.2&&W x==\'T\'){$(\'a.s[@d$="\'+7.2+\'"]\').f()}5(l&&F==U){F=1l(l,1p)}}};$.I.s=4(p,v){v=$.1q({P:\'s-\'},v||{});3 G=$(p).12()&&$(p)||$(\'<J></J>\').L(\'M\');G.15(\'s-p\');O b.17(4(i){3 10=b.d;3 2=\'#\'+v.P+(i+1);b.d=2;$(b).f(4(e){3 w=e.Y;G.1o(10,4(){5(w){$.H.n(2)}})})})};$.I.z=4(){O b.f(4(e){3 w=e.Y;5(w){$.H.n(b.2)}})}})(1r);',62,91,'||hash|var|function|if|_currentHash|location|iframe|document||this|_backStack|href||click|else|RESET_EVENT||length|iframeHash|_observeHistory|initialized|update|_forwardStack|output|false|isFirst|remote|historyDelta|_historyIframe|settings|trueClick|_addHistory|browser|history|trigger|true|_defaultReset|callback|contentWindow|_intervalId|target|ajaxHistory|fn|div|cachedHash|appendTo|body|URL|return|hashPrefix|bind|close|replace|undefined|null|open|typeof|for|clientX|push|remoteURL|shift|size|indexOf|split|addClass|initialize|each|unbind|historyReset|empty|msie|display|none|get|new|mozilla|opera|safari|Math|abs|setInterval|unshift|pop|load|200|extend|jQuery|style'.split('|'),0,{}))
|
||||
435
js/jquery.jdMenu.js
Normal file
@@ -0,0 +1,435 @@
|
||||
/*
|
||||
* jdMenu 1.3.beta2 (2007-03-06)
|
||||
*
|
||||
* Copyright (c) 2006,2007 Jonathan Sharp (http://jdsharp.us)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://jdsharp.us/
|
||||
*
|
||||
* Built upon jQuery 1.1.1 (http://jquery.com)
|
||||
* This also requires the jQuery dimensions plugin
|
||||
*/
|
||||
(function($){
|
||||
// This will store an element list of all our menu objects
|
||||
var jdMenu = [];
|
||||
|
||||
// Public methods
|
||||
$.fn.jdMenu = function(inSettings) {
|
||||
var settings = $.extend({}, arguments.callee.defaults, inSettings);
|
||||
return this.each(function() {
|
||||
jdMenu.push(this);
|
||||
$(this).addClass('jd_menu_flag_root');
|
||||
this.$settings = $.extend({}, settings, {isVerticalMenu: $(this).is('.jd_menu_vertical')});
|
||||
addEvents(this);
|
||||
});
|
||||
};
|
||||
$.fn.jdMenuShow = function() {
|
||||
return this.each(function() {
|
||||
showMenuLI.apply(this);
|
||||
});
|
||||
};
|
||||
$.fn.jdMenuHide = function() {
|
||||
return this.each(function() {
|
||||
hideMenuUL.apply(this);
|
||||
});
|
||||
};
|
||||
|
||||
// Private methods and logic
|
||||
$(window)
|
||||
// Bind a click event to hide all visible menus when the document is clicked
|
||||
.bind('click', function(){
|
||||
$(jdMenu).find('ul:visible').jdMenuHide();
|
||||
})
|
||||
// Cleanup after ourself by nulling the $settings object
|
||||
.bind('unload', function() {
|
||||
$(jdMenu).each(function() {
|
||||
this.$settings = null;
|
||||
});
|
||||
});
|
||||
|
||||
// These are our default settings for this plugin
|
||||
$.fn.jdMenu.defaults = {
|
||||
activateDelay: 750,
|
||||
showDelay: 150,
|
||||
hideDelay: 550,
|
||||
onShow: null,
|
||||
onHideCheck: null,
|
||||
onHide: null,
|
||||
onAnimate: null,
|
||||
onClick: null,
|
||||
offsetX: 4,
|
||||
offsetY: 2,
|
||||
iframe: $.browser.msie
|
||||
};
|
||||
|
||||
// Our special parentsUntil method to get all parents up to and including the matched element
|
||||
$.fn.parentsUntil = function(match) {
|
||||
var a = [];
|
||||
$(this[0]).parents().each(function() {
|
||||
a.push(this);
|
||||
return !$(this).is(match);
|
||||
});
|
||||
return this.pushStack(a, arguments);
|
||||
};
|
||||
|
||||
// Returns our settings object for this menu
|
||||
function getSettings(el) {
|
||||
return $(el).parents('ul.jd_menu_flag_root')[0].$settings;
|
||||
}
|
||||
|
||||
// Unbind any events and then rebind them
|
||||
function addEvents(ul) {
|
||||
removeEvents(ul);
|
||||
$('> li', ul)
|
||||
.hover(hoverOverLI, hoverOutLI)
|
||||
.bind('click', itemClick)
|
||||
.find('> a.accessible')
|
||||
.bind('click', accessibleClick);
|
||||
};
|
||||
|
||||
// Remove all events for this menu
|
||||
function removeEvents(ul) {
|
||||
$('> li', ul)
|
||||
.unbind('mouseover').unbind('mouseout')
|
||||
.unbind('click')
|
||||
.find('> a.accessible')
|
||||
.unbind('click');
|
||||
};
|
||||
|
||||
function hoverOverLI() {
|
||||
var cls = 'jd_menu_hover' + ($(this).parent().is('.jd_menu_flag_root') ? '_menubar' : '');
|
||||
$(this).addClass(cls).find('> a').addClass(cls);
|
||||
|
||||
if (this.$timer) {
|
||||
clearTimeout(this.$timer);
|
||||
}
|
||||
|
||||
// Do we have a sub menu?
|
||||
if ($('> ul', this).size() > 0) {
|
||||
var settings = getSettings(this);
|
||||
|
||||
// Which delay to use, the longer activate one or the shorter show delay if a menu is already visible
|
||||
var delay = ($(this).parents('ul.jd_menu_flag_root').find('ul:visible').size() == 0)
|
||||
? settings.activateDelay : settings.showDelay;
|
||||
var t = this;
|
||||
this.$timer = setTimeout(function() {
|
||||
showMenuLI.apply(t);
|
||||
}, delay);
|
||||
}
|
||||
};
|
||||
|
||||
function hoverOutLI() {
|
||||
// Remove both classes so we do not have to test which one we are
|
||||
$(this) .removeClass('jd_menu_hover').removeClass('jd_menu_hover_menubar')
|
||||
.find('> a')
|
||||
.removeClass('jd_menu_hover').removeClass('jd_menu_hover_menubar');
|
||||
|
||||
if (this.$timer) {
|
||||
clearTimeout(this.$timer);
|
||||
}
|
||||
|
||||
// TODO: Possible bug with our test for visibility in that parent menus are hidden child menus are not
|
||||
|
||||
// If we have a visible menu, hide it
|
||||
if ($(this).is(':visible') && $('> ul', this).size() > 0) {
|
||||
var settings = getSettings(this);
|
||||
var ul = $('> ul', this)[0];
|
||||
this.$timer = setTimeout(function() {
|
||||
hideMenuUL.apply(ul);
|
||||
}, settings.hideDelay);
|
||||
}
|
||||
};
|
||||
|
||||
// "this" is a reference to the LI element that contains
|
||||
// the UL that will be shown
|
||||
function showMenuLI() {
|
||||
var ul = $('> ul', this).get(0);
|
||||
// We are already visible, just return
|
||||
if ($(ul).is(':visible')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear our timer if it exists
|
||||
if (this.$timer) {
|
||||
clearTimeout(this.$timer);
|
||||
}
|
||||
|
||||
// Get our settings object
|
||||
var settings = getSettings(this);
|
||||
|
||||
// Call our callback
|
||||
if (settings.onShow != null && settings.onShow.apply(this) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add hover classes, needed for accessible functionality
|
||||
var isRoot = $(this).parent().is('.jd_menu_flag_root');
|
||||
var c = 'jd_menu_active' + (isRoot ? '_menubar' : '');
|
||||
$(this).addClass(c).find('> a').addClass(c);
|
||||
|
||||
if (!isRoot) {
|
||||
// Add the active class to the parent list item which maybe our menubar
|
||||
var c = 'jd_menu_active' + ($(this).parent().parent().parent().is('.jd_menu_flag_root') ? '_menubar' : '');
|
||||
$(this).parent().parent().addClass(c).find('> a').addClass(c);
|
||||
}
|
||||
|
||||
// Hide any existing menues at the same level
|
||||
$(this).parent().find('> li > ul:visible').not(ul).each(function() {
|
||||
hideMenuUL.apply(this);
|
||||
});
|
||||
|
||||
addEvents(ul);
|
||||
|
||||
// Our range object is used in calculating menu positions
|
||||
var Range = function(x1, x2, y1, y2) {
|
||||
this.x1 = x1;
|
||||
this.x2 = x2;
|
||||
this.y1 = y1;
|
||||
this.y2 = y2;
|
||||
}
|
||||
Range.prototype.contains = function(range) {
|
||||
return (this.x1 <= range.x1 && range.x2 <= this.x2)
|
||||
&&
|
||||
(this.y1 <= range.y1 && range.y2 <= this.y2);
|
||||
}
|
||||
Range.prototype.transform = function(x, y) {
|
||||
return new Range(this.x1 + x, this.x2 + x, this.y1 + y, this.y2 + y);
|
||||
}
|
||||
Range.prototype.nudgeX = function(range) {
|
||||
if (this.x1 < range.x1) {
|
||||
return new Range(range.x1, range.x1 + (this.x2 - this.x1), this.y1, this.y2);
|
||||
} else if (this.x2 > range.x2) {
|
||||
return new Range(range.x2 - (this.x2 - this.x1), range.x2, this.y1, this.y2);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
Range.prototype.nudgeY = function(range) {
|
||||
if (this.y1 < range.y1) {
|
||||
return new Range(this.x1, this.x2, range.y1, range.y1 + (this.y2 - this.y1));
|
||||
} else if (this.y2 > range.y2) {
|
||||
return new Range(this.x1, this.x2, range.y2 - (this.y2 - this.y1), range.y2);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// window width & scroll offset
|
||||
var sx = $(window).scrollLeft()
|
||||
var sy = $(window).scrollTop();
|
||||
var ww = $(window).innerWidth();
|
||||
var wh = $(window).innerHeight();
|
||||
|
||||
var viewport = new Range( sx, sx + ww,
|
||||
sy, sy + wh);
|
||||
|
||||
// "Show" our menu so we can calculate its width, set left and top so that it does not accidentally
|
||||
// go offscreen and trigger browser scroll bars
|
||||
$(ul).css({visibility: 'hidden', left: 0, top: 0}).show();
|
||||
|
||||
var menuWidth = $(ul).outerWidth();
|
||||
var menuHeight = $(ul).outerHeight();
|
||||
|
||||
// Get the LI parent UL outerwidth in case borders are applied to it
|
||||
var tp = $(this).parent();
|
||||
var thisWidth = tp.outerWidth();
|
||||
var thisBorderWidth = parseInt(tp.css('borderLeftWidth')) + parseInt(tp.css('borderRightWidth'));
|
||||
//var thisBorderTop = parseInt(tp.css('borderTopWidth'));
|
||||
var thisHeight = $(this).outerHeight();
|
||||
var thisOffset = $(this).offset({border: false});
|
||||
|
||||
$(ul).hide().css({visibility: ''});
|
||||
|
||||
// We define a list of valid positions for our menu and then test against them to find one that works best
|
||||
var position = [];
|
||||
// Bottom Horizontal
|
||||
// Menu is directly below and left edges aligned to parent item
|
||||
position[0] = new Range(thisOffset.left, thisOffset.left + menuWidth,
|
||||
thisOffset.top + thisHeight, thisOffset.top + thisHeight + menuHeight);
|
||||
// Menu is directly below and right edges aligned to parent item
|
||||
position[1] = new Range((thisOffset.left + thisWidth) - menuWidth, thisOffset.left + thisWidth,
|
||||
position[0].y1, position[0].y2);
|
||||
// Menu is "nudged" horizontally below parent item
|
||||
position[2] = position[0].nudgeX(viewport);
|
||||
|
||||
// Right vertical
|
||||
// Menu is directly right and top edge aligned to parent item
|
||||
position[3] = new Range(thisOffset.left + thisWidth - thisBorderWidth, thisOffset.left + thisWidth - thisBorderWidth + menuWidth,
|
||||
thisOffset.top, thisOffset.top + menuHeight);
|
||||
// Menu is directly right and bottom edges aligned with parent item
|
||||
position[4] = new Range(position[3].x1, position[3].x2,
|
||||
position[0].y1 - menuHeight, position[0].y1);
|
||||
// Menu is "nudged" vertically to right of parent item
|
||||
position[5] = position[3].nudgeY(viewport);
|
||||
|
||||
// Top Horizontal
|
||||
// Menu is directly top and left edges aligned to parent item
|
||||
position[6] = new Range(thisOffset.left, thisOffset.left + menuWidth,
|
||||
thisOffset.top - menuHeight, thisOffset.top);
|
||||
// Menu is directly top and right edges aligned to parent item
|
||||
position[7] = new Range((thisOffset.left + thisWidth) - menuWidth, thisOffset.left + thisWidth,
|
||||
position[6].y1, position[6].y2);
|
||||
// Menu is "nudged" horizontally to the top of parent item
|
||||
position[8] = position[6].nudgeX(viewport);
|
||||
|
||||
// Left vertical
|
||||
// Menu is directly left and top edges aligned to parent item
|
||||
position[9] = new Range(thisOffset.left - menuWidth, thisOffset.left,
|
||||
position[3].y1, position[3].y2);
|
||||
// Menu is directly left and bottom edges aligned to parent item
|
||||
position[10]= new Range(position[9].x1, position[9].x2,
|
||||
position[4].y1 + thisHeight - menuHeight, position[4].y1 + thisHeight);
|
||||
// Menu is "nudged" vertically to left of parent item
|
||||
position[11]= position[10].nudgeY(viewport);
|
||||
|
||||
// This defines the order in which we test our positions
|
||||
var order = [];
|
||||
if ($(this).parent().is('.jd_menu_flag_root') && !settings.isVerticalMenu) {
|
||||
order = [0, 1, 2, 6, 7, 8, 5, 11];
|
||||
} else {
|
||||
order = [3, 4, 5, 9, 10, 11, 0, 1, 2, 6, 7, 8];
|
||||
}
|
||||
|
||||
// Set our default position (first position) if no others can be found
|
||||
var pos = order[0];
|
||||
for (var i = 0, j = order.length; i < j; i++) {
|
||||
// If this position for our menu is within the viewport of the browser, use this position
|
||||
if (viewport.contains(position[order[i]])) {
|
||||
pos = order[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
var menuPosition = position[pos];
|
||||
|
||||
// Find if we are absolutely positioned or have an absolutely positioned parent
|
||||
$(this).add($(this).parents()).each(function() {
|
||||
if ($(this).css('position') == 'absolute') {
|
||||
var abs = $(this).offset();
|
||||
// Transform our coordinates to be relative to the absolute parent
|
||||
menuPosition = menuPosition.transform(-abs.left, -abs.top);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
switch (pos) {
|
||||
case 3:
|
||||
menuPosition.y1 += settings.offsetY;
|
||||
case 4:
|
||||
menuPosition.x1 -= settings.offsetX;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
menuPosition.y1 += settings.offsetY;
|
||||
case 10:
|
||||
menuPosition.x1 += settings.offsetX;
|
||||
break;
|
||||
}
|
||||
|
||||
if (settings.iframe) {
|
||||
$(ul).bgiframe();
|
||||
}
|
||||
|
||||
if (settings.onAnimate) {
|
||||
$(ul).css({left: menuPosition.x1, top: menuPosition.y1});
|
||||
// The onAnimate method is expected to "show" the element it is passed
|
||||
settings.onAnimate.apply(ul, [true]);
|
||||
} else {
|
||||
$(ul).css({left: menuPosition.x1, top: menuPosition.y1}).show();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// "this" is a reference to a UL menu to be hidden
|
||||
function hideMenuUL(recurse) {
|
||||
if (!$(this).is(':visible')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var settings = getSettings(this);
|
||||
|
||||
// Test if this menu should get hidden
|
||||
if (settings.onHideCheck != null && settings.onHideCheck.apply(this) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hide all of our child menus first
|
||||
$('> li ul:visible', this).each(function() {
|
||||
hideMenuUL.apply(this, [false]);
|
||||
});
|
||||
|
||||
// If we are the root, do not hide ourself
|
||||
if ($(this).is('.jd_menu_flag_root')) {
|
||||
alert('We are root');
|
||||
return false;
|
||||
}
|
||||
|
||||
var elms = $('> li', this).add($(this).parent());
|
||||
elms.removeClass('jd_menu_hover').removeClass('jd_menu_hover_menubar')
|
||||
.removeClass('jd_menu_active').removeClass('jd_menu_active_menubar')
|
||||
.find('> a')
|
||||
.removeClass('jd_menu_hover').removeClass('jd_menu_hover_menubar')
|
||||
.removeClass('jd_menu_active').removeClass('jd_menu_active_menubar');
|
||||
|
||||
removeEvents(this);
|
||||
$(this).each(function() {
|
||||
if (settings.onAnimate != null) {
|
||||
settings.onAnimate.apply(this, [false]);
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
}).find('> .bgiframe').remove();
|
||||
// Our callback for after our menu is hidden
|
||||
if (settings.onHide != null) {
|
||||
settings.onHide.apply(this);
|
||||
}
|
||||
|
||||
// Recursively hide our parent menus
|
||||
if (recurse == true) {
|
||||
$(this).parentsUntil('ul.jd_menu_flag_root')
|
||||
.removeClass('jd_menu_hover').removeClass('jd_menu_hover_menubar')
|
||||
.not('.jd_menu_flag_root').filter('ul')
|
||||
.each(function() {
|
||||
hideMenuUL.apply(this, [false]);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prevent the default (usually following a link)
|
||||
function accessibleClick(e) {
|
||||
if ($(this).is('.accessible')) {
|
||||
// Stop the browser from the default link action allowing the
|
||||
// click event to propagate to propagate to our LI (itemClick function)
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger a menu click
|
||||
function itemClick(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
var settings = getSettings(this);
|
||||
if (settings.onClick != null && settings.onClick.apply(this) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($('> ul', this).size() > 0) {
|
||||
showMenuLI.apply(this);
|
||||
} else {
|
||||
if (e.target == this) {
|
||||
var link = $('> a', e.target).not('.accessible');
|
||||
if (link.size() > 0) {
|
||||
var a = link.get(0);
|
||||
if (!a.onclick) {
|
||||
window.open(a.href, a.target || '_self');
|
||||
} else {
|
||||
$(a).click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hideMenuUL.apply($(this).parent(), [true]);
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
3549
js/jquery.latest.js
Normal file
1
js/jquery.pack.js
Normal file
426
js/jquery.tablehover.js
Normal file
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
* jQuery tableHover plugin
|
||||
* Version: 0.1.3
|
||||
*
|
||||
* Copyright (c) 2007 Roman Weich
|
||||
* http://p.sohei.org
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses
|
||||
* (This means that you can choose the license that best suits your project, and use it accordingly):
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Changelog:
|
||||
* v 0.1.3 - 2007-09-04
|
||||
* - fix: highlight did not work when the hovered table cell had child elements inside
|
||||
* v 0.1.2 - 2007-08-13
|
||||
* - fix/change: changed event binding routine, as is got really slow with jquery 1.1.3.1
|
||||
* -change: added new option "ignoreCols", through which columns can be excluded from the highlighting process
|
||||
* v 0.1.1 - 2007-06-05
|
||||
* - fix: errors when using the plugin on a table not having a theader or tfoot
|
||||
* v 0.1.0 - 2007-05-31
|
||||
*/
|
||||
|
||||
(function($)
|
||||
{
|
||||
/**
|
||||
* Calculates the actual cellIndex value of all cells in the table and stores it in the realCell property of each cell.
|
||||
* Thats done because the cellIndex value isn't correct when colspans or rowspans are used.
|
||||
* Originally created by Matt Kruse for his table library - Big Thanks! (see http://www.javascripttoolbox.com/)
|
||||
* @param {element} table The table element.
|
||||
*/
|
||||
var fixCellIndexes = function(table)
|
||||
{
|
||||
var rows = table.rows;
|
||||
var len = rows.length;
|
||||
var matrix = [];
|
||||
for ( var i = 0; i < len; i++ )
|
||||
{
|
||||
var cells = rows[i].cells;
|
||||
var clen = cells.length;
|
||||
for ( var j = 0; j < clen; j++ )
|
||||
{
|
||||
var c = cells[j];
|
||||
var rowSpan = c.rowSpan || 1;
|
||||
var colSpan = c.colSpan || 1;
|
||||
var firstAvailCol = -1;
|
||||
if ( !matrix[i] )
|
||||
{
|
||||
matrix[i] = [];
|
||||
}
|
||||
var m = matrix[i];
|
||||
// Find first available column in the first row
|
||||
while ( m[++firstAvailCol] ) {}
|
||||
c.realIndex = firstAvailCol;
|
||||
for ( var k = i; k < i + rowSpan; k++ )
|
||||
{
|
||||
if ( !matrix[k] )
|
||||
{
|
||||
matrix[k] = [];
|
||||
}
|
||||
var matrixrow = matrix[k];
|
||||
for ( var l = firstAvailCol; l < firstAvailCol + colSpan; l++ )
|
||||
{
|
||||
matrixrow[l] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the rowIndex of each row in the table.
|
||||
* Opera seems to get that wrong using document order instead of logical order on the tfoot-tbody part.
|
||||
* @param {element} table The table element.
|
||||
*/
|
||||
var fixRowIndexes = function(tbl)
|
||||
{
|
||||
var v = 0, i, k, r = ( tbl.tHead ) ? tbl.tHead.rows : 0;
|
||||
if ( r )
|
||||
{
|
||||
for ( i = 0; i < r.length; i++ )
|
||||
{
|
||||
r[i].realRIndex = v++;
|
||||
}
|
||||
}
|
||||
for ( k = 0; k < tbl.tBodies.length; k++ )
|
||||
{
|
||||
r = tbl.tBodies[k].rows;
|
||||
if ( r )
|
||||
{
|
||||
for ( i = 0; i < r.length; i++ )
|
||||
{
|
||||
r[i].realRIndex = v++;
|
||||
}
|
||||
}
|
||||
}
|
||||
r = ( tbl.tFoot ) ? tbl.tFoot.rows : 0;
|
||||
if ( r )
|
||||
{
|
||||
for ( i = 0; i < r.length; i++ )
|
||||
{
|
||||
r[i].realRIndex = v++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Highlights table rows and/or columns on mouse over.
|
||||
* Fixes the highlight of the currently highlighted rows/columns on click.
|
||||
* Works on tables with rowspans and colspans.
|
||||
*
|
||||
* @param {map} options An object for optional settings (options described below).
|
||||
*
|
||||
* @option {boolean} allowHead Allow highlighting when hovering over the table header.
|
||||
* Default value: true
|
||||
* @option {boolean} allowBody Allow highlighting when hovering over the table body.
|
||||
* Default value: true
|
||||
* @option {boolean} allowFoot Allow highlighting when hovering over the table footer.
|
||||
* Default value: true
|
||||
*
|
||||
* @option {boolean} headRows If true the rows in the table header will be highlighted when hovering over them.
|
||||
* Default value: false
|
||||
* @option {boolean} bodyRows If true the rows in the table body will be highlighted when hovering over them.
|
||||
* Default value: true
|
||||
* @option {boolean} footRows If true the rows in the table footer will be highlighted when hovering over them.
|
||||
* Default value: false
|
||||
* @option {boolean} spanRows When hovering over a cell spanning over more than one row, highlight all spanned rows.
|
||||
* Default value: true
|
||||
*
|
||||
* @option {boolean} headCols If true the cells in the table header (matching the currently hovered column) will be highlighted.
|
||||
* Default value: false
|
||||
* @option {boolean} bodyCols If true the cells in the table body (matching the currently hovered column) will be highlighted.
|
||||
* Default value: true
|
||||
* @option {boolean} footCols If true the cells in the table footer (matching the currently hovered column) will be highlighted.
|
||||
* Default value: false
|
||||
* @option {boolean} spanCols When hovering over a cell spanning over more than one column, highlight all spanned columns.
|
||||
* Default value: true
|
||||
* @option {array} ignoreCols An array of numbers. Each column with the matching column index won't be included in the highlighting process.
|
||||
* Index starting at 1!
|
||||
* Default value: [] (empty array)
|
||||
*
|
||||
* @option {boolean} headCells Set a special highlight class to the cell the mouse pointer is currently pointing at (inside the table header only).
|
||||
* Default value: false
|
||||
* @option {boolean} bodyCells Set a special highlight class to the cell the mouse pointer is currently pointing at (inside the table body only).
|
||||
* Default value: true
|
||||
* @option {boolean} footCells Set a special highlight class to the cell the mouse pointer is currently pointing at (inside the table footer only).
|
||||
* Default value: false
|
||||
*
|
||||
* @option {string} rowClass The css class set to the currently highlighted row.
|
||||
* Default value: 'hover'
|
||||
* @option {string} colClass The css class set to the currently highlighted column.
|
||||
* Default value: '' (empty string)
|
||||
* @option {string} cellClass The css class set to the currently highlighted cell.
|
||||
* Default value: '' (empty string)
|
||||
* @option {string} clickClass The css class set to the currently highlighted row and column on mouse click.
|
||||
* Default value: '' (empty string)
|
||||
*
|
||||
* @example $('#table').tableHover({});
|
||||
* @desc Add simple row highlighting to #table with default settings.
|
||||
*
|
||||
* @example $('#table').tableHover({rowClass: "someclass", colClass: "someotherclass"});
|
||||
* @desc Add row and columnhighlighting to #table and set the specified css classes to the highlighted cells.
|
||||
*
|
||||
* @example $('#table').tableHover({clickClass: "someclickclass"});
|
||||
* @desc Add simple row highlighting to #table and set the specified css class on the cells when clicked.
|
||||
*
|
||||
* @example $('#table').tableHover({allowBody: false, allowFoot: false, allowHead: true, colClass: "someclass"});
|
||||
* @desc Add column highlighting on #table only highlighting the cells when hovering over the table header.
|
||||
*
|
||||
* @example $('#table').tableHover({bodyCols: false, footCols: false, headCols: true, colClass: "someclass"});
|
||||
* @desc Add column highlighting on #table only for the cells in the header.
|
||||
*
|
||||
* @type jQuery
|
||||
*
|
||||
* @name tableHover
|
||||
* @cat Plugins/tableHover
|
||||
* @author Roman Weich (http://p.sohei.org)
|
||||
*/
|
||||
$.fn.tableHover = function(options)
|
||||
{
|
||||
var settings = $.extend({
|
||||
allowHead : true,
|
||||
allowBody : true,
|
||||
allowFoot : true,
|
||||
|
||||
headRows : false,
|
||||
bodyRows : true,
|
||||
footRows : false,
|
||||
spanRows : true,
|
||||
|
||||
headCols : false,
|
||||
bodyCols : true,
|
||||
footCols : false,
|
||||
spanCols : true,
|
||||
ignoreCols : [],
|
||||
|
||||
headCells : false,
|
||||
bodyCells : true,
|
||||
footCells : false,
|
||||
//css classes,,
|
||||
rowClass : 'hover',
|
||||
colClass : '',
|
||||
cellClass : '',
|
||||
clickClass : ''
|
||||
}, options);
|
||||
|
||||
return this.each(function()
|
||||
{
|
||||
var colIndex = [], rowIndex = [], tbl = this, r, rCnt = 0, lastClick = [-1, -1];
|
||||
|
||||
if ( !tbl.tBodies || !tbl.tBodies.length )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all rows and each of their cells to the row and column indexes.
|
||||
* @param {array} rows An array of table row elements to add.
|
||||
* @param {string} nodeName Defines whether the rows are in the header, body or footer of the table.
|
||||
*/
|
||||
var addToIndex = function(rows, nodeName)
|
||||
{
|
||||
var c, row, rowI, cI, rI, s;
|
||||
//loop through the rows
|
||||
for ( rowI = 0; rowI < rows.length; rowI++, rCnt++ )
|
||||
{
|
||||
row = rows[rowI];
|
||||
//each cell
|
||||
for ( cI = 0; cI < row.cells.length; cI++ )
|
||||
{
|
||||
c = row.cells[cI];
|
||||
//add to rowindex
|
||||
if ( (nodeName == 'TBODY' && settings.bodyRows)
|
||||
|| (nodeName == 'TFOOT' && settings.footRows)
|
||||
|| (nodeName == 'THEAD' && settings.headRows) )
|
||||
{
|
||||
s = c.rowSpan;
|
||||
while ( --s >= 0 )
|
||||
{
|
||||
rowIndex[rCnt + s].push(c);
|
||||
}
|
||||
}
|
||||
//add do colindex
|
||||
if ( (nodeName == 'TBODY' && settings.bodyCols)
|
||||
|| (nodeName == 'THEAD' && settings.headCols)
|
||||
|| (nodeName == 'TFOOT' && settings.footCols) )
|
||||
{
|
||||
s = c.colSpan;
|
||||
while ( --s >= 0 )
|
||||
{
|
||||
rI = c.realIndex + s;
|
||||
if ( $.inArray(rI + 1, settings.ignoreCols) > -1 )
|
||||
{
|
||||
break;//dont highlight the columns in the ignoreCols array
|
||||
}
|
||||
if ( !colIndex[rI] )
|
||||
{
|
||||
colIndex[rI] = [];
|
||||
}
|
||||
colIndex[rI].push(c);
|
||||
}
|
||||
}
|
||||
//allow hover for the cell?
|
||||
if ( (nodeName == 'TBODY' && settings.allowBody)
|
||||
|| (nodeName == 'THEAD' && settings.allowHead)
|
||||
|| (nodeName == 'TFOOT' && settings.allowFoot) )
|
||||
{
|
||||
c.thover = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouseover event handling. Set the highlight to the rows/cells.
|
||||
*/
|
||||
var over = function(e)
|
||||
{
|
||||
var p = e.target;
|
||||
while ( p != this && p.thover !== true )
|
||||
{
|
||||
p = p.parentNode;
|
||||
}
|
||||
if ( p.thover === true )
|
||||
{
|
||||
highlight(p, true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouseout event handling. Remove the highlight from the rows/cells.
|
||||
*/
|
||||
var out = function(e)
|
||||
{
|
||||
var p = e.target;
|
||||
while ( p != this && p.thover !== true )
|
||||
{
|
||||
p = p.parentNode;
|
||||
}
|
||||
if ( p.thover === true )
|
||||
{
|
||||
highlight(p, false);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mousedown event handling. Sets or removes the clickClass css style to the currently highlighted rows/cells.
|
||||
*/
|
||||
var click = function(e)
|
||||
{
|
||||
if ( e.target.thover && settings.clickClass != '' )
|
||||
{
|
||||
var x = e.target.realIndex, y = e.target.parentNode.realRIndex, s = '';
|
||||
//unclick
|
||||
$('td.' + settings.clickClass + ', th.' + settings.clickClass, tbl).removeClass(settings.clickClass);
|
||||
if ( x != lastClick[0] || y != lastClick[1] )
|
||||
{
|
||||
//click..
|
||||
if ( settings.rowClass != '' )
|
||||
{
|
||||
s += ',.' + settings.rowClass;
|
||||
}
|
||||
if ( settings.colClass != '' )
|
||||
{
|
||||
s += ',.' + settings.colClass;
|
||||
}
|
||||
if ( settings.cellClass != '' )
|
||||
{
|
||||
s += ',.' + settings.cellClass;
|
||||
}
|
||||
if ( s != '' )
|
||||
{
|
||||
$('td, th', tbl).filter(s.substring(1)).addClass(settings.clickClass);
|
||||
}
|
||||
lastClick = [x, y];
|
||||
}
|
||||
else
|
||||
{
|
||||
lastClick = [-1, -1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds or removes the highlight to/from the columns and rows.
|
||||
* @param {element} cell The cell with the mouseover/mouseout event.
|
||||
* @param {boolean} on Defines whether the style will be set or removed.
|
||||
*/
|
||||
var highlight = function(cell, on)
|
||||
{
|
||||
if ( on ) //create dummy funcs - dont want to test for on==true all the time
|
||||
{
|
||||
$.fn.tableHoverHover = $.fn.addClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
$.fn.tableHoverHover = $.fn.removeClass;
|
||||
}
|
||||
//highlight columns
|
||||
var h = colIndex[cell.realIndex] || [], rH = [], i = 0, rI, nn;
|
||||
if ( settings.colClass != '' )
|
||||
{
|
||||
while ( settings.spanCols && ++i < cell.colSpan && colIndex[cell.realIndex + i] )
|
||||
{
|
||||
h = h.concat(colIndex[cell.realIndex + i]);
|
||||
}
|
||||
$(h).tableHoverHover(settings.colClass);
|
||||
}
|
||||
//highlight rows
|
||||
if ( settings.rowClass != '' )
|
||||
{
|
||||
rI = cell.parentNode.realRIndex;
|
||||
if ( rowIndex[rI] )
|
||||
{
|
||||
rH = rH.concat(rowIndex[rI]);
|
||||
}
|
||||
i = 0;
|
||||
while ( settings.spanRows && ++i < cell.rowSpan )
|
||||
{
|
||||
if ( rowIndex[rI + i] )
|
||||
{
|
||||
rH = rH.concat(rowIndex[rI + i]);
|
||||
}
|
||||
}
|
||||
$(rH).tableHoverHover(settings.rowClass);
|
||||
}
|
||||
//highlight cell
|
||||
if ( settings.cellClass != '' )
|
||||
{
|
||||
nn = cell.parentNode.parentNode.nodeName.toUpperCase();
|
||||
if ( (nn == 'TBODY' && settings.bodyCells)
|
||||
|| (nn == 'THEAD' && settings.headCells)
|
||||
|| (nn == 'TFOOT' && settings.footCells) )
|
||||
{
|
||||
$(cell).tableHoverHover(settings.cellClass);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fixCellIndexes(tbl);
|
||||
fixRowIndexes(tbl);
|
||||
|
||||
//init rowIndex
|
||||
for ( r = 0; r < tbl.rows.length; r++ )
|
||||
{
|
||||
rowIndex[r] = [];
|
||||
}
|
||||
//add header cells to index
|
||||
if ( tbl.tHead )
|
||||
{
|
||||
addToIndex(tbl.tHead.rows, 'THEAD');
|
||||
}
|
||||
//create index - loop through the bodies
|
||||
for ( r = 0; r < tbl.tBodies.length; r++ )
|
||||
{
|
||||
addToIndex(tbl.tBodies[r].rows, 'TBODY');
|
||||
}
|
||||
//add footer cells to index
|
||||
if ( tbl.tFoot )
|
||||
{
|
||||
addToIndex(tbl.tFoot.rows, 'TFOOT');
|
||||
}
|
||||
$(this).bind('mouseover', over).bind('mouseout', out).click(click);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
2
js/jquery.tablesorter.min.js
vendored
Normal file
15
js/jquery.tabs-ie.css
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
Tabs - additional IE specific bug fixes
|
||||
|
||||
Recommended usage (Conditional Comments):
|
||||
<!--[if lte IE 7]>
|
||||
<link rel="stylesheet" href="tabs_ie.css" type="text/css" media="projection, screen" />
|
||||
<![endif]-->
|
||||
|
||||
*/
|
||||
.tabs-nav { /* auto clear */
|
||||
display: inline-block;
|
||||
}
|
||||
.tabs-nav .tabs-disabled a {
|
||||
filter: alpha(opacity=40);
|
||||
}
|
||||
1
js/jquery.tabs.pack.js
Normal file
223
js/jquery.treeview.js
Normal file
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Treeview 1.3 - jQuery plugin to hide and show branches of a tree
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
||||
*
|
||||
* Copyright (c) 2006 Jörn Zaefferer, Myles Angell
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.treeview.js 3506 2007-10-02 18:15:21Z joern.zaefferer $
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
// classes used by the plugin
|
||||
// need to be styled via external stylesheet, see first example
|
||||
var CLASSES = {
|
||||
open: "open",
|
||||
closed: "closed",
|
||||
expandable: "expandable",
|
||||
collapsable: "collapsable",
|
||||
lastCollapsable: "lastCollapsable",
|
||||
lastExpandable: "lastExpandable",
|
||||
last: "last",
|
||||
hitarea: "hitarea"
|
||||
};
|
||||
|
||||
$.extend($.fn, {
|
||||
swapClass: function(c1, c2) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
if ( $.className.has(this, c1) )
|
||||
$this.removeClass(c1).addClass(c2);
|
||||
else if ( $.className.has(this, c2) )
|
||||
$this.removeClass(c2).addClass(c1);
|
||||
});
|
||||
},
|
||||
replaceClass: function(c1, c2) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
if ( $.className.has(this, c1) )
|
||||
$this.removeClass(c1).addClass(c2);
|
||||
});
|
||||
},
|
||||
hoverClass: function(className) {
|
||||
className = className || "hover";
|
||||
return this.hover(function() {
|
||||
$(this).addClass(className);
|
||||
}, function() {
|
||||
$(this).removeClass(className);
|
||||
});
|
||||
},
|
||||
heightToggle: function(animated, callback) {
|
||||
animated ?
|
||||
this.animate({ height: "toggle" }, animated, callback) :
|
||||
this.each(function(){
|
||||
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
|
||||
if(callback)
|
||||
callback.apply(this, arguments);
|
||||
});
|
||||
},
|
||||
heightHide: function(animated, callback) {
|
||||
if (animated) {
|
||||
this.animate({ height: "hide" }, animated, callback)
|
||||
} else {
|
||||
this.hide();
|
||||
if (callback)
|
||||
this.each(callback);
|
||||
}
|
||||
},
|
||||
prepareBranches: function(settings) {
|
||||
// mark last tree items
|
||||
this.filter(":last-child").addClass(CLASSES.last);
|
||||
// collapse whole tree, or only those marked as closed, anyway except those marked as open
|
||||
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
|
||||
// return all items with sublists
|
||||
return this.filter(":has(>ul)");
|
||||
},
|
||||
applyClasses: function(settings, toggler) {
|
||||
this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
|
||||
if ( this == event.target ) {
|
||||
toggler.apply($(this).next());
|
||||
}
|
||||
}).add( $("a", this) ).hoverClass();
|
||||
|
||||
// handle closed ones first
|
||||
this.filter(":has(>ul:hidden)")
|
||||
.addClass(CLASSES.expandable)
|
||||
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
|
||||
|
||||
// handle open ones
|
||||
this.not(":has(>ul:hidden)")
|
||||
.addClass(CLASSES.collapsable)
|
||||
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
|
||||
|
||||
// create hitarea
|
||||
this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>")
|
||||
.find("div." + CLASSES.hitarea).click( toggler )
|
||||
},
|
||||
treeview: function(settings) {
|
||||
|
||||
// currently no defaults necessary, all implicit
|
||||
settings = $.extend({}, settings);
|
||||
|
||||
if (settings.add) {
|
||||
return this.trigger("add", [settings.add]);
|
||||
}
|
||||
|
||||
if (settings.toggle ) {
|
||||
var callback = settings.toggle;
|
||||
settings.toggle = function() {
|
||||
return callback.apply($(this).parent()[0], arguments);
|
||||
}
|
||||
}
|
||||
|
||||
// factory for treecontroller
|
||||
function treeController(tree, control) {
|
||||
// factory for click handlers
|
||||
function handler(filter) {
|
||||
return function() {
|
||||
// reuse toggle event handler, applying the elements to toggle
|
||||
// start searching for all hitareas
|
||||
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
|
||||
// for plain toggle, no filter is provided, otherwise we need to check the parent element
|
||||
return filter ? $(this).parent("." + filter).length : true;
|
||||
}) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// click on first element to collapse tree
|
||||
$(":eq(0)", control).click( handler(CLASSES.collapsable) );
|
||||
// click on second to expand tree
|
||||
$(":eq(1)", control).click( handler(CLASSES.expandable) );
|
||||
// click on third to toggle tree
|
||||
$(":eq(2)", control).click( handler() );
|
||||
}
|
||||
|
||||
// handle toggle event
|
||||
function toggler() {
|
||||
// this refers to hitareas, we need to find the parent lis first
|
||||
$(this).parent()
|
||||
// swap classes
|
||||
.swapClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
// find child lists
|
||||
.find( ">ul" )
|
||||
// toggle them
|
||||
.heightToggle( settings.animated, settings.toggle );
|
||||
if ( settings.unique ) {
|
||||
$(this).parent()
|
||||
.siblings()
|
||||
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
|
||||
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
|
||||
.find( ">ul" )
|
||||
.heightHide( settings.animated, settings.toggle );
|
||||
}
|
||||
}
|
||||
|
||||
function serialize() {
|
||||
function binary(arg) {
|
||||
return arg ? 1 : 0;
|
||||
}
|
||||
var data = [];
|
||||
branches.each(function(i, e) {
|
||||
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
|
||||
});
|
||||
$.cookie("treeview", data.join("") );
|
||||
}
|
||||
|
||||
function deserialize() {
|
||||
var stored = $.cookie("treeview");
|
||||
if ( stored ) {
|
||||
var data = stored.split("");
|
||||
branches.each(function(i, e) {
|
||||
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// add treeview class to activate styles
|
||||
this.addClass("treeview");
|
||||
|
||||
// prepare branches and find all tree items with child lists
|
||||
var branches = this.find("li").prepareBranches(settings);
|
||||
|
||||
switch(settings.persist) {
|
||||
case "cookie":
|
||||
var toggleCallback = settings.toggle;
|
||||
settings.toggle = function() {
|
||||
serialize();
|
||||
if (toggleCallback) {
|
||||
toggleCallback.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
deserialize();
|
||||
break;
|
||||
case "location":
|
||||
var current = this.find("a").filter(function() { return this.href == location.href; });
|
||||
if ( current.length ) {
|
||||
current.addClass("selected").parents("ul, li").add( current.next() ).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
branches.applyClasses(settings, toggler);
|
||||
|
||||
// if control option is set, create the treecontroller
|
||||
if ( settings.control )
|
||||
treeController(this, settings.control);
|
||||
|
||||
return this.bind("add", function(event, branches) {
|
||||
$(branches).prev().removeClass(CLASSES.last).removeClass(CLASSES.lastCollapsable).removeClass(CLASSES.lastExpandable);
|
||||
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// provide backwards compability
|
||||
$.fn.Treeview = $.fn.treeview;
|
||||
})(jQuery);
|
||||
473
js/json.js
Normal file
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2008-06-15
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
This file creates a global JSON object containing two methods: stringify
|
||||
and parse.
|
||||
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects without a toJSON
|
||||
method. It can be a function or an array.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t' or ' '),
|
||||
it contains the characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method
|
||||
will be passed the key associated with the value, and this will be
|
||||
bound to the object holding the key.
|
||||
|
||||
For example, this would serialize Dates as ISO strings.
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If the replacer parameter is an array, then it will be used to
|
||||
select the members to be serialized. It filters the results such
|
||||
that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representations, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the
|
||||
value that is filled with line breaks and indentation to make it
|
||||
easier to read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
then indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
text = JSON.stringify([new Date()], function (key, value) {
|
||||
return this[key] instanceof Date ?
|
||||
'Date(' + this[key] + ')' : value;
|
||||
});
|
||||
// text is '["Date(---current time---)"]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||
var d;
|
||||
if (typeof value === 'string' &&
|
||||
value.slice(0, 5) === 'Date(' &&
|
||||
value.slice(-1) === ')') {
|
||||
d = new Date(value.slice(5, -1));
|
||||
if (d) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
|
||||
This code should be minified before deployment.
|
||||
See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD THIRD PARTY
|
||||
CODE INTO YOUR PAGES.
|
||||
*/
|
||||
|
||||
/*jslint evil: true */
|
||||
|
||||
/*global JSON */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", call,
|
||||
charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes,
|
||||
getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length,
|
||||
parse, propertyIsEnumerable, prototype, push, replace, slice, stringify,
|
||||
test, toJSON, toString
|
||||
*/
|
||||
|
||||
if (!this.JSON) {
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// object in a closure to avoid global variables.
|
||||
|
||||
JSON = function () {
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapeable.lastIndex = 0;
|
||||
return escapeable.test(string) ?
|
||||
'"' + string.replace(escapeable, function (a) {
|
||||
var c = meta[a];
|
||||
if (typeof c === 'string') {
|
||||
return c;
|
||||
}
|
||||
return '\\u' + ('0000' +
|
||||
(+(a.charCodeAt(0))).toString(16)).slice(-4);
|
||||
}) + '"' :
|
||||
'"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// If the object has a dontEnum length property, we'll treat it as an array.
|
||||
|
||||
if (typeof value.length === 'number' &&
|
||||
!(value.propertyIsEnumerable('length'))) {
|
||||
|
||||
// The object is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' :
|
||||
gap ? '[\n' + gap +
|
||||
partial.join(',\n' + gap) + '\n' +
|
||||
mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
k = rep[i];
|
||||
if (typeof k === 'string') {
|
||||
v = str(k, value, rep);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value, rep);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' :
|
||||
gap ? '{\n' + gap +
|
||||
partial.join(',\n' + gap) + '\n' +
|
||||
mind + '}' :
|
||||
'{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return the JSON object containing the stringify, parse, and quote methods.
|
||||
|
||||
return {
|
||||
stringify: function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
},
|
||||
|
||||
|
||||
parse: function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' + ('0000' +
|
||||
(+(a.charCodeAt(0))).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against
|
||||
// regular expressions that look for non-JSON patterns. We are especially
|
||||
// concerned with '()' and 'new' because they can cause invocation, and '='
|
||||
// because it can cause mutation. But just to be safe, we want to reject all
|
||||
// unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace all backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
|
||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
}
|
||||
};
|
||||
}();
|
||||
}
|
||||
461
js/json/json2.js
Normal file
@@ -0,0 +1,461 @@
|
||||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2008-03-24
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
|
||||
This file creates a global JSON object containing three methods: stringify,
|
||||
parse, and quote.
|
||||
|
||||
|
||||
JSON.stringify(value, replacer, space)
|
||||
value any JavaScript value, usually an object or array.
|
||||
|
||||
replacer an optional parameter that determines how object
|
||||
values are stringified for objects without a toJSON
|
||||
method. It can be a function or an array.
|
||||
|
||||
space an optional parameter that specifies the indentation
|
||||
of nested structures. If it is omitted, the text will
|
||||
be packed without extra whitespace. If it is a number,
|
||||
it will specify the number of spaces to indent at each
|
||||
level. If it is a string (such as '\t'), it contains the
|
||||
characters used to indent at each level.
|
||||
|
||||
This method produces a JSON text from a JavaScript value.
|
||||
|
||||
When an object value is found, if the object contains a toJSON
|
||||
method, its toJSON method will be called and the result will be
|
||||
stringified. A toJSON method does not serialize: it returns the
|
||||
value represented by the name/value pair that should be serialized,
|
||||
or undefined if nothing should be serialized. The toJSON method will
|
||||
be passed the key associated with the value, and this will be bound
|
||||
to the object holding the key.
|
||||
|
||||
This is the toJSON method added to Dates:
|
||||
|
||||
function toJSON(key) {
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
}
|
||||
|
||||
You can provide an optional replacer method. It will be passed the
|
||||
key and value of each member, with this bound to the containing
|
||||
object. The value that is returned from your method will be
|
||||
serialized. If your method returns undefined, then the member will
|
||||
be excluded from the serialization.
|
||||
|
||||
If no replacer parameter is provided, then a default replacer
|
||||
will be used:
|
||||
|
||||
function replacer(key, value) {
|
||||
return Object.hasOwnProperty.call(this, key) ?
|
||||
value : undefined;
|
||||
}
|
||||
|
||||
The default replacer is passed the key and value for each item in
|
||||
the structure. It excludes inherited members.
|
||||
|
||||
If the replacer parameter is an array, then it will be used to
|
||||
select the members to be serialized. It filters the results such
|
||||
that only members with keys listed in the replacer array are
|
||||
stringified.
|
||||
|
||||
Values that do not have JSON representaions, such as undefined or
|
||||
functions, will not be serialized. Such values in objects will be
|
||||
dropped; in arrays they will be replaced with null. You can use
|
||||
a replacer function to replace those with JSON values.
|
||||
JSON.stringify(undefined) returns undefined.
|
||||
|
||||
The optional space parameter produces a stringification of the value
|
||||
that is filled with line breaks and indentation to make it easier to
|
||||
read.
|
||||
|
||||
If the space parameter is a non-empty string, then that string will
|
||||
be used for indentation. If the space parameter is a number, then
|
||||
then indentation will be that many spaces.
|
||||
|
||||
Example:
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||
// text is '["e",{"pluribus":"unum"}]'
|
||||
|
||||
|
||||
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||
|
||||
|
||||
JSON.parse(text, reviver)
|
||||
This method parses a JSON text to produce an object or array.
|
||||
It can throw a SyntaxError exception.
|
||||
|
||||
The optional reviver parameter is a function that can filter and
|
||||
transform the results. It receives each of the keys and values,
|
||||
and its return value is used instead of the original value.
|
||||
If it returns what it received, then the structure is not modified.
|
||||
If it returns undefined then the member is deleted.
|
||||
|
||||
Example:
|
||||
|
||||
// Parse the text. Values that look like ISO date strings will
|
||||
// be converted to Date objects.
|
||||
|
||||
myData = JSON.parse(text, function (key, value) {
|
||||
var a;
|
||||
if (typeof value === 'string') {
|
||||
a =
|
||||
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||
if (a) {
|
||||
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||
+a[5], +a[6]));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
|
||||
|
||||
JSON.quote(text)
|
||||
This method wraps a string in quotes, escaping some characters
|
||||
as needed.
|
||||
|
||||
|
||||
This is a reference implementation. You are free to copy, modify, or
|
||||
redistribute.
|
||||
|
||||
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD THIRD PARTY
|
||||
CODE INTO YOUR PAGES.
|
||||
*/
|
||||
|
||||
/*jslint regexp: true, forin: true, evil: true */
|
||||
|
||||
/*global JSON */
|
||||
|
||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||
call, charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
|
||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
|
||||
parse, propertyIsEnumerable, prototype, push, quote, replace, stringify,
|
||||
test, toJSON, toString
|
||||
*/
|
||||
|
||||
if (!this.JSON) {
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// object in a closure to avoid global variables.
|
||||
|
||||
JSON = function () {
|
||||
|
||||
function f(n) { // Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
Date.prototype.toJSON = function () {
|
||||
|
||||
// Eventually, this method will be based on the date.toISOString method.
|
||||
|
||||
return this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z';
|
||||
};
|
||||
|
||||
|
||||
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
return escapeable.test(string) ?
|
||||
'"' + string.replace(escapeable, function (a) {
|
||||
var c = meta[a];
|
||||
if (typeof c === 'string') {
|
||||
return c;
|
||||
}
|
||||
c = a.charCodeAt();
|
||||
return '\\u00' + Math.floor(c / 16).toString(16) +
|
||||
(c % 16).toString(16);
|
||||
}) + '"' :
|
||||
'"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// If the object has a dontEnum length property, we'll treat it as an array.
|
||||
|
||||
if (typeof value.length === 'number' &&
|
||||
!(value.propertyIsEnumerable('length'))) {
|
||||
|
||||
// The object is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' :
|
||||
gap ? '[\n' + gap + partial.join(',\n' + gap) +
|
||||
'\n' + mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
k = rep[i];
|
||||
if (typeof k === 'string') {
|
||||
v = str(k, value, rep);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
v = str(k, value, rep);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' :
|
||||
gap ? '{\n' + gap + partial.join(',\n' + gap) +
|
||||
'\n' + mind + '}' :
|
||||
'{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return the JSON object containing the stringify, parse, and quote methods.
|
||||
|
||||
return {
|
||||
stringify: function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
if (space) {
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no replacer parameter, use the default replacer.
|
||||
|
||||
if (!replacer) {
|
||||
rep = function (key, value) {
|
||||
if (!Object.hasOwnProperty.call(this, key)) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
// The replacer can be a function or an array. Otherwise, throw an error.
|
||||
|
||||
} else if (typeof replacer === 'function' ||
|
||||
(typeof replacer === 'object' &&
|
||||
typeof replacer.length === 'number')) {
|
||||
rep = replacer;
|
||||
} else {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
},
|
||||
|
||||
|
||||
parse: function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in three stages. In the first stage, we run the text against
|
||||
// regular expressions that look for non-JSON patterns. We are especially
|
||||
// concerned with '()' and 'new' because they can cause invocation, and '='
|
||||
// because it can cause mutation. But just to be safe, we want to reject all
|
||||
// unexpected forms.
|
||||
|
||||
// We split the first stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace all backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
|
||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the second stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional third stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
},
|
||||
|
||||
quote: quote
|
||||
};
|
||||
}();
|
||||
}
|
||||
180
js/splitter.js
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* jquery.splitter.js - two-pane splitter window plugin
|
||||
*
|
||||
* version 1.01 (01/05/2007)
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* The splitter() plugin implements a two-pane resizable splitter window.
|
||||
* The selected elements in the jQuery object are converted to a splitter;
|
||||
* each element should have two child elements which are used for the panes
|
||||
* of the splitter. The plugin adds a third child element for the splitbar.
|
||||
*
|
||||
* For more details see: http://methvin.com/jquery/splitter/
|
||||
*
|
||||
*
|
||||
* @example $('#MySplitter').splitter();
|
||||
* @desc Create a vertical splitter with default settings
|
||||
*
|
||||
* @example $('#MySplitter').splitter({direction: 'h', accessKey: 'M'});
|
||||
* @desc Create a horizontal splitter resizable via Alt+Shift+M
|
||||
*
|
||||
* @name splitter
|
||||
* @type jQuery
|
||||
* @param String options Options for the splitter
|
||||
* @cat Plugins/Splitter
|
||||
* @return jQuery
|
||||
* @author Dave Methvin (dave.methvin@gmail.com)
|
||||
*/
|
||||
jQuery.fn.splitter = function(opts){
|
||||
opts = jQuery.extend({
|
||||
type: 'v', // v=vertical, h=horizontal split
|
||||
activeClass: 'active', // class name for active splitter
|
||||
pxPerKey: 5, // splitter px moved per keypress
|
||||
tabIndex: 0, // tab order indicator
|
||||
accessKey: '' // accelerator key for splitter
|
||||
// initA initB // initial A/B size (pick ONE)
|
||||
// minA maxA minB maxB // min/max pane sizes
|
||||
},{
|
||||
v: { // Vertical splitters:
|
||||
keyGrowA: 39, // left arrow key
|
||||
keyShrinkA: 37, // right arrow key
|
||||
cursor: "e-resize", // double-arrow horizontal
|
||||
splitbarClass: "vsplitbar",
|
||||
eventPos: "pageX", set: "left",
|
||||
adjust: "width", offsetAdjust: "offsetWidth", adjSide1: "Left", adjSide2: "Right",
|
||||
fixed: "height", offsetFixed: "offsetHeight", fixSide1: "Top", fixSide2: "Bottom"
|
||||
},
|
||||
h: { // Horizontal splitters:
|
||||
keyGrowA: 40, // down arrow key
|
||||
keyShrinkA: 38, // up arrow key
|
||||
cursor: "n-resize", // double-arrow vertical
|
||||
splitbarClass: "hsplitbar",
|
||||
eventPos: "pageY", set: "top",
|
||||
adjust: "height", offsetAdjust: "offsetHeight", adjSide1: "Top", adjSide2: "Bottom",
|
||||
fixed: "width", offsetFixed: "offsetWidth", fixSide1: "Left", fixSide2: "Right"
|
||||
}
|
||||
}[((opts||{}).type||'v').charAt(0).toLowerCase()], opts||{});
|
||||
|
||||
return this.each(function() {
|
||||
function startSplit(e) {
|
||||
splitbar.addClass(opts.activeClass);
|
||||
if ( e.type == "mousedown" ) {
|
||||
paneA._posAdjust = paneA[0][opts.offsetAdjust] - e[opts.eventPos];
|
||||
jQuery(document)
|
||||
.bind("mousemove", doSplitMouse)
|
||||
.bind("mouseup", endSplit);
|
||||
}
|
||||
return true; // required???
|
||||
}
|
||||
function doSplitKey(e) {
|
||||
var key = e.which || e.keyCode;
|
||||
var dir = key==opts.keyGrowA? 1 : key==opts.keyShrinkA? -1 : 0;
|
||||
if ( dir )
|
||||
moveSplitter(paneA[0][opts.offsetAdjust]+dir*opts.pxPerKey);
|
||||
return true; // required???
|
||||
}
|
||||
function doSplitMouse(e) {
|
||||
moveSplitter(paneA._posAdjust+e[opts.eventPos]);
|
||||
}
|
||||
function endSplit(e) {
|
||||
splitbar.removeClass(opts.activeClass);
|
||||
jQuery(document)
|
||||
.unbind("mousemove", doSplitMouse)
|
||||
.unbind("mouseup", endSplit);
|
||||
}
|
||||
function moveSplitter(np) {
|
||||
// Constrain new position to fit pane size limits; 16=scrollbar fudge factor
|
||||
// TODO: enforce group width in IE6 since it lacks min/max css properties?
|
||||
np = Math.max(paneA._min+paneA._padAdjust, group._adjust - (paneB._max||9999), 16,
|
||||
Math.min(np, paneA._max||9999, group._adjust - splitbar._adjust -
|
||||
Math.max(paneB._min+paneB._padAdjust, 16)));
|
||||
|
||||
// Resize/position the two panes and splitbar
|
||||
splitbar.css(opts.set, np+"px");
|
||||
paneA.css(opts.adjust, np-paneA._padAdjust+"px");
|
||||
paneB.css(opts.set, np+splitbar._adjust+"px")
|
||||
.css(opts.adjust, group._adjust-splitbar._adjust-paneB._padAdjust-np+"px");
|
||||
|
||||
// IE fires resize for us; all others pay cash
|
||||
if ( !jQuery.browser.msie ) {
|
||||
paneA.trigger("resize");
|
||||
paneB.trigger("resize");
|
||||
}
|
||||
}
|
||||
function cssCache(jq, n, pf, m1, m2) {
|
||||
// IE backCompat mode thinks width/height includes border and padding
|
||||
jq[n] = jQuery.boxModel? (parseInt(jq.css(pf+m1))||0) + (parseInt(jq.css(pf+m2))||0) : 0;
|
||||
}
|
||||
function optCache(jq, pane) {
|
||||
// Opera returns -1px for min/max dimensions when they're not there!
|
||||
jq._min = Math.max(0, opts["min"+pane] || parseInt(jq.css("min-"+opts.adjust)) || 0);
|
||||
jq._max = Math.max(0, opts["max"+pane] || parseInt(jq.css("max-"+opts.adjust)) || 0);
|
||||
}
|
||||
|
||||
// Create jQuery object closures for splitter group and both panes
|
||||
var group = jQuery(this).css({position: "relative"});
|
||||
var divs = jQuery(">div", group).css({
|
||||
position: "absolute", // positioned inside splitter container
|
||||
margin: "0", // remove any stylesheet margin or ...
|
||||
border: "0", // ... border added for non-script situations
|
||||
"-moz-user-focus": "ignore" // disable focusability in Firefox
|
||||
});
|
||||
var paneA = jQuery(divs[0]); // left or top
|
||||
var paneB = jQuery(divs[1]); // right or bottom
|
||||
|
||||
// Focuser element, provides keyboard support
|
||||
var focuser = jQuery('<a href="javascript:void(0)"></a>')
|
||||
.bind("focus", startSplit).bind("keydown", doSplitKey).bind("blur", endSplit)
|
||||
.attr({accessKey: opts.accessKey, tabIndex: opts.tabIndex});
|
||||
|
||||
// Splitbar element, displays actual splitter bar
|
||||
// The select-related properties prevent unintended text highlighting
|
||||
var splitbar = jQuery('<div></div>')
|
||||
.insertAfter(paneA).append(focuser)
|
||||
.attr({"class": opts.splitbarClass, unselectable: "on"})
|
||||
.css({position: "absolute", "-khtml-user-select": "none",
|
||||
"-moz-user-select": "none", "user-select": "none"})
|
||||
.bind("mousedown", startSplit);
|
||||
if ( /^(auto|default)$/.test(splitbar.css("cursor") || "auto") )
|
||||
splitbar.css("cursor", opts.cursor);
|
||||
|
||||
// Cache several dimensions for speed--assume these don't change
|
||||
splitbar._adjust = splitbar[0][opts.offsetAdjust];
|
||||
cssCache(group, "_borderAdjust", "border", opts.adjSide1+"Width", opts.adjSide2+"Width");
|
||||
cssCache(group, "_borderFixed", "border", opts.fixSide1+"Width", opts.fixSide2+"Width");
|
||||
cssCache(paneA, "_padAdjust", "padding", opts.adjSide1, opts.adjSide2);
|
||||
cssCache(paneA, "_padFixed", "padding", opts.fixSide1, opts.fixSide2);
|
||||
cssCache(paneB, "_padAdjust", "padding", opts.adjSide1, opts.adjSide2);
|
||||
cssCache(paneB, "_padFixed", "padding", opts.fixSide1, opts.fixSide2);
|
||||
optCache(paneA, 'A');
|
||||
optCache(paneB, 'B');
|
||||
|
||||
// Initial splitbar position as measured from left edge of splitter
|
||||
paneA._init = (opts.initA==true? parseInt(jQuery.curCSS(paneA[0],opts.adjust)) : opts.initA) || 0;
|
||||
paneB._init = (opts.initB==true? parseInt(jQuery.curCSS(paneB[0],opts.adjust)) : opts.initB) || 0;
|
||||
if ( paneB._init )
|
||||
paneB._init = group[0][opts.offsetAdjust] - group._borderAdjust - paneB._init - splitbar._adjust;
|
||||
|
||||
// Set up resize event handler and trigger immediately to set initial position
|
||||
group.bind("resize", function(e,size){
|
||||
// Determine new width/height of splitter container
|
||||
group._fixed = group[0][opts.offsetFixed] - group._borderFixed;
|
||||
group._adjust = group[0][opts.offsetAdjust] - group._borderAdjust;
|
||||
// Bail if splitter isn't visible or content isn't there yet
|
||||
if ( group._fixed <= 0 || group._adjust <= 0 ) return;
|
||||
// Set the fixed dimension (e.g., height on a vertical splitter)
|
||||
paneA.css(opts.fixed, group._fixed-paneA._padFixed+"px");
|
||||
paneB.css(opts.fixed, group._fixed-paneB._padFixed+"px");
|
||||
splitbar.css(opts.fixed, group._fixed+"px");
|
||||
// Re-divvy the adjustable dimension; maintain size of the preferred pane
|
||||
moveSplitter(size || (!opts.initB? paneA[0][opts.offsetAdjust] :
|
||||
group._adjust-paneB[0][opts.offsetAdjust]-splitbar._adjust));
|
||||
}).trigger("resize" , [paneA._init || paneB._init ||
|
||||
Math.round((group[0][opts.offsetAdjust] - group._borderAdjust - splitbar._adjust)/2)]);
|
||||
});
|
||||
};
|
||||
5
js/swfobject.js
Normal file
11
js/themes/dark/dark.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.dark { background:#111; color:snow; font:10pt Calibri, Arial, sans-serif; }
|
||||
.dark a, a.dark { color:#68D; outline:none; }
|
||||
.dark a:visited, a.dark:visited { color:#D66; }
|
||||
.dark a:hover, a.dark:hover { color:#FFF; }
|
||||
.dark fieldset { border:1px solid #282828; }
|
||||
.dark legend { color:#CCC; font:.8em Verdana, san-serif; }
|
||||
.dark button, button.dark, .dark input, input.dark { padding:2px 4px; font:.9em Consolas, Verdana, san-serif; }
|
||||
.dark textarea, textarea.dark { padding:2px 4px; font:.9em Consolas, Courier New, san-serif; width:20em; height:5em; overflow:auto; }
|
||||
.dark select, select.dark { padding:3px 0 3px 4px; font:.9em Verdana, san-serif; }
|
||||
.dark label { font-weight:bold; }
|
||||
|
||||
192
js/themes/dark/dark.form.css
Normal file
@@ -0,0 +1,192 @@
|
||||
.dark .ui-form-hide { position:absolute; left:-2000em; }
|
||||
|
||||
|
||||
/*( fieldset )*/
|
||||
.dark .ui-form-fieldset,
|
||||
.dark.ui-form-fieldset {
|
||||
display:block;
|
||||
border:1px solid #333;
|
||||
padding:0;
|
||||
}
|
||||
.dark .ui-form-fieldset,
|
||||
.dark.ui-form-fieldset {
|
||||
margin-top:1.6em;
|
||||
}
|
||||
.dark fieldset.ui-form {
|
||||
margin:0;
|
||||
border:1px solid #111;
|
||||
color:snow;
|
||||
}
|
||||
.dark fieldset.ui-form { background:#181818; }
|
||||
.dark .ui-form-legend,
|
||||
.dark.ui-form-legend {
|
||||
display:block;
|
||||
text-align:left;
|
||||
border:1px solid #333;
|
||||
background:#222;
|
||||
margin:-1.05em 0 0 0;
|
||||
}
|
||||
.dark legend.ui-form {
|
||||
display:block;
|
||||
color:snow;
|
||||
font-weight:bold;
|
||||
background:#222;
|
||||
border-top:1px dotted #282828;
|
||||
border-bottom:1px dotted #282828;
|
||||
margin:-1px 2px;
|
||||
padding:0 2px 2px;
|
||||
}
|
||||
|
||||
|
||||
/*( inputs )*/
|
||||
.dark .ui-form-text,
|
||||
.dark .ui-form-password,
|
||||
.dark.ui-form-text,
|
||||
.dark.ui-form-password {
|
||||
border:1px solid #333;
|
||||
padding:2px 0 3px;
|
||||
}
|
||||
|
||||
.dark .ui-form-textarea,
|
||||
.dark.ui-form-textarea {
|
||||
display:block;
|
||||
border:1px solid #333;
|
||||
padding:0;
|
||||
}
|
||||
.dark .ui-form-textarea .ui-form-inner,
|
||||
.dark.ui-form-textarea .ui-form-inner {
|
||||
display:block;
|
||||
border:1px solid #111;
|
||||
overflow:hidden;
|
||||
}
|
||||
.dark .ui-form-text.focus,
|
||||
.dark .ui-form-password.focus,
|
||||
.dark .ui-form-textarea.focus,
|
||||
.dark.ui-form-text.focus,
|
||||
.dark.ui-form-password.focus,
|
||||
.dark.ui-form-textarea.focus {
|
||||
border:1px solid #444;
|
||||
}
|
||||
|
||||
.dark .ui-form-text input,
|
||||
.dark .ui-form-password input,
|
||||
.dark textarea.ui-form {
|
||||
margin:0;
|
||||
border:1px solid #111;
|
||||
background:#222; color:snow;
|
||||
}
|
||||
.dark textarea.ui-form { border:none; }
|
||||
.dark .ui-form-text input:focus,
|
||||
.dark .ui-form-password input:focus,
|
||||
.dark textarea.ui-form:focus { background:#1D1D1D; }
|
||||
|
||||
|
||||
/*( buttons )*/
|
||||
.dark .ui-form-buttons,
|
||||
.dark.ui-form-buttons {
|
||||
display:block; float:left;
|
||||
height:40px;
|
||||
background:url(dark.form.png) left -40px;
|
||||
border:none;
|
||||
color:#CCC;
|
||||
padding-left:25px;
|
||||
margin:0 4px;
|
||||
}
|
||||
.dark .ui-form-buttons .ui-form-inner,
|
||||
.dark.ui-form-buttons .ui-form-inner {
|
||||
display:block; float:left;
|
||||
height:40px;
|
||||
background:url(dark.form.png) right -40px;
|
||||
margin-right:-5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
.dark .ui-form-buttons .ui-form,
|
||||
.dark.ui-form-buttons .ui-form {
|
||||
background:transparent;
|
||||
border:none;
|
||||
color:#DDD;
|
||||
padding:9px 25px 10px 25px;
|
||||
*padding:9px 15px 10px 15px;
|
||||
margin-left:-25px;
|
||||
}
|
||||
.dark .ui-form-buttons.hover,
|
||||
.dark.ui-form-buttons.hover {
|
||||
background-position:left -80px;
|
||||
}
|
||||
.dark .ui-form-buttons.hover .ui-form-inner,
|
||||
.dark.ui-form-buttons.hover .ui-form-inner {
|
||||
background-position:right -80px;
|
||||
}
|
||||
.dark .ui-form-buttons.hover .ui-form,
|
||||
.dark.ui-form-buttons.hover .ui-form {
|
||||
color:#FFF;
|
||||
}
|
||||
.dark .ui-form-buttons.focus,
|
||||
.dark.ui-form-buttons.focus {
|
||||
background-position:left -80px;
|
||||
}
|
||||
.dark .ui-form-buttons.focus .ui-form-inner,
|
||||
.dark.ui-form-buttons.focus .ui-form-inner {
|
||||
background-position:right -80px;
|
||||
}
|
||||
.dark .ui-form-buttons.focus .ui-form,
|
||||
.dark.ui-form-buttons.focus .ui-form {
|
||||
color:#FFF;
|
||||
}
|
||||
.dark .ui-form-buttons.active,
|
||||
.dark.ui-form-buttons.active {
|
||||
background-position:left -120px;
|
||||
}
|
||||
.dark .ui-form-buttons.active .ui-form-inner,
|
||||
.dark.ui-form-buttons.active .ui-form-inner {
|
||||
background-position:right -120px;
|
||||
}
|
||||
.dark .ui-form-buttons.active .ui-form,
|
||||
.dark.ui-form-buttons.active .ui-form {
|
||||
background-position:right -120px;
|
||||
}
|
||||
|
||||
|
||||
/*( checkbox )*/
|
||||
.dark .ui-form-checkbox {
|
||||
background:url(dark.form.png) -221px 0;
|
||||
padding:2px 0 1px 0;
|
||||
}
|
||||
.dark .ui-form-checkbox .ui-form-content {
|
||||
padding:0 7px 1px 7px;
|
||||
color:#222;
|
||||
cursor:default;
|
||||
}
|
||||
.dark .ui-form-checkbox.hover,
|
||||
.dark .ui-form-checkbox.focus,
|
||||
.dark .ui-form-checkbox.active {
|
||||
background-position: -221px -20px;
|
||||
}
|
||||
.dark .ui-form-checkbox.selected .ui-form-inner {
|
||||
background:url(dark.form.png) -201px -2px;
|
||||
}
|
||||
|
||||
|
||||
/*( radio )*/
|
||||
.dark .ui-form-radio {
|
||||
padding:2px 1px;
|
||||
background:url(dark.form.png) -1px -1px;
|
||||
}
|
||||
.dark .ui-form-radio .ui-form-content {
|
||||
padding:1px 6px 1px 7px;
|
||||
*padding:0 6px 0 7px;
|
||||
color:#222;
|
||||
cursor:default;
|
||||
}
|
||||
.dark .ui-form-radio.hover,
|
||||
.dark .ui-form-radio.focus,
|
||||
.dark .ui-form-radio.active {
|
||||
background-position: -1px -21px;
|
||||
}
|
||||
.dark .ui-form-radio.selected .ui-form-inner {
|
||||
background:url(dark.form.png) -22px -3px;
|
||||
}
|
||||
.dark .ui-form-radio.selected .ui-form-content {
|
||||
color:#CDD6E7;
|
||||
}
|
||||
|
||||
BIN
js/themes/dark/dark.form.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
9
js/themes/dark/dark.menu.css
Normal file
@@ -0,0 +1,9 @@
|
||||
.ui-menu-toolbar {background:#222; font:10pt Verdana;}
|
||||
.ui-menu-toolbar-button {border:1px solid #DDD; background:#000;}
|
||||
.ui-menu-toolbar-button:hover {border:1px solid #CCC; background:#333; }
|
||||
.ui-menu-toolbar-button a {color:#fff;}
|
||||
.ui-menu-items {background:#000; border:1px solid #CCC; opacity:0.95; font:10pt Verdana; min-width:80px; *width:80px;}
|
||||
.ui-menu-item a { color:#fff; }
|
||||
.ui-menu-item-parent { }
|
||||
.ui-menu-item-disabled {color: #aaa; background: transparent;}
|
||||
.ui-context-header {color: #fff;}
|
||||
93
js/themes/dark/dark.modal.css
Normal file
@@ -0,0 +1,93 @@
|
||||
.dark .ui-modal .top.pane,
|
||||
.dark.ui-modal .top.pane {
|
||||
position: relative;
|
||||
cursor:move;
|
||||
}
|
||||
|
||||
.dark .ui-modal .top.pane .ui-modal-title-bar,
|
||||
.dark.ui-modal .top.pane .ui-modal-title-bar {
|
||||
background:#333;
|
||||
color:snow;
|
||||
padding:2px 4px;
|
||||
border-bottom:1px solid #333;
|
||||
font-weight:bold;
|
||||
font-size:1.1em;
|
||||
}
|
||||
|
||||
.dark .ui-modal .top.pane .ui-modal-buttons-right,
|
||||
.dark.ui-modal .top.pane .ui-modal-buttons-right {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.dark .ui-modal .top.pane .ui-modal-button-close,
|
||||
.dark.ui-modal .top.pane .ui-modal-button-close {
|
||||
font:10pt Verdana;
|
||||
font-weight:bold;
|
||||
color:snow;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.dark .ui-modal .middle.pane,
|
||||
.dark.ui-modal .middle.pane {
|
||||
position:relative;
|
||||
height: 100%;
|
||||
background:#222;
|
||||
padding-top:4px;
|
||||
}
|
||||
.dark .ui-modal .middle.pane .center.pane,
|
||||
.dark.ui-modal .middle.pane .center.pane{
|
||||
position:relative;
|
||||
overflow: auto;
|
||||
height: 100%;
|
||||
margin:0 4px;
|
||||
background:#111;
|
||||
color:snow;
|
||||
}
|
||||
.dark .ui-modal.noOverflow .middle.pane .center.pane,
|
||||
.dark.ui-modal.noOverflow .middle.pane .center.pane{
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.dark .ui-modal .middle.pane .left.pane,
|
||||
.dark.ui-modal .middle.pane .left.pane {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-left:1px solid #333;
|
||||
height:100%;
|
||||
width: 2px;
|
||||
}
|
||||
|
||||
.dark .ui-modal .middle.pane .right.pane,
|
||||
.dark.ui-modal .middle.pane .right.pane {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border-right:1px solid #333;
|
||||
height:100%;
|
||||
width: 2px;
|
||||
cursor:e-resize;
|
||||
}
|
||||
|
||||
.dark .ui-modal .bottom.pane,
|
||||
.dark.ui-modal .bottom.pane {
|
||||
position: relative;
|
||||
height:3px;
|
||||
background:#222;
|
||||
border:1px solid #333;
|
||||
border-top:none;
|
||||
cursor:s-resize;
|
||||
}
|
||||
|
||||
|
||||
.dark .ui-modal .bottom.pane .ui-modal-resize-se,
|
||||
.dark.ui-modal .bottom.pane .ui-modal-resize-se {
|
||||
position: absolute;
|
||||
bottom:-1px;
|
||||
right:-1px;
|
||||
height:4px;
|
||||
width:4px;
|
||||
cursor:se-resize;
|
||||
}
|
||||
|
||||
73
js/themes/dark/dark.tabs.css
Normal file
@@ -0,0 +1,73 @@
|
||||
@media projection, screen { .ui-tabs-hide { display:none; } }
|
||||
@media print { .ui-tabs-nav { display: none; } }
|
||||
|
||||
.dark .ui-tabs-nav,
|
||||
.dark.ui-tabs-nav {
|
||||
padding-left:6px;
|
||||
border-bottom:1px solid #333;
|
||||
float:left;
|
||||
width:99%;
|
||||
margin:0;
|
||||
}
|
||||
.dark .ui-tabs-nav li,
|
||||
.dark.ui-tabs-nav li {
|
||||
list-style:none;
|
||||
float:left;
|
||||
}
|
||||
.dark .ui-tabs-nav a,
|
||||
.dark.ui-tabs-nav a {
|
||||
display:block;
|
||||
padding:2px 0 1px;
|
||||
text-decoration:none!important;
|
||||
border:1px solid #444;
|
||||
margin:1px 1px 0 0;
|
||||
font:9pt Verdana;
|
||||
color:#FFF;
|
||||
background:#444;
|
||||
}
|
||||
.dark .ui-tabs-nav span,
|
||||
.dark.ui-tabs-nav span {
|
||||
padding:2px 13px 2px;
|
||||
color:#FFF;
|
||||
background:#333;
|
||||
}
|
||||
.dark .ui-tabs-nav a:hover,
|
||||
.dark .ui-tabs-nav a:hover span,
|
||||
.dark.ui-tabs-nav a:hover,
|
||||
.dark.ui-tabs-nav a:hover span {
|
||||
border-color:#181818;
|
||||
color:#FFF;
|
||||
background:#111;
|
||||
}
|
||||
.dark .ui-tabs-nav .ui-tabs-selected a,
|
||||
.dark.ui-tabs-nav .ui-tabs-selected a {
|
||||
background:#222;
|
||||
border-color:#333;
|
||||
}
|
||||
.dark .ui-tabs-nav .ui-tabs-selected a span,
|
||||
.dark.ui-tabs-nav .ui-tabs-selected a span {
|
||||
margin-bottom:0;
|
||||
color:#FFF;
|
||||
background:#181818;
|
||||
border-bottom:1px solid #181818;
|
||||
cursor:default;
|
||||
}
|
||||
.dark .ui-tabs-nav .ui-tabs-disabled a,
|
||||
.dark .ui-tabs-nav .ui-tabs-disabled a span,
|
||||
.dark.ui-tabs-nav .ui-tabs-disabled a,
|
||||
.dark.ui-tabs-nav .ui-tabs-disabled a span {
|
||||
background:#161616;
|
||||
color:#333;
|
||||
border-color:#161616;
|
||||
cursor:default;
|
||||
}
|
||||
.dark .ui-tabs-container {
|
||||
background:#181818;
|
||||
border-bottom:1px solid #222;
|
||||
clear:both;
|
||||
padding:10px 10px 8px 10px;
|
||||
*padding-top:3px;
|
||||
*margin-top:-24px;
|
||||
clear:left;
|
||||
}
|
||||
|
||||
61
js/themes/dark/dark.tree.css
Normal file
@@ -0,0 +1,61 @@
|
||||
body.dark { font:11pt Calibri; background:#111; color:snow; }
|
||||
|
||||
.dark .ui-tree-nodes * { outline:none; }
|
||||
.dark .ui-tree-nodes {
|
||||
position:relative;
|
||||
list-style: none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
margin-left:0;
|
||||
padding-left:0.8em;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node {
|
||||
margin:0;
|
||||
padding:0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-text {
|
||||
text-decoration:none;
|
||||
color:snow;
|
||||
padding:0 .3em;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-selected > .ui-tree-node-text {
|
||||
background: #448;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-button {
|
||||
border: 1px solid #222;
|
||||
padding-left:1px;
|
||||
color: #666;
|
||||
font:7pt Courier New,monospace;
|
||||
margin-top: 0.5em;
|
||||
position: absolute;
|
||||
left: 0.2em;
|
||||
width: 0.7em;
|
||||
height: 0.8em;
|
||||
line-height: 0.8em;
|
||||
text-decoration: none;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-expanded > .ui-tree-node-button {
|
||||
background: #181818;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-collapsed > .ui-tree-node-button {
|
||||
background: #222;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-moving > .ui-tree-node-button {
|
||||
background: #282828;
|
||||
}
|
||||
|
||||
.dark .ui-tree-node-moving > .ui-tree-node-text {
|
||||
background: #474; color:#FFF;
|
||||
}
|
||||
|
||||
12
js/themes/flora/flora.accordion.css
Normal file
@@ -0,0 +1,12 @@
|
||||
ul.ui-accordion-container { margin: 0; padding: 0; list-style-type: none; }
|
||||
ul.ui-accordion-container li { position: relative; margin: 0; margin-bottom: 2px; padding: 0; background-image: url(i/accordion-left.png); background-repeat: no-repeat; }
|
||||
ul.ui-accordion-container li a.ui-accordion-link { display: block; padding-left: 5px; margin-right: 3px; height: 28px; background-image: url(i/accordion-middle.png); color: #000; text-decoration: none; line-height: 28px; }
|
||||
ul.ui-accordion-container li div.ui-accordion-right { background-image: url(i/accordion-right.png); position: absolute; top: 0px; right: 0px; height: 28px; width: 3px; }
|
||||
|
||||
ul.ui-accordion-container li:hover { background-image: url(i/accordion-left-over.png); }
|
||||
ul.ui-accordion-container li:hover a.ui-accordion-link { background-image: url(i/accordion-middle-over.png); }
|
||||
ul.ui-accordion-container li:hover div.ui-accordion-right { background-image: url(i/accordion-right-over.png); }
|
||||
|
||||
ul.ui-accordion-container li.active { background-image: url(i/accordion-left-act.png); }
|
||||
ul.ui-accordion-container li.active a.ui-accordion-link { background-image: url(i/accordion-middle-act.png); }
|
||||
ul.ui-accordion-container li.active div.ui-accordion-right { background-image: url(i/accordion-right-act.png); }
|
||||
9
js/themes/flora/flora.all.css
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "flora.css";
|
||||
@import "flora.shadow.css";
|
||||
@import "flora.resizable.css";
|
||||
@import "flora.slider.css";
|
||||
@import "flora.accordion.css";
|
||||
@import "flora.tabs.css";
|
||||
@import "flora.dialog.css";
|
||||
@import "flora.tablesorter.css";
|
||||
@import "flora.calendar.css";
|
||||
167
js/themes/flora/flora.calendar.css
Normal file
@@ -0,0 +1,167 @@
|
||||
/* Main Style Sheet for jQuery Calendar */
|
||||
#calendar_div, .calendar_inline {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: #ddd;
|
||||
}
|
||||
#calendar_div {
|
||||
display: none;
|
||||
border: 1px solid #FF9900;
|
||||
z-index: 10; /*must have*/
|
||||
}
|
||||
#calendar_div, .calendar_control, .calendar_links, .calendar_header, .calendar {
|
||||
width: 185px;
|
||||
}
|
||||
.calendar_inline {
|
||||
float: left;
|
||||
display: block;
|
||||
border: 0;
|
||||
}
|
||||
.calendar_dialog {
|
||||
padding: 5px !important;
|
||||
border: 4px ridge #ddd !important;
|
||||
}
|
||||
button.calendar_trigger {
|
||||
width: 25px;
|
||||
}
|
||||
img.calendar_trigger {
|
||||
margin: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.calendar_prompt {
|
||||
float: left;
|
||||
width: 181px;
|
||||
padding: 2px;
|
||||
background: #ddd;
|
||||
color: #000;
|
||||
}
|
||||
* html .calendar_prompt {
|
||||
width: 185px;
|
||||
}
|
||||
.calendar_control, .calendar_links, .calendar_header, .calendar {
|
||||
clear: both;
|
||||
float: left;
|
||||
color: #fff;
|
||||
}
|
||||
.calendar_control {
|
||||
background: #FF9900;
|
||||
}
|
||||
.calendar_links {
|
||||
background: #E0F4D7;
|
||||
}
|
||||
.calendar_control, .calendar_links {
|
||||
font-weight: bold;
|
||||
font-size: 80%;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.calendar_links label { /* disabled links */
|
||||
padding: 2px 5px;
|
||||
color: #888;
|
||||
}
|
||||
.calendar_clear, .calendar_prev {
|
||||
float: left;
|
||||
}
|
||||
.calendar_current {
|
||||
float: left;
|
||||
width: 35%;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar_close, .calendar_next {
|
||||
float: right;
|
||||
}
|
||||
.calendar_header {
|
||||
background: #83C948;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.calendar_header select {
|
||||
background: #83C948;
|
||||
color: #000;
|
||||
border: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.calendar {
|
||||
background: #ccc;
|
||||
text-align: center;
|
||||
font-size: 100%;
|
||||
}
|
||||
.calendar a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.calendar .calendar_titleRow {
|
||||
background: #B1DB87;
|
||||
color: #000 !important;
|
||||
}
|
||||
.calendar .calendar_daysRow {
|
||||
background: #FFF;
|
||||
color: #666;
|
||||
}
|
||||
.calendar .calendar_daysCell {
|
||||
color: #000;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
#calendar .calendar_daysCell a{
|
||||
display: block;
|
||||
}
|
||||
.calendar .calendar_weekEndCell {
|
||||
background: #E0F4D7;
|
||||
}
|
||||
.calendar .calendar_daysCellOver {
|
||||
background: #fff;
|
||||
border: 1px solid #777;
|
||||
}
|
||||
.calendar .calendar_unselectable {
|
||||
color: #888;
|
||||
}
|
||||
.calendar_today {
|
||||
background: #ccc !important;
|
||||
}
|
||||
.calendar_currentDay {
|
||||
background: #999 !important;
|
||||
}
|
||||
|
||||
/* ________ CALENDAR LINKS _______
|
||||
|
||||
** Reset link properties and then override them with !important */
|
||||
#calendar_div a, .calendar_inline a {
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
color: #000;
|
||||
}
|
||||
.calendar_inline .calendar_links a {
|
||||
padding: 0 5px !important;
|
||||
}
|
||||
.calendar_control a, .calendar_links a {
|
||||
padding: 2px 5px !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
.calendar_titleRow a {
|
||||
color: #000 !important;
|
||||
}
|
||||
.calendar_control a:hover {
|
||||
/*background: #fdd !important;*/
|
||||
color: #333 !important;
|
||||
}
|
||||
.calendar_links a:hover, .calendar_titleRow a:hover {
|
||||
background: #FFF !important;
|
||||
color: #333 !important;
|
||||
}
|
||||
|
||||
/* ___________ IE6 IFRAME FIX ________ */
|
||||
|
||||
.calendar_cover {
|
||||
display: none; /*sorry for IE5*/
|
||||
display/**/: block; /*sorry for IE5*/
|
||||
position: absolute; /*must have*/
|
||||
z-index: -1; /*must have*/
|
||||
filter: mask(); /*must have*/
|
||||
top: -4px; /*must have*/
|
||||
left: -4px; /*must have*/
|
||||
width: 193px; /*must have to match width and borders*/
|
||||
height: 200px; /*must have to match maximum height*/
|
||||
}
|
||||
2
js/themes/flora/flora.css
Normal file
@@ -0,0 +1,2 @@
|
||||
.ui-wrapper { border: 1px solid #50A029; }
|
||||
.ui-wrapper input,textarea { border: 0; }
|
||||
86
js/themes/flora/flora.dialog.css
Normal file
@@ -0,0 +1,86 @@
|
||||
/* This file skins dialog */
|
||||
|
||||
.flora .ui-dialog,
|
||||
.flora.ui-dialog {
|
||||
background-color: #e6f7d4;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-titlebar,
|
||||
.flora.ui-dialog .ui-dialog-titlebar {
|
||||
border-bottom: 1px solid #d8d2aa;
|
||||
background: #ff9900 url(i/dialog-title.gif) repeat-x;
|
||||
padding: 0px;
|
||||
cursor: move;
|
||||
height: 28px;
|
||||
_height: 29px;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-titlebar-close,
|
||||
.flora.ui-dialog .ui-dialog-titlebar-close {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: url(i/dialog-titlebar-close.png) no-repeat;
|
||||
position:absolute;
|
||||
top: 6px;
|
||||
right: 7px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-titlebar-close-hover,
|
||||
.flora.ui-dialog .ui-dialog-titlebar-close-hover {
|
||||
background: url(i/dialog-titlebar-close-hover.png) no-repeat;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-title,
|
||||
.flora.ui-dialog .ui-dialog-title {
|
||||
margin-left: 5px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
top: 7px;
|
||||
left: 4px;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-content,
|
||||
.flora.ui-dialog .ui-dialog-content {
|
||||
margin: 1.2em;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-buttonpane,
|
||||
.flora.ui-dialog .ui-dialog-buttonpane {
|
||||
position: absolute;
|
||||
bottom: 8px;
|
||||
right: 12px;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.flora .ui-dialog .ui-dialog-buttonpane button,
|
||||
.flora.ui-dialog .ui-dialog-buttonpane button {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
/* Dialog handle styles */
|
||||
.flora .ui-dialog .ui-resizable-n,
|
||||
.flora.ui-dialog .ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: transparent url(i/dialog-n.gif) repeat scroll center top; }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-s,
|
||||
.flora.ui-dialog .ui-resizable-s { cursor: s-resize; height: 8px; width: 100%; bottom: 0px; left: 0px; background: transparent url(i/dialog-s.gif) repeat scroll center top; }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-e,
|
||||
.flora.ui-dialog .ui-resizable-e { cursor: e-resize; width: 7px; right: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-e.gif) repeat scroll right center; }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-w,
|
||||
.flora.ui-dialog .ui-resizable-w { cursor: w-resize; width: 7px; left: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-w.gif) repeat scroll right center; }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-se,
|
||||
.flora.ui-dialog .ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: transparent url(i/dialog-se.gif); }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-sw,
|
||||
.flora.ui-dialog .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: transparent url(i/dialog-sw.gif); }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-nw,
|
||||
.flora.ui-dialog .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 29px; left: 0px; top: 0px; background: transparent url(i/dialog-nw.gif); }
|
||||
|
||||
.flora .ui-dialog .ui-resizable-ne,
|
||||
.flora.ui-dialog .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 29px; right: 0px; top: 0px; background: transparent url(i/dialog-ne.gif); }
|
||||
8
js/themes/flora/flora.menu.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.ui-menu-toolbar {z-index:500; list-style:none;}
|
||||
.ui-menu-toolbar-button {float:left; padding:4px 20px; cursor:pointer;}
|
||||
.ui-menu-toolbar-button:hover {}
|
||||
.ui-menu-toolbar-button a {text-decoration:none;}
|
||||
.ui-menu-items {display:none; padding:0; z-index:500; list-style:none; padding:1px 4px; min-width:80px; *width:80px;}
|
||||
.ui-menu-item a { text-decoration:none;}
|
||||
.ui-menu-item-parent { background: url('i/menu-submenu.gif') no-repeat center right; }
|
||||
.ui-menu-item-disabled {}
|
||||
20
js/themes/flora/flora.resizable.css
Normal file
@@ -0,0 +1,20 @@
|
||||
/* This file skins resizables */
|
||||
|
||||
.ui-resizable { position: relative; }
|
||||
|
||||
/* Global handle styles */
|
||||
.ui-resizable-handle { position: absolute; display: none; font-size: 0.1px; }
|
||||
.ui-resizable .ui-resizable-handle { display: block; }
|
||||
body .ui-resizable-disabled .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */
|
||||
body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body' to make it more specific (css order) */
|
||||
|
||||
.ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: transparent url(i/resizable-n.gif) repeat scroll center top; }
|
||||
.ui-resizable-s { cursor: s-resize; height: 6px; width: 100%; bottom: 0px; left: 0px; background: transparent url(i/resizable-s.gif) repeat scroll center top; }
|
||||
|
||||
.ui-resizable-e { cursor: e-resize; width: 6px; right: 0px; top: 0px; height: 100%; background: transparent url(i/resizable-e.gif) repeat scroll right center; }
|
||||
.ui-resizable-w { cursor: w-resize; width: 6px; left: 0px; top: 0px; height: 100%; background: transparent url(i/resizable-w.gif) repeat scroll right center; }
|
||||
|
||||
.ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: transparent url(i/resizable-se.gif); }
|
||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: transparent url(i/resizable-sw.gif); }
|
||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: 0px; top: 0px; background: transparent url(i/resizable-nw.gif); }
|
||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: 0px; top: 0px; background: transparent url(i/resizable-ne.gif); }
|
||||
33
js/themes/flora/flora.shadow.css
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
.ui-shadow {
|
||||
background:transparent url(i/shadow.png) no-repeat scroll right bottom;
|
||||
height: 100px;
|
||||
margin: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ui-shadow-ne {
|
||||
background:transparent url(i/shadow.png) no-repeat scroll right top;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.ui-shadow-sw {
|
||||
background:transparent url(i/shadow.png) no-repeat scroll left bottom;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: -6px;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
.ui-shadow { position:relative; }
|
||||
.ui-shadow-color { background:#030; position:absolute; } /* Can be overidden via js */
|
||||
|
||||
8
js/themes/flora/flora.slider.css
Normal file
@@ -0,0 +1,8 @@
|
||||
/* This file skins sliders */
|
||||
|
||||
.ui-slider-handle { position: absolute; height: 23px; width: 12px; top: 0px; left: 0px; background-image: url(i/slider-handle.gif); }
|
||||
.ui-slider-disabled .ui-slider-handle { opacity: 0.5; filter: alpha(opacity=50); }
|
||||
|
||||
/* Default slider backgrounds */
|
||||
.ui-slider-1 { width: 200px; height: 23px; position: relative; background-image: url(i/slider-bg-1.png); background-repeat: no-repeat; background-position: center center; }
|
||||
.ui-slider-2 { width: 200px; height: 23px; position: relative; background-image: url(i/slider-bg-2.png); background-repeat: no-repeat; background-position: center center; }
|
||||
40
js/themes/flora/flora.tablesorter.css
Normal file
@@ -0,0 +1,40 @@
|
||||
/* This file skins tableSorter */
|
||||
|
||||
table.tablesorter {
|
||||
font-family:arial;
|
||||
background-color: #CDCDCD;
|
||||
margin:10px 0pt 15px;
|
||||
font-size: 8pt;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
|
||||
background-color: #B1DB87;
|
||||
border: 1px solid #FFF;
|
||||
font-size: 8pt;
|
||||
padding: 4px;
|
||||
}
|
||||
table.tablesorter thead tr .header {
|
||||
background-image: url(i/bg.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.tablesorter tbody td {
|
||||
color: #3D3D3D;
|
||||
padding: 4px;
|
||||
background-color: #FFF;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.tablesorter tbody tr.odd td {
|
||||
background-color:#E0F4D7;
|
||||
}
|
||||
table.tablesorter thead tr .headerSortUp {
|
||||
background-image: url(i/asc.gif);
|
||||
}
|
||||
table.tablesorter thead tr .headerSortDown {
|
||||
background-image: url(i/desc.gif);
|
||||
}
|
||||
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
|
||||
background-color: #83C948;
|
||||
}
|
||||
80
js/themes/flora/flora.tabs.css
Normal file
@@ -0,0 +1,80 @@
|
||||
@media projection, screen { .ui-tabs-hide { display:none; } }
|
||||
@media print { .ui-tabs-nav { display: none; } }
|
||||
|
||||
.ui-tabs-nav {
|
||||
padding-left:10px;
|
||||
float:left;
|
||||
width:98%;
|
||||
border-bottom:1px solid #FFF;
|
||||
margin:0;
|
||||
}
|
||||
.ui-tabs-nav li {
|
||||
list-style:none;
|
||||
float:left;
|
||||
}
|
||||
.ui-tabs-nav a {
|
||||
background:url(i/tabs.gif) no-repeat left 4px;
|
||||
display:block;
|
||||
height:27px;
|
||||
padding:0 0 0 4px;
|
||||
text-decoration:none!important;
|
||||
margin:1px 5px -2px 0;
|
||||
font:9pt Verdana;
|
||||
outline:none;
|
||||
}
|
||||
.ui-tabs-nav span {
|
||||
background:url(i/tabs.gif) no-repeat right 4px;
|
||||
display:block;
|
||||
height:27px;
|
||||
line-height:29px;
|
||||
padding:0px 13px 0 10px;
|
||||
margin-right:-3px;
|
||||
color:#FFF;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a {
|
||||
background-position:left -23px;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-selected a span {
|
||||
background-position:right -23px;
|
||||
margin-bottom:0;
|
||||
cursor:default;
|
||||
}
|
||||
.ui-tabs-nav .ui-tabs-disabled a,
|
||||
.ui-tabs-nav .ui-tabs-disabled a span {
|
||||
color:#000;
|
||||
opacity:0.4;
|
||||
filter:alpha(opacity=40);
|
||||
cursor:default;
|
||||
}
|
||||
.ui-tabs-container {
|
||||
background:#FFF;
|
||||
border:1px solid #519E2D;
|
||||
clear:left;
|
||||
padding:10px 10px 8px 10px;
|
||||
*padding-top:3px;
|
||||
*margin-top:-24px;
|
||||
}
|
||||
|
||||
/* hacks to get it working in IE */
|
||||
.ui-tabs-nav li {
|
||||
display: inline !important;
|
||||
position: relative;
|
||||
_top: -3px;
|
||||
}
|
||||
.ui-tabs-nav li a {
|
||||
display: inline !important;
|
||||
float: left;
|
||||
_padding-left: 2px;
|
||||
}
|
||||
.ui-tabs-nav li a span {
|
||||
display: inline !important;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
_padding-bottom: 0px;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
_top: 0px;
|
||||
_left: 3px;
|
||||
_padding-bottom: 2px;
|
||||
_padding-right: 13px;
|
||||
}
|
||||
BIN
js/themes/flora/i/Thumbs.db
Normal file
BIN
js/themes/flora/i/accordion-left-act.png
Normal file
|
After Width: | Height: | Size: 249 B |
BIN
js/themes/flora/i/accordion-left-over.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
js/themes/flora/i/accordion-left.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
js/themes/flora/i/accordion-middle-act.png
Normal file
|
After Width: | Height: | Size: 148 B |
BIN
js/themes/flora/i/accordion-middle-over.png
Normal file
|
After Width: | Height: | Size: 122 B |
BIN
js/themes/flora/i/accordion-middle.png
Normal file
|
After Width: | Height: | Size: 122 B |
BIN
js/themes/flora/i/accordion-right-act.png
Normal file
|
After Width: | Height: | Size: 245 B |
BIN
js/themes/flora/i/accordion-right-over.png
Normal file
|
After Width: | Height: | Size: 177 B |
BIN
js/themes/flora/i/accordion-right.png
Normal file
|
After Width: | Height: | Size: 177 B |
BIN
js/themes/flora/i/asc.gif
Normal file
|
After Width: | Height: | Size: 54 B |
BIN
js/themes/flora/i/bg.gif
Normal file
|
After Width: | Height: | Size: 64 B |
BIN
js/themes/flora/i/desc.gif
Normal file
|
After Width: | Height: | Size: 54 B |
BIN
js/themes/flora/i/dialog-e.gif
Normal file
|
After Width: | Height: | Size: 440 B |
BIN
js/themes/flora/i/dialog-n.gif
Normal file
|
After Width: | Height: | Size: 569 B |
BIN
js/themes/flora/i/dialog-ne.gif
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
js/themes/flora/i/dialog-nw.gif
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
js/themes/flora/i/dialog-s.gif
Normal file
|
After Width: | Height: | Size: 434 B |
BIN
js/themes/flora/i/dialog-se.gif
Normal file
|
After Width: | Height: | Size: 175 B |
BIN
js/themes/flora/i/dialog-sw.gif
Normal file
|
After Width: | Height: | Size: 175 B |
BIN
js/themes/flora/i/dialog-title.gif
Normal file
|
After Width: | Height: | Size: 238 B |
BIN
js/themes/flora/i/dialog-titlebar-close-hover.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
js/themes/flora/i/dialog-titlebar-close.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
js/themes/flora/i/dialog-w.gif
Normal file
|
After Width: | Height: | Size: 437 B |
BIN
js/themes/flora/i/menu-submenu.gif
Normal file
|
After Width: | Height: | Size: 93 B |
BIN
js/themes/flora/i/resizable-e.gif
Normal file
|
After Width: | Height: | Size: 338 B |
BIN
js/themes/flora/i/resizable-n.gif
Normal file
|
After Width: | Height: | Size: 341 B |
BIN
js/themes/flora/i/resizable-ne.gif
Normal file
|
After Width: | Height: | Size: 124 B |
BIN
js/themes/flora/i/resizable-nw.gif
Normal file
|
After Width: | Height: | Size: 91 B |
BIN
js/themes/flora/i/resizable-s.gif
Normal file
|
After Width: | Height: | Size: 341 B |
BIN
js/themes/flora/i/resizable-se.gif
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
js/themes/flora/i/resizable-sw.gif
Normal file
|
After Width: | Height: | Size: 175 B |
BIN
js/themes/flora/i/resizable-w.gif
Normal file
|
After Width: | Height: | Size: 339 B |
BIN
js/themes/flora/i/shadow.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
js/themes/flora/i/slider-bg-1.png
Normal file
|
After Width: | Height: | Size: 204 B |
BIN
js/themes/flora/i/slider-bg-2.png
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
js/themes/flora/i/slider-handle.gif
Normal file
|
After Width: | Height: | Size: 176 B |
BIN
js/themes/flora/i/tabs.gif
Normal file
|
After Width: | Height: | Size: 377 B |
11
js/themes/light/light.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.light { background:#FFF; color:#111; font:10pt Verdana, Arial, sans-serif; }
|
||||
.light a, a.light { color:#46C; outline:none; }
|
||||
.light a:visited, a.light:visited { color:#C44; }
|
||||
.light a:hover, a.light:hover { color:#000; }
|
||||
.light fieldset { border:1px solid #CCC; }
|
||||
.light legend { color:#555; font:.8em Verdana, san-serif; }
|
||||
.light button, button.light, .light input, input.light { padding:2px 4px; font:.9em Consolas, Verdana, san-serif; }
|
||||
.light textarea, textarea.light { padding:2px 4px; font:.9em Consolas, Courier New, san-serif; width:20em; height:5em; overflow:auto; }
|
||||
.light select, select.light { padding:3px 0 3px 4px; font:.9em Verdana, san-serif; }
|
||||
.light label { font-weight:bold; }
|
||||
|
||||
45
js/themes/light/light.form.css
Normal file
@@ -0,0 +1,45 @@
|
||||
.light .ui-form-textarea,
|
||||
.light.ui-form-textarea,
|
||||
.light .ui-form-fieldset,
|
||||
.light.ui-form-fieldset {
|
||||
display:block;
|
||||
border:1px solid #CCC;
|
||||
padding:0;
|
||||
}
|
||||
.light .ui-form-fieldset,
|
||||
.light.ui-form-fieldset {
|
||||
margin-top:1.6em;
|
||||
}
|
||||
.light textarea.ui-form,
|
||||
.light fieldset.ui-form {
|
||||
margin:0;
|
||||
border:1px solid #FFF;
|
||||
}
|
||||
.light textarea.ui-form { background:#F3F3F3; }
|
||||
.light fieldset.ui-form { background:#F6F6F6; }
|
||||
.light .ui-form-textarea.focus,
|
||||
.light.ui-form-textarea.focus {
|
||||
border:1px solid #AAA;
|
||||
}
|
||||
.light textarea.ui-form:focus {
|
||||
background:#F5F5F5;
|
||||
}
|
||||
.light .ui-form-legend,
|
||||
.light.ui-form-legend {
|
||||
display:block;
|
||||
text-align:left;
|
||||
border:1px solid #CCC;
|
||||
background:#F4F4F4;
|
||||
margin:-1.05em 0 0 0;
|
||||
}
|
||||
.light legend.ui-form {
|
||||
display:block;
|
||||
font-weight:bold;
|
||||
background:#F4F4F4;
|
||||
border-top:1px dotted #EEE;
|
||||
border-bottom:1px dotted #EEE;
|
||||
margin:-1px 2px;
|
||||
padding:0 2px 2px;
|
||||
}
|
||||
|
||||
|
||||
8
js/themes/light/light.menu.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.ui-menu-toolbar {background:#222; font:10pt Verdana;}
|
||||
.ui-menu-toolbar-button {border:1px solid #DDD; background:#FFF;}
|
||||
.ui-menu-toolbar-button:hover {border:1px solid #CCC; background:#EEE; }
|
||||
.ui-menu-toolbar-button a {color:#000;}
|
||||
.ui-menu-items {background:#FFF; border:1px solid #CCC; opacity:0.95; font:10pt Verdana; min-width:80px; *width:80px;}
|
||||
.ui-menu-item a { color:#000; }
|
||||
.ui-menu-item-parent { }
|
||||
.ui-menu-item-disabled {color: #aaa; background: transparent;}
|
||||
91
js/themes/light/light.modal.css
Normal file
@@ -0,0 +1,91 @@
|
||||
.light .ui-modal .top.pane,
|
||||
.light.ui-modal .top.pane {
|
||||
position: relative;
|
||||
cursor:move;
|
||||
}
|
||||
|
||||
.light .ui-modal .top.pane .ui-modal-title-bar,
|
||||
.light.ui-modal .top.pane .ui-modal-title-bar {
|
||||
background:#333;
|
||||
color:snow;
|
||||
padding:2px 4px;
|
||||
border-bottom:1px solid #000;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.light .ui-modal .top.pane .ui-modal-buttons-right,
|
||||
.light.ui-modal .top.pane .ui-modal-buttons-right {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.light .ui-modal .top.pane .ui-modal-button-close,
|
||||
.light.ui-modal .top.pane .ui-modal-button-close {
|
||||
font:10pt Verdana;
|
||||
font-weight:bold;
|
||||
color:snow;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.light .ui-modal .middle.pane,
|
||||
.light.ui-modal .middle.pane {
|
||||
position:relative;
|
||||
height: 100%;
|
||||
background:#F3F3F3;
|
||||
padding-top:4px;
|
||||
}
|
||||
.light .ui-modal .middle.pane .center.pane,
|
||||
.light.ui-modal .middle.pane .center.pane{
|
||||
position:relative;
|
||||
overflow: auto;
|
||||
height: 100%;
|
||||
margin:0 4px;
|
||||
background:#FFF;
|
||||
}
|
||||
.light .ui-modal.noOverflow .middle.pane .center.pane,
|
||||
.light.ui-modal.noOverflow .middle.pane .center.pane{
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.light .ui-modal .middle.pane .left.pane,
|
||||
.light.ui-modal .middle.pane .left.pane {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-left:1px solid #DDD;
|
||||
height:100%;
|
||||
width: 2px;
|
||||
}
|
||||
|
||||
.light .ui-modal .middle.pane .right.pane,
|
||||
.light.ui-modal .middle.pane .right.pane {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border-right:1px solid #DDD;
|
||||
height:100%;
|
||||
width: 2px;
|
||||
cursor:e-resize;
|
||||
}
|
||||
|
||||
.light .ui-modal .bottom.pane,
|
||||
.light.ui-modal .bottom.pane {
|
||||
position: relative;
|
||||
height:3px;
|
||||
background:#F3F3F3;
|
||||
border:1px solid #DDD;
|
||||
border-top:none;
|
||||
cursor:s-resize;
|
||||
}
|
||||
|
||||
|
||||
.light .ui-modal .bottom.pane .ui-modal-resize-se,
|
||||
.light.ui-modal .bottom.pane .ui-modal-resize-se {
|
||||
position: absolute;
|
||||
bottom:-1px;
|
||||
right:-1px;
|
||||
height:4px;
|
||||
width:4px;
|
||||
cursor:se-resize;
|
||||
}
|
||||
|
||||
71
js/themes/light/light.tabs.css
Normal file
@@ -0,0 +1,71 @@
|
||||
@media projection, screen { .ui-tabs-hide { display:none; } }
|
||||
@media print { .ui-tabs-nav { display: none; } }
|
||||
|
||||
.light .ui-tabs-nav,
|
||||
.light.ui-tabs-nav {
|
||||
padding-left:6px;
|
||||
border-bottom:1px solid #444;
|
||||
float:left;
|
||||
width:99%;
|
||||
margin:0;
|
||||
}
|
||||
.light .ui-tabs-nav li,
|
||||
.light.ui-tabs-nav li {
|
||||
list-style:none;
|
||||
float:left;
|
||||
}
|
||||
.light .ui-tabs-nav a,
|
||||
.light.ui-tabs-nav a {
|
||||
display:block;
|
||||
padding:2px 0 1px;
|
||||
text-decoration:none!important;
|
||||
border:1px solid #444;
|
||||
margin:1px 1px 0 0;
|
||||
font:9pt Verdana;
|
||||
color:#FFF;
|
||||
background:#444;
|
||||
}
|
||||
.light .ui-tabs-nav span,
|
||||
.light.ui-tabs-nav span {
|
||||
padding:2px 13px 2px;
|
||||
color:#FFF;
|
||||
background:#444;
|
||||
}
|
||||
.light .ui-tabs-nav a:hover,
|
||||
.light .ui-tabs-nav a:hover span,
|
||||
.light.ui-tabs-nav a:hover,
|
||||
.light.ui-tabs-nav a:hover span {
|
||||
border-color:#222;
|
||||
color:#FFF;
|
||||
background:#222;
|
||||
}
|
||||
.light .ui-tabs-nav .ui-tabs-selected a,
|
||||
.light.ui-tabs-nav .ui-tabs-selected a {
|
||||
background:#AAA;
|
||||
border-color:#666;
|
||||
}
|
||||
.light .ui-tabs-nav .ui-tabs-selected a span,
|
||||
.light.ui-tabs-nav .ui-tabs-selected a span {
|
||||
margin-bottom:0;
|
||||
color:#000;
|
||||
background:snow;
|
||||
border-bottom:1px solid #FFF;
|
||||
cursor:default;
|
||||
}
|
||||
.light .ui-tabs-nav .ui-tabs-disabled a,
|
||||
.light .ui-tabs-nav .ui-tabs-disabled a span,
|
||||
.light.ui-tabs-nav .ui-tabs-disabled a,
|
||||
.light.ui-tabs-nav .ui-tabs-disabled a span {
|
||||
background:#EEE;
|
||||
color:#BBB;
|
||||
border-color:#DDD;
|
||||
cursor:default;
|
||||
}
|
||||
.light .ui-tabs-container {
|
||||
clear:both;
|
||||
padding:10px 10px 8px 10px;
|
||||
removedpadding-top:3px;
|
||||
removedmargin-top:-24px;
|
||||
clear:left;
|
||||
}
|
||||
|
||||
61
js/themes/light/light.tree.css
Normal file
@@ -0,0 +1,61 @@
|
||||
body.light { font:10pt Verdana; background:#FFF; color:#111; }
|
||||
|
||||
.light .ui-tree-nodes * { outline:none; }
|
||||
.light .ui-tree-nodes {
|
||||
position:relative;
|
||||
list-style: none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
margin-left:0;
|
||||
padding-left:0.8em;
|
||||
}
|
||||
|
||||
.light .ui-tree-node {
|
||||
margin:0;
|
||||
padding:0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-text {
|
||||
text-decoration:none;
|
||||
color:#222;
|
||||
padding:0 .3em;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-selected > .ui-tree-node-text {
|
||||
background: #EEE;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-button {
|
||||
border: 1px solid #CCC;
|
||||
padding-left:1px;
|
||||
color: #666;
|
||||
font:7pt Courier New,monospace;
|
||||
margin-top: 0.4em;
|
||||
position: absolute;
|
||||
left: 0.2em;
|
||||
width: 0.7em;
|
||||
height: 0.8em;
|
||||
line-height: 0.8em;
|
||||
text-decoration: none;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-expanded > .ui-tree-node-button {
|
||||
background: #EEE;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-collapsed > .ui-tree-node-button {
|
||||
background: #DDD;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-moving > .ui-tree-node-button {
|
||||
background: #DDD;
|
||||
}
|
||||
|
||||
.light .ui-tree-node-moving > .ui-tree-node-text {
|
||||
background: #DDD;
|
||||
}
|
||||
|
||||
246
js/ui.accordion.js
Normal file
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Accordion 1.5 - jQuery menu widget
|
||||
*
|
||||
* Copyright (c) 2007 Jörn Zaefferer, Frank Marcia
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-accordion/
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.accordion.js 2951 2007-08-28 07:21:13Z joern.zaefferer $
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.ui = $.ui || {}
|
||||
|
||||
$.ui.accordion = {};
|
||||
$.extend($.ui.accordion, {
|
||||
defaults: {
|
||||
selectedClass: "selected",
|
||||
alwaysOpen: true,
|
||||
animated: 'slide',
|
||||
event: "click",
|
||||
header: "a"
|
||||
},
|
||||
animations: {
|
||||
slide: function(settings, additions) {
|
||||
settings = $.extend({
|
||||
easing: "swing",
|
||||
duration: 300
|
||||
}, settings, additions);
|
||||
if ( !settings.toHide.size() ) {
|
||||
settings.toShow.animate({height: "show"}, {
|
||||
duration: settings.duration,
|
||||
easing: settings.easing,
|
||||
complete: settings.finished
|
||||
});
|
||||
return;
|
||||
}
|
||||
var hideHeight = settings.toHide.height(),
|
||||
showHeight = settings.toShow.height(),
|
||||
difference = showHeight / hideHeight;
|
||||
settings.toShow.css({ height: 0, overflow: 'hidden' }).show();
|
||||
settings.toHide.filter(":hidden").each(settings.finished).end().filter(":visible").animate({height:"hide"},{
|
||||
step: function(n){
|
||||
settings.toShow.height(Math.ceil( (hideHeight - (n)) * difference ));
|
||||
},
|
||||
duration: settings.duration,
|
||||
easing: settings.easing,
|
||||
complete: settings.finished
|
||||
});
|
||||
},
|
||||
bounceslide: function(settings) {
|
||||
this.slide(settings, {
|
||||
easing: settings.down ? "bounceout" : "swing",
|
||||
duration: settings.down ? 1000 : 200
|
||||
});
|
||||
},
|
||||
easeslide: function(settings) {
|
||||
this.slide(settings, {
|
||||
easing: "easeinout",
|
||||
duration: 700
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.extend({
|
||||
nextUntil: function(expr) {
|
||||
var match = [];
|
||||
|
||||
// We need to figure out which elements to push onto the array
|
||||
this.each(function(){
|
||||
// Traverse through the sibling nodes
|
||||
for( var i = this.nextSibling; i; i = i.nextSibling ) {
|
||||
// Make sure that we're only dealing with elements
|
||||
if ( i.nodeType != 1 ) continue;
|
||||
|
||||
// If we find a match then we need to stop
|
||||
if ( $.filter( expr, [i] ).r.length ) break;
|
||||
|
||||
// Otherwise, add it on to the stack
|
||||
match.push( i );
|
||||
}
|
||||
});
|
||||
|
||||
return this.pushStack( match );
|
||||
},
|
||||
// the plugin method itself
|
||||
accordion: function(settings) {
|
||||
if ( !this.length )
|
||||
return this;
|
||||
|
||||
// setup configuration
|
||||
settings = $.extend({}, $.ui.accordion.defaults, settings);
|
||||
|
||||
if ( settings.navigation ) {
|
||||
var current = this.find("a").filter(function() { return this.href == location.href; });
|
||||
if ( current.length ) {
|
||||
if ( current.filter(settings.header).length ) {
|
||||
settings.active = current;
|
||||
} else {
|
||||
settings.active = current.parent().parent().prev();
|
||||
current.addClass("current");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate active if not specified, using the first header
|
||||
var container = this,
|
||||
headers = container.find(settings.header),
|
||||
active = findActive(settings.active),
|
||||
running = 0;
|
||||
|
||||
if ( settings.fillSpace ) {
|
||||
var maxHeight = this.parent().height();
|
||||
headers.each(function() {
|
||||
maxHeight -= $(this).outerHeight();
|
||||
});
|
||||
var maxPadding = 0;
|
||||
headers.nextUntil(settings.header).each(function() {
|
||||
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
|
||||
}).height(maxHeight - maxPadding);
|
||||
} else if ( settings.autoheight ) {
|
||||
var maxHeight = 0;
|
||||
headers.nextUntil(settings.header).each(function() {
|
||||
maxHeight = Math.max(maxHeight, $(this).height());
|
||||
}).height(maxHeight);
|
||||
}
|
||||
|
||||
headers
|
||||
.not(active || "")
|
||||
.nextUntil(settings.header)
|
||||
.hide();
|
||||
active.parent().andSelf().addClass(settings.selectedClass);
|
||||
|
||||
|
||||
function findActive(selector) {
|
||||
return selector != undefined
|
||||
? typeof selector == "number"
|
||||
? headers.filter(":eq(" + selector + ")")
|
||||
: headers.not(headers.not(selector))
|
||||
: selector === false
|
||||
? $("<div>")
|
||||
: headers.filter(":eq(0)");
|
||||
}
|
||||
|
||||
function toggle(toShow, toHide, data, clickedActive, down) {
|
||||
var finished = function(cancel) {
|
||||
running = cancel ? 0 : --running;
|
||||
if ( running )
|
||||
return;
|
||||
// trigger custom change event
|
||||
container.trigger("change", data);
|
||||
};
|
||||
|
||||
// count elements to animate
|
||||
running = toHide.size() == 0 ? toShow.size() : toHide.size();
|
||||
|
||||
if ( settings.animated ) {
|
||||
if ( !settings.alwaysOpen && clickedActive ) {
|
||||
toShow.slideToggle(settings.animated);
|
||||
finished(true);
|
||||
} else {
|
||||
$.ui.accordion.animations[settings.animated]({
|
||||
toShow: toShow,
|
||||
toHide: toHide,
|
||||
finished: finished,
|
||||
down: down
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if ( !settings.alwaysOpen && clickedActive ) {
|
||||
toShow.toggle();
|
||||
} else {
|
||||
toHide.hide();
|
||||
toShow.show();
|
||||
}
|
||||
finished(true);
|
||||
}
|
||||
}
|
||||
|
||||
function clickHandler(event) {
|
||||
// called only when using activate(false) to close all parts programmatically
|
||||
if ( !event.target && !settings.alwaysOpen ) {
|
||||
active.toggleClass(settings.selectedClass);
|
||||
var toHide = active.nextUntil(settings.header);
|
||||
var toShow = active = $([]);
|
||||
toggle( toShow, toHide );
|
||||
return;
|
||||
}
|
||||
// get the click target
|
||||
var clicked = $(event.target);
|
||||
|
||||
// due to the event delegation model, we have to check if one
|
||||
// of the parent elements is our actual header, and find that
|
||||
if ( clicked.parents(settings.header).length )
|
||||
while ( !clicked.is(settings.header) )
|
||||
clicked = clicked.parent();
|
||||
|
||||
var clickedActive = clicked[0] == active[0];
|
||||
|
||||
// if animations are still active, or the active header is the target, ignore click
|
||||
if(running || (settings.alwaysOpen && clickedActive) || !clicked.is(settings.header))
|
||||
return;
|
||||
|
||||
// switch classes
|
||||
active.parent().andSelf().toggleClass(settings.selectedClass);
|
||||
if ( !clickedActive ) {
|
||||
clicked.parent().andSelf().addClass(settings.selectedClass);
|
||||
}
|
||||
|
||||
// find elements to show and hide
|
||||
var toShow = clicked.nextUntil(settings.header),
|
||||
toHide = active.nextUntil(settings.header),
|
||||
data = [clicked, active, toShow, toHide],
|
||||
down = headers.index( active[0] ) > headers.index( clicked[0] );
|
||||
|
||||
active = clickedActive ? $([]) : clicked;
|
||||
toggle( toShow, toHide, data, clickedActive, down );
|
||||
|
||||
return !toShow.length;
|
||||
};
|
||||
function activateHandler(event, index) {
|
||||
// IE manages to call activateHandler on normal clicks
|
||||
if ( arguments.length == 1 )
|
||||
return;
|
||||
// call clickHandler with custom event
|
||||
clickHandler({
|
||||
target: findActive(index)[0]
|
||||
});
|
||||
};
|
||||
|
||||
return container
|
||||
.bind(settings.event, clickHandler)
|
||||
.bind("activate", activateHandler);
|
||||
},
|
||||
activate: function(index) {
|
||||
return this.trigger('activate', [index]);
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
871
js/ui.calendar.js
Normal file
@@ -0,0 +1,871 @@
|
||||
/* jQuery Calendar v2.7
|
||||
Written by Marc Grabanski (m@marcgrabanski.com) and enhanced by Keith Wood (kbwood@iprimus.com.au).
|
||||
|
||||
Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/jquery-calendar)
|
||||
Dual licensed under the GPL (http://www.gnu.org/licenses/gpl-3.0.txt) and
|
||||
CC (http://creativecommons.org/licenses/by/3.0/) licenses. "Share or Remix it but please Attribute the authors."
|
||||
Date: 09-03-2007 */
|
||||
|
||||
/* PopUp Calendar manager.
|
||||
Use the singleton instance of this class, popUpCal, to interact with the calendar.
|
||||
Settings for (groups of) calendars are maintained in an instance object
|
||||
(PopUpCalInstance), allowing multiple different settings on the same page. */
|
||||
function PopUpCal() {
|
||||
this._nextId = 0; // Next ID for a calendar instance
|
||||
this._inst = []; // List of instances indexed by ID
|
||||
this._curInst = null; // The current instance in use
|
||||
this._disabledInputs = []; // List of calendar inputs that have been disabled
|
||||
this._popUpShowing = false; // True if the popup calendar is showing , false if not
|
||||
this._inDialog = false; // True if showing within a "dialog", false if not
|
||||
this.regional = []; // Available regional settings, indexed by language code
|
||||
this.regional[''] = { // Default regional settings
|
||||
clearText: 'Clear', // Display text for clear link
|
||||
closeText: 'Close', // Display text for close link
|
||||
prevText: '<Prev', // Display text for previous month link
|
||||
nextText: 'Next>', // Display text for next month link
|
||||
currentText: 'Today', // Display text for current month link
|
||||
dayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Names of days starting at Sunday
|
||||
monthNames: ['January','February','March','April','May','June',
|
||||
'July','August','September','October','November','December'], // Names of months
|
||||
dateFormat: 'DMY/' // First three are day, month, year in the required order,
|
||||
// fourth (optional) is the separator, e.g. US would be 'MDY/', ISO would be 'YMD-'
|
||||
};
|
||||
this._defaults = { // Global defaults for all the calendar instances
|
||||
autoPopUp: 'focus', // 'focus' for popup on focus,
|
||||
// 'button' for trigger button, or 'both' for either
|
||||
defaultDate: null, // Used when field is blank: actual date,
|
||||
// +/-number for offset from today, null for today
|
||||
appendText: '', // Display text following the input box, e.g. showing the format
|
||||
buttonText: '...', // Text for trigger button
|
||||
buttonImage: '', // URL for trigger button image
|
||||
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
|
||||
closeAtTop: true, // True to have the clear/close at the top,
|
||||
// false to have them at the bottom
|
||||
hideIfNoPrevNext: false, // True to hide next/previous month links
|
||||
// if not applicable, false to just disable them
|
||||
changeMonth: true, // True if month can be selected directly, false if only prev/next
|
||||
changeYear: true, // True if year can be selected directly, false if only prev/next
|
||||
yearRange: '-10:+10', // Range of years to display in drop-down,
|
||||
// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
|
||||
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
|
||||
changeFirstDay: true, // True to click on day name to change, false to remain as set
|
||||
showOtherMonths: false, // True to show dates in other months, false to leave blank
|
||||
minDate: null, // The earliest selectable date, or null for no limit
|
||||
maxDate: null, // The latest selectable date, or null for no limit
|
||||
speed: 'medium', // Speed of display/closure
|
||||
customDate: null, // Function that takes a date and returns an array with
|
||||
// [0] = true if selectable, false if not,
|
||||
// [1] = custom CSS class name(s) or '', e.g. popUpCal.noWeekends
|
||||
fieldSettings: null, // Function that takes an input field and
|
||||
// returns a set of custom settings for the calendar
|
||||
onSelect: null // Define a callback function when a date is selected
|
||||
};
|
||||
$.extend(this._defaults, this.regional['']);
|
||||
this._calendarDiv = $('<div id="calendar_div"></div>');
|
||||
$(document.body).append(this._calendarDiv);
|
||||
$(document.body).mousedown(this._checkExternalClick);
|
||||
}
|
||||
|
||||
$.extend(PopUpCal.prototype, {
|
||||
/* Class name added to elements to indicate already configured with a calendar. */
|
||||
markerClassName: 'hasCalendar',
|
||||
|
||||
/* Register a new calendar instance - with custom settings. */
|
||||
_register: function(inst) {
|
||||
var id = this._nextId++;
|
||||
this._inst[id] = inst;
|
||||
return id;
|
||||
},
|
||||
|
||||
/* Retrieve a particular calendar instance based on its ID. */
|
||||
_getInst: function(id) {
|
||||
return this._inst[id] || id;
|
||||
},
|
||||
|
||||
/* Override the default settings for all instances of the calendar.
|
||||
@param settings object - the new settings to use as defaults (anonymous object)
|
||||
@return void */
|
||||
setDefaults: function(settings) {
|
||||
extendRemove(this._defaults, settings || {});
|
||||
},
|
||||
|
||||
/* Handle keystrokes. */
|
||||
_doKeyDown: function(e) {
|
||||
var inst = popUpCal._getInst(this._calId);
|
||||
if (popUpCal._popUpShowing) {
|
||||
switch (e.keyCode) {
|
||||
case 9: popUpCal.hideCalendar(inst, '');
|
||||
break; // hide on tab out
|
||||
case 13: popUpCal._selectDate(inst);
|
||||
break; // select the value on enter
|
||||
case 27: popUpCal.hideCalendar(inst, inst._get('speed'));
|
||||
break; // hide on escape
|
||||
case 33: popUpCal._adjustDate(inst, -1, (e.ctrlKey ? 'Y' : 'M'));
|
||||
break; // previous month/year on page up/+ ctrl
|
||||
case 34: popUpCal._adjustDate(inst, +1, (e.ctrlKey ? 'Y' : 'M'));
|
||||
break; // next month/year on page down/+ ctrl
|
||||
case 35: if (e.ctrlKey) popUpCal._clearDate(inst);
|
||||
break; // clear on ctrl+end
|
||||
case 36: if (e.ctrlKey) popUpCal._gotoToday(inst);
|
||||
break; // current on ctrl+home
|
||||
case 37: if (e.ctrlKey) popUpCal._adjustDate(inst, -1, 'D');
|
||||
break; // -1 day on ctrl+left
|
||||
case 38: if (e.ctrlKey) popUpCal._adjustDate(inst, -7, 'D');
|
||||
break; // -1 week on ctrl+up
|
||||
case 39: if (e.ctrlKey) popUpCal._adjustDate(inst, +1, 'D');
|
||||
break; // +1 day on ctrl+right
|
||||
case 40: if (e.ctrlKey) popUpCal._adjustDate(inst, +7, 'D');
|
||||
break; // +1 week on ctrl+down
|
||||
}
|
||||
}
|
||||
else if (e.keyCode == 36 && e.ctrlKey) { // display the calendar on ctrl+home
|
||||
popUpCal.showFor(this);
|
||||
}
|
||||
},
|
||||
|
||||
/* Filter entered characters. */
|
||||
_doKeyPress: function(e) {
|
||||
var inst = popUpCal._getInst(this._calId);
|
||||
var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
|
||||
return (chr < ' ' || chr == inst._get('dateFormat').charAt(3) ||
|
||||
(chr >= '0' && chr <= '9')); // only allow numbers and separator
|
||||
},
|
||||
|
||||
/* Attach the calendar to an input field. */
|
||||
_connectCalendar: function(target, inst) {
|
||||
var input = $(target);
|
||||
if (this._hasClass(input, this.markerClassName)) {
|
||||
return;
|
||||
}
|
||||
var appendText = inst._get('appendText');
|
||||
if (appendText) {
|
||||
input.after('<span class="calendar_append">' + appendText + '</span>');
|
||||
}
|
||||
var autoPopUp = inst._get('autoPopUp');
|
||||
if (autoPopUp == 'focus' || autoPopUp == 'both') { // pop-up calendar when in the marked field
|
||||
input.focus(this.showFor);
|
||||
}
|
||||
if (autoPopUp == 'button' || autoPopUp == 'both') { // pop-up calendar when button clicked
|
||||
var buttonText = inst._get('buttonText');
|
||||
var buttonImage = inst._get('buttonImage');
|
||||
var buttonImageOnly = inst._get('buttonImageOnly');
|
||||
var trigger = $(buttonImageOnly ? '<img class="calendar_trigger" src="' +
|
||||
buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
|
||||
'<button type="button" class="calendar_trigger">' + (buttonImage != '' ?
|
||||
'<img src="' + buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
|
||||
buttonText) + '</button>');
|
||||
input.wrap('<span class="calendar_wrap"></span>').after(trigger);
|
||||
trigger.click(this.showFor);
|
||||
}
|
||||
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress);
|
||||
input[0]._calId = inst._id;
|
||||
},
|
||||
|
||||
/* Attach an inline calendar to a div. */
|
||||
_inlineCalendar: function(target, inst) {
|
||||
var input = $(target);
|
||||
if (this._hasClass(input, this.markerClassName)) {
|
||||
return;
|
||||
}
|
||||
input.addClass(this.markerClassName).append(inst._calendarDiv);
|
||||
input[0]._calId = inst._id;
|
||||
},
|
||||
|
||||
/* Does this element have a particular class? */
|
||||
_hasClass: function(element, className) {
|
||||
var classes = element.attr('class');
|
||||
return (classes && classes.indexOf(className) > -1);
|
||||
},
|
||||
|
||||
/* Pop-up the calendar in a "dialog" box.
|
||||
@param dateText string - the initial date to display (in the current format)
|
||||
@param onSelect function - the function(dateText) to call when a date is selected
|
||||
@param settings object - update the dialog calendar instance's settings (anonymous object)
|
||||
@param pos int[2] - coordinates for the dialog's position within the screen
|
||||
leave empty for default (screen centre)
|
||||
@return void */
|
||||
dialogCalendar: function(dateText, onSelect, settings, pos) {
|
||||
var inst = this._dialogInst; // internal instance
|
||||
if (!inst) {
|
||||
inst = this._dialogInst = new PopUpCalInstance({}, false);
|
||||
this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');
|
||||
this._dialogInput.keydown(this._doKeyDown);
|
||||
$('body').append(this._dialogInput);
|
||||
this._dialogInput[0]._calId = inst._id;
|
||||
}
|
||||
extendRemove(inst._settings, settings || {});
|
||||
this._dialogInput.val(dateText);
|
||||
|
||||
/* Cross Browser Positioning */
|
||||
if (self.innerHeight) { // all except Explorer
|
||||
windowWidth = self.innerWidth;
|
||||
windowHeight = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
windowHeight = document.documentElement.clientHeight;
|
||||
} else if (document.body) { // other Explorers
|
||||
windowWidth = document.body.clientWidth;
|
||||
windowHeight = document.body.clientHeight;
|
||||
}
|
||||
this._pos = pos || // should use actual width/height below
|
||||
[(windowWidth / 2) - 100, (windowHeight / 2) - 100];
|
||||
|
||||
// move input on screen for focus, but hidden behind dialog
|
||||
this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
|
||||
inst._settings.onSelect = onSelect;
|
||||
this._inDialog = true;
|
||||
this._calendarDiv.addClass('calendar_dialog');
|
||||
this.showFor(this._dialogInput[0]);
|
||||
if ($.blockUI) {
|
||||
$.blockUI(this._calendarDiv);
|
||||
}
|
||||
},
|
||||
|
||||
/* Enable the input field(s) for entry.
|
||||
@param inputs element/object - single input field or jQuery collection of input fields
|
||||
@return void */
|
||||
enableFor: function(inputs) {
|
||||
inputs = (inputs.jquery ? inputs : $(inputs));
|
||||
inputs.each(function() {
|
||||
this.disabled = false;
|
||||
$('../button.calendar_trigger', this).each(function() { this.disabled = false; });
|
||||
$('../img.calendar_trigger', this).css({opacity:'1.0',cursor:''});
|
||||
var $this = this;
|
||||
popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
|
||||
function(value) { return (value == $this ? null : value); }); // delete entry
|
||||
});
|
||||
},
|
||||
|
||||
/* Disable the input field(s) from entry.
|
||||
@param inputs element/object - single input field or jQuery collection of input fields
|
||||
@return void */
|
||||
disableFor: function(inputs) {
|
||||
inputs = (inputs.jquery ? inputs : $(inputs));
|
||||
inputs.each(function() {
|
||||
this.disabled = true;
|
||||
$('../button.calendar_trigger', this).each(function() { this.disabled = true; });
|
||||
$('../img.calendar_trigger', this).css({opacity:'0.5',cursor:'default'});
|
||||
var $this = this;
|
||||
popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
|
||||
function(value) { return (value == $this ? null : value); }); // delete entry
|
||||
popUpCal._disabledInputs[popUpCal._disabledInputs.length] = this;
|
||||
});
|
||||
},
|
||||
|
||||
/* Update the settings for a calendar attached to an input field or division.
|
||||
@param control element - the input field or div/span attached to the calendar or
|
||||
string - the ID or other jQuery selector of the input field
|
||||
@param settings object - the new settings to update
|
||||
@return void */
|
||||
reconfigureFor: function(control, settings) {
|
||||
control = (typeof control == 'string' ? $(control)[0] : control);
|
||||
var inst = this._getInst(control._calId);
|
||||
if (inst) {
|
||||
extendRemove(inst._settings, settings || {});
|
||||
this._updateCalendar(inst);
|
||||
}
|
||||
},
|
||||
|
||||
/* Set the date for a calendar attached to an input field or division.
|
||||
@param control element - the input field or div/span attached to the calendar
|
||||
@param date Date - the new date
|
||||
@return void */
|
||||
setDateFor: function(control, date) {
|
||||
var inst = this._getInst(control._calId);
|
||||
if (inst) {
|
||||
inst._setDate(date);
|
||||
}
|
||||
},
|
||||
|
||||
/* Retrieve the date for a calendar attached to an input field or division.
|
||||
@param control element - the input field or div/span attached to the calendar
|
||||
@return Date - the current date */
|
||||
getDateFor: function(control) {
|
||||
var inst = this._getInst(control._calId);
|
||||
return (inst ? inst._getDate() : null);
|
||||
},
|
||||
|
||||
/* Pop-up the calendar for a given input field.
|
||||
@param target element - the input field attached to the calendar
|
||||
@return void */
|
||||
showFor: function(target) {
|
||||
var input = (target.nodeName && target.nodeName.toLowerCase() == 'input' ? target : this);
|
||||
if (input.nodeName.toLowerCase() != 'input') { // find from button/image trigger
|
||||
input = $('input', input.parentNode)[0];
|
||||
}
|
||||
if (popUpCal._lastInput == input) { // already here
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < popUpCal._disabledInputs.length; i++) { // check not disabled
|
||||
if (popUpCal._disabledInputs[i] == input) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var inst = popUpCal._getInst(input._calId);
|
||||
var fieldSettings = inst._get('fieldSettings');
|
||||
extendRemove(inst._settings, (fieldSettings ? fieldSettings(input) : {}));
|
||||
popUpCal.hideCalendar(inst, '');
|
||||
popUpCal._lastInput = input;
|
||||
inst._setDateFromField(input);
|
||||
if (popUpCal._inDialog) { // hide cursor
|
||||
input.value = '';
|
||||
}
|
||||
if (!popUpCal._pos) { // position below input
|
||||
popUpCal._pos = popUpCal._findPos(input);
|
||||
popUpCal._pos[1] += input.offsetHeight;
|
||||
}
|
||||
inst._calendarDiv.css('position', (popUpCal._inDialog && $.blockUI ? 'static' : 'absolute')).
|
||||
css('left', popUpCal._pos[0] + 'px').css('top', popUpCal._pos[1] + 'px');
|
||||
popUpCal._pos = null;
|
||||
popUpCal._showCalendar(inst);
|
||||
},
|
||||
|
||||
/* Construct and display the calendar. */
|
||||
_showCalendar: function(id) {
|
||||
var inst = this._getInst(id);
|
||||
popUpCal._updateCalendar(inst);
|
||||
if (!inst._inline) {
|
||||
var speed = inst._get('speed');
|
||||
inst._calendarDiv.show(speed, function() {
|
||||
popUpCal._popUpShowing = true;
|
||||
popUpCal._afterShow(inst);
|
||||
});
|
||||
if (speed == '') {
|
||||
popUpCal._popUpShowing = true;
|
||||
popUpCal._afterShow(inst);
|
||||
}
|
||||
if (inst._input[0].type != 'hidden') {
|
||||
inst._input[0].focus();
|
||||
}
|
||||
this._curInst = inst;
|
||||
}
|
||||
},
|
||||
|
||||
/* Generate the calendar content. */
|
||||
_updateCalendar: function(inst) {
|
||||
inst._calendarDiv.empty().append(inst._generateCalendar());
|
||||
if (inst._input && inst._input[0].type != 'hidden') {
|
||||
inst._input[0].focus();
|
||||
}
|
||||
},
|
||||
|
||||
/* Tidy up after displaying the calendar. */
|
||||
_afterShow: function(inst) {
|
||||
if ($.browser.msie) { // fix IE < 7 select problems
|
||||
$('#calendar_cover').css({width: inst._calendarDiv[0].offsetWidth + 4,
|
||||
height: inst._calendarDiv[0].offsetHeight + 4});
|
||||
}
|
||||
// re-position on screen if necessary
|
||||
var calDiv = inst._calendarDiv[0];
|
||||
var pos = popUpCal._findPos(inst._input[0]);
|
||||
// Get browser width and X value (IE6+, FF, Safari, Opera)
|
||||
if( typeof( window.innerWidth ) == 'number' ) {
|
||||
browserWidth = window.innerWidth;
|
||||
} else {
|
||||
browserWidth = document.documentElement.clientWidth;
|
||||
}
|
||||
if ( document.documentElement && (document.documentElement.scrollLeft)) {
|
||||
browserX = document.documentElement.scrollLeft;
|
||||
} else {
|
||||
browserX = document.body.scrollLeft;
|
||||
}
|
||||
// Reposition calendar if outside the browser window.
|
||||
if ((calDiv.offsetLeft + calDiv.offsetWidth) >
|
||||
(browserWidth + browserX) ) {
|
||||
inst._calendarDiv.css('left', (pos[0] + inst._input[0].offsetWidth - calDiv.offsetWidth) + 'px');
|
||||
}
|
||||
// Get browser height and Y value (IE6+, FF, Safari, Opera)
|
||||
if( typeof( window.innerHeight ) == 'number' ) {
|
||||
browserHeight = window.innerHeight;
|
||||
} else {
|
||||
browserHeight = document.documentElement.clientHeight;
|
||||
}
|
||||
if ( document.documentElement && (document.documentElement.scrollTop)) {
|
||||
browserTopY = document.documentElement.scrollTop;
|
||||
} else {
|
||||
browserTopY = document.body.scrollTop;
|
||||
}
|
||||
// Reposition calendar if outside the browser window.
|
||||
if ((calDiv.offsetTop + calDiv.offsetHeight) >
|
||||
(browserTopY + browserHeight) ) {
|
||||
inst._calendarDiv.css('top', (pos[1] - calDiv.offsetHeight) + 'px');
|
||||
}
|
||||
},
|
||||
|
||||
/* Hide the calendar from view.
|
||||
@param id string/object - the ID of the current calendar instance,
|
||||
or the instance itself
|
||||
@param speed string - the speed at which to close the calendar
|
||||
@return void */
|
||||
hideCalendar: function(id, speed) {
|
||||
var inst = this._getInst(id);
|
||||
if (popUpCal._popUpShowing) {
|
||||
speed = (speed != null ? speed : inst._get('speed'));
|
||||
inst._calendarDiv.hide(speed, function() {
|
||||
popUpCal._tidyDialog(inst);
|
||||
});
|
||||
if (speed == '') {
|
||||
popUpCal._tidyDialog(inst);
|
||||
}
|
||||
popUpCal._popUpShowing = false;
|
||||
popUpCal._lastInput = null;
|
||||
inst._settings.prompt = null;
|
||||
if (popUpCal._inDialog) {
|
||||
popUpCal._dialogInput.css('position', 'absolute').
|
||||
css('left', '0px').css('top', '-100px');
|
||||
if ($.blockUI) {
|
||||
$.unblockUI();
|
||||
$('body').append(this._calendarDiv);
|
||||
}
|
||||
}
|
||||
popUpCal._inDialog = false;
|
||||
}
|
||||
popUpCal._curInst = null;
|
||||
},
|
||||
|
||||
/* Tidy up after a dialog display. */
|
||||
_tidyDialog: function(inst) {
|
||||
inst._calendarDiv.removeClass('calendar_dialog');
|
||||
$('.calendar_prompt', inst._calendarDiv).remove();
|
||||
},
|
||||
|
||||
/* Close calendar if clicked elsewhere. */
|
||||
_checkExternalClick: function(event) {
|
||||
if (!popUpCal._curInst) {
|
||||
return;
|
||||
}
|
||||
var target = $(event.target);
|
||||
if( (target.parents("#calendar_div").length == 0)
|
||||
&& (target.attr('class') != 'calendar_trigger')
|
||||
&& popUpCal._popUpShowing
|
||||
&& !(popUpCal._inDialog && $.blockUI) )
|
||||
{
|
||||
popUpCal.hideCalendar(popUpCal._curInst, '');
|
||||
}
|
||||
},
|
||||
|
||||
/* Adjust one of the date sub-fields. */
|
||||
_adjustDate: function(id, offset, period) {
|
||||
var inst = this._getInst(id);
|
||||
inst._adjustDate(offset, period);
|
||||
this._updateCalendar(inst);
|
||||
},
|
||||
|
||||
/* Action for current link. */
|
||||
_gotoToday: function(id) {
|
||||
var date = new Date();
|
||||
var inst = this._getInst(id);
|
||||
inst._selectedDay = date.getDate();
|
||||
inst._selectedMonth = date.getMonth();
|
||||
inst._selectedYear = date.getFullYear();
|
||||
this._adjustDate(inst);
|
||||
},
|
||||
|
||||
/* Action for selecting a new month/year. */
|
||||
_selectMonthYear: function(id, select, period) {
|
||||
var inst = this._getInst(id);
|
||||
inst._selectingMonthYear = false;
|
||||
inst[period == 'M' ? '_selectedMonth' : '_selectedYear'] =
|
||||
select.options[select.selectedIndex].value - 0;
|
||||
this._adjustDate(inst);
|
||||
},
|
||||
|
||||
/* Restore input focus after not changing month/year. */
|
||||
_clickMonthYear: function(id) {
|
||||
var inst = this._getInst(id);
|
||||
if (inst._input && inst._selectingMonthYear && !$.browser.msie) {
|
||||
inst._input[0].focus();
|
||||
}
|
||||
inst._selectingMonthYear = !inst._selectingMonthYear;
|
||||
},
|
||||
|
||||
/* Action for changing the first week day. */
|
||||
_changeFirstDay: function(id, a) {
|
||||
var inst = this._getInst(id);
|
||||
var dayNames = inst._get('dayNames');
|
||||
var value = a.firstChild.nodeValue;
|
||||
for (var i = 0; i < 7; i++) {
|
||||
if (dayNames[i] == value) {
|
||||
inst._settings.firstDay = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._updateCalendar(inst);
|
||||
},
|
||||
|
||||
/* Action for selecting a day. */
|
||||
_selectDay: function(id, td) {
|
||||
var inst = this._getInst(id);
|
||||
inst._selectedDay = $("a", td).html();
|
||||
this._selectDate(id);
|
||||
},
|
||||
|
||||
/* Erase the input field and hide the calendar. */
|
||||
_clearDate: function(id) {
|
||||
this._selectDate(id, '');
|
||||
},
|
||||
|
||||
/* Update the input field with the selected date. */
|
||||
_selectDate: function(id, dateStr) {
|
||||
var inst = this._getInst(id);
|
||||
dateStr = (dateStr != null ? dateStr : inst._formatDate());
|
||||
if (inst._input) {
|
||||
inst._input.val(dateStr);
|
||||
}
|
||||
var onSelect = inst._get('onSelect');
|
||||
if (onSelect) {
|
||||
onSelect(dateStr, inst); // trigger custom callback
|
||||
}
|
||||
else {
|
||||
inst._input.trigger('change'); // fire the change event
|
||||
}
|
||||
if (inst._inline) {
|
||||
this._updateCalendar(inst);
|
||||
}
|
||||
else {
|
||||
this.hideCalendar(inst, inst._get('speed'));
|
||||
}
|
||||
},
|
||||
|
||||
/* Set as customDate function to prevent selection of weekends.
|
||||
@param date Date - the date to customise
|
||||
@return [boolean, string] - is this date selectable?, what is its CSS class? */
|
||||
noWeekends: function(date) {
|
||||
var day = date.getDay();
|
||||
return [(day > 0 && day < 6), ''];
|
||||
},
|
||||
|
||||
/* Find an object's position on the screen. */
|
||||
_findPos: function(obj) {
|
||||
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
|
||||
obj = obj.nextSibling;
|
||||
}
|
||||
var curleft = curtop = 0;
|
||||
if (obj && obj.offsetParent) {
|
||||
curleft = obj.offsetLeft;
|
||||
curtop = obj.offsetTop;
|
||||
while (obj = obj.offsetParent) {
|
||||
var origcurleft = curleft;
|
||||
curleft += obj.offsetLeft;
|
||||
if (curleft < 0) {
|
||||
curleft = origcurleft;
|
||||
}
|
||||
curtop += obj.offsetTop;
|
||||
}
|
||||
}
|
||||
return [curleft,curtop];
|
||||
}
|
||||
});
|
||||
|
||||
/* Individualised settings for calendars applied to one or more related inputs.
|
||||
Instances are managed and manipulated through the PopUpCal manager. */
|
||||
function PopUpCalInstance(settings, inline) {
|
||||
this._id = popUpCal._register(this);
|
||||
this._selectedDay = 0;
|
||||
this._selectedMonth = 0; // 0-11
|
||||
this._selectedYear = 0; // 4-digit year
|
||||
this._input = null; // The attached input field
|
||||
this._inline = inline; // True if showing inline, false if used in a popup
|
||||
this._calendarDiv = (!inline ? popUpCal._calendarDiv :
|
||||
$('<div id="calendar_div_' + this._id + '" class="calendar_inline"></div>'));
|
||||
// customise the calendar object - uses manager defaults if not overridden
|
||||
this._settings = extendRemove({}, settings || {}); // clone
|
||||
if (inline) {
|
||||
this._setDate(this._getDefaultDate());
|
||||
}
|
||||
}
|
||||
|
||||
$.extend(PopUpCalInstance.prototype, {
|
||||
/* Get a setting value, defaulting if necessary. */
|
||||
_get: function(name) {
|
||||
return (this._settings[name] != null ? this._settings[name] : popUpCal._defaults[name]);
|
||||
},
|
||||
|
||||
/* Parse existing date and initialise calendar. */
|
||||
_setDateFromField: function(input) {
|
||||
this._input = $(input);
|
||||
var dateFormat = this._get('dateFormat');
|
||||
var currentDate = this._input.val().split(dateFormat.charAt(3));
|
||||
if (currentDate.length == 3) {
|
||||
this._currentDay = parseInt(currentDate[dateFormat.indexOf('D')], 10);
|
||||
this._currentMonth = parseInt(currentDate[dateFormat.indexOf('M')], 10) - 1;
|
||||
this._currentYear = parseInt(currentDate[dateFormat.indexOf('Y')], 10);
|
||||
}
|
||||
else {
|
||||
var date = this._getDefaultDate();
|
||||
this._currentDay = date.getDate();
|
||||
this._currentMonth = date.getMonth();
|
||||
this._currentYear = date.getFullYear();
|
||||
}
|
||||
this._selectedDay = this._currentDay;
|
||||
this._selectedMonth = this._currentMonth;
|
||||
this._selectedYear = this._currentYear;
|
||||
this._adjustDate();
|
||||
},
|
||||
|
||||
/* Retrieve the default date shown on opening. */
|
||||
_getDefaultDate: function() {
|
||||
var offsetDate = function(offset) {
|
||||
var date = new Date();
|
||||
date.setDate(date.getDate() + offset);
|
||||
return date;
|
||||
};
|
||||
var defaultDate = this._get('defaultDate');
|
||||
return (defaultDate == null ? new Date() :
|
||||
(typeof defaultDate == 'number' ? offsetDate(defaultDate) : defaultDate));
|
||||
},
|
||||
|
||||
/* Set the date directly. */
|
||||
_setDate: function(date) {
|
||||
this._selectedDay = this._currentDay = date.getDate();
|
||||
this._selectedMonth = this._currentMonth = date.getMonth();
|
||||
this._selectedYear = this._currentYear = date.getFullYear();
|
||||
this._adjustDate();
|
||||
},
|
||||
|
||||
/* Retrieve the date directly. */
|
||||
_getDate: function() {
|
||||
return new Date(this._currentYear, this._currentMonth, this._currentDay);
|
||||
},
|
||||
|
||||
/* Generate the HTML for the current state of the calendar. */
|
||||
_generateCalendar: function() {
|
||||
var today = new Date();
|
||||
today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
|
||||
// build the calendar HTML
|
||||
var controls = '<div class="calendar_control">' +
|
||||
'<a class="calendar_clear" onclick="popUpCal._clearDate(' + this._id + ');">' +
|
||||
this._get('clearText') + '</a>' +
|
||||
'<a class="calendar_close" onclick="popUpCal.hideCalendar(' + this._id + ');">' +
|
||||
this._get('closeText') + '</a></div>';
|
||||
var prompt = this._get('prompt');
|
||||
var closeAtTop = this._get('closeAtTop');
|
||||
var hideIfNoPrevNext = this._get('hideIfNoPrevNext');
|
||||
// controls and links
|
||||
var html = (prompt ? '<div class="calendar_prompt">' + prompt + '</div>' : '') +
|
||||
(closeAtTop && !this._inline ? controls : '') + '<div class="calendar_links">' +
|
||||
(this._canAdjustMonth(-1) ? '<a class="calendar_prev" ' +
|
||||
'onclick="popUpCal._adjustDate(' + this._id + ', -1, \'M\');">' + this._get('prevText') + '</a>' :
|
||||
(hideIfNoPrevNext ? '' : '<label class="calendar_prev">' + this._get('prevText') + '</label>')) +
|
||||
(this._isInRange(today) ? '<a class="calendar_current" ' +
|
||||
'onclick="popUpCal._gotoToday(' + this._id + ');">' + this._get('currentText') + '</a>' : '') +
|
||||
(this._canAdjustMonth(+1) ? '<a class="calendar_next" ' +
|
||||
'onclick="popUpCal._adjustDate(' + this._id + ', +1, \'M\');">' + this._get('nextText') + '</a>' :
|
||||
(hideIfNoPrevNext ? '' : '<label class="calendar_next">' + this._get('nextText') + '</label>')) +
|
||||
'</div><div class="calendar_header">';
|
||||
var minDate = this._get('minDate');
|
||||
var maxDate = this._get('maxDate');
|
||||
// month selection
|
||||
var monthNames = this._get('monthNames');
|
||||
if (!this._get('changeMonth')) {
|
||||
html += monthNames[this._selectedMonth] + ' ';
|
||||
}
|
||||
else {
|
||||
var inMinYear = (minDate && minDate.getFullYear() == this._selectedYear);
|
||||
var inMaxYear = (maxDate && maxDate.getFullYear() == this._selectedYear);
|
||||
html += '<select class="calendar_newMonth" ' +
|
||||
'onchange="popUpCal._selectMonthYear(' + this._id + ', this, \'M\');" ' +
|
||||
'onclick="popUpCal._clickMonthYear(' + this._id + ');">';
|
||||
for (var month = 0; month < 12; month++) {
|
||||
if ((!inMinYear || month >= minDate.getMonth()) &&
|
||||
(!inMaxYear || month <= maxDate.getMonth())) {
|
||||
html += '<option value="' + month + '"' +
|
||||
(month == this._selectedMonth ? ' selected="selected"' : '') +
|
||||
'>' + monthNames[month] + '</option>';
|
||||
}
|
||||
}
|
||||
html += '</select>';
|
||||
}
|
||||
// year selection
|
||||
if (!this._get('changeYear')) {
|
||||
html += this._selectedYear;
|
||||
}
|
||||
else {
|
||||
// determine range of years to display
|
||||
var years = this._get('yearRange').split(':');
|
||||
var year = 0;
|
||||
var endYear = 0;
|
||||
if (years.length != 2) {
|
||||
year = this._selectedYear - 10;
|
||||
endYear = this._selectedYear + 10;
|
||||
}
|
||||
else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
|
||||
year = this._selectedYear + parseInt(years[0], 10);
|
||||
endYear = this._selectedYear + parseInt(years[1], 10);
|
||||
}
|
||||
else {
|
||||
year = parseInt(years[0], 10);
|
||||
endYear = parseInt(years[1], 10);
|
||||
}
|
||||
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
|
||||
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
|
||||
html += '<select class="calendar_newYear" onchange="popUpCal._selectMonthYear(' +
|
||||
this._id + ', this, \'Y\');" ' + 'onclick="popUpCal._clickMonthYear(' +
|
||||
this._id + ');">';
|
||||
for (; year <= endYear; year++) {
|
||||
html += '<option value="' + year + '"' +
|
||||
(year == this._selectedYear ? ' selected="selected"' : '') +
|
||||
'>' + year + '</option>';
|
||||
}
|
||||
html += '</select>';
|
||||
}
|
||||
html += '</div><table class="calendar" cellpadding="0" cellspacing="0"><thead>' +
|
||||
'<tr class="calendar_titleRow">';
|
||||
var firstDay = this._get('firstDay');
|
||||
var changeFirstDay = this._get('changeFirstDay');
|
||||
var dayNames = this._get('dayNames');
|
||||
for (var dow = 0; dow < 7; dow++) { // days of the week
|
||||
html += '<td>' + (!changeFirstDay ? '' : '<a onclick="popUpCal._changeFirstDay(' +
|
||||
this._id + ', this);">') + dayNames[(dow + firstDay) % 7] +
|
||||
(changeFirstDay ? '</a>' : '') + '</td>';
|
||||
}
|
||||
html += '</tr></thead><tbody>';
|
||||
var daysInMonth = this._getDaysInMonth(this._selectedYear, this._selectedMonth);
|
||||
this._selectedDay = Math.min(this._selectedDay, daysInMonth);
|
||||
var leadDays = (this._getFirstDayOfMonth(this._selectedYear, this._selectedMonth) - firstDay + 7) % 7;
|
||||
var currentDate = new Date(this._currentYear, this._currentMonth, this._currentDay);
|
||||
var selectedDate = new Date(this._selectedYear, this._selectedMonth, this._selectedDay);
|
||||
var printDate = new Date(this._selectedYear, this._selectedMonth, 1 - leadDays);
|
||||
var numRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
|
||||
var customDate = this._get('customDate');
|
||||
var showOtherMonths = this._get('showOtherMonths');
|
||||
for (var row = 0; row < numRows; row++) { // create calendar rows
|
||||
html += '<tr class="calendar_daysRow">';
|
||||
for (var dow = 0; dow < 7; dow++) { // create calendar days
|
||||
var customSettings = (customDate ? customDate(printDate) : [true, '']);
|
||||
var otherMonth = (printDate.getMonth() != this._selectedMonth);
|
||||
var unselectable = otherMonth || !customSettings[0] ||
|
||||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
|
||||
html += '<td class="calendar_daysCell' +
|
||||
((dow + firstDay + 6) % 7 >= 5 ? ' calendar_weekEndCell' : '') + // highlight weekends
|
||||
(otherMonth ? ' calendar_otherMonth' : '') + // highlight days from other months
|
||||
(printDate.getTime() == selectedDate.getTime() ? ' calendar_daysCellOver' : '') + // highlight selected day
|
||||
(unselectable ? ' calendar_unselectable' : '') + // highlight unselectable days
|
||||
(otherMonth && !showOtherMonths ? '' : ' ' + customSettings[1] + // highlight custom dates
|
||||
(printDate.getTime() == currentDate.getTime() ? ' calendar_currentDay' : // highlight current day
|
||||
(printDate.getTime() == today.getTime() ? ' calendar_today' : ''))) + '"' + // highlight today (if different)
|
||||
(unselectable ? '' : ' onmouseover="$(this).addClass(\'calendar_daysCellOver\');"' +
|
||||
' onmouseout="$(this).removeClass(\'calendar_daysCellOver\');"' +
|
||||
' onclick="popUpCal._selectDay(' + this._id + ', this);"') + '>' + // actions
|
||||
(otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months
|
||||
(unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
|
||||
printDate.setDate(printDate.getDate() + 1);
|
||||
}
|
||||
html += '</tr>';
|
||||
}
|
||||
html += '</tbody></table>' + (!closeAtTop && !this._inline ? controls : '') +
|
||||
'<div style="clear: both;"></div>' + (!$.browser.msie ? '' :
|
||||
'<!--[if lte IE 6.5]><iframe src="javascript:false;" class="calendar_cover"></iframe><![endif]-->');
|
||||
return html;
|
||||
},
|
||||
|
||||
/* Adjust one of the date sub-fields. */
|
||||
_adjustDate: function(offset, period) {
|
||||
var date = new Date(this._selectedYear + (period == 'Y' ? offset : 0),
|
||||
this._selectedMonth + (period == 'M' ? offset : 0),
|
||||
this._selectedDay + (period == 'D' ? offset : 0));
|
||||
// ensure it is within the bounds set
|
||||
var minDate = this._get('minDate');
|
||||
var maxDate = this._get('maxDate');
|
||||
date = (minDate && date < minDate ? minDate : date);
|
||||
date = (maxDate && date > maxDate ? maxDate : date);
|
||||
this._selectedDay = date.getDate();
|
||||
this._selectedMonth = date.getMonth();
|
||||
this._selectedYear = date.getFullYear();
|
||||
},
|
||||
|
||||
/* Find the number of days in a given month. */
|
||||
_getDaysInMonth: function(year, month) {
|
||||
return 32 - new Date(year, month, 32).getDate();
|
||||
},
|
||||
|
||||
/* Find the day of the week of the first of a month. */
|
||||
_getFirstDayOfMonth: function(year, month) {
|
||||
return new Date(year, month, 1).getDay();
|
||||
},
|
||||
|
||||
/* Determines if we should allow a "next/prev" month display change. */
|
||||
_canAdjustMonth: function(offset) {
|
||||
var date = new Date(this._selectedYear, this._selectedMonth + offset, 1);
|
||||
if (offset < 0) {
|
||||
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
|
||||
}
|
||||
return this._isInRange(date);
|
||||
},
|
||||
|
||||
/* Is the given date in the accepted range? */
|
||||
_isInRange: function(date) {
|
||||
var minDate = this._get('minDate');
|
||||
var maxDate = this._get('maxDate');
|
||||
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
|
||||
},
|
||||
|
||||
/* Format the given date for display. */
|
||||
_formatDate: function() {
|
||||
var day = this._currentDay = this._selectedDay;
|
||||
var month = this._currentMonth = this._selectedMonth;
|
||||
var year = this._currentYear = this._selectedYear;
|
||||
month++; // adjust javascript month
|
||||
var dateFormat = this._get('dateFormat');
|
||||
var dateString = '';
|
||||
for (var i = 0; i < 3; i++) {
|
||||
dateString += dateFormat.charAt(3) +
|
||||
(dateFormat.charAt(i) == 'D' ? (day < 10 ? '0' : '') + day :
|
||||
(dateFormat.charAt(i) == 'M' ? (month < 10 ? '0' : '') + month :
|
||||
(dateFormat.charAt(i) == 'Y' ? year : '?')));
|
||||
}
|
||||
return dateString.substring(dateFormat.charAt(3) ? 1 : 0);
|
||||
}
|
||||
});
|
||||
|
||||
/* jQuery extend now ignores nulls! */
|
||||
function extendRemove(target, props) {
|
||||
$.extend(target, props);
|
||||
for (var name in props) {
|
||||
if (props[name] == null) {
|
||||
target[name] = null;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
/* Attach the calendar to a jQuery selection.
|
||||
@param settings object - the new settings to use for this calendar instance (anonymous)
|
||||
@return jQuery object - for chaining further calls */
|
||||
$.fn.calendar = function(settings) {
|
||||
return this.each(function() {
|
||||
// check for settings on the control itself - in namespace 'cal:'
|
||||
var inlineSettings = null;
|
||||
for (attrName in popUpCal._defaults) {
|
||||
var attrValue = this.getAttribute('cal:' + attrName);
|
||||
if (attrValue) {
|
||||
inlineSettings = inlineSettings || {};
|
||||
try {
|
||||
inlineSettings[attrName] = eval(attrValue);
|
||||
}
|
||||
catch (err) {
|
||||
inlineSettings[attrName] = attrValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
var nodeName = this.nodeName.toLowerCase();
|
||||
if (nodeName == 'input') {
|
||||
var instSettings = (inlineSettings ? $.extend($.extend({}, settings || {}),
|
||||
inlineSettings || {}) : settings); // clone and customise
|
||||
var inst = (inst && !inlineSettings ? inst :
|
||||
new PopUpCalInstance(instSettings, false));
|
||||
popUpCal._connectCalendar(this, inst);
|
||||
}
|
||||
else if (nodeName == 'div' || nodeName == 'span') {
|
||||
var instSettings = $.extend($.extend({}, settings || {}),
|
||||
inlineSettings || {}); // clone and customise
|
||||
var inst = new PopUpCalInstance(instSettings, true);
|
||||
popUpCal._inlineCalendar(this, inst);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* Initialise the calendar. */
|
||||
$(document).ready(function() {
|
||||
popUpCal = new PopUpCal(); // singleton instance
|
||||
});
|
||||
133
js/ui.dialog.js
Normal file
@@ -0,0 +1,133 @@
|
||||
(function($)
|
||||
{
|
||||
//If the UI scope is not availalable, add it
|
||||
$.ui = $.ui || {};
|
||||
|
||||
$.fn.dialog = function(o) {
|
||||
return this.each(function() {
|
||||
if (!$(this).is(".ui-dialog")) new $.ui.dialog(this, o);
|
||||
});
|
||||
}
|
||||
$.fn.dialogOpen = function() {
|
||||
return this.each(function() {
|
||||
var contentEl;
|
||||
if ($(this).parents(".ui-dialog").length) contentEl = this;
|
||||
if (!contentEl && $(this).is(".ui-dialog")) contentEl = $('.ui-dialog-content', this)[0];
|
||||
$.ui.dialogOpen(contentEl)
|
||||
});
|
||||
}
|
||||
$.fn.dialogClose = function() {
|
||||
return this.each(function() {
|
||||
var contentEl;
|
||||
if ($(this).parents(".ui-dialog").length) contentEl = this;
|
||||
if (!contentEl && $(this).is(".ui-dialog")) contentEl = $('.ui-dialog-content', this)[0];
|
||||
$.ui.dialogClose(contentEl);
|
||||
});
|
||||
}
|
||||
|
||||
$.ui.dialog = function(el, o) {
|
||||
|
||||
var options = {
|
||||
width: 300,
|
||||
height: 200,
|
||||
position: 'center',
|
||||
buttons: [],
|
||||
modal: false,
|
||||
drag: true,
|
||||
resize: true,
|
||||
shadow: false // It's quite slow
|
||||
};
|
||||
var o = o || {}; $.extend(options, o); //Extend and copy options
|
||||
this.element = el; var self = this; //Do bindings
|
||||
$.data(this.element, "ui-dialog", this);
|
||||
|
||||
var uiDialogContent = $(el).addClass('ui-dialog-content')
|
||||
.wrap(document.createElement('div'))
|
||||
.wrap(document.createElement('div'));
|
||||
var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'});
|
||||
var uiDialog = uiDialogContainer.parent()
|
||||
.addClass('ui-dialog').addClass(uiDialogContent.attr('className'))
|
||||
.css({position: 'absolute', width: options.width, height: options.height});
|
||||
|
||||
if (options.modal == false && options.resize == true) {
|
||||
uiDialog.append("<div class='ui-resizable-n ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-s ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-e ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-w ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-ne ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-se ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-sw ui-resizable-handle'></div>")
|
||||
.append("<div class='ui-resizable-nw ui-resizable-handle'></div>");
|
||||
|
||||
uiDialog.resizable();
|
||||
}
|
||||
|
||||
uiDialogContainer.prepend('<div class="ui-dialog-titlebar"></div>');
|
||||
var uiDialogTitlebar = $('.ui-dialog-titlebar', uiDialogContainer);
|
||||
var title = (options.title) ? options.title : (uiDialogContent.attr('title')) ? uiDialogContent.attr('title') : '';
|
||||
uiDialogTitlebar.append('<span class="ui-dialog-title">' + title + '</span>');
|
||||
uiDialogTitlebar.append('<div class="ui-dialog-titlebar-close"></div>');
|
||||
$('.ui-dialog-titlebar-close', uiDialogTitlebar)
|
||||
.hover(function() { $(this).addClass('ui-dialog-titlebar-close-hover'); },
|
||||
function() { $(this).removeClass('ui-dialog-titlebar-close-hover'); })
|
||||
.mousedown(function(ev) {
|
||||
ev.stopPropagation();
|
||||
})
|
||||
.click(function() {
|
||||
self.close();
|
||||
});
|
||||
var l = 0;
|
||||
$.each(options.buttons, function() { l = 1; return false; });
|
||||
if (l == 1) {
|
||||
uiDialog.append('<div class="ui-dialog-buttonpane"></div>');
|
||||
var uiDialogButtonPane = $('.ui-dialog-buttonpane', uiDialog);
|
||||
$.each(options.buttons, function(name, value) {
|
||||
var btn = $(document.createElement('button')).text(name).click(value);
|
||||
uiDialogButtonPane.append(btn);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.modal == false && options.drag == true) {
|
||||
uiDialog.draggable({ handle: '.ui-dialog-titlebar' });
|
||||
}
|
||||
|
||||
this.open = function() {
|
||||
var wnd = $(window), top = 0, left = 0;
|
||||
switch (options.position) {
|
||||
case 'center':
|
||||
top = (wnd.height() / 2) - (uiDialog.height() / 2);
|
||||
left = (wnd.width() / 2) - (uiDialog.width() / 2);
|
||||
break;
|
||||
case 'left':
|
||||
top = (wnd.height() / 2) - (uiDialog.height() / 2);
|
||||
left = 0;
|
||||
break;
|
||||
case 'top':
|
||||
top = 0;
|
||||
left = (wnd.width() / 2) - (uiDialog.width() / 2);
|
||||
break;
|
||||
}
|
||||
uiDialog.css({top: top, left: left});
|
||||
uiDialog.appendTo('body').show();
|
||||
};
|
||||
|
||||
this.close = function() {
|
||||
uiDialog.hide();
|
||||
};
|
||||
|
||||
uiDialog.show();
|
||||
this.open();
|
||||
if (options.shadow && $.fn.shadow != undefined) {
|
||||
uiDialog.shadow();
|
||||
}
|
||||
}
|
||||
|
||||
$.ui.dialogOpen = function(el) {
|
||||
$.data(el, "ui-dialog").open();
|
||||
}
|
||||
|
||||
$.ui.dialogClose = function(el) {
|
||||
$.data(el, "ui-dialog").close();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
259
js/ui.draggable.ext.js
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* 'this' -> original element
|
||||
* 1. argument: browser event
|
||||
* 2.argument: ui object
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.ui.plugin.add("draggable", "stop", "effect", function(e,ui) {
|
||||
var t = ui.helper;
|
||||
if(ui.options.effect[1]) {
|
||||
if(t != this) {
|
||||
ui.options.beQuietAtEnd = true;
|
||||
switch(ui.options.effect[1]) {
|
||||
case 'fade':
|
||||
$(t).fadeOut(300, function() { $(this).remove(); });
|
||||
break;
|
||||
default:
|
||||
$(t).remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "effect", function(e,ui) {
|
||||
if(ui.options.effect[0]) {
|
||||
switch(ui.options.effect[0]) {
|
||||
case 'fade':
|
||||
$(ui.helper).hide().fadeIn(300);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "cursor", function(e,ui) {
|
||||
var t = $('body');
|
||||
if (t.css("cursor")) ui.options.ocursor = t.css("cursor");
|
||||
t.css("cursor", ui.options.cursor);
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable", "stop", "cursor", function(e,ui) {
|
||||
if (ui.options.ocursor) $('body').css("cursor", ui.options.ocursor);
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "zIndex", function(e,ui) {
|
||||
var t = $(ui.helper);
|
||||
if(t.css("zIndex")) ui.options.ozIndex = t.css("zIndex");
|
||||
t.css('zIndex', ui.options.zIndex);
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable", "stop", "zIndex", function(e,ui) {
|
||||
if(ui.options.ozIndex) $(ui.helper).css('zIndex', ui.options.ozIndex);
|
||||
});
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "opacity", function(e,ui) {
|
||||
var t = $(ui.helper);
|
||||
if(t.css("opacity")) ui.options.oopacity = t.css("opacity");
|
||||
t.css('opacity', ui.options.opacity);
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable", "stop", "opacity", function(e,ui) {
|
||||
if(ui.options.oopacity) $(ui.helper).css('opacity', ui.options.oopacity);
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "stop", "revert", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
var rpos = { left: 0, top: 0 };
|
||||
o.beQuietAtEnd = true;
|
||||
|
||||
if(ui.helper != this) {
|
||||
|
||||
rpos = $(ui.draggable.sorthelper || this).offset({ border: false });
|
||||
|
||||
var nl = rpos.left-o.po.left-o.margins.left;
|
||||
var nt = rpos.top-o.po.top-o.margins.top;
|
||||
|
||||
} else {
|
||||
var nl = o.co.left - (o.po ? o.po.left : 0);
|
||||
var nt = o.co.top - (o.po ? o.po.top : 0);
|
||||
}
|
||||
|
||||
var self = ui.draggable;
|
||||
|
||||
$(ui.helper).animate({
|
||||
left: nl,
|
||||
top: nt
|
||||
}, 500, function() {
|
||||
|
||||
if(o.wasPositioned) $(self.element).css('position', o.wasPositioned);
|
||||
if(o.stop) o.stop.apply(self.element, [self.helper, self.pos, [o.co.left - o.po.left,o.co.top - o.po.top],self]);
|
||||
|
||||
if(self.helper != self.element) window.setTimeout(function() { $(self.helper).remove(); }, 0); //Using setTimeout because of strange flickering in Firefox
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "iframeFix", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
if(!ui.draggable.slowMode) { // Make clones on top of iframes (only if we are not in slowMode)
|
||||
if(o.iframeFix.constructor == Array) {
|
||||
for(var i=0;i<o.iframeFix.length;i++) {
|
||||
var co = $(o.iframeFix[i]).offset({ border: false });
|
||||
$("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width", $(o.iframeFix[i])[0].offsetWidth+"px").css("height", $(o.iframeFix[i])[0].offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body");
|
||||
}
|
||||
} else {
|
||||
$("iframe").each(function() {
|
||||
var co = $(this).offset({ border: false });
|
||||
$("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width", this.offsetWidth+"px").css("height", this.offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable","stop", "iframeFix", function(e,ui) {
|
||||
if(ui.options.iframeFix) $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "start", "containment", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
|
||||
if(!o.cursorAtIgnore || o.containment.left != undefined || o.containment.constructor == Array) return;
|
||||
if(o.containment == 'parent') o.containment = this.parentNode;
|
||||
|
||||
|
||||
if(o.containment == 'document') {
|
||||
o.containment = [
|
||||
0-o.margins.left,
|
||||
0-o.margins.top,
|
||||
$(document).width()-o.margins.right,
|
||||
($(document).height() || document.body.parentNode.scrollHeight)-o.margins.bottom
|
||||
];
|
||||
} else { //I'm a node, so compute top/left/right/bottom
|
||||
var ce = $(o.containment)[0];
|
||||
var co = $(o.containment).offset({ border: false });
|
||||
|
||||
o.containment = [
|
||||
co.left-o.margins.left,
|
||||
co.top-o.margins.top,
|
||||
co.left+(ce.offsetWidth || ce.scrollWidth)-o.margins.right,
|
||||
co.top+(ce.offsetHeight || ce.scrollHeight)-o.margins.bottom
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("draggable", "drag", "containment", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
if(!o.cursorAtIgnore) return;
|
||||
|
||||
var h = $(ui.helper);
|
||||
var c = o.containment;
|
||||
if(c.constructor == Array) {
|
||||
|
||||
if((ui.draggable.pos[0] < c[0]-o.po.left)) ui.draggable.pos[0] = c[0]-o.po.left;
|
||||
if((ui.draggable.pos[1] < c[1]-o.po.top)) ui.draggable.pos[1] = c[1]-o.po.top;
|
||||
if(ui.draggable.pos[0]+h[0].offsetWidth > c[2]-o.po.left) ui.draggable.pos[0] = c[2]-o.po.left-h[0].offsetWidth;
|
||||
if(ui.draggable.pos[1]+h[0].offsetHeight > c[3]-o.po.top) ui.draggable.pos[1] = c[3]-o.po.top-h[0].offsetHeight;
|
||||
|
||||
} else {
|
||||
|
||||
if(c.left && (ui.draggable.pos[0] < c.left)) ui.draggable.pos[0] = c.left;
|
||||
if(c.top && (ui.draggable.pos[1] < c.top)) ui.draggable.pos[1] = c.top;
|
||||
|
||||
var p = $(o.pp);
|
||||
if(c.right && ui.draggable.pos[0]+h[0].offsetWidth > p[0].offsetWidth-c.right) ui.draggable.pos[0] = (p[0].offsetWidth-c.right)-h[0].offsetWidth;
|
||||
if(c.bottom && ui.draggable.pos[1]+h[0].offsetHeight > p[0].offsetHeight-c.bottom) ui.draggable.pos[1] = (p[0].offsetHeight-c.bottom)-h[0].offsetHeight;
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "drag", "grid", function(e,ui) {
|
||||
var o = ui.options;
|
||||
if(!o.cursorAtIgnore) return;
|
||||
ui.draggable.pos[0] = o.co.left + o.margins.left - o.po.left + Math.round((ui.draggable.pos[0] - o.co.left - o.margins.left + o.po.left) / o.grid[0]) * o.grid[0];
|
||||
ui.draggable.pos[1] = o.co.top + o.margins.top - o.po.top + Math.round((ui.draggable.pos[1] - o.co.top - o.margins.top + o.po.top) / o.grid[1]) * o.grid[1];
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "drag", "axis", function(e,ui) {
|
||||
var o = ui.options;
|
||||
if(!o.cursorAtIgnore) return;
|
||||
if(o.constraint) o.axis = o.constraint; //Legacy check
|
||||
o.axis ? ( o.axis == 'x' ? ui.draggable.pos[1] = o.co.top - o.margins.top - o.po.top : ui.draggable.pos[0] = o.co.left - o.margins.left - o.po.left ) : null;
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "drag", "scroll", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
o.scrollSensitivity = o.scrollSensitivity || 20;
|
||||
o.scrollSpeed = o.scrollSpeed || 20;
|
||||
|
||||
if(o.pp && o.ppOverflow) { // If we have a positioned parent, we only scroll in this one
|
||||
// TODO: Extremely strange issues are waiting here..handle with care
|
||||
} else {
|
||||
if((ui.draggable.rpos[1] - $(window).height()) - $(document).scrollTop() > -o.scrollSensitivity) window.scrollBy(0,o.scrollSpeed);
|
||||
if(ui.draggable.rpos[1] - $(document).scrollTop() < o.scrollSensitivity) window.scrollBy(0,-o.scrollSpeed);
|
||||
if((ui.draggable.rpos[0] - $(window).width()) - $(document).scrollLeft() > -o.scrollSensitivity) window.scrollBy(o.scrollSpeed,0);
|
||||
if(ui.draggable.rpos[0] - $(document).scrollLeft() < o.scrollSensitivity) window.scrollBy(-o.scrollSpeed,0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
||||
$.ui.plugin.add("draggable", "drag", "wrapHelper", function(e,ui) {
|
||||
|
||||
var o = ui.options;
|
||||
if(o.cursorAtIgnore) return;
|
||||
var t = ui.helper;
|
||||
|
||||
if(!o.pp || !o.ppOverflow) {
|
||||
var wx = $(window).width() - ($.browser.mozilla ? 20 : 0);
|
||||
var sx = $(document).scrollLeft();
|
||||
|
||||
var wy = $(window).height();
|
||||
var sy = $(document).scrollTop();
|
||||
} else {
|
||||
var wx = o.pp.offsetWidth + o.po.left - 20;
|
||||
var sx = o.pp.scrollLeft;
|
||||
|
||||
var wy = o.pp.offsetHeight + o.po.top - 20;
|
||||
var sy = o.pp.scrollTop;
|
||||
}
|
||||
|
||||
ui.draggable.pos[0] -= ((ui.draggable.rpos[0]-o.cursorAt.left - wx + t.offsetWidth+o.margins.right) - sx > 0 || (ui.draggable.rpos[0]-o.cursorAt.left+o.margins.left) - sx < 0) ? (t.offsetWidth+o.margins.left+o.margins.right - o.cursorAt.left * 2) : 0;
|
||||
|
||||
ui.draggable.pos[1] -= ((ui.draggable.rpos[1]-o.cursorAt.top - wy + t.offsetHeight+o.margins.bottom) - sy > 0 || (ui.draggable.rpos[1]-o.cursorAt.top+o.margins.top) - sy < 0) ? (t.offsetHeight+o.margins.top+o.margins.bottom - o.cursorAt.top * 2) : 0;
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
182
js/ui.draggable.js
Normal file
@@ -0,0 +1,182 @@
|
||||
(function($) {
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { draggable: "(' '+a.className+' ').indexOf(' ui-draggable ')" });
|
||||
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-draggable")) jQuery.data(this, "ui-draggable")["'+cur+'"](a); }); }');
|
||||
$.fn["draggable"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.draggableInstance = function() {
|
||||
if($(this[0]).is(".ui-draggable")) return $.data(this[0], "ui-draggable");
|
||||
return false;
|
||||
};
|
||||
|
||||
$.fn.draggable = function(o) {
|
||||
return this.each(function() {
|
||||
new $.ui.draggable(this, o);
|
||||
});
|
||||
}
|
||||
|
||||
$.ui.ddmanager = {
|
||||
current: null,
|
||||
droppables: [],
|
||||
prepareOffsets: function(t, e) {
|
||||
var dropTop = $.ui.ddmanager.dropTop = [];
|
||||
var dropLeft = $.ui.ddmanager.dropLeft;
|
||||
var m = $.ui.ddmanager.droppables;
|
||||
for (var i = 0; i < m.length; i++) {
|
||||
if(m[i].item.disabled) continue;
|
||||
m[i].offset = $(m[i].item.element).offset();
|
||||
if (t && m[i].item.options.accept(t.element)) //Activate the droppable if used directly from draggables
|
||||
m[i].item.activate.call(m[i].item, e);
|
||||
}
|
||||
},
|
||||
fire: function(oDrag, e) {
|
||||
|
||||
var oDrops = $.ui.ddmanager.droppables;
|
||||
var oOvers = $.grep(oDrops, function(oDrop) {
|
||||
|
||||
if (!oDrop.item.disabled && $.ui.intersect(oDrag, oDrop, oDrop.item.options.tolerance))
|
||||
oDrop.item.drop.call(oDrop.item, e);
|
||||
});
|
||||
$.each(oDrops, function(i, oDrop) {
|
||||
if (!oDrop.item.disabled && oDrop.item.options.accept(oDrag.element)) {
|
||||
oDrop.out = 1; oDrop.over = 0;
|
||||
oDrop.item.deactivate.call(oDrop.item, e);
|
||||
}
|
||||
});
|
||||
},
|
||||
update: function(oDrag, e) {
|
||||
|
||||
if(oDrag.options.refreshPositions) $.ui.ddmanager.prepareOffsets();
|
||||
|
||||
var oDrops = $.ui.ddmanager.droppables;
|
||||
var oOvers = $.grep(oDrops, function(oDrop) {
|
||||
if(oDrop.item.disabled) return false;
|
||||
var isOver = $.ui.intersect(oDrag, oDrop, oDrop.item.options.tolerance)
|
||||
if (!isOver && oDrop.over == 1) {
|
||||
oDrop.out = 1; oDrop.over = 0;
|
||||
oDrop.item.out.call(oDrop.item, e);
|
||||
}
|
||||
return isOver;
|
||||
});
|
||||
$.each(oOvers, function(i, oOver) {
|
||||
if (oOver.over == 0) {
|
||||
oOver.out = 0; oOver.over = 1;
|
||||
oOver.item.over.call(oOver.item, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.ui.draggable = function(el, o) {
|
||||
|
||||
var options = {};
|
||||
$.extend(options, o);
|
||||
var self = this;
|
||||
$.extend(options, {
|
||||
_start: function(h, p, c, t, e) {
|
||||
self.start.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_beforeStop: function(h, p, c, t, e) {
|
||||
self.stop.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_drag: function(h, p, c, t, e) {
|
||||
self.drag.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
startCondition: function(e) {
|
||||
return !(e.target.className.indexOf("ui-resizable-handle") != -1 || self.disabled);
|
||||
}
|
||||
});
|
||||
|
||||
$.data(el, "ui-draggable", this);
|
||||
|
||||
if (options.ghosting == true) options.helper = 'clone'; //legacy option check
|
||||
$(el).addClass("ui-draggable");
|
||||
this.interaction = new $.ui.mouseInteraction(el, options);
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.draggable.prototype, {
|
||||
plugins: {},
|
||||
currentTarget: null,
|
||||
lastTarget: null,
|
||||
destroy: function() {
|
||||
$(this.interaction.element).removeClass("ui-draggable").removeClass("ui-draggable-disabled");
|
||||
this.interaction.destroy();
|
||||
},
|
||||
enable: function() {
|
||||
$(this.interaction.element).removeClass("ui-draggable-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.interaction.element).addClass("ui-draggable-disabled");
|
||||
this.disabled = true;
|
||||
},
|
||||
prepareCallbackObj: function(self) {
|
||||
return {
|
||||
helper: self.helper,
|
||||
position: { left: self.pos[0], top: self.pos[1] },
|
||||
offset: self.options.cursorAt,
|
||||
draggable: self,
|
||||
options: self.options
|
||||
}
|
||||
},
|
||||
start: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
$.ui.ddmanager.current = this;
|
||||
|
||||
$.ui.plugin.call(that, 'start', [e, that.prepareCallbackObj(this)]);
|
||||
$(this.element).triggerHandler("dragstart", [e, that.prepareCallbackObj(this)], o.start);
|
||||
|
||||
if (this.slowMode && $.ui.droppable && !o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this, e);
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
stop: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
$.ui.plugin.call(that, 'stop', [e, that.prepareCallbackObj(this)]);
|
||||
$(this.element).triggerHandler("dragstop", [e, that.prepareCallbackObj(this)], o.stop);
|
||||
|
||||
if (this.slowMode && $.ui.droppable && !o.dropBehaviour) //If cursorAt is within the helper, we must use our drop manager
|
||||
$.ui.ddmanager.fire(this, e);
|
||||
|
||||
$.ui.ddmanager.current = null;
|
||||
$.ui.ddmanager.last = this;
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
drag: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
$.ui.ddmanager.update(this, e);
|
||||
|
||||
this.pos = [this.pos[0]-o.cursorAt.left, this.pos[1]-o.cursorAt.top];
|
||||
|
||||
$.ui.plugin.call(that, 'drag', [e, that.prepareCallbackObj(this)]);
|
||||
var nv = $(this.element).triggerHandler("drag", [e, that.prepareCallbackObj(this)], o.drag);
|
||||
|
||||
var nl = (nv && nv.left) ? nv.left : this.pos[0];
|
||||
var nt = (nv && nv.top) ? nv.top : this.pos[1];
|
||||
|
||||
$(this.helper).css('left', nl+'px').css('top', nt+'px'); // Stick the helper to the cursor
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})($);
|
||||
25
js/ui.droppable.ext.js
Normal file
@@ -0,0 +1,25 @@
|
||||
(function($) {
|
||||
|
||||
// options.activeClass
|
||||
$.ui.plugin.add("droppable", "activate", "activeClass", function(e,ui) {
|
||||
$(this).addClass(ui.options.activeClass);
|
||||
});
|
||||
$.ui.plugin.add("droppable", "deactivate", "activeClass", function(e,ui) {
|
||||
$(this).removeClass(ui.options.activeClass);
|
||||
});
|
||||
$.ui.plugin.add("droppable", "drop", "activeClass", function(e,ui) {
|
||||
$(this).removeClass(ui.options.activeClass);
|
||||
});
|
||||
|
||||
// options.hoverClass
|
||||
$.ui.plugin.add("droppable", "over", "hoverClass", function(e,ui) {
|
||||
$(this).addClass(ui.options.hoverClass);
|
||||
});
|
||||
$.ui.plugin.add("droppable", "out", "hoverClass", function(e,ui) {
|
||||
$(this).removeClass(ui.options.hoverClass);
|
||||
});
|
||||
$.ui.plugin.add("droppable", "drop", "hoverClass", function(e,ui) {
|
||||
$(this).removeClass(ui.options.hoverClass);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
201
js/ui.droppable.js
Normal file
@@ -0,0 +1,201 @@
|
||||
(function($) {
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { droppable: "(' '+a.className+' ').indexOf(' ui-droppable ')" });
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-droppable")) jQuery.data(this, "ui-droppable")["'+cur+'"](a); }); }');
|
||||
$.fn["droppable"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.droppableInstance = function() {
|
||||
if($(this[0]).is(".ui-droppable")) return $.data(this[0], "ui-droppable");
|
||||
return false;
|
||||
};
|
||||
|
||||
$.fn.droppable = function(o) {
|
||||
return this.each(function() {
|
||||
new $.ui.droppable(this,o);
|
||||
});
|
||||
}
|
||||
|
||||
$.ui.droppable = function(el,o) {
|
||||
|
||||
if(!o) var o = {};
|
||||
this.element = el; if($.browser.msie) el.droppable = 1;
|
||||
$.data(el, "ui-droppable", this);
|
||||
|
||||
this.options = {};
|
||||
$.extend(this.options, o);
|
||||
|
||||
var accept = o.accept;
|
||||
$.extend(this.options, {
|
||||
accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) {
|
||||
return $(d).is(accept);
|
||||
},
|
||||
tolerance: o.tolerance || 'intersect'
|
||||
});
|
||||
o = this.options;
|
||||
var self = this;
|
||||
|
||||
this.mouseBindings = [function(e) { return self.move.apply(self, [e]); },function(e) { return self.drop.apply(self, [e]); }];
|
||||
$(this.element).bind("mousemove", this.mouseBindings[0]);
|
||||
$(this.element).bind("mouseup", this.mouseBindings[1]);
|
||||
|
||||
$.ui.ddmanager.droppables.push({ item: this, over: 0, out: 1 }); // Add the reference and positions to the manager
|
||||
$(this.element).addClass("ui-droppable");
|
||||
|
||||
};
|
||||
|
||||
$.extend($.ui.droppable.prototype, {
|
||||
plugins: {},
|
||||
prepareCallbackObj: function(c) {
|
||||
return {
|
||||
draggable: c,
|
||||
droppable: this,
|
||||
element: c.element,
|
||||
helper: c.helper,
|
||||
options: this.options
|
||||
}
|
||||
},
|
||||
destroy: function() {
|
||||
$(this.element).removeClass("ui-droppable").removeClass("ui-droppable-disabled");
|
||||
$(this.element).unbind("mousemove", this.mouseBindings[0]);
|
||||
$(this.element).unbind("mouseup", this.mouseBindings[1]);
|
||||
|
||||
for(var i=0;i<$.ui.ddmanager.droppables.length;i++) {
|
||||
if($.ui.ddmanager.droppables[i].item == this) $.ui.ddmanager.droppables.splice(i,1);
|
||||
}
|
||||
},
|
||||
enable: function() {
|
||||
$(this.element).removeClass("ui-droppable-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.element).addClass("ui-droppable-disabled");
|
||||
this.disabled = true;
|
||||
},
|
||||
move: function(e) {
|
||||
|
||||
if(!$.ui.ddmanager.current) return;
|
||||
|
||||
var o = this.options;
|
||||
var c = $.ui.ddmanager.current;
|
||||
|
||||
/* Save current target, if no last target given */
|
||||
var findCurrentTarget = function(e) {
|
||||
if(e.currentTarget) return e.currentTarget;
|
||||
var el = e.srcElement;
|
||||
do { if(el.droppable) return el; el = el.parentNode; } while (el); //This is only used in IE! references in DOM are evil!
|
||||
}
|
||||
if(c && o.accept(c.element)) c.currentTarget = findCurrentTarget(e);
|
||||
|
||||
c.drag.apply(c, [e]);
|
||||
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
|
||||
|
||||
},
|
||||
over: function(e) {
|
||||
|
||||
var c = $.ui.ddmanager.current;
|
||||
if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element
|
||||
|
||||
var o = this.options;
|
||||
if (o.accept(c.element)) {
|
||||
$.ui.plugin.call(this, 'over', [e, this.prepareCallbackObj(c)]);
|
||||
$(this.element).triggerHandler("dropover", [e, this.prepareCallbackObj(c)], o.over);
|
||||
}
|
||||
|
||||
},
|
||||
out: function(e) {
|
||||
|
||||
var c = $.ui.ddmanager.current;
|
||||
if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element
|
||||
|
||||
var o = this.options;
|
||||
if (o.accept(c.element)) {
|
||||
$.ui.plugin.call(this, 'out', [e, this.prepareCallbackObj(c)]);
|
||||
$(this.element).triggerHandler("dropout", [e, this.prepareCallbackObj(c)], o.out);
|
||||
}
|
||||
|
||||
},
|
||||
drop: function(e) {
|
||||
|
||||
var c = $.ui.ddmanager.current;
|
||||
if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element
|
||||
|
||||
var o = this.options;
|
||||
if(o.accept(c.element)) { // Fire callback
|
||||
if(o.greedy && !c.slowMode) {
|
||||
if(c.currentTarget == this.element) {
|
||||
$.ui.plugin.call(this, 'drop', [e, {
|
||||
draggable: c,
|
||||
droppable: this,
|
||||
element: c.element,
|
||||
helper: c.helper
|
||||
}]);
|
||||
$(this.element).triggerHandler("drop", [e, {
|
||||
draggable: c,
|
||||
droppable: this,
|
||||
element: c.element,
|
||||
helper: c.helper
|
||||
}], o.drop);
|
||||
}
|
||||
} else {
|
||||
$.ui.plugin.call(this, 'drop', [e, this.prepareCallbackObj(c)]);
|
||||
$(this.element).triggerHandler("drop", [e, this.prepareCallbackObj(c)], o.drop);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
activate: function(e) {
|
||||
var c = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'activate', [e, this.prepareCallbackObj(c)]);
|
||||
if(c) $(this.element).triggerHandler("dropactivate", [e, this.prepareCallbackObj(c)], this.options.activate);
|
||||
},
|
||||
deactivate: function(e) {
|
||||
var c = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'deactivate', [e, this.prepareCallbackObj(c)]);
|
||||
if(c) $(this.element).triggerHandler("dropdeactivate", [e, this.prepareCallbackObj(c)], this.options.deactivate);
|
||||
}
|
||||
});
|
||||
|
||||
$.ui.intersect = function(oDrag, oDrop, toleranceMode) {
|
||||
if (!oDrop.offset)
|
||||
return false;
|
||||
var x1 = oDrag.rpos[0] - oDrag.options.cursorAt.left + oDrag.options.margins.left, x2 = x1 + oDrag.helperSize.width,
|
||||
y1 = oDrag.rpos[1] - oDrag.options.cursorAt.top + oDrag.options.margins.top, y2 = y1 + oDrag.helperSize.height;
|
||||
var l = oDrop.offset.left, r = l + oDrop.item.element.offsetWidth,
|
||||
t = oDrop.offset.top, b = t + oDrop.item.element.offsetHeight;
|
||||
switch (toleranceMode) {
|
||||
case 'fit':
|
||||
return ( l < x1 && x2 < r
|
||||
&& t < y1 && y2 < b);
|
||||
break;
|
||||
case 'intersect':
|
||||
return ( l < x1 + (oDrag.helperSize.width / 2) // Right Half
|
||||
&& x2 - (oDrag.helperSize.width / 2) < r // Left Half
|
||||
&& t < y1 + (oDrag.helperSize.height / 2) // Bottom Half
|
||||
&& y2 - (oDrag.helperSize.height / 2) < b ); // Top Half
|
||||
break;
|
||||
case 'pointer':
|
||||
return ( l < oDrag.rpos[0] && oDrag.rpos[0] < r
|
||||
&& t < oDrag.rpos[1] && oDrag.rpos[1] < b);
|
||||
break;
|
||||
case 'touch':
|
||||
return ( (l < x1 && x1 < r && t < y1 && y1 < b) // Top-Left Corner
|
||||
|| (l < x1 && x1 < r && t < y2 && y2 < b) // Bottom-Left Corner
|
||||
|| (l < x2 && x2 < r && t < y1 && y1 < b) // Top-Right Corner
|
||||
|| (l < x2 && x2 < r && t < y2 && y2 < b) ); // Bottom-Right Corner
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
})($);
|
||||
|
||||
191
js/ui.magnifier.js
Normal file
@@ -0,0 +1,191 @@
|
||||
(function($) {
|
||||
|
||||
//If the UI scope is not availalable, add it
|
||||
$.ui = $.ui || {};
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { magnifier: "(' '+a.className+' ').indexOf(' ui-magnifier ')" });
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable,reset".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-magnifier")) jQuery.data(this, "ui-magnifier")["'+cur+'"](a); }); }');
|
||||
$.fn["magnifier"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.magnifierInstance = function() {
|
||||
if($(this[0]).is(".ui-magnifier")) return $.data(this[0], "ui-magnifier");
|
||||
return false;
|
||||
};
|
||||
|
||||
$.fn.magnifier = function(options) {
|
||||
return this.each(function() {
|
||||
new $.ui.magnifier(this,options);
|
||||
});
|
||||
};
|
||||
|
||||
$.ui.magnifier = function(el,options) {
|
||||
|
||||
var self = this; this.items = []; this.element = el;
|
||||
this.options = options || {}; var o = this.options;
|
||||
$.data(el, "ui-magnifier", this);
|
||||
$(el).addClass("ui-magnifier");
|
||||
|
||||
o.distance = o.distance || 150;
|
||||
o.magnification = o.magnification || 2;
|
||||
o.baseline = o.baseline || 0;
|
||||
o.verticalLine = o.verticalLine != undefined ? o.verticalLine : -0.5;
|
||||
|
||||
this.pp = $(el).offset({ border: false });
|
||||
|
||||
$('> *', el).each(function() {
|
||||
var co = $(this).offset({ border: false });
|
||||
if(self.options.overlap) var cp = $(this).position();
|
||||
self.items.push([this, co, [$(this).width(),$(this).height()], (cp || null)]);
|
||||
|
||||
if(o.opacity)
|
||||
$(this).css('opacity', o.opacity.min);
|
||||
});
|
||||
|
||||
if(o.overlap) {
|
||||
for(var i=0;i<this.items.length;i++) {
|
||||
//Absolute stuff
|
||||
$(this.items[i][0]).css({
|
||||
position: "absolute",
|
||||
top: this.items[i][3].top,
|
||||
left: this.items[i][3].left
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
this.moveEvent = function(e) { if(!self.disabled) self.magnify.apply(self, [e]); }
|
||||
$(document).bind("mousemove", this.moveEvent);
|
||||
|
||||
if(o.click) { //If onclick callback is available
|
||||
|
||||
this.clickEvent = function(e) { if(!self.disabled) o.click.apply(this, [e, { options: self.options, current: self.current[0], currentOffset: self.current[1] }]); }
|
||||
$(el).bind('click', this.clickEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.magnifier.prototype, {
|
||||
destroy: function() {
|
||||
$(this.element).removeClass("ui-magnifier").removeClass("ui-magnifier-disabled");
|
||||
$(document).unbind("mousemove", this.moveEvent);
|
||||
if(this.clickEvent) $(this.element).unbind("click", this.clickEvent);
|
||||
},
|
||||
enable: function() {
|
||||
$(this.element).removeClass("ui-magnifier-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.element).addClass("ui-magnifier-disabled");
|
||||
this.reset();
|
||||
this.disabled = true;
|
||||
},
|
||||
reset: function(e) {
|
||||
|
||||
var o = this.options;
|
||||
var c;
|
||||
var distance = 1;
|
||||
|
||||
for(var i=0;i<this.items.length;i++) {
|
||||
|
||||
c = this.items[i];
|
||||
|
||||
$(c[0]).css({
|
||||
width: c[2][0],
|
||||
height: c[2][1],
|
||||
top: (c[3] ? c[3].top : 0),
|
||||
left: (c[3] ? c[3].left : 0)
|
||||
});
|
||||
|
||||
if(o.opacity)
|
||||
$(c[0]).css('opacity', o.opacity.min);
|
||||
|
||||
if(o.zIndex)
|
||||
$(c[0]).css("z-index", "");
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
magnify: function(e) {
|
||||
var p = [e.pageX,e.pageY];
|
||||
var o = this.options;
|
||||
var c;
|
||||
this.current = this.items[0];
|
||||
var distance = 1;
|
||||
|
||||
//Compute the parents distance, because we don't need to fire anything if we are not near the parent
|
||||
|
||||
var overlap = ((p[0] > this.pp.left-o.distance && p[0] < this.pp.left + this.element.offsetWidth + o.distance) && (p[1] > this.pp.top-o.distance && p[1] < this.pp.top + this.element.offsetHeight + o.distance));
|
||||
if(!overlap) return false;
|
||||
|
||||
|
||||
for(var i=0;i<this.items.length;i++) {
|
||||
c = this.items[i];
|
||||
|
||||
var olddistance = distance;
|
||||
if(!o.axis) {
|
||||
distance = Math.sqrt(
|
||||
Math.pow(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left)) - (c[0].offsetWidth/2), 2)
|
||||
+ Math.pow(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top )) - (c[0].offsetHeight/2), 2)
|
||||
);
|
||||
} else {
|
||||
if(o.axis == "y") {
|
||||
distance = Math.abs(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top )) - (c[0].offsetHeight/2));
|
||||
} else {
|
||||
distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left)) - (c[0].offsetWidth/2));
|
||||
}
|
||||
}
|
||||
|
||||
if(distance < o.distance) {
|
||||
|
||||
this.current = distance < olddistance ? this.items[i] : this.current;
|
||||
|
||||
if(!o.axis || o.axis != "y") {
|
||||
$(c[0]).css({
|
||||
width: c[2][0]+ (c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)),
|
||||
left: (c[3] ? (c[3].left + o.verticalLine * ((c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)))) : 0)
|
||||
});
|
||||
}
|
||||
|
||||
if(!o.axis || o.axis != "x") {
|
||||
$(c[0]).css({
|
||||
height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)),
|
||||
top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)))
|
||||
});
|
||||
}
|
||||
|
||||
if(o.opacity)
|
||||
$(c[0]).css('opacity', o.opacity.max-(distance/o.distance) < o.opacity.min ? o.opacity.min : o.opacity.max-(distance/o.distance));
|
||||
|
||||
} else {
|
||||
|
||||
$(c[0]).css({
|
||||
width: c[2][0],
|
||||
height: c[2][1],
|
||||
top: (c[3] ? c[3].top : 0),
|
||||
left: (c[3] ? c[3].left : 0)
|
||||
});
|
||||
|
||||
if(o.opacity)
|
||||
$(c[0]).css('opacity', o.opacity.min);
|
||||
|
||||
}
|
||||
|
||||
if(o.zIndex)
|
||||
$(c[0]).css("z-index", "");
|
||||
|
||||
}
|
||||
|
||||
if(this.options.zIndex)
|
||||
$(this.current[0]).css("z-index", this.options.zIndex);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})($);
|
||||
253
js/ui.mouse.js
Normal file
@@ -0,0 +1,253 @@
|
||||
(function($) {
|
||||
|
||||
//If the UI scope is not availalable, add it
|
||||
$.ui = $.ui || {};
|
||||
|
||||
//Add methods that are vital for all mouse interaction stuff (plugin registering)
|
||||
$.extend($.ui, {
|
||||
plugin: {
|
||||
add: function(w, c, o, p) {
|
||||
var a = $.ui[w].prototype; if(!a.plugins[c]) a.plugins[c] = [];
|
||||
a.plugins[c].push([o,p]);
|
||||
},
|
||||
call: function(instance, name, arguments) {
|
||||
var c = instance.plugins[name]; if(!c) return;
|
||||
var o = instance.interaction ? instance.interaction.options : instance.options;
|
||||
var e = instance.interaction ? instance.interaction.element : instance.element;
|
||||
|
||||
for (var i = 0; i < c.length; i++) {
|
||||
if (o[c[i][0]]) c[i][1].apply(e, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.mouseInteractionDestroy = function() {
|
||||
this.each(function() {
|
||||
if($.data(this, "ui-mouse")) $.data(this, "ui-mouse").destroy();
|
||||
});
|
||||
}
|
||||
|
||||
$.ui.mouseInteraction = function(el,o) {
|
||||
|
||||
if(!o) var o = {};
|
||||
this.element = el;
|
||||
$.data(this.element, "ui-mouse", this);
|
||||
|
||||
this.options = {};
|
||||
$.extend(this.options, o);
|
||||
$.extend(this.options, {
|
||||
handle : o.handle ? ($(o.handle, el)[0] ? $(o.handle, el) : $(el)) : $(el),
|
||||
helper: o.helper || 'original',
|
||||
preventionDistance: o.preventionDistance || 0,
|
||||
dragPrevention: o.dragPrevention ? o.dragPrevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],
|
||||
cursorAt: { top: ((o.cursorAt && o.cursorAt.top) ? o.cursorAt.top : 0), left: ((o.cursorAt && o.cursorAt.left) ? o.cursorAt.left : 0), bottom: ((o.cursorAt && o.cursorAt.bottom) ? o.cursorAt.bottom : 0), right: ((o.cursorAt && o.cursorAt.right) ? o.cursorAt.right : 0) },
|
||||
cursorAtIgnore: (!o.cursorAt) ? true : false, //Internal property
|
||||
appendTo: o.appendTo || 'parent'
|
||||
})
|
||||
o = this.options; //Just Lazyness
|
||||
|
||||
if(!this.options.nonDestructive && (o.helper == 'clone' || o.helper == 'original')) {
|
||||
|
||||
// Let's save the margins for better reference
|
||||
o.margins = {
|
||||
top: parseInt($(el).css('marginTop')) || 0,
|
||||
left: parseInt($(el).css('marginLeft')) || 0,
|
||||
bottom: parseInt($(el).css('marginBottom')) || 0,
|
||||
right: parseInt($(el).css('marginRight')) || 0
|
||||
};
|
||||
|
||||
// We have to add margins to our cursorAt
|
||||
if(o.cursorAt.top != 0) o.cursorAt.top = o.margins.top;
|
||||
if(o.cursorAt.left != 0) o.cursorAt.left += o.margins.left;
|
||||
if(o.cursorAt.bottom != 0) o.cursorAt.bottom += o.margins.bottom;
|
||||
if(o.cursorAt.right != 0) o.cursorAt.right += o.margins.right;
|
||||
|
||||
|
||||
if(o.helper == 'original')
|
||||
o.wasPositioned = $(el).css('position');
|
||||
|
||||
} else {
|
||||
o.margins = { top: 0, left: 0, right: 0, bottom: 0 };
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.mousedownfunc = function(e) { // Bind the mousedown event
|
||||
return self.click.apply(self, [e]);
|
||||
}
|
||||
o.handle.bind('mousedown', this.mousedownfunc);
|
||||
|
||||
//Prevent selection of text when starting the drag in IE
|
||||
if($.browser.msie) $(this.element).attr('unselectable', 'on');
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.mouseInteraction.prototype, {
|
||||
plugins: {},
|
||||
currentTarget: null,
|
||||
lastTarget: null,
|
||||
timer: null,
|
||||
slowMode: false,
|
||||
init: false,
|
||||
destroy: function() {
|
||||
this.options.handle.unbind('mousedown', this.mousedownfunc);
|
||||
},
|
||||
trigger: function(e) {
|
||||
return this.click.apply(this, arguments);
|
||||
},
|
||||
click: function(e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
window.focus();
|
||||
if(e.which != 1) return true; //only left click starts dragging
|
||||
|
||||
// Prevent execution on defined elements
|
||||
var targetName = (e.target) ? e.target.nodeName.toLowerCase() : e.srcElement.nodeName.toLowerCase();
|
||||
for(var i=0;i<o.dragPrevention.length;i++) {
|
||||
if(targetName == o.dragPrevention[i]) return true;
|
||||
}
|
||||
|
||||
//Prevent execution on condition
|
||||
if(o.startCondition && !o.startCondition.apply(this, [e])) return true;
|
||||
|
||||
var self = this;
|
||||
this.mouseup = function(e) { return self.stop.apply(self, [e]); }
|
||||
this.mousemove = function(e) { return self.drag.apply(self, [e]); }
|
||||
|
||||
var initFunc = function() { //This function get's called at bottom or after timeout
|
||||
$(document).bind('mouseup', self.mouseup);
|
||||
$(document).bind('mousemove', self.mousemove);
|
||||
self.opos = [e.pageX,e.pageY]; // Get the original mouse position
|
||||
}
|
||||
|
||||
if(o.preventionTimeout) { //use prevention timeout
|
||||
if(this.timer) clearInterval(this.timer);
|
||||
this.timer = setTimeout(function() { initFunc(); }, o.preventionTimeout);
|
||||
return false;
|
||||
}
|
||||
|
||||
initFunc();
|
||||
return false;
|
||||
|
||||
},
|
||||
start: function(e) {
|
||||
|
||||
var o = this.options; var a = this.element;
|
||||
o.co = $(a).offset(); //get the current offset
|
||||
|
||||
this.helper = typeof o.helper == 'function' ? $(o.helper.apply(a, [e,this]))[0] : (o.helper == 'clone' ? $(a).clone()[0] : a);
|
||||
|
||||
if(o.appendTo == 'parent') { // Let's see if we have a positioned parent
|
||||
var cp = a.parentNode;
|
||||
while (cp) {
|
||||
if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {
|
||||
o.pp = cp;
|
||||
o.po = $(cp).offset();
|
||||
o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!
|
||||
break;
|
||||
}
|
||||
cp = cp.parentNode ? cp.parentNode : null;
|
||||
};
|
||||
|
||||
if(!o.pp) o.po = { top: 0, left: 0 };
|
||||
}
|
||||
|
||||
this.pos = [this.opos[0],this.opos[1]]; //Use the relative position
|
||||
this.rpos = [this.pos[0],this.pos[1]]; //Save the absolute position
|
||||
|
||||
if(o.cursorAtIgnore) { // If we want to pick the element where we clicked, we borrow cursorAt and add margins
|
||||
o.cursorAt.left = this.pos[0] - o.co.left + o.margins.left;
|
||||
o.cursorAt.top = this.pos[1] - o.co.top + o.margins.top;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(o.pp) { // If we have a positioned parent, we pick the draggable relative to it
|
||||
this.pos[0] -= o.po.left;
|
||||
this.pos[1] -= o.po.top;
|
||||
}
|
||||
|
||||
this.slowMode = (o.cursorAt && (o.cursorAt.top-o.margins.top > 0 || o.cursorAt.bottom-o.margins.bottom > 0) && (o.cursorAt.left-o.margins.left > 0 || o.cursorAt.right-o.margins.right > 0)) ? true : false; //If cursorAt is within the helper, set slowMode to true
|
||||
|
||||
if(!o.nonDestructive) $(this.helper).css('position', 'absolute');
|
||||
if(o.helper != 'original') $(this.helper).appendTo((o.appendTo == 'parent' ? a.parentNode : o.appendTo)).show();
|
||||
|
||||
// Remap right/bottom properties for cursorAt to left/top
|
||||
if(o.cursorAt.right && !o.cursorAt.left) o.cursorAt.left = this.helper.offsetWidth+o.margins.right+o.margins.left - o.cursorAt.right;
|
||||
if(o.cursorAt.bottom && !o.cursorAt.top) o.cursorAt.top = this.helper.offsetHeight+o.margins.top+o.margins.bottom - o.cursorAt.bottom;
|
||||
|
||||
this.init = true;
|
||||
|
||||
if(o._start) o._start.apply(a, [this.helper, this.pos, o.cursorAt, this, e]); // Trigger the start callback
|
||||
this.helperSize = { width: outerWidth(this.helper), height: outerHeight(this.helper) }; //Set helper size property
|
||||
return false;
|
||||
|
||||
},
|
||||
stop: function(e) {
|
||||
|
||||
var o = this.options; var a = this.element; var self = this;
|
||||
|
||||
$(document).unbind('mouseup', self.mouseup);
|
||||
$(document).unbind('mousemove', self.mousemove);
|
||||
|
||||
if(this.init == false) return this.opos = this.pos = null;
|
||||
if(o._beforeStop) o._beforeStop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);
|
||||
|
||||
if(this.helper != a && !o.beQuietAtEnd) { // Remove helper, if it's not the original node
|
||||
$(this.helper).remove(); this.helper = null;
|
||||
}
|
||||
|
||||
if(!o.beQuietAtEnd) {
|
||||
//if(o.wasPositioned) $(a).css('position', o.wasPositioned);
|
||||
if(o._stop) o._stop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);
|
||||
}
|
||||
|
||||
this.init = false;
|
||||
this.opos = this.pos = null;
|
||||
return false;
|
||||
|
||||
},
|
||||
drag: function(e) {
|
||||
|
||||
if (!this.opos || ($.browser.msie && !e.button)) return this.stop.apply(this, [e]); // check for IE mouseup when moving into the document again
|
||||
var o = this.options;
|
||||
|
||||
this.pos = [e.pageX,e.pageY]; //relative mouse position
|
||||
if(this.rpos && this.rpos[0] == this.pos[0] && this.rpos[1] == this.pos[1]) return false;
|
||||
this.rpos = [this.pos[0],this.pos[1]]; //absolute mouse position
|
||||
|
||||
if(o.pp) { //If we have a positioned parent, use a relative position
|
||||
this.pos[0] -= o.po.left;
|
||||
this.pos[1] -= o.po.top;
|
||||
}
|
||||
|
||||
if( (Math.abs(this.rpos[0]-this.opos[0]) > o.preventionDistance || Math.abs(this.rpos[1]-this.opos[1]) > o.preventionDistance) && this.init == false) //If position is more than x pixels from original position, start dragging
|
||||
this.start.apply(this,[e]);
|
||||
else {
|
||||
if(this.init == false) return false;
|
||||
}
|
||||
|
||||
if(o._drag) o._drag.apply(this.element, [this.helper, this.pos, o.cursorAt, this, e]);
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
var num = function(el, prop) {
|
||||
return parseInt($.css(el.jquery?el[0]:el,prop))||0;
|
||||
};
|
||||
function outerWidth(el) {
|
||||
var $el = $(el), ow = $el.width();
|
||||
for (var i = 0, props = ['borderLeftWidth', 'paddingLeft', 'paddingRight', 'borderRightWidth']; i < props.length; i++)
|
||||
ow += num($el, props[i]);
|
||||
return ow;
|
||||
}
|
||||
function outerHeight(el) {
|
||||
var $el = $(el), oh = $el.width();
|
||||
for (var i = 0, props = ['borderTopWidth', 'paddingTop', 'paddingBottom', 'borderBottomWidth']; i < props.length; i++)
|
||||
oh += num($el, props[i]);
|
||||
return oh;
|
||||
}
|
||||
|
||||
})($);
|
||||
304
js/ui.resizable.js
Normal file
@@ -0,0 +1,304 @@
|
||||
(function($) {
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { resizable: "(' '+a.className+' ').indexOf(' ui-resizable ')" });
|
||||
|
||||
|
||||
$.fn.resizable = function(o) {
|
||||
return this.each(function() {
|
||||
if(!$(this).is(".ui-resizable")) new $.ui.resizable(this,o);
|
||||
});
|
||||
}
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); if(jQuery(this.parentNode).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); }); }');
|
||||
$.fn["resizable"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.resizableInstance = function() {
|
||||
if($(this[0]).is(".ui-resizable") || $(this[0].parentNode).is(".ui-resizable")) return $.data(this[0], "ui-resizable");
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
$.ui.resizable = function(el,o) {
|
||||
|
||||
var options = {}; o = o || {}; $.extend(options, o); //Extend and copy options
|
||||
this.element = el; var self = this; //Do bindings
|
||||
$.data(this.element, "ui-resizable", this);
|
||||
|
||||
if(options.proxy) {
|
||||
var helper = function(e,that) {
|
||||
var helper = $('<div></div>').css({
|
||||
width: $(this).width(),
|
||||
height: $(this).height(),
|
||||
position: 'absolute',
|
||||
left: that.options.co.left,
|
||||
top: that.options.co.top
|
||||
}).addClass(that.options.proxy);
|
||||
return helper;
|
||||
}
|
||||
} else {
|
||||
var helper = "original";
|
||||
}
|
||||
|
||||
//Destructive mode wraps the original element
|
||||
if(el.nodeName.match(/textarea|input|select|button|img/i)) options.destructive = true;
|
||||
if(options.destructive) {
|
||||
|
||||
$(el).wrap('<div class="ui-wrapper" style="position: relative; width: '+$(el).outerWidth()+'px; height: '+$(el).outerHeight()+';"></div>');
|
||||
var oel = el;
|
||||
el = el.parentNode; this.element = el;
|
||||
|
||||
//Move margins to the wrapper
|
||||
$(el).css({ marginLeft: $(oel).css("marginLeft"), marginTop: $(oel).css("marginTop"), marginRight: $(oel).css("marginRight"), marginBottom: $(oel).css("marginBottom")});
|
||||
$(oel).css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
||||
|
||||
o.proportionallyResize = o.proportionallyResize || [];
|
||||
o.proportionallyResize.push(oel);
|
||||
|
||||
var b = [parseInt($(oel).css('borderTopWidth')),parseInt($(oel).css('borderRightWidth')),parseInt($(oel).css('borderBottomWidth')),parseInt($(oel).css('borderLeftWidth'))];
|
||||
} else {
|
||||
var b = [0,0,0,0];
|
||||
}
|
||||
|
||||
if(options.destructive || !$(".ui-resizable-handle",el).length) {
|
||||
//Adding handles (disabled not so common ones)
|
||||
var t = function(a,b) { $(el).append("<div class='ui-resizable-"+a+" ui-resizable-handle' style='"+b+"'></div>"); };
|
||||
//t('n','top: '+b[0]+'px;');
|
||||
t('e','right: '+b[1]+'px;'+(options.zIndex ? 'z-index: '+options.zIndex+';' : ''));
|
||||
t('s','bottom: '+b[1]+'px;'+(options.zIndex ? 'z-index: '+options.zIndex+';' : ''));
|
||||
//t('w','left: '+b[3]+'px;');
|
||||
t('se','bottom: '+b[2]+'px; right: '+b[1]+'px;'+(options.zIndex ? 'z-index: '+options.zIndex+';' : ''));
|
||||
//t('sw','bottom: '+b[2]+'px; left: '+b[3]+'px;');
|
||||
//t('ne','top: '+b[0]+'px; right: '+b[1]+'px;');
|
||||
//t('nw','top: '+b[0]+'px; left: '+b[3]+'px;');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//If other elements should be modified, we have to copy that array
|
||||
options.modifyThese = [];
|
||||
if(o.proportionallyResize) {
|
||||
options.proportionallyResize = o.proportionallyResize.slice(0);
|
||||
var propRes = options.proportionallyResize;
|
||||
|
||||
for(var i in propRes) {
|
||||
|
||||
if(propRes[i].constructor == String)
|
||||
propRes[i] = $(propRes[i], el);
|
||||
|
||||
if(!$(propRes[i]).length) continue;
|
||||
|
||||
|
||||
var x = $(propRes[i]).width() - $(el).width();
|
||||
var y = $(propRes[i]).height() - $(el).height();
|
||||
options.modifyThese.push([$(propRes[i]),x,y]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
options.handles = {};
|
||||
if(!o.handles) o.handles = { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' };
|
||||
|
||||
for(var i in o.handles) { options.handles[i] = o.handles[i]; } //Copying the object
|
||||
|
||||
for(var i in options.handles) {
|
||||
|
||||
if(options.handles[i].constructor == String)
|
||||
options.handles[i] = $(options.handles[i], el);
|
||||
|
||||
if(!$(options.handles[i]).length) continue;
|
||||
|
||||
$(options.handles[i]).bind('mousedown', function(e) {
|
||||
self.interaction.options.axis = this.resizeAxis;
|
||||
})[0].resizeAxis = i;
|
||||
|
||||
}
|
||||
|
||||
//If we want to auto hide the elements
|
||||
if(o.autohide)
|
||||
$(this.element).addClass("ui-resizable-autohide").hover(function() { $(this).removeClass("ui-resizable-autohide"); }, function() { if(self.interaction.options.autohide && !self.interaction.init) $(this).addClass("ui-resizable-autohide"); });
|
||||
|
||||
|
||||
$.extend(options, {
|
||||
helper: helper,
|
||||
nonDestructive: true,
|
||||
dragPrevention: 'input,button,select',
|
||||
minHeight: options.minHeight || 50,
|
||||
minWidth: options.minWidth || 100,
|
||||
startCondition: function(e) {
|
||||
if(self.disabled) return false;
|
||||
for(var i in options.handles) {
|
||||
if($(options.handles[i])[0] == e.target) return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
_start: function(h,p,c,t,e) {
|
||||
self.start.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_beforeStop: function(h,p,c,t,e) {
|
||||
self.stop.apply(t, [self, e]); // Trigger the stop callback
|
||||
},
|
||||
_drag: function(h,p,c,t,e) {
|
||||
self.drag.apply(t, [self, e]); // Trigger the start callback
|
||||
}
|
||||
});
|
||||
|
||||
//Initialize mouse interaction
|
||||
this.interaction = new $.ui.mouseInteraction(el,options);
|
||||
|
||||
//Add the class for themeing
|
||||
$(this.element).addClass("ui-resizable");
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.resizable.prototype, {
|
||||
plugins: {},
|
||||
prepareCallbackObj: function(self) {
|
||||
return {
|
||||
helper: self.helper,
|
||||
resizable: self,
|
||||
axis: self.options.axis,
|
||||
options: self.options
|
||||
}
|
||||
},
|
||||
destroy: function() {
|
||||
$(this.element).removeClass("ui-resizable").removeClass("ui-resizable-disabled");
|
||||
this.interaction.destroy();
|
||||
},
|
||||
enable: function() {
|
||||
$(this.element).removeClass("ui-resizable-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.element).addClass("ui-resizable-disabled");
|
||||
this.disabled = true;
|
||||
},
|
||||
start: function(that, e) {
|
||||
this.options.originalSize = [$(this.element).width(),$(this.element).height()];
|
||||
this.options.originalPosition = $(this.element).css("position");
|
||||
this.options.originalPositionValues = $(this.element).position();
|
||||
|
||||
this.options.modifyThese.push([$(this.helper),0,0]);
|
||||
|
||||
$(that.element).triggerHandler("resizestart", [e, that.prepareCallbackObj(this)], this.options.start);
|
||||
return false;
|
||||
},
|
||||
stop: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
$(that.element).triggerHandler("resizestop", [e, that.prepareCallbackObj(this)], this.options.stop);
|
||||
|
||||
if(o.proxy) {
|
||||
$(this.element).css({
|
||||
width: $(this.helper).width(),
|
||||
height: $(this.helper).height()
|
||||
});
|
||||
|
||||
if(o.originalPosition == "absolute" || o.originalPosition == "fixed") {
|
||||
$(this.element).css({
|
||||
top: $(this.helper).css("top"),
|
||||
left: $(this.helper).css("left")
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
},
|
||||
drag: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
var rel = (o.originalPosition != "absolute" && o.originalPosition != "fixed");
|
||||
var co = rel ? o.co : this.options.originalPositionValues;
|
||||
var p = o.originalSize;
|
||||
|
||||
this.pos = rel ? [this.rpos[0]-o.cursorAt.left, this.rpos[1]-o.cursorAt.top] : [this.pos[0]-o.cursorAt.left, this.pos[1]-o.cursorAt.top];
|
||||
|
||||
var nw = p[0] + (this.pos[0] - co.left);
|
||||
var nh = p[1] + (this.pos[1] - co.top);
|
||||
|
||||
if(o.axis) {
|
||||
switch(o.axis) {
|
||||
case 'e':
|
||||
nh = p[1];
|
||||
break;
|
||||
case 's':
|
||||
nw = p[0];
|
||||
break;
|
||||
case 'n':
|
||||
case 'ne':
|
||||
|
||||
|
||||
if(!o.proxy && (o.originalPosition != "absolute" && o.originalPosition != "fixed"))
|
||||
return false;
|
||||
|
||||
if(o.axis == 'n') nw = p[0];
|
||||
var mod = (this.pos[1] - co.top); nh = nh - (mod*2);
|
||||
mod = nh <= o.minHeight ? p[1] - o.minHeight : (nh >= o.maxHeight ? 0-(o.maxHeight-p[1]) : mod);
|
||||
$(this.helper).css('top', co.top + mod);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
case 'sw':
|
||||
|
||||
if(!o.proxy && (o.originalPosition != "absolute" && o.originalPosition != "fixed"))
|
||||
return false;
|
||||
|
||||
if(o.axis == 'w') nh = p[1];
|
||||
var mod = (this.pos[0] - co.left); nw = nw - (mod*2);
|
||||
mod = nw <= o.minWidth ? p[0] - o.minWidth : (nw >= o.maxWidth ? 0-(o.maxWidth-p[0]) : mod);
|
||||
$(this.helper).css('left', co.left + mod);
|
||||
break;
|
||||
|
||||
case 'nw':
|
||||
|
||||
if(!o.proxy && (o.originalPosition != "absolute" && o.originalPosition != "fixed"))
|
||||
return false;
|
||||
|
||||
var modx = (this.pos[0] - co.left); nw = nw - (modx*2);
|
||||
modx = nw <= o.minWidth ? p[0] - o.minWidth : (nw >= o.maxWidth ? 0-(o.maxWidth-p[0]) : modx);
|
||||
|
||||
var mody = (this.pos[1] - co.top); nh = nh - (mody*2);
|
||||
mody = nh <= o.minHeight ? p[1] - o.minHeight : (nh >= o.maxHeight ? 0-(o.maxHeight-p[1]) : mody);
|
||||
|
||||
$(this.helper).css({
|
||||
left: co.left + modx,
|
||||
top: co.top + mody
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(e.shiftKey) nh = nw * (p[1]/p[0]);
|
||||
|
||||
if(o.minWidth) nw = nw <= o.minWidth ? o.minWidth : nw;
|
||||
if(o.minHeight) nh = nh <= o.minHeight ? o.minHeight : nh;
|
||||
|
||||
if(o.maxWidth) nw = nw >= o.maxWidth ? o.maxWidth : nw;
|
||||
if(o.maxHeight) nh = nh >= o.maxHeight ? o.maxHeight : nh;
|
||||
|
||||
if(e.shiftKey) nh = nw * (p[1]/p[0]);
|
||||
|
||||
var modifier = $(that.element).triggerHandler("resize", [e, that.prepareCallbackObj(this)], o.resize);
|
||||
if(!modifier) modifier = {};
|
||||
|
||||
for(var i in this.options.modifyThese) {
|
||||
var c = this.options.modifyThese[i];
|
||||
c[0].css({
|
||||
width: modifier.width ? modifier.width+c[1] : nw+c[1],
|
||||
height: modifier.height ? modifier.height+c[2] : nh+c[2]
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})($);
|
||||
116
js/ui.selectable.js
Normal file
@@ -0,0 +1,116 @@
|
||||
(function($)
|
||||
{
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { selectable: "(' '+a.className+' ').indexOf(' ui-selectable ')" });
|
||||
$.extend($.expr[':'], { selectee: "(' '+a.className+' ').indexOf(' ui-selectee ')" });
|
||||
|
||||
$.fn.selectable = function(o) {
|
||||
return this.each(function() {
|
||||
if (!$(this).is(".ui-selectable")) new $.ui.selectable(this, o);
|
||||
});
|
||||
}
|
||||
|
||||
$.ui.selectable = function(el, o) {
|
||||
|
||||
var options = {
|
||||
filter: '*'
|
||||
};
|
||||
var o = o || {}; $.extend(options, o); //Extend and copy options
|
||||
this.element = el; var self = this; //Do bindings
|
||||
self.dragged = false;
|
||||
|
||||
$.extend(options, {
|
||||
helper: function() { return $(document.createElement('div')).css({border:'1px dotted black'}); },
|
||||
_start: function(h,p,c,t,e) {
|
||||
self.start.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_drag: function(h,p,c,t,e) {
|
||||
self.dragged = true;
|
||||
self.drag.apply(t, [self, e]); // Trigger the drag callback
|
||||
},
|
||||
_stop: function(h,p,c,t,e) {
|
||||
self.stop.apply(t, [self, e]); // Trigger the end callback
|
||||
self.dragged = false;
|
||||
}
|
||||
});
|
||||
|
||||
//Initialize mouse interaction
|
||||
this.mouse = new $.ui.mouseInteraction(el, options);
|
||||
|
||||
//Add the class for themeing
|
||||
$(this.element).addClass("ui-selectable");
|
||||
$(this.element).children(options.filter).addClass("ui-selectee");
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.selectable.prototype, {
|
||||
plugins: {},
|
||||
start: function(self, ev) {
|
||||
$(self.mouse.helper).css({'z-index': 100, position: 'absolute', left: ev.clientX, top: ev.clientY, width:0, height: 0});
|
||||
if (ev.ctrlKey) {
|
||||
if ($(ev.target).is('.ui-selected')) {
|
||||
$(ev.target).removeClass('ui-selected').addClass('ui-unselecting');
|
||||
$(self.element).triggerHandler("selectableunselecting", [ev, {
|
||||
selectable: self.element,
|
||||
unselecting: ev.target,
|
||||
options: this.options
|
||||
}], this.options.unselecting);
|
||||
}
|
||||
} else {
|
||||
self.unselecting(self, ev, this.options);
|
||||
self.selectingTarget(self, ev, this.options);
|
||||
}
|
||||
},
|
||||
drag: function(self, ev) {
|
||||
var x1 = self.mouse.opos[0], y1 = self.mouse.opos[1], x2 = ev.pageX, y2 = ev.pageY;
|
||||
if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
|
||||
if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
|
||||
$(self.mouse.helper).css({left: x1, top: y1, width: x2-x1, height: y2-y1});
|
||||
self.selectingTarget(self, ev, this.options);
|
||||
},
|
||||
stop: function(self, ev) {
|
||||
var options = this.options;
|
||||
$('.ui-selecting', self.element).each(function() {
|
||||
$(this).removeClass('ui-selecting').addClass('ui-selected');
|
||||
$(self.element).triggerHandler("selectableselected", [ev, {
|
||||
selectable: self.element,
|
||||
selected: this,
|
||||
options: options
|
||||
}], options.selected);
|
||||
});
|
||||
$('.ui-unselecting', self.element).each(function() {
|
||||
$(this).removeClass('ui-unselecting');
|
||||
$(self.element).triggerHandler("selectableunselected", [ev, {
|
||||
selectable: self.element,
|
||||
unselected: this,
|
||||
options: options
|
||||
}], options.unselected);
|
||||
});
|
||||
},
|
||||
unselecting: function(self, ev, options) {
|
||||
$('.ui-selected', self.element).each(function() {
|
||||
if (this != ev.target) {
|
||||
$(this).removeClass('ui-selected').addClass('ui-unselecting');
|
||||
$(self.element).triggerHandler("selectableunselecting", [ev, {
|
||||
selectable: self.element,
|
||||
unselecting: this,
|
||||
options: options
|
||||
}], options.unselecting);
|
||||
}
|
||||
});
|
||||
},
|
||||
selectingTarget: function(self, ev, options) {
|
||||
var target = $(ev.target);
|
||||
if (target.is('.ui-selectee:not(.ui-selecting)')) {
|
||||
target.removeClass('ui-selected').removeClass('ui-unselecting').addClass('ui-selecting');
|
||||
$(self.element).triggerHandler("selectableselecting", [ev, {
|
||||
selectable: self.element,
|
||||
selecting: ev.target,
|
||||
options: options
|
||||
}], options.selecting);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
87
js/ui.shadow.js
Normal file
@@ -0,0 +1,87 @@
|
||||
(function($) {
|
||||
|
||||
//If the UI scope is not available, add it
|
||||
$.ui = $.ui || {};
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { shadowed: "(' '+a.className+' ').indexOf(' ui-shadowed ')" });
|
||||
|
||||
$.fn.shadowEnable = function() { if($(this[0]).next().is(".ui-shadow")) $(this[0]).next().show(); }
|
||||
$.fn.shadowDisable = function() { if($(this[0]).next().is(".ui-shadow")) $(this[0]).next().hide(); }
|
||||
|
||||
$.fn.shadow = function(options) {
|
||||
|
||||
options = options || {};
|
||||
options.offset = options.offset ? options.offset : 0;
|
||||
options.opacity = options.opacity ? options.opacity : 0.2;
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
var cur = $(this);
|
||||
|
||||
//Create a shadow element
|
||||
var shadow = $("<div class='ui-shadow'></div>"); cur.after(shadow);
|
||||
|
||||
//Figure the base height and width
|
||||
var baseWidth = cur.outerWidth();
|
||||
var baseHeight = cur.outerHeight();
|
||||
|
||||
//get the offset
|
||||
var position = cur.position();
|
||||
|
||||
//Append smooth corners
|
||||
$('<div class="ui-shadow-color ui-shadow-layer-1"></div>').css({ opacity: options.opacity-0.05, left: 5+options.offset, top: 5+options.offset, width: baseWidth+1, height: baseHeight+1 }).appendTo(shadow);
|
||||
$('<div class="ui-shadow-color ui-shadow-layer-2"></div>').css({ opacity: options.opacity-0.1, left: 7+options.offset, top: 7+options.offset, width: baseWidth, height: baseHeight-3 }).appendTo(shadow);
|
||||
$('<div class="ui-shadow-color ui-shadow-layer-3"></div>').css({ opacity: options.opacity-0.1, left: 7+options.offset, top: 7+options.offset, width: baseWidth-3, height: baseHeight }).appendTo(shadow);
|
||||
$('<div class="ui-shadow-color ui-shadow-layer-4"></div>').css({ opacity: options.opacity, left: 6+options.offset, top: 6+options.offset, width: baseWidth-1, height: baseHeight-1 }).appendTo(shadow);
|
||||
|
||||
//If we have a color, use it
|
||||
if(options.color)
|
||||
$("div.ui-shadow-color", shadow).css("background-color", options.color);
|
||||
|
||||
//Determine the stack order (attention: the zIndex will get one higher!)
|
||||
if(!cur.css("zIndex") || cur.css("zIndex") == "auto") {
|
||||
var stack = 0;
|
||||
cur.css("position", (cur.css("position") == "static" ? "relative" : cur.css("position"))).css("z-index", "1");
|
||||
} else {
|
||||
var stack = parseInt(cur.css("zIndex"));
|
||||
cur.css("zIndex", stack+1);
|
||||
}
|
||||
|
||||
//Copy the original z-index and position to the clone
|
||||
//alert(shadow); If you insert this alert, opera will time correctly!!
|
||||
shadow.css({
|
||||
position: "absolute",
|
||||
zIndex: stack,
|
||||
left: position.left,
|
||||
top: position.top,
|
||||
width: baseWidth,
|
||||
height: baseHeight,
|
||||
marginLeft: cur.css("marginLeft"),
|
||||
marginRight: cur.css("marginRight"),
|
||||
marginBottom: cur.css("marginBottom"),
|
||||
marginTop: cur.css("marginTop")
|
||||
});
|
||||
|
||||
|
||||
function rearrangeShadow(el,sh) {
|
||||
var $el = $(el);
|
||||
$(sh).css($el.position());
|
||||
$(sh).children().css({ height: $el.outerHeight()+"px", width: $el.outerWidth()+"px" });
|
||||
}
|
||||
|
||||
if($.browser.msie) {
|
||||
//Add dynamic css expressions
|
||||
shadow[0].style.setExpression("left","parseInt(jQuery(this.previousSibling).css('left'))+'px' || jQuery(this.previousSibling).position().left");
|
||||
shadow[0].style.setExpression("top","parseInt(jQuery(this.previousSibling).css('top'))+'px' || jQuery(this.previousSibling).position().top");
|
||||
} else {
|
||||
//Bind events for good browsers
|
||||
this.addEventListener("DOMAttrModified",function() { rearrangeShadow(this,shadow); },false);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
})($);
|
||||
294
js/ui.slider.js
Normal file
@@ -0,0 +1,294 @@
|
||||
(function($) {
|
||||
|
||||
|
||||
//Web Forms 2.0
|
||||
window.webforms = 1;
|
||||
if(window['webforms']) {
|
||||
$(document).ready(function() {
|
||||
|
||||
$("input").each(function() {
|
||||
if(this.getAttribute("type") == "range") {
|
||||
var cur = $(this);
|
||||
var slider = $("<div class='ui-slider'></div>").css({ width: cur.innerWidth()+"px", height: cur.innerHeight()+"px" }).insertAfter(cur);
|
||||
var handle = $("<div class='ui-slider-handle'></div>").appendTo(slider);
|
||||
|
||||
|
||||
slider.css({
|
||||
"position": cur.css("position") == "absolute" ? "absolute" : "relative",
|
||||
"left": cur.css("left"),
|
||||
"right": cur.css("right"),
|
||||
"zIndex": cur.css("zIndex"),
|
||||
"float": cur.css("float"),
|
||||
"clear": cur.css("clear")
|
||||
});
|
||||
cur.css({ position: "absolute", opacity: 0, top: "-1000px", left: "-1000px" });
|
||||
|
||||
slider.slider({
|
||||
maxValue: cur.attr("max"),
|
||||
minValue: cur.attr("min"),
|
||||
startValue: this.getAttribute("value"),
|
||||
stepping: cur.attr("step"),
|
||||
change: function(e, ui) { cur[0].value = ui.value; cur[0].setAttribute("value", ui.value); },
|
||||
});
|
||||
|
||||
slider = slider.sliderInstance();
|
||||
|
||||
cur.bind("keydown", function(e) {
|
||||
var o = slider.interaction.options;
|
||||
switch(e.keyCode) {
|
||||
case 37:
|
||||
slider.moveTo(slider.interaction.curValue+o.minValue-(o.stepping || 1));
|
||||
break;
|
||||
case 39:
|
||||
slider.moveTo(slider.interaction.curValue+o.minValue+(o.stepping || 1));
|
||||
break;
|
||||
}
|
||||
if(e.keyCode != 9) return false;
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { slider: "(' '+a.className+' ').indexOf(' ui-slider ')" });
|
||||
|
||||
$.fn.slider = function(o) {
|
||||
return this.each(function() {
|
||||
new $.ui.slider(this, o);
|
||||
});
|
||||
}
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable,moveTo".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-slider")) jQuery.data(this, "ui-slider")["'+cur+'"](a); }); }');
|
||||
$.fn["slider"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.sliderInstance = function() {
|
||||
if($(this[0]).is(".ui-slider")) return $.data(this[0], "ui-slider");
|
||||
return false;
|
||||
};
|
||||
|
||||
$.ui.slider = function(el, o) {
|
||||
|
||||
var options = {};
|
||||
o = o || {};
|
||||
$.extend(options, o);
|
||||
$.extend(options, {
|
||||
axis: o.axis || (el.offsetWidth < el.offsetHeight ? 'vertical' : 'horizontal'),
|
||||
maxValue: parseInt(o.maxValue) || 100,
|
||||
minValue: parseInt(o.minValue) || 0,
|
||||
startValue: parseInt(o.startValue) || 0,
|
||||
_start: function(h, p, c, t, e) {
|
||||
self.start.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_beforeStop: function(h, p, c, t, e) {
|
||||
self.stop.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
_drag: function(h, p, c, t, e) {
|
||||
self.drag.apply(t, [self, e]); // Trigger the start callback
|
||||
},
|
||||
startCondition: function() {
|
||||
return !self.disabled;
|
||||
}
|
||||
});
|
||||
|
||||
var self = this;
|
||||
var o = options;
|
||||
$.data(el, "ui-slider", this);
|
||||
o.stepping = parseInt(o.stepping) || (o.steps ? o.maxValue/o.steps : 0);
|
||||
o.realValue = (o.maxValue - o.minValue);
|
||||
|
||||
|
||||
this.handle = options.handle ? $(options.handle, el) : $('.ui-slider-handle', el);
|
||||
if(this.handle.length == 1) {
|
||||
this.interaction = new $.ui.mouseInteraction(this.handle[0], options);
|
||||
this.multipleHandles = false;
|
||||
} else {
|
||||
this.interactions = [];
|
||||
this.handle.each(function() {
|
||||
self.interactions.push(new $.ui.mouseInteraction(this, options));
|
||||
});
|
||||
this.multipleHandles = true;
|
||||
}
|
||||
|
||||
this.element = el;
|
||||
$(this.element).addClass("ui-slider");
|
||||
|
||||
|
||||
if(o.axis == 'horizontal') {
|
||||
this.parentSize = $(this.element).outerWidth() - this.handle.outerWidth();
|
||||
this.prop = 'left';
|
||||
}
|
||||
|
||||
if(o.axis == 'vertical') {
|
||||
this.parentSize = $(this.element).outerHeight() - this.handle.outerHeight();
|
||||
this.prop = 'top';
|
||||
}
|
||||
|
||||
if(!this.multipleHandles) {
|
||||
$(el).bind('click', function(e) { self.click.apply(self, [e]); });
|
||||
if(!isNaN(o.startValue)) this.moveTo(o.startValue,options.realValue, null, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$.extend($.ui.slider.prototype, {
|
||||
currentTarget: null,
|
||||
lastTarget: null,
|
||||
destroy: function() {
|
||||
$(this.element).removeClass("ui-slider").removeClass("ui-slider-disabled");
|
||||
this.interaction.destroy();
|
||||
},
|
||||
enable: function() {
|
||||
$(this.element).removeClass("ui-slider-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.element).addClass("ui-slider-disabled");
|
||||
this.disabled = true;
|
||||
},
|
||||
nonvalidRange: function(self) {
|
||||
|
||||
for(var i=0;i<this.interactions.length;i++) {
|
||||
if(self == this.interactions[i]) {
|
||||
if(this.interactions[i-1]) {
|
||||
if(this.interactions[i-1].curValue > this.interactions[i].curValue) return this.interactions[i-1].curValue;
|
||||
}
|
||||
|
||||
if(this.interactions[i+1]) {
|
||||
if(this.interactions[i+1].curValue < this.interactions[i].curValue) return this.interactions[i+1].curValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
prepareCallbackObj: function(self,m) {
|
||||
|
||||
var cur = this;
|
||||
var func = function() {
|
||||
var retVal = [];
|
||||
for(var i=0;i<cur.interactions.length;i++) {
|
||||
retVal.push((cur.interactions[i].curValue || 0)+self.options.minValue);
|
||||
}
|
||||
return retVal;
|
||||
};
|
||||
|
||||
return {
|
||||
handle: self.helper,
|
||||
pixel: m,
|
||||
value: self.curValue+self.options.minValue,
|
||||
values: this.multipleHandles ? func() : self.curValue+self.options.minValue,
|
||||
slider: self
|
||||
}
|
||||
},
|
||||
click: function(e) {
|
||||
var o = this.interaction.options;
|
||||
var pointer = [e.pageX,e.pageY];
|
||||
var offset = $(this.interaction.element).offsetParent().offset({ border: false });
|
||||
if(this.interaction.element == e.target || this.disabled) return;
|
||||
|
||||
this.interaction.pickValue = this.interaction.curValue;
|
||||
this.drag.apply(this.interaction, [this, e, [pointer[0]-offset.left-this.handle[0].offsetWidth/2,pointer[1]-offset.top-this.handle[0].offsetHeight/2]]);
|
||||
|
||||
if(this.interaction.pickValue != this.interaction.curValue)
|
||||
$(this.element).triggerHandler("slidechange", [e, this.prepareCallbackObj(this.interaction)], o.change);
|
||||
|
||||
},
|
||||
start: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
$(that.element).triggerHandler("slidestart", [e, that.prepareCallbackObj(this)], o.start);
|
||||
this.pickValue = this.curValue;
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
stop: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
$(that.element).triggerHandler("slidestop", [e, that.prepareCallbackObj(this)], o.stop);
|
||||
if(this.pickValue != this.curValue) $(that.element).triggerHandler("slidechange", [e, that.prepareCallbackObj(this)], o.change);
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
drag: function(that, e, pos) {
|
||||
|
||||
var o = this.options;
|
||||
this.pos = pos || [this.pos[0]-this.element.offsetWidth/2, this.pos[1]-this.element.offsetHeight/2];
|
||||
|
||||
if(o.axis == 'horizontal') var m = this.pos[0];
|
||||
if(o.axis == 'vertical') var m = this.pos[1];
|
||||
|
||||
|
||||
var p = that.parentSize;
|
||||
var prop = that.prop;
|
||||
|
||||
if(m < 0) m = 0;
|
||||
if(m > p) m = p;
|
||||
|
||||
this.curValue = (Math.round((m/p)*o.realValue));
|
||||
if(o.stepping) {
|
||||
this.curValue = Math.round(this.curValue/o.stepping)*o.stepping;
|
||||
m = ((this.curValue)/o.realValue) * p;
|
||||
}
|
||||
|
||||
if(that.interactions) {
|
||||
nonvalidRange = that.nonvalidRange(this);
|
||||
if(nonvalidRange) {
|
||||
this.curValue = nonvalidRange;
|
||||
m = ((this.curValue)/o.realValue) * p;
|
||||
}
|
||||
}
|
||||
|
||||
$(this.element).css(prop, m+'px');
|
||||
$(that.element).triggerHandler("slide", [e, that.prepareCallbackObj(this,m)], o.slide);
|
||||
return false;
|
||||
|
||||
},
|
||||
moveTo: function(value,scale,changeslide,p) { // renamed from goto to moveTo as goto is reserved javascript word
|
||||
|
||||
if(this.multipleHandles) return false; //TODO: Multiple handle moveTo function
|
||||
|
||||
var o = this.interaction.options;
|
||||
var offset = $(this.interaction.element).offsetParent().offset({ border: false });
|
||||
this.interaction.pickValue = this.interaction.curValue;
|
||||
value = value-o.minValue;
|
||||
|
||||
var modifier = scale || o.realValue;
|
||||
|
||||
var p = this.parentSize;
|
||||
var prop = this.prop;
|
||||
|
||||
m = Math.round(((value)/modifier) * p);
|
||||
|
||||
if(m < 0) m = 0;
|
||||
if(m > p) m = p;
|
||||
|
||||
this.interaction.curValue = (Math.round((m/p)*o.realValue));
|
||||
if(o.stepping) {
|
||||
this.interaction.curValue = Math.round(this.interaction.curValue/o.stepping)*o.stepping;
|
||||
m = ((this.interaction.curValue)/o.realValue) * p;
|
||||
}
|
||||
|
||||
$(this.interaction.element).css(prop, m+'px');
|
||||
|
||||
if(!changeslide && this.interaction.pickValue != this.interaction.curValue && !p)
|
||||
$(this.element).triggerHandler("slidechange", [e, this.prepareCallbackObj(this.interaction)], o.change);
|
||||
|
||||
if(changeslide)
|
||||
$(this.element).triggerHandler("slide", [e, this.prepareCallbackObj(this.interaction)], o.slide);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})($);
|
||||
262
js/ui.sortable.js
Normal file
@@ -0,0 +1,262 @@
|
||||
if (window.Node && Node.prototype && !Node.prototype.contains) {
|
||||
Node.prototype.contains = function (arg) {
|
||||
return !!(this.compareDocumentPosition(arg) & 16)
|
||||
}
|
||||
}
|
||||
|
||||
(function($) {
|
||||
|
||||
//Make nodes selectable by expression
|
||||
$.extend($.expr[':'], { sortable: "(' '+a.className+' ').indexOf(' ui-sortable ')" });
|
||||
|
||||
$.fn.sortable = function(o) {
|
||||
return this.each(function() {
|
||||
new $.ui.sortable(this,o);
|
||||
});
|
||||
}
|
||||
|
||||
//Macros for external methods that support chaining
|
||||
var methods = "destroy,enable,disable,refresh".split(",");
|
||||
for(var i=0;i<methods.length;i++) {
|
||||
var cur = methods[i], f;
|
||||
eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-sortable")) jQuery.data(this, "ui-sortable")["'+cur+'"](a); }); }');
|
||||
$.fn["sortable"+cur.substr(0,1).toUpperCase()+cur.substr(1)] = f;
|
||||
};
|
||||
|
||||
//get instance method
|
||||
$.fn.sortableInstance = function() {
|
||||
if($(this[0]).is(".ui-sortable")) return $.data(this[0], "ui-sortable");
|
||||
return false;
|
||||
};
|
||||
|
||||
$.ui.sortable = function(el,o) {
|
||||
|
||||
this.element = el;
|
||||
this.set = [];
|
||||
var options = {};
|
||||
var self = this;
|
||||
$.data(this.element, "ui-sortable", this);
|
||||
$(el).addClass("ui-sortable");
|
||||
|
||||
$.extend(options, o);
|
||||
$.extend(options, {
|
||||
items: options.items || '> li',
|
||||
smooth: options.smooth != undefined ? options.smooth : true,
|
||||
helper: 'clone',
|
||||
containment: options.containment ? (options.containment == 'sortable' ? el : options.containment) : null,
|
||||
zIndex: options.zIndex || 1000,
|
||||
_start: function(h,p,c,t,e) {
|
||||
self.start.apply(t, [self, e]); // Trigger the onStart callback
|
||||
},
|
||||
_beforeStop: function(h,p,c,t,e) {
|
||||
self.stop.apply(t, [self, e]); // Trigger the onStart callback
|
||||
},
|
||||
_drag: function(h,p,c,t,e) {
|
||||
self.drag.apply(t, [self, e]); // Trigger the onStart callback
|
||||
},
|
||||
startCondition: function() {
|
||||
return !self.disabled;
|
||||
}
|
||||
});
|
||||
|
||||
//Get the items
|
||||
var items = $(options.items, el);
|
||||
|
||||
//Let's determine the floating mode
|
||||
options.floating = /left|right/.test(items.css('float'));
|
||||
|
||||
//Let's determine the parent's offset
|
||||
if($(el).css('position') == 'static') $(el).css('position', 'relative');
|
||||
options.offset = $(el).offset({ border: false });
|
||||
|
||||
items.each(function() {
|
||||
new $.ui.mouseInteraction(this,options);
|
||||
});
|
||||
|
||||
//Add current items to the set
|
||||
items.each(function() {
|
||||
self.set.push([this,null]);
|
||||
});
|
||||
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
$.extend($.ui.sortable.prototype, {
|
||||
plugins: {},
|
||||
currentTarget: null,
|
||||
lastTarget: null,
|
||||
prepareCallbackObj: function(self, that) {
|
||||
return {
|
||||
helper: self.helper,
|
||||
position: { left: self.pos[0], top: self.pos[1] },
|
||||
offset: self.options.cursorAt,
|
||||
draggable: self,
|
||||
current: that,
|
||||
options: self.options
|
||||
}
|
||||
},
|
||||
refresh: function() {
|
||||
|
||||
//Get the items
|
||||
var self = this;
|
||||
var items = $(this.options.items, this.element);
|
||||
|
||||
var unique = [];
|
||||
items.each(function() {
|
||||
old = false;
|
||||
for(var i=0;i<self.set.length;i++) { if(self.set[i][0] == this) old = true; }
|
||||
if(!old) unique.push(this);
|
||||
});
|
||||
|
||||
for(var i=0;i<unique.length;i++) {
|
||||
new $.ui.mouseInteraction(unique[i],self.options);
|
||||
}
|
||||
|
||||
//Add current items to the set
|
||||
this.set = [];
|
||||
items.each(function() {
|
||||
self.set.push([this,null]);
|
||||
});
|
||||
|
||||
},
|
||||
destroy: function() {
|
||||
$(this.element).removeClass("ui-sortable").removeClass("ui-sortable-disabled");
|
||||
$(this.options.items, this.element).mouseInteractionDestroy();
|
||||
|
||||
},
|
||||
enable: function() {
|
||||
$(this.element).removeClass("ui-sortable-disabled");
|
||||
this.disabled = false;
|
||||
},
|
||||
disable: function() {
|
||||
$(this.element).addClass("ui-sortable-disabled");
|
||||
this.disabled = true;
|
||||
},
|
||||
start: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
if(o.hoverClass) {
|
||||
that.helper = $('<div class="'+o.hoverClass+'"></div>').appendTo('body').css({
|
||||
height: this.element.offsetHeight+'px',
|
||||
width: this.element.offsetWidth+'px',
|
||||
position: 'absolute'
|
||||
});
|
||||
}
|
||||
|
||||
if(o.zIndex) {
|
||||
if($(this.helper).css("zIndex")) o.ozIndex = $(this.helper).css("zIndex");
|
||||
$(this.helper).css('zIndex', o.zIndex);
|
||||
}
|
||||
|
||||
that.firstSibling = $(this.element).prev()[0];
|
||||
|
||||
$(this.element).triggerHandler("sortstart", [e, that.prepareCallbackObj(this)], o.start);
|
||||
$(this.element).css('visibility', 'hidden');
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
stop: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
var self = this;
|
||||
|
||||
|
||||
if(o.smooth) {
|
||||
var os = $(this.element).offset();
|
||||
o.beQuietAtEnd = true;
|
||||
$(this.helper).animate({ left: os.left - o.po.left, top: os.top - o.po.top }, 500, stopIt);
|
||||
} else {
|
||||
stopIt();
|
||||
}
|
||||
|
||||
function stopIt() {
|
||||
|
||||
$(self.element).css('visibility', 'visible');
|
||||
if(that.helper) that.helper.remove();
|
||||
if(self.helper != self.element) $(self.helper).remove();
|
||||
|
||||
if(o.ozIndex)
|
||||
$(self.helper).css('zIndex', o.ozIndex);
|
||||
|
||||
|
||||
//Let's see if the position in DOM has changed
|
||||
if($(self.element).prev()[0] != that.firstSibling) {
|
||||
//$(self.element).triggerHandler("sortupdate", [e, that.prepareCallbackObj(self, that)], o.update);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
drag: function(that, e) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
this.pos = [this.pos[0]-(o.cursorAt.left ? o.cursorAt.left : 0), this.pos[1]-(o.cursorAt.top ? o.cursorAt.top : 0)];
|
||||
var nv = $(this.element).triggerHandler("sort", [e, that.prepareCallbackObj(this)], o.sort);
|
||||
var nl = (nv && nv.left) ? nv.left : this.pos[0];
|
||||
var nt = (nv && nv.top) ? nv.top : this.pos[1];
|
||||
|
||||
|
||||
var m = that.set;
|
||||
var p = this.pos[1];
|
||||
|
||||
for(var i=0;i<m.length;i++) {
|
||||
|
||||
var ci = $(m[i][0]); var cio = m[i][0];
|
||||
if(this.element.contains(cio)) continue;
|
||||
var cO = ci.offset(); //TODO: Caching
|
||||
cO = { top: cO.top, left: cO.left };
|
||||
|
||||
var mb = function(e) { if(true || o.lba != cio) { ci.before(e); o.lba = cio; } }
|
||||
var ma = function(e) { if(true || o.laa != cio) { ci.after(e); o.laa = cio; } }
|
||||
|
||||
if(o.floating) {
|
||||
|
||||
var overlap = ((cO.left - (this.pos[0]+(this.options.po ? this.options.po.left : 0)))/this.helper.offsetWidth);
|
||||
|
||||
if(!(cO.top < this.pos[1]+(this.options.po ? this.options.po.top : 0) + cio.offsetHeight/2 && cO.top + cio.offsetHeight > this.pos[1]+(this.options.po ? this.options.po.top : 0) + cio.offsetHeight/2)) continue;
|
||||
|
||||
} else {
|
||||
|
||||
var overlap = ((cO.top - (this.pos[1]+(this.options.po ? this.options.po.top : 0)))/this.helper.offsetHeight);
|
||||
|
||||
if(!(cO.left < this.pos[0]+(this.options.po ? this.options.po.left : 0) + cio.offsetWidth/2 && cO.left + cio.offsetWidth > this.pos[0]+(this.options.po ? this.options.po.left : 0) + cio.offsetWidth/2)) continue;
|
||||
|
||||
}
|
||||
|
||||
if(overlap >= 0 && overlap <= 0.5) { //Overlapping at top
|
||||
ci.prev().length ? ma(this.element) : mb(this.element);
|
||||
}
|
||||
|
||||
if(overlap < 0 && overlap > -0.5) { //Overlapping at bottom
|
||||
ci.next()[0] == this.element ? mb(this.element) : ma(this.element);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Let's see if the position in DOM has changed
|
||||
if($(this.element).prev()[0] != that.lastSibling) {
|
||||
$(this.element).triggerHandler("sortchange", [e, that.prepareCallbackObj(this, that)], this.options.change);
|
||||
that.lastSibling = $(this.element).prev()[0];
|
||||
}
|
||||
|
||||
if(that.helper) { //reposition helper if available
|
||||
var to = $(this.element).offset();
|
||||
that.helper.css({
|
||||
top: to.top+'px',
|
||||
left: to.left+'px'
|
||||
});
|
||||
}
|
||||
|
||||
$(this.helper).css('left', nl+'px').css('top', nt+'px'); // Stick the helper to the cursor
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})($);
|
||||