1205 lines
70 KiB
JavaScript
1205 lines
70 KiB
JavaScript
/*
|
|
The following errors were found when attempting to minify this file:
|
|
Closure Compilation Error:
|
|
*/
|
|
var fb_busy = false;
|
|
$(document).ready(function () {
|
|
if ($('#makeToolbarSignInButtonDisappear').val() == 'True') {
|
|
if ($('#loggedOutToolbarSignInButton')) {
|
|
$('#loggedOutToolbarSignInButton').hide();
|
|
$('#signedOutToolbarMoreInformationButtons').hide();
|
|
}
|
|
}
|
|
|
|
var userName;
|
|
|
|
if (document.layers)
|
|
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
|
|
|
|
document.onmouseover = hidestatus;
|
|
document.onmouseout = hidestatus;
|
|
|
|
userName = document.getElementById('UserName');
|
|
if (userName) {
|
|
if (userName.value == '') {
|
|
userName.focus();
|
|
} else {
|
|
document.getElementById('Password').focus();
|
|
}
|
|
}
|
|
|
|
if (document.getElementById('fb-root')) {
|
|
if (typeof (FB) != "undefined") {
|
|
FB.init({
|
|
appId: $('#AppID').val(),
|
|
cookie: true,
|
|
status: true,
|
|
oauth: true
|
|
});
|
|
}
|
|
$('.fb-login').click(function (evt) {
|
|
var from;
|
|
var url;
|
|
var anchor;
|
|
var signInURL;
|
|
|
|
if (fb_busy) return;
|
|
fb_busy = true;
|
|
|
|
$('.fb-login').fadeOut(100);
|
|
$('.loginBox').fadeOut(100);
|
|
$('#login-fb-waiting-text').delay(100).text('Signing in with Facebook...');
|
|
$('#login-fb-waiting').delay(100).fadeIn(100);
|
|
|
|
try {
|
|
FB.login(function (response) {
|
|
if (response.authResponse) {
|
|
var res = HasAcceptedTerms('/MyAccount/HasAcceptedTermsFacebook?access_token=' + response.authResponse.accessToken + '&orgName=' + (document.getElementById('Organization') != null ? document.getElementById('Organization').value : ''));
|
|
if (res.status != 1) {
|
|
alert(res.msg);
|
|
} else if (!res.HasAcceptedTerms) {
|
|
ShowTerms(function () {
|
|
PerformFacebookSignIn(response.authResponse.accessToken);
|
|
});
|
|
} else {
|
|
PerformFacebookSignIn(response.authResponse.accessToken);
|
|
}
|
|
} else {
|
|
// user is not logged in
|
|
LoginFailed('Sign in with Facebook cancelled.');
|
|
}
|
|
}, {
|
|
scope: 'email'
|
|
});
|
|
} catch (e) {
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
$('.performSignIn').unbind('click').click(function (e) {
|
|
performSignIn();
|
|
});
|
|
|
|
$('.forgot').unbind('click').click(function (e) {
|
|
var $self = $(this);
|
|
var uniqueID = $self.parents('ol.loginBox').find('.UniqueID').val();
|
|
var username = $('#UserName' + uniqueID).val();
|
|
recover(username);
|
|
});
|
|
});
|
|
|
|
function PerformFacebookSignIn(accessToken) {
|
|
// user is logged in and granted permission.
|
|
signInURL = '/MyAccount/FacebookSignIn?access_token=' + accessToken;
|
|
from = GetQueryStringParameter('from');
|
|
var dn = GetQueryStringParameter('dn');
|
|
if (dn != "") {
|
|
signInURL = signInURL + '&dn=' + dn;
|
|
}
|
|
if (from != "") {
|
|
url = GetQueryStringParameter('url');
|
|
anchor = GetQueryStringParameter('anchor');
|
|
signInURL = signInURL + '&from=' + from + '&url=' + url + '&anchor=' + anchor;
|
|
|
|
}
|
|
|
|
window.location.href = signInURL;
|
|
}
|
|
|
|
function LoginFailed(message) {
|
|
$('#login-fb-waiting-text').fadeOut(250);
|
|
$('#login-fb-waiting-text').text(message);
|
|
$('#login-fb-waiting-text').fadeIn(250).delay(2000).fadeOut(250);
|
|
$('#login-fb-waiting').delay(2250).fadeOut(250);
|
|
$('.loginBox').delay(2250).fadeIn(250);
|
|
$('.fb-login').delay(2250).fadeIn(250);
|
|
fb_busy = false;
|
|
}
|
|
|
|
function hidestatus() {
|
|
window.status = ''
|
|
return true
|
|
}
|
|
|
|
function performSignIn() {
|
|
var res = HasAcceptedTerms('/MyAccount/HasAcceptedTerms?userName=' + document.getElementById('UserName').value + '&orgName=' + (document.getElementById('Organization') != null ? document.getElementById('Organization').value : ''));
|
|
if (res.status != 1) {
|
|
alert(res.msg);
|
|
} else if (!res.HasAcceptedTerms) {
|
|
ShowTerms(function () {
|
|
if (window.chrome !== null && window.chrome !== undefined && window.navigator.vendor === "Google Inc.") {
|
|
setTimeout(function () { //issue with chrome where the form submit doesn't respect the form's action. SetTimeout is a workaround.
|
|
$('#aspnetForm:first').submit();
|
|
}, 0);
|
|
} else {
|
|
$('#aspnetForm:first').submit();
|
|
}
|
|
|
|
});
|
|
} else {
|
|
//This call is necessary here since when we do programatic submits, it does not remove the placeholder and the submit handler automatically. Refer to removePlaceHolder() in GlobalJSFunctionDetail.js for detailed comment.
|
|
removePlaceHolders();
|
|
setDaysSinceLastLoginCookie();
|
|
if (window.chrome !== null && window.chrome !== undefined && window.navigator.vendor === "Google Inc.") {
|
|
setTimeout(function () { //issue with chrome where the form submit doesn't respect the form's action. SetTimeout is a workaround.
|
|
$('#aspnetForm:first').submit();
|
|
}, 0);
|
|
} else {
|
|
$('#aspnetForm:first').submit();
|
|
}
|
|
}
|
|
}
|
|
|
|
function signInOnEnter(ev) {
|
|
ev = (window.event ? window.event : ev);
|
|
|
|
if (ev.keyCode == 10 || ev.keyCode == 13)
|
|
performSignIn();
|
|
}
|
|
|
|
function VerifyUserOnEnter(ev) {
|
|
ev = (window.event ? window.event : ev);
|
|
|
|
if (ev.keyCode == 10 || ev.keyCode == 13)
|
|
VerifyEditUser();
|
|
}
|
|
|
|
function VerifyEditUser(isNew) {
|
|
var alertMsg = "";
|
|
var errString = 'The form can not be submitted due to the following error(s):\n';
|
|
errString += "-----------------------------------------------------------------------\n\n";
|
|
var doSubmit = true;
|
|
|
|
txtPassword = TrimString(document.getElementById('Password').value);
|
|
txtConfirmPassword = TrimString(document.getElementById('ConfirmPassword').value);
|
|
|
|
if (FieldIsEmpty(document.getElementById('UserName').value)) {
|
|
doSubmit = false;
|
|
alertMsg += "Your email cannot be blank.\n";
|
|
}
|
|
|
|
if (FieldIsEmpty(document.getElementById('FirstName').value)) {
|
|
doSubmit = false;
|
|
alertMsg += "Your first name cannot be blank.\n";
|
|
}
|
|
|
|
if (FieldIsEmpty(document.getElementById('LastName').value)) {
|
|
doSubmit = false;
|
|
alertMsg += "Your last name cannot be blank.\n";
|
|
}
|
|
|
|
if (txtPassword != txtConfirmPassword) {
|
|
doSubmit = false;
|
|
alertMsg += "Passwords do not match.\n";
|
|
}
|
|
|
|
if ((txtPassword.length > 0) && (txtPassword.length < 5)) {
|
|
doSubmit = false;
|
|
alertMsg += "Password needs to be 5 characters or longer.\n";
|
|
}
|
|
|
|
if (isNew) {
|
|
if (FieldIsEmpty(document.getElementById('Password').value)) {
|
|
doSubmit = false;
|
|
alertMsg += "Your password cannot be blank.\n";
|
|
}
|
|
|
|
if (!$('#HasAcceptedTerms').is(':checked')) {
|
|
doSubmit = false;
|
|
alertMsg += "You must agree to the policies, terms and conditions.\n";
|
|
}
|
|
}
|
|
|
|
if (alertMsg.length > 0) {
|
|
errString += alertMsg;
|
|
errString += "\n-----------------------------------------------------------------------\n";
|
|
errString += "Please correct them and re-submit.";
|
|
alert(errString)
|
|
}
|
|
|
|
if (doSubmit) {
|
|
if (isNew) {
|
|
performSignIn();
|
|
} else {
|
|
document.forms[0].submit();
|
|
}
|
|
}
|
|
}
|
|
|
|
function validateContact(idPrepend) {
|
|
var alertMessage = "";
|
|
|
|
if ($(idPrepend + 'FirstName').val() == '' || $(idPrepend + 'FirstName').val() == 'First Name') {
|
|
alertMessage += "Please enter a valid first name.\n";
|
|
}
|
|
|
|
if ($(idPrepend + 'LastName').val() == '' || $(idPrepend + 'LastName').val() == 'Last Name') {
|
|
alertMessage += "Please enter a valid last name.\n";
|
|
}
|
|
|
|
if ($(idPrepend + 'Address1').val() == '' || $(+'Address1').val() == 'Address') {
|
|
alertMessage += "Please enter a valid address.\n";
|
|
}
|
|
|
|
if ($(idPrepend + 'City').val() == '' || $(idPrepend + 'City').val() == 'City') {
|
|
alertMessage += "Please enter a valid city.\n";
|
|
}
|
|
|
|
if ($(idPrepend + 'State').val() == '' || $(idPrepend + 'State').val() == 'ST') {
|
|
alertMessage += "Please enter a valid " + getLowerCaseStateString() + ".\n";
|
|
} else if (!RegExValidate('^[A-Z]{2}$', $(idPrepend + 'State').val(), 'i') || !RegExValidate('^[a-z]{2}$', $(idPrepend + 'State').val(), 'i')) {
|
|
alertMessage += "Please enter a valid " + getLowerCaseStateString() + ".\n";
|
|
}
|
|
|
|
if ($(idPrepend + 'PostalCode').val() == '' || (!isZipCode($(idPrepend + 'PostalCode').val(), intCountryCode))) {
|
|
if (intCountryCode == 840)
|
|
alertMessage += "Please enter a valid US zip code.\n";
|
|
else if (intCountryCode == 124)
|
|
alertMessage += "Please enter a valid Canadian postal code.\n";
|
|
else
|
|
alertMessage += "Please enter a valid zip code.\n";
|
|
|
|
}
|
|
|
|
if ($(idPrepend + 'Phone').val() == '' || !phoneValidate($(idPrepend + 'Phone').val())) {
|
|
alertMessage += "Please enter a valid phone number.\n";
|
|
}
|
|
|
|
return alertMessage;
|
|
}
|
|
|
|
function validateRequiredProfile(alertMsgDetail) {
|
|
|
|
if (txtCompany != null) {
|
|
if (txtCompany.value == '') {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Your company name cannot be blank.\n";
|
|
}
|
|
}
|
|
if (txtAddress1.value == 'Address' || txtAddress1.value == '') {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter Contact address.\n";
|
|
}
|
|
if (txtCity.value == 'City' || txtCity.value == '') {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter City for contact address.\n";
|
|
}
|
|
if (txtState.value == 'ST' || txtState.value == '') {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter State for contact address.\n";
|
|
} else if (!RegExValidate('^[A-Z]{2}$', txtState.value, 'i') || !RegExValidate('^[a-z]{2}$', txtState.value, 'i')) {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter a valid State for contact address.\n";
|
|
}
|
|
if (txtZip.value == 'Zip' || txtZip.value == '') {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter Zip for contact address.\n";
|
|
} else if (!RegExValidate('^[0-9]{5}$', txtZip.value, 'i')) {
|
|
alertMsgDetail.doSubmit = false;
|
|
alertMsgDetail.alertMsg += "Please enter a valid Zip for contact address.\n";
|
|
}
|
|
|
|
}
|
|
|
|
//Get the contact list
|
|
function contactList(contactID) {
|
|
$.ajax({
|
|
url: '/MyAccount/ContactList?contactID=' + contactID,
|
|
type: 'GET',
|
|
success: function (data) {
|
|
if (data.RedirectURL)
|
|
window.location = data.RedirectURL;
|
|
else {
|
|
$('#addressesBlock').html(data);
|
|
$('.section.selfClear').css('display', 'block');
|
|
// some address blocks were not enhanced by Jquery.Mobile libraries so, solution
|
|
// seems to be triggering pagecreate event
|
|
$('#mainProfileCreate').trigger('pagecreate');
|
|
}
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('An error occurred');
|
|
},
|
|
beforeSend: function () {
|
|
ajaxPostBackStart('Loading');
|
|
},
|
|
complete: function () {
|
|
ajaxPostBackEnd();
|
|
}
|
|
});
|
|
}
|
|
|
|
//Removes a contact
|
|
function contactDelete(contactID) {
|
|
if (confirm('Are you sure you want to delete this address?')) {
|
|
$.ajax({
|
|
url: '/MyAccount/ContactDelete?contactID=' + contactID,
|
|
type: 'GET',
|
|
success: function (data) {
|
|
$('#addressesBlock').html(data);
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('The address could not be deleted.');
|
|
},
|
|
beforeSend: function () {
|
|
ajaxPostBackStart('Loading');
|
|
},
|
|
complete: function () {
|
|
ajaxPostBackEnd();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//Saves a contact
|
|
function contactSave(contactID, isMobileView, idPrepend, isEdit) {
|
|
|
|
isEdit = isEdit || false;
|
|
|
|
if (arguments.length == 1 && typeof isMobileView == 'undefined') {
|
|
isMobileView = false;
|
|
}
|
|
|
|
if (arguments.length >= 1 && arguments.length <= 2 && typeof idPrepend == 'undefined') {
|
|
|
|
idPrepend = "";
|
|
}
|
|
|
|
idPrepend = "#" + idPrepend;
|
|
|
|
var result = validateContact(idPrepend);
|
|
|
|
var firstName = $(idPrepend + 'FirstName');
|
|
var lastName = $(idPrepend + 'LastName');
|
|
var address1 = $(idPrepend + 'Address1');
|
|
var address2 = $(idPrepend + 'Address2');
|
|
var city = $(idPrepend + 'City');
|
|
var state = $(idPrepend + 'State');
|
|
var postalcode = $(idPrepend + 'PostalCode');
|
|
var phone = $(idPrepend + 'Phone');
|
|
|
|
var isDefault;
|
|
|
|
if (result == "") {
|
|
isDefault = firstName.parents('.address').find('.isDefault').is(':checked');
|
|
var token = $("#addressesBlock input[name='__RequestVerificationToken']").val();
|
|
$.ajax({
|
|
url: '/MyAccount/ContactSave',
|
|
contentType: 'application/x-www-form-urlencoded',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
data: {
|
|
__RequestVerificationToken: token,
|
|
ContactID: contactID,
|
|
FirstName: firstName.val(),
|
|
LastName: lastName.val(),
|
|
Address1: address1.val(),
|
|
Address2: address2.val(),
|
|
City: city.val(),
|
|
State: state.val(),
|
|
PostalCode: postalcode.val(),
|
|
Phone: phone.val(),
|
|
IsDefault: isDefault
|
|
},
|
|
success: function (data) {
|
|
if (data != null && data != undefined && data.RedirectURL) {
|
|
window.location = data.RedirectURL;
|
|
} else {
|
|
|
|
//var obj = jQuery.parseJSON(data);
|
|
if (data.Successful == false) {
|
|
|
|
alert(data.ErrorMessage);
|
|
return false;
|
|
|
|
} else {
|
|
|
|
contactList(0);
|
|
}
|
|
|
|
}
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('The address could not be saved.');
|
|
},
|
|
beforeSend: function () {
|
|
ajaxPostBackStart('Loading');
|
|
},
|
|
complete: function () {
|
|
ajaxPostBackEnd();
|
|
}
|
|
});
|
|
} else {
|
|
alert(result);
|
|
|
|
if (isMobileView) return false;
|
|
}
|
|
|
|
|
|
if (isMobileView && !isEdit) {
|
|
|
|
firstName.val("");
|
|
lastName.val("");
|
|
address1.val("");
|
|
address2.val("");
|
|
city.val("");
|
|
//state = ...
|
|
postalcode.val("");
|
|
phone.val("");
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
//Changes the default address on myaccount screen.
|
|
function changeDefaultContact(checkBox, contactID) {
|
|
if (contactID == 0) {
|
|
setDefaultContact(checkBox);
|
|
} else {
|
|
$.ajax({
|
|
url: '/MyAccount/ContactSetDefault?contactID=' + contactID,
|
|
type: 'GET',
|
|
success: function (data) {
|
|
setDefaultContact(checkBox);
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('The default address could not be changed.');
|
|
},
|
|
beforeSend: function () {
|
|
ajaxPostBackStart('Loading');
|
|
},
|
|
complete: function () {
|
|
ajaxPostBackEnd();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
//Changes the default address on myaccount screen.
|
|
function changeDefaultContactMobile(contactID) {
|
|
|
|
$.ajax({
|
|
url: '/MyAccount/ContactSetDefault?contactID=' + contactID,
|
|
type: 'GET',
|
|
success: function (data) {
|
|
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('The default address could not be changed.');
|
|
},
|
|
beforeSend: function () {
|
|
ajaxPostBackStart('Loading');
|
|
},
|
|
complete: function () {
|
|
ajaxPostBackEnd();
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function setDefaultContact(checkBox) {
|
|
var $addressBlock;
|
|
$('.address input[type=checkbox]').each(function () {
|
|
this.checked = false;
|
|
this.disabled = false;
|
|
});
|
|
|
|
checkBox.checked = true;
|
|
checkBox.disabled = true;
|
|
|
|
$('.address.active').removeClass('active');
|
|
$addressBlock = $(checkBox).parents('.address');
|
|
$addressBlock.addClass('active');
|
|
}
|
|
|
|
function recover(username) {
|
|
var responseFN = function (ajaxRequest) {
|
|
alert(ajaxRequest);
|
|
}
|
|
|
|
makeHttpRequestEx('/Services/ForgotPassword.ashx?Username=' +
|
|
encodeURIComponent(username) + '&set=admin', null, responseFN, false);
|
|
}
|
|
|
|
function SetPhotoMobile(photoType, createProfile) {
|
|
SetPhoto(photoType, createProfile);
|
|
}
|
|
|
|
|
|
function SetPhoto(photoType, createProfile) {
|
|
if (createProfile.toLowerCase() == 'true') {
|
|
$.post('/MyAccount/CreateProfilePhoto?photoType=' + photoType, function (response) {
|
|
$('.photo.fbPhoto').html(response);
|
|
switch (photoType) {
|
|
case 0:
|
|
$('#SetRemovePhoto').val('False');
|
|
break;
|
|
case 1:
|
|
$('#SetRemovePhoto').val('False');
|
|
break;
|
|
case 2:
|
|
$('#SetRemovePhoto').val('True');
|
|
break;
|
|
}
|
|
});
|
|
} else {
|
|
$.post('/MyAccount/ProfilePhoto?photoType=' + photoType, function (response) {
|
|
if (response.RedirectURL)
|
|
window.location.href = response.RedirectURL;
|
|
else {
|
|
$('.photo.fbPhoto').html(response);
|
|
switch (photoType) {
|
|
case 0:
|
|
$('#SetRemovePhoto').val('False');
|
|
break;
|
|
case 1:
|
|
$('#SetRemovePhoto').val('False');
|
|
break;
|
|
case 2:
|
|
$('#SetRemovePhoto').val('True');
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function HasAcceptedTerms(url) {
|
|
|
|
var result = {
|
|
status: 1,
|
|
HasAcceptedTerms: true
|
|
};
|
|
if ($('#HasAcceptedTerms').is(':checked')) {
|
|
return result;
|
|
}
|
|
|
|
$.ajax({
|
|
url: location.origin + url,
|
|
type: 'POST',
|
|
async: false,
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
result = data;
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
result = {
|
|
status: 0,
|
|
msg: 'Error encountered while checking terms acceptance.'
|
|
};
|
|
}
|
|
});
|
|
|
|
return result;
|
|
}
|
|
|
|
function openCpModalMobile(options) {
|
|
|
|
var msg;
|
|
var title = options.title;
|
|
|
|
$.ajax({
|
|
url: options.url,
|
|
type: 'GET',
|
|
async: false,
|
|
cache: false,
|
|
success: function (result) {
|
|
msg = result;
|
|
},
|
|
error: function (xhr, textStatus, exception) {
|
|
alert('Error encountered while loading modal.');
|
|
}
|
|
});
|
|
|
|
$('#popupBasic .header').html(title);
|
|
$('#popupBasic .content').html(msg);
|
|
$("#popupBasic").popup('open', {
|
|
positionTo: 'window',
|
|
overlayTheme: 'a'
|
|
});
|
|
}
|
|
|
|
function ShowTerms(onAccept) {
|
|
|
|
if ($('#IsMobile').val() == 'True') {
|
|
|
|
openCpModalMobile({
|
|
title: 'Our Terms Have Changed',
|
|
className: 'legalUpdate',
|
|
isFrontEnd: true,
|
|
url: '/MyAccount/Terms'
|
|
});
|
|
|
|
$('.legalUpdate .button.accept').click(onAccept);
|
|
$('.legalUpdate .button.cancel').click(DoNotAcceptMobile);
|
|
|
|
} else {
|
|
|
|
openCpModal({
|
|
title: 'Our Privacy Policy/Terms and Conditions Have Changed',
|
|
className: 'legalUpdate',
|
|
isFrontEnd: true,
|
|
url: '/MyAccount/Terms'
|
|
});
|
|
|
|
$('.legalUpdate .button.accept').click(onAccept);
|
|
$('.legalUpdate .modalClose').click(DoNotAccept);
|
|
}
|
|
}
|
|
|
|
|
|
function DoNotAccept() {
|
|
$('#login-fb-waiting-text').hide();
|
|
$('#login-fb-waiting').hide();
|
|
$('.loginBox').show();
|
|
$('.fb-login').show();
|
|
fb_busy = false;
|
|
closeCpModal();
|
|
|
|
return false;
|
|
}
|
|
|
|
function DoNotAcceptMobile() {
|
|
|
|
window.location = '/MyAccount';
|
|
|
|
}
|
|
|
|
// Returns TRUE if the password and confirm password field match.
|
|
function passwordFieldsMatch() {
|
|
// NOTE: e_5 and e_6 are hard-coded IDs
|
|
var passwordField = $('#e_5');
|
|
var confirmPasswordField = $('#e_6');
|
|
return passwordField.val() == confirmPasswordField.val();
|
|
};
|
|
/*
|
|
http://www.JSON.org/json2.js
|
|
2011-02-23
|
|
|
|
Public Domain.
|
|
|
|
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
|
|
|
See http://www.JSON.org/js.html
|
|
|
|
|
|
This code should be minified before deployment.
|
|
See http://javascript.crockford.com/jsmin.html
|
|
|
|
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
|
NOT CONTROL.
|
|
|
|
|
|
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. It can be a
|
|
function or an array of strings.
|
|
|
|
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 value
|
|
|
|
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 of strings, 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
|
|
the 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.
|
|
*/
|
|
|
|
/*jslint evil: true, strict: false, regexp: false */
|
|
|
|
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
|
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
|
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
|
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
|
test, toJSON, toString, valueOf
|
|
*/
|
|
|
|
|
|
// Create a JSON object only if one does not already exist. We create the
|
|
// methods in a closure to avoid creating global variables.
|
|
|
|
var JSON;
|
|
if (!JSON) {
|
|
JSON = {};
|
|
}
|
|
|
|
(function () {
|
|
"use strict";
|
|
|
|
function f(n) {
|
|
// Format integers to have at least two digits.
|
|
return n < 10 ? '0' + n : n;
|
|
}
|
|
|
|
if (typeof Date.prototype.toJSON !== 'function') {
|
|
|
|
Date.prototype.toJSON = function (key) {
|
|
|
|
return isFinite(this.valueOf()) ?
|
|
this.getUTCFullYear() + '-' +
|
|
f(this.getUTCMonth() + 1) + '-' +
|
|
f(this.getUTCDate()) + 'T' +
|
|
f(this.getUTCHours()) + ':' +
|
|
f(this.getUTCMinutes()) + ':' +
|
|
f(this.getUTCSeconds()) + 'Z' : null;
|
|
};
|
|
|
|
String.prototype.toJSON =
|
|
Number.prototype.toJSON =
|
|
Boolean.prototype.toJSON = function (key) {
|
|
return this.valueOf();
|
|
};
|
|
}
|
|
|
|
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
|
escapable = /[\\\"\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.
|
|
|
|
escapable.lastIndex = 0;
|
|
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
|
var c = meta[a];
|
|
return typeof c === 'string' ? c :
|
|
'\\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 = [];
|
|
|
|
// Is the value an array?
|
|
|
|
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
|
|
|
// The value 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) {
|
|
if (typeof rep[i] === 'string') {
|
|
k = rep[i];
|
|
v = str(k, value);
|
|
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.prototype.hasOwnProperty.call(value, k)) {
|
|
v = str(k, value);
|
|
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;
|
|
}
|
|
}
|
|
|
|
// If the JSON object does not yet have a stringify method, give it one.
|
|
|
|
if (typeof JSON.stringify !== 'function') {
|
|
JSON.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});
|
|
};
|
|
}
|
|
|
|
|
|
// If the JSON object does not yet have a parse method, give it one.
|
|
|
|
if (typeof JSON.parse !== 'function') {
|
|
JSON.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.prototype.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.
|
|
|
|
text = String(text);
|
|
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 the JSON 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(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/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');
|
|
};
|
|
}
|
|
}());
|
|
;
|
|
/*! jQuery UI - v1.10.4 - 2014-01-17
|
|
* http://jqueryui.com
|
|
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);
|
|
/*! jQuery UI - v1.10.4 - 2014-01-17
|
|
* http://jqueryui.com
|
|
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix||i:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),1===arguments.length)return a[i]===t?null:a[i];a[i]=s}else{if(1===arguments.length)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery);
|
|
/*! jQuery UI - v1.10.4 - 2014-01-17
|
|
* http://jqueryui.com
|
|
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);
|
|
/*! jQuery UI - v1.10.4 - 2014-01-17
|
|
* http://jqueryui.com
|
|
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-e(document).scrollTop()<s.scrollSensitivity?n=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(n=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-e(document).scrollLeft()<s.scrollSensitivity?n=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(n=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),s=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(t,i){var s,n,a,o,r,h,l,u,c,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,y=i.offset.top,b=y+p.helperProportions.height;for(c=p.snapElements.length-1;c>=0;c--)r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>b||y>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+s.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex)}})})(jQuery);
|
|
/*! jQuery UI - v1.10.4 - 2014-01-17
|
|
* http://jqueryui.com
|
|
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],undefined):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},e.ui.ddmanager.droppables[i.scope]=e.ui.ddmanager.droppables[i.scope]||[],e.ui.ddmanager.droppables[i.scope].push(this),i.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,i,s){if(!i.offset)return!1;var n,a,o=(e.positionAbs||e.position.absolute).left,r=(e.positionAbs||e.position.absolute).top,h=o+e.helperProportions.width,l=r+e.helperProportions.height,u=i.offset.left,c=i.offset.top,d=u+i.proportions().width,p=c+i.proportions().height;switch(s){case"fit":return o>=u&&d>=h&&r>=c&&p>=l;case"intersect":return o+e.helperProportions.width/2>u&&d>h-e.helperProportions.width/2&&r+e.helperProportions.height/2>c&&p>l-e.helperProportions.height/2;case"pointer":return n=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,c,i.proportions().height)&&t(n,u,i.proportions().width);case"touch":return(r>=c&&p>=r||l>=c&&p>=l||c>r&&l>p)&&(o>=u&&d>=o||h>=u&&d>=h||u>o&&h>d);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===n}),a.length&&(s=e.data(a[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}})(jQuery);
|
|
window.pageHandleResponsive = true;
|
|
|
|
$.when(window.Pages.rwdReady).done(function () {
|
|
var $sidebar = $('div.sidebar');
|
|
var $mainContent = $('div.contentMain');
|
|
|
|
toggleClassMedia('minWidth550px', '.contentMain:media(this-min-width: 550px)');
|
|
toggleClassMedia('minWidth500px', '.contentMain:media(this-min-width: 500px)');
|
|
toggleClassMedia('minWidth470px', '.contentMain:media(this-min-width: 470px)');
|
|
toggleClassMedia('maxWidth470px', '.contentMain:media(this-max-width: 470px)');
|
|
toggleClassMedia('minWidth400px', '.contentMain:media(this-min-width: 400px)');
|
|
cpMedia.register('.moduleContentNew:media(this-min-width: 590px)', {
|
|
setup: function () {
|
|
$mainContent.after($sidebar);
|
|
},
|
|
match: function (e, element) {
|
|
$mainContent.before($sidebar);
|
|
$(element).addClass('minWidth590px');
|
|
},
|
|
unmatch: function (e, element) {
|
|
$mainContent.after($sidebar);
|
|
$(element).removeClass('minWidth590px');
|
|
}
|
|
});
|
|
|
|
});
|
|
|