Implement RFC-7 JavaScript module loader

- Adds ES6 support via Babel
- Transforms existing JavaScript to UMD modules
- Adds module bundling via Browserify
- Existing JavaScript converted to UMD modules
- lib.js and leftandmain.js are bundled using browserify
- JavaScript minifying of bundles handed by gulp
This commit is contained in:
David Craig 2016-01-11 14:25:30 +13:00 committed by Damian Mooyman
parent e74665b639
commit 2140025c20
167 changed files with 13593 additions and 1783 deletions

4
.gitattributes vendored
View File

@ -1 +1,3 @@
docs/ export-ignore
admin/javascript/src/ export-ignore
docs/ export-ignore
javascript/src/ export ignore

View File

@ -308,23 +308,18 @@ class LeftAndMain extends Controller implements PermissionProvider {
$htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
}
// Using uncompressed files as they'll be processed by JSMin in the Requirements class.
// Not as effective as other compressors or pre-compressed+finetuned files,
// but overall the unified minification into a single file brings more performance benefits
// than a couple of saved bytes (after gzip) in individual files.
// We also re-compress already compressed files through JSMin as this causes weird runtime bugs.
Requirements::combine_files(
'lib.js',
array(
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-lib.js', [
'provides' => [
THIRDPARTY_DIR . '/jquery/jquery.js',
FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js',
FRAMEWORK_ADMIN_DIR . '/javascript/lib.js',
THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js',
THIRDPARTY_DIR . '/json-js/json2.js',
THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js',
THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js',
THIRDPARTY_DIR . '/jquery-query/jquery.query.js',
THIRDPARTY_DIR . '/jquery-form/jquery.form.js',
THIRDPARTY_DIR . '/jquery-ondemand/jquery.ondemand.js',
THIRDPARTY_DIR . '/jquery-changetracker/lib/jquery.changetracker.js',
THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js',
@ -332,51 +327,48 @@ class LeftAndMain extends Controller implements PermissionProvider {
FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js',
THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js',
FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js',
FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js',
FRAMEWORK_DIR . '/javascript/i18n.js',
FRAMEWORK_DIR . '/javascript/TreeDropdownField.js',
FRAMEWORK_DIR . '/javascript/DateField.js',
FRAMEWORK_DIR . '/javascript/HtmlEditorField.js',
FRAMEWORK_DIR . '/javascript/TabSet.js',
FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js',
FRAMEWORK_DIR . '/javascript/GridField.js',
)
);
FRAMEWORK_DIR . '/javascript/dist/TreeDropdownField.js',
FRAMEWORK_DIR . '/javascript/dist/DateField.js',
FRAMEWORK_DIR . '/javascript/dist/HtmlEditorField.js',
FRAMEWORK_DIR . '/javascript/dist/TabSet.js',
FRAMEWORK_DIR . '/javascript/dist/GridField.js',
FRAMEWORK_DIR . '/javascript/dist/i18n.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/sspath.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js',
]
]);
if (Director::isDev()) Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/leaktools.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/bundle-leftandmain.js', [
'provides' => [
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Layout.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.ActionTabSet.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Panel.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Tree.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Content.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.EditForm.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Menu.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Preview.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.BatchActions.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldHelp.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.FieldDescriptionToggle.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.TreeDropdownField.js'
]
]);
$leftAndMainIncludes = array_unique(array_merge(
array(
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldDescriptionToggle.js',
FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
),
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true),
Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)
));
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true);
Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true);
if($this->config()->session_keepalive_ping) {
$leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js';
if ($this->config()->session_keepalive_ping) {
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/LeftAndMain.Ping.js');
}
Requirements::combine_files('leftandmain.js', $leftAndMainIncludes);
// TODO Confuses jQuery.ondemand through document.write()
if (Director::isDev()) {
// TODO Confuses jQuery.ondemand through document.write()
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/leaktools.js');
}
Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
@ -1765,7 +1757,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
/**
* Register the given javascript file as required in the CMS.
* Filenames should be relative to the base, eg, FRAMEWORK_DIR . '/javascript/loader.js'
* Filenames should be relative to the base, eg, FRAMEWORK_DIR . '/javascript/dist/loader.js'
*
* @deprecated since version 4.0
*/

View File

@ -63,7 +63,7 @@ class MemberImportForm extends Form {
parent::__construct($controller, $name, $fields, $actions, $validator);
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js');
$this->addExtraClass('cms');
$this->addExtraClass('import-form');

View File

@ -110,7 +110,7 @@ abstract class ModelAdmin extends LeftAndMain {
user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
}
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ModelAdmin.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/ModelAdmin.js');
}
public function Link($action = null) {

View File

@ -31,7 +31,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
public function init() {
parent::init();
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/SecurityAdmin.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/SecurityAdmin.js');
}
/**
@ -202,10 +202,8 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
Requirements::clear();
Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/MemberImportForm.css');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js');
return $this->renderWith('BlankPage', array(
'Form' => $this->MemberImportForm()->forTemplate(),
'Content' => ' '
@ -234,10 +232,8 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
Requirements::clear();
Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/MemberImportForm.css');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberImportForm.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberImportForm.js');
return $this->renderWith('BlankPage', array(
'Content' => ' ',
'Form' => $this->GroupImportForm()->forTemplate()

View File

@ -1,23 +0,0 @@
jQuery.noConflict();
/**
* File: LeftAndMain.js
*/
(function($) {
// setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
$.entwine('ss', function($) {
// Make all buttons "hoverable" with jQuery theming.
$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({
onadd: function() {
this.addClass('ss-ui-button');
if(!this.data('button')) this.button();
this._super();
},
onremove: function() {
if(this.data('button')) this.button('destroy');
this._super();
}
});
});
}(jQuery));

View File

@ -1,239 +0,0 @@
/**
* File: LeftAndMain.ActionTabset.js
*
* Contains rules for .ss-ui-action-tabset, used for:
* * Site tree action tabs (to perform actions on the site tree)
* * Actions menu (Edit page actions)
*
*/
(function($){
$.entwine('ss', function($) {
/**
* Generic rules for all ss-ui-action-tabsets
* * ActionMenus
* * SiteTree ActionTabs
*/
$('.ss-tabset.ss-ui-action-tabset').entwine({
// Ignore tab state so it will not be reopened on form submission.
IgnoreTabState: true,
onadd: function() {
// Make sure the .ss-tabset is already initialised to apply our modifications on top.
this._super();
//Set actionTabs to allow closing and be closed by default
this.tabs({'collapsible': true, 'active': false});
},
onremove: function() {
// Remove all bound events.
// This guards against an edge case where the click handlers are not unbound
// because the panel is still open when the ajax edit form reloads.
var frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset');
});
$(document).off('click.ss-ui-action-tabset');
this._super();
},
/**
* Deal with available vertical space
*/
'ontabsbeforeactivate': function(event, ui) {
this.riseUp(event, ui);
},
/**
* Handle opening and closing tabs
*/
onclick: function(event, ui) {
this.attachCloseHandler(event, ui);
},
/**
* Generic function to close open tabs. Stores event in a handler,
* and removes the bound event once activated.
*
* Note: Should be called by a click event attached to 'this'
*/
attachCloseHandler: function(event, ui) {
var that = this, frame = $('.cms-container').find('iframe'), closeHandler;
// Create a handler for the click event so we can close tabs
// and easily remove the event once done
closeHandler = function(event) {
var panel, frame;
panel = $(event.target).closest('.ss-ui-action-tabset .ui-tabs-panel');
// If anything except the ui-nav button or panel is clicked,
// close panel and remove handler. We can't close if click was
// within panel, as it might've caused a button action,
// and we need to show its loading indicator.
if (!$(event.target).closest(that).length && !panel.length) {
that.tabs('option', 'active', false); // close tabs
// remove click event from objects it is bound to (iframe's and document)
frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset', closeHandler);
});
$(document).off('click.ss-ui-action-tabset', closeHandler);
}
};
// Bind click event to document, and use closeHandler to handle the event
$(document).on('click.ss-ui-action-tabset', closeHandler);
// Make sure iframe click also closes tab
// iframe needs a special case, else the click event will not register here
if(frame.length > 0){
frame.each(function(index, iframe) {
$(iframe).contents().on('click.ss-ui-action-tabset', closeHandler);
});
}
},
/**
* Function riseUp checks to see if a tab should be opened upwards
* (based on space concerns). If true, the rise-up class is applied
* and a new position is calculated and applied to the element.
*
* Note: Should be called by a tabsbeforeactivate event
*/
riseUp: function(event, ui) {
var elHeight, trigger, endOfWindow, elPos, activePanel, activeTab, topPosition, containerSouth, padding;
// Get the numbers needed to calculate positions
elHeight = $(this).find('.ui-tabs-panel').outerHeight();
trigger = $(this).find('.ui-tabs-nav').outerHeight();
endOfWindow = ($(window).height() + $(document).scrollTop()) - trigger;
elPos = $(this).find('.ui-tabs-nav').offset().top;
activePanel = ui.newPanel;
activeTab = ui.newTab;
if (elPos + elHeight >= endOfWindow && elPos - elHeight > 0){
this.addClass('rise-up');
if (activeTab.position() !== null){
topPosition = -activePanel.outerHeight();
containerSouth = activePanel.parents('.south');
if (containerSouth){
// If container is the southern panel, make tab appear from the top of the container
padding = activeTab.offset().top - containerSouth.offset().top;
topPosition = topPosition-padding;
}
$(activePanel).css('top',topPosition+"px");
}
} else {
// else remove the rise-up class and set top to 0
this.removeClass('rise-up');
if (activeTab.position() !== null){
$(activePanel).css('top','0px');
}
}
return false;
}
});
/**
* ActionMenus
* * Specific rules for ActionMenus, used for edit page actions
*/
$('.cms-content-actions .ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
//Set the position of the opening tab (if it exists)
if($(ui.newPanel).length > 0){
$(ui.newPanel).css('left', ui.newTab.position().left+"px");
}
}
});
/**
* SiteTree ActionTabs
* Specific rules for site tree action tabs. Applies to tabs
* within the expanded content area, and within the sidebar
*/
$('.cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
// Remove tabset open classes (Last gets a unique class
// in the bigger sitetree. Remove this if we have it)
$(this).closest('.ss-ui-action-tabset')
.removeClass('tabset-open tabset-open-last');
}
});
/**
* SiteTree ActionTabs: expanded
* * Specific rules for siteTree actions within the expanded content area.
*/
$('.cms-content-fields .ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
if($( ui.newPanel).length > 0){
if($(ui.newTab).hasClass("last")){
// Align open tab to the right (because opened tab is last)
$(ui.newPanel).css({'left': 'auto', 'right': '0px'});
// Last needs to be styled differently when open, so apply a unique class
$(ui.newPanel).parent().addClass('tabset-open-last');
}else{
// Assign position to tabpanel based on position of relivent active tab item
$(ui.newPanel).css('left', ui.newTab.position().left+"px");
// If this is the first tab, make sure the position doesn't include border
// (hard set position to 0 ), and add the tab-set open class
if($(ui.newTab).hasClass("first")){
$(ui.newPanel).css('left',"0px");
$(ui.newPanel).parent().addClass('tabset-open');
}
}
}
}
});
/**
* SiteTree ActionTabs: sidebar
* * Specific rules for when the site tree actions panel appears in
* * the side-bar
*/
$('.cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({
// If actions panel is within the sidebar, apply active class
// to help animate open/close on hover
'from .ui-tabs-nav li': {
onhover: function(e) {
$(e.target).parent().find('li .active').removeClass('active');
$(e.target).find('a').addClass('active');
}
},
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
// Reset position of tabs, else anyone going between the large
// and the small sitetree will see broken tabs
// Apply styles with .css, to avoid overriding currently applied styles
$(ui.newPanel).css({'left': 'auto', 'right': 'auto'});
if($(ui.newPanel).length > 0){
$(ui.newPanel).parent().addClass('tabset-open');
}
}
});
});
}(jQuery));

View File

@ -1,44 +0,0 @@
/**
* Enable toggling (show/hide) of the field's description.
*/
(function ($) {
$.entwine('ss', function ($) {
$('.cms-description-toggle').entwine({
onadd: function () {
var shown = false, // Current state of the description.
fieldId = this.prop('id').substr(0, this.prop('id').indexOf('_Holder')),
$trigger = this.find('.cms-description-trigger'), // Click target for toggling the description.
$description = this.find('.description');
// Prevent multiple events being added.
if (this.hasClass('description-toggle-enabled')) {
return;
}
// If a custom trigger han't been supplied use a sensible default.
if ($trigger.length === 0) {
$trigger = this
.find('.middleColumn')
.first() // Get the first middleColumn so we don't add multiple triggers on composite field types.
.after('<label class="right" for="' + fieldId + '"><a class="cms-description-trigger" href="javascript:void(0)"><span class="btn-icon-information"></span></a></label>')
.next();
}
this.addClass('description-toggle-enabled');
// Toggle next description when button is clicked.
$trigger.on('click', function() {
$description[shown ? 'hide' : 'show']();
shown = !shown;
});
// Hide next description by default.
$description.hide();
}
});
});
})(jQuery);

View File

@ -1,37 +0,0 @@
(function($) {
$.entwine('ss', function($) {
/**
* Converts an inline field description into a tooltip
* which is shown on hover over any part of the field container,
* as well as when focusing into an input element within the field container.
*
* Note that some fields don't have distinct focusable
* input fields (e.g. GridField), and aren't compatible
* with showing tooltips.
*/
$(".cms .field.cms-description-tooltip").entwine({
onmatch: function() {
this._super();
var descriptionEl = this.find('.description'), inputEl, tooltipEl;
if(descriptionEl.length) {
this
// TODO Remove title setting, shouldn't be necessary
.attr('title', descriptionEl.text())
.tooltip({content: descriptionEl.html()});
descriptionEl.remove();
}
},
});
$(".cms .field.cms-description-tooltip :input").entwine({
onfocusin: function(e) {
this.closest('.field').tooltip('open');
},
onfocusout: function(e) {
this.closest('.field').tooltip('close');
}
});
});
}(jQuery));

View File

@ -1,17 +0,0 @@
(function($) {
$.entwine('ss', function($){
// Any TreeDowndownField needs to refresh it's contents after a form submission,
// because the tree on the backend might have changed
$('.TreeDropdownField').entwine({
'from .cms-container form': {
onaftersubmitform: function(e){
this.find('.tree-holder').empty();
this._super();
}
}
});
});
})(jQuery);

43
admin/javascript/dist/CMSSecurity.js vendored Normal file
View File

@ -0,0 +1,43 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.CMSSecurity', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssCMSSecurity = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.noConflict();
_jQuery2.default.entwine.warningLevel = _jQuery2.default.entwine.WARN_LEVEL_BESTPRACTISE;
_jQuery2.default.entwine('ss', function ($) {
$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({
onadd: function onadd() {
this.addClass('ss-ui-button');
if (!this.data('button')) this.button();
this._super();
},
onremove: function onremove() {
if (this.data('button')) this.button('destroy');
this._super();
}
});
});
});

View File

@ -0,0 +1,54 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.LeftAndMain.Ping', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssLeftAndMainPing = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss.ping', function ($) {
$('.cms-container').entwine({
PingIntervalSeconds: 5 * 60,
onadd: function onadd() {
this._setupPinging();
this._super();
},
_setupPinging: function _setupPinging() {
var onSessionLost = function onSessionLost(xmlhttp, status) {
if (xmlhttp.status > 400 || xmlhttp.responseText == 0) {
if (window.open('Security/login')) {
alert('Please log in and then try again');
} else {
alert('Please enable pop-ups for this site');
}
}
};
setInterval(function () {
$.ajax({
url: 'Security/ping',
global: false,
type: 'POST',
complete: onSessionLost
});
}, this.getPingIntervalSeconds() * 1000);
}
});
});
});

1103
admin/javascript/dist/LeftAndMain.js vendored Normal file
View File

@ -0,0 +1,1103 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.LeftAndMain', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssLeftAndMain = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
_jQuery2.default.noConflict();
window.ss = window.ss || {};
var windowWidth, windowHeight;
window.ss.debounce = function (func, wait, immediate) {
var timeout, context, args;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
return function () {
var callNow = immediate && !timeout;
context = this;
args = arguments;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
};
(0, _jQuery2.default)(window).bind('resize.leftandmain', function (e) {
var cb = function cb() {
(0, _jQuery2.default)('.cms-container').trigger('windowresize');
};
if (_jQuery2.default.browser.msie && parseInt(_jQuery2.default.browser.version, 10) < 9) {
var newWindowWidth = (0, _jQuery2.default)(window).width(),
newWindowHeight = (0, _jQuery2.default)(window).height();
if (newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
_jQuery2.default.entwine.warningLevel = _jQuery2.default.entwine.WARN_LEVEL_BESTPRACTISE;
_jQuery2.default.entwine('ss', function ($) {
$(window).on("message", function (e) {
var target,
event = e.originalEvent,
data = _typeof(event.data) === 'object' ? event.data : JSON.parse(event.data);
if ($.path.parseUrl(window.location.href).domain !== $.path.parseUrl(event.origin).domain) return;
target = typeof data.target === 'undefined' ? $(window) : $(data.target);
switch (data.type) {
case 'event':
target.trigger(data.event, data.data);
break;
case 'callback':
target[data.callback].call(target, data.data);
break;
}
});
var positionLoadingSpinner = function positionLoadingSpinner() {
var offset = 120;
var spinner = $('.ss-loading-screen .loading-animation');
var top = ($(window).height() - spinner.height()) / 2;
spinner.css('top', top + offset);
spinner.show();
};
var applyChosen = function applyChosen(el) {
if (el.is(':visible')) {
el.addClass('has-chzn').chosen({
allow_single_deselect: true,
disable_search_threshold: 20
});
var title = el.prop('title');
if (title) {
el.siblings('.chzn-container').prop('title', title);
}
} else {
setTimeout(function () {
el.show();
applyChosen(el);
}, 500);
}
};
var isSameUrl = function isSameUrl(url1, url2) {
var baseUrl = $('base').attr('href');
url1 = $.path.isAbsoluteUrl(url1) ? url1 : $.path.makeUrlAbsolute(url1, baseUrl), url2 = $.path.isAbsoluteUrl(url2) ? url2 : $.path.makeUrlAbsolute(url2, baseUrl);
var url1parts = $.path.parseUrl(url1),
url2parts = $.path.parseUrl(url2);
return url1parts.pathname.replace(/\/*$/, '') == url2parts.pathname.replace(/\/*$/, '') && url1parts.search == url2parts.search;
};
var ajaxCompleteEvent = window.ss.debounce(function () {
$(window).trigger('ajaxComplete');
}, 1000, true);
$(window).bind('resize', positionLoadingSpinner).trigger('resize');
$(document).ajaxComplete(function (e, xhr, settings) {
if (window.History.enabled) {
var url = xhr.getResponseHeader('X-ControllerURL'),
origUrl = History.getPageUrl().replace(/\/$/, ''),
destUrl = settings.url,
opts;
if (url !== null && (!isSameUrl(origUrl, url) || !isSameUrl(destUrl, url))) {
opts = {
id: new Date().getTime() + String(Math.random()).replace(/\D/g, ''),
pjax: xhr.getResponseHeader('X-Pjax') ? xhr.getResponseHeader('X-Pjax') : settings.headers['X-Pjax']
};
window.History.pushState(opts, '', url);
}
}
var msg = xhr.getResponseHeader('X-Status') ? xhr.getResponseHeader('X-Status') : xhr.statusText,
reathenticate = xhr.getResponseHeader('X-Reauthenticate'),
msgType = xhr.status < 200 || xhr.status > 399 ? 'bad' : 'good',
ignoredMessages = ['OK'];
if (reathenticate) {
$('.cms-container').showLoginDialog();
return;
}
if (xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) {
statusMessage(decodeURIComponent(msg), msgType);
}
ajaxCompleteEvent(this);
});
$('.cms-container').entwine({
StateChangeXHR: null,
FragmentXHR: {},
StateChangeCount: 0,
LayoutOptions: {
minContentWidth: 940,
minPreviewWidth: 400,
mode: 'content'
},
onadd: function onadd() {
var self = this;
if ($.browser.msie && parseInt($.browser.version, 10) < 8) {
$('.ss-loading-screen').append('<p class="ss-loading-incompat-warning"><span class="notice">' + 'Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.' + '</span></p>').css('z-index', $('.ss-loading-screen').css('z-index') + 1);
$('.loading-animation').remove();
this._super();
return;
}
this.redraw();
$('.ss-loading-screen').hide();
$('body').removeClass('loading');
$(window).unbind('resize', positionLoadingSpinner);
this.restoreTabState();
this._super();
},
fromWindow: {
onstatechange: function onstatechange(e) {
this.handleStateChange(e);
}
},
'onwindowresize': function onwindowresize() {
this.redraw();
},
'from .cms-panel': {
ontoggle: function ontoggle() {
this.redraw();
}
},
'from .cms-container': {
onaftersubmitform: function onaftersubmitform() {
this.redraw();
}
},
'from .cms-menu-list li a': {
onclick: function onclick(e) {
var href = $(e.target).attr('href');
if (e.which > 1 || href == this._tabStateUrl()) return;
this.splitViewMode();
}
},
updateLayoutOptions: function updateLayoutOptions(newSpec) {
var spec = this.getLayoutOptions();
var dirty = false;
for (var k in newSpec) {
if (spec[k] !== newSpec[k]) {
spec[k] = newSpec[k];
dirty = true;
}
}
if (dirty) this.redraw();
},
splitViewMode: function splitViewMode() {
this.updateLayoutOptions({
mode: 'split'
});
},
contentViewMode: function contentViewMode() {
this.updateLayoutOptions({
mode: 'content'
});
},
previewMode: function previewMode() {
this.updateLayoutOptions({
mode: 'preview'
});
},
RedrawSuppression: false,
redraw: function redraw() {
if (this.getRedrawSuppression()) return;
if (window.debug) console.log('redraw', this.attr('class'), this.get(0));
this.data('jlayout', jLayout.threeColumnCompressor({
menu: this.children('.cms-menu'),
content: this.children('.cms-content'),
preview: this.children('.cms-preview')
}, this.getLayoutOptions()));
this.layout();
this.find('.cms-panel-layout').redraw();
this.find('.cms-content-fields[data-layout-type]').redraw();
this.find('.cms-edit-form[data-layout-type]').redraw();
this.find('.cms-preview').redraw();
this.find('.cms-content').redraw();
},
checkCanNavigate: function checkCanNavigate(selectors) {
var contentEls = this._findFragments(selectors || ['Content']),
trackedEls = contentEls.find(':data(changetracker)').add(contentEls.filter(':data(changetracker)')),
safe = true;
if (!trackedEls.length) {
return true;
}
trackedEls.each(function () {
if (!$(this).confirmUnsavedChanges()) {
safe = false;
}
});
return safe;
},
loadPanel: function loadPanel(url, title, data, forceReload, forceReferer) {
if (!data) data = {};
if (!title) title = "";
if (!forceReferer) forceReferer = History.getState().url;
if (!this.checkCanNavigate(data.pjax ? data.pjax.split(',') : ['Content'])) {
return;
}
this.saveTabState();
if (window.History.enabled) {
$.extend(data, {
__forceReferer: forceReferer
});
if (forceReload) {
$.extend(data, {
__forceReload: Math.random()
});
window.History.replaceState(data, title, url);
} else {
window.History.pushState(data, title, url);
}
} else {
window.location = $.path.makeUrlAbsolute(url, $('base').attr('href'));
}
},
reloadCurrentPanel: function reloadCurrentPanel() {
this.loadPanel(window.History.getState().url, null, null, true);
},
submitForm: function submitForm(form, button, callback, ajaxOptions) {
var self = this;
if (!button) button = this.find('.Actions :submit[name=action_save]');
if (!button) button = this.find('.Actions :submit:first');
form.trigger('beforesubmitform');
this.trigger('submitform', {
form: form,
button: button
});
$(button).addClass('loading');
var validationResult = form.validate();
if (typeof validationResult !== 'undefined' && !validationResult) {
statusMessage("Validation failed.", "bad");
$(button).removeClass('loading');
return false;
}
var formData = form.serializeArray();
formData.push({
name: $(button).attr('name'),
value: '1'
});
formData.push({
name: 'BackURL',
value: History.getPageUrl().replace(/\/$/, '')
});
this.saveTabState();
jQuery.ajax(jQuery.extend({
headers: {
"X-Pjax": "CurrentForm,Breadcrumbs"
},
url: form.attr('action'),
data: formData,
type: 'POST',
complete: function complete() {
$(button).removeClass('loading');
},
success: function success(data, status, xhr) {
form.removeClass('changed');
if (callback) callback(data, status, xhr);
var newContentEls = self.handleAjaxResponse(data, status, xhr);
if (!newContentEls) return;
newContentEls.filter('form').trigger('aftersubmitform', {
status: status,
xhr: xhr,
formData: formData
});
}
}, ajaxOptions));
return false;
},
LastState: null,
PauseState: false,
handleStateChange: function handleStateChange() {
if (this.getPauseState()) {
return;
}
if (this.getStateChangeXHR()) this.getStateChangeXHR().abort();
var self = this,
h = window.History,
state = h.getState(),
fragments = state.data.pjax || 'Content',
headers = {},
fragmentsArr = fragments.split(','),
contentEls = this._findFragments(fragmentsArr);
this.setStateChangeCount(this.getStateChangeCount() + 1);
var isLegacyIE = $.browser.msie && parseInt($.browser.version, 10) < 9;
if (isLegacyIE && this.getStateChangeCount() > 20) {
document.location.href = state.url;
return;
}
if (!this.checkCanNavigate()) {
if (h.emulated.pushState) {
return;
}
var lastState = this.getLastState();
this.setPauseState(true);
if (lastState) {
h.pushState(lastState.id, lastState.title, lastState.url);
} else {
h.back();
}
this.setPauseState(false);
return;
}
this.setLastState(state);
if (contentEls.length < fragmentsArr.length) {
fragments = 'Content', fragmentsArr = ['Content'];
contentEls = this._findFragments(fragmentsArr);
}
this.trigger('beforestatechange', {
state: state,
element: contentEls
});
headers['X-Pjax'] = fragments;
if (typeof state.data.__forceReferer !== 'undefined') {
var url = state.data.__forceReferer;
try {
url = decodeURI(url);
} catch (e) {} finally {
headers['X-Backurl'] = encodeURI(url);
}
}
contentEls.addClass('loading');
var xhr = $.ajax({
headers: headers,
url: state.url,
complete: function complete() {
self.setStateChangeXHR(null);
contentEls.removeClass('loading');
},
success: function success(data, status, xhr) {
var els = self.handleAjaxResponse(data, status, xhr, state);
self.trigger('afterstatechange', {
data: data,
status: status,
xhr: xhr,
element: els,
state: state
});
}
});
this.setStateChangeXHR(xhr);
},
loadFragment: function loadFragment(url, pjaxFragments) {
var self = this,
xhr,
headers = {},
baseUrl = $('base').attr('href'),
fragmentXHR = this.getFragmentXHR();
if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) {
fragmentXHR[pjaxFragments].abort();
fragmentXHR[pjaxFragments] = null;
}
url = $.path.isAbsoluteUrl(url) ? url : $.path.makeUrlAbsolute(url, baseUrl);
headers['X-Pjax'] = pjaxFragments;
xhr = $.ajax({
headers: headers,
url: url,
success: function success(data, status, xhr) {
var elements = self.handleAjaxResponse(data, status, xhr, null);
self.trigger('afterloadfragment', {
data: data,
status: status,
xhr: xhr,
elements: elements
});
},
error: function error(xhr, status, _error) {
self.trigger('loadfragmenterror', {
xhr: xhr,
status: status,
error: _error
});
},
complete: function complete() {
var fragmentXHR = self.getFragmentXHR();
if (typeof fragmentXHR[pjaxFragments] !== 'undefined' && fragmentXHR[pjaxFragments] !== null) {
fragmentXHR[pjaxFragments] = null;
}
}
});
fragmentXHR[pjaxFragments] = xhr;
return xhr;
},
handleAjaxResponse: function handleAjaxResponse(data, status, xhr, state) {
var self = this,
url,
selectedTabs,
guessFragment,
fragment,
$data;
if (xhr.getResponseHeader('X-Reload') && xhr.getResponseHeader('X-ControllerURL')) {
var baseUrl = $('base').attr('href'),
rawURL = xhr.getResponseHeader('X-ControllerURL'),
url = $.path.isAbsoluteUrl(rawURL) ? rawURL : $.path.makeUrlAbsolute(rawURL, baseUrl);
document.location.href = url;
return;
}
if (!data) return;
var title = xhr.getResponseHeader('X-Title');
if (title) document.title = decodeURIComponent(title.replace(/\+/g, ' '));
var newFragments = {},
newContentEls;
if (xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\/json[ \t]*;?/i)) {
newFragments = data;
} else {
fragment = document.createDocumentFragment();
jQuery.clean([data], document, fragment, []);
$data = $(jQuery.merge([], fragment.childNodes));
guessFragment = 'Content';
if ($data.is('form') && !$data.is('[data-pjax-fragment~=Content]')) guessFragment = 'CurrentForm';
newFragments[guessFragment] = $data;
}
this.setRedrawSuppression(true);
try {
$.each(newFragments, function (newFragment, html) {
var contentEl = $('[data-pjax-fragment]').filter(function () {
return $.inArray(newFragment, $(this).data('pjaxFragment').split(' ')) != -1;
}),
newContentEl = $(html);
if (newContentEls) newContentEls.add(newContentEl);else newContentEls = newContentEl;
if (newContentEl.find('.cms-container').length) {
throw 'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops';
}
var origStyle = contentEl.attr('style');
var origParent = contentEl.parent();
var origParentLayoutApplied = typeof origParent.data('jlayout') !== 'undefined';
var layoutClasses = ['east', 'west', 'center', 'north', 'south', 'column-hidden'];
var elemClasses = contentEl.attr('class');
var origLayoutClasses = [];
if (elemClasses) {
origLayoutClasses = $.grep(elemClasses.split(' '), function (val) {
return $.inArray(val, layoutClasses) >= 0;
});
}
newContentEl.removeClass(layoutClasses.join(' ')).addClass(origLayoutClasses.join(' '));
if (origStyle) newContentEl.attr('style', origStyle);
var styles = newContentEl.find('style').detach();
if (styles.length) $(document).find('head').append(styles);
contentEl.replaceWith(newContentEl);
if (!origParent.is('.cms-container') && origParentLayoutApplied) {
origParent.layout();
}
});
var newForm = newContentEls.filter('form');
if (newForm.hasClass('cms-tabset')) newForm.removeClass('cms-tabset').addClass('cms-tabset');
} finally {
this.setRedrawSuppression(false);
}
this.redraw();
this.restoreTabState(state && typeof state.data.tabState !== 'undefined' ? state.data.tabState : null);
return newContentEls;
},
_findFragments: function _findFragments(fragments) {
return $('[data-pjax-fragment]').filter(function () {
var i,
nodeFragments = $(this).data('pjaxFragment').split(' ');
for (i in fragments) {
if ($.inArray(fragments[i], nodeFragments) != -1) return true;
}
return false;
});
},
refresh: function refresh() {
$(window).trigger('statechange');
$(this).redraw();
},
saveTabState: function saveTabState() {
if (typeof window.sessionStorage == "undefined" || window.sessionStorage === null) return;
var selectedTabs = [],
url = this._tabStateUrl();
this.find('.cms-tabset,.ss-tabset').each(function (i, el) {
var id = $(el).attr('id');
if (!id) return;
if (!$(el).data('tabs')) return;
if ($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return;
selectedTabs.push({
id: id,
selected: $(el).tabs('option', 'selected')
});
});
if (selectedTabs) {
var tabsUrl = 'tabs-' + url;
try {
window.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs));
} catch (err) {
if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {
return;
} else {
throw err;
}
}
}
},
restoreTabState: function restoreTabState(overrideStates) {
var self = this,
url = this._tabStateUrl(),
hasSessionStorage = typeof window.sessionStorage !== "undefined" && window.sessionStorage,
sessionData = hasSessionStorage ? window.sessionStorage.getItem('tabs-' + url) : null,
sessionStates = sessionData ? JSON.parse(sessionData) : false;
this.find('.cms-tabset, .ss-tabset').each(function () {
var index,
tabset = $(this),
tabsetId = tabset.attr('id'),
tab,
forcedTab = tabset.find('.ss-tabs-force-active');
if (!tabset.data('tabs')) {
return;
}
tabset.tabs('refresh');
if (forcedTab.length) {
index = forcedTab.index();
} else if (overrideStates && overrideStates[tabsetId]) {
tab = tabset.find(overrideStates[tabsetId].tabSelector);
if (tab.length) {
index = tab.index();
}
} else if (sessionStates) {
$.each(sessionStates, function (i, sessionState) {
if (tabset.is('#' + sessionState.id)) {
index = sessionState.selected;
}
});
}
if (index !== null) {
tabset.tabs('option', 'active', index);
self.trigger('tabstaterestored');
}
});
},
clearTabState: function clearTabState(url) {
if (typeof window.sessionStorage == "undefined") return;
var s = window.sessionStorage;
if (url) {
s.removeItem('tabs-' + url);
} else {
for (var i = 0; i < s.length; i++) {
if (s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
}
}
},
clearCurrentTabState: function clearCurrentTabState() {
this.clearTabState(this._tabStateUrl());
},
_tabStateUrl: function _tabStateUrl() {
return History.getState().url.replace(/\?.*/, '').replace(/#.*/, '').replace($('base').attr('href'), '');
},
showLoginDialog: function showLoginDialog() {
var tempid = $('body').data('member-tempid'),
dialog = $('.leftandmain-logindialog'),
url = 'CMSSecurity/login';
if (dialog.length) dialog.remove();
url = $.path.addSearchParams(url, {
'tempid': tempid,
'BackURL': window.location.href
});
dialog = $('<div class="leftandmain-logindialog"></div>');
dialog.attr('id', new Date().getTime());
dialog.data('url', url);
$('body').append(dialog);
}
});
$('.leftandmain-logindialog').entwine({
onmatch: function onmatch() {
this._super();
this.ssdialog({
iframeUrl: this.data('url'),
dialogClass: "leftandmain-logindialog-dialog",
autoOpen: true,
minWidth: 500,
maxWidth: 500,
minHeight: 370,
maxHeight: 400,
closeOnEscape: false,
open: function open() {
$('.ui-widget-overlay').addClass('leftandmain-logindialog-overlay');
},
close: function close() {
$('.ui-widget-overlay').removeClass('leftandmain-logindialog-overlay');
}
});
},
onunmatch: function onunmatch() {
this._super();
},
open: function open() {
this.ssdialog('open');
},
close: function close() {
this.ssdialog('close');
},
toggle: function toggle(bool) {
if (this.is(':visible')) this.close();else this.open();
},
reauthenticate: function reauthenticate(data) {
if (typeof data.SecurityID !== 'undefined') {
$(':input[name=SecurityID]').val(data.SecurityID);
}
if (typeof data.TempID !== 'undefined') {
$('body').data('member-tempid', data.TempID);
}
this.close();
}
});
$('form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading').entwine({
onmatch: function onmatch() {
this.append('<div class="cms-content-loading-overlay ui-widget-overlay-light"></div><div class="cms-content-loading-spinner"></div>');
this._super();
},
onunmatch: function onunmatch() {
this.find('.cms-content-loading-overlay,.cms-content-loading-spinner').remove();
this._super();
}
});
$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({
onadd: function onadd() {
this.addClass('ss-ui-button');
if (!this.data('button')) this.button();
this._super();
},
onremove: function onremove() {
if (this.data('button')) this.button('destroy');
this._super();
}
});
$('.cms .cms-panel-link').entwine({
onclick: function onclick(e) {
if ($(this).hasClass('external-link')) {
e.stopPropagation();
return;
}
var href = this.attr('href'),
url = href && !href.match(/^#/) ? href : this.data('href'),
data = {
pjax: this.data('pjaxTarget')
};
$('.cms-container').loadPanel(url, null, data);
e.preventDefault();
}
});
$('.cms .ss-ui-button-ajax').entwine({
onclick: function onclick(e) {
$(this).removeClass('ui-button-text-only');
$(this).addClass('ss-ui-button-loading ui-button-text-icons');
var loading = $(this).find(".ss-ui-loading-icon");
if (loading.length < 1) {
loading = $("<span></span>").addClass('ss-ui-loading-icon ui-button-icon-primary ui-icon');
$(this).prepend(loading);
}
loading.show();
var href = this.attr('href'),
url = href ? href : this.data('href');
jQuery.ajax({
url: url,
complete: function complete(xmlhttp, status) {
var msg = xmlhttp.getResponseHeader('X-Status') ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.responseText;
try {
if (typeof msg != "undefined" && msg !== null) eval(msg);
} catch (e) {}
loading.hide();
$(".cms-container").refresh();
$(this).removeClass('ss-ui-button-loading ui-button-text-icons');
$(this).addClass('ui-button-text-only');
},
dataType: 'html'
});
e.preventDefault();
}
});
$('.cms .ss-ui-dialog-link').entwine({
UUID: null,
onmatch: function onmatch() {
this._super();
this.setUUID(new Date().getTime());
},
onunmatch: function onunmatch() {
this._super();
},
onclick: function onclick() {
this._super();
var self = this,
id = 'ss-ui-dialog-' + this.getUUID();
var dialog = $('#' + id);
if (!dialog.length) {
dialog = $('<div class="ss-ui-dialog" id="' + id + '" />');
$('body').append(dialog);
}
var extraClass = this.data('popupclass') ? this.data('popupclass') : '';
dialog.ssdialog({
iframeUrl: this.attr('href'),
autoOpen: true,
dialogExtraClass: extraClass
});
return false;
}
});
$('.cms-content .Actions').entwine({
onmatch: function onmatch() {
this.find('.ss-ui-button').click(function () {
var form = this.form;
if (form) {
form.clickedButton = this;
setTimeout(function () {
form.clickedButton = null;
}, 10);
}
});
this.redraw();
this._super();
},
onunmatch: function onunmatch() {
this._super();
},
redraw: function redraw() {
if (window.debug) console.log('redraw', this.attr('class'), this.get(0));
this.contents().filter(function () {
return this.nodeType == 3 && !/\S/.test(this.nodeValue);
}).remove();
this.find('.ss-ui-button').each(function () {
if (!$(this).data('button')) $(this).button();
});
this.find('.ss-ui-buttonset').buttonset();
}
});
$('.cms .field.date input.text').entwine({
onmatch: function onmatch() {
var holder = $(this).parents('.field.date:first'),
config = holder.data();
if (!config.showcalendar) {
this._super();
return;
}
config.showOn = 'button';
if (config.locale && $.datepicker.regional[config.locale]) {
config = $.extend(config, $.datepicker.regional[config.locale], {});
}
$(this).datepicker(config);
this._super();
},
onunmatch: function onunmatch() {
this._super();
}
});
$('.cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown').entwine({
onmatch: function onmatch() {
if (this.is('.no-chzn')) {
this._super();
return;
}
if (!this.data('placeholder')) this.data('placeholder', ' ');
this.removeClass('has-chzn chzn-done');
this.siblings('.chzn-container').remove();
applyChosen(this);
this._super();
},
onunmatch: function onunmatch() {
this._super();
}
});
$(".cms-panel-layout").entwine({
redraw: function redraw() {
if (window.debug) console.log('redraw', this.attr('class'), this.get(0));
}
});
$('.cms .ss-gridfield').entwine({
showDetailView: function showDetailView(url) {
var params = window.location.search.replace(/^\?/, '');
if (params) url = $.path.addSearchParams(url, params);
$('.cms-container').loadPanel(url);
}
});
$('.cms-search-form').entwine({
onsubmit: function onsubmit(e) {
var nonEmptyInputs, url;
nonEmptyInputs = this.find(':input:not(:submit)').filter(function () {
var vals = $.grep($(this).fieldValue(), function (val) {
return val;
});
return vals.length;
});
url = this.attr('action');
if (nonEmptyInputs.length) {
url = $.path.addSearchParams(url, nonEmptyInputs.serialize());
}
var container = this.closest('.cms-container');
container.find('.cms-edit-form').tabs('select', 0);
container.loadPanel(url, "", {}, true);
return false;
}
});
$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({
onclick: function onclick(e) {
e.preventDefault();
var form = $(this).parents('form');
form.clearForm();
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated");
form.submit();
}
});
window._panelDeferredCache = {};
$('.cms-panel-deferred').entwine({
onadd: function onadd() {
this._super();
this.redraw();
},
onremove: function onremove() {
if (window.debug) console.log('saving', this.data('url'), this);
if (!this.data('deferredNoCache')) window._panelDeferredCache[this.data('url')] = this.html();
this._super();
},
redraw: function redraw() {
if (window.debug) console.log('redraw', this.attr('class'), this.get(0));
var self = this,
url = this.data('url');
if (!url) throw 'Elements of class .cms-panel-deferred need a "data-url" attribute';
this._super();
if (!this.children().length) {
if (!this.data('deferredNoCache') && typeof window._panelDeferredCache[url] !== 'undefined') {
this.html(window._panelDeferredCache[url]);
} else {
this.addClass('loading');
$.ajax({
url: url,
complete: function complete() {
self.removeClass('loading');
},
success: function success(data, status, xhr) {
self.html(data);
}
});
}
}
}
});
$('.cms-tabset').entwine({
onadd: function onadd() {
this.redrawTabs();
this._super();
},
onremove: function onremove() {
if (this.data('tabs')) this.tabs('destroy');
this._super();
},
redrawTabs: function redrawTabs() {
this.rewriteHashlinks();
var id = this.attr('id'),
activeTab = this.find('ul:first .ui-tabs-active');
if (!this.data('uiTabs')) this.tabs({
active: activeTab.index() != -1 ? activeTab.index() : 0,
beforeLoad: function beforeLoad(e, ui) {
return false;
},
activate: function activate(e, ui) {
if (ui.newTab) {
ui.newTab.find('.cms-panel-link').click();
}
var actions = $(this).closest('form').find('.Actions');
if ($(ui.newTab).closest('li').hasClass('readonly')) {
actions.fadeOut();
} else {
actions.show();
}
}
});
},
rewriteHashlinks: function rewriteHashlinks() {
$(this).find('ul a').each(function () {
if (!$(this).attr('href')) return;
var matches = $(this).attr('href').match(/#.*/);
if (!matches) return;
$(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]);
});
}
});
$('#filters-button').entwine({
onmatch: function onmatch() {
this._super();
this.data('collapsed', true);
this.data('animating', false);
},
onunmatch: function onunmatch() {
this._super();
},
showHide: function showHide() {
var self = this,
$filters = $('.cms-content-filters').first(),
collapsed = this.data('collapsed');
if (this.data('animating')) {
return;
}
this.toggleClass('active');
this.data('animating', true);
$filters[collapsed ? 'slideDown' : 'slideUp']({
complete: function complete() {
self.data('collapsed', !collapsed);
self.data('animating', false);
}
});
},
onclick: function onclick() {
this.showHide();
}
});
});
var statusMessage = function statusMessage(text, type) {
text = jQuery('<div/>').text(text).html();
jQuery.noticeAdd({
text: text,
type: type,
stayTime: 5000,
inEffect: {
left: '0',
opacity: 'show'
}
});
};
var errorMessage = function errorMessage(text) {
jQuery.noticeAdd({
text: text,
type: 'error',
stayTime: 5000,
inEffect: {
left: '0',
opacity: 'show'
}
});
};
});

View File

@ -0,0 +1,39 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.MemberDatetimeOptionsetField', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssMemberDatetimeOptionsetField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.memberdatetimeoptionset').entwine({
onmatch: function onmatch() {
this.find('.description .toggle-content').hide();
this._super();
}
});
$('.memberdatetimeoptionset .toggle').entwine({
onclick: function onclick(e) {
jQuery(this).closest('.description').find('.toggle-content').toggle();
return false;
}
});
});
});

View File

@ -0,0 +1,42 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.MemberImportForm', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssMemberImportForm = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.import-form .advanced').entwine({
onmatch: function onmatch() {
this._super();
this.hide();
},
onunmatch: function onunmatch() {
this._super();
}
});
$('.import-form a.toggle-advanced').entwine({
onclick: function onclick(e) {
this.parents('form:eq(0)').find('.advanced').toggle();
return false;
}
});
});
});

45
admin/javascript/dist/ModelAdmin.js vendored Normal file
View File

@ -0,0 +1,45 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.ModelAdmin', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssModelAdmin = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.cms-content-tools #Form_SearchForm').entwine({
onsubmit: function onsubmit(e) {
this.trigger('beforeSubmit');
}
});
$('.importSpec').entwine({
onmatch: function onmatch() {
this.find('div.details').hide();
this.find('a.detailsLink').click(function () {
$('#' + $(this).attr('href').replace(/.*#/, '')).slideToggle();
return false;
});
this._super();
},
onunmatch: function onunmatch() {
this._super();
}
});
});
});

76
admin/javascript/dist/SecurityAdmin.js vendored Normal file
View File

@ -0,0 +1,76 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.SecurityAdmin', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssSecurityAdmin = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var refreshAfterImport = function refreshAfterImport(e) {
var existingFormMessage = (0, _jQuery2.default)((0, _jQuery2.default)(this).contents()).find('.message');
if (existingFormMessage && existingFormMessage.html()) {
var memberTableField = (0, _jQuery2.default)(window.parent.document).find('#Form_EditForm_Members').get(0);
if (memberTableField) memberTableField.refresh();
var tree = (0, _jQuery2.default)(window.parent.document).find('.cms-tree').get(0);
if (tree) tree.reload();
}
};
(0, _jQuery2.default)('#MemberImportFormIframe, #GroupImportFormIframe').entwine({
onadd: function onadd() {
this._super();
(0, _jQuery2.default)(this).bind('load', refreshAfterImport);
}
});
_jQuery2.default.entwine('ss', function ($) {
$('.permissioncheckboxset .checkbox[value=ADMIN]').entwine({
onmatch: function onmatch() {
this.toggleCheckboxes();
this._super();
},
onunmatch: function onunmatch() {
this._super();
},
onclick: function onclick(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function toggleCheckboxes() {
var self = this,
checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this);
if (this.is(':checked')) {
checkboxes.each(function () {
$(this).data('SecurityAdmin.oldChecked', $(this).is(':checked'));
$(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled'));
$(this).prop('disabled', true);
$(this).prop('checked', true);
});
} else {
checkboxes.each(function () {
$(this).prop('checked', $(this).data('SecurityAdmin.oldChecked'));
$(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled'));
});
}
}
});
});
});

View File

@ -0,0 +1,3 @@
!function e(t,n,i){function s(o,r){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){var n=t[o][1][e];return s(n?n:e)},c,c.exports,e,t,n,i)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<i.length;o++)s(i[o]);return s}({1:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".ss-tabset.ss-ui-action-tabset").entwine({IgnoreTabState:!0,onadd:function(){this._super(),this.tabs({collapsible:!0,active:!1})},onremove:function(){var t=e(".cms-container").find("iframe");t.each(function(t,n){e(n).contents().off("click.ss-ui-action-tabset")}),e(document).off("click.ss-ui-action-tabset"),this._super()},ontabsbeforeactivate:function(e,t){this.riseUp(e,t)},onclick:function(e,t){this.attachCloseHandler(e,t)},attachCloseHandler:function(t,n){var i,s=this,a=e(".cms-container").find("iframe");i=function(t){var n,a;n=e(t.target).closest(".ss-ui-action-tabset .ui-tabs-panel"),e(t.target).closest(s).length||n.length||(s.tabs("option","active",!1),a=e(".cms-container").find("iframe"),a.each(function(t,n){e(n).contents().off("click.ss-ui-action-tabset",i)}),e(document).off("click.ss-ui-action-tabset",i))},e(document).on("click.ss-ui-action-tabset",i),a.length>0&&a.each(function(t,n){e(n).contents().on("click.ss-ui-action-tabset",i)})},riseUp:function(t,n){var i,s,a,o,r,l,d,c,u;return i=e(this).find(".ui-tabs-panel").outerHeight(),s=e(this).find(".ui-tabs-nav").outerHeight(),a=e(window).height()+e(document).scrollTop()-s,o=e(this).find(".ui-tabs-nav").offset().top,r=n.newPanel,l=n.newTab,o+i>=a&&o-i>0?(this.addClass("rise-up"),null!==l.position()&&(d=-r.outerHeight(),c=r.parents(".south"),c&&(u=l.offset().top-c.offset().top,d-=u),e(r).css("top",d+"px"))):(this.removeClass("rise-up"),null!==l.position()&&e(r).css("top","0px")),!1}}),e(".cms-content-actions .ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(t,n){this._super(t,n),e(n.newPanel).length>0&&e(n.newPanel).css("left",n.newTab.position().left+"px")}}),e(".cms-actions-row.ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(t,n){this._super(t,n),e(this).closest(".ss-ui-action-tabset").removeClass("tabset-open tabset-open-last")}}),e(".cms-content-fields .ss-tabset.ss-ui-action-tabset").entwine({ontabsbeforeactivate:function(t,n){this._super(t,n),e(n.newPanel).length>0&&(e(n.newTab).hasClass("last")?(e(n.newPanel).css({left:"auto",right:"0px"}),e(n.newPanel).parent().addClass("tabset-open-last")):(e(n.newPanel).css("left",n.newTab.position().left+"px"),e(n.newTab).hasClass("first")&&(e(n.newPanel).css("left","0px"),e(n.newPanel).parent().addClass("tabset-open"))))}}),e(".cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset").entwine({"from .ui-tabs-nav li":{onhover:function(t){e(t.target).parent().find("li .active").removeClass("active"),e(t.target).find("a").addClass("active")}},ontabsbeforeactivate:function(t,n){this._super(t,n),e(n.newPanel).css({left:"auto",right:"auto"}),e(n.newPanel).length>0&&e(n.newPanel).parent().addClass("tabset-open")}})})},{jQuery:"jQuery"}],2:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s),o=e("i18n"),r=i(o);a["default"].entwine("ss.tree",function(e){e("#Form_BatchActionsForm").entwine({Actions:[],getTree:function(){return e(".cms-tree")},fromTree:{oncheck_node:function(e,t){this.serializeFromTree()},onuncheck_node:function(e,t){this.serializeFromTree()}},registerDefault:function(){this.register("admin/pages/batchactions/publish",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_PUBLISH_PROMPT","You have {num} page(s) selected.\n\nDo you really want to publish?"),{num:e.length}));return t?e:!1}),this.register("admin/pages/batchactions/unpublish",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_UNPUBLISH_PROMPT","You have {num} page(s) selected.\n\nDo you really want to unpublish"),{num:e.length}));return t?e:!1}),this.register("admin/pages/batchactions/delete",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_DELETE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to delete?"),{num:e.length}));return t?e:!1}),this.register("admin/pages/batchactions/archive",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_ARCHIVE_PROMPT","You have {num} page(s) selected.\n\nAre you sure you want to archive these pages?\n\nThese pages and all of their children pages will be unpublished and sent to the archive."),{num:e.length}));return t?e:!1}),this.register("admin/pages/batchactions/restore",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_RESTORE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to restore to stage?\n\nChildren of archived pages will be restored to the root level, unless those pages are also being restored."),{num:e.length}));return t?e:!1}),this.register("admin/pages/batchactions/deletefromlive",function(e){var t=confirm(r["default"].inject(r["default"]._t("CMSMAIN.BATCH_DELETELIVE_PROMPT","You have {num} page(s) selected.\n\nDo you really want to delete these pages from live?"),{num:e.length}));return t?e:!1})},onadd:function(){this.registerDefault(),this._super()},register:function(e,t){this.trigger("register",{type:e,callback:t});var n=this.getActions();n[e]=t,this.setActions(n)},unregister:function(e){this.trigger("unregister",{type:e});var t=this.getActions();t[e]&&delete t[e],this.setActions(t)},refreshSelected:function(t){var n=this,i=this.getTree(),s=this.getIDs(),a=[],o=e(".cms-content-batchactions-button"),r=this.find(":input[name=Action]").val();null==t&&(t=i);for(var l in s)e(e(i).getNodeByID(l)).addClass("selected").attr("selected","selected");if(!r||-1==r||!o.hasClass("active"))return void e(t).find("li").each(function(){e(this).setEnabled(!0)});e(t).find("li").each(function(){a.push(e(this).data("id")),e(this).addClass("treeloading").setEnabled(!1)});var d=r+"/applicablepages/?csvIDs="+a.join(",");jQuery.getJSON(d,function(i){jQuery(t).find("li").each(function(){e(this).removeClass("treeloading");var t=e(this).data("id");0==t||e.inArray(t,i)>=0?e(this).setEnabled(!0):(e(this).removeClass("selected").setEnabled(!1),e(this).prop("selected",!1))}),n.serializeFromTree()})},serializeFromTree:function(){var e=this.getTree(),t=e.getSelectedIDs();return this.setIDs(t),!0},setIDs:function(e){this.find(":input[name=csvIDs]").val(e?e.join(","):null)},getIDs:function(){var e=this.find(":input[name=csvIDs]").val();return e?e.split(","):[]},onsubmit:function(t){var n=this,i=this.getIDs(),s=this.getTree(),a=this.getActions();if(!i||!i.length)return alert(r["default"]._t("CMSMAIN.SELECTONEPAGE","Please select at least one page")),t.preventDefault(),!1;var o=this.find(":input[name=Action]").val();if(a[o]&&(i=this.getActions()[o].apply(this,[i])),!i||!i.length)return t.preventDefault(),!1;this.setIDs(i),s.find("li").removeClass("failed");var l=this.find(":submit:first");return l.addClass("loading"),jQuery.ajax({url:o,type:"POST",data:this.serializeArray(),complete:function(e,t){l.removeClass("loading"),s.jstree("refresh",-1),n.setIDs([]),n.find(":input[name=Action]").val("").change();var i=e.getResponseHeader("X-Status");i&&statusMessage(decodeURIComponent(i),"success"==t?"good":"bad")},success:function(t,n){var i,a;if(t.modified){var o=[];for(i in t.modified)a=s.getNodeByID(i),s.jstree("set_text",a,t.modified[i].TreeTitle),o.push(a);e(o).effect("highlight")}if(t.deleted)for(i in t.deleted)a=s.getNodeByID(i),a.length&&s.jstree("delete_node",a);if(t.error)for(i in t.error)a=s.getNodeByID(i),e(a).addClass("failed")},dataType:"json"}),t.preventDefault(),!1}}),e(".cms-content-batchactions-button").entwine({onmatch:function(){this._super(),this.updateTree()},onunmatch:function(){this._super()},onclick:function(e){this.updateTree()},updateTree:function(){var t=e(".cms-tree"),n=e("#Form_BatchActionsForm");this._super(),this.data("active")?(t.addClass("multiple"),t.removeClass("draggable"),n.serializeFromTree()):(t.removeClass("multiple"),t.addClass("draggable")),e("#Form_BatchActionsForm").refreshSelected()}}),e("#Form_BatchActionsForm select[name=Action]").entwine({onchange:function(t){var n=e(t.target.form),i=n.find(":submit"),s=e(t.target).val();s&&-1!=s?i.removeAttr("disabled").button("refresh"):i.attr("disabled","disabled").button("refresh"),e("#Form_BatchActionsForm").refreshSelected(),this.trigger("liszt:updated"),this._super(t)}})})},{i18n:"i18n",jQuery:"jQuery"}],3:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".cms-content").entwine({onadd:function(){this.find(".cms-tabset").redrawTabs(),this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.add(this.find(".cms-tabset")).redrawTabs(),this.find(".cms-content-header").redraw(),this.find(".cms-content-actions").redraw()}}),e(".cms-content .cms-tree").entwine({onadd:function(){var t=this;this._super(),this.bind("select_node.jstree",function(n,i){var s=i.rslt.obj,a=t.find(":input[name=ID]").val(),o=i.args[2],r=e(".cms-container");if(!o)return!1;if(e(s).hasClass("disabled"))return!1;if(e(s).data("id")!=a){var l=e(s).find("a:first").attr("href");l&&"#"!=l?(l=l.split("?")[0],t.jstree("deselect_all"),t.jstree("uncheck_all"),e.path.isExternal(e(s).find("a:first"))&&(l=l=e.path.makeUrlAbsolute(l,e("base").attr("href"))),document.location.search&&(l=e.path.addSearchParams(l,document.location.search.replace(/^\?/,""))),r.loadPanel(l)):t.removeForm()}})}}),e(".cms-content .cms-content-fields").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0))}}),e(".cms-content .cms-content-header, .cms-content .cms-content-actions").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.height("auto"),this.height(this.innerHeight()-this.css("padding-top")-this.css("padding-bottom"))}})})},{jQuery:"jQuery"}],4:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s),o=e("i18n"),r=i(o);window.onbeforeunload=function(e){var t=(0,a["default"])(".cms-edit-form");return t.trigger("beforesubmitform"),t.is(".changed")?r["default"]._t("LeftAndMain.CONFIRMUNSAVEDSHORT"):void 0},a["default"].entwine("ss",function(e){e(".cms-edit-form").entwine({PlaceholderHtml:"",ChangeTrackerOptions:{ignoreFieldSelector:".no-change-track, .ss-upload :input, .cms-navigator :input"},onadd:function(){this.attr("autocomplete","off"),this._setupChangeTracker();for(var t in{action:!0,method:!0,enctype:!0,name:!0}){var n=this.find(":input[name=_form_"+t+"]");n&&(this.attr(t,n.val()),n.remove())}if(this.hasClass("validationerror")){var i=this.find(".message.validation, .message.required").first().closest(".tab");e(".cms-container").clearCurrentTabState(),i.closest(".ss-tabset").tabs("option","active",i.index(".tab"))}this._super()},onremove:function(){this.changetracker("destroy"),this._super()},onmatch:function(){this._super()},onunmatch:function(){this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.add(this.find(".cms-tabset")).redrawTabs(),this.find(".cms-content-header").redraw()},_setupChangeTracker:function(){this.changetracker(this.getChangeTrackerOptions())},confirmUnsavedChanges:function(){if(this.trigger("beforesubmitform"),!this.is(".changed"))return!0;var e=confirm(r["default"]._t("LeftAndMain.CONFIRMUNSAVED"));return e&&this.removeClass("changed"),e},onsubmit:function(e,t){return"_blank"!=this.prop("target")?(t&&this.closest(".cms-container").submitForm(this,t),!1):void 0},validate:function(){var e=!0;return this.trigger("validate",{isValid:e}),e},"from .htmleditor":{oneditorinit:function(t){var n=this,i=e(t.target).closest(".field.htmleditor"),s=i.find("textarea.htmleditor").getEditor().getInstance();s.onClick.add(function(e){n.saveFieldFocus(i.attr("id"))})}},"from .cms-edit-form :input:not(:submit)":{onclick:function(t){this.saveFieldFocus(e(t.target).attr("id"))},onfocus:function(t){this.saveFieldFocus(e(t.target).attr("id"))}},"from .cms-edit-form .treedropdown *":{onfocusin:function(t){var n=e(t.target).closest(".field.treedropdown");this.saveFieldFocus(n.attr("id"))}},"from .cms-edit-form .dropdown .chzn-container a":{onfocusin:function(t){var n=e(t.target).closest(".field.dropdown");this.saveFieldFocus(n.attr("id"))}},"from .cms-container":{ontabstaterestored:function(e){this.restoreFieldFocus()}},saveFieldFocus:function(t){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var n=e(this).attr("id"),i=[];if(i.push({id:n,selected:t}),i)try{window.sessionStorage.setItem(n,JSON.stringify(i))}catch(s){if(s.code===DOMException.QUOTA_EXCEEDED_ERR&&0===window.sessionStorage.length)return;throw s}}},restoreFieldFocus:function(){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var t,n,i,s,a,o=this,r="undefined"!=typeof window.sessionStorage&&window.sessionStorage,l=r?window.sessionStorage.getItem(this.attr("id")):null,d=l?JSON.parse(l):!1,c=0!==this.find(".ss-tabset").length;if(r&&d.length>0){if(e.each(d,function(n,i){o.is("#"+i.id)&&(t=e("#"+i.selected))}),e(t).length<1)return void this.focusFirstInput();if(n=e(t).closest(".ss-tabset").find(".ui-tabs-nav .ui-tabs-active .ui-tabs-anchor").attr("id"),i="tab-"+e(t).closest(".ss-tabset .ui-tabs-panel").attr("id"),c&&i!==n)return;s=e(t).closest(".togglecomposite"),s.length>0&&s.accordion("activate",s.find(".ui-accordion-header")),a=e(t).position().top,e(t).is(":visible")||(t="#"+e(t).closest(".field").attr("id"),a=e(t).position().top),e(t).focus(),a>e(window).height()/2&&o.find(".cms-content-fields").scrollTop(a)}else this.focusFirstInput()}},focusFirstInput:function(){this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(":visible:first").focus()}}),e(".cms-edit-form .Actions input.action[type=submit], .cms-edit-form .Actions button.action").entwine({onclick:function(e){return this.hasClass("gridfield-button-delete")&&!confirm(r["default"]._t("TABLEFIELD.DELETECONFIRMMESSAGE"))?(e.preventDefault(),!1):(this.is(":disabled")||this.parents("form").trigger("submit",[this]),e.preventDefault(),!1)}}),e(".cms-edit-form .Actions input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .Actions button.action.ss-ui-action-cancel").entwine({onclick:function(e){History.getStateByIndex(1)?History.back():this.parents("form").trigger("submit",[this]),e.preventDefault()}}),e(".cms-edit-form .ss-tabset").entwine({onmatch:function(){if(!this.hasClass("ss-ui-action-tabset")){var e=this.find("> ul:first");1==e.children("li").length&&e.hide().parent().addClass("ss-tabset-tabshidden")}this._super()},onunmatch:function(){this._super()}})})},{i18n:"i18n",jQuery:"jQuery"}],5:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".cms-description-toggle").entwine({onadd:function(){var e=!1,t=this.prop("id").substr(0,this.prop("id").indexOf("_Holder")),n=this.find(".cms-description-trigger"),i=this.find(".description");this.hasClass("description-toggle-enabled")||(0===n.length&&(n=this.find(".middleColumn").first().after('<label class="right" for="'+t+'"><a class="cms-description-trigger" href="javascript:void(0)"><span class="btn-icon-information"></span></a></label>').next()),this.addClass("description-toggle-enabled"),n.on("click",function(){i[e?"hide":"show"](),e=!e}),i.hide())}})})},{jQuery:"jQuery"}],6:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".cms .field.cms-description-tooltip").entwine({onmatch:function(){this._super();var e=this.find(".description");e.length&&(this.attr("title",e.text()).tooltip({content:e.html()}),e.remove())}}),e(".cms .field.cms-description-tooltip :input").entwine({onfocusin:function(e){this.closest(".field").tooltip("open")},onfocusout:function(e){this.closest(".field").tooltip("close")}})})},{jQuery:"jQuery"}],7:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].fn.layout.defaults.resize=!1,jLayout="undefined"==typeof jLayout?{}:jLayout,jLayout.threeColumnCompressor=function(e,t){function n(e){var t=e+"Size";return function(e){var n=s[t](),i=o[t](),a=r[t](),l=e.insets();return width=n.width+i.width+a.width,height=Math.max(n.height,i.height,a.height),{width:l.left+l.right+width,height:l.top+l.bottom+height}}}if("undefined"==typeof e.menu||"undefined"==typeof e.content||"undefined"==typeof e.preview)throw'Spec is invalid. Please provide "menu", "content" and "preview" elements.';if("undefined"==typeof t.minContentWidth||"undefined"==typeof t.minPreviewWidth||"undefined"==typeof t.mode)throw'Spec is invalid. Please provide "minContentWidth", "minPreviewWidth", "mode"';if("split"!==t.mode&&"content"!==t.mode&&"preview"!==t.mode)throw'Spec is invalid. "mode" should be either "split", "content" or "preview"';var i={options:t},s=a["default"].jLayoutWrap(e.menu),o=a["default"].jLayoutWrap(e.content),r=a["default"].jLayoutWrap(e.preview);return i.layout=function(n){var i=n.bounds(),a=n.insets(),l=a.top,d=i.height-a.bottom,c=a.left,u=i.width-a.right,h=e.menu.width(),f=0,p=0;"preview"===this.options.mode?(f=0,p=u-c-h):"content"===this.options.mode?(f=u-c-h,p=0):(f=(u-c-h)/2,p=u-c-(h+f),f<this.options.minContentWidth?(f=this.options.minContentWidth,p=u-c-(h+f)):p<this.options.minPreviewWidth&&(p=this.options.minPreviewWidth,f=u-c-(h+p)),(f<this.options.minContentWidth||p<this.options.minPreviewWidth)&&(f=u-c-h,p=0));var m={content:e.content.hasClass("column-hidden"),preview:e.preview.hasClass("column-hidden")},g={content:0===f,preview:0===p};return e.content.toggleClass("column-hidden",g.content),e.preview.toggleClass("column-hidden",g.preview),s.bounds({x:c,y:l,height:d-l,width:h}),s.doLayout(),c+=h,o.bounds({x:c,y:l,height:d-l,width:f}),g.content||o.doLayout(),c+=f,r.bounds({x:c,y:l,height:d-l,width:p}),g.preview||r.doLayout(),g.content!==m.content&&e.content.trigger("columnvisibilitychanged"),g.preview!==m.preview&&e.preview.trigger("columnvisibilitychanged"),f+p<t.minContentWidth+t.minPreviewWidth?e.preview.trigger("disable"):e.preview.trigger("enable"),n},i.preferred=n("preferred"),i.minimum=n("minimum"),i.maximum=n("maximum"),i}},{jQuery:"jQuery"}],8:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".cms-panel.cms-menu").entwine({togglePanel:function(t,n,i){e(".cms-menu-list").children("li").each(function(){t?e(this).children("ul").each(function(){e(this).removeClass("collapsed-flyout"),e(this).data("collapse")&&(e(this).removeData("collapse"),e(this).addClass("collapse"))}):e(this).children("ul").each(function(){e(this).addClass("collapsed-flyout"),e(this).hasClass("collapse"),e(this).removeClass("collapse"),e(this).data("collapse",!0)})}),this.toggleFlyoutState(t),this._super(t,n,i)},toggleFlyoutState:function(t){if(t)e(".collapsed").find("li").show(),e(".cms-menu-list").find(".child-flyout-indicator").hide();else{e(".collapsed-flyout").find("li").each(function(){e(this).hide()});var n=e(".cms-menu-list ul.collapsed-flyout").parent();0===n.children(".child-flyout-indicator").length&&n.append('<span class="child-flyout-indicator"></span>').fadeIn(),n.children(".child-flyout-indicator").fadeIn()}},siteTreePresent:function(){return e("#cms-content-tools-CMSMain").length>0},getPersistedStickyState:function(){var t,n;return void 0!==e.cookie&&(n=e.cookie("cms-menu-sticky"),void 0!==n&&null!==n&&(t="true"===n)),t},setPersistedStickyState:function(t){void 0!==e.cookie&&e.cookie("cms-menu-sticky",t,{path:"/",expires:31})},getEvaluatedCollapsedState:function(){var t,n=this.getPersistedCollapsedState(),i=e(".cms-menu").getPersistedStickyState(),s=this.siteTreePresent();return t=void 0===n?s:n!==s&&i?n:s},onadd:function(){var t=this;setTimeout(function(){t.togglePanel(!t.getEvaluatedCollapsedState(),!1,!1)},0),e(window).on("ajaxComplete",function(e){setTimeout(function(){t.togglePanel(!t.getEvaluatedCollapsedState(),!1,!1)},0)}),this._super()}}),e(".cms-menu-list").entwine({onmatch:function(){this.find("li.current").select(),this.updateItems(),this._super()},onunmatch:function(){this._super()},updateMenuFromResponse:function(e){var t=e.getResponseHeader("X-Controller");if(t){var n=this.find("li#Menu-"+t.replace(/\\/g,"-").replace(/[^a-zA-Z0-9\-_:.]+/,""));n.hasClass("current")||n.select()}this.updateItems()},"from .cms-container":{onafterstatechange:function(e,t){this.updateMenuFromResponse(t.xhr)},onaftersubmitform:function(e,t){this.updateMenuFromResponse(t.xhr)}},"from .cms-edit-form":{onrelodeditform:function(e,t){this.updateMenuFromResponse(t.xmlhttp)}},getContainingPanel:function(){return this.closest(".cms-panel")},fromContainingPanel:{ontoggle:function(t){this.toggleClass("collapsed",e(t.target).hasClass("collapsed"))}},updateItems:function(){var t=this.find("#Menu-CMSMain");t[t.is(".current")?"show":"hide"]();var n=e(".cms-content input[name=ID]").val();n&&this.find("li").each(function(){e.isFunction(e(this).setRecordID)&&e(this).setRecordID(n)})}}),e(".cms-menu-list li").entwine({toggleFlyout:function(t){var n=e(this);n.children("ul").first().hasClass("collapsed-flyout")&&(t?n.children("ul").find("li").fadeIn("fast"):n.children("ul").find("li").hide())}}),e(".cms-menu-list li").hoverIntent(function(){e(this).toggleFlyout(!0)},function(){e(this).toggleFlyout(!1)}),e(".cms-menu-list .toggle").entwine({onclick:function(e){this.getMenuItem().toggle(),e.preventDefault()}}),e(".cms-menu-list li").entwine({onmatch:function(){this.find("ul").length&&this.find("a:first").append('<span class="toggle-children"><span class="toggle-children-icon"></span></span>'),this._super()},onunmatch:function(){this._super()},toggle:function(){this[this.hasClass("opened")?"close":"open"]()},open:function(){var e=this.getMenuItem();e&&e.open(),this.addClass("opened").find("ul").show(),this.find(".toggle-children").addClass("opened")},close:function(){this.removeClass("opened").find("ul").hide(),this.find(".toggle-children").removeClass("opened")},select:function(){var e=this.getMenuItem();if(this.addClass("current").open(),this.siblings().removeClass("current").close(),this.siblings().find("li").removeClass("current"),e){var t=e.siblings();e.addClass("current"),t.removeClass("current").close(),t.find("li").removeClass("current").close()}this.getMenu().updateItems(),this.trigger("select")}}),e(".cms-menu-list *").entwine({getMenu:function(){return this.parents(".cms-menu-list:first")}}),e(".cms-menu-list li *").entwine({getMenuItem:function(){return this.parents("li:first")}}),e(".cms-menu-list li a").entwine({onclick:function(t){var n=e.path.isExternal(this.attr("href"));if(!(t.which>1||n)&&"_blank"!=this.attr("target")){t.preventDefault();var i=this.getMenuItem(),s=this.attr("href");n||(s=e("base").attr("href")+s);var a=i.find("li");if(a.length)a.first().find("a").click();else if(!e(".cms-container").loadPanel(s))return!1;i.select()}}}),e(".cms-menu-list li .toggle-children").entwine({onclick:function(e){var t=this.closest("li");return t.toggle(),!1}}),e(".cms .profile-link").entwine({onclick:function(){return e(".cms-container").loadPanel(this.attr("href")),e(".cms-menu-list li").removeClass("current").close(),!1}}),e(".cms-menu .sticky-toggle").entwine({onadd:function(){var t=e(".cms-menu").getPersistedStickyState()?!0:!1;this.toggleCSS(t),this.toggleIndicator(t),this._super()},toggleCSS:function(e){this[e?"addClass":"removeClass"]("active")},toggleIndicator:function(e){this.next(".sticky-status-indicator").text(e?"fixed":"auto")},onclick:function(){var e=this.closest(".cms-menu"),t=e.getPersistedCollapsedState(),n=e.getPersistedStickyState(),i=void 0===n?!this.hasClass("active"):!n;void 0===t?e.setPersistedCollapsedState(e.hasClass("collapsed")):void 0!==t&&i===!1&&e.clearPersistedCollapsedState(),e.setPersistedStickyState(i),this.toggleCSS(i),this.toggleIndicator(i),this._super()}})})},{jQuery:"jQuery"}],9:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e.entwine.warningLevel=e.entwine.WARN_LEVEL_BESTPRACTISE,e(".cms-panel").entwine({WidthExpanded:null,WidthCollapsed:null,canSetCookie:function(){return void 0!==e.cookie&&void 0!==this.attr("id")},getPersistedCollapsedState:function(){var t,n;return this.canSetCookie()&&(n=e.cookie("cms-panel-collapsed-"+this.attr("id")),void 0!==n&&null!==n&&(t="true"===n)),t},setPersistedCollapsedState:function(t){this.canSetCookie()&&e.cookie("cms-panel-collapsed-"+this.attr("id"),t,{path:"/",expires:31})},clearPersistedCollapsedState:function(){this.canSetCookie()&&e.cookie("cms-panel-collapsed-"+this.attr("id"),"",{path:"/",expires:-1})},getInitialCollapsedState:function(){var e=this.getPersistedCollapsedState();return void 0===e&&(e=this.hasClass("collapsed")),e},onadd:function(){var t,n;if(!this.find(".cms-panel-content").length)throw new Exception('Content panel for ".cms-panel" not found');this.find(".cms-panel-toggle").length||(n=e("<div class='cms-panel-toggle south'></div>").append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>').append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>'),this.append(n)),this.setWidthExpanded(this.find(".cms-panel-content").innerWidth()),t=this.find(".cms-panel-content-collapsed"),this.setWidthCollapsed(t.length?t.innerWidth():this.find(".toggle-expand").innerWidth()),this.togglePanel(!this.getInitialCollapsedState(),!0,!1),this._super()},togglePanel:function(e,t,n){var i,s;t||(this.trigger("beforetoggle.sspanel",e),this.trigger(e?"beforeexpand":"beforecollapse")),this.toggleClass("collapsed",!e),i=e?this.getWidthExpanded():this.getWidthCollapsed(),this.width(i),s=this.find(".cms-panel-content-collapsed"),s.length&&(this.find(".cms-panel-content")[e?"show":"hide"](),this.find(".cms-panel-content-collapsed")[e?"hide":"show"]()),n!==!1&&this.setPersistedCollapsedState(!e),this.trigger("toggle",e),this.trigger(e?"expand":"collapse")},expandPanel:function(e){(e||this.hasClass("collapsed"))&&this.togglePanel(!0)},collapsePanel:function(e){(e||!this.hasClass("collapsed"))&&this.togglePanel(!1)}}),e(".cms-panel.collapsed .cms-panel-toggle").entwine({onclick:function(e){this.expandPanel(),e.preventDefault()}}),e(".cms-panel *").entwine({getPanel:function(){return this.parents(".cms-panel:first")}}),e(".cms-panel .toggle-expand").entwine({onclick:function(e){e.preventDefault(),e.stopPropagation(),this.getPanel().expandPanel(),this._super(e)}}),e(".cms-panel .toggle-collapse").entwine({onclick:function(e){e.preventDefault(),e.stopPropagation(),this.getPanel().collapsePanel(),this._super(e)}}),e(".cms-content-tools.collapsed").entwine({onclick:function(e){this.expandPanel(),this._super(e)}})})},{jQuery:"jQuery"}],10:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s),o=e("i18n"),r=i(o);a["default"].entwine("ss.preview",function(e){e(".cms-preview").entwine({AllowedStates:["StageLink","LiveLink","ArchiveLink"],CurrentStateName:null,CurrentSizeName:"auto",IsPreviewEnabled:!1,DefaultMode:"split",Sizes:{auto:{width:"100%",height:"100%"},mobile:{width:"335px",height:"568px"},mobileLandscape:{width:"583px",height:"320px"},tablet:{width:"783px",height:"1024px"},tabletLandscape:{width:"1039px",height:"768px"},desktop:{width:"1024px",height:"800px"}},changeState:function(t,n){var i=this,s=this._getNavigatorStates();return n!==!1&&e.each(s,function(e,n){i.saveState("state",t)}),this.setCurrentStateName(t),this._loadCurrentState(),this.redraw(),this},changeMode:function(t,n){var i=e(".cms-container");if("split"==t)i.entwine(".ss").splitViewMode(),this.setIsPreviewEnabled(!0),this._loadCurrentState();else if("content"==t)i.entwine(".ss").contentViewMode(),this.setIsPreviewEnabled(!1);else{if("preview"!=t)throw"Invalid mode: "+t;i.entwine(".ss").previewMode(),this.setIsPreviewEnabled(!0),this._loadCurrentState()}return n!==!1&&this.saveState("mode",t),this.redraw(),this},changeSize:function(e){var t=this.getSizes();return this.setCurrentSizeName(e),this.removeClass("auto desktop tablet mobile").addClass(e),this.find(".preview-device-outer").width(t[e].width).height(t[e].height),this.find(".preview-device-inner").width(t[e].width),this.saveState("size",e),this.redraw(),this},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0));var t=this.getCurrentStateName();t&&this.find(".cms-preview-states").changeVisibleState(t);var n=e(".cms-container").entwine(".ss").getLayoutOptions();n&&e(".preview-mode-selector").changeVisibleMode(n.mode);var i=this.getCurrentSizeName();return i&&this.find(".preview-size-selector").changeVisibleSize(this.getCurrentSizeName()),this},saveState:function(e,t){this._supportsLocalStorage()&&window.localStorage.setItem("cms-preview-state-"+e,t)},loadState:function(e){return this._supportsLocalStorage()?window.localStorage.getItem("cms-preview-state-"+e):void 0},disablePreview:function(){return this.setPendingURL(null),this._loadUrl("about:blank"),this._block(),this.changeMode("content",!1),this.setIsPreviewEnabled(!1),this},enablePreview:function(){return this.getIsPreviewEnabled()||(this.setIsPreviewEnabled(!0),e.browser.msie&&e.browser.version.slice(0,3)<=7?this.changeMode("content"):this.changeMode(this.getDefaultMode(),!1)),this},getOrAppendFontFixStyleElement:function(){var t=e("#FontFixStyleElement");return t.length||(t=e('<style type="text/css" id="FontFixStyleElement" disabled="disabled">:before,:after{content:none !important}</style>').appendTo("head")),t},onadd:function(){var t=this,n=(this.parent(),this.find("iframe"));n.addClass("center"),n.bind("load",function(){t._adjustIframeForPreview(),t._loadCurrentPage(),e(this).removeClass("loading")}),e.browser.msie&&8===parseInt(e.browser.version,10)&&n.bind("readystatechange",function(e){"interactive"==n[0].readyState&&(t.getOrAppendFontFixStyleElement().removeAttr("disabled"),setTimeout(function(){t.getOrAppendFontFixStyleElement().attr("disabled","disabled")},0))}),this.append('<div class="cms-preview-overlay ui-widget-overlay-light"></div>'),this.find(".cms-preview-overlay").hide(),this.disablePreview(),this._super()},_supportsLocalStorage:function(){var e,t,n=new Date;try{return(e=window.localStorage).setItem(n,n),t=e.getItem(n)==n,e.removeItem(n),t&&e}catch(i){console.warn("localStorge is not available due to current browser / system settings.")}},onenable:function(){var t=e(".preview-mode-selector");t.removeClass("split-disabled"),t.find(".disabled-tooltip").hide()},ondisable:function(){var t=e(".preview-mode-selector");t.addClass("split-disabled"),t.find(".disabled-tooltip").show()},_block:function(){return this.addClass("blocked"),this.find(".cms-preview-overlay").show(),this},_unblock:function(){return this.removeClass("blocked"),this.find(".cms-preview-overlay").hide(),this},_initialiseFromContent:function(){var t,n;return e(".cms-previewable").length?(t=this.loadState("mode"),n=this.loadState("size"),this._moveNavigator(),t&&"content"==t||(this.enablePreview(),this._loadCurrentState()),this.redraw(),t&&this.changeMode(t),n&&this.changeSize(n)):this.disablePreview(),this},"from .cms-container":{onafterstatechange:function(e,t){t.xhr.getResponseHeader("X-ControllerURL")||this._initialiseFromContent()}},PendingURL:null,oncolumnvisibilitychanged:function(){var e=this.getPendingURL();e&&!this.is(".column-hidden")&&(this.setPendingURL(null),
this._loadUrl(e),this._unblock())},"from .cms-container .cms-edit-form":{onaftersubmitform:function(){this._initialiseFromContent()}},_loadUrl:function(e){return this.find("iframe").addClass("loading").attr("src",e),this},_getNavigatorStates:function(){var t=e.map(this.getAllowedStates(),function(t){var n=e(".cms-preview-states .state-name[data-name="+t+"]");return n.length?{name:t,url:n.attr("data-link"),active:n.is(":radio")?n.is(":checked"):n.is(":selected")}:null});return t},_loadCurrentState:function(){if(!this.getIsPreviewEnabled())return this;var t=this._getNavigatorStates(),n=this.getCurrentStateName(),i=null;t&&(i=e.grep(t,function(e,t){return n===e.name||!n&&e.active}));var s=null;return i[0]?s=i[0].url:t.length?(this.setCurrentStateName(t[0].name),s=t[0].url):this.setCurrentStateName(null),this.is(".column-hidden")?(this.setPendingURL(s),this._loadUrl("about:blank"),this._block()):(this.setPendingURL(null),s?(this._loadUrl(s),this._unblock()):this._block()),this},_moveNavigator:function(){var t=e(".cms-preview .cms-preview-controls"),n=e(".cms-edit-form .cms-navigator");n.length&&t.length?t.html(e(".cms-edit-form .cms-navigator").detach()):this._block()},_loadCurrentPage:function(){if(this.getIsPreviewEnabled()){var t=this.find("iframe")[0].contentDocument,n=(e(".cms-container"),e(t).find("meta[name=x-page-id]").attr("content")),i=e(t).find("meta[name=x-cms-edit-link]").attr("content"),s=e(".cms-content");n&&s.find(":input[name=ID]").val()!=n&&window.History.enabled&&e(".cms-container").entwine(".ss").loadPanel(i)}},_adjustIframeForPreview:function(){var e=this.find("iframe")[0];if(e){var t=e.contentDocument;if(t){for(var n=t.getElementsByTagName("A"),i=0;i<n.length;i++){var s=n[i].getAttribute("href");s&&s.match(/^http:\/\//)&&n[i].setAttribute("target","_blank")}var a=t.getElementById("SilverStripeNavigator");a&&(a.style.display="none");var o=t.getElementById("SilverStripeNavigatorMessage");o&&(o.style.display="none"),this.trigger("afterIframeAdjustedForPreview",[t])}}}}),e(".cms-edit-form").entwine({onadd:function(){this._super(),e(".cms-preview")._initialiseFromContent()}}),e(".cms-preview-states").entwine({changeVisibleState:function(e){this.find('input[data-name="'+e+'"]').prop("checked",!0)}}),e(".cms-preview-states .state-name").entwine({onclick:function(t){this.parent().find(".active").removeClass("active"),this.next("label").addClass("active");var n=e(this).attr("data-name");e(".cms-preview").changeState(n)}}),e(".preview-mode-selector").entwine({changeVisibleMode:function(e){this.find("select").val(e).trigger("liszt:updated")._addIcon()}}),e(".preview-mode-selector select").entwine({onchange:function(t){this._super(t),t.preventDefault();var n=e(this).val();e(".cms-preview").changeMode(n)}}),e(".preview-mode-selector .chzn-results li").entwine({onclick:function(t){if(e.browser.msie){t.preventDefault();var n=this.index(),i=this.closest(".preview-mode-selector").find("select option:eq("+n+")").val();e(".cms-preview").changeMode(i)}}}),e(".cms-preview.column-hidden").entwine({onmatch:function(){e("#preview-mode-dropdown-in-content").show(),e(".cms-preview .result-selected").hasClass("font-icon-columns")&&statusMessage(r["default"]._t("LeftAndMain.DISABLESPLITVIEW","Screen too small to show site preview in split mode"),"error"),this._super()},onunmatch:function(){e("#preview-mode-dropdown-in-content").hide(),this._super()}}),e("#preview-mode-dropdown-in-content").entwine({onmatch:function(){e(".cms-preview").is(".column-hidden")?this.show():this.hide(),this._super()},onunmatch:function(){this._super()}}),e(".preview-size-selector").entwine({changeVisibleSize:function(e){this.find("select").val(e).trigger("liszt:updated")._addIcon()}}),e(".preview-size-selector select").entwine({onchange:function(t){t.preventDefault();var n=e(this).val();e(".cms-preview").changeSize(n)}}),e(".preview-selector select.preview-dropdown").entwine({"onliszt:showing_dropdown":function(){this.siblings().find(".chzn-drop").addClass("open")._alignRight()},"onliszt:hiding_dropdown":function(){this.siblings().find(".chzn-drop").removeClass("open")._removeRightAlign()},"onliszt:ready":function(){this._super(),this._addIcon()},_addIcon:function(){var e=this.find(":selected"),t=e.attr("data-icon"),n=this.parent().find(".chzn-container a.chzn-single"),i=n.attr("data-icon");return"undefined"!=typeof i&&n.removeClass(i),n.addClass(t),n.attr("data-icon",t),this}}),e(".preview-selector .chzn-drop").entwine({_alignRight:function(){var t=this;e(this).hide(),setTimeout(function(){e(t).css({left:"auto",right:0}),e(t).show()},100)},_removeRightAlign:function(){e(this).css({right:"auto"})}}),e(".preview-mode-selector .chzn-drop li:last-child").entwine({onmatch:function(){e(".preview-mode-selector").hasClass("split-disabled")?this.parent().append('<div class="disabled-tooltip"></div>'):this.parent().append('<div class="disabled-tooltip" style="display: none;"></div>')}}),e(".preview-scroll").entwine({ToolbarSize:53,_redraw:function(){var e=this.getToolbarSize();window.debug&&console.log("redraw",this.attr("class"),this.get(0));var t=this.height()-e;this.height(t)},onmatch:function(){this._redraw(),this._super()},onunmatch:function(){this._super()}}),e(".preview-device-outer").entwine({onclick:function(){this.toggleClass("rotate")}})})},{i18n:"i18n",jQuery:"jQuery"}],11:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss.tree",function(e){e(".cms-tree").entwine({Hints:null,IsUpdatingTree:!1,IsLoaded:!1,onadd:function(){if(this._super(),!e.isNumeric(this.data("jstree_instance_id"))){var t=this.attr("data-hints");t&&this.setHints(e.parseJSON(t));var n=this;this.jstree(this.getTreeConfig()).bind("loaded.jstree",function(t,i){n.setIsLoaded(!0),i.inst._set_settings({html_data:{ajax:{url:n.data("urlTree"),data:function(t){var i=n.data("searchparams")||[];return i=e.grep(i,function(e,t){return"ID"!=e.name&&"value"!=e.name}),i.push({name:"ID",value:e(t).data("id")?e(t).data("id"):0}),i.push({name:"ajax",value:1}),i}}}}),n.updateFromEditForm(),n.css("visibility","visible"),i.inst.hide_checkboxes()}).bind("before.jstree",function(t,i){if("start_drag"==i.func&&(!n.hasClass("draggable")||n.hasClass("multiselect")))return t.stopImmediatePropagation(),!1;if(e.inArray(i.func,["check_node","uncheck_node"])){var s=e(i.args[0]).parents("li:first"),a=s.find("li:not(.disabled)");if(s.hasClass("disabled")&&0==a)return t.stopImmediatePropagation(),!1}}).bind("move_node.jstree",function(t,i){if(!n.getIsUpdatingTree()){var s=i.rslt.o,a=i.rslt.np,o=(i.inst._get_parent(s),e(a).data("id")||0),r=e(s).data("id"),l=e.map(e(s).siblings().andSelf(),function(t){return e(t).data("id")});e.ajax({url:n.data("urlSavetreenode"),type:"POST",data:{ID:r,ParentID:o,SiblingIDs:l},success:function(){e(".cms-edit-form :input[name=ID]").val()==r&&e(".cms-edit-form :input[name=ParentID]").val(o),n.updateNodesFromServer([r])},statusCode:{403:function(){e.jstree.rollback(i.rlbk)}}})}}).bind("select_node.jstree check_node.jstree uncheck_node.jstree",function(t,n){e(document).triggerHandler(t,n)})}},onremove:function(){this.jstree("destroy"),this._super()},"from .cms-container":{onafterstatechange:function(e){this.updateFromEditForm()}},"from .cms-container form":{onaftersubmitform:function(t){var n=e(".cms-edit-form :input[name=ID]").val();this.updateNodesFromServer([n])}},getTreeConfig:function(){var t=this;return{core:{initially_open:["record-0"],animation:0,html_titles:!0},html_data:{},ui:{select_limit:1,initially_select:[this.find(".current").attr("id")]},crrm:{move:{check_move:function(n){var i=e(n.o),s=e(n.np),a=n.ot.get_container()[0]==n.np[0],o=i.getClassname(),r=s.getClassname(),l=t.getHints(),d=[],c=r?r:"Root",u=l&&"undefined"!=typeof l[c]?l[c]:null;u&&i.attr("class").match(/VirtualPage-([^\s]*)/)&&(o=RegExp.$1),u&&(d="undefined"!=typeof u.disallowedChildren?u.disallowedChildren:[]);var h=!(0===i.data("id")||i.hasClass("status-archived")||a&&"inside"!=n.p||s.hasClass("nochildren")||d.length&&-1!=e.inArray(o,d));return h}}},dnd:{drop_target:!1,drag_target:!1},checkbox:{two_state:!0},themes:{theme:"apple",url:e("body").data("frameworkpath")+"/thirdparty/jstree/themes/apple/style.css"},plugins:["html_data","ui","dnd","crrm","themes","checkbox"]}},search:function(e,t){e?this.data("searchparams",e):this.removeData("searchparams"),this.jstree("refresh",-1,t)},getNodeByID:function(e){return this.find("*[data-id="+e+"]")},createNode:function(t,n,i){var s=this,a=void 0!==n.ParentID?s.getNodeByID(n.ParentID):!1,o=e(t),r={data:""};o.hasClass("jstree-open")?r.state="open":o.hasClass("jstree-closed")&&(r.state="closed"),this.jstree("create_node",a.length?a:-1,"last",r,function(e){for(var t=e.attr("class"),n=0;n<o[0].attributes.length;n++){var s=o[0].attributes[n];e.attr(s.name,s.value)}e.addClass(t).html(o.html()),i(e)})},updateNode:function(t,n,i){var s=e(n),a=t.attr("class"),o=i.NextID?this.getNodeByID(i.NextID):!1,r=i.PrevID?this.getNodeByID(i.PrevID):!1,l=i.ParentID?this.getNodeByID(i.ParentID):!1;e.each(["id","style","class","data-pagetype"],function(e,n){t.attr(n,s.attr(n))}),a=a.replace(/status-[^\s]*/,"");var d=t.children("ul").detach();t.addClass(a).html(s.html()).append(d),o&&o.length?this.jstree("move_node",t,o,"before"):r&&r.length?this.jstree("move_node",t,r,"after"):this.jstree("move_node",t,l.length?l:-1)},updateFromEditForm:function(){var t,n=e(".cms-edit-form :input[name=ID]").val();n?(t=this.getNodeByID(n),t.length?(this.jstree("deselect_all"),this.jstree("select_node",t)):this.updateNodesFromServer([n])):this.jstree("deselect_all")},updateNodesFromServer:function(t){if(!this.getIsUpdatingTree()&&this.getIsLoaded()){var n=this,i=!1;this.setIsUpdatingTree(!0),n.jstree("save_selected");var s=function(e){n.getNodeByID(e.data("id")).not(e).remove(),n.jstree("deselect_all"),n.jstree("select_node",e)};n.jstree("open_node",this.getNodeByID(0)),n.jstree("save_opened"),n.jstree("save_selected"),e.ajax({url:e.path.addSearchParams(this.data("urlUpdatetreenodes"),"ids="+t.join(",")),dataType:"json",success:function(t,a){e.each(t,function(e,t){var a=n.getNodeByID(e);return t?void(a.length?(n.updateNode(a,t.html,t),setTimeout(function(){s(a)},500)):(i=!0,t.ParentID&&!n.find("li[data-id="+t.ParentID+"]").length?n.jstree("load_node",-1,function(){newNode=n.find("li[data-id="+e+"]"),s(newNode)}):n.createNode(t.html,t,function(e){s(e)}))):void n.jstree("delete_node",a)}),i||(n.jstree("deselect_all"),n.jstree("reselect"),n.jstree("reopen"))},complete:function(){n.setIsUpdatingTree(!1)}})}}}),e(".cms-tree.multiple").entwine({onmatch:function(){this._super(),this.jstree("show_checkboxes")},onunmatch:function(){this._super(),this.jstree("uncheck_all"),this.jstree("hide_checkboxes")},getSelectedIDs:function(){return e(this).jstree("get_checked").not(".disabled").map(function(){return e(this).data("id")}).get()}}),e(".cms-tree li").entwine({setEnabled:function(e){this.toggleClass("disabled",!e)},getClassname:function(){var e=this.attr("class").match(/class-([^\s]*)/i);return e?e[1]:""},getID:function(){return this.data("id")}})})},{jQuery:"jQuery"}],12:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=i(s);a["default"].entwine("ss",function(e){e(".TreeDropdownField").entwine({"from .cms-container form":{onaftersubmitform:function(e){this.find(".tree-holder").empty(),this._super()}}})})},{jQuery:"jQuery"}],13:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},_jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery);_jQuery2["default"].noConflict(),window.ss=window.ss||{};var windowWidth,windowHeight;window.ss.debounce=function(e,t,n){var i,s,a,o=function(){i=null,n||e.apply(s,a)};return function(){var r=n&&!i;s=this,a=arguments,clearTimeout(i),i=setTimeout(o,t),r&&e.apply(s,a)}},(0,_jQuery2["default"])(window).bind("resize.leftandmain",function(e){var t=function(){(0,_jQuery2["default"])(".cms-container").trigger("windowresize")};if(_jQuery2["default"].browser.msie&&parseInt(_jQuery2["default"].browser.version,10)<9){var n=(0,_jQuery2["default"])(window).width(),i=(0,_jQuery2["default"])(window).height();(n!=windowWidth||i!=windowHeight)&&(windowWidth=n,windowHeight=i,t())}else t()}),_jQuery2["default"].entwine.warningLevel=_jQuery2["default"].entwine.WARN_LEVEL_BESTPRACTISE,_jQuery2["default"].entwine("ss",function($){$(window).on("message",function(e){var t,n=e.originalEvent,i="object"===_typeof(n.data)?n.data:JSON.parse(n.data);if($.path.parseUrl(window.location.href).domain===$.path.parseUrl(n.origin).domain)switch(t=$("undefined"==typeof i.target?window:i.target),i.type){case"event":t.trigger(i.event,i.data);break;case"callback":t[i.callback].call(t,i.data)}});var positionLoadingSpinner=function(){var e=120,t=$(".ss-loading-screen .loading-animation"),n=($(window).height()-t.height())/2;t.css("top",n+e),t.show()},applyChosen=function e(t){if(t.is(":visible")){t.addClass("has-chzn").chosen({allow_single_deselect:!0,disable_search_threshold:20});var n=t.prop("title");n&&t.siblings(".chzn-container").prop("title",n)}else setTimeout(function(){t.show(),e(t)},500)},isSameUrl=function(e,t){var n=$("base").attr("href");e=$.path.isAbsoluteUrl(e)?e:$.path.makeUrlAbsolute(e,n),t=$.path.isAbsoluteUrl(t)?t:$.path.makeUrlAbsolute(t,n);var i=$.path.parseUrl(e),s=$.path.parseUrl(t);return i.pathname.replace(/\/*$/,"")==s.pathname.replace(/\/*$/,"")&&i.search==s.search},ajaxCompleteEvent=window.ss.debounce(function(){$(window).trigger("ajaxComplete")},1e3,!0);$(window).bind("resize",positionLoadingSpinner).trigger("resize"),$(document).ajaxComplete(function(e,t,n){if(window.History.enabled){var i,s=t.getResponseHeader("X-ControllerURL"),a=History.getPageUrl().replace(/\/$/,""),o=n.url;null===s||isSameUrl(a,s)&&isSameUrl(o,s)||(i={id:(new Date).getTime()+String(Math.random()).replace(/\D/g,""),pjax:t.getResponseHeader("X-Pjax")?t.getResponseHeader("X-Pjax"):n.headers["X-Pjax"]},window.History.pushState(i,"",s))}var r=t.getResponseHeader("X-Status")?t.getResponseHeader("X-Status"):t.statusText,l=t.getResponseHeader("X-Reauthenticate"),d=t.status<200||t.status>399?"bad":"good",c=["OK"];return l?void $(".cms-container").showLoginDialog():(0!==t.status&&r&&$.inArray(r,c)&&statusMessage(decodeURIComponent(r),d),void ajaxCompleteEvent(this))}),$(".cms-container").entwine({StateChangeXHR:null,FragmentXHR:{},StateChangeCount:0,LayoutOptions:{minContentWidth:940,minPreviewWidth:400,mode:"content"},onadd:function(){return $.browser.msie&&parseInt($.browser.version,10)<8?($(".ss-loading-screen").append('<p class="ss-loading-incompat-warning"><span class="notice">Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.</span></p>').css("z-index",$(".ss-loading-screen").css("z-index")+1),$(".loading-animation").remove(),void this._super()):(this.redraw(),$(".ss-loading-screen").hide(),$("body").removeClass("loading"),$(window).unbind("resize",positionLoadingSpinner),this.restoreTabState(),void this._super())},fromWindow:{onstatechange:function(e){this.handleStateChange(e)}},onwindowresize:function(){this.redraw()},"from .cms-panel":{ontoggle:function(){this.redraw()}},"from .cms-container":{onaftersubmitform:function(){this.redraw()}},"from .cms-menu-list li a":{onclick:function(e){var t=$(e.target).attr("href");e.which>1||t==this._tabStateUrl()||this.splitViewMode()}},updateLayoutOptions:function(e){var t=this.getLayoutOptions(),n=!1;for(var i in e)t[i]!==e[i]&&(t[i]=e[i],n=!0);n&&this.redraw()},splitViewMode:function(){this.updateLayoutOptions({mode:"split"})},contentViewMode:function(){this.updateLayoutOptions({mode:"content"})},previewMode:function(){this.updateLayoutOptions({mode:"preview"})},RedrawSuppression:!1,redraw:function(){this.getRedrawSuppression()||(window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.data("jlayout",jLayout.threeColumnCompressor({menu:this.children(".cms-menu"),content:this.children(".cms-content"),preview:this.children(".cms-preview")},this.getLayoutOptions())),this.layout(),this.find(".cms-panel-layout").redraw(),this.find(".cms-content-fields[data-layout-type]").redraw(),this.find(".cms-edit-form[data-layout-type]").redraw(),this.find(".cms-preview").redraw(),this.find(".cms-content").redraw())},checkCanNavigate:function(e){var t=this._findFragments(e||["Content"]),n=t.find(":data(changetracker)").add(t.filter(":data(changetracker)")),i=!0;return n.length?(n.each(function(){$(this).confirmUnsavedChanges()||(i=!1)}),i):!0},loadPanel:function(e,t,n,i,s){n||(n={}),t||(t=""),s||(s=History.getState().url),this.checkCanNavigate(n.pjax?n.pjax.split(","):["Content"])&&(this.saveTabState(),window.History.enabled?($.extend(n,{__forceReferer:s}),i?($.extend(n,{__forceReload:Math.random()}),window.History.replaceState(n,t,e)):window.History.pushState(n,t,e)):window.location=$.path.makeUrlAbsolute(e,$("base").attr("href")))},reloadCurrentPanel:function(){this.loadPanel(window.History.getState().url,null,null,!0)},submitForm:function(e,t,n,i){var s=this;t||(t=this.find(".Actions :submit[name=action_save]")),t||(t=this.find(".Actions :submit:first")),e.trigger("beforesubmitform"),this.trigger("submitform",{form:e,button:t}),$(t).addClass("loading");var a=e.validate();if("undefined"!=typeof a&&!a)return statusMessage("Validation failed.","bad"),$(t).removeClass("loading"),!1;var o=e.serializeArray();return o.push({name:$(t).attr("name"),value:"1"}),o.push({name:"BackURL",value:History.getPageUrl().replace(/\/$/,"")}),this.saveTabState(),jQuery.ajax(jQuery.extend({headers:{"X-Pjax":"CurrentForm,Breadcrumbs"},url:e.attr("action"),data:o,type:"POST",complete:function(){$(t).removeClass("loading")},success:function(t,i,a){e.removeClass("changed"),n&&n(t,i,a);var r=s.handleAjaxResponse(t,i,a);r&&r.filter("form").trigger("aftersubmitform",{status:i,xhr:a,formData:o})}},i)),!1},LastState:null,PauseState:!1,handleStateChange:function(){if(!this.getPauseState()){this.getStateChangeXHR()&&this.getStateChangeXHR().abort();var e=this,t=window.History,n=t.getState(),i=n.data.pjax||"Content",s={},a=i.split(","),o=this._findFragments(a);this.setStateChangeCount(this.getStateChangeCount()+1);var r=$.browser.msie&&parseInt($.browser.version,10)<9;if(r&&this.getStateChangeCount()>20)return void(document.location.href=n.url);if(!this.checkCanNavigate()){if(t.emulated.pushState)return;var l=this.getLastState();return this.setPauseState(!0),l?t.pushState(l.id,l.title,l.url):t.back(),void this.setPauseState(!1)}if(this.setLastState(n),o.length<a.length&&(i="Content",a=["Content"],o=this._findFragments(a)),this.trigger("beforestatechange",{state:n,element:o}),s["X-Pjax"]=i,"undefined"!=typeof n.data.__forceReferer){var d=n.data.__forceReferer;try{d=decodeURI(d)}catch(c){}finally{s["X-Backurl"]=encodeURI(d)}}o.addClass("loading");var u=$.ajax({headers:s,url:n.url,complete:function(){e.setStateChangeXHR(null),o.removeClass("loading")},success:function(t,i,s){var a=e.handleAjaxResponse(t,i,s,n);e.trigger("afterstatechange",{data:t,status:i,xhr:s,element:a,state:n})}});this.setStateChangeXHR(u)}},loadFragment:function(e,t){var n,i=this,s={},a=$("base").attr("href"),o=this.getFragmentXHR();return"undefined"!=typeof o[t]&&null!==o[t]&&(o[t].abort(),o[t]=null),e=$.path.isAbsoluteUrl(e)?e:$.path.makeUrlAbsolute(e,a),s["X-Pjax"]=t,n=$.ajax({headers:s,url:e,success:function(e,t,n){var s=i.handleAjaxResponse(e,t,n,null);i.trigger("afterloadfragment",{data:e,status:t,xhr:n,elements:s})},error:function(e,t,n){i.trigger("loadfragmenterror",{xhr:e,status:t,error:n})},complete:function(){var e=i.getFragmentXHR();"undefined"!=typeof e[t]&&null!==e[t]&&(e[t]=null)}}),o[t]=n,n},handleAjaxResponse:function(e,t,n,i){var s,a,o,r;if(n.getResponseHeader("X-Reload")&&n.getResponseHeader("X-ControllerURL")){var l=$("base").attr("href"),d=n.getResponseHeader("X-ControllerURL"),s=$.path.isAbsoluteUrl(d)?d:$.path.makeUrlAbsolute(d,l);return void(document.location.href=s)}if(e){var c=n.getResponseHeader("X-Title");c&&(document.title=decodeURIComponent(c.replace(/\+/g," ")));var u,h={};n.getResponseHeader("Content-Type").match(/^((text)|(application))\/json[ \t]*;?/i)?h=e:(o=document.createDocumentFragment(),jQuery.clean([e],document,o,[]),r=$(jQuery.merge([],o.childNodes)),a="Content",r.is("form")&&!r.is("[data-pjax-fragment~=Content]")&&(a="CurrentForm"),h[a]=r),this.setRedrawSuppression(!0);try{$.each(h,function(e,t){var n=$("[data-pjax-fragment]").filter(function(){return-1!=$.inArray(e,$(this).data("pjaxFragment").split(" "))}),i=$(t);if(u?u.add(i):u=i,i.find(".cms-container").length)throw'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops';var s=n.attr("style"),a=n.parent(),o="undefined"!=typeof a.data("jlayout"),r=["east","west","center","north","south","column-hidden"],l=n.attr("class"),d=[];l&&(d=$.grep(l.split(" "),function(e){return $.inArray(e,r)>=0})),i.removeClass(r.join(" ")).addClass(d.join(" ")),s&&i.attr("style",s);var c=i.find("style").detach();c.length&&$(document).find("head").append(c),n.replaceWith(i),!a.is(".cms-container")&&o&&a.layout()});var f=u.filter("form");f.hasClass("cms-tabset")&&f.removeClass("cms-tabset").addClass("cms-tabset")}finally{this.setRedrawSuppression(!1)}return this.redraw(),this.restoreTabState(i&&"undefined"!=typeof i.data.tabState?i.data.tabState:null),u}},_findFragments:function(e){return $("[data-pjax-fragment]").filter(function(){var t,n=$(this).data("pjaxFragment").split(" ");for(t in e)if(-1!=$.inArray(e[t],n))return!0;return!1})},refresh:function(){$(window).trigger("statechange"),$(this).redraw()},saveTabState:function(){if("undefined"!=typeof window.sessionStorage&&null!==window.sessionStorage){var e=[],t=this._tabStateUrl();if(this.find(".cms-tabset,.ss-tabset").each(function(t,n){var i=$(n).attr("id");i&&$(n).data("tabs")&&($(n).data("ignoreTabState")||$(n).getIgnoreTabState()||e.push({id:i,selected:$(n).tabs("option","selected")}))}),e){var n="tabs-"+t;try{window.sessionStorage.setItem(n,JSON.stringify(e))}catch(i){if(i.code===DOMException.QUOTA_EXCEEDED_ERR&&0===window.sessionStorage.length)return;throw i}}}},restoreTabState:function(e){var t=this,n=this._tabStateUrl(),i="undefined"!=typeof window.sessionStorage&&window.sessionStorage,s=i?window.sessionStorage.getItem("tabs-"+n):null,a=s?JSON.parse(s):!1;this.find(".cms-tabset, .ss-tabset").each(function(){var n,i,s=$(this),o=s.attr("id"),r=s.find(".ss-tabs-force-active");s.data("tabs")&&(s.tabs("refresh"),r.length?n=r.index():e&&e[o]?(i=s.find(e[o].tabSelector),i.length&&(n=i.index())):a&&$.each(a,function(e,t){s.is("#"+t.id)&&(n=t.selected)}),null!==n&&(s.tabs("option","active",n),t.trigger("tabstaterestored")))})},clearTabState:function(e){if("undefined"!=typeof window.sessionStorage){var t=window.sessionStorage;if(e)t.removeItem("tabs-"+e);else for(var n=0;n<t.length;n++)t.key(n).match(/^tabs-/)&&t.removeItem(t.key(n))}},clearCurrentTabState:function(){this.clearTabState(this._tabStateUrl())},_tabStateUrl:function(){return History.getState().url.replace(/\?.*/,"").replace(/#.*/,"").replace($("base").attr("href"),"")},showLoginDialog:function(){var e=$("body").data("member-tempid"),t=$(".leftandmain-logindialog"),n="CMSSecurity/login";t.length&&t.remove(),n=$.path.addSearchParams(n,{tempid:e,BackURL:window.location.href}),t=$('<div class="leftandmain-logindialog"></div>'),t.attr("id",(new Date).getTime()),t.data("url",n),$("body").append(t)}}),$(".leftandmain-logindialog").entwine({onmatch:function(){this._super(),this.ssdialog({iframeUrl:this.data("url"),dialogClass:"leftandmain-logindialog-dialog",autoOpen:!0,minWidth:500,maxWidth:500,minHeight:370,maxHeight:400,closeOnEscape:!1,open:function(){$(".ui-widget-overlay").addClass("leftandmain-logindialog-overlay")},close:function(){$(".ui-widget-overlay").removeClass("leftandmain-logindialog-overlay")}})},onunmatch:function(){this._super()},open:function(){this.ssdialog("open")},close:function(){this.ssdialog("close")},toggle:function(e){this.is(":visible")?this.close():this.open()},reauthenticate:function(e){"undefined"!=typeof e.SecurityID&&$(":input[name=SecurityID]").val(e.SecurityID),"undefined"!=typeof e.TempID&&$("body").data("member-tempid",e.TempID),this.close()}}),$("form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading").entwine({onmatch:function(){this.append('<div class="cms-content-loading-overlay ui-widget-overlay-light"></div><div class="cms-content-loading-spinner"></div>'),this._super()},onunmatch:function(){this.find(".cms-content-loading-overlay,.cms-content-loading-spinner").remove(),this._super()}}),$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({onadd:function(){this.addClass("ss-ui-button"),this.data("button")||this.button(),this._super()},onremove:function(){this.data("button")&&this.button("destroy"),this._super()}}),$(".cms .cms-panel-link").entwine({onclick:function(e){if($(this).hasClass("external-link"))return void e.stopPropagation();var t=this.attr("href"),n=t&&!t.match(/^#/)?t:this.data("href"),i={pjax:this.data("pjaxTarget")};$(".cms-container").loadPanel(n,null,i),e.preventDefault()}}),$(".cms .ss-ui-button-ajax").entwine({onclick:function onclick(e){$(this).removeClass("ui-button-text-only"),$(this).addClass("ss-ui-button-loading ui-button-text-icons");var loading=$(this).find(".ss-ui-loading-icon");loading.length<1&&(loading=$("<span></span>").addClass("ss-ui-loading-icon ui-button-icon-primary ui-icon"),$(this).prepend(loading)),loading.show();var href=this.attr("href"),url=href?href:this.data("href");jQuery.ajax({url:url,complete:function complete(xmlhttp,status){var msg=xmlhttp.getResponseHeader("X-Status")?xmlhttp.getResponseHeader("X-Status"):xmlhttp.responseText;try{"undefined"!=typeof msg&&null!==msg&&eval(msg)}catch(e){}loading.hide(),$(".cms-container").refresh(),$(this).removeClass("ss-ui-button-loading ui-button-text-icons"),$(this).addClass("ui-button-text-only")},dataType:"html"}),e.preventDefault()}}),$(".cms .ss-ui-dialog-link").entwine({UUID:null,onmatch:function(){this._super(),this.setUUID((new Date).getTime())},onunmatch:function(){this._super()},onclick:function(){this._super();var e="ss-ui-dialog-"+this.getUUID(),t=$("#"+e);t.length||(t=$('<div class="ss-ui-dialog" id="'+e+'" />'),$("body").append(t));var n=this.data("popupclass")?this.data("popupclass"):"";return t.ssdialog({iframeUrl:this.attr("href"),autoOpen:!0,dialogExtraClass:n}),!1}}),$(".cms-content .Actions").entwine({onmatch:function(){this.find(".ss-ui-button").click(function(){var e=this.form;e&&(e.clickedButton=this,setTimeout(function(){e.clickedButton=null},10))}),this.redraw(),this._super()},onunmatch:function(){this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0)),this.contents().filter(function(){return 3==this.nodeType&&!/\S/.test(this.nodeValue)}).remove(),this.find(".ss-ui-button").each(function(){$(this).data("button")||$(this).button()}),this.find(".ss-ui-buttonset").buttonset()}}),$(".cms .field.date input.text").entwine({onmatch:function(){var e=$(this).parents(".field.date:first"),t=e.data();return t.showcalendar?(t.showOn="button",t.locale&&$.datepicker.regional[t.locale]&&(t=$.extend(t,$.datepicker.regional[t.locale],{})),$(this).datepicker(t),void this._super()):void this._super()},onunmatch:function(){this._super()}}),$(".cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown").entwine({onmatch:function(){return this.is(".no-chzn")?void this._super():(this.data("placeholder")||this.data("placeholder"," "),this.removeClass("has-chzn chzn-done"),this.siblings(".chzn-container").remove(),applyChosen(this),void this._super())},onunmatch:function(){this._super()}}),$(".cms-panel-layout").entwine({redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0))}}),$(".cms .ss-gridfield").entwine({showDetailView:function(e){var t=window.location.search.replace(/^\?/,"");t&&(e=$.path.addSearchParams(e,t)),$(".cms-container").loadPanel(e)}}),$(".cms-search-form").entwine({onsubmit:function(e){var t,n;t=this.find(":input:not(:submit)").filter(function(){var e=$.grep($(this).fieldValue(),function(e){return e});return e.length}),n=this.attr("action"),t.length&&(n=$.path.addSearchParams(n,t.serialize()));var i=this.closest(".cms-container");return i.find(".cms-edit-form").tabs("select",0),i.loadPanel(n,"",{},!0),!1}}),$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({onclick:function(e){e.preventDefault();var t=$(this).parents("form");t.clearForm(),t.find(".dropdown select").prop("selectedIndex",0).trigger("liszt:updated"),t.submit()}}),window._panelDeferredCache={},$(".cms-panel-deferred").entwine({onadd:function(){this._super(),this.redraw()},onremove:function(){window.debug&&console.log("saving",this.data("url"),this),this.data("deferredNoCache")||(window._panelDeferredCache[this.data("url")]=this.html()),this._super()},redraw:function(){window.debug&&console.log("redraw",this.attr("class"),this.get(0));var e=this,t=this.data("url");if(!t)throw'Elements of class .cms-panel-deferred need a "data-url" attribute';this._super(),this.children().length||(this.data("deferredNoCache")||"undefined"==typeof window._panelDeferredCache[t]?(this.addClass("loading"),$.ajax({url:t,complete:function(){e.removeClass("loading")},success:function(t,n,i){e.html(t)}})):this.html(window._panelDeferredCache[t]))}}),$(".cms-tabset").entwine({onadd:function(){this.redrawTabs(),this._super()},onremove:function(){this.data("tabs")&&this.tabs("destroy"),this._super()},redrawTabs:function(){this.rewriteHashlinks();var e=(this.attr("id"),this.find("ul:first .ui-tabs-active"));this.data("uiTabs")||this.tabs({active:-1!=e.index()?e.index():0,beforeLoad:function(e,t){return!1},activate:function(e,t){t.newTab&&t.newTab.find(".cms-panel-link").click();var n=$(this).closest("form").find(".Actions");$(t.newTab).closest("li").hasClass("readonly")?n.fadeOut():n.show()}})},rewriteHashlinks:function(){$(this).find("ul a").each(function(){if($(this).attr("href")){var e=$(this).attr("href").match(/#.*/);e&&$(this).attr("href",document.location.href.replace(/#.*/,"")+e[0])}})}}),$("#filters-button").entwine({onmatch:function(){this._super(),this.data("collapsed",!0),this.data("animating",!1)},onunmatch:function(){this._super()},showHide:function(){var e=this,t=$(".cms-content-filters").first(),n=this.data("collapsed");this.data("animating")||(this.toggleClass("active"),this.data("animating",!0),t[n?"slideDown":"slideUp"]({complete:function(){e.data("collapsed",!n),e.data("animating",!1)}}))},onclick:function(){this.showHide()}})});var statusMessage=function(e,t){e=jQuery("<div/>").text(e).html(),jQuery.noticeAdd({text:e,type:t,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},errorMessage=function(e){jQuery.noticeAdd({text:e,type:"error",stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}},{jQuery:"jQuery"}],14:[function(e,t,n){"use strict";e("../../src/LeftAndMain.Layout.js"),e("../../src/LeftAndMain.js"),e("../../src/LeftAndMain.ActionTabSet.js"),e("../../src/LeftAndMain.Panel.js"),e("../../src/LeftAndMain.Tree.js"),e("../../src/LeftAndMain.Content.js"),e("../../src/LeftAndMain.EditForm.js"),e("../../src/LeftAndMain.Menu.js"),e("../../src/LeftAndMain.Preview.js"),e("../../src/LeftAndMain.BatchActions.js"),e("../../src/LeftAndMain.FieldHelp.js"),e("../../src/LeftAndMain.FieldDescriptionToggle.js"),e("../../src/LeftAndMain.TreeDropdownField.js")},{"../../src/LeftAndMain.ActionTabSet.js":1,"../../src/LeftAndMain.BatchActions.js":2,
"../../src/LeftAndMain.Content.js":3,"../../src/LeftAndMain.EditForm.js":4,"../../src/LeftAndMain.FieldDescriptionToggle.js":5,"../../src/LeftAndMain.FieldHelp.js":6,"../../src/LeftAndMain.Layout.js":7,"../../src/LeftAndMain.Menu.js":8,"../../src/LeftAndMain.Panel.js":9,"../../src/LeftAndMain.Preview.js":10,"../../src/LeftAndMain.Tree.js":11,"../../src/LeftAndMain.TreeDropdownField.js":12,"../../src/LeftAndMain.js":13}]},{},[14]);

20
admin/javascript/dist/bundle-lib.js vendored Normal file
View File

@ -0,0 +1,20 @@
require=function e(t,i,n){function s(r,o){if(!i[r]){if(!t[r]){var l="function"==typeof require&&require;if(!o&&l)return l(r,!0);if(a)return a(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var c=i[r]={exports:{}};t[r][0].call(c.exports,function(e){var i=t[r][1][e];return s(i?i:e)},c,c.exports,e,t,i,n)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)s(n[r]);return s}({1:[function(e,t,i){"use strict";e("../../../../thirdparty/jquery/jquery.js"),e("../../../../thirdparty/jquery-ondemand/jquery.ondemand.js"),e("../../src/sspath.js"),e("../../../../thirdparty/jquery-ui/jquery-ui.js"),e("../../../../thirdparty/json-js/json2.js"),e("../../../../thirdparty/jquery-entwine/dist/jquery.entwine-dist.js"),e("../../../../thirdparty/jquery-cookie/jquery.cookie.js"),e("../../../../thirdparty/jquery-query/jquery.query.js"),e("../../../../thirdparty/jquery-form/jquery.form.js"),e("../../../thirdparty/jquery-notice/jquery.notice.js"),e("../../../thirdparty/jsizes/lib/jquery.sizes.js"),e("../../../thirdparty/jlayout/lib/jlayout.border.js"),e("../../../thirdparty/jlayout/lib/jquery.jlayout.js"),e("../../../thirdparty/history-js/scripts/uncompressed/history.js"),e("../../../thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js"),e("../../../thirdparty/history-js/scripts/uncompressed/history.html4.js"),e("../../../../thirdparty/jstree/jquery.jstree.js"),e("../../../thirdparty/chosen/chosen/chosen.jquery.js"),e("../../../thirdparty/jquery-hoverIntent/jquery.hoverIntent.js"),e("../../../../thirdparty/jquery-changetracker/lib/jquery.changetracker.js"),e("../../../../javascript/src/TreeDropdownField.js"),e("../../../../javascript/src/DateField.js"),e("../../../../javascript/src/HtmlEditorField.js"),e("../../../../javascript/src/TabSet.js"),e("../../src/ssui.core.js"),e("../../../../javascript/src/GridField.js")},{"../../../../javascript/src/DateField.js":13,"../../../../javascript/src/GridField.js":14,"../../../../javascript/src/HtmlEditorField.js":15,"../../../../javascript/src/TabSet.js":16,"../../../../javascript/src/TreeDropdownField.js":17,"../../../../thirdparty/jquery-changetracker/lib/jquery.changetracker.js":18,"../../../../thirdparty/jquery-cookie/jquery.cookie.js":19,"../../../../thirdparty/jquery-entwine/dist/jquery.entwine-dist.js":20,"../../../../thirdparty/jquery-form/jquery.form.js":21,"../../../../thirdparty/jquery-ondemand/jquery.ondemand.js":22,"../../../../thirdparty/jquery-query/jquery.query.js":23,"../../../../thirdparty/jquery-ui/jquery-ui.js":24,"../../../../thirdparty/jquery/jquery.js":25,"../../../../thirdparty/json-js/json2.js":26,"../../../../thirdparty/jstree/jquery.jstree.js":27,"../../../thirdparty/chosen/chosen/chosen.jquery.js":4,"../../../thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js":5,"../../../thirdparty/history-js/scripts/uncompressed/history.html4.js":6,"../../../thirdparty/history-js/scripts/uncompressed/history.js":7,"../../../thirdparty/jlayout/lib/jlayout.border.js":8,"../../../thirdparty/jlayout/lib/jquery.jlayout.js":9,"../../../thirdparty/jquery-hoverIntent/jquery.hoverIntent.js":10,"../../../thirdparty/jquery-notice/jquery.notice.js":11,"../../../thirdparty/jsizes/lib/jquery.sizes.js":12,"../../src/sspath.js":2,"../../src/ssui.core.js":3}],2:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=n(s),r=((0,a["default"])(window),(0,a["default"])("html"),(0,a["default"])("head"),{urlParseRE:/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,parseUrl:function(e){if("object"===a["default"].type(e))return e;var t=r.urlParseRE.exec(e||"")||[];return{href:t[0]||"",hrefNoHash:t[1]||"",hrefNoSearch:t[2]||"",domain:t[3]||"",protocol:t[4]||"",doubleSlash:t[5]||"",authority:t[6]||"",username:t[8]||"",password:t[9]||"",host:t[10]||"",hostname:t[11]||"",port:t[12]||"",pathname:t[13]||"",directory:t[14]||"",filename:t[15]||"",search:t[16]||"",hash:t[17]||""}},makePathAbsolute:function(e,t){if(e&&"/"===e.charAt(0))return e;e=e||"",t=t?t.replace(/^\/|(\/[^\/]*|[^\/]+)$/g,""):"";for(var i=t?t.split("/"):[],n=e.split("/"),s=0;s<n.length;s++){var a=n[s];switch(a){case".":break;case"..":i.length&&i.pop();break;default:i.push(a)}}return"/"+i.join("/")},isSameDomain:function(e,t){return r.parseUrl(e).domain===r.parseUrl(t).domain},isRelativeUrl:function(e){return""===r.parseUrl(e).protocol},isAbsoluteUrl:function(e){return""!==r.parseUrl(e).protocol},makeUrlAbsolute:function(e,t){if(!r.isRelativeUrl(e))return e;var i=r.parseUrl(e),n=r.parseUrl(t),s=i.protocol||n.protocol,a=i.protocol?i.doubleSlash:i.doubleSlash||n.doubleSlash,o=i.authority||n.authority,l=""!==i.pathname,h=r.makePathAbsolute(i.pathname||n.filename,n.pathname),c=i.search||!l&&n.search||"",d=i.hash;return s+a+o+h+c+d},addSearchParams:function(e,t){var i=r.parseUrl(e),t="string"==typeof t?r.convertSearchToArray(t):t,n=a["default"].extend(r.convertSearchToArray(i.search),t);return i.hrefNoSearch+"?"+a["default"].param(n)+(i.hash||"")},getSearchParams:function(e){var t=r.parseUrl(e);return r.convertSearchToArray(t.search)},convertSearchToArray:function(e){var t,i,n={},e=e.replace(/^\?/,""),s=e?e.split("&"):[];for(t=0;t<s.length;t++)i=s[t].split("="),n[i[0]]=i[1];return n},convertUrlToDataUrl:function(e){var t=r.parseUrl(e);return r.isEmbeddedPage(t)?t.hash.split(dialogHashKey)[0].replace(/^#/,""):r.isSameDomain(t,document)?t.hrefNoHash.replace(document.domain,""):e},get:function(e){return void 0===e&&(e=location.hash),r.stripHash(e).replace(/[^\/]*\.[^\/*]+$/,"")},getFilePath:function(e){var t="&"+a["default"].mobile.subPageUrlKey;return e&&e.split(t)[0].split(dialogHashKey)[0]},set:function(e){location.hash=e},isPath:function(e){return/\//.test(e)},clean:function(e){return e.replace(document.domain,"")},stripHash:function(e){return e.replace(/^#/,"")},cleanHash:function(e){return r.stripHash(e.replace(/\?.*$/,"").replace(dialogHashKey,""))},isExternal:function(e){var t=r.parseUrl(e);return t.protocol&&t.domain!==document.domain?!0:!1},hasProtocol:function(e){return/^(:?\w+:)/.test(e)}});a["default"].path=r},{jQuery:"jQuery"}],3:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("jQuery"),a=n(s);a["default"].widget("ssui.button",a["default"].ui.button,{options:{alternate:{icon:null,text:null},showingAlternate:!1},toggleAlternate:function(){this._trigger("ontogglealternate")!==!1&&(this.options.alternate.icon||this.options.alternate.text)&&(this.options.showingAlternate=!this.options.showingAlternate,this.refresh())},_refreshAlternate:function(){this._trigger("beforerefreshalternate"),(this.options.alternate.icon||this.options.alternate.text)&&(this.options.showingAlternate?(this.element.find(".ui-button-icon-primary").hide(),this.element.find(".ui-button-text").hide(),this.element.find(".ui-button-icon-alternate").show(),this.element.find(".ui-button-text-alternate").show()):(this.element.find(".ui-button-icon-primary").show(),this.element.find(".ui-button-text").show(),this.element.find(".ui-button-icon-alternate").hide(),this.element.find(".ui-button-text-alternate").hide()),this._trigger("afterrefreshalternate"))},_resetButton:function(){var e=this.element.data("icon-primary"),t=this.element.data("icon-secondary");e||(e=this.element.data("icon")),e&&(this.options.icons.primary="btn-icon-"+e),t&&(this.options.icons.secondary="btn-icon-"+t),a["default"].ui.button.prototype._resetButton.call(this),this.options.alternate.text||(this.options.alternate.text=this.element.data("text-alternate")),this.options.alternate.icon||(this.options.alternate.icon=this.element.data("icon-alternate")),this.options.showingAlternate||(this.options.showingAlternate=this.element.hasClass("ss-ui-alternate")),this.options.alternate.icon&&this.buttonElement.append("<span class='ui-button-icon-alternate ui-button-icon-primary ui-icon btn-icon-"+this.options.alternate.icon+"'></span>"),this.options.alternate.text&&this.buttonElement.append("<span class='ui-button-text-alternate ui-button-text'>"+this.options.alternate.text+"</span>"),this._refreshAlternate()},refresh:function(){a["default"].ui.button.prototype.refresh.call(this),this._refreshAlternate()},destroy:function(){this.element.find(".ui-button-text-alternate").remove(),this.element.find(".ui-button-icon-alternate").remove(),a["default"].ui.button.prototype.destroy.call(this)}}),a["default"].widget("ssui.ssdialog",a["default"].ui.dialog,{options:{iframeUrl:"",reloadOnOpen:!0,dialogExtraClass:"",modal:!0,bgiframe:!0,autoOpen:!1,autoPosition:!0,minWidth:500,maxWidth:800,minHeight:300,maxHeight:700,widthRatio:.8,heightRatio:.8,resizable:!1},_create:function(){a["default"].ui.dialog.prototype._create.call(this);var e=this,t=(0,a["default"])('<iframe marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto"></iframe>');t.bind("load",function(i){"about:blank"!=(0,a["default"])(this).attr("src")&&(t.addClass("loaded").show(),e._resizeIframe(),e.uiDialog.removeClass("loading"))}).hide(),this.options.dialogExtraClass&&this.uiDialog.addClass(this.options.dialogExtraClass),this.element.append(t),this.options.iframeUrl&&this.element.css("overflow","hidden")},open:function(){a["default"].ui.dialog.prototype.open.call(this);var e=this,t=this.element.children("iframe");!this.options.iframeUrl||t.hasClass("loaded")&&!this.options.reloadOnOpen||(t.hide(),t.attr("src",this.options.iframeUrl),this.uiDialog.addClass("loading")),(0,a["default"])(window).bind("resize.ssdialog",function(){e._resizeIframe()})},close:function(){a["default"].ui.dialog.prototype.close.call(this),this.uiDialog.unbind("resize.ssdialog"),(0,a["default"])(window).unbind("resize.ssdialog")},_resizeIframe:function(){var e,t,i={},n=this.element.children("iframe");this.options.widthRatio&&(e=(0,a["default"])(window).width()*this.options.widthRatio,this.options.minWidth&&e<this.options.minWidth?i.width=this.options.minWidth:this.options.maxWidth&&e>this.options.maxWidth?i.width=this.options.maxWidth:i.width=e),this.options.heightRatio&&(t=(0,a["default"])(window).height()*this.options.heightRatio,this.options.minHeight&&t<this.options.minHeight?i.height=this.options.minHeight:this.options.maxHeight&&t>this.options.maxHeight?i.height=this.options.maxHeight:i.height=t),jQuery.isEmptyObject(i)||(this._setOptions(i),n.attr("width",i.width-parseFloat(this.element.css("paddingLeft"))-parseFloat(this.element.css("paddingRight"))),n.attr("height",i.height-parseFloat(this.element.css("paddingTop"))-parseFloat(this.element.css("paddingBottom"))),this.options.autoPosition&&this._setOption("position",this.options.position))}}),a["default"].widget("ssui.titlebar",{_create:function(){this.originalTitle=this.element.attr("title");var e=this.options,t=e.title||this.originalTitle||"&nbsp;",i=a["default"].ui.dialog.getTitleId(this.element);this.element.parent().addClass("ui-dialog");var n=this.element.addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix");if(e.closeButton){var s=(0,a["default"])('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){s.addClass("ui-state-hover")},function(){s.removeClass("ui-state-hover")}).focus(function(){s.addClass("ui-state-focus")}).blur(function(){s.removeClass("ui-state-focus")}).mousedown(function(e){e.stopPropagation()}).appendTo(n);(this.uiDialogTitlebarCloseText=(0,a["default"])("<span/>")).addClass("ui-icon ui-icon-closethick").text(e.closeText).appendTo(s)}(0,a["default"])("<span/>").addClass("ui-dialog-title").attr("id",i).html(t).prependTo(n);n.find("*").add(n).disableSelection()},destroy:function(){this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),this.originalTitle&&this.element.attr("title",this.originalTitle)}}),a["default"].extend(a["default"].ssui.titlebar,{version:"0.0.1",options:{title:"",closeButton:!1,closeText:"close"},uuid:0,getTitleId:function(e){return"ui-dialog-title-"+(e.attr("id")||++this.uuid)}})},{jQuery:"jQuery"}],4:[function(e,t,i){(function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.name="SelectParser",e.prototype.add_node=function(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,i,n,s,a,r;for(t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),a=e.childNodes,r=[],n=0,s=a.length;s>n;n++)i=a[n],r.push(this.add_option(i,t,e.disabled));return r},e.prototype.add_option=function(e,t,i){return"OPTION"===e.nodeName.toUpperCase()?(""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:i===!0?i:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},e}(),e.select_to_array=function(t){var i,n,s,a,r;for(n=new e,r=t.childNodes,s=0,a=r.length;a>s;s++)i=r[s],n.add_node(i);return n.parsed},this.SelectParser=e}).call(window),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=null!=t?t:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.set_default_text(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.name="AbstractChosen",e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||1/0},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return t.blur_test()},100))},e.prototype.result_add_option=function(e){var t,i;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.push(e.classes),i=""!==e.style.cssText?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+i+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,i;switch(t=null!=(i=e.which)?i:e.keyCode,this.search_field_scale(),t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(e.preventDefault(),this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,i;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",i=Math.floor(Math.random()*e.length),t=e.substring(i,i+1)},e}(),t.AbstractChosen=e}.call(window),function(){var e,t,i,n,s={}.hasOwnProperty,a=function(e,t){function i(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e};n=this,e=jQuery,e.fn.extend({chosen:function(i){return e.browser.msie&&("6.0"===e.browser.version||"7.0"===e.browser.version&&7===document.documentMode)?this:this.each(function(n){var s;return s=e(this),s.hasClass("chzn-done")?void 0:s.data("chosen",new t(this,i))})}}),t=function(t){function s(){return s.__super__.constructor.apply(this,arguments)}return a(s,t),s.prototype.name="Chosen",s.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},s.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},s.prototype.set_up_html=function(){var t,n,s,a,r;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,t=e("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+(this.options.width||this.f_width)+"px;"}),this.is_multiple?t.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):t.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(t),this.container=e("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),a=this.rise_up(this.container,this.dropdown),n=a?-this.container.find(".chzn-drop").height():this.container.height(),s=this.container.width()-i(this.dropdown),this.dropdown.css({width:s+"px",top:n+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),r=s-i(this.search_container)-i(this.search_field),this.search_field.css({width:r+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},s.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){return e.container_mousedown(t)}),this.container.mouseup(function(t){return e.container_mouseup(t)}),this.container.mouseenter(function(t){return e.mouse_enter(t)}),this.container.mouseleave(function(t){return e.mouse_leave(t)}),this.search_results.mouseup(function(t){return e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){return e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){return e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){return e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){return e.container_mousedown(t)}),this.search_field.blur(function(t){return e.input_blur(t)}),this.search_field.keyup(function(t){return e.keyup_checker(t)}),this.search_field.keydown(function(t){return e.keydown_checker(t)}),this.search_field.focus(function(t){return e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){return e.choices_click(t)}):this.container.click(function(e){return e.preventDefault()})},s.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field()):(this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus",this.activate_action))},s.prototype.container_mousedown=function(t){var i;return this.is_disabled?void 0:(i=null!=t?e(t.target).hasClass("search-choice-close"):!1,t&&"mousedown"===t.type&&!this.results_showing&&t.stopPropagation(),this.pending_destroy_click||i?this.pending_destroy_click=!1:(this.active_field?this.is_multiple||!t||e(t.target)[0]!==this.selected_item[0]&&!e(t.target).parents("a.chzn-single").length||(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()))},s.prototype.container_mouseup=function(e){return"ABBR"!==e.target.nodeName||this.is_disabled?void 0:this.results_reset(e)},s.prototype.blur_test=function(e){return!this.active_field&&this.container.hasClass("chzn-container-active")?this.close_field():void 0},s.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},s.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},s.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},s.prototype.results_build=function(){var e,t,i,s,a;for(this.parsing=!0,this.results_data=n.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",a=this.results_data,i=0,s=a.length;s>i;i++)t=a[i],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},s.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},s.prototype.result_do_highlight=function(e){var t,i,n,s,a;if(e.length){if(this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),n=parseInt(this.search_results.css("maxHeight"),10),a=this.search_results.scrollTop(),s=n+a,i=this.result_highlight.position().top+this.search_results.scrollTop(),t=i+this.result_highlight.outerHeight(),t>=s)return this.search_results.scrollTop(t-n>0?t-n:0);if(a>i)return this.search_results.scrollTop(i)}},s.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},s.prototype.results_show=function(){var e,t,n;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),t=this.container.width()-i(this.dropdown),n=this.rise_up(this.container,this.dropdown),e=n?-this.container.find(".chzn-drop").height():this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.css("width",t-i(this.search_container)-i(this.search_field)+"px"),this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},s.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},s.prototype.set_tab_index=function(e){var t;return this.form_field_jq.attr("tabindex")?(t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)):void 0},s.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},s.prototype.search_results_mouseup=function(t){var i;return i=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first(),i.length?(this.result_highlight=i,this.result_select(t),this.search_field.focus()):void 0},s.prototype.search_results_mouseover=function(t){var i;return i=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first(),i?this.result_do_highlight(i):void 0},s.prototype.search_results_mouseout=function(t){return e(t.target).hasClass("active-result")?this.result_clear_highlight():void 0},s.prototype.choices_click=function(t){return t.preventDefault(),!this.active_field||e(t.target).hasClass("search-choice")||this.results_showing?void 0:this.results_show()},s.prototype.choice_build=function(t){var i,n,s,a=this;return i=this.container_id+"_c_"+t.array_index,this.choices+=1,n=t.disabled?'<li class="search-choice search-choice-disabled" id="'+i+'"><span>'+t.html+"</span></li>":'<li class="search-choice" id="'+i+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(n),s=e("#"+i).find("a").first(),s.click(function(e){return a.choice_destroy_link_click(e)})},s.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},s.prototype.choice_destroy=function(e){return this.result_deselect(e.attr("rel"))?(this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove()):void 0},s.prototype.results_reset=function(){return this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},s.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},s.prototype.result_select=function(e){var t,i,n,s;return this.result_highlight?(t=this.result_highlight,i=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),s=i.substr(i.lastIndexOf("_")+1),n=this.results_data[s],n.selected=!0,this.form_field.options[n.options_index].selected=!0,this.is_multiple?this.choice_build(n):(this.selected_item.find("span").first().text(n.text),this.allow_single_deselect&&this.single_deselect_control_build()),e.metaKey&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[n.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()):void 0},s.prototype.result_activate=function(e){return e.addClass("active-result")},s.prototype.result_deactivate=function(e){return e.removeClass("active-result")},s.prototype.result_deselect=function(t){var i,n;return n=this.results_data[t],this.form_field.options[n.options_index].disabled?!1:(n.selected=!1,this.form_field.options[n.options_index].selected=!1,i=e("#"+this.container_id+"_o_"+t),i.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[n.options_index].value}),this.search_field_scale(),!0)},s.prototype.single_deselect_control_build=function(){return this.allow_single_deselect&&this.selected_item.find("abbr").length<1?this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'):void 0},s.prototype.winnow_results=function(){var t,i,n,s,a,r,o,l,h,c,d,u,p,f,g,m,v,_;for(this.no_results_clear(),h=0,c=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),r=this.search_contains?"":"^",a=new RegExp(r+c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),_=this.results_data,f=0,m=_.length;m>f;f++)if(i=_[f],!i.disabled&&!i.empty)if(i.group)e("#"+i.dom_id).css("display","none");else if(!this.is_multiple||!i.selected){if(t=!1,l=i.dom_id,o=e("#"+l),a.test(i.html))t=!0,h+=1;else if((i.html.indexOf(" ")>=0||0===i.html.indexOf("["))&&(s=i.html.replace(/\[|\]/g,"").split(" "),s.length))for(g=0,v=s.length;v>g;g++)n=s[g],a.test(n)&&(t=!0,h+=1);t?(c.length?(d=i.html.search(p),u=i.html.substr(0,d+c.length)+"</em>"+i.html.substr(d+c.length),u=u.substr(0,d)+"<em>"+u.substr(d)):u=i.html,o.html(u),this.result_activate(o),null!=i.group_array_index&&e("#"+this.results_data[i.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&l===this.result_highlight.attr("id")&&this.result_clear_highlight(),
this.result_deactivate(o))}return 1>h&&c.length?this.no_results(c):this.winnow_results_set_highlight()},s.prototype.winnow_results_clear=function(){var t,i,n,s,a;for(this.search_field.val(""),i=this.search_results.find("li"),a=[],n=0,s=i.length;s>n;n++)t=i[n],t=e(t),t.hasClass("group-result")?a.push(t.css("display","auto")):this.is_multiple&&t.hasClass("result-selected")?a.push(void 0):a.push(this.result_activate(t));return a},s.prototype.winnow_results_set_highlight=function(){var e,t;return this.result_highlight||(t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first(),null==e)?void 0:this.result_do_highlight(e)},s.prototype.no_results=function(t){var i;return i=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),i.find("span").first().html(t),this.search_results.append(i)},s.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},s.prototype.keydown_arrow=function(){var t,i;return this.result_highlight?this.results_showing&&(i=this.result_highlight.nextAll("li.active-result").first(),i&&this.result_do_highlight(i)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t))),this.results_showing?void 0:this.results_show()},s.prototype.keyup_arrow=function(){var e;return this.results_showing||this.is_multiple?this.result_highlight?(e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},s.prototype.keydown_backstroke=function(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(e=this.search_container.siblings("li.search-choice").last(),e.length&&!e.hasClass("search-choice-disabled")?(this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},s.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},s.prototype.keydown_checker=function(e){var t,i;switch(t=null!=(i=e.which)?i:e.keyCode,this.search_field_scale(),8!==t&&this.pending_backstroke&&this.clear_backstroke(),t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},s.prototype.search_field_scale=function(){var t,i,n,s,a,r,o,l,h,c;if(this.is_multiple){for(n=0,l=0,r="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,c=o.length;c>h;h++)a=o[h],r+=a+":"+this.search_field.css(a)+";";return i=e("<div />",{style:r}),i.text(this.search_field.val()),e("body").append(i),l=i.width()+25,i.remove(),l>this.f_width-10&&(l=this.f_width-10),this.search_field.css({width:l+"px"}),s=this.rise_up(this.container,this.dropdown),t=s?-this.container.find(".chzn-drop").height():this.container.height(),this.dropdown.css({top:t+"px"})}},s.prototype.generate_random_id=function(){var t;for(t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();e("#"+t).length>0;)t+=this.generate_random_char();return t},s.prototype.rise_up=function(t,i){var n,s,a,r;return r=t.find("a.chzn-single"),r.length>0?(a=e(window).height()+e(document).scrollTop()-t.find("a").innerHeight(),s=r.offset().top,n=i.innerHeight(),s+n>a&&s-n>0?(t.addClass("chzn-with-rise"),!0):(t.removeClass("chzn-with-rise"),!1)):!1},s}(AbstractChosen),i=function(e){var t;return t=e.outerWidth()-e.width()},n.get_side_border_padding=i}.call(window)},{}],5:[function(e,t,i){!function(e,t){"use strict";var i=e.History=e.History||{},n=e.jQuery;if("undefined"!=typeof i.Adapter)throw new Error("History.js Adapter has already been loaded...");i.Adapter={bind:function(e,t,i){n(e).bind(t,i)},trigger:function(e,t,i){n(e).trigger(t,i)},extractEventData:function(e,i,n){var s=i&&i.originalEvent&&i.originalEvent[e]||n&&n[e]||t;return s},onDomLoad:function(e){n(e)}},"undefined"!=typeof i.init&&i.init()}(window)},{}],6:[function(e,t,i){!function(e,t){"use strict";var i=e.document,n=e.setTimeout||n,s=e.clearTimeout||s,a=e.setInterval||a,r=e.History=e.History||{};if("undefined"!=typeof r.initHtml4)throw new Error("History.js HTML4 Support has already been loaded...");r.initHtml4=function(){return"undefined"!=typeof r.initHtml4.initialized?!1:(r.initHtml4.initialized=!0,r.enabled=!0,r.savedHashes=[],r.isLastHash=function(e){var t,i=r.getHashByIndex();return t=e===i},r.isHashEqual=function(e,t){return e=encodeURIComponent(e).replace(/%25/g,"%"),t=encodeURIComponent(t).replace(/%25/g,"%"),e===t},r.saveHash=function(e){return r.isLastHash(e)?!1:(r.savedHashes.push(e),!0)},r.getHashByIndex=function(e){var t=null;return t="undefined"==typeof e?r.savedHashes[r.savedHashes.length-1]:0>e?r.savedHashes[r.savedHashes.length+e]:r.savedHashes[e]},r.discardedHashes={},r.discardedStates={},r.discardState=function(e,t,i){var n,s=r.getHashByState(e);return n={discardedState:e,backState:i,forwardState:t},r.discardedStates[s]=n,!0},r.discardHash=function(e,t,i){var n={discardedHash:e,backState:i,forwardState:t};return r.discardedHashes[e]=n,!0},r.discardedState=function(e){var t,i=r.getHashByState(e);return t=r.discardedStates[i]||!1},r.discardedHash=function(e){var t=r.discardedHashes[e]||!1;return t},r.recycleState=function(e){var t=r.getHashByState(e);return r.discardedState(e)&&delete r.discardedStates[t],!0},r.emulated.hashChange&&(r.hashChangeInit=function(){r.checkerFunction=null;var t,n,s,o,l="",h=Boolean(r.getHash());return r.isInternetExplorer()?(t="historyjs-iframe",n=i.createElement("iframe"),n.setAttribute("id",t),n.setAttribute("src","#"),n.style.display="none",i.body.appendChild(n),n.contentWindow.document.open(),n.contentWindow.document.close(),s="",o=!1,r.checkerFunction=function(){if(o)return!1;o=!0;var t=r.getHash(),i=r.getHash(n.contentWindow.document.location);return t!==l?(l=t,i!==t&&(s=i=t,n.contentWindow.document.open(),n.contentWindow.document.close(),n.contentWindow.document.location.hash=r.escapeHash(t)),r.Adapter.trigger(e,"hashchange")):i!==s&&(s=i,h&&""===i?r.back():r.setHash(i,!1)),o=!1,!0}):r.checkerFunction=function(){var t=r.getHash()||"";return t!==l&&(l=t,r.Adapter.trigger(e,"hashchange")),!0},r.intervalList.push(a(r.checkerFunction,r.options.hashChangeInterval)),!0},r.Adapter.onDomLoad(r.hashChangeInit)),r.emulated.pushState&&(r.onHashChange=function(t){var i,n=t&&t.newURL||r.getLocationHref(),s=r.getHashByUrl(n),a=null,o=null;return r.isLastHash(s)?(r.busy(!1),!1):(r.doubleCheckComplete(),r.saveHash(s),s&&r.isTraditionalAnchor(s)?(r.Adapter.trigger(e,"anchorchange"),r.busy(!1),!1):(a=r.extractState(r.getFullUrl(s||r.getLocationHref()),!0),r.isLastSavedState(a)?(r.busy(!1),!1):(o=r.getHashByState(a),(i=r.discardedState(a))?(r.getHashByIndex(-2)===r.getHashByState(i.forwardState)?r.back(!1):r.forward(!1),!1):(r.pushState(a.data,a.title,encodeURI(a.url),!1),!0))))},r.Adapter.bind(e,"hashchange",r.onHashChange),r.pushState=function(t,i,n,s){if(n=encodeURI(n).replace(/%25/g,"%"),r.getHashByUrl(n))throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).");if(s!==!1&&r.busy())return r.pushQueue({scope:r,callback:r.pushState,args:arguments,queue:s}),!1;r.busy(!0);var a=r.createStateObject(t,i,n),o=r.getHashByState(a),l=r.getState(!1),h=r.getHashByState(l),c=r.getHash(),d=r.expectedStateId==a.id;return r.storeState(a),r.expectedStateId=a.id,r.recycleState(a),r.setTitle(a),o===h?(r.busy(!1),!1):(r.saveState(a),d||r.Adapter.trigger(e,"statechange"),r.isHashEqual(o,c)||r.isHashEqual(o,r.getShortUrl(r.getLocationHref()))||r.setHash(o,!1),r.busy(!1),!0)},r.replaceState=function(t,i,n,s){if(n=encodeURI(n).replace(/%25/g,"%"),r.getHashByUrl(n))throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).");if(s!==!1&&r.busy())return r.pushQueue({scope:r,callback:r.replaceState,args:arguments,queue:s}),!1;r.busy(!0);var a=r.createStateObject(t,i,n),o=r.getHashByState(a),l=r.getState(!1),h=r.getHashByState(l),c=r.getStateByIndex(-2);return r.discardState(l,a,c),o===h?(r.storeState(a),r.expectedStateId=a.id,r.recycleState(a),r.setTitle(a),r.saveState(a),r.Adapter.trigger(e,"statechange"),r.busy(!1)):r.pushState(a.data,a.title,a.url,!1),!0}),void(r.emulated.pushState&&r.getHash()&&!r.emulated.hashChange&&r.Adapter.onDomLoad(function(){r.Adapter.trigger(e,"hashchange")})))},"undefined"!=typeof r.init&&r.init()}(window)},{}],7:[function(e,t,i){!function(e,t){"use strict";var i=e.console||t,n=e.document,s=e.navigator,a=e.sessionStorage||!1,r=e.setTimeout,o=e.clearTimeout,l=e.setInterval,h=e.clearInterval,c=e.JSON,d=e.alert,u=e.History=e.History||{},p=e.history;try{a.setItem("TEST","1"),a.removeItem("TEST")}catch(f){a=!1}if(c.stringify=c.stringify||c.encode,c.parse=c.parse||c.decode,"undefined"!=typeof u.init)throw new Error("History.js Core has already been loaded...");u.init=function(e){return"undefined"==typeof u.Adapter?!1:("undefined"!=typeof u.initCore&&u.initCore(),"undefined"!=typeof u.initHtml4&&u.initHtml4(),!0)},u.initCore=function(f){if("undefined"!=typeof u.initCore.initialized)return!1;if(u.initCore.initialized=!0,u.options=u.options||{},u.options.hashChangeInterval=u.options.hashChangeInterval||100,u.options.safariPollInterval=u.options.safariPollInterval||500,u.options.doubleCheckInterval=u.options.doubleCheckInterval||500,u.options.disableSuid=u.options.disableSuid||!1,u.options.storeInterval=u.options.storeInterval||1e3,u.options.busyDelay=u.options.busyDelay||250,u.options.debug=u.options.debug||!1,u.options.initialTitle=u.options.initialTitle||n.title,u.options.html4Mode=u.options.html4Mode||!1,u.options.delayInit=u.options.delayInit||!1,u.intervalList=[],u.clearAllIntervals=function(){var e,t=u.intervalList;if("undefined"!=typeof t&&null!==t){for(e=0;e<t.length;e++)h(t[e]);u.intervalList=null}},u.debug=function(){u.options.debug&&u.log.apply(u,arguments)},u.log=function(){var e,t,s,a,r,o=!("undefined"==typeof i||"undefined"==typeof i.log||"undefined"==typeof i.log.apply),l=n.getElementById("log");for(o?(a=Array.prototype.slice.call(arguments),e=a.shift(),"undefined"!=typeof i.debug?i.debug.apply(i,[e,a]):i.log.apply(i,[e,a])):e="\n"+arguments[0]+"\n",t=1,s=arguments.length;s>t;++t){if(r=arguments[t],"object"==typeof r&&"undefined"!=typeof c)try{r=c.stringify(r)}catch(h){}e+="\n"+r+"\n"}return l?(l.value+=e+"\n-----\n",l.scrollTop=l.scrollHeight-l.clientHeight):o||d(e),!0},u.getInternetExplorerMajorVersion=function(){var e=u.getInternetExplorerMajorVersion.cached="undefined"!=typeof u.getInternetExplorerMajorVersion.cached?u.getInternetExplorerMajorVersion.cached:function(){for(var e=3,t=n.createElement("div"),i=t.getElementsByTagName("i");(t.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->")&&i[0];);return e>4?e:!1}();return e},u.isInternetExplorer=function(){var e=u.isInternetExplorer.cached="undefined"!=typeof u.isInternetExplorer.cached?u.isInternetExplorer.cached:Boolean(u.getInternetExplorerMajorVersion());return e},u.options.html4Mode?u.emulated={pushState:!0,hashChange:!0}:u.emulated={pushState:!Boolean(e.history&&e.history.pushState&&e.history.replaceState&&!(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(s.userAgent)||/AppleWebKit\/5([0-2]|3[0-2])/i.test(s.userAgent))),hashChange:Boolean(!("onhashchange"in e||"onhashchange"in n)||u.isInternetExplorer()&&u.getInternetExplorerMajorVersion()<8)},u.enabled=!u.emulated.pushState,u.bugs={setHash:Boolean(!u.emulated.pushState&&"Apple Computer, Inc."===s.vendor&&/AppleWebKit\/5([0-2]|3[0-3])/.test(s.userAgent)),safariPoll:Boolean(!u.emulated.pushState&&"Apple Computer, Inc."===s.vendor&&/AppleWebKit\/5([0-2]|3[0-3])/.test(s.userAgent)),ieDoubleCheck:Boolean(u.isInternetExplorer()&&u.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(u.isInternetExplorer()&&u.getInternetExplorerMajorVersion()<7)},u.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},u.cloneObject=function(e){var t,i;return e?(t=c.stringify(e),i=c.parse(t)):i={},i},u.getRootUrl=function(){var e=n.location.protocol+"//"+(n.location.hostname||n.location.host);return n.location.port&&(e+=":"+n.location.port),e+="/"},u.getBaseHref=function(){var e=n.getElementsByTagName("base"),t=null,i="";return 1===e.length&&(t=e[0],i=t.href.replace(/[^\/]+$/,"")),i=i.replace(/\/+$/,""),i&&(i+="/"),i},u.getBaseUrl=function(){var e=u.getBaseHref()||u.getBasePageUrl()||u.getRootUrl();return e},u.getPageUrl=function(){var e,t=u.getState(!1,!1),i=(t||{}).url||u.getLocationHref();return e=i.replace(/\/+$/,"").replace(/[^\/]+$/,function(e,t,i){return/\./.test(e)?e:e+"/"})},u.getBasePageUrl=function(){var e=u.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(e,t,i){return/[^\/]$/.test(e)?"":e}).replace(/\/+$/,"")+"/";return e},u.getFullUrl=function(e,t){var i=e,n=e.substring(0,1);return t="undefined"==typeof t?!0:t,/[a-z]+\:\/\//.test(e)||(i="/"===n?u.getRootUrl()+e.replace(/^\/+/,""):"#"===n?u.getPageUrl().replace(/#.*/,"")+e:"?"===n?u.getPageUrl().replace(/[\?#].*/,"")+e:t?u.getBaseUrl()+e.replace(/^(\.\/)+/,""):u.getBasePageUrl()+e.replace(/^(\.\/)+/,"")),i.replace(/\#$/,"")},u.getShortUrl=function(e){var t=e,i=u.getBaseUrl(),n=u.getRootUrl();return u.emulated.pushState&&(t=t.replace(i,"")),t=t.replace(n,"/"),u.isTraditionalAnchor(t)&&(t="./"+t),t=t.replace(/^(\.\/)+/g,"./").replace(/\#$/,"")},u.getLocationHref=function(e){return e=e||n,e.URL===e.location.href?e.location.href:e.location.href===decodeURIComponent(e.URL)?e.URL:e.location.hash&&decodeURIComponent(e.location.href.replace(/^[^#]+/,""))===e.location.hash?e.location.href:-1==e.URL.indexOf("#")&&-1!=e.location.href.indexOf("#")?e.location.href:e.URL||e.location.href},u.store={},u.idToState=u.idToState||{},u.stateToId=u.stateToId||{},u.urlToId=u.urlToId||{},u.storedStates=u.storedStates||[],u.savedStates=u.savedStates||[],u.normalizeStore=function(){u.store.idToState=u.store.idToState||{},u.store.urlToId=u.store.urlToId||{},u.store.stateToId=u.store.stateToId||{}},u.getState=function(e,t){"undefined"==typeof e&&(e=!0),"undefined"==typeof t&&(t=!0);var i=u.getLastSavedState();return!i&&t&&(i=u.createStateObject()),e&&(i=u.cloneObject(i),i.url=i.cleanUrl||i.url),i},u.getIdByState=function(e){var t,i=u.extractId(e.url);if(!i)if(t=u.getStateString(e),"undefined"!=typeof u.stateToId[t])i=u.stateToId[t];else if("undefined"!=typeof u.store.stateToId[t])i=u.store.stateToId[t];else{for(;;)if(i=(new Date).getTime()+String(Math.random()).replace(/\D/g,""),"undefined"==typeof u.idToState[i]&&"undefined"==typeof u.store.idToState[i])break;u.stateToId[t]=i,u.idToState[i]=e}return i},u.normalizeState=function(e){var t,i;return e&&"object"==typeof e||(e={}),"undefined"!=typeof e.normalized?e:(e.data&&"object"==typeof e.data||(e.data={}),t={},t.normalized=!0,t.title=e.title||"",t.url=u.getFullUrl(e.url?decodeURIComponent(e.url):u.getLocationHref()),t.hash=u.getShortUrl(t.url),t.data=u.cloneObject(e.data),t.id=u.getIdByState(t),t.cleanUrl=t.url.replace(/\??\&_suid.*/,""),t.url=t.cleanUrl,i=!u.isEmptyObject(t.data),(t.title||i)&&u.options.disableSuid!==!0&&(t.hash=u.getShortUrl(t.url).replace(/\??\&_suid.*/,""),/\?/.test(t.hash)||(t.hash+="?"),t.hash+="&_suid="+t.id),t.hashedUrl=u.getFullUrl(t.hash),(u.emulated.pushState||u.bugs.safariPoll)&&u.hasUrlDuplicate(t)&&(t.url=t.hashedUrl),t)},u.createStateObject=function(e,t,i){var n={data:e,title:t,url:i};return n=u.normalizeState(n)},u.getStateById=function(e){e=String(e);var i=u.idToState[e]||u.store.idToState[e]||t;return i},u.getStateString=function(e){var t,i,n;return t=u.normalizeState(e),i={data:t.data,title:e.title,url:e.url},n=c.stringify(i)},u.getStateId=function(e){var t,i;return t=u.normalizeState(e),i=t.id},u.getHashByState=function(e){var t,i;return t=u.normalizeState(e),i=t.hash},u.extractId=function(e){var t,i,n,s;return s=-1!=e.indexOf("#")?e.split("#")[0]:e,i=/(.*)\&_suid=([0-9]+)$/.exec(s),n=i?i[1]||e:e,t=i?String(i[2]||""):"",t||!1},u.isTraditionalAnchor=function(e){var t=!/[\/\?\.]/.test(e);return t},u.extractState=function(e,t){var i,n,s=null;return t=t||!1,i=u.extractId(e),i&&(s=u.getStateById(i)),s||(n=u.getFullUrl(e),i=u.getIdByUrl(n)||!1,i&&(s=u.getStateById(i)),s||!t||u.isTraditionalAnchor(e)||(s=u.createStateObject(null,null,n))),s},u.getIdByUrl=function(e){var i=u.urlToId[e]||u.store.urlToId[e]||t;return i},u.getLastSavedState=function(){return u.savedStates[u.savedStates.length-1]||t},u.getLastStoredState=function(){return u.storedStates[u.storedStates.length-1]||t},u.hasUrlDuplicate=function(e){var t,i=!1;return t=u.extractState(e.url),i=t&&t.id!==e.id},u.storeState=function(e){return u.urlToId[e.url]=e.id,u.storedStates.push(u.cloneObject(e)),e},u.isLastSavedState=function(e){var t,i,n,s=!1;return u.savedStates.length&&(t=e.id,i=u.getLastSavedState(),n=i.id,s=t===n),s},u.saveState=function(e){return u.isLastSavedState(e)?!1:(u.savedStates.push(u.cloneObject(e)),!0)},u.getStateByIndex=function(e){var t=null;return t="undefined"==typeof e?u.savedStates[u.savedStates.length-1]:0>e?u.savedStates[u.savedStates.length+e]:u.savedStates[e]},u.getCurrentIndex=function(){var e=null;return e=u.savedStates.length<1?0:u.savedStates.length-1},u.getHash=function(e){var t,i=u.getLocationHref(e);return t=u.getHashByUrl(i)},u.unescapeHash=function(e){var t=u.normalizeHash(e);return t=decodeURIComponent(t)},u.normalizeHash=function(e){var t=e.replace(/[^#]*#/,"").replace(/#.*/,"");return t},u.setHash=function(e,t){var i,s;return t!==!1&&u.busy()?(u.pushQueue({scope:u,callback:u.setHash,args:arguments,queue:t}),!1):(u.busy(!0),i=u.extractState(e,!0),i&&!u.emulated.pushState?u.pushState(i.data,i.title,i.url,!1):u.getHash()!==e&&(u.bugs.setHash?(s=u.getPageUrl(),u.pushState(null,null,s+"#"+e,!1)):n.location.hash=e),u)},u.escapeHash=function(t){var i=u.normalizeHash(t);return i=e.encodeURIComponent(i),u.bugs.hashEscape||(i=i.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),i},u.getHashByUrl=function(e){var t=String(e).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return t=u.unescapeHash(t)},u.setTitle=function(e){var t,i=e.title;i||(t=u.getStateByIndex(0),t&&t.url===e.url&&(i=t.title||u.options.initialTitle));try{n.getElementsByTagName("title")[0].innerHTML=i.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(s){}return n.title=i,u},u.queues=[],u.busy=function(e){if("undefined"!=typeof e?u.busy.flag=e:"undefined"==typeof u.busy.flag&&(u.busy.flag=!1),!u.busy.flag){o(u.busy.timeout);var t=function(){var e,i,n;if(!u.busy.flag)for(e=u.queues.length-1;e>=0;--e)i=u.queues[e],0!==i.length&&(n=i.shift(),u.fireQueueItem(n),u.busy.timeout=r(t,u.options.busyDelay))};u.busy.timeout=r(t,u.options.busyDelay)}return u.busy.flag},u.busy.flag=!1,u.fireQueueItem=function(e){return e.callback.apply(e.scope||u,e.args||[])},u.pushQueue=function(e){return u.queues[e.queue||0]=u.queues[e.queue||0]||[],u.queues[e.queue||0].push(e),u},u.queue=function(e,t){return"function"==typeof e&&(e={callback:e}),"undefined"!=typeof t&&(e.queue=t),u.busy()?u.pushQueue(e):u.fireQueueItem(e),u},u.clearQueue=function(){return u.busy.flag=!1,u.queues=[],u},u.stateChanged=!1,u.doubleChecker=!1,u.doubleCheckComplete=function(){return u.stateChanged=!0,u.doubleCheckClear(),u},u.doubleCheckClear=function(){return u.doubleChecker&&(o(u.doubleChecker),u.doubleChecker=!1),u},u.doubleCheck=function(e){return u.stateChanged=!1,u.doubleCheckClear(),u.bugs.ieDoubleCheck&&(u.doubleChecker=r(function(){return u.doubleCheckClear(),u.stateChanged||e(),!0},u.options.doubleCheckInterval)),u},u.safariStatePoll=function(){var t,i=u.extractState(u.getLocationHref());if(!u.isLastSavedState(i))return t=i,t||(t=u.createStateObject()),u.Adapter.trigger(e,"popstate"),u},u.back=function(e){return e!==!1&&u.busy()?(u.pushQueue({scope:u,callback:u.back,args:arguments,queue:e}),!1):(u.busy(!0),u.doubleCheck(function(){u.back(!1)}),p.go(-1),!0)},u.forward=function(e){return e!==!1&&u.busy()?(u.pushQueue({scope:u,callback:u.forward,args:arguments,queue:e}),!1):(u.busy(!0),u.doubleCheck(function(){u.forward(!1)}),p.go(1),!0)},u.go=function(e,t){var i;if(e>0)for(i=1;e>=i;++i)u.forward(t);else{if(!(0>e))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(i=-1;i>=e;--i)u.back(t)}return u},u.emulated.pushState){var g=function(){};u.pushState=u.pushState||g,u.replaceState=u.replaceState||g}else u.onPopState=function(t,i){var n,s,a=!1,r=!1;return u.doubleCheckComplete(),(n=u.getHash())?(s=u.extractState(n||u.getLocationHref(),!0),s?u.replaceState(s.data,s.title,s.url,!1):(u.Adapter.trigger(e,"anchorchange"),u.busy(!1)),u.expectedStateId=!1,!1):(a=u.Adapter.extractEventData("state",t,i)||!1,r=a?u.getStateById(a):u.expectedStateId?u.getStateById(u.expectedStateId):u.extractState(u.getLocationHref()),r||(r=u.createStateObject(null,null,u.getLocationHref())),u.expectedStateId=!1,u.isLastSavedState(r)?(u.busy(!1),!1):(u.storeState(r),u.saveState(r),u.setTitle(r),u.Adapter.trigger(e,"statechange"),u.busy(!1),!0))},u.Adapter.bind(e,"popstate",u.onPopState),u.pushState=function(t,i,n,s){if(u.getHashByUrl(n)&&u.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(s!==!1&&u.busy())return u.pushQueue({scope:u,callback:u.pushState,args:arguments,queue:s}),!1;u.busy(!0);var a=u.createStateObject(t,i,n);return u.isLastSavedState(a)?u.busy(!1):(u.storeState(a),u.expectedStateId=a.id,p.pushState(a.id,a.title,a.url),u.Adapter.trigger(e,"popstate")),!0},u.replaceState=function(t,i,n,s){if(u.getHashByUrl(n)&&u.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(s!==!1&&u.busy())return u.pushQueue({scope:u,callback:u.replaceState,args:arguments,queue:s}),!1;u.busy(!0);var a=u.createStateObject(t,i,n);return u.isLastSavedState(a)?u.busy(!1):(u.storeState(a),u.expectedStateId=a.id,p.replaceState(a.id,a.title,a.url),u.Adapter.trigger(e,"popstate")),!0};if(a){try{u.store=c.parse(a.getItem("History.store"))||{}}catch(m){u.store={}}u.normalizeStore()}else u.store={},u.normalizeStore();u.Adapter.bind(e,"unload",u.clearAllIntervals),u.saveState(u.storeState(u.extractState(u.getLocationHref(),!0))),a&&(u.onUnload=function(){var e,t,i;try{e=c.parse(a.getItem("History.store"))||{}}catch(n){e={}}e.idToState=e.idToState||{},e.urlToId=e.urlToId||{},e.stateToId=e.stateToId||{};for(t in u.idToState)u.idToState.hasOwnProperty(t)&&(e.idToState[t]=u.idToState[t]);for(t in u.urlToId)u.urlToId.hasOwnProperty(t)&&(e.urlToId[t]=u.urlToId[t]);for(t in u.stateToId)u.stateToId.hasOwnProperty(t)&&(e.stateToId[t]=u.stateToId[t]);u.store=e,u.normalizeStore(),i=c.stringify(e);try{a.setItem("History.store",i)}catch(s){if(!/QUOTA_EXCEEDED_ERR/.test(s.message))throw s;a.removeItem("History.store"),a.setItem("History.store",i)}},u.intervalList.push(l(u.onUnload,u.options.storeInterval)),u.Adapter.bind(e,"beforeunload",u.onUnload),u.Adapter.bind(e,"unload",u.onUnload)),u.emulated.pushState||(u.bugs.safariPoll&&u.intervalList.push(l(u.safariStatePoll,u.options.safariPollInterval)),("Apple Computer, Inc."===s.vendor||"Mozilla"===(s.appCodeName||""))&&(u.Adapter.bind(e,"hashchange",function(){u.Adapter.trigger(e,"popstate")}),u.getHash()&&u.Adapter.onDomLoad(function(){u.Adapter.trigger(e,"hashchange")})))},u.options&&u.options.delayInit||u.init()}(window)},{}],8:[function(e,t,i){!function(){window.jLayout="undefined"==typeof window.jLayout?{}:window.jLayout,jLayout.border=function(e){function t(e){return function(t){var n,h=t.insets(),c=0,d=0;return s&&s.isVisible()&&(n=s[e+"Size"](),c+=n.width+i.hgap,d=n.height),a&&a.isVisible()&&(n=a[e+"Size"](),c+=n.width+i.hgap,d=Math.max(n.height,d)),l&&l.isVisible()&&(n=l[e+"Size"](),c+=n.width,d=Math.max(n.height,d)),r&&r.isVisible()&&(n=r[e+"Size"](),c=Math.max(n.width,c),d+=n.height+i.vgap),o&&o.isVisible()&&(n=o[e+"Size"](),c=Math.max(n.width,c),d+=n.height+i.vgap),{width:c+h.left+h.right,height:d+h.top+h.bottom}}}var i={},n={},s=e.east,a=e.west,r=e.north,o=e.south,l=e.center;return i.hgap=e.hgap||0,i.vgap=e.vgap||0,n.items=function(){var e=[];return s&&e.push(s),a&&e.push(a),r&&e.push(r),o&&e.push(o),l&&e.push(l),e},n.layout=function(e){var t,n=e.bounds(),h=e.insets(),c=h.top,d=n.height-h.bottom,u=h.left,p=n.width-h.right;return r&&r.isVisible()&&(t=r.preferredSize(),r.bounds({x:u,y:c,width:p-u,height:t.height}),r.doLayout(),c+=t.height+i.vgap),o&&o.isVisible()&&(t=o.preferredSize(),o.bounds({x:u,y:d-t.height,width:p-u,height:t.height}),o.doLayout(),d-=t.height+i.vgap),s&&s.isVisible()&&(t=s.preferredSize(),s.bounds({x:p-t.width,y:c,width:t.width,height:d-c}),s.doLayout(),p-=t.width+i.hgap),a&&a.isVisible()&&(t=a.preferredSize(),a.bounds({x:u,y:c,width:t.width,height:d-c}),a.doLayout(),u+=t.width+i.hgap),l&&l.isVisible()&&(l.bounds({x:u,y:c,width:p-u,height:d-c}),l.doLayout()),e},n.preferred=t("preferred"),n.minimum=t("minimum"),n.maximum=t("maximum"),n}}()},{}],9:[function(e,t,i){var n=window.jQuery,s=window.jLayout;n&&s&&!function(e){var t=e.jLayoutWrap=function(t,i){var n={};return n.item=t,e.each(["min","max"],function(e,i){n[i+"imumSize"]=function(e){var s=t.data("jlayout");return s?s[i+"imum"](n):t[i+"Size"](e)}}),e.extend(n,{doLayout:function(){var e=t.data("jlayout");e?e.layout(n):t.is("[data-layout-type]")&&t.layout({resize:!1}),t.css({position:"absolute"})},isVisible:function(){return t.isVisible()},insets:function(){var e=t.padding(),i=t.border();return{top:e.top,bottom:e.bottom+i.bottom+i.top,left:e.left,right:e.right+i.right+i.left}},bounds:function(e){var i={};return e?("number"==typeof e.x&&(i.left=e.x),"number"==typeof e.y&&(i.top=e.y),"number"==typeof e.width&&(i.width=e.width-(t.outerWidth(!0)-t.width()),i.width=i.width>=0?i.width:0),"number"==typeof e.height&&(i.height=e.height-(t.outerHeight(!0)-t.height()),i.height=i.height>=0?i.height:0),t.css(i),t):(i=t.position(),{x:i.left,y:i.top,width:t.outerWidth(!1),height:t.outerHeight(!1)})},preferredSize:function(){var e,s,a=t.margin(),r={width:0,height:0},o=t.data("jlayout");return o&&i?(r=o.preferred(n),e=n.minimumSize(),s=n.maximumSize(),r.width+=a.left+a.right,r.height+=a.top+a.bottom,r.width<e.width||r.height<e.height?(r.width=Math.max(r.width,e.width),r.height=Math.max(r.height,e.height)):(r.width>s.width||r.height>s.height)&&(r.width=Math.min(r.width,s.width),r.height=Math.min(r.height,s.height))):(r=n.bounds(),r.width+=a.left+a.right,r.height+=a.top+a.bottom),r}}),n};e.fn.layout=function(i){var n=e.extend({},e.fn.layout.defaults,i);return e.each(this,function(){var i=e(this),a=e.metadata&&i.metadata().layout?e.extend(n,i.metadata().layout):n,a=i.data("layoutType")?e.extend(a,{type:i.data("layoutType")}):a,r=t(i,a.resize);"border"===a.type&&"undefined"!=typeof s.border?(e.each(["north","south","west","east","center"],function(e,n){i.children().hasClass(n)&&(a[n]=t(i.children("."+n+":first")))}),i.data("jlayout",s.border(a))):"grid"===a.type&&"undefined"!=typeof s.grid?(a.items=[],i.children().each(function(i){e(this).hasClass("ui-resizable-handle")||(a.items[i]=t(e(this)))}),i.data("jlayout",s.grid(a))):"flexGrid"===a.type&&"undefined"!=typeof s.flexGrid?(a.items=[],i.children().each(function(i){e(this).hasClass("ui-resizable-handle")||(a.items[i]=t(e(this)))}),i.data("jlayout",s.flexGrid(a))):"column"===a.type&&"undefined"!=typeof s.column?(a.items=[],i.children().each(function(i){e(this).hasClass("ui-resizable-handle")||(a.items[i]=t(e(this)))}),i.data("jlayout",s.column(a))):"flow"===a.type&&"undefined"!=typeof s.flow&&(a.items=[],i.children().each(function(i){e(this).hasClass("ui-resizable-handle")||(a.items[i]=t(e(this)))}),i.data("jlayout",s.flow(a))),a.resize&&r.bounds(r.preferredSize()),r.doLayout(),i.css({position:"relative"}),void 0!==e.ui&&i.addClass("ui-widget")})},e.fn.layout.defaults={resize:!0,type:"grid"}}(n)},{}],10:[function(e,t,i){!function(e){e.fn.hoverIntent=function(t,i){var n={sensitivity:7,interval:100,timeout:350};n=e.extend(n,i?{over:t,out:i}:t);var s,a,r,o,l=function(e){s=e.pageX,a=e.pageY},h=function(t,i){return i.hoverIntent_t=clearTimeout(i.hoverIntent_t),Math.abs(r-s)+Math.abs(o-a)<n.sensitivity?(e(i).unbind("mousemove",l),i.hoverIntent_s=1,n.over.apply(i,[t])):(r=s,o=a,i.hoverIntent_t=setTimeout(function(){h(t,i)},n.interval),void 0)},c=function(e,t){return t.hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=0,n.out.apply(t,[e])},d=function(t){var i=jQuery.extend({},t),s=this;s.hoverIntent_t&&(s.hoverIntent_t=clearTimeout(s.hoverIntent_t)),"mouseenter"==t.type?(r=i.pageX,o=i.pageY,e(s).bind("mousemove",l),1!=s.hoverIntent_s&&(s.hoverIntent_t=setTimeout(function(){h(i,s)},n.interval))):(e(s).unbind("mousemove",l),1==s.hoverIntent_s&&(s.hoverIntent_t=setTimeout(function(){c(i,s)},n.timeout)))};return this.bind("mouseenter",d).bind("mouseleave",d)}}(jQuery)},{}],11:[function(e,t,i){!function(e){e.extend({noticeAdd:function(t){var t,i,n,s,a,r={inEffect:{opacity:"show"},inEffectDuration:600,stayTime:3e3,text:"",stay:!1,type:"notice"},o=!1;t=e.extend({},r,t),i=e(".notice-wrap").length?e(".notice-wrap"):e("<div></div>").addClass("notice-wrap").appendTo("body"),n=e("<div></div>").addClass("notice-item-wrapper"),s=e("<div></div>").hide().addClass("notice-item "+t.type).appendTo(i).html("<p>"+t.text+"</p>").animate(t.inEffect,t.inEffectDuration).wrap(n),a=e("<div></div>").addClass("notice-item-close").prependTo(s).html("x").click(function(){e.noticeRemove(s)}),s.hover(function(){o=!0},function(){o=!1}),t.stay||setTimeout(function(){var t=setInterval(function(){o||(e.noticeRemove(s),clearInterval(t))},1e3)},t.stayTime)},noticeRemove:function(e){e.animate({opacity:"0"},600,function(){e.parent().animate({height:"0px"},300,function(){e.parent().remove()})})}})}(jQuery)},{}],12:[function(e,t,i){!function(e){"use strict";var t=function(e){return parseInt(e,10)||0};e.each(["min","max"],function(i,n){e.fn[n+"Size"]=function(e){var i,s;return e?(void 0!==e.width&&this.css(n+"-width",e.width),void 0!==e.height&&this.css(n+"-height",e.height),this):(i=this.css(n+"-width"),s=this.css(n+"-height"),{width:"max"===n&&(void 0===i||"none"===i||-1===t(i))&&Number.MAX_VALUE||t(i),height:"max"===n&&(void 0===s||"none"===s||-1===t(s))&&Number.MAX_VALUE||t(s)})}}),e.fn.isVisible=function(){return this.is(":visible")},e.each(["border","margin","padding"],function(i,n){e.fn[n]=function(e){return e?(void 0!==e.top&&this.css(n+"-top"+("border"===n?"-width":""),e.top),void 0!==e.bottom&&this.css(n+"-bottom"+("border"===n?"-width":""),e.bottom),void 0!==e.left&&this.css(n+"-left"+("border"===n?"-width":""),e.left),void 0!==e.right&&this.css(n+"-right"+("border"===n?"-width":""),e.right),this):{top:t(this.css(n+"-top"+("border"===n?"-width":""))),bottom:t(this.css(n+"-bottom"+("border"===n?"-width":""))),left:t(this.css(n+"-left"+("border"===n?"-width":""))),right:t(this.css(n+"-right"+("border"===n?"-width":"")))}}})}(jQuery)},{}],13:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s);a["default"].fn.extend({ssDatepicker:function(e){return(0,a["default"])(this).each(function(){if(!(0,a["default"])(this).data("datepicker")){(0,a["default"])(this).siblings("button").addClass("ui-icon ui-icon-calendar");var t=((0,a["default"])(this).parents(".field.date:first"),a["default"].extend(e||{},(0,a["default"])(this).data(),(0,a["default"])(this).data("jqueryuiconfig"),{}));t.showcalendar&&(t.locale&&a["default"].datepicker.regional[t.locale]&&(t=a["default"].extend(t,a["default"].datepicker.regional[t.locale],{})),
t.min&&(t.minDate=a["default"].datepicker.parseDate("yy-mm-dd",t.min)),t.max&&(t.maxDate=a["default"].datepicker.parseDate("yy-mm-dd",t.max)),t.dateFormat=t.jquerydateformat,(0,a["default"])(this).datepicker(t))}})}}),(0,a["default"])(document).on("click",".field.date input.text,input.text.date",function(){(0,a["default"])(this).ssDatepicker(),(0,a["default"])(this).data("datepicker")&&(0,a["default"])(this).datepicker("show")})},{"./jQuery":"jQuery"}],14:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s),r=e("./i18n"),o=n(r);a["default"].entwine("ss",function(e){e(".ss-gridfield").entwine({reload:function(t,i){var n=this,s=this.closest("form"),a=this.find(":input:focus").attr("name"),r=s.find(":input").serializeArray();t||(t={}),t.data||(t.data=[]),t.data=t.data.concat(r),window.location.search&&(t.data=window.location.search.replace(/^\?/,"")+"&"+e.param(t.data)),window.history&&window.history.pushState||window.location.hash&&-1!=window.location.hash.indexOf("?")&&(t.data=window.location.hash.substring(window.location.hash.indexOf("?")+1)+"&"+e.param(t.data)),s.addClass("loading"),e.ajax(e.extend({},{headers:{"X-Pjax":"CurrentField"},type:"POST",url:this.data("url"),dataType:"html",success:function(r){if(n.empty().append(e(r).children()),a&&n.find(':input[name="'+a+'"]').focus(),n.find(".filter-header").length){var o;"show"==t.data[0].filter?(o='<span class="non-sortable"></span>',n.addClass("show-filter").find(".filter-header").show()):(o='<button type="button" name="showFilter" class="ss-gridfield-button-filter trigger"></button>',n.removeClass("show-filter").find(".filter-header").hide()),n.find(".sortable-header th:last").html(o)}s.removeClass("loading"),i&&i.apply(this,arguments),n.trigger("reload",n)},error:function(e){alert(o["default"]._t("GRIDFIELD.ERRORINTRANSACTION")),s.removeClass("loading")}},t))},showDetailView:function(e){window.location.href=e},getItems:function(){return this.find(".ss-gridfield-item")},setState:function(e,t){var i=this.getState();i[e]=t,this.find(':input[name="'+this.data("name")+'[GridState]"]').val(JSON.stringify(i))},getState:function(){return JSON.parse(this.find(':input[name="'+this.data("name")+'[GridState]"]').val())}}),e(".ss-gridfield *").entwine({getGridField:function(){return this.closest(".ss-gridfield")}}),e(".ss-gridfield :button[name=showFilter]").entwine({onclick:function(t){e(".filter-header").show("slow").find(":input:first").focus(),this.closest(".ss-gridfield").addClass("show-filter"),this.parent().html('<span class="non-sortable"></span>'),t.preventDefault()}}),e(".ss-gridfield .ss-gridfield-item").entwine({onclick:function(t){if(e(t.target).closest(".action").length)return this._super(t),!1;var i=this.find(".edit-link");i.length&&this.getGridField().showDetailView(i.prop("href"))},onmouseover:function(){this.find(".edit-link").length&&this.css("cursor","pointer")},onmouseout:function(){this.css("cursor","default")}}),e(".ss-gridfield .action").entwine({onclick:function(e){var t="show";return this.button("option","disabled")?void e.preventDefault():((this.hasClass("ss-gridfield-button-close")||!this.closest(".ss-gridfield").hasClass("show-filter"))&&(t="hidden"),this.getGridField().reload({data:[{name:this.attr("name"),value:this.val(),filter:t}]}),void e.preventDefault())}}),e(".ss-gridfield .add-existing-autocompleter").entwine({onbuttoncreate:function(){var e=this;this.toggleDisabled(),this.find('input[type="text"]').on("keyup",function(){e.toggleDisabled()})},onunmatch:function(){this.find('input[type="text"]').off("keyup")},toggleDisabled:function(){var e=this.find(".ss-ui-button"),t=this.find('input[type="text"]'),i=""!==t.val(),n=e.is(":disabled");(i&&n||!i&&!n)&&e.button("option","disabled",!n)}}),e(".ss-gridfield .col-buttons .action.gridfield-button-delete, .cms-edit-form .Actions button.action.action-delete").entwine({onclick:function(e){return confirm(o["default"]._t("TABLEFIELD.DELETECONFIRMMESSAGE"))?void this._super(e):(e.preventDefault(),!1)}}),e(".ss-gridfield .action.gridfield-button-print").entwine({UUID:null,onmatch:function(){this._super(),this.setUUID((new Date).getTime())},onunmatch:function(){this._super()},onclick:function(t){var i=this.closest(":button"),n=this.getGridField(),s=this.closest("form"),a=s.find(":input.gridstate").serialize();a+="&"+encodeURIComponent(i.attr("name"))+"="+encodeURIComponent(i.val()),window.location.search&&(a=window.location.search.replace(/^\?/,"")+"&"+a);var r=-1==n.data("url").indexOf("?")?"?":"&",o=e.path.makeUrlAbsolute(n.data("url")+r+a,e("base").attr("href"));window.open(o);return!1}}),e(".ss-gridfield-print-iframe").entwine({onmatch:function(){this._super(),this.hide().bind("load",function(){this.focus();var e=this.contentWindow||this;e.print()})},onunmatch:function(){this._super()}}),e(".ss-gridfield .action.no-ajax").entwine({onclick:function(t){var i=this.closest(":button"),n=this.getGridField(),s=this.closest("form"),a=s.find(":input.gridstate").serialize();a+="&"+encodeURIComponent(i.attr("name"))+"="+encodeURIComponent(i.val()),window.location.search&&(a=window.location.search.replace(/^\?/,"")+"&"+a);var r=-1==n.data("url").indexOf("?")?"?":"&";return window.location.href=e.path.makeUrlAbsolute(n.data("url")+r+a,e("base").attr("href")),!1}}),e(".ss-gridfield .action-detail").entwine({onclick:function(){return this.getGridField().showDetailView(e(this).prop("href")),!1}}),e(".ss-gridfield[data-selectable]").entwine({getSelectedItems:function(){return this.find(".ss-gridfield-item.ui-selected")},getSelectedIDs:function(){return e.map(this.getSelectedItems(),function(t){return e(t).data("id")})}}),e(".ss-gridfield[data-selectable] .ss-gridfield-items").entwine({onadd:function(){this._super(),this.selectable()},onremove:function(){this._super(),this.data("selectable")&&this.selectable("destroy")}}),e(".ss-gridfield .filter-header :input").entwine({onmatch:function(){var e=this.closest(".fieldgroup").find(".ss-gridfield-button-filter"),t=this.closest(".fieldgroup").find(".ss-gridfield-button-reset");this.val()&&(e.addClass("filtered"),t.addClass("filtered")),this._super()},onunmatch:function(){this._super()},onkeydown:function(e){if(!this.closest(".ss-gridfield-button-reset").length){var t=this.closest(".fieldgroup").find(".ss-gridfield-button-filter"),i=this.closest(".fieldgroup").find(".ss-gridfield-button-reset");if("13"==e.keyCode){var n=this.closest(".filter-header").find(".ss-gridfield-button-filter"),s="show";return(this.hasClass("ss-gridfield-button-close")||!this.closest(".ss-gridfield").hasClass("show-filter"))&&(s="hidden"),this.getGridField().reload({data:[{name:n.attr("name"),value:n.val(),filter:s}]}),!1}t.addClass("hover-alike"),i.addClass("hover-alike")}}}),e(".ss-gridfield .relation-search").entwine({onfocusin:function(t){this.autocomplete({source:function(t,i){var n=e(this.element);e(this.element).closest("form");e.ajax({headers:{"X-Pjax":"Partial"},type:"GET",url:e(n).data("searchUrl"),data:encodeURIComponent(n.attr("name"))+"="+encodeURIComponent(n.val()),success:function(e){i(JSON.parse(e))},error:function(e){alert(o["default"]._t("GRIDFIELD.ERRORINTRANSACTION","An error occured while fetching data from the server\n Please try again later."))}})},select:function(t,i){e(this).closest(".ss-gridfield").find("#action_gridfield_relationfind").replaceWith('<input type="hidden" name="relationID" value="'+i.item.id+'" id="relationID"/>');var n=e(this).closest(".ss-gridfield").find("#action_gridfield_relationadd");n.data("button")?n.button("enable"):n.removeAttr("disabled")}})}}),e(".ss-gridfield .pagination-page-number input").entwine({onkeydown:function(t){if(13==t.keyCode){var i=parseInt(e(this).val(),10),n=e(this).getGridField();return n.setState("GridFieldPaginator",{currentPage:i}),n.reload(),!1}}})})},{"./i18n":"i18n","./jQuery":"jQuery"}],15:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}var _jQuery=require("./jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_i18n=require("./i18n"),_i18n2=_interopRequireDefault(_i18n),ss="undefined"!=typeof window.ss?window.ss:{};ss.editorWrappers={},ss.editorWrappers.tinyMCE=function(){var instance;return{init:function(e){ss.editorWrappers.tinyMCE.initialized||(tinyMCE.init(e),ss.editorWrappers.tinyMCE.initialized=!0)},getInstance:function(){return this.instance},onopen:function(){},onclose:function(){},save:function(){tinyMCE.triggerSave()},create:function(e,t){this.instance=new tinymce.Editor(e,t),this.instance.onInit.add(function(e){if(!ss.editorWrappers.tinyMCE.patched){var t=tinymce.themes.AdvancedTheme.prototype.destroy;tinymce.themes.AdvancedTheme.prototype.destroy=function(){t.apply(this,arguments),this.statusKeyboardNavigation&&(this.statusKeyboardNavigation.destroy(),this.statusKeyboardNavigation=null)},ss.editorWrappers.tinyMCE.patched=!0}if(jQuery(e.getElement()).trigger("editorinit"),e.settings.update_interval){var i;jQuery(e.getBody()).on("focus",function(){i=setInterval(function(){var t=jQuery(e.getElement());e.isDirty()&&t.val(e.getContent({format:"raw",no_events:1}))},e.settings.update_interval)}),jQuery(e.getBody()).on("blur",function(){clearInterval(i)})}}),this.instance.onChange.add(function(e,t){e.save(),jQuery(e.getElement()).trigger("change")}),this.instance.render()},repaint:function(){tinyMCE.execCommand("mceRepaint")},isDirty:function(){return this.getInstance().isDirty()},getContent:function(){return this.getInstance().getContent()},getDOM:function(){return this.getInstance().dom},getContainer:function(){return this.getInstance().getContainer()},getSelectedNode:function(){return this.getInstance().selection.getNode()},selectNode:function(e){this.getInstance().selection.select(e)},setContent:function(e,t){this.getInstance().execCommand("mceSetContent",!1,e,t)},insertContent:function(e,t){this.getInstance().execCommand("mceInsertContent",!1,e,t)},replaceContent:function(e,t){this.getInstance().execCommand("mceReplaceContent",!1,e,t)},insertLink:function(e,t){this.getInstance().execCommand("mceInsertLink",!1,e,t)},removeLink:function(){this.getInstance().execCommand("unlink",!1)},cleanLink:function cleanLink(href,node){var cb=tinyMCE.settings.urlconverter_callback;return cb&&(href=eval(cb+"(href, node, true);")),href.match(new RegExp("^"+tinyMCE.settings.document_base_url+"(.*)$"))&&(href=RegExp.$1),href.match(/^javascript:\s*mctmp/)&&(href=""),href},createBookmark:function(){return this.getInstance().selection.getBookmark()},moveToBookmark:function(e){this.getInstance().selection.moveToBookmark(e),this.getInstance().focus()},blur:function(){this.getInstance().selection.collapse()},addUndo:function(){this.getInstance().undoManager.add()}}},ss.editorWrappers["default"]=ss.editorWrappers.tinyMCE,_jQuery2["default"].entwine("ss",function(e){e("textarea.htmleditor").entwine({Editor:null,onadd:function(){var e=this.data("editor")||"default",t=ss.editorWrappers[e]();this.setEditor(t),"undefined"!=typeof ssTinyMceConfig&&this.redraw(),this._super()},onremove:function(){var t=tinyMCE.get(this.attr("id"));if(t){try{t.remove()}catch(i){}try{t.destroy()}catch(i){}this.next(".mceEditor").remove(),e.each(jQuery.cache,function(){var t=this.handle&&this.handle.elem;if(t){var i=t;try{for(;i&&1==i.nodeType;)i=i.parentNode}catch(n){}i||e(t).unbind().remove()}})}this._super()},getContainingForm:function(){return this.closest("form")},fromWindow:{onload:function(){this.redraw()}},redraw:function(){var e=ssTinyMceConfig[this.data("config")],t=this.getEditor();t.init(e),t.create(this.attr("id"),e),this._super()},"from .cms-edit-form":{onbeforesubmitform:function(e){this.getEditor().save(),this._super()}},oneditorinit:function(){var t=e(this.getEditor().getInstance().getContainer());setTimeout(function(){t.show()},10)},"from .cms-container":{onbeforestatechange:function(){this.css("visibility","hidden");var e=this.getEditor(),t=e&&e.getInstance()?e.getContainer():null;t&&t.length&&t.remove()}},isChanged:function(){var e=this.getEditor();return e&&e.getInstance()&&e.isDirty()},resetChanged:function(){this.getEditor();if("undefined"!=typeof tinyMCE){var e=tinyMCE.getInstanceById(this.attr("id"));e&&(e.startContent=tinymce.trim(e.getContent({format:"raw",no_events:1})))}},openLinkDialog:function(){this.openDialog("link")},openMediaDialog:function(){this.openDialog("media")},openDialog:function(t){var i=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},n=this,s=e("#cms-editor-dialogs").data("url"+i(t)+"form"),a=e(".htmleditorfield-"+t+"dialog");a.length?(a.getForm().setElement(this),a.open()):(a=e('<div class="htmleditorfield-dialog htmleditorfield-'+t+'dialog loading">'),e("body").append(a),e.ajax({url:s,complete:function(){a.removeClass("loading")},success:function(e){a.html(e),a.getForm().setElement(n),a.trigger("ssdialogopen")}}))}}),e(".htmleditorfield-dialog").entwine({onadd:function(){this.is(".ui-dialog-content")||this.ssdialog({autoOpen:!0,buttons:{insert:{text:_i18n2["default"]._t("HtmlEditorField.INSERT","Insert"),"data-icon":"accept","class":"ss-ui-action-constructive media-insert",click:function(){e(this).find("form").submit()}}}}),this._super()},getForm:function(){return this.find("form")},open:function(){this.ssdialog("open")},close:function(){this.ssdialog("close")},toggle:function(e){this.is(":visible")?this.close():this.open()},onscroll:function(){this.animate({scrollTop:this.find("form").height()},500)}}),e("form.htmleditorfield-form").entwine({Selection:null,Bookmark:null,Element:null,setSelection:function(t){return this._super(e(t))},onadd:function(){var e=this.find(":header:first");this.getDialog().attr("title",e.text()),this._super()},onremove:function(){this.setSelection(null),this.setBookmark(null),this.setElement(null),this._super()},getDialog:function(){return this.closest(".htmleditorfield-dialog")},fromDialog:{onssdialogopen:function(){var e=this.getEditor();e.onopen(),this.setSelection(e.getSelectedNode()),this.setBookmark(e.createBookmark()),e.blur(),this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(":visible:enabled").eq(0).focus(),this.redraw(),this.updateFromEditor()},onssdialogclose:function(){var e=this.getEditor();e.onclose(),e.moveToBookmark(this.getBookmark()),this.setSelection(null),this.setBookmark(null),this.resetFields()}},getEditor:function(){return this.getElement().getEditor()},modifySelection:function(e){var t=this.getEditor();t.moveToBookmark(this.getBookmark()),e.call(this,t),this.setSelection(t.getSelectedNode()),this.setBookmark(t.createBookmark()),t.blur()},updateFromEditor:function(){},redraw:function(){},resetFields:function(){this.find(".tree-holder").empty()}}),e("form.htmleditorfield-linkform").entwine({onsubmit:function(e){return this.insertLink(),this.getDialog().close(),!1},resetFields:function(){this._super(),this[0].reset()},redraw:function(){this._super();var e=this.find(":input[name=LinkType]:checked").val();this.addAnchorSelector(),this.resetFileField(),this.find("div.content .field").hide(),this.find('.field[id$="LinkType"]').show(),this.find('.field[id$="'+e+'_Holder"]').show(),("internal"==e||"anchor"==e)&&this.find('.field[id$="Anchor_Holder"]').show(),"email"==e?this.find('.field[id$="Subject_Holder"]').show():this.find('.field[id$="TargetBlank_Holder"]').show(),"anchor"==e&&this.find('.field[id$="AnchorSelector_Holder"]').show(),this.find('.field[id$="Description_Holder"]').show()},getLinkAttributes:function(){var e,t=null,i=this.find(":input[name=Subject]").val(),n=this.find(":input[name=Anchor]").val();switch(this.find(":input[name=TargetBlank]").is(":checked")&&(t="_blank"),this.find(":input[name=LinkType]:checked").val()){case"internal":e="[sitetree_link,id="+this.find(":input[name=internal]").val()+"]",n&&(e+="#"+n);break;case"anchor":e="#"+n;break;case"file":e="[file_link,id="+this.find(".ss-uploadfield .ss-uploadfield-item").attr("data-fileid")+"]",t="_blank";break;case"email":e="mailto:"+this.find(":input[name=email]").val(),i&&(e+="?subject="+encodeURIComponent(i)),t=null;break;default:e=this.find(":input[name=external]").val(),-1==e.indexOf("://")&&(e="http://"+e)}return{href:e,target:t,title:this.find(":input[name=Description]").val()}},insertLink:function(){this.modifySelection(function(e){e.insertLink(this.getLinkAttributes())})},removeLink:function(){this.modifySelection(function(e){e.removeLink()}),this.resetFileField(),this.close()},resetFileField:function(){var e=this.find('.ss-uploadfield[id$="file_Holder"]'),t=e.data("fileupload"),i=e.find(".ss-uploadfield-item[data-fileid]");i.length&&(t._trigger("destroy",null,{context:i}),e.find(".ss-uploadfield-addfile").removeClass("borderTop"))},addAnchorSelector:function(){if(!this.find(":input[name=AnchorSelector]").length){var t=this,i=e('<select id="Form_EditorToolbarLinkForm_AnchorSelector" name="AnchorSelector"></select>');this.find(":input[name=Anchor]").parent().append(i),this.updateAnchorSelector(),i.change(function(i){t.find(':input[name="Anchor"]').val(e(this).val())})}},getAnchors:function(){var t=this.find(":input[name=LinkType]:checked").val(),i=e.Deferred();switch(t){case"anchor":var n=[],s=this.getEditor();if(s){var a=s.getContent().match(/\s+(name|id)\s*=\s*(["'])([^\2\s>]*?)\2|\s+(name|id)\s*=\s*([^"']+)[\s +>]/gim);if(a&&a.length)for(var r=0;r<a.length;r++){var o=-1==a[r].indexOf("id=")?7:5;n.push(a[r].substr(o).replace(/"$/,""))}}i.resolve(n);break;case"internal":var l=this.find(":input[name=internal]").val();l?e.ajax({url:e.path.addSearchParams(this.attr("action").replace("LinkForm","getanchors"),{PageID:parseInt(l)}),success:function(t,n,s){i.resolve(e.parseJSON(t))},error:function(e,t){i.reject(e.responseText)}}):i.resolve([]);break;default:i.reject(_i18n2["default"]._t("HtmlEditorField.ANCHORSNOTSUPPORTED","Anchors are not supported for this link type."))}return i.promise()},updateAnchorSelector:function(){var t=this.find(":input[name=AnchorSelector]"),i=this.getAnchors();t.empty(),t.append(e('<option value="" selected="1">'+_i18n2["default"]._t("HtmlEditorField.LOOKINGFORANCHORS","Looking for anchors...")+"</option>")),i.done(function(i){if(t.empty(),t.append(e('<option value="" selected="1">'+_i18n2["default"]._t("HtmlEditorField.SelectAnchor")+"</option>")),i)for(var n=0;n<i.length;n++)t.append(e('<option value="'+i[n]+'">'+i[n]+"</option>"))}).fail(function(i){t.empty(),t.append(e('<option value="" selected="1">'+i+"</option>"))}),e.browser.msie&&t.hide().show()},updateFromEditor:function(){var e,t=/<\S[^><]*>/g,i=this.getCurrentLink();if(i)for(e in i){var n=this.find(":input[name="+e+"]"),s=i[e];"string"==typeof s&&(s=s.replace(t,"")),n.is(":checkbox")?n.prop("checked",s).change():n.is(":radio")?n.val([s]).change():"file"==e?(n=this.find(':input[name="'+e+'[Uploads][]"]'),n=n.parents(".ss-uploadfield"),function a(e,t){e.getConfig()?e.attachFiles([t]):setTimeout(function(){a(e,t)},50)}(n,s)):n.val(s).change()}},getCurrentLink:function(){var e=this.getSelection(),t="",i="",n="",s="insert",a="",r=null;return e.length&&(r=e.is("a")?e:e=e.parents("a:first")),r&&r.length&&this.modifySelection(function(e){e.selectNode(r[0])}),r.attr("href")||(r=null),r&&(t=r.attr("href"),i=r.attr("target"),n=r.attr("title"),a=r.attr("class"),t=this.getEditor().cleanLink(t,r),s="update"),t.match(/^mailto:(.*)$/)?{LinkType:"email",email:RegExp.$1,Description:n}:t.match(/^(assets\/.*)$/)||t.match(/^\[file_link\s*(?:\s*|%20|,)?id=([0-9]+)\]?(#.*)?$/)?{LinkType:"file",file:RegExp.$1,Description:n,TargetBlank:i?!0:!1}:t.match(/^#(.*)$/)?{LinkType:"anchor",Anchor:RegExp.$1,Description:n,TargetBlank:i?!0:!1}:t.match(/^\[sitetree_link(?:\s*|%20|,)?id=([0-9]+)\]?(#.*)?$/i)?{LinkType:"internal",internal:RegExp.$1,Anchor:RegExp.$2?RegExp.$2.substr(1):"",Description:n,TargetBlank:i?!0:!1}:t?{LinkType:"external",external:t,Description:n,TargetBlank:i?!0:!1}:null}}),e("form.htmleditorfield-linkform input[name=LinkType]").entwine({onclick:function(e){this.parents("form:first").redraw(),this._super()},onchange:function(){this.parents("form:first").redraw();var e=this.parent().find(":checked").val();("anchor"===e||"internal"===e)&&this.parents("form.htmleditorfield-linkform").updateAnchorSelector(),this._super()}}),e("form.htmleditorfield-linkform input[name=internal]").entwine({onvalueupdated:function(){this.parents("form.htmleditorfield-linkform").updateAnchorSelector(),this._super()}}),e("form.htmleditorfield-linkform :submit[name=action_remove]").entwine({onclick:function(e){return this.parents("form:first").removeLink(),this._super(),!1}}),e("form.htmleditorfield-mediaform").entwine({toggleCloseButton:function(){var e=Boolean(this.find(".ss-htmleditorfield-file").length);this.find(".overview .action-delete")[e?"hide":"show"]()},onsubmit:function(){return this.modifySelection(function(t){this.find(".ss-htmleditorfield-file").each(function(){e(this).insertHTML(t)}),t.repaint()}),this.getDialog().close(),!1},updateFromEditor:function(){var e=this,t=this.getSelection();t.is("img")&&this.showFileView(t.data("url")||t.attr("src")).done(function(i){i.updateFromNode(t),e.toggleCloseButton(),e.redraw()}),this.redraw()},redraw:function(t){this._super();var i=this.getSelection(),n=Boolean(this.find(".ss-htmleditorfield-file").length),s=i.is("img"),a=this.hasClass("insertingURL"),r=this.find(".header-edit");r[n?"show":"hide"](),this.closest("ui-dialog").find("ui-dialog-buttonpane .media-insert").button(n?"enable":"disable").toggleClass("ui-state-disabled",!n),this.find(".htmleditorfield-default-panel")[s||a?"hide":"show"](),this.find(".htmleditorfield-web-panel")[s||!a?"hide":"show"]();var o=this.find(".htmleditorfield-mediaform-heading.insert");s?o.hide():a?(o.show().text(_i18n2["default"]._t("HtmlEditorField.INSERTURL")).prepend('<button class="back-button font-icon-left-open no-text" title="'+_i18n2["default"]._t("HtmlEditorField.BACK")+'"></button>'),this.find(".htmleditorfield-web-panel input.remoteurl").focus()):o.show().text(_i18n2["default"]._t("HtmlEditorField.INSERTFROM")).find(".back-button").remove(),this.find(".htmleditorfield-mediaform-heading.update")[s?"show":"hide"](),this.find(".ss-uploadfield-item-actions")[s?"hide":"show"](),this.find(".ss-uploadfield-item-name")[s?"hide":"show"](),this.find(".ss-uploadfield-item-preview")[s?"hide":"show"](),this.find(".Actions .media-update")[s?"show":"hide"](),this.find(".ss-uploadfield-item-editform").toggleEditForm(s),this.find(".htmleditorfield-from-cms .field.treedropdown").css("left",e(".htmleditorfield-mediaform-heading:visible").outerWidth()),this.closest(".ui-dialog").addClass("ss-uploadfield-dropzone"),this.closest(".ui-dialog").find(".ui-dialog-buttonpane .media-insert .ui-button-text").text([s?_i18n2["default"]._t("HtmlEditorField.UPDATE","Update"):_i18n2["default"]._t("HtmlEditorField.INSERT","Insert")])},resetFields:function(){this.find(".ss-htmleditorfield-file").remove(),this.find(".ss-gridfield-items .ui-selected").removeClass("ui-selected"),this.find("li.ss-uploadfield-item").remove(),this.redraw(),this._super()},getFileView:function(e){return this.find(".ss-htmleditorfield-file[data-id="+e+"]")},showFileView:function(t){var i=this,n=Number(t)==t?{ID:t}:{FileURL:t},s=e('<div class="ss-htmleditorfield-file loading" />');this.find(".content-edit").prepend(s);var a=e.Deferred();return e.ajax({url:e.path.addSearchParams(this.attr("action").replace(/MediaForm/,"viewfile"),n),success:function(t,n,r){var o=e(t).filter(".ss-htmleditorfield-file");s.replaceWith(o),i.redraw(),a.resolve(o)},error:function(){s.remove(),a.reject()}}),a.promise()}}),e("form.htmleditorfield-mediaform div.ss-upload .upload-url").entwine({onclick:function(){var e=this.closest("form");e.addClass("insertingURL"),e.redraw()}}),e("form.htmleditorfield-mediaform .htmleditorfield-mediaform-heading .back-button").entwine({onclick:function(){var e=this.closest("form");e.removeClass("insertingURL"),e.redraw()}}),e("form.htmleditorfield-mediaform .ss-gridfield-items").entwine({onselectableselected:function(t,i){var n=this.closest("form"),s=e(i.selected);s.is(".ss-gridfield-item")&&(n.closest("form").showFileView(s.data("id")),n.redraw(),n.parent().trigger("scroll"))},onselectableunselected:function(t,i){var n=this.closest("form"),s=e(i.unselected);s.is(".ss-gridfield-item")&&(n.getFileView(s.data("id")).remove(),n.redraw())}}),e("form.htmleditorfield-form.htmleditorfield-mediaform div.ss-assetuploadfield").entwine({onfileuploadstop:function(t){var i=this.closest("form"),n=[];i.find("div.content-edit").find("div.ss-htmleditorfield-file").each(function(){n.push(e(this).data("id"))});var s=e(".ss-uploadfield-files",this).children(".ss-uploadfield-item");s.each(function(){var t=e(this).data("fileid");t&&-1==e.inArray(t,n)&&(e(this).remove(),i.showFileView(t))}),i.parent().trigger("scroll"),i.redraw()}}),e("form.htmleditorfield-form.htmleditorfield-mediaform input.remoteurl").entwine({onadd:function(){this._super(),this.validate()},onkeyup:function(){this.validate()},onchange:function(){this.validate()},getAddButton:function(){return this.closest(".CompositeField").find("button.add-url")},validate:function(){var t=this.val(),i=t;return t=e.trim(t),t=t.replace(/^https?:\/\//i,""),i!==t&&this.val(t),this.getAddButton().button(t?"enable":"disable"),!!t}}),e("form.htmleditorfield-form.htmleditorfield-mediaform .add-url").entwine({getURLField:function(){return this.closest(".CompositeField").find("input.remoteurl")},onclick:function(e){var t=this.getURLField(),i=this.closest(".CompositeField"),n=this.closest("form");return t.validate()&&(i.addClass("loading"),n.showFileView("http://"+t.val()).done(function(){i.removeClass("loading"),n.parent().trigger("scroll")}),n.redraw()),!1}}),e("form.htmleditorfield-mediaform .ss-htmleditorfield-file").entwine({getAttributes:function(){},getExtraData:function(){},getHTML:function(){return e("<div>").append(e("<a/>").attr({href:this.data("url")}).text(this.find(".name").text())).html()},insertHTML:function(e){e.replaceContent(this.getHTML())},updateFromNode:function(e){},updateDimensions:function(e,t,i){var n,s=this.find(":input[name=Width]"),a=this.find(":input[name=Height]"),r=s.val(),o=a.val();r&&o&&(e?(n=a.getOrigVal()/s.getOrigVal(),"Width"==e?(t&&r>t&&(r=t),o=Math.floor(r*n)):"Height"==e&&(i&&o>i&&(o=i),r=Math.ceil(o/n))):(t&&r>t&&(r=t),i&&o>i&&(o=i)),s.val(r),a.val(o))}}),e("form.htmleditorfield-mediaform .ss-htmleditorfield-file.image").entwine({getAttributes:function(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val();return{src:this.find(":input[name=URL]").val(),alt:this.find(":input[name=AltText]").val(),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null,title:this.find(":input[name=Title]").val(),"class":this.find(":input[name=CSSClass]").val(),"data-fileid":this.find(":input[name=FileID]").val()}},getExtraData:function(){return{CaptionText:this.find(":input[name=CaptionText]").val()}},getHTML:function(){},insertHTML:function(t){var i=this.closest("form"),n=i.getSelection();t||(t=i.getEditor());var s=this.getAttributes(),a=this.getExtraData(),r=n&&n.is("img")?n:null;r&&r.parent().is(".captionImage")&&(r=r.parent());var o=n&&n.is("img")?n:e("<img />");o.attr(s);var l=o.parent(".captionImage"),h=l.find(".caption");a.CaptionText?(l.length||(l=e("<div></div>")),l.attr("class","captionImage "+s["class"]).css("width",s.width),h.length||(h=e('<p class="caption"></p>').appendTo(l)),h.attr("class","caption "+s["class"]).text(a.CaptionText)):l=h=null;var c=l?l:o;r&&r.not(c).length&&r.replaceWith(c),l&&l.prepend(o),r||(t.repaint(),t.insertContent(e("<div />").append(c).html(),{skip_undo:1})),t.addUndo(),t.repaint()},updateFromNode:function(e){this.find(":input[name=AltText]").val(e.attr("alt")),this.find(":input[name=Title]").val(e.attr("title")),this.find(":input[name=CSSClass]").val(e.attr("class")),this.find(":input[name=Width]").val(e.width()),this.find(":input[name=Height]").val(e.height()),this.find(":input[name=CaptionText]").val(e.siblings(".caption:first").text()),this.find(":input[name=FileID]").val(e.data("fileid"))}}),e("form.htmleditorfield-mediaform .ss-htmleditorfield-file.flash").entwine({getAttributes:function(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val();return{src:this.find(":input[name=URL]").val(),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null,"data-fileid":this.find(":input[name=FileID]").val()}},getHTML:function(){var t=this.getAttributes(),i=tinyMCE.activeEditor.plugins.media.dataToImg({type:"flash",width:t.width,height:t.height,params:{src:t.src},video:{sources:[]}});return e("<div />").append(i).html()},updateFromNode:function(e){}}),e("form.htmleditorfield-mediaform .ss-htmleditorfield-file.embed").entwine({getAttributes:function(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val();return{src:this.find(".thumbnail-preview").attr("src"),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null,"class":this.find(":input[name=CSSClass]").val(),alt:this.find(":input[name=AltText]").val(),title:this.find(":input[name=Title]").val(),"data-fileid":this.find(":input[name=FileID]").val()}},getExtraData:function(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val();return{CaptionText:this.find(":input[name=CaptionText]").val(),Url:this.find(":input[name=URL]").val(),thumbnail:this.find(".thumbnail-preview").attr("src"),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null,cssclass:this.find(":input[name=CSSClass]").val()}},getHTML:function(){var t,i=this.getAttributes(),n=this.getExtraData(),s=e("<img />").attr(i).addClass("ss-htmleditorfield-file embed");return e.each(n,function(e,t){s.attr("data-"+e,t)}),t=n.CaptionText?e('<div style="width: '+i.width+'px;" class="captionImage '+i["class"]+'"><p class="caption">'+n.CaptionText+"</p></div>").prepend(s):s,e("<div />").append(t).html()},updateFromNode:function(e){this.find(":input[name=AltText]").val(e.attr("alt")),this.find(":input[name=Title]").val(e.attr("title")),this.find(":input[name=Width]").val(e.width()),this.find(":input[name=Height]").val(e.height()),this.find(":input[name=Title]").val(e.attr("title")),this.find(":input[name=CSSClass]").val(e.data("cssclass")),this.find(":input[name=FileID]").val(e.data("fileid"))}}),e("form.htmleditorfield-mediaform .ss-htmleditorfield-file .dimensions :input").entwine({OrigVal:null,onmatch:function(){this._super(),this.setOrigVal(parseInt(this.val(),10))},onunmatch:function(){this._super()},onfocusout:function(e){this.closest(".ss-htmleditorfield-file").updateDimensions(this.attr("name"))}}),e("form.htmleditorfield-mediaform .ss-uploadfield-item .ss-uploadfield-item-cancel").entwine({onclick:function(e){var t=this.closest("form"),i=this.closest("ss-uploadfield-item");t.find(".ss-gridfield-item[data-id="+i.data("id")+"]").removeClass("ui-selected"),this.closest(".ss-uploadfield-item").remove(),t.redraw(),e.preventDefault()}}),e("div.ss-assetuploadfield .ss-uploadfield-item-edit, div.ss-assetuploadfield .ss-uploadfield-item-name").entwine({getEditForm:function(){return this.closest(".ss-uploadfield-item").find(".ss-uploadfield-item-editform")},fromEditForm:{onchange:function(t){var i=e(t.target);i.removeClass("edited"),i.addClass("edited")}},onclick:function(e){var t=this.getEditForm();return this.closest(".ss-uploadfield-item").hasClass("ss-htmleditorfield-file")?(t.parent("ss-uploadfield-item").removeClass("ui-state-warning"),t.toggleEditForm(),e.preventDefault(),!1):void this._super(e)}}),e("div.ss-assetuploadfield .ss-uploadfield-item-editform").entwine({toggleEditForm:function(e){var t=this.prev(".ss-uploadfield-item-info"),i=t.find(".ss-uploadfield-item-status"),n="";e===!0||e!==!1&&0===this.height()?(n=_i18n2["default"]._t("UploadField.Editing","Editing ..."),this.height("auto"),t.find(".toggle-details-icon").addClass("opened"),i.removeClass("ui-state-success-text").removeClass("ui-state-warning-text")):(this.height(0),
t.find(".toggle-details-icon").removeClass("opened"),this.hasClass("edited")?(n=_i18n2["default"]._t("UploadField.CHANGESSAVED","Changes Made"),this.removeClass("edited"),i.addClass("ui-state-success-text")):(n=_i18n2["default"]._t("UploadField.NOCHANGES","No Changes"),i.addClass("ui-state-success-text"))),i.attr("title",n).text(n)}}),e('form.htmleditorfield-mediaform .field[id$="ParentID_Holder"] .TreeDropdownField').entwine({onadd:function(){this._super();var e=this;this.bind("change",function(){var t=e.closest("form").find(".ss-gridfield");t.setState("ParentID",e.getValue()),t.reload()})}})}),window.sapphiremce_cleanup=function(e,t){return"get_from_editor"==e&&(t=t.replace(/<[a-z0-9]+:imagedata[^>]+src="?([^> "]+)"?[^>]*>/gi,'<img src="$1">'),t=t.replace(new RegExp("<(!--)([^>]*)(--)>","g"),""),t=t.replace(/([ \f\r\t\n\'\"])class=mso[a-z0-9]+[^ >]+/gi,"$1"),t=t.replace(/([ \f\r\t\n\'\"]class=")mso[a-z0-9]+[^ ">]+ /gi,"$1"),t=t.replace(/([ \f\r\t\n\'\"])class="mso[a-z0-9]+[^">]+"/gi,"$1"),t=t.replace(/([ \f\r\t\n\'\"])on[a-z]+=[^ >]+/gi,"$1"),t=t.replace(/ >/gi,">"),t=t.replace(/<(\/[A-Za-z0-9]+)[ \f\r\t\n]+[^>]*>/gi,"<$1>")),"get_from_editor_dom"==e&&jQuery(t).find("img").each(function(){this.onresizestart=null,this.onresizeend=null,this.removeAttribute("onresizestart"),this.removeAttribute("onresizeend")}),t}},{"./i18n":"i18n","./jQuery":"jQuery"}],16:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s);a["default"].entwine("ss",function(e){e(".ss-tabset").entwine({IgnoreTabState:!1,onadd:function(){var e=window.location.hash;this.redrawTabs(),""!==e&&this.openTabFromURL(e),this._super()},onremove:function(){this.data("tabs")&&this.tabs("destroy"),this._super()},redrawTabs:function(){this.rewriteHashlinks(),this.tabs()},openTabFromURL:function(t){var i;e.each(this.find(".cms-panel-link"),function(){return-1!==this.href.indexOf(t)&&1===e(t).length?(i=e(this),!1):void 0}),void 0!==i&&e(window).one("ajaxComplete",function(){i.click()})},rewriteHashlinks:function(){e(this).find("ul a").each(function(){if(e(this).attr("href")){var t=e(this).attr("href").match(/#.*/);t&&e(this).attr("href",document.location.href.replace(/#.*/,"")+t[0])}})}})})},{"./jQuery":"jQuery"}],17:[function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var s=e("./jQuery"),a=n(s),r=e("./i18n"),o=n(r);a["default"].entwine("ss",function(e){var t,i;e(window).bind("resize.treedropdownfield",function(){var n=function(){e(".TreeDropdownField").closePanel()};if(e.browser.msie&&parseInt(e.browser.version,10)<9){var s=e(window).width(),a=e(window).height();(s!=t||a!=i)&&(t=s,i=a,n())}else n()});var n={openlink:o["default"]._t("TreeDropdownField.OpenLink"),fieldTitle:"("+o["default"]._t("TreeDropdownField.FieldTitle")+")",searchFieldTitle:"("+o["default"]._t("TreeDropdownField.SearchFieldTitle")+")"},s=function(t){e(t.target).parents(".TreeDropdownField").length||e(".TreeDropdownField").closePanel()};e(".TreeDropdownField").entwine({CurrentXhr:null,onadd:function(){this.append('<span class="treedropdownfield-title"></span><div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div><div class="treedropdownfield-panel"><div class="tree-holder"></div></div>');var e=n.openLink;e&&this.find("treedropdownfield-toggle-panel-link a").attr("title",e),this.data("title")&&this.setTitle(this.data("title")),this.getPanel().hide(),this._super()},getPanel:function(){return this.find(".treedropdownfield-panel")},openPanel:function(){e(".TreeDropdownField").closePanel(),e("body").bind("click",s);var t=this.getPanel(),i=this.find(".tree-holder");t.css("width",this.width()),t.show();var n=this.find(".treedropdownfield-toggle-panel-link");n.addClass("treedropdownfield-open-tree"),this.addClass("treedropdownfield-open-tree"),n.find("a").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-n"),i.is(":empty")&&!t.hasClass("loading")?this.loadTree(null,this._riseUp):this._riseUp(),this.trigger("panelshow")},_riseUp:function(){var t,i,n,s=this,a=this.getPanel(),r=this.find(".treedropdownfield-toggle-panel-link"),o=r.innerHeight();r.length>0&&(n=e(window).height()+e(document).scrollTop()-r.innerHeight(),i=r.offset().top,t=a.innerHeight(),i+t>n&&i-t>0?(s.addClass("treedropdownfield-with-rise"),o=-a.outerHeight()):s.removeClass("treedropdownfield-with-rise")),a.css({top:o+"px"})},closePanel:function(){jQuery("body").unbind("click",s);var e=this.find(".treedropdownfield-toggle-panel-link");e.removeClass("treedropdownfield-open-tree"),this.removeClass("treedropdownfield-open-tree treedropdownfield-with-rise"),e.find("a").removeClass("ui-icon-triangle-1-n").addClass("ui-icon-triangle-1-s"),this.getPanel().hide(),this.trigger("panelhide")},togglePanel:function(){this[this.getPanel().is(":visible")?"closePanel":"openPanel"]()},setTitle:function(e){e=e||this.data("title")||n.fieldTitle,this.find(".treedropdownfield-title").html(e),this.data("title",e)},getTitle:function(){return this.find(".treedropdownfield-title").text()},updateTitle:function(){var e=this,t=e.find(".tree-holder"),i=this.getValue(),n=function(){var i=e.getValue();if(i){var n=t.find('*[data-id="'+i+'"]'),s=n.children("a").find("span.jstree_pageicon")?n.children("a").find("span.item").html():null;s||(s=n.length>0?t.jstree("get_text",n[0]):null),s&&(e.setTitle(s),e.data("title",s)),n&&t.jstree("select_node",n)}else e.setTitle(e.data("empty-title")),e.removeData("title")};t.is(":empty")&&i?this.loadTree({forceValue:i},n):n()},setValue:function(t){this.data("metadata",e.extend(this.data("metadata"),{id:t})),this.find(":input:hidden").val(t).trigger("valueupdated").trigger("change")},getValue:function(){return this.find(":input:hidden").val()},loadTree:function(t,i){var n,s=this,a=this.getPanel(),r=e(a).find(".tree-holder"),t=t?e.extend({},this.getRequestParams(),t):this.getRequestParams();this.getCurrentXhr()&&this.getCurrentXhr().abort(),a.addClass("loading"),n=e.ajax({url:this.data("urlTree"),data:t,complete:function(e,t){a.removeClass("loading")},success:function(t,n,a){r.html(t);var o=!0;r.jstree("destroy").bind("loaded.jstree",function(e,t){var n=s.getValue(),a=r.find('*[data-id="'+n+'"]'),l=t.inst.get_selected();n&&a!=l&&t.inst.select_node(a),o=!1,i&&i.apply(s)}).jstree(s.getTreeConfig()).bind("select_node.jstree",function(t,i){var n=i.rslt.obj,a=e(n).data("id");o||s.getValue()!=a?(s.data("metadata",e.extend({id:a},e(n).getMetaData())),s.setTitle(i.inst.get_text(n)),s.setValue(a)):(s.data("metadata",null),s.setTitle(null),s.setValue(null),i.inst.deselect_node(n)),o||s.closePanel(),o=!1}),s.setCurrentXhr(null)}}),this.setCurrentXhr(n)},getTreeConfig:function(){var t=this;return{core:{html_titles:!0,animation:0},html_data:{data:this.getPanel().find(".tree-holder").html(),ajax:{url:function i(n){var i=e.path.parseUrl(t.data("urlTree")).hrefNoSearch;return i+"/"+(e(n).data("id")?e(n).data("id"):0)},data:function(i){var n=e.query.load(t.data("urlTree")).keys,s=t.getRequestParams();return s=e.extend({},n,s,{ajax:1})}}},ui:{select_limit:1,initially_select:[this.getPanel().find(".current").attr("id")]},themes:{theme:"apple"},types:{types:{"default":{check_node:function(e){return!e.hasClass("disabled")},uncheck_node:function(e){return!e.hasClass("disabled")},select_node:function(e){return!e.hasClass("disabled")},deselect_node:function(e){return!e.hasClass("disabled")}}}},plugins:["html_data","ui","themes","types"]}},getRequestParams:function(){return{}}}),e(".TreeDropdownField .tree-holder li").entwine({getMetaData:function(){var e=this.attr("class").match(/class-([^\s]*)/i),t=e?e[1]:"";return{ClassName:t}}}),e(".TreeDropdownField *").entwine({getField:function(){return this.parents(".TreeDropdownField:first")}}),e(".TreeDropdownField").entwine({onclick:function(e){return this.togglePanel(),!1}}),e(".TreeDropdownField .treedropdownfield-panel").entwine({onclick:function(e){return!1}}),e(".TreeDropdownField.searchable").entwine({onadd:function(){this._super();var t=o["default"]._t("TreeDropdownField.ENTERTOSEARCH");this.find(".treedropdownfield-panel").prepend(e('<input type="text" class="search treedropdownfield-search" data-skip-autofocus="true" placeholder="'+t+'" value="" />'))},search:function(e,t){this.openPanel(),this.loadTree({search:e},t)},cancelSearch:function(){this.closePanel(),this.loadTree()}}),e(".TreeDropdownField.searchable input.search").entwine({onkeydown:function(e){var t=this.getField();return 13==e.keyCode?(t.search(this.val()),!1):void(27==e.keyCode&&t.cancelSearch())}}),e(".TreeDropdownField.multiple").entwine({getTreeConfig:function(){var e=this._super();return e.checkbox={override_ui:!0,two_state:!0},e.plugins.push("checkbox"),e.ui.select_limit=-1,e},loadTree:function(t,i){var n,s=this,a=this.getPanel(),r=e(a).find(".tree-holder"),t=t?e.extend({},this.getRequestParams(),t):this.getRequestParams();this.getCurrentXhr()&&this.getCurrentXhr().abort(),a.addClass("loading"),n=e.ajax({url:this.data("urlTree"),data:t,complete:function(e,t){a.removeClass("loading")},success:function(t,n,a){r.html(t);var o=!0;s.setCurrentXhr(null),r.jstree("destroy").bind("loaded.jstree",function(t,n){e.each(s.getValue(),function(e,t){n.inst.check_node(r.find("*[data-id="+t+"]"))}),o=!1,i&&i.apply(s)}).jstree(s.getTreeConfig()).bind("uncheck_node.jstree check_node.jstree",function(t,i){var n=i.inst.get_checked(null,!0);s.setValue(e.map(n,function(t,i){return e(t).data("id")})),s.setTitle(e.map(n,function(e,t){return i.inst.get_text(e)})),s.data("metadata",e.map(n,function(t,i){return{id:e(t).data("id"),metadata:e(t).getMetaData()}}))})}}),this.setCurrentXhr(n)},getValue:function(){var e=this._super();return e.split(/ *, */)},setValue:function(t){this._super(e.isArray(t)?t.join(","):t)},setTitle:function(t){this._super(e.isArray(t)?t.join(", "):t)},updateTitle:function(){}}),e(".TreeDropdownField input[type=hidden]").entwine({onadd:function(){this._super(),this.bind("change.TreeDropdownField",function(){e(this).getField().updateTitle()})},onremove:function(){this._super(),this.unbind(".TreeDropdownField")}})})},{"./i18n":"i18n","./jQuery":"jQuery"}],18:[function(e,t,i){!function(e){e.fn.changetracker=function(t){var i=this;if(this.length>1)return this.each(function(e,i){this.changetracker(t)}),this;this.defaults={fieldSelector:":input:not(:submit)",ignoreFieldSelector:"",changedCssClass:"changed"};var n=e.extend({},this.defaults,t);if(this.initialize=function(){e.meta&&(n=e.extend({},n,this.data()));var t,s=!1,a=function(t){var a,r=e(t.target),o=r.data("changetracker.origVal");a=r.is(":checkbox")?r.is(":checked")?1:0:r.val(),null===o||a!=o?(r.addClass(n.changedCssClass),i.addClass(n.changedCssClass)):(r.removeClass(n.changedCssClass),r.is(":radio")&&i.find(":radio[name="+r.attr("name")+"]").removeClass(n.changedCssClass),s||i.getFields().filter("."+n.changedCssClass).length||i.removeClass(n.changedCssClass))},r=this.getFields();r.filter(":radio,:checkbox").bind("click.changetracker",a),r.not(":radio,:checkbox").bind("change.changetracker",a),r.each(function(){t=e(this).is(":radio,:checkbox")?i.find(":input[name="+e(this).attr("name")+"]:checked").val():e(this).val(),e(this).data("changetracker.origVal",t)}),i.bind("dirty.changetracker",function(){s=!0,i.addClass(n.changedCssClass)}),this.data("changetracker",!0)},this.destroy=function(){this.getFields().unbind(".changetracker").removeClass(n.changedCssClass).removeData("changetracker.origVal"),this.unbind(".changetracker").removeData("changetracker")},this.reset=function(){this.getFields().each(function(){i.resetField(this)}),this.removeClass(n.changedCssClass)},this.resetField=function(t){return e(t).removeData("changetracker.origVal").removeClass("changed")},this.getFields=function(){return this.find(n.fieldSelector).not(n.ignoreFieldSelector)},"string"==typeof arguments[0]){var s=(arguments[1],Array.prototype.slice.call(arguments));return s.splice(0,1),this[arguments[0]].apply(this,s)}return this.initialize()}}(jQuery)},{}],19:[function(e,t,i){jQuery.cookie=function(e,t,i){if("undefined"==typeof t){var n=null;if(document.cookie&&""!=document.cookie)for(var s=document.cookie.split(";"),a=0;a<s.length;a++){var r=jQuery.trim(s[a]);if(r.substring(0,e.length+1)==e+"="){n=decodeURIComponent(r.substring(e.length+1));break}}return n}i=i||{},null===t&&(t="",i=jQuery.extend({},i),i.expires=-1);var o="";if(i.expires&&("number"==typeof i.expires||i.expires.toUTCString)){var l;"number"==typeof i.expires?(l=new Date,l.setTime(l.getTime()+24*i.expires*60*60*1e3)):l=i.expires,o="; expires="+l.toUTCString()}var h=i.path?"; path="+i.path:"",c=i.domain?"; domain="+i.domain:"",d=i.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),o,h,c,d].join("")}},{}],20:[function(e,t,i){var n;!function(){var e={},t=/xyz/.test(function(){})?/\b_super\b/:/.*/;n=function(){},n.addMethod=function(e,i){var n=this._super&&this._super.prototype;n&&t.test(i)?this.prototype[e]=function(){var t=this._super;this._super=n[e];try{var s=i.apply(this,arguments)}finally{this._super=t}return s}:this.prototype[e]=i},n.addMethods=function(e){for(var t in e)"function"==typeof e[t]?this.addMethod(t,e[t]):this.prototype[t]=e[t]},n.subclassOf=function(e){for(var t=this;t;){if(t===e)return!0;t=t._super}},n.extend=function(t){var i=function(){if(arguments[0]!==e){if(!(this instanceof i)){var t=new i(e);return t.init&&t.init.apply(t,arguments),t}this.init&&this.init.apply(this,arguments)}};return i.constructor=i,i.extend=n.extend,i.addMethod=n.addMethod,i.addMethods=n.addMethods,i.subclassOf=n.subclassOf,i._super=this,i.prototype=new this(e),i.prototype.constructor=i,i.addMethods(t),i}}(),function(e){var t={UNICODE:/\\[0-9a-f]{1,6}(?:\r\n|[ \n\r\t\f])?/,ESCAPE:/(?:UNICODE)|\\[^\n\r\f0-9a-f]/,NONASCII:/[^\x00-\x7F]/,NMSTART:/[_a-z]|(?:NONASCII)|(?:ESCAPE)/,NMCHAR:/[_a-z0-9-]|(?:NONASCII)|(?:ESCAPE)/,IDENT:/-?(?:NMSTART)(?:NMCHAR)*/,NL:/\n|\r\n|\r|\f/,STRING:/(?:STRING1)|(?:STRING2)|(?:STRINGBARE)/,STRING1:/"(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\"])*"/,STRING2:/'(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\'])*'/,STRINGBARE:/(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\]])*/,FUNCTION:/(?:IDENT)\(\)/,INTEGER:/[0-9]+/,WITHN:/([-+])?(INTEGER)?(n)\s*(?:([-+])\s*(INTEGER))?/,WITHOUTN:/([-+])?(INTEGER)/},i={not:/:not\(/,not_end:/\)/,tag:/((?:IDENT)|\*)/,id:/#(IDENT)/,cls:/\.(IDENT)/,attr:/\[\s*(IDENT)\s*(?:([^=]?=)\s*(STRING)\s*)?\]/,pseudo_el:/(?::(first-line|first-letter|before|after))|(?:::((?:FUNCTION)|(?:IDENT)))/,pseudo_cls_nth:/:nth-child\(\s*(?:(?:WITHN)|(?:WITHOUTN)|(odd|even))\s*\)/,pseudo_cls:/:(IDENT)/,comb:/\s*(\+|~|>)\s*|\s+/,comma:/\s*,\s*/,important:/\s+!important\s*$/},s=/[A-Z][A-Z0-9]+/;for(var a in i){for(var r,o=i[a].source;r=o.match(s);)o=o.replace(r[0],t[r[0]].source);i[a]=new RegExp(o,"gi")}var l=n.extend({init:function(e){this.str=e,this.pos=0},match:function(e){var t;return e.lastIndex=this.pos,(t=e.exec(this.str))&&t.index==this.pos?(this.pos=e.lastIndex?e.lastIndex:this.str.length,t):null},peek:function(e){var t;return e.lastIndex=this.pos,(t=e.exec(this.str))&&t.index==this.pos?t:null},showpos:function(){return this.str.slice(0,this.pos)+"<HERE>"+this.str.slice(this.pos)},done:function(){return this.pos==this.str.length}}),h=n.extend({}),c=h.extend({init:function(){this.tag=null,this.id=null,this.classes=[],this.attrs=[],this.nots=[],this.pseudo_classes=[],this.pseudo_els=[]},parse:function(e){var t;(t=e.match(i.tag))&&(this.tag=t[1]);do if(t=e.match(i.not)){if(this.nots[this.nots.length]=u().parse(e),!(t=e.match(i.not_end)))throw"Invalid :not term in selector"}else if(t=e.match(i.id))this.id=t[1];else if(t=e.match(i.cls))this.classes[this.classes.length]=t[1];else if(t=e.match(i.attr))this.attrs[this.attrs.length]=[t[1],t[2],t[3]];else if(t=e.match(i.pseudo_el))this.pseudo_els[this.pseudo_els.length]=t[1]||t[2];else if(t=e.match(i.pseudo_cls_nth)){if(t[3])var n=parseInt((t[1]||"")+(t[2]||"1")),s=parseInt((t[4]||"")+(t[5]||"0"));else var n=t[8]?2:0,s=t[8]?4-t[8].length:parseInt((t[6]||"")+t[7]);this.pseudo_classes[this.pseudo_classes.length]=["nth-child",[n,s]]}else(t=e.match(i.pseudo_cls))&&(this.pseudo_classes[this.pseudo_classes.length]=[t[1]]);while(t&&!e.done());return this}}),d=h.extend({init:function(){this.parts=[]},parse:function(e){for(this.parts[this.parts.length]=c().parse(e);!e.done()&&!e.peek(i.comma)&&(r=e.match(i.comb));)this.parts[this.parts.length]=r[1]||" ",this.parts[this.parts.length]=c().parse(e);return 1==this.parts.length?this.parts[0]:this}}),u=h.extend({init:function(){this.parts=[]},parse:function(e){for(this.parts[this.parts.length]=d().parse(e);!e.done()&&(r=e.match(i.comma));)this.parts[this.parts.length]=d().parse(e);return 1==this.parts.length?this.parts[0]:this}});e.selector=function(e){var t=l(e),i=u().parse(t);if(i.selector=e,t.done())return i;throw"Could not parse selector - "+t.showpos()},e.selector.SelectorBase=h,e.selector.SimpleSelector=c,e.selector.Selector=d,e.selector.SelectorsGroup=u}(jQuery),function(e){e.selector.SimpleSelector.addMethod("specifity",function(){if(this.spec)return this.spec;var t=[this.id?1:0,this.classes.length+this.attrs.length+this.pseudo_classes.length,(this.tag&&"*"!=this.tag?1:0)+this.pseudo_els.length];return e.each(this.nots,function(e,i){var n=i.specifity();t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}),this.spec=t}),e.selector.Selector.addMethod("specifity",function(){if(this.spec)return this.spec;var t=[0,0,0];return e.each(this.parts,function(e,i){if(!(e%2)){var n=i.specifity();t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}}),this.spec=t}),e.selector.SelectorsGroup.addMethod("specifity",function(){if(this.spec)return this.spec;var t=[0,0,0];return e.each(this.parts,function(e,i){var n=i.specifity();t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}),this.spec=t})}(jQuery),function(e){function t(e){return e.complex?c(["l"+ ++v+":{",e.replace(o,"break l"+v),"}"]):e.replace(o,"")}var i=document.createElement("div");i.innerHTML='<form id="test"><input name="id" type="text"/></form>';var s,a="test"!==i.firstChild.getAttribute("id"),r=i.firstElementChild&&"FORM"==i.firstElementChild.tagName,o=(i.children&&"FORM"==i.children[0].tagName,/GOOD/g),l=/BAD/g,h=/^['"]/g,c=function(e){return e.join("\n")},d=function(e){var t=new String(e.join("\n"));return t.complex=!0,t},u=function(e){return"_"+e.replace(/^[^A-Za-z]|[^A-Za-z0-9]/g,function(e){return"_0x"+e.charCodeAt(0).toString(16)+"_"})};if(a){var p={"class":"className","for":"htmlFor"};s=function(e){var t=p[e]||e;return"var "+u(e)+' = el.getAttribute("'+t+'",2) || (el.getAttributeNode("'+e+'")||{}).nodeValue;'}}else s=function(e){return"var "+u(e)+' = el.getAttribute("'+e+'");'};var f={"-":"!K","=":'K != "V"',"!=":'K == "V"',"~=":'_WS_K.indexOf(" V ") == -1',"^=":'!K || K.indexOf("V") != 0',"*=":'!K || K.indexOf("V") == -1',"$=":'!K || K.substr(K.length-"V".length) != "V"'},g=e.selector.State=n.extend({init:function(){this.reset()},reset:function(){this.attrs={},this.wsattrs={}},prev:function(){return this.reset(),r?"el = el.previousElementSibling":"while((el = el.previousSibling) && el.nodeType != 1) {}"},next:function(){return this.reset(),r?"el = el.nextElementSibling":"while((el = el.nextSibling) && el.nodeType != 1) {}"},prevLoop:function(e){return this.reset(),c(r?["while(el = el.previousElementSibling){",e]:["while(el = el.previousSibling){","if (el.nodeType != 1) continue;",e])},parent:function(){return this.reset(),"el = el.parentNode;"},parentLoop:function(e){return this.reset(),c(["while((el = el.parentNode) && el.nodeType == 1){",e,"}"])},uses_attr:function(e){return this.attrs[e]?void 0:(this.attrs[e]=!0,s(e))},uses_wsattr:function(e){return this.wsattrs[e]?void 0:(this.wsattrs[e]=!0,c([this.uses_attr(e),"var _WS_"+u(e)+' = " "+'+u(e)+'+" ";']))},uses_jqueryFilters:function(){return this.jqueryFiltersAdded?void 0:(this.jqueryFiltersAdded=!0,"var _$filters = jQuery.find.selectors.filters;")},save:function(e){return"var el"+e+" = el;"},restore:function(e){return this.reset(),"el = el"+e+";"}}),m={"first-child":c(["var cel = el;","while(cel = cel.previousSibling){ if (cel.nodeType === 1) BAD; }"]),"last-child":c(["var cel = el;","while(cel = cel.nextSibling){ if (cel.nodeType === 1) BAD; }"]),"nth-child":function(e,t){var i=c(["var i = 1, cel = el;","while(cel = cel.previousSibling){","if (cel.nodeType === 1) i++;","}"]);return c(0==e?[i,"if (i- "+t+" != 0) BAD;"]:0==t&&e>=0?[i,"if (i%"+e+" != 0 || i/"+e+" < 0) BAD;"]:0==t&&0>e?["BAD;"]:[i,"if ((i- "+t+")%"+e+" != 0 || (i- "+t+")/"+e+" < 0) BAD;"])}};m["only-child"]=c([m["first-child"],m["last-child"]]),e.selector.SimpleSelector.addMethod("compile",function(t){var i=[];return this.tag&&"*"!=this.tag&&(i[i.length]='if (el.tagName != "'+this.tag.toUpperCase()+'") BAD;'),this.id&&(i[i.length]=t.uses_attr("id"),i[i.length]='if (_id !== "'+this.id+'") BAD;'),this.classes.length&&(i[i.length]=t.uses_wsattr("class"),e.each(this.classes,function(e,t){i[i.length]='if (_WS__class.indexOf(" '+t+' ") == -1) BAD;'})),e.each(this.attrs,function(e,n){i[i.length]="~="==n[1]?t.uses_wsattr(n[0]):t.uses_attr(n[0]);var s=f[n[1]||"-"];s=s.replace(/K/g,u(n[0])).replace(/V/g,n[2]&&n[2].match(h)?n[2].slice(1,-1):n[2]),i[i.length]="if ("+s+") BAD;"}),e.each(this.nots,function(n,s){var a=++v,r=c(["l"+a+":{",s.compile(t).replace(l,"break l"+a).replace(o,"BAD"),"}"]);s instanceof e.selector.SimpleSelector||(r=c([t.save(a),r,t.restore(a)])),i[i.length]=r}),e.each(this.pseudo_classes,function(n,s){var a=m[s[0]];a?i[i.length]="function"==typeof a?a.apply(this,s[1]):a:(a=e.find.selectors.filters[s[0]])&&(i[i.length]=t.uses_jqueryFilters(),i[i.length]="if (!_$filters."+s[0]+"(el)) BAD;")}),i[i.length]="GOOD",c(i)});var v=0,_={" ":function(e,t,i){return d([i,"while(true){",e.parent(),"if (!el || el.nodeType !== 1) BAD;",t.compile(e).replace(l,"continue"),"}"])},">":function(e,t,i){return c([i,e.parent(),"if (!el || el.nodeType !== 1) BAD;",t.compile(e)])},"~":function(e,t,i){return d([i,e.prevLoop(),t.compile(e).replace(l,"continue"),"}","BAD;"])},"+":function(e,t,i){return c([i,e.prev(),"if (!el) BAD;",t.compile(e)])}};e.selector.Selector.addMethod("compile",function(e){for(var i=this.parts.length,n=this.parts[--i].compile(e);i;){var s=this.parts[--i];n=_[s](e,this.parts[--i],t(n))}return n}),e.selector.SelectorsGroup.addMethod("compile",function(e){for(var t=[],i=++v,n=0;n<this.parts.length;n++)t[t.length]=c([0==n?e.save(i):e.restore(i),"l"+i+"_"+n+":{",this.parts[n].compile(e).replace(l,"break l"+i+"_"+n),"}"]);return t[t.length]="BAD;",c(t)}),e.selector.SelectorBase.addMethod("matches",function(e){return this.matches=new Function("el",c(["if (!el) return false;",this.compile(new g).replace(l,"return false").replace(o,"return true")])),this.matches(e)})}(jQuery),function(e){var t=/DIRECT/g,i=/CONTEXT/g,n=/DIRECT|CONTEXT/g;e.selector.SelectorBase.addMethod("affectedBy",function(e){return this.affectedBy=new Function("props",["var direct_classes, context_classes, direct_attrs, context_attrs, t;",this.ABC_compile().replace(t,"direct").replace(i,"context"),"return {classes: {context: context_classes, direct: direct_classes}, attrs: {context: context_attrs, direct: direct_attrs}};"].join("\n")),this.affectedBy(e)}),e.selector.SimpleSelector.addMethod("ABC_compile",function(){var t=[];return e.each(this.classes,function(e,i){t[t.length]="if (t = props.classes['"+i+"']) (DIRECT_classes || (DIRECT_classes = {}))['"+i+"'] = t;"}),e.each(this.nots,function(e,i){t[t.length]=i.ABC_compile()}),t.join("\n")}),e.selector.Selector.addMethod("ABC_compile",function(e){var t=[],i=this.parts.length-1;for(t[t.length]=this.parts[i].ABC_compile();(i-=2)>=0;)t[t.length]=this.parts[i].ABC_compile().replace(n,"CONTEXT");return t.join("\n")}),e.selector.SelectorsGroup.addMethod("ABC_compile",function(){var t=[];return e.each(this.parts,function(e,i){t[t.length]=i.ABC_compile()}),t.join("\n")})}(jQuery),function(e){void 0===e.support.focusinBubbles&&(e.support.focusinBubbles=!!e.browser.msie),e.support.focusinBubbles||e.event.special.focusin||e.each({focus:"focusin",blur:"focusout"},function(t,i){e.event.special[i]={setup:function(){return this.addEventListener?void this.addEventListener(t,e.event.special[i].handler,!0):!1},teardown:function(){return this.removeEventListener?void this.removeEventListener(t,e.event.special[i].handler,!0):!1},handler:function(t){return arguments[0]=e.event.fix(t),arguments[0].type=i,e.event.handle.apply(this,arguments)}}}),function(){var t=null;e(document).bind("focusin",function(i){var n=i.realTarget||i.target;t&&t!==n&&(i.type="focusout",e(t).trigger(i),i.type="focusin",i.target=n),t=n}).bind("focusout",function(e){t=null})}()}(jQuery);try{console.log}catch(s){window.console=void 0}!function(e){var t=function(){function t(e,i){return new t.fn.init(e,i)}jQuery.extend(!0,t,e),t.superclass=e,t.fn=t.prototype=e(),t.fn.constructor=t,t.fn.init=function(e,n){return n&&n instanceof jQuery&&!(n instanceof t)&&(n=t(n)),jQuery.fn.init.call(this,e,n,i)},t.fn.init.prototype=t.fn;var i=t(document);return t},i={};e.entwine=function(){e.fn.entwine.apply(null,arguments)},e.extend(e.entwine,{namespaces:i,clear_all_rules:function(){for(var t in e.fn)e.fn[t].isentwinemethod&&delete e.fn[t];e(document).unbind(".entwine"),e(window).unbind(".entwine");for(var t in i)delete i[t];for(var t in e.entwine.capture_bindings)delete e.entwine.capture_bindings[t]},WARN_LEVEL_NONE:0,WARN_LEVEL_IMPORTANT:1,WARN_LEVEL_BESTPRACTISE:2,warningLevel:0,warn:function(t,i){i<=e.entwine.warningLevel&&console&&console.warn&&(console.warn(t),console.trace&&console.trace())},warn_exception:function(t,i,n){e.entwine.WARN_LEVEL_IMPORTANT<=e.entwine.warningLevel&&console&&console.warn&&(2==arguments.length&&(n=i,i=null),i?console.warn("Uncaught exception",n,"in",t,"on",i):console.warn("Uncaught exception",n,"in",t),n.stack&&console.warn("Stack Trace:\n"+n.stack))}});var s=0,a=n.extend({init:function(e,t){this.selector=e,this.specifity=e.specifity(),this.important=0,this.name=t,this.rulecount=s++}});a.compare=function(e,t){var i=e.specifity,n=t.specifity;return e.important-t.important||i[0]-n[0]||i[1]-n[1]||i[2]-n[2]||e.rulecount-t.rulecount},e.entwine.RuleList=function(){var e=[];return e.addRule=function(t,i){var n=a(t,i);return e[e.length]=n,e.sort(a.compare),n},e};var r=[];e.entwine.Namespace=n.extend({init:function(n){if(n&&!n.match(/^[A-Za-z0-9.]+$/)&&e.entwine.warn("Entwine namespace "+n+" is not formatted as period seperated identifiers",e.entwine.WARN_LEVEL_BESTPRACTISE),n=n||"__base",this.name=n,this.store={},i[n]=this,"__base"==n)this.injectee=e.fn,this.$=e;else{this.$=e.sub?e.sub():t(),this.$.cache=e.cache,this.injectee=this.$.prototype;var s=this.injectee.entwine=function(t){var i=arguments;return t&&"string"==typeof t?"."!=t.charAt(0)&&(i[0]=n+"."+t):(i=e.makeArray(i),i.unshift(n)),e.fn.entwine.apply(this,i)};this.$.entwine=function(){s.apply(null,arguments)};for(var a=0;a<r.length;a++){var o,l=r[a];if(o=l.namespaceMethodOverrides){var h=o(this);for(var c in h)this.injectee[c]=h[c]}if(o=l.namespaceStaticOverrides){var h=o(this);for(var c in h)this.$.entwine[c]=h[c]}}}},one:function(e,t,i){var n=this,s=this.store[e],a=function(e,r,o){for(void 0===o&&(o=s.length);o--;)if(s[o].selector.matches(e)){var l,h=e.i,c=e.f;e.i=o,e.f=a;try{l=s[o][t].apply(n.$(e),r)}finally{e.i=h,e.f=c}return l}return i?i.apply(n.$(e),r):void 0};return a},build_proxy:function(t,i){var n=this.one(t,"func",i),s=function(){for(var t,i=e(this),s=i.length;s--;)t=n(i[s],arguments);return t};return s},bind_proxy:function(t,i,n){var s=this.store[i]||(this.store[i]=e.entwine.RuleList()),a=s.addRule(t,i);a.func=n,this.injectee.hasOwnProperty(i)&&this.injectee[i].isentwinemethod||(this.injectee[i]=this.build_proxy(i,this.injectee.hasOwnProperty(i)?this.injectee[i]:null),this.injectee[i].isentwinemethod=!0),this.injectee[i].isentwinemethod||e.entwine.warn("Warning: Entwine function "+i+" clashes with regular jQuery function - entwine function will not be callable directly on jQuery object",e.entwine.WARN_LEVEL_IMPORTANT)},add:function(e,t){for(var i in t)for(var n=t[i],s=0;s<r.length&&(!r[s].bind||!r[s].bind.call(this,e,i,n));s++);},has:function(e,t){var i=this.store[t];if(!i)return!1;for(var n=0;n<i.length;n++)if(e=e.not(i[n].selector),!e.length)return!0;return!1}}),e.entwine.Namespace.addHandler=function(e){for(var t=0;t<r.length&&r[t].order<e.order;t++);r.splice(t,0,e)},e.entwine.Namespace.addHandler({order:50,bind:function(t,i,n){return e.isFunction(n)?(this.bind_proxy(t,i,n),!0):void 0}}),e.extend(e.fn,{entwine:function(t){var n=0,s=null,a=i.__base||e.entwine.Namespace();for("string"==typeof t&&("."==t.charAt("0")&&(t=t.substr(1)),t&&(a=i[t]||e.entwine.Namespace(t)),n=1);n<arguments.length;){var r=arguments[n++];e.isFunction(r)&&(1!=r.length&&e.entwine.warn("Function block inside entwine definition does not take $ argument properly",e.entwine.WARN_LEVEL_IMPORTANT),r=r.call(a.$(this),a.$)),r&&(null===s&&(s=this.selector?e.selector(this.selector):!1),s?a.add(s,r):e.entwine.warn("Entwine block given to entwine call without selector. Make sure you call $(selector).entwine when defining blocks",e.entwine.WARN_LEVEL_IMPORTANT))}return a.$(this)},_super:function(){for(var e,t=this.length;t--;){var i=this[0];e=i.f(i,arguments,i.i)}return e}})}(jQuery),function(e){function t(e,t){for(var i,n=e.length,s=t.firstChild;i=s;)for(1===i.nodeType&&(e[n++]=i),s=i.firstChild||i.nextSibling;!s&&(i=i.parentNode)&&i!==t;)s=i.nextSibling}var i=!1,n=function(n){var s=function(s){var a=[];i||(1==s.nodeType&&(a[a.length]=s),t(a,s));var r=n.apply(this,arguments);if(!i&&a.length){var o=e.Event("EntwineElementsAdded");o.targets=a,e(document).triggerHandler(o)}return r};return s.patched=!0,s},s=e.prototype.jquery.split("."),a=s[0]>1||s[1]>=10?1:2,r=e.prototype.domManip;e.prototype.domManip=function(){return arguments[a].patched||(arguments[a]=n(arguments[a])),r.apply(this,arguments)};var o=e.prototype.html;e.prototype.html=function(n){if(void 0===n)return o.apply(this,arguments);i=!0;var s=o.apply(this,arguments);i=!1;for(var a=[],r=0,l=this.length;l>r;r++)t(a,this[r]);var h=e.Event("EntwineElementsAdded");return h.targets=a,e(document).triggerHandler(h),s};var l=!1,h=e.cleanData;e.cleanData=function(t){var i=t;if(l)for(var n=0,s=t.length,i=[],a=0;s>n;n++)for(var r=t[n],o=r;o=o.parentNode;)if(9==o.nodeType){i[a++]=r;break}if(i.length){var c=e.Event("EntwineElementsRemoved");c.targets=i,e(document).triggerHandler(c)}l||h.apply(this,arguments)};var c=e.prototype.remove;e.prototype.remove=function(e,t){l=t;var i=c.call(this,e);return l=!1,i},e(function(){var i=[];t(i,document);var n=e.Event("EntwineElementsAdded");n.targets=i,e(document).triggerHandler(n)})}(jQuery),function(e){var t=function(){var t=e.makeArray(arguments),i=t.pop();e.each(t,function(t,n){var s=e.fn[n];e.fn[n]=function(){var t=this,n=e.makeArray(arguments),a=s.apply(t,n);return i.apply(t,n),a}})},i=window.setTimeout,s=n.extend({init:function(){this.global=!1,this.attrs={},this.classes={}},triggerEvent:function(){a==this&&(this.check_id&&clearTimeout(this.check_id),a=new s,e(document).triggerHandler("EntwineSubtreeMaybeChanged",[this]))},changed:function(){if(!this.check_id){var e=this;this.check_id=i(function(){e.check_id=null,e.triggerEvent()},10)}},addAll:function(){return this.global?this:(this.global=!0,this.changed(),this)},addSubtree:function(e){return this.addAll()},addSubtreeFuture:function(t){return this.global?this:(this.subtree=this.subtree?this.subtree.add(t):e(t),this.changed(),this)},addAttr:function(t,i){return this.global?this:(this.attrs[t]=t in this.attrs?this.attrs[t].add(i):e(i),this.changed(),this)},addClass:function(t,i){return this.global?this:(this.classes[t]=t in this.classes?this.classes[t].add(i):e(i),this.changed(),this)}}),a=new s;e(document).bind("EntwineElementsAdded",function(e){a.addSubtree(e.targets)});var r=null;e(document).bind("EntwineElementsRemoved",function(e){r=e.targets}),t("remove","html","empty",function(){var e=r;r=null,e&&a.addSubtree(e)}),t("removeAttr",function(e){
a.addAttr(e,this)}),t("addClass","removeClass","toggleClass",function(e){"string"==typeof e&&a.addClass(e,this)}),t("attr",function(e,t){if(void 0!==t&&"string"==typeof e)a.addAttr(e,this);else if("string"!=typeof e)for(var i in e)a.addAttr(i,this)}),e.extend(e.entwine,{synchronous_mode:function(){a&&a.check_id&&clearTimeout(a.check_id),a=new s,i=function(e,t){return e.call(this),null}},triggerMatching:function(){a.addAll()}})}(jQuery),function(e){if(void 0==e.support.changeBubbles){e.support.changeBubbles=!0;var t=document.createElement("div");if(eventName="onchange",t.attachEvent){var i=eventName in t;i||(t.setAttribute(eventName,"return;"),i="function"==typeof t[eventName]),e.support.changeBubbles=i}}if(document.compareDocumentPosition)var n=function(e,t){return e&&t&&(e==t||!!(16&e.compareDocumentPosition(t)))};else var n=function(e,t){return e&&t&&(e==t||(e.contains?e.contains(t):!0))};e.entwine.Namespace.addMethods({build_event_proxy:function(e){var t=this.one(e,"func"),i=function(e,i){e=e.delegatedEvent||e;for(var n=e.target;n&&1==n.nodeType&&!e.isPropagationStopped();){var s=t(n,arguments);void 0!==s&&(e.result=s),s===!1&&(e.preventDefault(),e.stopPropagation()),n=n.parentNode}};return i},build_mouseenterleave_proxy:function(e){var t=this.one(e,"func"),i=function(e){for(var i=e.target,s=e.relatedTarget;i&&1==i.nodeType&&!e.isPropagationStopped()&&!n(i,s);){var a=t(i,arguments);void 0!==a&&(e.result=a),a===!1&&(e.preventDefault(),e.stopPropagation()),i=i.parentNode}};return i},build_change_proxy:function(e){var t=this.one(e,"func"),i=function(e){var t=e.type,i=e.value;return"radio"===t||"checkbox"===t?i=e.checked:"select-multiple"===t?(i="",e.selectedIndex>-1&&(i=jQuery.map(e.options,function(e){return e.selected}).join("-"))):jQuery.nodeName(e,"select")&&(i=e.selectedIndex),i},n=/^(?:textarea|input|select)$/i,s=function(e){var s,a,r=e.target;if(n.test(r.nodeName)&&!r.readOnly&&(s=jQuery.data(r,"_entwine_change_data"),a=i(r),("focusout"!==e.type||"radio"!==r.type)&&jQuery.data(r,"_entwine_change_data",a),void 0!==s&&a!==s&&(null!=s||a)))for(e.type="change";r&&1==r.nodeType&&!e.isPropagationStopped();){var o=t(r,arguments);void 0!==o&&(e.result=o),o===!1&&(e.preventDefault(),e.stopPropagation()),r=r.parentNode}},a=function(e){var t=e.type,n=e.target,a=jQuery.nodeName(n,"input")?n.type:"";switch(t){case"focusout":case"beforedeactivate":s.apply(this,arguments);break;case"click":("radio"===a||"checkbox"===a||jQuery.nodeName(n,"select"))&&s.apply(this,arguments);break;case"keydown":(13===e.keyCode&&!jQuery.nodeName(n,"textarea")||32===e.keyCode&&("checkbox"===a||"radio"===a)||"select-multiple"===a)&&s.apply(this,arguments);break;case"focusin":case"beforeactivate":jQuery.data(n,"_entwine_change_data",i(n))}};return a},bind_event:function(t,i,n,s){var a=this.store[i]||(this.store[i]=e.entwine.RuleList()),r=a.proxies||(a.proxies={}),o=a.addRule(t,i);if(o.func=n,!r[i]){switch(i){case"onmouseenter":r[i]=this.build_mouseenterleave_proxy(i),s="mouseover";break;case"onmouseleave":r[i]=this.build_mouseenterleave_proxy(i),s="mouseout";break;case"onchange":e.support.changeBubbles||(r[i]=this.build_change_proxy(i),s="click keydown focusin focusout beforeactivate beforedeactivate");break;case"onsubmit":s="delegatedSubmit";break;case"onfocus":case"onblur":e.entwine.warn("Event "+s+" not supported - using focusin / focusout instead",e.entwine.WARN_LEVEL_IMPORTANT)}r[i]||(r[i]=this.build_event_proxy(i)),e(document).bind(s.replace(/(\s+|$)/g,".entwine$1"),r[i])}}}),e.entwine.Namespace.addHandler({order:40,bind:function(t,i,n){var s,a;return e.isFunction(n)&&(s=i.match(/^on(.*)/))?(a=s[1],this.bind_event(t,i,n,a),!0):void 0}});var s=function(t,i){var n=e.Event("delegatedSubmit");return n.delegatedEvent=t,e(document).trigger(n,i)};e(document).bind("EntwineElementsAdded",function(t){var i=e(t.targets).filter("form");i.length&&i.bind("submit.entwine_delegate_submit",s)})}(jQuery),function(e){e.entwine.Namespace.addMethods({bind_capture:function(t,i,n,s){var a=this.captures||(this.captures={}),r=a[i]||(a[i]={}),o=r[n]||(r[n]=e.entwine.RuleList()),l=o.addRule(t,i);l.handler=n,this.bind_proxy(t,n,s)}});var t=e.entwine.capture_bindings={},i=function(t){return function(i){var n,s,a,r,o,l,h;for(var c in e.entwine.namespaces)if(n=e.entwine.namespaces[c],s=n.captures,s&&(a=s[t]))for(var c in a)for(var r=a[c],d=n.$([]),u=r.length;u--;){o=r[u],l=o.handler,h=o.selector.selector;var p=n.$(h).not(d);p[l].apply(p,arguments),d=d.add(p)}}},n=function(t,i,n){var s=e.selector(t);return function(e){return s.matches(e.target)?i.apply(this,arguments):void 0}},s=function(e,t,i){return function(e){return e.target===document?t.apply(this,arguments):void 0}},a=function(e,t,i){return function(e){return e.target===window?t.apply(this,arguments):void 0}},r=function(t,i,n){return function(n){var s=this["get"+t]();if("string"==typeof s){var a=a&&s==a.selector?a:e.selector(s);if(a.matches(n.target))return i.apply(this,arguments)}else if(-1!==e.inArray(n.target,s))return i.apply(this,arguments)}};e.entwine.Namespace.addHandler({order:10,bind:function(o,l,h){var c;if(e.isPlainObject(h)&&(c=l.match(/^from\s*(.*)/))){var d,u=c[1];d=u.match(/[^\w]/)?n:"Window"==u||"window"==u?a:"Document"==u||"document"==u?s:r;for(var p in h){var f=h[p];c=p.match(/^on(.*)/);var g=c[1];if(this.bind_capture(o,g,l+"_"+g,d(u,f)),!t[g]){var m=g.replace(/(\s+|$)/g,".entwine$1");t[g]=i(g),e(d==a?window:document).bind(m,t[g])}}return!0}}})}(jQuery),function(e){e.entwine.Namespace.addMethods({bind_condesc:function(t,i,n){for(var s,a=this.store.ctors||(this.store.ctors=e.entwine.RuleList()),r=0;r<a.length;r++)if(a[r].selector.selector==t.selector){s=a[r];break}if(s||(s=a.addRule(t,"ctors")),s[i]=n,!a[i+"proxy"]){var o=this.one("ctors",i),l=this,h=function(t,n,s){for(var a=t.length;a--;){var r=t[a],h=r.i,c=r.f;r.i=n,r.f=o;try{s.call(l.$(r))}catch(d){e.entwine.warn_exception(i,r,d)}finally{r.i=h,r.f=c}}};a[i+"proxy"]=h}}}),e.entwine.Namespace.addHandler({order:30,bind:function(t,i,n){return!e.isFunction(n)||"onmatch"!=i&&"onunmatch"!=i?void 0:(this.matchersDirty=!0,this.bind_condesc(t,i,n),!0)}}),e(document).bind("EntwineSubtreeMaybeChanged",function(t,i){for(var n in e.entwine.namespaces){var s=e.entwine.namespaces[n],a=s.store.ctors;if(a){for(var r,o,l,h,c,d,u,p,f=null,g=e([]),m=e([]),v=function(t){if(null===f){f=e([]);for(var i,n=a.length;--n>t;)(i=a[n].cache)&&(f=f.add(i))}},_=a.length;_--;){if(h=a[_],c=h.selector.selector,d=h.onmatch,u=h.onunmatch,l=null,p=!1,s.matchersDirty||i.global)p=!0;else{for(var n in i.attrs){p=!0;break}var y=h.selector.affectedBy(i);if(y.classes.context)p=!0;else for(var n in y.classes.direct){v(_);var b=i.classes[n].not(f);null===l&&(l=h.cache?h.cache.not(g).add(m.filter(c)):e([])),l=l.not(b).add(b.filter(c))}}p?(v(_),l=e(c).not(f)):l||(r=m.length&&m.filter(c),r&&r.length?l=h.cache?h.cache.not(g).add(r):r:(o=g.length&&h.cache&&h.cache.filter(g),o&&o.length&&(l=h.cache.not(o)))),null===l?f&&h.cache&&(f=f.add(h.cache)):(h.cache?(r=l.not(h.cache),o=h.cache.not(l)):(r=l,o=null),(r&&r.length||o&&o.length)&&(o&&o.length&&(m=m.add(o),u&&!h.onunmatchRunning&&(h.onunmatchRunning=!0,a.onunmatchproxy(o,_,u),h.onunmatchRunning=!1)),r&&r.length&&(g=g.add(r),m=m.not(r),d&&!h.onmatchRunning&&(h.onmatchRunning=!0,a.onmatchproxy(r,_,d),h.onmatchRunning=!1))),f&&(f=f.add(l)),h.cache=l)}s.matchersDirty=!1}}})}(jQuery),function(e){e.entwine.Namespace.addMethods({build_addrem_proxy:function(e){var t=this.one(e,"func");return function(){if(0!==this.length){if(this.length){for(var e,i=this.length;i--;)e=t(this[i],arguments);return e}return t(this,arguments)}}},bind_addrem_proxy:function(t,i,n){var s=this.store[i]||(this.store[i]=e.entwine.RuleList()),a=s.addRule(t,i);a.func=n,this.injectee.hasOwnProperty(i)||(this.injectee[i]=this.build_addrem_proxy(i),this.injectee[i].isentwinemethod=!0)}}),e.entwine.Namespace.addHandler({order:30,bind:function(t,i,n){return!e.isFunction(n)||"onadd"!=i&&"onremove"!=i?void 0:(this.bind_addrem_proxy(t,i,n),!0)}}),e(document).bind("EntwineElementsAdded",function(t){for(var i in e.entwine.namespaces){var n=e.entwine.namespaces[i];n.injectee.onadd&&n.injectee.onadd.call(t.targets)}}),e(document).bind("EntwineElementsRemoved",function(t){for(var i in e.entwine.namespaces){var n=e.entwine.namespaces[i];n.injectee.onremove&&n.injectee.onremove.call(t.targets)}})}(jQuery),function(e){var t="__entwine!",i=function(e,i,n){return e.data(t+i+"!"+n)},n=function(e,i,n,s){return e.data(t+i+"!"+n,s)},s=function(e,i){var n={},s=jQuery.data(e[0]),a=t+i+"!",r=a.length,o=jQuery.cache[s];for(var l in o)l.substr(0,r)==a&&(n[l.substr(r)]=o[l]);return n},a=function(e,t,i){for(var s in i)n(t,s,i[s])},r=function(e,t,r){switch(r.length){case 0:return s(e,t);case 1:return"string"==typeof r[0]?i(e,t,r[0]):a(e,t,r[0]);default:return n(e,t,r[0],r[1])}};e.extend(e.fn,{entwineData:function(){return r(this,"__base",arguments)}}),e.entwine.Namespace.addHandler({order:60,bind:function(t,i,n){i.charAt(0)!=i.charAt(0).toUpperCase()&&e.entwine.warn("Entwine property "+i+" does not start with a capital letter",e.entwine.WARN_LEVEL_BESTPRACTISE);var s="get"+i,a="set"+i;this.bind_proxy(t,s,function(){var e=this.entwineData(i);return void 0===e?n:e}),this.bind_proxy(t,a,function(e){return this.entwineData(i,e)});var r=this.injectee[s],o=this.injectee[a];return this.bind_proxy(t,i,function(e){return(1==arguments.length?o:r).call(this,e)}),!0},namespaceMethodOverrides:function(e){return{entwineData:function(){return r(this,e.name,arguments)}}}})}(jQuery),function(e){e.concrete=e.entwine,e.fn.concrete=e.fn.entwine,e.fn.concreteData=e.fn.entwineData,e.entwine.Namespace.addHandler({order:100,bind:function(e,t,i){return!1},namespaceMethodOverrides:function(e){return e.$.concrete=e.$.entwine,e.injectee.concrete=e.injectee.entwine,e.injectee.concreteData=e.injectee.entwineData,{}}})}(jQuery)},{}],21:[function(e,t,i){!function(e){function t(t){var i=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(this).ajaxSubmit(i))}function i(t){var i=t.target,n=e(i);if(!n.is(":submit,input:image")){var s=n.closest(":submit");if(0==s.length)return;i=s[0]}var a=this;if(a.clk=i,"image"==i.type)if(void 0!=t.offsetX)a.clk_x=t.offsetX,a.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var r=n.offset();a.clk_x=t.pageX-r.left,a.clk_y=t.pageY-r.top}else a.clk_x=t.pageX-i.offsetLeft,a.clk_y=t.pageY-i.offsetTop;setTimeout(function(){a.clk=a.clk_x=a.clk_y=null},100)}function n(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}e.fn.ajaxSubmit=function(t){function i(i){for(var n=new FormData,s=0;s<i.length;s++)"file"!=i[s].type&&n.append(i[s].name,i[s].value);if(l.find("input:file:enabled").each(function(){var t=e(this).attr("name"),i=this.files;if(t)for(var s=0;s<i.length;s++)n.append(t,i[s])}),t.extraData)for(var a in t.extraData)n.append(a,t.extraData[a]);t.data=null;var r=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:"POST"});r.data=null;var o=r.beforeSend;r.beforeSend=function(e,i){i.data=n,e.upload&&(e.upload.onprogress=function(e){i.progress(e.position,e.total)}),o&&o.call(i,e,t)},e.ajax(r)}function s(i){function s(e){var t=e.contentWindow?e.contentWindow.document:e.contentDocument?e.contentDocument:e.document;return t}function r(){function t(){try{var e=s(g).readyState;n("state = "+e),"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(i){n("Server abort: ",i," (",i.name,")"),o(j),b&&clearTimeout(b),b=void 0}}var i=l.attr("target"),r=l.attr("action");x.setAttribute("target",p),a||x.setAttribute("method","POST"),r!=d.url&&x.setAttribute("action",d.url),d.skipEncodingOverride||a&&!/post/i.test(a)||l.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),d.timeout&&(b=setTimeout(function(){y=!0,o(k)},d.timeout));var h=[];try{if(d.extraData)for(var c in d.extraData)h.push(e('<input type="hidden" name="'+c+'">').attr("value",d.extraData[c]).appendTo(x)[0]);d.iframeTarget||(f.appendTo("body"),g.attachEvent?g.attachEvent("onload",o):g.addEventListener("load",o,!1)),setTimeout(t,15),x.submit()}finally{x.setAttribute("action",r),i?x.setAttribute("target",i):l.removeAttr("target"),e(h).remove()}}function o(t){if(!m.aborted&&!I){try{D=s(g)}catch(i){n("cannot access response document: ",i),t=j}if(t===k&&m)return void m.abort("timeout");if(t==j&&m)return void m.abort("server abort");if(D&&D.location.href!=d.iframeSrc||y){g.detachEvent?g.detachEvent("onload",o):g.removeEventListener("load",o,!1);var a,r="success";try{if(y)throw"timeout";var l="xml"==d.dataType||D.XMLDocument||e.isXMLDoc(D);if(n("isXml="+l),!l&&window.opera&&(null==D.body||""==D.body.innerHTML)&&--A)return n("requeing onLoad callback, DOM not available"),void setTimeout(o,250);var h=D.body?D.body:D.documentElement;m.responseText=h?h.innerHTML:null,m.responseXML=D.XMLDocument?D.XMLDocument:D,l&&(d.dataType="xml"),m.getResponseHeader=function(e){var t={"content-type":d.dataType};return t[e]},h&&(m.status=Number(h.getAttribute("status"))||m.status,m.statusText=h.getAttribute("statusText")||m.statusText);var c=(d.dataType||"").toLowerCase(),p=/(json|script|text)/.test(c);if(p||d.textarea){var v=D.getElementsByTagName("textarea")[0];if(v)m.responseText=v.value,m.status=Number(v.getAttribute("status"))||m.status,m.statusText=v.getAttribute("statusText")||m.statusText;else if(p){var _=D.getElementsByTagName("pre")[0],x=D.getElementsByTagName("body")[0];_?m.responseText=_.textContent?_.textContent:_.innerText:x&&(m.responseText=x.textContent?x.textContent:x.innerText)}}else"xml"!=c||m.responseXML||null==m.responseText||(m.responseXML=E(m.responseText));try{S=M(m,c,d)}catch(t){r="parsererror",m.error=a=t||r}}catch(t){n("error caught: ",t),r="error",m.error=a=t||r}m.aborted&&(n("upload aborted"),r=null),m.status&&(r=m.status>=200&&m.status<300||304===m.status?"success":"error"),"success"===r?(d.success&&d.success.call(d.context,S,"success",m),u&&e.event.trigger("ajaxSuccess",[m,d])):r&&(void 0==a&&(a=m.statusText),d.error&&d.error.call(d.context,m,r,a),u&&e.event.trigger("ajaxError",[m,d,a])),u&&e.event.trigger("ajaxComplete",[m,d]),u&&!--e.active&&e.event.trigger("ajaxStop"),d.complete&&d.complete.call(d.context,m,r),I=!0,d.timeout&&clearTimeout(b),setTimeout(function(){d.iframeTarget||f.remove(),m.responseXML=null},100)}}}var h,c,d,u,p,f,g,m,v,_,y,b,x=l[0],w=!!e.fn.prop;if(i)if(w)for(c=0;c<i.length;c++)h=e(x[i[c].name]),h.prop("disabled",!1);else for(c=0;c<i.length;c++)h=e(x[i[c].name]),h.removeAttr("disabled");if(e(":input[name=submit],:input[id=submit]",x).length)return void alert('Error: Form elements must not have name or id of "submit".');if(d=e.extend(!0,{},e.ajaxSettings,t),d.context=d.context||d,p="jqFormIO"+(new Date).getTime(),d.iframeTarget?(f=e(d.iframeTarget),_=f.attr("name"),null==_?f.attr("name",p):p=_):(f=e('<iframe name="'+p+'" src="'+d.iframeSrc+'" />'),f.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=f[0],m={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var i="timeout"===t?"timeout":"aborted";n("aborting upload... "+i),this.aborted=1,f.attr("src",d.iframeSrc),m.error=i,d.error&&d.error.call(d.context,m,i,t),u&&e.event.trigger("ajaxError",[m,d,i]),d.complete&&d.complete.call(d.context,m,i)}},u=d.global,u&&!e.active++&&e.event.trigger("ajaxStart"),u&&e.event.trigger("ajaxSend",[m,d]),d.beforeSend&&d.beforeSend.call(d.context,m,d)===!1)return void(d.global&&e.active--);if(!m.aborted){v=x.clk,v&&(_=v.name,_&&!v.disabled&&(d.extraData=d.extraData||{},d.extraData[_]=v.value,"image"==v.type&&(d.extraData[_+".x"]=x.clk_x,d.extraData[_+".y"]=x.clk_y)));var k=1,j=2,C=e("meta[name=csrf-token]").attr("content"),T=e("meta[name=csrf-param]").attr("content");T&&C&&(d.extraData=d.extraData||{},d.extraData[T]=C),d.forceSync?r():setTimeout(r,10);var S,D,I,A=50,E=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},N=e.parseJSON||function(e){return window.eval("("+e+")")},M=function(t,i,n){var s=t.getResponseHeader("content-type")||"",a="xml"===i||!i&&s.indexOf("xml")>=0,r=a?t.responseXML:t.responseText;return a&&"parsererror"===r.documentElement.nodeName&&e.error&&e.error("parsererror"),n&&n.dataFilter&&(r=n.dataFilter(r,i)),"string"==typeof r&&("json"===i||!i&&s.indexOf("json")>=0?r=N(r):("script"===i||!i&&s.indexOf("javascript")>=0)&&e.globalEval(r)),r}}}if(!this.length)return n("ajaxSubmit: skipping submit process - no element selected"),this;var a,r,o,l=this;"function"==typeof t&&(t={success:t}),a=this.attr("method"),r=this.attr("action"),o="string"==typeof r?e.trim(r):"",o=o||window.location.href||"",o&&(o=(o.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:o,success:e.ajaxSettings.success,type:a||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var h={};if(this.trigger("form-pre-serialize",[this,t,h]),h.veto)return n("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return n("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var c=t.traditional;void 0===c&&(c=e.ajaxSettings.traditional);var d,u=this.formToArray(t.semantic);if(t.data&&(t.extraData=t.data,d=e.param(t.data,c)),t.beforeSubmit&&t.beforeSubmit(u,this,t)===!1)return n("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[u,this,t,h]),h.veto)return n("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var p=e.param(u,c);d&&(p=p?p+"&"+d:d),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+p,t.data=null):t.data=p;var f=[];if(t.resetForm&&f.push(function(){l.resetForm()}),t.clearForm&&f.push(function(){l.clearForm(t.includeHidden)}),!t.dataType&&t.target){var g=t.success||function(){};f.push(function(i){var n=t.replaceTarget?"replaceWith":"html";e(t.target)[n](i).each(g,arguments)})}else t.success&&f.push(t.success);t.success=function(e,i,n){for(var s=t.context||t,a=0,r=f.length;r>a;a++)f[a].apply(s,[e,i,n||l,l])};var m=e("input:file:enabled[value]",this),v=m.length>0,_="multipart/form-data",y=l.attr("enctype")==_||l.attr("encoding")==_,b=!!(v&&m.get(0).files&&window.FormData);n("fileAPI :"+b);var x=(v||y)&&!b;return t.iframe!==!1&&(t.iframe||x)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){s(u)}):s(u):(v||y)&&b?(t.progress=t.progress||e.noop,i(u)):e.ajax(t),this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(s){if(s=s||{},s.delegation=s.delegation&&e.isFunction(e.fn.on),!s.delegation&&0===this.length){var a={s:this.selector,c:this.context};return!e.isReady&&a.s?(n("DOM not ready, queuing ajaxForm"),e(function(){e(a.s,a.c).ajaxForm(s)}),this):(n("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return s.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,i).on("submit.form-plugin",this.selector,s,t).on("click.form-plugin",this.selector,s,i),this):this.ajaxFormUnbind().bind("submit.form-plugin",s,t).bind("click.form-plugin",s,i)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t){var i=[];if(0===this.length)return i;var n=this[0],s=t?n.getElementsByTagName("*"):n.elements;if(!s)return i;var a,r,o,l,h,c,d;for(a=0,c=s.length;c>a;a++)if(h=s[a],o=h.name)if(t&&n.clk&&"image"==h.type)h.disabled||n.clk!=h||(i.push({name:o,value:e(h).val(),type:h.type}),i.push({name:o+".x",value:n.clk_x},{name:o+".y",value:n.clk_y}));else if(l=e.fieldValue(h,!0),l&&l.constructor==Array)for(r=0,d=l.length;d>r;r++)i.push({name:o,value:l[r]});else null!==l&&"undefined"!=typeof l&&i.push({name:o,value:l,type:h.type});if(!t&&n.clk){var u=e(n.clk),p=u[0];o=p.name,o&&!p.disabled&&"image"==p.type&&(i.push({name:o,value:u.val()}),i.push({name:o+".x",value:n.clk_x},{name:o+".y",value:n.clk_y}))}return i},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var i=[];return this.each(function(){var n=this.name;if(n){var s=e.fieldValue(this,t);if(s&&s.constructor==Array)for(var a=0,r=s.length;r>a;a++)i.push({name:n,value:s[a]});else null!==s&&"undefined"!=typeof s&&i.push({name:this.name,value:s})}}),e.param(i)},e.fn.fieldValue=function(t){for(var i=[],n=0,s=this.length;s>n;n++){var a=this[n],r=e.fieldValue(a,t);null===r||"undefined"==typeof r||r.constructor==Array&&!r.length||(r.constructor==Array?e.merge(i,r):i.push(r))}return i},e.fieldValue=function(t,i){var n=t.name,s=t.type,a=t.tagName.toLowerCase();if(void 0===i&&(i=!0),i&&(!n||t.disabled||"reset"==s||"button"==s||("checkbox"==s||"radio"==s)&&!t.checked||("submit"==s||"image"==s)&&t.form&&t.form.clk!=t||"select"==a&&-1==t.selectedIndex))return null;if("select"==a){var r=t.selectedIndex;if(0>r)return null;for(var o=[],l=t.options,h="select-one"==s,c=h?r+1:l.length,d=h?r:0;c>d;d++){var u=l[d];if(u.selected){var p=u.value;if(p||(p=u.attributes&&u.attributes.value&&!u.attributes.value.specified?u.text:u.value),h)return p;o.push(p)}}return o}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(e){var t=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var i=this.type,n=this.tagName.toLowerCase();t.test(i)||"textarea"==n||e&&/hidden/.test(i)?this.value="":"checkbox"==i||"radio"==i?this.checked=!1:"select"==n&&(this.selectedIndex=-1)})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var n=e(this).parent("select");t&&n[0]&&"select-one"==n[0].type&&n.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}(jQuery)},{}],22:[function(e,t,i){!function(e){var t=function(e){return e.replace(/%2C/g,",").replace(/\&amp;/g,"&").replace(/^\s+|\s+$/g,"")};e.extend({_ondemand_loaded_list:null,isItemLoaded:function(i){var n,s=this;return null===this._ondemand_loaded_list&&(this._ondemand_loaded_list={},e("script").each(function(){n=e(this).attr("src"),n&&(s._ondemand_loaded_list[n]=1)}),e('link[rel="stylesheet"]').each(function(){n=e(this).attr("href"),n&&(s._ondemand_loaded_list[n]=1)})),void 0!==this._ondemand_loaded_list[t(i)]},requireCss:function(t,i){if(i||(i="all"),!e.isItemLoaded(t)){if(document.createStyleSheet){var n=document.createStyleSheet(t);n.media=i}else{var s=document.createElement("link");e(s).attr({href:t,type:"text/css",media:i,rel:"stylesheet"}).appendTo(e("head").get(0))}this._ondemand_loaded_list[t]=1}},processOnDemandHeaders:function(i,n,s){var a=this,r=new e.Deferred;if(s.getResponseHeader&&s.getResponseHeader("X-Include-CSS"))for(var o=s.getResponseHeader("X-Include-CSS").split(","),l=0;l<o.length;l++)o[l].match(/^(.*):##:(.*)$/)?e.requireCss(t(RegExp.$1),RegExp.$2):e.requireCss(t(o[l]));var h=[];if(s.getResponseHeader&&s.getResponseHeader("X-Include-JS"))for(var c=s.getResponseHeader("X-Include-JS").split(","),l=0;l<c.length;l++){var d=t(c[l]);e.isItemLoaded(d)||h.push(d)}var u=function(){if(h.length){var t=h.shift();e.ajax({dataType:"script",url:t,success:function(){a._ondemand_loaded_list[t]=1,u()},cache:!1,async:!1})}else r.resolve(i,n,s)};return h.length?u():r.resolve(i,n,s),r.promise()}}),e.ajaxSetup({beforeSend:function(t,i){if("script"!=i.dataType){var n=new e.Deferred;t.success(function(t,s,a){e.processOnDemandHeaders(t,s,a).done(function(){n.resolveWith(i.context||this,[t,s,a])})}),t.success=function(e){n.done(e)}}}})}(jQuery)},{}],23:[function(e,t,i){!new function(e){var t=e.separator||"&",i=e.spaces===!1?!1:!0,n=(e.suffix===!1?"":"[]",e.prefix===!1?!1:!0),s=n?e.hash===!0?"#":"?":"",a=e.numbers===!1?!1:!0;jQuery.query=new function(){var e=function(e,t){return void 0!=e&&null!==e&&(t?e.constructor==t:!0)},n=function(e){for(var t,i=/\[([^[]*)\]/g,n=/^([^[]+)(\[.*\])?$/.exec(e),s=n[1],a=[];t=i.exec(n[2]);)a.push(t[1]);return[s,a]},r=function(t,i,n){var s=i.shift();if("object"!=typeof t&&(t=null),""===s)if(t||(t=[]),e(t,Array))t.push(0==i.length?n:r(null,i.slice(0),n));else if(e(t,Object)){for(var a=0;null!=t[a++];);t[--a]=0==i.length?n:r(t[a],i.slice(0),n)}else t=[],t.push(0==i.length?n:r(null,i.slice(0),n));else if(s&&s.match(/^\s*[0-9]+\s*$/)){var o=parseInt(s,10);t||(t=[]),t[o]=0==i.length?n:r(t[o],i.slice(0),n)}else{if(!s)return n;var o=s.replace(/^\s*|\s*$/g,"");if(t||(t={}),e(t,Array)){for(var l={},a=0;a<t.length;++a)l[a]=t[a];t=l}t[o]=0==i.length?n:r(t[o],i.slice(0),n)}return t},o=function(e){var t=this;return t.keys={},e.queryObject?jQuery.each(e.get(),function(e,i){t.SET(e,i)}):jQuery.each(arguments,function(){var e=""+this;e=e.replace(/^[?#]/,""),e=e.replace(/[;&]$/,""),i&&(e=e.replace(/[+]/g," ")),jQuery.each(e.split(/[&;]/),function(){var e=decodeURIComponent(this.split("=")[0]||""),i=decodeURIComponent(this.split("=")[1]||"");e&&(a&&(/^[+-]?[0-9]+\.[0-9]*$/.test(i)?i=parseFloat(i):/^[+-]?[0-9]+$/.test(i)&&(i=parseInt(i,10))),i=i||0===i?i:!0,i!==!1&&i!==!0&&"number"!=typeof i&&(i=i),t.SET(e,i))})}),t};return o.prototype={queryObject:!0,has:function(t,i){var n=this.get(t);return e(n,i)},GET:function(t){if(!e(t))return this.keys;for(var i=n(t),s=i[0],a=i[1],r=this.keys[s];null!=r&&0!=a.length;)r=r[a.shift()];return"number"==typeof r?r:r||""},get:function(t){var i=this.GET(t);return e(i,Object)?jQuery.extend(!0,{},i):e(i,Array)?i.slice(0):i},SET:function(t,i){var s=e(i)?i:null,a=n(t),o=a[0],l=a[1],h=this.keys[o];return this.keys[o]=r(h,l.slice(0),s),this},set:function(e,t){return this.copy().SET(e,t)},REMOVE:function(e){return this.SET(e,null).COMPACT()},remove:function(e){return this.copy().REMOVE(e)},EMPTY:function(){var e=this;return jQuery.each(e.keys,function(t,i){delete e.keys[t]}),e},load:function(e){var t=e.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1"),i=e.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new o(e.length==i.length?"":i,e.length==t.length?"":t)},empty:function(){return this.copy().EMPTY()},copy:function(){return new o(this)},COMPACT:function(){function t(i){function n(t,i,n){e(t,Array)?t.push(n):t[i]=n}var s="object"==typeof i?e(i,Array)?[]:{}:i;return"object"==typeof i&&jQuery.each(i,function(i,a){return e(a)?void n(s,i,t(a)):!0}),s}return this.keys=t(this.keys),this},compact:function(){return this.copy().COMPACT()},toString:function(){var n=[],a=[],r=function(e){return e+="",i&&(e=e.replace(/ /g,"+")),encodeURIComponent(e)},o=function(t,i,n){if(e(n)&&n!==!1){var s=[r(i)];n!==!0&&(s.push("="),s.push(r(n))),t.push(s.join(""))}},l=function(e,t){var i=function(e){return t&&""!=t?[t,"[",e,"]"].join(""):[e].join("")};jQuery.each(e,function(e,t){"object"==typeof t?l(t,i(e)):o(a,i(e),t)})};return l(this.keys),a.length>0&&n.push(s),n.push(a.join(t)),n.join("")}},new o(location.search,location.hash)}}(jQuery.query||{})},{}],24:[function(require,module,exports){!function(e,t){function i(t,i){var s,a,r,o=t.nodeName.toLowerCase();return"area"===o?(s=t.parentNode,a=s.name,t.href&&a&&"map"===s.nodeName.toLowerCase()?(r=e("img[usemap=#"+a+"]")[0],!!r&&n(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var s=0,a=/^ui-id-\d+$/;e.ui=e.ui||{},e.ui.version||(e.extend(e.ui,{version:"1.9.2",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:e.fn.focus,focus:function(t,i){return"number"==typeof t?this.each(function(){var n=this;setTimeout(function(){e(n).focus(),i&&i.call(n)},t)}):this._focus.apply(this,arguments)},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 n,s,a=e(this[0]);a.length&&a[0]!==document;){if(n=a.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(a.css("zIndex"),10),!isNaN(s)&&0!==s))return s;a=a.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){a.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,n){return!!e.data(t,n[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(t,!s)}}),e(function(){var t=document.body,i=t.appendChild(i=document.createElement("div"));i.offsetHeight,e.extend(i.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=100===i.offsetHeight,e.support.selectstart="onselectstart"in i,t.removeChild(i).style.display="none"}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===n?["Left","Right"]:["Top","Bottom"],r=n.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?o["inner"+n].call(this):this.each(function(){e(this).css(r,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?o["outer"+n].call(this,t):this.each(function(){e(this).css(r,s(this,t,!0,i)+"px")})}}),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)),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=6===parseFloat(t[1],10)}(),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,n){var s,a=e.ui[t].prototype;for(s in n)a.plugins[s]=a.plugins[s]||[],a.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;n<s.length;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},contains:e.contains,hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)},isOverAxis:function(e,t,i){return e>t&&t+i>e},isOver:function(t,i,n,s,a,r){
return e.ui.isOverAxis(t,n,a)&&e.ui.isOverAxis(i,s,r)}}))}(jQuery),function(e,t){var i=0,n=Array.prototype.slice,s=e.cleanData;e.cleanData=function(t){for(var i,n=0;null!=(i=t[n]);n++)try{e(i).triggerHandler("remove")}catch(a){}s(t)},e.widget=function(t,i,n){var s,a,r,o,l=t.split(".")[0];t=t.split(".")[1],s=l+"-"+t,n||(n=i,i=e.Widget),e.expr[":"][s.toLowerCase()]=function(t){return!!e.data(t,s)},e[l]=e[l]||{},a=e[l][t],r=e[l][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new r(e,t)},e.extend(r,a,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),o=new i,o.options=e.widget.extend({},o.options),e.each(n,function(t,s){e.isFunction(s)&&(n[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}())}),r.prototype=e.widget.extend(o,{widgetEventPrefix:a?o.widgetEventPrefix:t},n,{constructor:r,namespace:l,widgetName:t,widgetBaseClass:s,widgetFullName:s}),a?(e.each(a._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,r,i._proto)}),delete a._childConstructors):i._childConstructors.push(r),e.widget.bridge(t,r)},e.widget.extend=function(i){for(var s,a,r=n.call(arguments,1),o=0,l=r.length;l>o;o++)for(s in r[o])a=r[o][s],r[o].hasOwnProperty(s)&&a!==t&&(e.isPlainObject(a)?i[s]=e.isPlainObject(i[s])?e.widget.extend({},i[s],a):e.widget.extend({},a):i[s]=a);return i},e.widget.bridge=function(i,s){var a=s.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,l=n.call(arguments,1),h=this;return r=!o&&l.length?e.widget.extend.apply(null,[r].concat(l)):r,o?this.each(function(){var n,s=e.data(this,a);return s?e.isFunction(s[r])&&"_"!==r.charAt(0)?(n=s[r].apply(s,l),n!==s&&n!==t?(h=n&&n.jquery?h.pushStack(n.get()):n,!1):void 0):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 s(r,this))}),h}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),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(),n!==this&&(e.data(n,this.widgetName,this),e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),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,n){var s,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},s=i.split("."),i=s.shift(),s.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;r<s.length-1;r++)a[s[r]]=a[s[r]]||{},a=a[s[r]];if(i=s.pop(),n===t)return a[i]===t?null:a[i];a[i]=n}else{if(n===t)return this.options[i]===t?null:this.options[i];o[i]=n}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(t,i,n){var s,a=this;"boolean"!=typeof t&&(n=i,i=t,t=!1),n?(i=s=e(i),this.bindings=this.bindings.add(i)):(n=i,i=this.element,s=this.widget()),e.each(n,function(n,r){function o(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):void 0}"string"!=typeof r&&(o.guid=r.guid=r.guid||o.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),h=l[1]+a.eventNamespace,c=l[2];c?s.delegate(c,h,o):i.bind(h,o)})},_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?n[e]:e).apply(n,arguments)}var n=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,n){var s,a,r=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(s in a)s in i||(i[s]=a[s]);return this.element.trigger(i,n),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,s,a){"string"==typeof s&&(s={effect:s});var r,o=s?s===!0||"number"==typeof s?i:s.effect||i:t;s=s||{},"number"==typeof s&&(s={duration:s}),r=!e.isEmptyObject(s),s.complete=a,s.delay&&n.delay(s.delay),r&&e.effects&&(e.effects.effect[o]||e.uiBackCompat!==!1&&e.effects[o])?n[t](s):o!==t&&n[o]?n[o](s.duration,s.easing,a):n.queue(function(i){e(this)[t](),a&&a.call(n[0]),i()})}}),e.uiBackCompat!==!1&&(e.Widget.prototype._getCreateOptions=function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})}(jQuery),function(e,t){var i=!1;e(document).mouseup(function(e){i=!1}),e.widget("ui.mouse",{version:"1.9.2",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):void 0}),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(t){if(!i){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var n=this,s=1===t.which,a="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!a&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),i=!0,!0)):!0}},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||t.button?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):this._mouseUp(t)},_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(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})}(jQuery),function(e,t){function i(e,t,i){return[parseInt(e[0],10)*(u.test(e[0])?t/100:1),parseInt(e[1],10)*(u.test(e[1])?i/100:1)]}function n(t,i){return parseInt(e.css(t,i),10)||0}e.ui=e.ui||{};var s,a=Math.max,r=Math.abs,o=Math.round,l=/left|center|right/,h=/top|center|bottom/,c=/[\+\-]\d+%?/,d=/^\w+/,u=/%$/,p=e.fn.position;e.position={scrollbarWidth:function(){if(s!==t)return s;var i,n,a=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),r=a.children()[0];return e("body").append(a),i=r.offsetWidth,a.css("overflow","scroll"),n=r.offsetWidth,i===n&&(n=a[0].clientWidth),a.remove(),s=i-n},getScrollInfo:function(t){var i=t.isWindow?"":t.element.css("overflow-x"),n=t.isWindow?"":t.element.css("overflow-y"),s="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===n||"auto"===n&&t.height<t.element[0].scrollHeight;return{width:s?e.position.scrollbarWidth():0,height:a?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),n=e.isWindow(i[0]);return{element:i,isWindow:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return p.apply(this,arguments);t=e.extend({},t);var s,u,f,g,m,v=e(t.of),_=e.position.getWithinInfo(t.within),y=e.position.getScrollInfo(_),b=v[0],x=(t.collision||"flip").split(" "),w={};return 9===b.nodeType?(u=v.width(),f=v.height(),g={top:0,left:0}):e.isWindow(b)?(u=v.width(),f=v.height(),g={top:v.scrollTop(),left:v.scrollLeft()}):b.preventDefault?(t.at="left top",u=f=0,g={top:b.pageY,left:b.pageX}):(u=v.outerWidth(),f=v.outerHeight(),g=v.offset()),m=e.extend({},g),e.each(["my","at"],function(){var e,i,n=(t[this]||"").split(" ");1===n.length&&(n=l.test(n[0])?n.concat(["center"]):h.test(n[0])?["center"].concat(n):["center","center"]),n[0]=l.test(n[0])?n[0]:"center",n[1]=h.test(n[1])?n[1]:"center",e=c.exec(n[0]),i=c.exec(n[1]),w[this]=[e?e[0]:0,i?i[0]:0],t[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===t.at[0]?m.left+=u:"center"===t.at[0]&&(m.left+=u/2),"bottom"===t.at[1]?m.top+=f:"center"===t.at[1]&&(m.top+=f/2),s=i(w.at,u,f),m.left+=s[0],m.top+=s[1],this.each(function(){var l,h,c=e(this),d=c.outerWidth(),p=c.outerHeight(),b=n(this,"marginLeft"),k=n(this,"marginTop"),j=d+b+n(this,"marginRight")+y.width,C=p+k+n(this,"marginBottom")+y.height,T=e.extend({},m),S=i(w.my,c.outerWidth(),c.outerHeight());"right"===t.my[0]?T.left-=d:"center"===t.my[0]&&(T.left-=d/2),"bottom"===t.my[1]?T.top-=p:"center"===t.my[1]&&(T.top-=p/2),T.left+=S[0],T.top+=S[1],e.support.offsetFractions||(T.left=o(T.left),T.top=o(T.top)),l={marginLeft:b,marginTop:k},e.each(["left","top"],function(i,n){e.ui.position[x[i]]&&e.ui.position[x[i]][n](T,{targetWidth:u,targetHeight:f,elemWidth:d,elemHeight:p,collisionPosition:l,collisionWidth:j,collisionHeight:C,offset:[s[0]+S[0],s[1]+S[1]],my:t.my,at:t.at,within:_,elem:c})}),e.fn.bgiframe&&c.bgiframe(),t.using&&(h=function(e){var i=g.left-T.left,n=i+u-d,s=g.top-T.top,o=s+f-p,l={target:{element:v,left:g.left,top:g.top,width:u,height:f},element:{element:c,left:T.left,top:T.top,width:d,height:p},horizontal:0>n?"left":i>0?"right":"center",vertical:0>o?"top":s>0?"bottom":"middle"};d>u&&r(i+n)<u&&(l.horizontal="center"),p>f&&r(s+o)<f&&(l.vertical="middle"),a(r(i),r(n))>a(r(s),r(o))?l.important="horizontal":l.important="vertical",t.using.call(this,e,l)}),c.offset(e.extend(T,{using:h}))})},e.ui.position={fit:{left:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollLeft:n.offset.left,r=n.width,o=e.left-t.collisionPosition.marginLeft,l=s-o,h=o+t.collisionWidth-r-s;t.collisionWidth>r?l>0&&0>=h?(i=e.left+l+t.collisionWidth-r-s,e.left+=l-i):h>0&&0>=l?e.left=s:l>h?e.left=s+r-t.collisionWidth:e.left=s:l>0?e.left+=l:h>0?e.left-=h:e.left=a(e.left-o,e.left)},top:function(e,t){var i,n=t.within,s=n.isWindow?n.scrollTop:n.offset.top,r=t.within.height,o=e.top-t.collisionPosition.marginTop,l=s-o,h=o+t.collisionHeight-r-s;t.collisionHeight>r?l>0&&0>=h?(i=e.top+l+t.collisionHeight-r-s,e.top+=l-i):h>0&&0>=l?e.top=s:l>h?e.top=s+r-t.collisionHeight:e.top=s:l>0?e.top+=l:h>0?e.top-=h:e.top=a(e.top-o,e.top)}},flip:{left:function(e,t){var i,n,s=t.within,a=s.offset.left+s.scrollLeft,o=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,h=e.left-t.collisionPosition.marginLeft,c=h-l,d=h+t.collisionWidth-o-l,u="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>c?(i=e.left+u+p+f+t.collisionWidth-o-a,(0>i||i<r(c))&&(e.left+=u+p+f)):d>0&&(n=e.left-t.collisionPosition.marginLeft+u+p+f-l,(n>0||r(n)<d)&&(e.left+=u+p+f))},top:function(e,t){var i,n,s=t.within,a=s.offset.top+s.scrollTop,o=s.height,l=s.isWindow?s.scrollTop:s.offset.top,h=e.top-t.collisionPosition.marginTop,c=h-l,d=h+t.collisionHeight-o-l,u="top"===t.my[1],p=u?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,g=-2*t.offset[1];0>c?(n=e.top+p+f+g+t.collisionHeight-o-a,e.top+p+f+g>c&&(0>n||n<r(c))&&(e.top+=p+f+g)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+g-l,e.top+p+f+g>d&&(i>0||r(i)<d)&&(e.top+=p+f+g))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,n,s,a,r=document.getElementsByTagName("body")[0],o=document.createElement("div");t=document.createElement(r?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in n)t.style[a]=n[a];t.appendChild(o),i=r||document.documentElement,i.insertBefore(t,i.firstChild),o.style.cssText="position: absolute; left: 10.7432222px;",s=e(o).offset().left,e.support.offsetFractions=s>10&&11>s,t.innerHTML="",i.removeChild(t)}(),e.uiBackCompat!==!1&&!function(e){var i=e.fn.position;e.fn.position=function(n){if(!n||!n.offset)return i.call(this,n);var s=n.offset.split(" "),a=n.at.split(" ");return 1===s.length&&(s[1]=s[0]),/^\d/.test(s[0])&&(s[0]="+"+s[0]),/^\d/.test(s[1])&&(s[1]="+"+s[1]),1===a.length&&(/left|center|right/.test(a[0])?a[1]="center":(a[1]=a[0],a[0]="center")),i.call(this,e.extend(n,{at:a[0]+s[0]+" "+a[1]+s[1],offset:t}))}}(jQuery)}(jQuery),function(e,t){var i=0,n={},s={};n.height=n.paddingTop=n.paddingBottom=n.borderTopWidth=n.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.9.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.accordionId="ui-accordion-"+(this.element.attr("id")||++i),n=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset"),this.headers=this.element.find(n.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this._hoverable(this.headers),this._focusable(this.headers),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide(),n.collapsible||n.active!==!1&&null!=n.active||(n.active=0),n.active<0&&(n.active+=this.headers.length),this.active=this._findActive(n.active).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top"),this.active.next().addClass("ui-accordion-content-active").show(),this._createIcons(),this.refresh(),this.element.attr("role","tablist"),this.headers.attr("role","tab").each(function(i){var n=e(this),s=n.attr("id"),a=n.next(),r=a.attr("id");s||(s=t+"-header-"+i,n.attr("id",s)),r||(r=t+"-panel-"+i,a.attr("id",r)),n.attr("aria-controls",r),a.attr("aria-labelledby",s)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._on(this.headers,{keydown:"_keydown"}),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._setupEvents(n.event)},_getCreateEventData:function(){return{header:this.active,content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?void this._activate(t):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),void("disabled"===e&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)))},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,n=this.headers.length,s=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(s+1)%n];break;case i.LEFT:case i.UP:a=this.headers[(s-1+n)%n];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[n-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t,i,n=this.options.heightStyle,s=this.element.parent();"fill"===n?(e.support.minHeight||(i=s.css("overflow"),s.css("overflow","hidden")),t=s.height(),this.element.siblings(":visible").each(function(){var i=e(this),n=i.css("position");"absolute"!==n&&"fixed"!==n&&(t-=i.outerHeight(!0))}),i&&s.css("overflow",i),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===n&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={};t&&(e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._on(this.headers,i))},_eventHandler:function(t){var i=this.options,n=this.active,s=e(t.currentTarget),a=s[0]===n[0],r=a&&i.collapsible,o=r?e():s.next(),l=n.next(),h={oldHeader:n,oldPanel:l,newHeader:r?e():s,newPanel:o};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,h)===!1||(i.active=r?!1:this.headers.index(s),this.active=a?e():s,this._toggle(h),n.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(s.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),s.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,n=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=n,this.options.animate?this._animate(i,n,t):(n.hide(),i.show(),this._toggleComplete(t)),n.attr({"aria-expanded":"false","aria-hidden":"true"}),n.prev().attr("aria-selected","false"),i.length&&n.length?n.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,i){var a,r,o,l=this,h=0,c=e.length&&(!t.length||e.index()<t.index()),d=this.options.animate||{},u=c&&d.down||d,p=function(){l._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(r=u),r=r||u.easing||d.easing,o=o||u.duration||d.duration,t.length?e.length?(a=e.show().outerHeight(),t.animate(n,{duration:o,easing:r,step:function(e,t){t.now=Math.round(e)}}),void e.hide().animate(s,{duration:o,easing:r,complete:p,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?h+=i.now:"content"!==l.options.heightStyle&&(i.now=Math.round(a-t.outerHeight()-h),h=0)}})):t.animate(n,o,r,p):e.animate(s,o,r,p)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.uiBackCompat!==!1&&(!function(e,t){e.extend(t.options,{navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}});var i=t._create;t._create=function(){if(this.options.navigation){var t=this,n=this.element.find(this.options.header),s=n.next(),a=n.add(s).find("a").filter(this.options.navigationFilter)[0];a&&n.add(s).each(function(i){return e.contains(this,a)?(t.options.active=Math.floor(i/2),!1):void 0})}i.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{heightStyle:null,autoHeight:!0,clearStyle:!1,fillSpace:!1});var i=t._create,n=t._setOption;e.extend(t,{_create:function(){this.options.heightStyle=this.options.heightStyle||this._mergeHeightStyle(),i.call(this)},_setOption:function(e){("autoHeight"===e||"clearStyle"===e||"fillSpace"===e)&&(this.options.heightStyle=this._mergeHeightStyle()),n.apply(this,arguments)},_mergeHeightStyle:function(){var e=this.options;return e.fillSpace?"fill":e.clearStyle?"content":e.autoHeight?"auto":void 0}})}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options.icons,{activeHeader:null,headerSelected:"ui-icon-triangle-1-s"});var i=t._createIcons;t._createIcons=function(){this.options.icons&&(this.options.icons.activeHeader=this.options.icons.activeHeader||this.options.icons.headerSelected),i.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){t.activate=t._activate;var i=t._findActive;t._findActive=function(e){return-1===e&&(e=!1),e&&"number"!=typeof e&&(e=this.headers.index(this.headers.filter(e)),-1===e&&(e=!1)),i.call(this,e)}}(jQuery,jQuery.ui.accordion.prototype),jQuery.ui.accordion.prototype.resize=jQuery.ui.accordion.prototype.refresh,function(e,t){e.extend(t.options,{change:null,changestart:null});var i=t._trigger;t._trigger=function(e,t,n){var s=i.apply(this,arguments);return s?("beforeActivate"===e?s=i.call(this,"changestart",t,{oldHeader:n.oldHeader,oldContent:n.oldPanel,newHeader:n.newHeader,newContent:n.newPanel}):"activate"===e&&(s=i.call(this,"change",t,{oldHeader:n.oldHeader,oldContent:n.oldPanel,newHeader:n.newHeader,newContent:n.newPanel})),s):!1}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{animate:null,animated:"slide"});var i=t._create;t._create=function(){var e=this.options;null===e.animate&&(e.animated?"slide"===e.animated?e.animate=300:"bounceslide"===e.animated?e.animate={duration:200,down:{easing:"easeOutBounce",duration:1e3}}:e.animate=e.animated:e.animate=!1),i.call(this)}}(jQuery,jQuery.ui.accordion.prototype))}(jQuery),function(e,t){var i=0;e.widget("ui.autocomplete",{version:"1.9.2",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,i,n;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is("input,textarea")?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(s){if(this.element.prop("readOnly"))return t=!0,n=!0,void(i=!0);t=!1,n=!1,i=!1;var a=e.ui.keyCode;switch(s.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",s);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",s);break;case a.UP:t=!0,this._keyEvent("previous",s);break;case a.DOWN:t=!0,this._keyEvent("next",s);break;case a.ENTER:case a.NUMPAD_ENTER:this.menu.active&&(t=!0,s.preventDefault(),this.menu.select(s));break;case a.TAB:this.menu.active&&this.menu.select(s);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(s),s.preventDefault());break;default:i=!0,this._searchTimeout(s)}},keypress:function(n){if(t)return t=!1,void n.preventDefault();if(!i){var s=e.ui.keyCode;switch(n.keyCode){case s.PAGE_UP:this._move("previousPage",n);break;case s.PAGE_DOWN:this._move("nextPage",n);break;case s.UP:this._keyEvent("previous",n);break;case s.DOWN:this._keyEvent("next",n)}}},input:function(e){return n?(n=!1,void e.preventDefault()):void this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(e),void this._change(e))}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete").appendTo(this.document.find(this.options.appendTo||"body")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data("menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(n){n.target===t.element[0]||n.target===i||e.contains(i,n.target)||t.close()})})},menufocus:function(t,i){if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});var n=i.item.data("ui-autocomplete-item")||i.item.data("item.autocomplete");!1!==this._trigger("focus",t,{item:n})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value):this.liveRegion.text(n.value)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item")||t.item.data("item.autocomplete"),n=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this.document.find(t||"body")[0]),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is("textarea")?!0:this.element.is("input")?!1:this.element.prop("isContentEditable")},_initSource:function(){var t,i,n=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,n){n(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,s){n.xhr&&n.xhr.abort(),n.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){s(e)},error:function(){s([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,t=++i;return function(n){t===i&&e.__response(n),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var i=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(i,t),this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next();
},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var n=this;e.each(i,function(e,i){n._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").append(e("<a>").text(i.label)).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this._value(this.term),void this.menu.blur()):void this.menu[e](t):void this.search(null,t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var n=new RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return n.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.text(t))}})}(jQuery),function(e,t){var i,n,s,a,r="ui-button ui-widget ui-state-default ui-corner-all",o="ui-state-hover ui-state-active ",l="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",h=function(){var t=e(this).find(":ui-button");setTimeout(function(){t.button("refresh")},1)},c=function(t){var i=t.name,n=t.form,s=e([]);return i&&(s=n?e(n).find("[name='"+i+"']"):e("[name='"+i+"']",t.ownerDocument).filter(function(){return!this.form})),s};e.widget("ui.button",{version:"1.9.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,h),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,o=this.options,l="checkbox"===this.type||"radio"===this.type,d=l?"":"ui-state-active",u="ui-state-focus";null===o.label&&(o.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(r).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){o.disabled||this===i&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){o.disabled||e(this).removeClass(d)}).bind("click"+this.eventNamespace,function(e){o.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){t.buttonElement.addClass(u)}).bind("blur"+this.eventNamespace,function(){t.buttonElement.removeClass(u)}),l&&(this.element.bind("change"+this.eventNamespace,function(){a||t.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){o.disabled||(a=!1,n=e.pageX,s=e.pageY)}).bind("mouseup"+this.eventNamespace,function(e){o.disabled||(n!==e.pageX||s!==e.pageY)&&(a=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return o.disabled||a?!1:(e(this).toggleClass("ui-state-active"),void t.buttonElement.attr("aria-pressed",t.element[0].checked))}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(o.disabled||a)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var i=t.element[0];c(i).not(i).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return o.disabled?!1:(e(this).addClass("ui-state-active"),i=this,void t.document.one("mouseup",function(){i=null}))}).bind("mouseup"+this.eventNamespace,function(){return o.disabled?!1:void e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){return o.disabled?!1:void((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"))}).bind("keyup"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",o.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.element.is("[type=checkbox]")?this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(r+" "+o+" "+l).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?void(t?this.element.prop("disabled",!0):this.element.prop("disabled",!1)):void this._resetButton()},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?c(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return void(this.options.label&&this.element.val(this.options.label));var t=this.buttonElement.removeClass(l),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),n=this.options.icons,s=n.primary&&n.secondary,a=[];n.primary||n.secondary?(this.options.text&&a.push("ui-button-text-icon"+(s?"s":n.primary?"-primary":"-secondary")),n.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+n.primary+"'></span>"),n.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+n.secondary+"'></span>"),this.options.text||(a.push(s?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.9.2",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})}(jQuery),function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){$(this).removeClass("ui-state-hover"),-1!=this.className.indexOf("ui-datepicker-prev")&&$(this).removeClass("ui-datepicker-prev-hover"),-1!=this.className.indexOf("ui-datepicker-next")&&$(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",function(){$.datepicker._isDisabledDatepicker(instActive.inline?e.parent()[0]:instActive.input[0])||($(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),$(this).addClass("ui-state-hover"),-1!=this.className.indexOf("ui-datepicker-prev")&&$(this).addClass("ui-datepicker-prev-hover"),-1!=this.className.indexOf("ui-datepicker-next")&&$(this).addClass("ui-datepicker-next-hover"))})}function extendRemove(e,t){$.extend(e,t);for(var i in t)(null==t[i]||t[i]==undefined)&&(e[i]=t[i]);return e}$.extend($.ui,{datepicker:{version:"1.9.2"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline="div"==nodeName||"span"==nodeName;target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),"input"==nodeName?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(e,t){var i=e[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:i,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(e,t){var i=$(e);t.append=$([]),t.trigger=$([]),i.hasClass(this.markerClassName)||(this._attachments(i,t),i.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,i,n){t.settings[i]=n}).bind("getData.datepicker",function(e,i){return this._get(t,i)}),this._autoSize(t),$.data(e,PROP_NAME,t),t.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,t){var i=this._get(t,"appendText"),n=this._get(t,"isRTL");t.append&&t.append.remove(),i&&(t.append=$('<span class="'+this._appendClass+'">'+i+"</span>"),e[n?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove();var s=this._get(t,"showOn");if(("focus"==s||"both"==s)&&e.focus(this._showDatepicker),"button"==s||"both"==s){var a=this._get(t,"buttonText"),r=this._get(t,"buttonImage");t.trigger=$(this._get(t,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:r,alt:a,title:a}):$('<button type="button"></button>').addClass(this._triggerClass).html(""==r?a:$("<img/>").attr({src:r,alt:a,title:a}))),e[n?"before":"after"](t.trigger),t.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==e[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=e[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(e[0])):$.datepicker._showDatepicker(e[0]),!1})}},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t=new Date(2009,11,20),i=this._get(e,"dateFormat");if(i.match(/[DM]/)){var n=function(e){for(var t=0,i=0,n=0;n<e.length;n++)e[n].length>t&&(t=e[n].length,i=n);return i};t.setMonth(n(this._get(e,i.match(/MM/)?"monthNames":"monthNamesShort"))),t.setDate(n(this._get(e,i.match(/DD/)?"dayNames":"dayNamesShort"))+20-t.getDay())}e.input.attr("size",this._formatDate(e,t).length)}},_inlineDatepicker:function(e,t){var i=$(e);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(t.dpDiv).bind("setData.datepicker",function(e,i,n){t.settings[i]=n}).bind("getData.datepicker",function(e,i){return this._get(t,i)}),$.data(e,PROP_NAME,t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block"))},_dialogDatepicker:function(e,t,i,n,s){var a=this._dialogInst;if(!a){this.uuid+=1;var r="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+r+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),a=this._dialogInst=this._newInst(this._dialogInput,!1),a.settings={},$.data(this._dialogInput[0],PROP_NAME,a)}if(extendRemove(a.settings,n||{}),t=t&&t.constructor==Date?this._formatDate(a,t):t,this._dialogInput.val(t),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,!this._pos){var o=document.documentElement.clientWidth,l=document.documentElement.clientHeight,h=document.documentElement.scrollLeft||document.body.scrollLeft,c=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[o/2-100+h,l/2-150+c]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,a),this},_destroyDatepicker:function(e){var t=$(e),i=$.data(e,PROP_NAME);if(t.hasClass(this.markerClassName)){var n=e.nodeName.toLowerCase();$.removeData(e,PROP_NAME),"input"==n?(i.append.remove(),i.trigger.remove(),t.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"==n||"span"==n)&&t.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(e){var t=$(e),i=$.data(e,PROP_NAME);if(t.hasClass(this.markerClassName)){var n=e.nodeName.toLowerCase();if("input"==n)e.disabled=!1,i.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if("div"==n||"span"==n){var s=t.children("."+this._inlineClass);s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t})}},_disableDatepicker:function(e){var t=$(e),i=$.data(e,PROP_NAME);if(t.hasClass(this.markerClassName)){var n=e.nodeName.toLowerCase();if("input"==n)e.disabled=!0,i.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if("div"==n||"span"==n){var s=t.children("."+this._inlineClass);s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t}),this._disabledInputs[this._disabledInputs.length]=e}},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]==e)return!0;return!1},_getInst:function(e){try{return $.data(e,PROP_NAME)}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,t,i){var n=this._getInst(e);if(2==arguments.length&&"string"==typeof t)return"defaults"==t?$.extend({},$.datepicker._defaults):n?"all"==t?$.extend({},n.settings):this._get(n,t):null;var s=t||{};if("string"==typeof t&&(s={},s[t]=i),n){this._curInst==n&&this._hideDatepicker();var a=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(n,"min"),o=this._getMinMaxDate(n,"max");extendRemove(n.settings,s),null!==r&&s.dateFormat!==undefined&&s.minDate===undefined&&(n.settings.minDate=this._formatDate(n,r)),null!==o&&s.dateFormat!==undefined&&s.maxDate===undefined&&(n.settings.maxDate=this._formatDate(n,o)),this._attachments($(e),n),this._autoSize(n),this._setDate(n,a),this._updateAlternate(n),this._updateDatepicker(n)}},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(e){var t=$.datepicker._getInst(e.target),i=!0,n=t.dpDiv.is(".ui-datepicker-rtl");if(t._keyEvent=!0,$.datepicker._datepickerShowing)switch(e.keyCode){case 9:$.datepicker._hideDatepicker(),i=!1;break;case 13:var s=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",t.dpDiv);s[0]&&$.datepicker._selectDay(e.target,t.selectedMonth,t.selectedYear,s[0]);var a=$.datepicker._get(t,"onSelect");if(a){var r=$.datepicker._formatDate(t);a.apply(t.input?t.input[0]:null,[r,t])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&$.datepicker._clearDate(e.target),i=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&$.datepicker._gotoToday(e.target),i=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,n?1:-1,"D"),i=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,-7,"D"),i=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,n?-1:1,"D"),i=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,7,"D"),i=e.ctrlKey||e.metaKey;break;default:i=!1}else 36==e.keyCode&&e.ctrlKey?$.datepicker._showDatepicker(this):i=!1;i&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var t=$.datepicker._getInst(e.target);if($.datepicker._get(t,"constrainInput")){var i=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),n=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||e.metaKey||" ">n||!i||i.indexOf(n)>-1}},_doKeyUp:function(e){var t=$.datepicker._getInst(e.target);if(t.input.val()!=t.lastVal)try{var i=$.datepicker.parseDate($.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,$.datepicker._getFormatConfig(t));i&&($.datepicker._setDateFromField(t),$.datepicker._updateAlternate(t),$.datepicker._updateDatepicker(t))}catch(n){$.datepicker.log(n)}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!=e.nodeName.toLowerCase()&&(e=$("input",e.parentNode)[0]),!$.datepicker._isDisabledDatepicker(e)&&$.datepicker._lastInput!=e){var t=$.datepicker._getInst(e);$.datepicker._curInst&&$.datepicker._curInst!=t&&($.datepicker._curInst.dpDiv.stop(!0,!0),t&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var i=$.datepicker._get(t,"beforeShow"),n=i?i.apply(e,[e,t]):{};if(n!==!1){extendRemove(t.settings,n),t.lastVal=null,$.datepicker._lastInput=e,$.datepicker._setDateFromField(t),$.datepicker._inDialog&&(e.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(e),$.datepicker._pos[1]+=e.offsetHeight);var s=!1;$(e).parents().each(function(){return s|="fixed"==$(this).css("position"),!s});var a={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};if($.datepicker._pos=null,t.dpDiv.empty(),t.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(t),a=$.datepicker._checkOffset(t,a,s),t.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":s?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),!t.inline){var r=$.datepicker._get(t,"showAnim"),o=$.datepicker._get(t,"duration"),l=function(){var e=t.dpDiv.find("iframe.ui-datepicker-cover");if(e.length){var i=$.datepicker._getBorders(t.dpDiv);e.css({left:-i[0],top:-i[1],width:t.dpDiv.outerWidth(),height:t.dpDiv.outerHeight()})}};t.dpDiv.zIndex($(e).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&($.effects.effect[r]||$.effects[r])?t.dpDiv.show(r,$.datepicker._get(t,"showOptions"),o,l):t.dpDiv[r||"show"](r?o:null,l),r&&o||l(),t.input.is(":visible")&&!t.input.is(":disabled")&&t.input.focus(),$.datepicker._curInst=t}}}},_updateDatepicker:function(e){this.maxRows=4;var t=$.datepicker._getBorders(e.dpDiv);instActive=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i=e.dpDiv.find("iframe.ui-datepicker-cover");i.length&&i.css({left:-t[0],top:-t[1],width:e.dpDiv.outerWidth(),height:e.dpDiv.outerHeight()}),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var n=this._getNumberOfMonths(e),s=n[1],a=17;if(e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&e.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",a*s+"em"),e.dpDiv[(1!=n[0]||1!=n[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e==$.datepicker._curInst&&$.datepicker._datepickerShowing&&e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&e.input[0]!=document.activeElement&&e.input.focus(),e.yearshtml){var r=e.yearshtml;setTimeout(function(){r===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),r=e.yearshtml=null},0)}},_getBorders:function(e){var t=function(e){return{thin:1,medium:2,thick:3}[e]||e};return[parseFloat(t(e.css("border-left-width"))),parseFloat(t(e.css("border-top-width")))]},_checkOffset:function(e,t,i){var n=e.dpDiv.outerWidth(),s=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,o=document.documentElement.clientWidth+(i?0:$(document).scrollLeft()),l=document.documentElement.clientHeight+(i?0:$(document).scrollTop());return t.left-=this._get(e,"isRTL")?n-a:0,t.left-=i&&t.left==e.input.offset().left?$(document).scrollLeft():0,t.top-=i&&t.top==e.input.offset().top+r?$(document).scrollTop():0,t.left-=Math.min(t.left,t.left+n>o&&o>n?Math.abs(t.left+n-o):0),t.top-=Math.min(t.top,t.top+s>l&&l>s?Math.abs(s+r):0),t},_findPos:function(e){for(var t=this._getInst(e),i=this._get(t,"isRTL");e&&("hidden"==e.type||1!=e.nodeType||$.expr.filters.hidden(e));)e=e[i?"previousSibling":"nextSibling"];var n=$(e).offset();return[n.left,n.top]},_hideDatepicker:function(e){var t=this._curInst;if(t&&(!e||t==$.data(e,PROP_NAME))&&this._datepickerShowing){var i=this._get(t,"showAnim"),n=this._get(t,"duration"),s=function(){$.datepicker._tidyDialog(t)};$.effects&&($.effects.effect[i]||$.effects[i])?t.dpDiv.hide(i,$.datepicker._get(t,"showOptions"),n,s):t.dpDiv["slideDown"==i?"slideUp":"fadeIn"==i?"fadeOut":"hide"](i?n:null,s),i||s(),this._datepickerShowing=!1;var a=this._get(t,"onClose");a&&a.apply(t.input?t.input[0]:null,[t.input?t.input.val():"",t]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if($.datepicker._curInst){var t=$(e.target),i=$.datepicker._getInst(t[0]);(t[0].id!=$.datepicker._mainDivId&&0==t.parents("#"+$.datepicker._mainDivId).length&&!t.hasClass($.datepicker.markerClassName)&&!t.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||t.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=i)&&$.datepicker._hideDatepicker()}},_adjustDate:function(e,t,i){var n=$(e),s=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(s,t+("M"==i?this._get(s,"showCurrentAtPos"):0),i),this._updateDatepicker(s))},_gotoToday:function(e){var t=$(e),i=this._getInst(t[0]);if(this._get(i,"gotoCurrent")&&i.currentDay)i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear;else{var n=new Date;i.selectedDay=n.getDate(),i.drawMonth=i.selectedMonth=n.getMonth(),i.drawYear=i.selectedYear=n.getFullYear()}this._notifyChange(i),this._adjustDate(t)},_selectMonthYear:function(e,t,i){var n=$(e),s=this._getInst(n[0]);s["selected"+("M"==i?"Month":"Year")]=s["draw"+("M"==i?"Month":"Year")]=parseInt(t.options[t.selectedIndex].value,10),this._notifyChange(s),this._adjustDate(n)},_selectDay:function(e,t,i,n){var s=$(e);if(!$(n).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(s[0])){var a=this._getInst(s[0]);a.selectedDay=a.currentDay=$("a",n).html(),a.selectedMonth=a.currentMonth=t,a.selectedYear=a.currentYear=i,this._selectDate(e,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear))}},_clearDate:function(e){var t=$(e);this._getInst(t[0]);this._selectDate(t,"")},_selectDate:function(e,t){var i=$(e),n=this._getInst(i[0]);t=null!=t?t:this._formatDate(n),n.input&&n.input.val(t),this._updateAlternate(n);var s=this._get(n,"onSelect");s?s.apply(n.input?n.input[0]:null,[t,n]):n.input&&n.input.trigger("change"),n.inline?this._updateDatepicker(n):(this._hideDatepicker(),this._lastInput=n.input[0],"object"!=typeof n.input[0]&&n.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var t=this._get(e,"altField");if(t){var i=this._get(e,"altFormat")||this._get(e,"dateFormat"),n=this._getDate(e),s=this.formatDate(i,n,this._getFormatConfig(e));$(t).each(function(){$(this).val(s)})}},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var i=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((i-t)/864e5)/7)+1},parseDate:function(e,t,i){if(null==e||null==t)throw"Invalid arguments";if(t="object"==typeof t?t.toString():t+"",""==t)return null;var n=(i?i.shortYearCutoff:null)||this._defaults.shortYearCutoff;n="string"!=typeof n?n:(new Date).getFullYear()%100+parseInt(n,10);for(var s=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,l=-1,h=-1,c=-1,d=-1,u=!1,p=function(t){var i=_+1<e.length&&e.charAt(_+1)==t;return i&&_++,i},f=function(e){var i=p(e),n="@"==e?14:"!"==e?20:"y"==e&&i?4:"o"==e?3:2,s=new RegExp("^\\d{1,"+n+"}"),a=t.substring(v).match(s);if(!a)throw"Missing number at position "+v;return v+=a[0].length,parseInt(a[0],10)},g=function(e,i,n){var s=$.map(p(e)?n:i,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)}),a=-1;if($.each(s,function(e,i){var n=i[1];return t.substr(v,n.length).toLowerCase()==n.toLowerCase()?(a=i[0],v+=n.length,!1):void 0}),-1!=a)return a+1;throw"Unknown name at position "+v},m=function(){if(t.charAt(v)!=e.charAt(_))throw"Unexpected literal at position "+v;v++},v=0,_=0;_<e.length;_++)if(u)"'"!=e.charAt(_)||p("'")?m():u=!1;else switch(e.charAt(_)){case"d":c=f("d");break;case"D":g("D",s,a);break;case"o":d=f("o");break;case"m":h=f("m");break;case"M":h=g("M",r,o);break;case"y":l=f("y");break;case"@":var y=new Date(f("@"));l=y.getFullYear(),h=y.getMonth()+1,c=y.getDate();break;case"!":var y=new Date((f("!")-this._ticksTo1970)/1e4);l=y.getFullYear(),h=y.getMonth()+1,c=y.getDate();break;case"'":p("'")?m():u=!0;break;default:m()}if(v<t.length){var b=t.substr(v);if(!/^\s+/.test(b))throw"Extra/unparsed characters found in date: "+b}if(-1==l?l=(new Date).getFullYear():100>l&&(l+=(new Date).getFullYear()-(new Date).getFullYear()%100+(n>=l?0:-100)),d>-1)for(h=1,c=d;;){var x=this._getDaysInMonth(l,h-1);if(x>=c)break;h++,c-=x}var y=this._daylightSavingAdjust(new Date(l,h-1,c));if(y.getFullYear()!=l||y.getMonth()+1!=h||y.getDate()!=c)throw"Invalid date";return y},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";var n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,s=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,o=function(t){var i=u+1<e.length&&e.charAt(u+1)==t;return i&&u++,i},l=function(e,t,i){var n=""+t;if(o(e))for(;n.length<i;)n="0"+n;return n},h=function(e,t,i,n){return o(e)?n[t]:i[t]},c="",d=!1;if(t)for(var u=0;u<e.length;u++)if(d)"'"!=e.charAt(u)||o("'")?c+=e.charAt(u):d=!1;else switch(e.charAt(u)){
case"d":c+=l("d",t.getDate(),2);break;case"D":c+=h("D",t.getDay(),n,s);break;case"o":c+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":c+=l("m",t.getMonth()+1,2);break;case"M":c+=h("M",t.getMonth(),a,r);break;case"y":c+=o("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":c+=t.getTime();break;case"!":c+=1e4*t.getTime()+this._ticksTo1970;break;case"'":o("'")?c+="'":d=!0;break;default:c+=e.charAt(u)}return c},_possibleChars:function(e){for(var t="",i=!1,n=function(t){var i=s+1<e.length&&e.charAt(s+1)==t;return i&&s++,i},s=0;s<e.length;s++)if(i)"'"!=e.charAt(s)||n("'")?t+=e.charAt(s):i=!1;else switch(e.charAt(s)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":n("'")?t+="'":i=!0;break;default:t+=e.charAt(s)}return t},_get:function(e,t){return e.settings[t]!==undefined?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!=e.lastVal){var i,n,s=this._get(e,"dateFormat"),a=e.lastVal=e.input?e.input.val():null;i=n=this._getDefaultDate(e);var r=this._getFormatConfig(e);try{i=this.parseDate(s,a,r)||n}catch(o){this.log(o),a=t?"":a}e.selectedDay=i.getDate(),e.drawMonth=e.selectedMonth=i.getMonth(),e.drawYear=e.selectedYear=i.getFullYear(),e.currentDay=a?i.getDate():0,e.currentMonth=a?i.getMonth():0,e.currentYear=a?i.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(e,t,i){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},s=function(t){try{return $.datepicker.parseDate($.datepicker._get(e,"dateFormat"),t,$.datepicker._getFormatConfig(e))}catch(i){}for(var n=(t.toLowerCase().match(/^c/)?$.datepicker._getDate(e):null)||new Date,s=n.getFullYear(),a=n.getMonth(),r=n.getDate(),o=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=o.exec(t);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,$.datepicker._getDaysInMonth(s,a));break;case"y":case"Y":s+=parseInt(l[1],10),r=Math.min(r,$.datepicker._getDaysInMonth(s,a))}l=o.exec(t)}return new Date(s,a,r)},a=null==t||""===t?i:"string"==typeof t?s(t):"number"==typeof t?isNaN(t)?i:n(t):new Date(t.getTime());return a=a&&"Invalid Date"==a.toString()?i:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var n=!t,s=e.selectedMonth,a=e.selectedYear,r=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=r.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=r.getMonth(),e.drawYear=e.selectedYear=e.currentYear=r.getFullYear(),s==e.selectedMonth&&a==e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(n?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""==e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(e){var t=this._get(e,"stepMonths"),i="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(i,-t,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(i,+t,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(i)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(i,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t=new Date;t=this._daylightSavingAdjust(new Date(t.getFullYear(),t.getMonth(),t.getDate()));var i=this._get(e,"isRTL"),n=this._get(e,"showButtonPanel"),s=this._get(e,"hideIfNoPrevNext"),a=this._get(e,"navigationAsDateFormat"),r=this._getNumberOfMonths(e),o=this._get(e,"showCurrentAtPos"),l=this._get(e,"stepMonths"),h=1!=r[0]||1!=r[1],c=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),d=this._getMinMaxDate(e,"min"),u=this._getMinMaxDate(e,"max"),p=e.drawMonth-o,f=e.drawYear;if(0>p&&(p+=12,f--),u){var g=this._daylightSavingAdjust(new Date(u.getFullYear(),u.getMonth()-r[0]*r[1]+1,u.getDate()));for(g=d&&d>g?d:g;this._daylightSavingAdjust(new Date(f,p,1))>g;)p--,0>p&&(p=11,f--)}e.drawMonth=p,e.drawYear=f;var m=this._get(e,"prevText");m=a?this.formatDate(m,this._daylightSavingAdjust(new Date(f,p-l,1)),this._getFormatConfig(e)):m;var v=this._canAdjustMonth(e,-1,f,p)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(i?"e":"w")+'">'+m+"</span></a>":s?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(i?"e":"w")+'">'+m+"</span></a>",_=this._get(e,"nextText");_=a?this.formatDate(_,this._daylightSavingAdjust(new Date(f,p+l,1)),this._getFormatConfig(e)):_;var y=this._canAdjustMonth(e,1,f,p)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+_+'"><span class="ui-icon ui-icon-circle-triangle-'+(i?"w":"e")+'">'+_+"</span></a>":s?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+_+'"><span class="ui-icon ui-icon-circle-triangle-'+(i?"w":"e")+'">'+_+"</span></a>",b=this._get(e,"currentText"),x=this._get(e,"gotoCurrent")&&e.currentDay?c:t;b=a?this.formatDate(b,x,this._getFormatConfig(e)):b;var w=e.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(e,"closeText")+"</button>",k=n?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(i?w:"")+(this._isInRange(e,x)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+b+"</button>":"")+(i?"":w)+"</div>":"",j=parseInt(this._get(e,"firstDay"),10);j=isNaN(j)?0:j;for(var C=this._get(e,"showWeek"),T=this._get(e,"dayNames"),S=(this._get(e,"dayNamesShort"),this._get(e,"dayNamesMin")),D=this._get(e,"monthNames"),I=this._get(e,"monthNamesShort"),A=this._get(e,"beforeShowDay"),E=this._get(e,"showOtherMonths"),N=this._get(e,"selectOtherMonths"),M=(this._get(e,"calculateWeek")||this.iso8601Week,this._getDefaultDate(e)),P="",H=0;H<r[0];H++){var F="";this.maxRows=4;for(var L=0;L<r[1];L++){var O=this._daylightSavingAdjust(new Date(f,p,e.selectedDay)),z=" ui-corner-all",R="";if(h){if(R+='<div class="ui-datepicker-group',r[1]>1)switch(L){case 0:R+=" ui-datepicker-group-first",z=" ui-corner-"+(i?"right":"left");break;case r[1]-1:R+=" ui-datepicker-group-last",z=" ui-corner-"+(i?"left":"right");break;default:R+=" ui-datepicker-group-middle",z=""}R+='">'}R+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+z+'">'+(/all|left/.test(z)&&0==H?i?y:v:"")+(/all|right/.test(z)&&0==H?i?v:y:"")+this._generateMonthYearHeader(e,p,f,d,u,H>0||L>0,D,I)+'</div><table class="ui-datepicker-calendar"><thead><tr>';for(var W=C?'<th class="ui-datepicker-week-col">'+this._get(e,"weekHeader")+"</th>":"",q=0;7>q;q++){var B=(q+j)%7;W+="<th"+((q+j+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+T[B]+'">'+S[B]+"</span></th>"}R+=W+"</tr></thead><tbody>";var U=this._getDaysInMonth(f,p);f==e.selectedYear&&p==e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,U));var Q=(this._getFirstDayOfMonth(f,p)-j+7)%7,V=Math.ceil((Q+U)/7),Y=h&&this.maxRows>V?this.maxRows:V;this.maxRows=Y;for(var X=this._daylightSavingAdjust(new Date(f,p,1-Q)),K=0;Y>K;K++){R+="<tr>";for(var G=C?'<td class="ui-datepicker-week-col">'+this._get(e,"calculateWeek")(X)+"</td>":"",q=0;7>q;q++){var J=A?A.apply(e.input?e.input[0]:null,[X]):[!0,""],Z=X.getMonth()!=p,ee=Z&&!N||!J[0]||d&&d>X||u&&X>u;G+='<td class="'+((q+j+6)%7>=5?" ui-datepicker-week-end":"")+(Z?" ui-datepicker-other-month":"")+(X.getTime()==O.getTime()&&p==e.selectedMonth&&e._keyEvent||M.getTime()==X.getTime()&&M.getTime()==O.getTime()?" "+this._dayOverClass:"")+(ee?" "+this._unselectableClass+" ui-state-disabled":"")+(Z&&!E?"":" "+J[1]+(X.getTime()==c.getTime()?" "+this._currentClass:"")+(X.getTime()==t.getTime()?" ui-datepicker-today":""))+'"'+(Z&&!E||!J[2]?"":' title="'+J[2]+'"')+(ee?"":' data-handler="selectDay" data-event="click" data-month="'+X.getMonth()+'" data-year="'+X.getFullYear()+'"')+">"+(Z&&!E?"&#xa0;":ee?'<span class="ui-state-default">'+X.getDate()+"</span>":'<a class="ui-state-default'+(X.getTime()==t.getTime()?" ui-state-highlight":"")+(X.getTime()==c.getTime()?" ui-state-active":"")+(Z?" ui-priority-secondary":"")+'" href="#">'+X.getDate()+"</a>")+"</td>",X.setDate(X.getDate()+1),X=this._daylightSavingAdjust(X)}R+=G+"</tr>"}p++,p>11&&(p=0,f++),R+="</tbody></table>"+(h?"</div>"+(r[0]>0&&L==r[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),F+=R}P+=F}return P+=k+($.ui.ie6&&!e.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),e._keyEvent=!1,P},_generateMonthYearHeader:function(e,t,i,n,s,a,r,o){var l=this._get(e,"changeMonth"),h=this._get(e,"changeYear"),c=this._get(e,"showMonthAfterYear"),d='<div class="ui-datepicker-title">',u="";if(a||!l)u+='<span class="ui-datepicker-month">'+r[t]+"</span>";else{var p=n&&n.getFullYear()==i,f=s&&s.getFullYear()==i;u+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var g=0;12>g;g++)(!p||g>=n.getMonth())&&(!f||g<=s.getMonth())&&(u+='<option value="'+g+'"'+(g==t?' selected="selected"':"")+">"+o[g]+"</option>");u+="</select>"}if(c||(d+=u+(!a&&l&&h?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!h)d+='<span class="ui-datepicker-year">'+i+"</span>";else{var m=this._get(e,"yearRange").split(":"),v=(new Date).getFullYear(),_=function(e){var t=e.match(/c[+-].*/)?i+parseInt(e.substring(1),10):e.match(/[+-].*/)?v+parseInt(e,10):parseInt(e,10);return isNaN(t)?v:t},y=_(m[0]),b=Math.max(y,_(m[1]||""));for(y=n?Math.max(y,n.getFullYear()):y,b=s?Math.min(b,s.getFullYear()):b,e.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';b>=y;y++)e.yearshtml+='<option value="'+y+'"'+(y==i?' selected="selected"':"")+">"+y+"</option>";e.yearshtml+="</select>",d+=e.yearshtml,e.yearshtml=null}return d+=this._get(e,"yearSuffix"),c&&(d+=(!a&&l&&h?"":"&#xa0;")+u),d+="</div>"},_adjustInstDate:function(e,t,i){var n=e.drawYear+("Y"==i?t:0),s=e.drawMonth+("M"==i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(n,s))+("D"==i?t:0),r=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(n,s,a)));e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),("M"==i||"Y"==i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max"),s=i&&i>t?i:t;return s=n&&s>n?n:s},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,n){var s=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,n+(0>t?t:s[0]*s[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i=this._getMinMaxDate(e,"min"),n=this._getMinMaxDate(e,"max");return(!i||t.getTime()>=i.getTime())&&(!n||t.getTime()<=n.getTime())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,n){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(n,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),$.fn.datepicker=function(e){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find(document.body).append($.datepicker.dpDiv),$.datepicker.initialized=!0);var t=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!=e&&"getDate"!=e&&"widget"!=e?"option"==e&&2==arguments.length&&"string"==typeof arguments[1]?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t)):this.each(function(){"string"==typeof e?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this].concat(t)):$.datepicker._attachDatepicker(this,e)}):$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.9.2",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(e,t){var i="ui-dialog ui-widget ui-widget-content ui-corner-all ",n={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},s={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.9.2",options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),"string"!=typeof this.originalTitle&&(this.originalTitle=""),this.oldPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.options.title=this.options.title||this.originalTitle;var t,n,s,a,r,o=this,l=this.options,h=l.title||"&#160;";t=(this.uiDialog=e("<div>")).addClass(i+l.dialogClass).css({display:"none",outline:0,zIndex:l.zIndex}).attr("tabIndex",-1).keydown(function(t){l.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE&&(o.close(t),t.preventDefault())}).mousedown(function(e){o.moveToTop(!1,e)}).appendTo("body"),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(t),n=(this.uiDialogTitlebar=e("<div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").bind("mousedown",function(){t.focus()}).prependTo(t),s=e("<a href='#'></a>").addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").click(function(e){e.preventDefault(),o.close(e)}).appendTo(n),(this.uiDialogTitlebarCloseText=e("<span>")).addClass("ui-icon ui-icon-closethick").text(l.closeText).appendTo(s),a=e("<span>").uniqueId().addClass("ui-dialog-title").html(h).prependTo(n),r=(this.uiDialogButtonPane=e("<div>")).addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),(this.uiButtonSet=e("<div>")).addClass("ui-dialog-buttonset").appendTo(r),t.attr({role:"dialog","aria-labelledby":a.attr("id")}),n.find("*").add(n).disableSelection(),this._hoverable(s),this._focusable(s),l.draggable&&e.fn.draggable&&this._makeDraggable(),l.resizable&&e.fn.resizable&&this._makeResizable(),this._createButtons(l.buttons),this._isOpen=!1,e.fn.bgiframe&&t.bgiframe(),this._on(t,{keydown:function(i){if(l.modal&&i.keyCode===e.ui.keyCode.TAB){var n=e(":tabbable",t),s=n.filter(":first"),a=n.filter(":last");return i.target!==a[0]||i.shiftKey?i.target===s[0]&&i.shiftKey?(a.focus(1),!1):void 0:(s.focus(1),!1)}}})},_init:function(){this.options.autoOpen&&this.open()},_destroy:function(){var e,t=this.oldPosition;this.overlay&&this.overlay.destroy(),this.uiDialog.hide(),this.element.removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},close:function(t){var i,n,s=this;if(this._isOpen&&!1!==this._trigger("beforeClose",t))return this._isOpen=!1,this.overlay&&this.overlay.destroy(),this.options.hide?this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)}):(this.uiDialog.hide(),this._trigger("close",t)),e.ui.dialog.overlay.resize(),this.options.modal&&(i=0,e(".ui-dialog").each(function(){this!==s.uiDialog[0]&&(n=e(this).css("z-index"),isNaN(n)||(i=Math.max(i,n)))}),e.ui.dialog.maxZ=i),this},isOpen:function(){return this._isOpen},moveToTop:function(t,i){var n,s=this.options;return s.modal&&!t||!s.stack&&!s.modal?this._trigger("focus",i):(s.zIndex>e.ui.dialog.maxZ&&(e.ui.dialog.maxZ=s.zIndex),this.overlay&&(e.ui.dialog.maxZ+=1,e.ui.dialog.overlay.maxZ=e.ui.dialog.maxZ,this.overlay.$el.css("z-index",e.ui.dialog.overlay.maxZ)),n={scrollTop:this.element.scrollTop(),scrollLeft:this.element.scrollLeft()},e.ui.dialog.maxZ+=1,this.uiDialog.css("z-index",e.ui.dialog.maxZ),this.element.attr(n),this._trigger("focus",i),this)},open:function(){if(!this._isOpen){var t,i=this.options,n=this.uiDialog;return this._size(),this._position(i.position),n.show(i.show),this.overlay=i.modal?new e.ui.dialog.overlay(this):null,this.moveToTop(!0),t=this.element.find(":tabbable"),t.length||(t=this.uiDialogButtonPane.find(":tabbable"),t.length||(t=n)),t.eq(0).focus(),this._isOpen=!0,this._trigger("open"),this}},_createButtons:function(t){var i=this,n=!1;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),"object"==typeof t&&null!==t&&e.each(t,function(){return!(n=!0)}),n?(e.each(t,function(t,n){var s,a;n=e.isFunction(n)?{click:n,text:t}:n,n=e.extend({type:"button"},n),a=n.click,n.click=function(){a.apply(i.element[0],arguments)},s=e("<button></button>",n).appendTo(i.uiButtonSet),e.fn.button&&s.button()}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)):this.uiDialog.removeClass("ui-dialog-buttons")},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,s){e(this).addClass("ui-dialog-dragging"),i._trigger("dragStart",n,t(s))},drag:function(e,n){i._trigger("drag",e,t(n))},stop:function(s,a){n.position=[a.position.left-i.document.scrollLeft(),a.position.top-i.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),i._trigger("dragStop",s,t(a)),e.ui.dialog.overlay.resize()}})},_makeResizable:function(i){function n(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}i=i===t?this.options.resizable:i;var s=this,a=this.options,r=this.uiDialog.css("position"),o="string"==typeof i?i:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:a.maxWidth,maxHeight:a.maxHeight,minWidth:a.minWidth,minHeight:this._minHeight(),handles:o,start:function(t,i){e(this).addClass("ui-dialog-resizing"),s._trigger("resizeStart",t,n(i))},resize:function(e,t){s._trigger("resize",e,n(t))},stop:function(t,i){e(this).removeClass("ui-dialog-resizing"),a.height=e(this).height(),a.width=e(this).width(),s._trigger("resizeStop",t,n(i)),e.ui.dialog.overlay.resize()}}).css("position",r).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(t){var i,n=[],s=[0,0];t?(("string"==typeof t||"object"==typeof t&&"0"in t)&&(n=t.split?t.split(" "):[t[0],t[1]],1===n.length&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(s[e]=n[e],n[e]=t)}),t={my:n[0]+(s[0]<0?s[0]:"+"+s[0])+" "+n[1]+(s[1]<0?s[1]:"+"+s[1]),at:n.join(" ")}),t=e.extend({},e.ui.dialog.prototype.options.position,t)):t=e.ui.dialog.prototype.options.position,i=this.uiDialog.is(":visible"),i||this.uiDialog.show(),this.uiDialog.position(t),i||this.uiDialog.hide()},_setOptions:function(t){var i=this,a={},r=!1;e.each(t,function(e,t){i._setOption(e,t),e in n&&(r=!0),e in s&&(a[e]=t)}),r&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(t,n){var s,a,r=this.uiDialog;switch(t){case"buttons":this._createButtons(n);break;case"closeText":this.uiDialogTitlebarCloseText.text(""+n);break;case"dialogClass":r.removeClass(this.options.dialogClass).addClass(i+n);break;case"disabled":n?r.addClass("ui-dialog-disabled"):r.removeClass("ui-dialog-disabled");break;case"draggable":s=r.is(":data(draggable)"),s&&!n&&r.draggable("destroy"),!s&&n&&this._makeDraggable();break;case"position":this._position(n);break;case"resizable":a=r.is(":data(resizable)"),a&&!n&&r.resizable("destroy"),a&&"string"==typeof n&&r.resizable("option","handles",n),a||n===!1||this._makeResizable(n);break;case"title":e(".ui-dialog-title",this.uiDialogTitlebar).html(""+(n||"&#160;"))}this._super(t,n)},_size:function(){var t,i,n,s=this.options,a=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),i=Math.max(0,s.minHeight-t),"auto"===s.height?e.support.minHeight?this.element.css({minHeight:i,height:"auto"}):(this.uiDialog.show(),n=this.element.css("height","auto").height(),a||this.uiDialog.hide(),this.element.height(Math.max(n,i))):this.element.height(Math.max(s.height-t,0)),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),e.extend(e.ui.dialog,{uuid:0,maxZ:0,getTitleId:function(e){var t=e.attr("id");return t||(this.uuid+=1,t=this.uuid),"ui-dialog-title-"+t},overlay:function(t){this.$el=e.ui.dialog.overlay.create(t)}}),e.extend(e.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:e.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(e){return e+".dialog-overlay"}).join(" "),create:function(t){0===this.instances.length&&(setTimeout(function(){e.ui.dialog.overlay.instances.length&&e(document).bind(e.ui.dialog.overlay.events,function(t){return e(t.target).zIndex()<e.ui.dialog.overlay.maxZ?!1:void 0})},1),e(window).bind("resize.dialog-overlay",e.ui.dialog.overlay.resize));var i=this.oldInstances.pop()||e("<div>").addClass("ui-widget-overlay");return e(document).bind("keydown.dialog-overlay",function(n){var s=e.ui.dialog.overlay.instances;0!==s.length&&s[s.length-1]===i&&t.options.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===e.ui.keyCode.ESCAPE&&(t.close(n),n.preventDefault())}),i.appendTo(document.body).css({width:this.width(),height:this.height()}),e.fn.bgiframe&&i.bgiframe(),this.instances.push(i),i},destroy:function(t){var i=e.inArray(t,this.instances),n=0;-1!==i&&this.oldInstances.push(this.instances.splice(i,1)[0]),0===this.instances.length&&e([document,window]).unbind(".dialog-overlay"),t.height(0).width(0).remove(),e.each(this.instances,function(){n=Math.max(n,this.css("z-index"))}),this.maxZ=n},height:function(){var t,i;return e.ui.ie?(t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),i=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),i>t?e(window).height()+"px":t+"px"):e(document).height()+"px"},width:function(){var t,i;return e.ui.ie?(t=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),i=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),i>t?e(window).width()+"px":t+"px"):e(document).width()+"px"},resize:function(){var t=e([]);e.each(e.ui.dialog.overlay.instances,function(){t=t.add(this)}),t.css({width:0,height:0}).css({width:e.ui.dialog.overlay.width(),height:e.ui.dialog.overlay.height()})}}),e.extend(e.ui.dialog.overlay.prototype,{destroy:function(){e.ui.dialog.overlay.destroy(this.$el)}})}(jQuery),function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.9.2",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},_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).is(".ui-resizable-handle")?!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.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},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),i.containment&&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(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var n=this._uiHash();if(this._trigger("drag",t,n)===!1)return this._mouseUp({}),!1;this.position=n.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=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(i=e.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1);for(var n=this.element[0],s=!1;n&&(n=n.parentNode);)n==document&&(s=!0);if(!s&&"original"===this.options.helper)return!1;if("invalid"==this.options.revert&&!i||"valid"==this.options.revert&&i||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,i)){var a=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){a._trigger("stop",t)!==!1&&a._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!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){var i=this.options.handle&&e(this.options.handle,this.element).length?!1:!0;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(i=!0)}),i},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"==i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"==i.appendTo?this.element[0].parentNode:i.appendTo),n[0]==this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_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(){this.offsetParent=this.helper.offsetParent();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=this.options;if("parent"==t.containment&&(t.containment=this.helper[0].parentNode),("document"==t.containment||"window"==t.containment)&&(this.containment=["document"==t.containment?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"==t.containment?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"==t.containment?0:e(window).scrollLeft())+e("document"==t.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"==t.containment?0:e(window).scrollTop())+(e("document"==t.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(t.containment)||t.containment.constructor==Array)t.containment.constructor==Array&&(this.containment=t.containment);else{var i=e(t.containment),n=i[0];if(!n)return;var s=(i.offset(),
"hidden"!=e(n).css("overflow"));this.containment=[(parseInt(e(n).css("borderLeftWidth"),10)||0)+(parseInt(e(n).css("paddingLeft"),10)||0),(parseInt(e(n).css("borderTopWidth"),10)||0)+(parseInt(e(n).css("paddingTop"),10)||0),(s?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(e(n).css("borderLeftWidth"),10)||0)-(parseInt(e(n).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(e(n).css("borderTopWidth"),10)||0)-(parseInt(e(n).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i}},_convertPositionTo:function(t,i){i||(i=this.position);var n="absolute"==t?1:-1,s=(this.options,"absolute"!=this.cssPosition||this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent),a=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"==this.cssPosition?-this.scrollParent.scrollTop():a?0:s.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():a?0:s.scrollLeft())*n}},_generatePosition:function(t){var i=this.options,n="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(n[0].tagName),a=t.pageX,r=t.pageY;if(this.originalPosition){var o;if(this.containment){if(this.relative_container){var l=this.relative_container.offset();o=[this.containment[0]+l.left,this.containment[1]+l.top,this.containment[2]+l.left,this.containment[3]+l.top]}else o=this.containment;t.pageX-this.offset.click.left<o[0]&&(a=o[0]+this.offset.click.left),t.pageY-this.offset.click.top<o[1]&&(r=o[1]+this.offset.click.top),t.pageX-this.offset.click.left>o[2]&&(a=o[2]+this.offset.click.left),t.pageY-this.offset.click.top>o[3]&&(r=o[3]+this.offset.click.top)}if(i.grid){var h=i.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1]:this.originalPageY;r=o&&(h-this.offset.click.top<o[1]||h-this.offset.click.top>o[3])?h-this.offset.click.top<o[1]?h+i.grid[1]:h-i.grid[1]:h;var c=i.grid[0]?this.originalPageX+Math.round((a-this.originalPageX)/i.grid[0])*i.grid[0]:this.originalPageX;a=o&&(c-this.offset.click.left<o[0]||c-this.offset.click.left>o[2])?c-this.offset.click.left<o[0]?c+i.grid[0]:c-i.grid[0]:c}}return{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"==this.cssPosition?-this.scrollParent.scrollTop():s?0:n.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():s?0:n.scrollLeft())}},_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,n){return n=n||this._uiHash(),e.ui.plugin.call(this,t,[i,n]),"drag"==t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,n)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var n=e(this).data("draggable"),s=n.options,a=e.extend({},i,{item:n.element});n.sortables=[],e(s.connectToSortable).each(function(){var i=e.data(this,"sortable");i&&!i.options.disabled&&(n.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var n=e(this).data("draggable"),s=e.extend({},i,{item:n.element});e.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"==n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,s))})},drag:function(t,i){var n=e(this).data("draggable"),s=this;e.each(n.sortables,function(a){var r=!1,o=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(r=!0,e.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!=o&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(o.instance.element[0],this.instance.element[0])&&(r=!1),r})),r?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(s).clone().removeAttr("id").appendTo(this.instance.element).data("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=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",t),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),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(),n._trigger("fromSortable",t),n.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i){var n=e("body"),s=e(this).data("draggable").options;n.css("cursor")&&(s._cursor=n.css("cursor")),n.css("cursor",s.cursor)},stop:function(t,i){var n=e(this).data("draggable").options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var n=e(i.helper),s=e(this).data("draggable").options;n.css("opacity")&&(s._opacity=n.css("opacity")),n.css("opacity",s.opacity)},stop:function(t,i){var n=e(this).data("draggable").options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,i){var n=e(this).data("draggable");n.scrollParent[0]!=document&&"HTML"!=n.scrollParent[0].tagName&&(n.overflowOffset=n.scrollParent.offset())},drag:function(t,i){var n=e(this).data("draggable"),s=n.options,a=!1;n.scrollParent[0]!=document&&"HTML"!=n.scrollParent[0].tagName?(s.axis&&"x"==s.axis||(n.overflowOffset.top+n.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?n.scrollParent[0].scrollTop=a=n.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-n.overflowOffset.top<s.scrollSensitivity&&(n.scrollParent[0].scrollTop=a=n.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"==s.axis||(n.overflowOffset.left+n.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?n.scrollParent[0].scrollLeft=a=n.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-n.overflowOffset.left<s.scrollSensitivity&&(n.scrollParent[0].scrollLeft=a=n.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"==s.axis||(t.pageY-e(document).scrollTop()<s.scrollSensitivity?a=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(a=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"==s.axis||(t.pageX-e(document).scrollLeft()<s.scrollSensitivity?a=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(a=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(n,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i){var n=e(this).data("draggable"),s=n.options;n.snapElements=[],e(s.snap.constructor!=String?s.snap.items||":data(draggable)":s.snap).each(function(){var t=e(this),i=t.offset();this!=n.element[0]&&n.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i){for(var n=e(this).data("draggable"),s=n.options,a=s.snapTolerance,r=i.offset.left,o=r+n.helperProportions.width,l=i.offset.top,h=l+n.helperProportions.height,c=n.snapElements.length-1;c>=0;c--){var d=n.snapElements[c].left,u=d+n.snapElements[c].width,p=n.snapElements[c].top,f=p+n.snapElements[c].height;if(r>d-a&&u+a>r&&l>p-a&&f+a>l||r>d-a&&u+a>r&&h>p-a&&f+a>h||o>d-a&&u+a>o&&l>p-a&&f+a>l||o>d-a&&u+a>o&&h>p-a&&f+a>h){if("inner"!=s.snapMode){var g=Math.abs(p-h)<=a,m=Math.abs(f-l)<=a,v=Math.abs(d-o)<=a,_=Math.abs(u-r)<=a;g&&(i.position.top=n._convertPositionTo("relative",{top:p-n.helperProportions.height,left:0}).top-n.margins.top),m&&(i.position.top=n._convertPositionTo("relative",{top:f,left:0}).top-n.margins.top),v&&(i.position.left=n._convertPositionTo("relative",{top:0,left:d-n.helperProportions.width}).left-n.margins.left),_&&(i.position.left=n._convertPositionTo("relative",{top:0,left:u}).left-n.margins.left)}var y=g||m||v||_;if("outer"!=s.snapMode){var g=Math.abs(p-l)<=a,m=Math.abs(f-h)<=a,v=Math.abs(d-r)<=a,_=Math.abs(u-o)<=a;g&&(i.position.top=n._convertPositionTo("relative",{top:p,left:0}).top-n.margins.top),m&&(i.position.top=n._convertPositionTo("relative",{top:f-n.helperProportions.height,left:0}).top-n.margins.top),v&&(i.position.left=n._convertPositionTo("relative",{top:0,left:d}).left-n.margins.left),_&&(i.position.left=n._convertPositionTo("relative",{top:0,left:u-n.helperProportions.width}).left-n.margins.left)}!n.snapElements[c].snapping&&(g||m||v||_||y)&&n.options.snap.snap&&n.options.snap.snap.call(n.element,t,e.extend(n._uiHash(),{snapItem:n.snapElements[c].item})),n.snapElements[c].snapping=g||m||v||_||y}else n.snapElements[c].snapping&&n.options.snap.release&&n.options.snap.release.call(n.element,t,e.extend(n._uiHash(),{snapItem:n.snapElements[c].item})),n.snapElements[c].snapping=!1}}}),e.ui.plugin.add("draggable","stack",{start:function(t,i){var n=e(this).data("draggable").options,s=e.makeArray(e(n.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});if(s.length){var a=parseInt(s[0].style.zIndex)||0;e(s).each(function(e){this.style.zIndex=a+e}),this[0].style.zIndex=a+s.length}}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var n=e(i.helper),s=e(this).data("draggable").options;n.css("zIndex")&&(s._zIndex=n.css("zIndex")),n.css("zIndex",s.zIndex)},stop:function(t,i){var n=e(this).data("draggable").options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}})}(jQuery),function(e,t){e.widget("ui.droppable",{version:"1.9.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var t=this.options,i=t.accept;this.isover=0,this.isout=1,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=e.ui.ddmanager.droppables[this.options.scope],i=0;i<t.length;i++)t[i]==this&&t.splice(i,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 n=i||e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]==this.element[0])return!1;var s=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope==n.options.scope&&t.accept.call(t.element[0],n.currentItem||n.element)&&e.ui.intersect(n,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(s=!0,!1):void 0}),s?!1:this.accept.call(this.element[0],n.currentItem||n.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(n)),this.element):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(t,i,n){if(!i.offset)return!1;var s=(t.positionAbs||t.position.absolute).left,a=s+t.helperProportions.width,r=(t.positionAbs||t.position.absolute).top,o=r+t.helperProportions.height,l=i.offset.left,h=l+i.proportions.width,c=i.offset.top,d=c+i.proportions.height;switch(n){case"fit":return s>=l&&h>=a&&r>=c&&d>=o;case"intersect":return l<s+t.helperProportions.width/2&&a-t.helperProportions.width/2<h&&c<r+t.helperProportions.height/2&&o-t.helperProportions.height/2<d;case"pointer":var u=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,p=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,f=e.ui.isOver(p,u,c,l,i.proportions.height,i.proportions.width);return f;case"touch":return(r>=c&&d>=r||o>=c&&d>=o||c>r&&o>d)&&(s>=l&&h>=s||a>=l&&h>=a||l>s&&a>h);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var n=e.ui.ddmanager.droppables[t.options.scope]||[],s=i?i.type:null,a=(t.currentItem||t.element).find(":data(droppable)").andSelf();e:for(var r=0;r<n.length;r++)if(!(n[r].options.disabled||t&&!n[r].accept.call(n[r].element[0],t.currentItem||t.element))){for(var o=0;o<a.length;o++)if(a[o]==n[r].element[0]){n[r].proportions.height=0;continue e}n[r].visible="none"!=n[r].element.css("display"),n[r].visible&&("mousedown"==s&&n[r]._activate.call(n[r],i),n[r].offset=n[r].element.offset(),n[r].proportions={width:n[r].element[0].offsetWidth,height:n[r].element[0].offsetHeight})}},drop:function(t,i){var n=!1;return e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(n=this._drop.call(this,i)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,i)))}),n},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 n=e.ui.intersect(t,this,this.options.tolerance),s=n||1!=this.isover?n&&0==this.isover?"isover":null:"isout";if(s){var a;if(this.options.greedy){var r=this.options.scope,o=this.element.parents(":data(droppable)").filter(function(){return e.data(this,"droppable").options.scope===r});o.length&&(a=e.data(o[0],"droppable"),a.greedyChild="isover"==s?1:0)}a&&"isover"==s&&(a.isover=0,a.isout=1,a._out.call(a,i)),this[s]=1,this["isout"==s?"isover":"isout"]=0,this["isover"==s?"_over":"_out"].call(this,i),a&&"isout"==s&&(a.isout=0,a.isover=1,a._over.call(a,i))}}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}}(jQuery),jQuery.effects||function(e,t){var i=e.uiBackCompat!==!1,n="ui-effects-";e.effects={effect:{}},function(t,i){function n(e,t,i){var n=u[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function s(e){var i=c(),n=i._rgba=[];return e=e.toLowerCase(),g(h,function(t,s){var a,r=s.re.exec(e),o=r&&s.parse(r),l=s.space||"rgba";return o?(a=i[l](o),i[d[l].cache]=a[d[l].cache],n=i._rgba=a._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&t.extend(n,r.transparent),i):r[e]}function a(e,t,i){return i=(i+1)%1,1>6*i?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var r,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),l=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],c=t.Color=function(e,i,n,s){return new t.Color.fn.parse(e,i,n,s)},d={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},p=c.support={},f=t("<p>")[0],g=t.each;f.style.cssText="background-color:rgba(1,1,1,.5)",p.rgba=f.style.backgroundColor.indexOf("rgba")>-1,g(d,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),c.fn=t.extend(c.prototype,{parse:function(a,o,l,h){if(a===i)return this._rgba=[null,null,null,null],this;(a.jquery||a.nodeType)&&(a=t(a).css(o),o=i);var u=this,p=t.type(a),f=this._rgba=[];return o!==i&&(a=[a,o,l,h],p="array"),"string"===p?this.parse(s(a)||r._default):"array"===p?(g(d.rgba.props,function(e,t){f[t.idx]=n(a[t.idx],t)}),this):"object"===p?(a instanceof c?g(d,function(e,t){a[t.cache]&&(u[t.cache]=a[t.cache].slice())}):g(d,function(t,i){var s=i.cache;g(i.props,function(e,t){if(!u[s]&&i.to){if("alpha"===e||null==a[e])return;u[s]=i.to(u._rgba)}u[s][t.idx]=n(a[e],t,!0)}),u[s]&&e.inArray(null,u[s].slice(0,3))<0&&(u[s][3]=1,i.from&&(u._rgba=i.from(u[s])))}),this):void 0},is:function(e){var t=c(e),i=!0,n=this;return g(d,function(e,s){var a,r=t[s.cache];return r&&(a=n[s.cache]||s.to&&s.to(n._rgba)||[],g(s.props,function(e,t){return null!=r[t.idx]?i=r[t.idx]===a[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return g(d,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var i=c(e),s=i._space(),a=d[s],r=0===this.alpha()?c("transparent"):this,o=r[a.cache]||a.to(r._rgba),l=o.slice();return i=i[a.cache],g(a.props,function(e,s){var a=s.idx,r=o[a],h=i[a],c=u[s.type]||{};null!==h&&(null===r?l[a]=h:(c.mod&&(h-r>c.mod/2?r+=c.mod:r-h>c.mod/2&&(r-=c.mod)),l[a]=n((h-r)*t+r,s)))}),this[s](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),s=c(e)._rgba;return c(t.map(i,function(e,t){return(1-n)*s[t]+n*e}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),n=i.pop();return e&&i.push(~~(255*n)),"#"+t.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),c.fn.parse.prototype=c.fn,d.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,s=e[1]/255,a=e[2]/255,r=e[3],o=Math.max(n,s,a),l=Math.min(n,s,a),h=o-l,c=o+l,d=.5*c;return t=l===o?0:n===o?60*(s-a)/h+360:s===o?60*(a-n)/h+120:60*(n-s)/h+240,i=0===d||1===d?d:.5>=d?h/c:h/(2-c),[Math.round(t)%360,i,d,null==r?1:r]},d.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],s=e[3],r=.5>=n?n*(1+i):n+i-n*i,o=2*n-r;return[Math.round(255*a(o,r,t+1/3)),Math.round(255*a(o,r,t)),Math.round(255*a(o,r,t-1/3)),s]},g(d,function(e,s){var a=s.props,r=s.cache,o=s.to,h=s.from;c.fn[e]=function(e){if(o&&!this[r]&&(this[r]=o(this._rgba)),e===i)return this[r].slice();var s,l=t.type(e),d="array"===l||"object"===l?e:arguments,u=this[r].slice();return g(a,function(e,t){var i=d["object"===l?e:t.idx];null==i&&(i=u[t.idx]),u[t.idx]=n(i,t)}),h?(s=c(h(u)),s[r]=u,s):c(u)},g(a,function(i,n){c.fn[i]||(c.fn[i]=function(s){var a,r=t.type(s),o="alpha"===i?this._hsla?"hsla":"rgba":e,h=this[o](),c=h[n.idx];return"undefined"===r?c:("function"===r&&(s=s.call(this,c),r=t.type(s)),null==s&&n.empty?this:("string"===r&&(a=l.exec(s),a&&(s=c+parseFloat(a[2])*("+"===a[1]?1:-1))),h[n.idx]=s,this[o](h)))})})}),g(o,function(e,i){t.cssHooks[i]={set:function(e,n){var a,r,o="";if("string"!==t.type(n)||(a=s(n))){if(n=c(a||n),!p.rgba&&1!==n._rgba[3]){for(r="backgroundColor"===i?e.parentNode:e;(""===o||"transparent"===o)&&r&&r.style;)try{o=t.css(r,"backgroundColor"),r=r.parentNode}catch(l){}n=n.blend(o&&"transparent"!==o?o:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=c(e.elem,i),e.end=c(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}}),t.cssHooks.borderColor={expand:function(e){var t={};return g(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},r=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(){var t,i,n=this.ownerDocument.defaultView?this.ownerDocument.defaultView.getComputedStyle(this,null):this.currentStyle,s={};if(n&&n.length&&n[0]&&n[n[0]])for(i=n.length;i--;)t=n[i],"string"==typeof n[t]&&(s[e.camelCase(t)]=n[t]);else for(t in n)"string"==typeof n[t]&&(s[t]=n[t]);return s}function n(t,i){var n,s,r={};for(n in i)s=i[n],t[n]!==s&&(a[n]||(e.fx.step[n]||!isNaN(parseFloat(s)))&&(r[n]=s));return r}var s=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,i,e.end),e.setAttr=!0)}}),e.effects.animateClass=function(t,a,r,o){var l=e.speed(a,r,o);return this.queue(function(){var a,r=e(this),o=r.attr("class")||"",h=l.children?r.find("*").andSelf():r;h=h.map(function(){var t=e(this);return{el:t,start:i.call(this)}}),a=function(){e.each(s,function(e,i){t[i]&&r[i+"Class"](t[i])})},a(),h=h.map(function(){return this.end=i.call(this.el[0]),this.diff=n(this.start,this.end),this}),r.attr("class",o),h=h.map(function(){var t=this,i=e.Deferred(),n=jQuery.extend({},l,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,n),i.promise()}),e.when.apply(e,h.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(r[0])})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,i,n,s){return i?e.effects.animateClass.call(this,{add:t},i,n,s):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,i,n,s){return i?e.effects.animateClass.call(this,{remove:t},i,n,s):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(i,n,s,a,r){return"boolean"==typeof n||n===t?s?e.effects.animateClass.call(this,n?{add:i}:{remove:i},s,a,r):this._toggleClass(i,n):e.effects.animateClass.call(this,{toggle:i},n,s,a)},switchClass:function(t,i,n,s,a){return e.effects.animateClass.call(this,{add:i,remove:t},n,s,a)}})}(),function(){function s(t,i,n,s){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(s=i,n=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(s=n,n=i,i={}),e.isFunction(n)&&(s=n,n=null),i&&e.extend(t,i),n=n||i.duration,t.duration=e.fx.off?0:"number"==typeof n?n:n in e.fx.speeds?e.fx.speeds[n]:e.fx.speeds._default,t.complete=s||i.complete,t}function a(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?!1:i&&e.effects[t]?!1:!0}e.extend(e.effects,{version:"1.9.2",save:function(e,t){for(var i=0;i<t.length;i++)null!==t[i]&&e.data(n+t[i],e[0].style[t[i]])},restore:function(e,i){var s,a;for(a=0;a<i.length;a++)null!==i[a]&&(s=e.data(n+i[a]),s===t&&(s=""),e.css(i[a],s))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,n;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":n=0;break;case"center":n=.5;break;case"right":n=1;break;default:n=e[1]/t.width}return{x:n,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},n=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),s={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(r){a=document.body}return t.wrap(n),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),n=t.parent(),"static"===t.css("position")?(n.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,n){i[n]=t.css(n),isNaN(parseInt(i[n],10))&&(i[n]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(s),n.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,n,s){return s=s||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(s[i]=a[0]*n+a[1])}),s}}),e.fn.extend({effect:function(){function t(t){function i(){e.isFunction(a)&&a.call(s[0]),e.isFunction(t)&&t()}var s=e(this),a=n.complete,r=n.mode;(s.is(":hidden")?"hide"===r:"show"===r)?i():o.call(s[0],n,i)}var n=s.apply(this,arguments),a=n.mode,r=n.queue,o=e.effects.effect[n.effect],l=!o&&i&&e.effects[n.effect];return e.fx.off||!o&&!l?a?this[a](n.duration,n.complete):this.each(function(){n.complete&&n.complete.call(this)}):o?r===!1?this.each(t):this.queue(r||"fx",t):l.call(this,{options:n,duration:n.duration,callback:n.complete,mode:n.mode})},_show:e.fn.show,show:function(e){if(a(e))return this._show.apply(this,arguments);var t=s.apply(this,arguments);return t.mode="show",this.effect.call(this,t)},_hide:e.fn.hide,hide:function(e){if(a(e))return this._hide.apply(this,arguments);var t=s.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(a(t)||"boolean"==typeof t||e.isFunction(t))return this.__toggle.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)},cssUnit:function(t){var i=this.css(t),n=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(n=[parseFloat(i),t])}),n}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;e<((t=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}()}(jQuery),function(e,t){var i=/up|down|vertical/,n=/up|left|vertical|horizontal/;e.effects.effect.blind=function(t,s){var a,r,o,l=e(this),h=["position","top","bottom","left","right","height","width"],c=e.effects.setMode(l,t.mode||"hide"),d=t.direction||"up",u=i.test(d),p=u?"height":"width",f=u?"top":"left",g=n.test(d),m={},v="show"===c;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),h):e.effects.save(l,h),l.show(),a=e.effects.createWrapper(l).css({overflow:"hidden"}),r=a[p](),o=parseFloat(a.css(f))||0,m[p]=v?r:0,g||(l.css(u?"bottom":"right",0).css(u?"top":"left","auto").css({position:"absolute"}),m[f]=v?o:r+o),v&&(a.css(p,0),g||a.css(f,o+r)),a.animate(m,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===c&&l.hide(),e.effects.restore(l,h),e.effects.removeWrapper(l),s()}})}}(jQuery),function(e,t){e.effects.effect.bounce=function(t,i){var n,s,a,r=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(r,t.mode||"effect"),h="hide"===l,c="show"===l,d=t.direction||"up",u=t.distance,p=t.times||5,f=2*p+(c||h?1:0),g=t.duration/f,m=t.easing,v="up"===d||"down"===d?"top":"left",_="up"===d||"left"===d,y=r.queue(),b=y.length;for((c||h)&&o.push("opacity"),e.effects.save(r,o),r.show(),e.effects.createWrapper(r),u||(u=r["top"===v?"outerHeight":"outerWidth"]()/3),c&&(a={opacity:1},a[v]=0,r.css("opacity",0).css(v,_?2*-u:2*u).animate(a,g,m)),h&&(u/=Math.pow(2,p-1)),a={},a[v]=0,n=0;p>n;n++)s={},s[v]=(_?"-=":"+=")+u,r.animate(s,g,m).animate(a,g,m),u=h?2*u:u/2;h&&(s={opacity:0},s[v]=(_?"-=":"+=")+u,r.animate(s,g,m)),r.queue(function(){h&&r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}),b>1&&y.splice.apply(y,[1,0].concat(y.splice(b,f+1))),r.dequeue()}}(jQuery),function(e,t){e.effects.effect.clip=function(t,i){var n,s,a,r=e(this),o=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(r,t.mode||"hide"),h="show"===l,c=t.direction||"vertical",d="vertical"===c,u=d?"height":"width",p=d?"top":"left",f={};e.effects.save(r,o),r.show(),n=e.effects.createWrapper(r).css({overflow:"hidden"}),s="IMG"===r[0].tagName?n:r,a=s[u](),h&&(s.css(u,0),s.css(p,a/2)),f[u]=h?a:0,f[p]=h?0:a/2,s.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){h||r.hide(),e.effects.restore(r,o),e.effects.removeWrapper(r),i()}})}}(jQuery),function(e,t){e.effects.effect.drop=function(t,i){
var n,s=e(this),a=["position","top","bottom","left","right","opacity","height","width"],r=e.effects.setMode(s,t.mode||"hide"),o="show"===r,l=t.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l?"pos":"neg",d={opacity:o?1:0};e.effects.save(s,a),s.show(),e.effects.createWrapper(s),n=t.distance||s["top"===h?"outerHeight":"outerWidth"](!0)/2,o&&s.css("opacity",0).css(h,"pos"===c?-n:n),d[h]=(o?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+n,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&s.hide(),e.effects.restore(s,a),e.effects.removeWrapper(s),i()}})}}(jQuery),function(e,t){e.effects.effect.explode=function(t,i){function n(){y.push(this),y.length===d*u&&s()}function s(){p.css({visibility:"visible"}),e(y).remove(),g||p.hide(),i()}var a,r,o,l,h,c,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,u=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),g="show"===f,m=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/u),_=Math.ceil(p.outerHeight()/d),y=[];for(a=0;d>a;a++)for(l=m.top+a*_,c=a-(d-1)/2,r=0;u>r;r++)o=m.left+r*v,h=r-(u-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-r*v,top:-a*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:o+(g?h*v:0),top:l+(g?c*_:0),opacity:g?0:1}).animate({left:o+(g?0:h*v),top:l+(g?0:c*_),opacity:g?1:0},t.duration||500,t.easing,n)}}(jQuery),function(e,t){e.effects.effect.fade=function(t,i){var n=e(this),s=e.effects.setMode(n,t.mode||"toggle");n.animate({opacity:s},{queue:!1,duration:t.duration,easing:t.easing,complete:i})}}(jQuery),function(e,t){e.effects.effect.fold=function(t,i){var n,s,a=e(this),r=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(a,t.mode||"hide"),l="show"===o,h="hide"===o,c=t.size||15,d=/([0-9]+)%/.exec(c),u=!!t.horizFirst,p=l!==u,f=p?["width","height"]:["height","width"],g=t.duration/2,m={},v={};e.effects.save(a,r),a.show(),n=e.effects.createWrapper(a).css({overflow:"hidden"}),s=p?[n.width(),n.height()]:[n.height(),n.width()],d&&(c=parseInt(d[1],10)/100*s[h?0:1]),l&&n.css(u?{height:0,width:c}:{height:c,width:0}),m[f[0]]=l?s[0]:c,v[f[1]]=l?s[1]:0,n.animate(m,g,t.easing).animate(v,g,t.easing,function(){h&&a.hide(),e.effects.restore(a,r),e.effects.removeWrapper(a),i()})}}(jQuery),function(e,t){e.effects.effect.highlight=function(t,i){var n=e(this),s=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(n,t.mode||"show"),r={backgroundColor:n.css("backgroundColor")};"hide"===a&&(r.opacity=0),e.effects.save(n,s),n.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(r,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&n.hide(),e.effects.restore(n,s),i()}})}}(jQuery),function(e,t){e.effects.effect.pulsate=function(t,i){var n,s=e(this),a=e.effects.setMode(s,t.mode||"show"),r="show"===a,o="hide"===a,l=r||"hide"===a,h=2*(t.times||5)+(l?1:0),c=t.duration/h,d=0,u=s.queue(),p=u.length;for((r||!s.is(":visible"))&&(s.css("opacity",0).show(),d=1),n=1;h>n;n++)s.animate({opacity:d},c,t.easing),d=1-d;s.animate({opacity:d},c,t.easing),s.queue(function(){o&&s.hide(),i()}),p>1&&u.splice.apply(u,[1,0].concat(u.splice(p,h+1))),s.dequeue()}}(jQuery),function(e,t){e.effects.effect.puff=function(t,i){var n=e(this),s=e.effects.setMode(n,t.mode||"hide"),a="hide"===s,r=parseInt(t.percent,10)||150,o=r/100,l={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:s,complete:i,percent:a?r:100,from:a?l:{height:l.height*o,width:l.width*o,outerHeight:l.outerHeight*o,outerWidth:l.outerWidth*o}}),n.effect(t)},e.effects.effect.scale=function(t,i){var n=e(this),s=e.extend(!0,{},t),a=e.effects.setMode(n,t.mode||"effect"),r=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),o=t.direction||"both",l=t.origin,h={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},c={y:"horizontal"!==o?r/100:1,x:"vertical"!==o?r/100:1};s.effect="size",s.queue=!1,s.complete=i,"effect"!==a&&(s.origin=l||["middle","center"],s.restore=!0),s.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:h),s.to={height:h.height*c.y,width:h.width*c.x,outerHeight:h.outerHeight*c.y,outerWidth:h.outerWidth*c.x},s.fade&&("show"===a&&(s.from.opacity=0,s.to.opacity=1),"hide"===a&&(s.from.opacity=1,s.to.opacity=0)),n.effect(s)},e.effects.effect.size=function(t,i){var n,s,a,r=e(this),o=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],c=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],u=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(r,t.mode||"effect"),f=t.restore||"effect"!==p,g=t.scale||"both",m=t.origin||["middle","center"],v=r.css("position"),_=f?o:l,y={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&r.show(),n={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},"toggle"===t.mode&&"show"===p?(r.from=t.to||y,r.to=t.from||n):(r.from=t.from||("show"===p?y:n),r.to=t.to||("hide"===p?y:n)),a={from:{y:r.from.height/n.height,x:r.from.width/n.width},to:{y:r.to.height/n.height,x:r.to.width/n.width}},("box"===g||"both"===g)&&(a.from.y!==a.to.y&&(_=_.concat(d),r.from=e.effects.setTransition(r,d,a.from.y,r.from),r.to=e.effects.setTransition(r,d,a.to.y,r.to)),a.from.x!==a.to.x&&(_=_.concat(u),r.from=e.effects.setTransition(r,u,a.from.x,r.from),r.to=e.effects.setTransition(r,u,a.to.x,r.to))),("content"===g||"both"===g)&&a.from.y!==a.to.y&&(_=_.concat(c).concat(h),r.from=e.effects.setTransition(r,c,a.from.y,r.from),r.to=e.effects.setTransition(r,c,a.to.y,r.to)),e.effects.save(r,_),r.show(),e.effects.createWrapper(r),r.css("overflow","hidden").css(r.from),m&&(s=e.effects.getBaseline(m,n),r.from.top=(n.outerHeight-r.outerHeight())*s.y,r.from.left=(n.outerWidth-r.outerWidth())*s.x,r.to.top=(n.outerHeight-r.to.outerHeight)*s.y,r.to.left=(n.outerWidth-r.to.outerWidth)*s.x),r.css(r.from),("content"===g||"both"===g)&&(d=d.concat(["marginTop","marginBottom"]).concat(c),u=u.concat(["marginLeft","marginRight"]),h=o.concat(d).concat(u),r.find("*[width]").each(function(){var i=e(this),n={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,h),i.from={height:n.height*a.from.y,width:n.width*a.from.x,outerHeight:n.outerHeight*a.from.y,outerWidth:n.outerWidth*a.from.x},i.to={height:n.height*a.to.y,width:n.width*a.to.x,outerHeight:n.height*a.to.y,outerWidth:n.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,u,a.from.x,i.from),i.to=e.effects.setTransition(i,u,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,h)})})),r.animate(r.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===r.to.opacity&&r.css("opacity",r.from.opacity),"hide"===p&&r.hide(),e.effects.restore(r,_),f||("static"===v?r.css({position:"relative",top:r.to.top,left:r.to.left}):e.each(["top","left"],function(e,t){r.css(t,function(t,i){var n=parseInt(i,10),s=e?r.to.left:r.to.top;return"auto"===i?s+"px":n+s+"px"})})),e.effects.removeWrapper(r),i()}})}}(jQuery),function(e,t){e.effects.effect.shake=function(t,i){var n,s=e(this),a=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(s,t.mode||"effect"),o=t.direction||"left",l=t.distance||20,h=t.times||3,c=2*h+1,d=Math.round(t.duration/c),u="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,f={},g={},m={},v=s.queue(),_=v.length;for(e.effects.save(s,a),s.show(),e.effects.createWrapper(s),f[u]=(p?"-=":"+=")+l,g[u]=(p?"+=":"-=")+2*l,m[u]=(p?"-=":"+=")+2*l,s.animate(f,d,t.easing),n=1;h>n;n++)s.animate(g,d,t.easing).animate(m,d,t.easing);s.animate(g,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===r&&s.hide(),e.effects.restore(s,a),e.effects.removeWrapper(s),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),s.dequeue()}}(jQuery),function(e,t){e.effects.effect.slide=function(t,i){var n,s=e(this),a=["position","top","bottom","left","right","width","height"],r=e.effects.setMode(s,t.mode||"show"),o="show"===r,l=t.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,d={};e.effects.save(s,a),s.show(),n=t.distance||s["top"===h?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(s).css({overflow:"hidden"}),o&&s.css(h,c?isNaN(n)?"-"+n:-n:n),d[h]=(o?c?"+=":"-=":c?"-=":"+=")+n,s.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===r&&s.hide(),e.effects.restore(s,a),e.effects.removeWrapper(s),i()}})}}(jQuery),function(e,t){e.effects.effect.transfer=function(t,i){var n=e(this),s=e(t.to),a="fixed"===s.css("position"),r=e("body"),o=a?r.scrollTop():0,l=a?r.scrollLeft():0,h=s.offset(),c={top:h.top-o,left:h.left-l,height:s.innerHeight(),width:s.innerWidth()},d=n.offset(),u=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(t.className).css({top:d.top-o,left:d.left-l,height:n.innerHeight(),width:n.innerWidth(),position:a?"fixed":"absolute"}).animate(c,t.duration,t.easing,function(){u.remove(),i()})}}(jQuery),function(e,t){var i=!1;e.widget("ui.menu",{version:"1.9.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var n=e(t.target).closest(".ui-menu-item");!i&&n.not(".ui-state-disabled").length&&(i=!0,this.select(t),n.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),i=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,s,a,r,o,l=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:l=!1,s=this.previousFilter||"",a=String.fromCharCode(t.keyCode),r=!1,clearTimeout(this.filterTimer),a===s?r=!0:a=s+a,o=new RegExp("^"+i(a),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),n=r&&-1!==n.index(this.active.next())?this.active.nextAll(".ui-menu-item"):n,n.length||(a=String.fromCharCode(t.keyCode),o=new RegExp("^"+i(a),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousFilter=a,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}l&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,i=this.options.icons.submenu,n=this.element.find(this.options.menus);n.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),n=t.prev("a"),s=e("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",n.attr("id"))}),t=n.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-—–\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},focus:function(e,t){var i,n;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),n=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",n.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,n,s,a,r,o;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,n=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,s=t.offset().top-this.activeMenu.offset().top-i-n,a=this.activeMenu.scrollTop(),r=this.activeMenu.height(),o=t.height(),0>s?this.activeMenu.scrollTop(a+s):s+o>r&&this.activeMenu.scrollTop(a+s-r+o))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var n=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));n.length||(n=this.element),this._close(n),this.blur(t),this.activeMenu=n},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var n;this.active&&(n="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),n&&n.length&&this.active||(n=this.activeMenu.children(".ui-menu-item")[t]()),this.focus(i,n)},nextPage:function(t){var i,n,s;return this.active?void(this.isLastItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n-s<0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]()))):void this.next(t)},previousPage:function(t){var i,n,s;return this.active?void(this.isFirstItem()||(this._hasScroll()?(n=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-n+s>0}),this.focus(t,i)):this.focus(t,this.activeMenu.children(".ui-menu-item").first()))):void this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)}})}(jQuery),function(e,t){e.widget("ui.progressbar",{version:"1.9.2",options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this._value():(this._setOption("value",e),this)},_setOption:function(e,t){"value"===e&&(this.options.value=t,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),this._super(e,t)},_value:function(){var e=this.options.value;return"number"!=typeof e&&(e=0),Math.min(this.options.max,Math.max(this.min,e))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var e=this.value(),t=this._percentage();this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),this.valueDiv.toggle(e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(t.toFixed(0)+"%"),this.element.attr("aria-valuenow",e)}})}(jQuery),function(e,t){e.widget("ui.resizable",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var t=this,i=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=i.handles||(e(".ui-resizable-handle",this.element).length?{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"}:"e,s,se"),this.handles.constructor==String){"all"==this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw");var n=this.handles.split(",");this.handles={};for(var s=0;s<n.length;s++){var a=e.trim(n[s]),r="ui-resizable-"+a,o=e('<div class="ui-resizable-handle '+r+'"></div>');o.css({zIndex:i.zIndex}),"se"==a&&o.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[a]=".ui-resizable-"+a,this.element.append(o)}}this._renderAxis=function(t){t=t||this.element;for(var i in this.handles){if(this.handles[i].constructor==String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=e(this.handles[i],this.element),s=0;s=/sw|ne|nw|se|n|s/.test(i)?n.outerHeight():n.outerWidth();var a=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");t.css(a,s),this._proportionallyResize()}e(this.handles[i]).length}},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!t.resizing){if(this.className)var e=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);t.axis=e&&e[1]?e[1]:"se"}}),i.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){i.disabled||(e(this).removeClass("ui-resizable-autohide"),t._handles.show())}).mouseleave(function(){i.disabled||t.resizing||(e(this).addClass("ui-resizable-autohide"),t._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){t(this.element);var i=this.element;this.originalElement.css({position:i.css("position"),width:i.outerWidth(),height:i.outerHeight(),top:i.css("top"),left:i.css("left")}).insertAfter(i),i.remove()}return this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_mouseCapture:function(t){var i=!1;for(var n in this.handles)e(this.handles[n])[0]==t.target&&(i=!0);return!this.options.disabled&&i},_mouseStart:function(t){var n=this.options,s=this.element.position(),a=this.element;this.resizing=!0,this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()},(a.is(".ui-draggable")||/absolute/.test(a.css("position")))&&a.css({position:"absolute",top:s.top,left:s.left}),this._renderProxy();var r=i(this.helper.css("left")),o=i(this.helper.css("top"));n.containment&&(r+=e(n.containment).scrollLeft()||0,o+=e(n.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:r,top:o},this.size=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.originalPosition={left:r,top:o},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof n.aspectRatio?n.aspectRatio:this.originalSize.width/this.originalSize.height||1;var l=e(".ui-resizable-"+this.axis).css("cursor");return e("body").css("cursor","auto"==l?this.axis+"-resize":l),a.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(e){var t=this.helper,i=(this.options,this.originalMousePosition),n=this.axis,s=e.pageX-i.left||0,a=e.pageY-i.top||0,r=this._change[n];if(!r)return!1;var o=r.apply(this,[e,s,a]);return this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(o=this._updateRatio(o,e)),o=this._respectSize(o,e),this._propagate("resize",e),t.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(o),this._trigger("resize",e,this.ui()),!1},_mouseStop:function(t){this.resizing=!1;var i=this.options,n=this;if(this._helper){var s=this._proportionallyResizeElements,a=s.length&&/textarea/i.test(s[0].nodeName),r=a&&e.ui.hasScroll(s[0],"left")?0:n.sizeDiff.height,o=a?0:n.sizeDiff.width,l={width:n.helper.width()-o,height:n.helper.height()-r},h=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,c=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;i.animate||this.element.css(e.extend(l,{top:c,left:h})),n.helper.height(n.size.height),n.helper.width(n.size.width),this._helper&&!i.animate&&this._proportionallyResize()}return e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,i,s,a,r,o=this.options;r={minWidth:n(o.minWidth)?o.minWidth:0,maxWidth:n(o.maxWidth)?o.maxWidth:1/0,minHeight:n(o.minHeight)?o.minHeight:0,maxHeight:n(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=r.minHeight*this.aspectRatio,s=r.minWidth/this.aspectRatio,i=r.maxHeight*this.aspectRatio,a=r.maxWidth/this.aspectRatio,t>r.minWidth&&(r.minWidth=t),s>r.minHeight&&(r.minHeight=s),i<r.maxWidth&&(r.maxWidth=i),a<r.maxHeight&&(r.maxHeight=a)),this._vBoundaries=r},_updateCache:function(e){this.options;this.offset=this.helper.offset(),n(e.left)&&(this.position.left=e.left),n(e.top)&&(this.position.top=e.top),n(e.height)&&(this.size.height=e.height),n(e.width)&&(this.size.width=e.width)},_updateRatio:function(e,t){var i=(this.options,this.position),s=this.size,a=this.axis;return n(e.height)?e.width=e.height*this.aspectRatio:n(e.width)&&(e.height=e.width/this.aspectRatio),"sw"==a&&(e.left=i.left+(s.width-e.width),e.top=null),"nw"==a&&(e.top=i.top+(s.height-e.height),e.left=i.left+(s.width-e.width)),e},_respectSize:function(e,t){var i=(this.helper,this._vBoundaries),s=(this._aspectRatio||t.shiftKey,this.axis),a=n(e.width)&&i.maxWidth&&i.maxWidth<e.width,r=n(e.height)&&i.maxHeight&&i.maxHeight<e.height,o=n(e.width)&&i.minWidth&&i.minWidth>e.width,l=n(e.height)&&i.minHeight&&i.minHeight>e.height;o&&(e.width=i.minWidth),l&&(e.height=i.minHeight),a&&(e.width=i.maxWidth),r&&(e.height=i.maxHeight);var h=this.originalPosition.left+this.originalSize.width,c=this.position.top+this.size.height,d=/sw|nw|w/.test(s),u=/nw|ne|n/.test(s);o&&d&&(e.left=h-i.minWidth),a&&d&&(e.left=h-i.maxWidth),l&&u&&(e.top=c-i.minHeight),r&&u&&(e.top=c-i.maxHeight);var p=!e.width&&!e.height;return p&&!e.left&&e.top?e.top=null:p&&!e.top&&e.left&&(e.left=null),e},_proportionallyResize:function(){this.options;if(this._proportionallyResizeElements.length)for(var t=this.helper||this.element,i=0;i<this._proportionallyResizeElements.length;i++){var n=this._proportionallyResizeElements[i];if(!this.borderDif){var s=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],a=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")];this.borderDif=e.map(s,function(e,t){var i=parseInt(e,10)||0,n=parseInt(a[t],10)||0;return i+n})}n.css({height:t.height()-this.borderDif[0]-this.borderDif[2]||0,width:t.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var t=this.element,i=this.options;if(this.elementOffset=t.offset(),this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var n=e.ui.ie6?1:0,s=e.ui.ie6?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+s,height:this.element.outerHeight()+s,position:"absolute",left:this.elementOffset.left-n+"px",top:this.elementOffset.top-n+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(e,t,i){return{width:this.originalSize.width+t}},w:function(e,t,i){var n=(this.options,this.originalSize),s=this.originalPosition;return{left:s.left+t,width:n.width-t}},n:function(e,t,i){var n=(this.options,this.originalSize),s=this.originalPosition;return{top:s.top+i,height:n.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},sw:function(t,i,n){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,n]))},ne:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,n]))},nw:function(t,i,n){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,n]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!=t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","alsoResize",{start:function(t,i){var n=e(this).data("resizable"),s=n.options,a=function(t){e(t).each(function(){var t=e(this);t.data("resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof s.alsoResize||s.alsoResize.parentNode?a(s.alsoResize):s.alsoResize.length?(s.alsoResize=s.alsoResize[0],a(s.alsoResize)):e.each(s.alsoResize,function(e){a(e)})},resize:function(t,i){var n=e(this).data("resizable"),s=n.options,a=n.originalSize,r=n.originalPosition,o={height:n.size.height-a.height||0,width:n.size.width-a.width||0,top:n.position.top-r.top||0,left:n.position.left-r.left||0},l=function(t,n){e(t).each(function(){var t=e(this),s=e(this).data("resizable-alsoresize"),a={},r=n&&n.length?n:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(e,t){var i=(s[t]||0)+(o[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof s.alsoResize||s.alsoResize.nodeType?l(s.alsoResize):e.each(s.alsoResize,function(e,t){l(e,t)})},stop:function(t,i){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","animate",{
stop:function(t,i){var n=e(this).data("resizable"),s=n.options,a=n._proportionallyResizeElements,r=a.length&&/textarea/i.test(a[0].nodeName),o=r&&e.ui.hasScroll(a[0],"left")?0:n.sizeDiff.height,l=r?0:n.sizeDiff.width,h={width:n.size.width-l,height:n.size.height-o},c=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,d=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(h,d&&c?{top:d,left:c}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var i={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};a&&a.length&&e(a[0]).css({width:i.width,height:i.height}),n._updateCache(i),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(t,n){var s=e(this).data("resizable"),a=s.options,r=s.element,o=a.containment,l=o instanceof e?o.get(0):/parent/.test(o)?r.parent().get(0):o;if(l)if(s.containerElement=e(l),/document/.test(o)||o==document)s.containerOffset={left:0,top:0},s.containerPosition={left:0,top:0},s.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight};else{var h=e(l),c=[];e(["Top","Right","Left","Bottom"]).each(function(e,t){c[e]=i(h.css("padding"+t))}),s.containerOffset=h.offset(),s.containerPosition=h.position(),s.containerSize={height:h.innerHeight()-c[3],width:h.innerWidth()-c[1]};var d=s.containerOffset,u=s.containerSize.height,p=s.containerSize.width,f=e.ui.hasScroll(l,"left")?l.scrollWidth:p,g=e.ui.hasScroll(l)?l.scrollHeight:u;s.parentData={element:l,left:d.left,top:d.top,width:f,height:g}}},resize:function(t,i){var n=e(this).data("resizable"),s=n.options,a=(n.containerSize,n.containerOffset),r=(n.size,n.position),o=n._aspectRatio||t.shiftKey,l={top:0,left:0},h=n.containerElement;h[0]!=document&&/static/.test(h.css("position"))&&(l=a),r.left<(n._helper?a.left:0)&&(n.size.width=n.size.width+(n._helper?n.position.left-a.left:n.position.left-l.left),o&&(n.size.height=n.size.width/n.aspectRatio),n.position.left=s.helper?a.left:0),r.top<(n._helper?a.top:0)&&(n.size.height=n.size.height+(n._helper?n.position.top-a.top:n.position.top),o&&(n.size.width=n.size.height*n.aspectRatio),n.position.top=n._helper?a.top:0),n.offset.left=n.parentData.left+n.position.left,n.offset.top=n.parentData.top+n.position.top;var c=Math.abs((n._helper?n.offset.left-l.left:n.offset.left-l.left)+n.sizeDiff.width),d=Math.abs((n._helper?n.offset.top-l.top:n.offset.top-a.top)+n.sizeDiff.height),u=n.containerElement.get(0)==n.element.parent().get(0),p=/relative|absolute/.test(n.containerElement.css("position"));u&&p&&(c-=n.parentData.left),c+n.size.width>=n.parentData.width&&(n.size.width=n.parentData.width-c,o&&(n.size.height=n.size.width/n.aspectRatio)),d+n.size.height>=n.parentData.height&&(n.size.height=n.parentData.height-d,o&&(n.size.width=n.size.height*n.aspectRatio))},stop:function(t,i){var n=e(this).data("resizable"),s=n.options,a=(n.position,n.containerOffset),r=n.containerPosition,o=n.containerElement,l=e(n.helper),h=l.offset(),c=l.outerWidth()-n.sizeDiff.width,d=l.outerHeight()-n.sizeDiff.height;n._helper&&!s.animate&&/relative/.test(o.css("position"))&&e(this).css({left:h.left-r.left-a.left,width:c,height:d}),n._helper&&!s.animate&&/static/.test(o.css("position"))&&e(this).css({left:h.left-r.left-a.left,width:c,height:d})}}),e.ui.plugin.add("resizable","ghost",{start:function(t,i){var n=e(this).data("resizable"),s=n.options,a=n.size;n.ghost=n.originalElement.clone(),n.ghost.css({opacity:.25,display:"block",position:"relative",height:a.height,width:a.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof s.ghost?s.ghost:""),n.ghost.appendTo(n.helper)},resize:function(t,i){var n=e(this).data("resizable");n.options;n.ghost&&n.ghost.css({position:"relative",height:n.size.height,width:n.size.width})},stop:function(t,i){var n=e(this).data("resizable");n.options;n.ghost&&n.helper&&n.helper.get(0).removeChild(n.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(t,i){var n=e(this).data("resizable"),s=n.options,a=n.size,r=n.originalSize,o=n.originalPosition,l=n.axis;s._aspectRatio||t.shiftKey;s.grid="number"==typeof s.grid?[s.grid,s.grid]:s.grid;var h=Math.round((a.width-r.width)/(s.grid[0]||1))*(s.grid[0]||1),c=Math.round((a.height-r.height)/(s.grid[1]||1))*(s.grid[1]||1);/^(se|s|e)$/.test(l)?(n.size.width=r.width+h,n.size.height=r.height+c):/^(ne)$/.test(l)?(n.size.width=r.width+h,n.size.height=r.height+c,n.position.top=o.top-c):/^(sw)$/.test(l)?(n.size.width=r.width+h,n.size.height=r.height+c,n.position.left=o.left-h):(n.size.width=r.width+h,n.size.height=r.height+c,n.position.top=o.top-c,n.position.left=o.left-h)}});var i=function(e){return parseInt(e,10)||0},n=function(e){return!isNaN(parseInt(e,10))}}(jQuery),function(e,t){e.widget("ui.selectable",e.ui.mouse,{version:"1.9.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var t=this;this.element.addClass("ui-selectable"),this.dragged=!1;var i;this.refresh=function(){i=e(t.options.filter,t.element[0]),i.addClass("ui-selectee"),i.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=i.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this;if(this.opos=[t.pageX,t.pageY],!this.options.disabled){var n=this.options;this.selectees=e(n.filter,this.element[0]),this._trigger("start",t),e(n.appendTo).append(this.helper),this.helper.css({left:t.clientX,top:t.clientY,width:0,height:0}),n.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var n=e.data(this,"selectable-item");n.startselected=!0,t.metaKey||t.ctrlKey||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",t,{unselecting:n.element}))}),e(t.target).parents().andSelf().each(function(){var n=e.data(this,"selectable-item");if(n){var s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected");return n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1}})}},_mouseDrag:function(t){var i=this;if(this.dragged=!0,!this.options.disabled){var n=this.options,s=this.opos[0],a=this.opos[1],r=t.pageX,o=t.pageY;if(s>r){var l=r;r=s,s=l}if(a>o){var l=o;o=a,a=l}return this.helper.css({left:s,top:a,width:r-s,height:o-a}),this.selectees.each(function(){var l=e.data(this,"selectable-item");if(l&&l.element!=i.element[0]){var h=!1;"touch"==n.tolerance?h=!(l.left>r||l.right<s||l.top>o||l.bottom<a):"fit"==n.tolerance&&(h=l.left>s&&l.right<r&&l.top>a&&l.bottom<o),h?(l.selected&&(l.$element.removeClass("ui-selected"),l.selected=!1),l.unselecting&&(l.$element.removeClass("ui-unselecting"),l.unselecting=!1),l.selecting||(l.$element.addClass("ui-selecting"),l.selecting=!0,i._trigger("selecting",t,{selecting:l.element}))):(l.selecting&&((t.metaKey||t.ctrlKey)&&l.startselected?(l.$element.removeClass("ui-selecting"),l.selecting=!1,l.$element.addClass("ui-selected"),l.selected=!0):(l.$element.removeClass("ui-selecting"),l.selecting=!1,l.startselected&&(l.$element.addClass("ui-unselecting"),l.unselecting=!0),i._trigger("unselecting",t,{unselecting:l.element}))),l.selected&&(t.metaKey||t.ctrlKey||l.startselected||(l.$element.removeClass("ui-selected"),l.selected=!1,l.$element.addClass("ui-unselecting"),l.unselecting=!0,i._trigger("unselecting",t,{unselecting:l.element}))))}}),!1}},_mouseStop:function(t){var i=this;this.dragged=!1;this.options;return e(".ui-unselecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-unselecting"),n.unselecting=!1,n.startselected=!1,i._trigger("unselected",t,{unselected:n.element})}),e(".ui-selecting",this.element[0]).each(function(){var n=e.data(this,"selectable-item");n.$element.removeClass("ui-selecting").addClass("ui-selected"),n.selecting=!1,n.selected=!0,n.startselected=!0,i._trigger("selected",t,{selected:n.element})}),this._trigger("stop",t),this.helper.remove(),!1}})}(jQuery),function(e,t){var i=5;e.widget("ui.slider",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var t,n,s=this.options,a=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),r="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(s.disabled?" ui-slider-disabled ui-disabled":"")),this.range=e([]),s.range&&(s.range===!0&&(s.values||(s.values=[this._valueMin(),this._valueMin()]),s.values.length&&2!==s.values.length&&(s.values=[s.values[0],s.values[0]])),this.range=e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+("min"===s.range||"max"===s.range?" ui-slider-range-"+s.range:""))),n=s.values&&s.values.length||1,t=a.length;n>t;t++)o.push(r);this.handles=a.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(e){e.preventDefault()}).mouseenter(function(){s.disabled||e(this).addClass("ui-state-hover")}).mouseleave(function(){e(this).removeClass("ui-state-hover")}).focus(function(){s.disabled?e(this).blur():(e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),e(this).addClass("ui-state-focus"))}).blur(function(){e(this).removeClass("ui-state-focus")}),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)}),this._on(this.handles,{keydown:function(t){var n,s,a,r,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),n=this._start(t,o),n===!1))return}switch(r=this.options.step,s=a=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:a=this._valueMin();break;case e.ui.keyCode.END:a=this._valueMax();break;case e.ui.keyCode.PAGE_UP:a=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/i);break;case e.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/i);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;a=this._trimAlignValue(s+r);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;a=this._trimAlignValue(s-r)}this._slide(t,o,a)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}),this._refreshValue(),this._animateOff=!1},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,n,s,a,r,o,l,h,c=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},n=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(n-c.values(t));s>i&&(s=i,a=e(this),r=t)}),d.range===!0&&this.values(1)===d.min&&(r+=1,a=e(this.handles[r])),o=this._start(t,r),o===!1?!1:(this._mouseSliding=!0,this._handleIndex=r,a.addClass("ui-state-active").focus(),l=a.offset(),h=!e(t.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:t.pageX-l.left-a.width()/2,top:t.pageY-l.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,r,n),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,n,s,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),n=i/t,n>1&&(n=1),0>n&&(n=0),"vertical"===this.orientation&&(n=1-n),s=this._valueMax()-this._valueMin(),a=this._valueMin()+n*s,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var n,s,a;this.options.values&&this.options.values.length?(n=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>n||1===t&&n>i)&&(i=n),i!==this.values(t)&&(s=this.values(),s[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:s}),n=this.values(t?0:1),a!==!1&&this.values(t,i,!0))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,i){var n,s,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(n=this.options.values,s=arguments[0],a=0;a<n.length;a+=1)n[a]=this._trimAlignValue(s[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var n,s=0;switch(e.isArray(this.options.values)&&(s=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments),t){case"disabled":i?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.prop("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.prop("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),n=0;s>n;n+=1)this._change(null,n);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,n;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);for(i=this.options.values.slice(),n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(i[n]);return i},_trimAlignValue:function(e){if(e<=this._valueMin())return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,n=e-i;return 2*Math.abs(i)>=t&&(n+=i>0?t:-t),parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,i,n,s,a,r=this.options.range,o=this.options,l=this,h=this._animateOff?!1:o.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(n){i=(l.values(n)-l._valueMin())/(l._valueMax()-l._valueMin())*100,c["horizontal"===l.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[h?"animate":"css"](c,o.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===n&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},o.animate),1===n&&l.range[h?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:o.animate})):(0===n&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},o.animate),1===n&&l.range[h?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:o.animate}))),t=i}):(n=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(n-s)/(a-s)*100:0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,o.animate),"min"===r&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},o.animate),"max"===r&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:o.animate}),"min"===r&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},o.animate),"max"===r&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:o.animate}))}})}(jQuery),function(e,t){e.widget("ui.sortable",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,i){"disabled"===t?(this.options[t]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,i){var n=this;if(this.reverting)return!1;if(this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(t);var s=null;e(t.target).parents().each(function(){return e.data(this,n.widgetName+"-item")==n?(s=e(this),!1):void 0});if(e.data(t.target,n.widgetName+"-item")==n&&(s=e(t.target)),!s)return!1;if(this.options.handle&&!i){var a=!1;if(e(this.options.handle,s).find("*").andSelf().each(function(){this==t.target&&(a=!0)}),!a)return!1}return this.currentItem=s,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,i,n){var s=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,s.cursorAt&&this._adjustOffsetFromHelper(s.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),s.containment&&this._setContainment(),s.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",s.cursor)),s.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",s.opacity)),s.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",s.zIndex)),this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!n)for(var a=this.containers.length-1;a>=0;a--)this.containers[a]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){if(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll){var i=this.options,n=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?this.scrollParent[0].scrollTop=n=this.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-this.overflowOffset.top<i.scrollSensitivity&&(this.scrollParent[0].scrollTop=n=this.scrollParent[0].scrollTop-i.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?this.scrollParent[0].scrollLeft=n=this.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-this.overflowOffset.left<i.scrollSensitivity&&(this.scrollParent[0].scrollLeft=n=this.scrollParent[0].scrollLeft-i.scrollSpeed)):(t.pageY-e(document).scrollTop()<i.scrollSensitivity?n=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(n=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed)),t.pageX-e(document).scrollLeft()<i.scrollSensitivity?n=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(n=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))),n!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)}this.positionAbs=this._convertPositionTo("absolute"),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");for(var s=this.items.length-1;s>=0;s--){var a=this.items[s],r=a.item[0],o=this._intersectsWithPointer(a);if(o&&a.instance===this.currentContainer&&r!=this.currentItem[0]&&this.placeholder[1==o?"next":"prev"]()[0]!=r&&!e.contains(this.placeholder[0],r)&&("semi-dynamic"==this.options.type?!e.contains(this.element[0],r):!0)){if(this.direction=1==o?"down":"up","pointer"!=this.options.tolerance&&!this._intersectsWithSides(a))break;this._rearrange(t,a),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var n=this,s=this.placeholder.offset();this.reverting=!0,e(this.helper).animate({left:s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){n._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!=this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[-=_](.+)/);i&&n.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!n.length&&t.key&&n.push(t.key+"="),n.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),n=[];return t=t||{},i.each(function(){n.push(e(t.item||this).attr(t.attribute||"id")||"")}),n},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,n=this.positionAbs.top,s=n+this.helperProportions.height,a=e.left,r=a+e.width,o=e.top,l=o+e.height,h=this.offset.click.top,c=this.offset.click.left,d=n+h>o&&l>n+h&&t+c>a&&r>t+c;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?d:a<t+this.helperProportions.width/2&&i-this.helperProportions.width/2<r&&o<n+this.helperProportions.height/2&&s-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),s=i&&n,a=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return s?this.floating?r&&"right"==r||"down"==a?2:1:a&&("down"==a?2:1):!1},_intersectsWithSides:function(t){var i=e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),n=e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"==a&&n||"left"==a&&!n:s&&("down"==s&&i||"up"==s&&!i)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!=e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!=e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor==String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var i=[],n=[],s=this._connectWith();if(s&&t)for(var a=s.length-1;a>=0;a--)for(var r=e(s[a]),o=r.length-1;o>=0;o--){var l=e.data(r[o],this.widgetName);l&&l!=this&&!l.options.disabled&&n.push([e.isFunction(l.options.items)?l.options.items.call(l.element):e(l.options.items,l.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),l])}n.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var a=n.length-1;a>=0;a--)n[a][0].each(function(){i.push(this)});return e(i)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;i<t.length;i++)if(t[i]==e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i=this.items,n=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],s=this._connectWith();if(s&&this.ready)for(var a=s.length-1;a>=0;a--)for(var r=e(s[a]),o=r.length-1;o>=0;o--){var l=e.data(r[o],this.widgetName);l&&l!=this&&!l.options.disabled&&(n.push([e.isFunction(l.options.items)?l.options.items.call(l.element[0],t,{item:this.currentItem}):e(l.options.items,l.element),l]),this.containers.push(l))}for(var a=n.length-1;a>=0;a--)for(var h=n[a][1],c=n[a][0],o=0,d=c.length;d>o;o++){var u=e(c[o]);u.data(this.widgetName+"-item",h),i.push({item:u,instance:h,width:0,height:0,left:0,top:0})}},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var i=this.items.length-1;i>=0;i--){var n=this.items[i];if(n.instance==this.currentContainer||!this.currentContainer||n.item[0]==this.currentItem[0]){var s=this.options.toleranceElement?e(this.options.toleranceElement,n.item):n.item;t||(n.width=s.outerWidth(),n.height=s.outerHeight());var a=s.offset();n.left=a.left,n.top=a.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var i=this.containers.length-1;i>=0;i--){var a=this.containers[i].element.offset();this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}return this},_createPlaceholder:function(t){t=t||this;var i=t.options;if(!i.placeholder||i.placeholder.constructor==String){var n=i.placeholder;i.placeholder={element:function(){var i=e(document.createElement(t.currentItem[0].nodeName)).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return n||(i.style.visibility="hidden"),i},update:function(e,s){(!n||i.forcePlaceholderSize)&&(s.height()||s.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}}t.placeholder=e(i.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),i.placeholder.update(t,t.placeholder)},_contactContainers:function(t){for(var i=null,n=null,s=this.containers.length-1;s>=0;s--)if(!e.contains(this.currentItem[0],this.containers[s].element[0]))if(this._intersectsWith(this.containers[s].containerCache)){if(i&&e.contains(this.containers[s].element[0],i.element[0]))continue;i=this.containers[s],n=s}else this.containers[s].containerCache.over&&(this.containers[s]._trigger("out",t,this._uiHash(this)),
this.containers[s].containerCache.over=0);if(i)if(1===this.containers.length)this.containers[n]._trigger("over",t,this._uiHash(this)),this.containers[n].containerCache.over=1;else{for(var a=1e4,r=null,o=this.containers[n].floating?"left":"top",l=this.containers[n].floating?"width":"height",h=this.positionAbs[o]+this.offset.click[o],c=this.items.length-1;c>=0;c--)if(e.contains(this.containers[n].element[0],this.items[c].item[0])&&this.items[c].item[0]!=this.currentItem[0]){var d=this.items[c].item.offset()[o],u=!1;Math.abs(d-h)>Math.abs(d+this.items[c][l]-h)&&(u=!0,d+=this.items[c][l]),Math.abs(d-h)<a&&(a=Math.abs(d-h),r=this.items[c],this.direction=u?"up":"down")}if(!r&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[n],r?this._rearrange(t,r,null,!0):this._rearrange(t,null,this.containers[n].element,!0),this._trigger("change",t,this._uiHash()),this.containers[n]._trigger("change",t,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[n]._trigger("over",t,this._uiHash(this)),this.containers[n].containerCache.over=1}},_createHelper:function(t){var i=this.options,n=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"==i.helper?this.currentItem.clone():this.currentItem;return n.parents("body").length||e("parent"!=i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(n[0]),n[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(""==n[0].style.width||i.forceHelperSize)&&n.width(this.currentItem.width()),(""==n[0].style.height||i.forceHelperSize)&&n.height(this.currentItem.height()),n},_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(){this.offsetParent=this.helper.offsetParent();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.currentItem.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.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;if("parent"==t.containment&&(t.containment=this.helper[0].parentNode),("document"==t.containment||"window"==t.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"==t.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"==t.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),!/^(document|window|parent)$/.test(t.containment)){var i=e(t.containment)[0],n=e(t.containment).offset(),s="hidden"!=e(i).css("overflow");this.containment=[n.left+(parseInt(e(i).css("borderLeftWidth"),10)||0)+(parseInt(e(i).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(i).css("borderTopWidth"),10)||0)+(parseInt(e(i).css("paddingTop"),10)||0)-this.margins.top,n.left+(s?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e(i).css("borderLeftWidth"),10)||0)-(parseInt(e(i).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(s?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e(i).css("borderTopWidth"),10)||0)-(parseInt(e(i).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(t,i){i||(i=this.position);var n="absolute"==t?1:-1,s=(this.options,"absolute"!=this.cssPosition||this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent),a=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"==this.cssPosition?-this.scrollParent.scrollTop():a?0:s.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():a?0:s.scrollLeft())*n}},_generatePosition:function(t){var i=this.options,n="absolute"!=this.cssPosition||this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(n[0].tagName);"relative"!=this.cssPosition||this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset());var a=t.pageX,r=t.pageY;if(this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(r=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(r=this.containment[3]+this.offset.click.top)),i.grid)){var o=this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1];r=this.containment&&(o-this.offset.click.top<this.containment[1]||o-this.offset.click.top>this.containment[3])?o-this.offset.click.top<this.containment[1]?o+i.grid[1]:o-i.grid[1]:o;var l=this.originalPageX+Math.round((a-this.originalPageX)/i.grid[0])*i.grid[0];a=this.containment&&(l-this.offset.click.left<this.containment[0]||l-this.offset.click.left>this.containment[2])?l-this.offset.click.left<this.containment[0]?l+i.grid[0]:l-i.grid[0]:l}return{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"==this.cssPosition?-this.scrollParent.scrollTop():s?0:n.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():s?0:n.scrollLeft())}},_rearrange:function(e,t,i,n){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var s=this.counter;this._delay(function(){s==this.counter&&this.refreshPositions(!n)})},_clear:function(t,i){this.reverting=!1;var n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]==this.currentItem[0]){for(var s in this._storedCSS)("auto"==this._storedCSS[s]||"static"==this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!i&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev==this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent==this.currentItem.parent()[0]||i||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(i||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer))));for(var s=this.containers.length-1;s>=0;s--)i||n.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[s])),this.containers[s].containerCache.over=0);if(this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"==this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!i){this._trigger("beforeStop",t,this._uiHash());for(var s=0;s<n.length;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(i||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null,!i){for(var s=0;s<n.length;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}})}(jQuery),function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.9.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,n){var s=i.attr(n);void 0!==s&&s.length&&(t[n]=s)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?void delete this.cancelBlur:(this._refresh(),void(this.previous!==this.element.val()&&this._trigger("change",e)))},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:void this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,n=e.ui.keyCode;switch(t.keyCode){case n.UP:return this._repeat(null,1,t),!0;case n.DOWN:return this._repeat(null,-1,t),!0;case n.PAGE_UP:return this._repeat(null,i.page,t),!0;case n.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span></a><a class='ui-spinner-button ui-spinner-down ui-corner-br'><span class='ui-icon "+this.options.icons.down+"'>&#9660;</span></a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,n=this.options;return t=null!==n.min?n.min:0,i=e-t,i=Math.round(i/n.step)*n.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==n.max&&e>n.max?n.max:null!==n.min&&e<n.min?n.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,void this.element.val(this._format(i))}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),this._super(e,t),"disabled"===e&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._spin((e||1)*this.options.step)},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._spin((e||1)*-this.options.step)},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?void t(this._value).call(this,e):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(e,t){function i(){return++s}function n(e){return e.hash.length>1&&e.href.replace(a,"")===location.href.replace(a,"").replace(/\s/g,"%20")}var s=0,a=/#.*$/;e.widget("ui.tabs",{version:"1.9.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,i=this.options,n=i.active,s=location.hash.substring(1);this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),null===n&&(s&&this.tabs.each(function(t,i){return e(i).attr("aria-controls")===s?(n=t,!1):void 0}),null===n&&(n=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===n||-1===n)&&(n=this.tabs.length?0:!1)),n!==!1&&(n=this.tabs.index(this.tabs.eq(n)),-1===n&&(n=i.collapsible?!1:0)),i.active=n,!i.collapsible&&i.active===!1&&this.anchors.length&&(i.active=0),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(this.options.active):this.active=e(),this._refresh(),this.active.length&&this.load(i.active)},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),n=this.tabs.index(i),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:n++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:s=!1,n--;break;case e.ui.keyCode.END:n=this.anchors.length-1;break;case e.ui.keyCode.HOME:n=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n);case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n===this.options.active?!1:n);default:return}t.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,s),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function n(){return t>s&&(t=0),0>t&&(t=s),t}for(var s=this.tabs.length-1;-1!==e.inArray(n(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?void this._activate(t):"disabled"===e?void this._setupDisabled(t):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),void("heightStyle"===e&&this._setupHeightStyle(t)))},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var a,r,o,l=e(s).uniqueId().attr("id"),h=e(s).closest("li"),c=h.attr("aria-controls");n(s)?(a=s.hash,r=t.element.find(t._sanitizeSelector(a))):(o=t._tabId(h),a="#"+o,r=t.element.find(a),r.length||(r=t._createPanel(o),r.insertAfter(t.panels[i-1]||t.tablist)),r.attr("aria-live","polite")),r.length&&(t.panels=t.panels.add(r)),c&&h.data("ui-tabs-aria-controls",c),h.attr({"aria-controls":a.substring(1),"aria-labelledby":l}),r.attr("aria-labelledby",l)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,n=0;i=this.tabs[n];n++)t===!0||-1!==e.inArray(n,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,n,s=this.element.parent();"fill"===t?(e.support.minHeight||(n=s.css("overflow"),s.css("overflow","hidden")),i=s.height(),this.element.siblings(":visible").each(function(){var t=e(this),n=t.css("position");"absolute"!==n&&"fixed"!==n&&(i-=t.outerHeight(!0))}),n&&s.css("overflow",n),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,n=this.active,s=e(t.currentTarget),a=s.closest("li"),r=a[0]===n[0],o=r&&i.collapsible,l=o?e():this._getPanelForTab(a),h=n.length?this._getPanelForTab(n):e(),c={oldTab:n,oldPanel:h,newTab:o?e():a,newPanel:l};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||r&&!i.collapsible||this._trigger("beforeActivate",t,c)===!1||(i.active=o?!1:this.tabs.index(a),this.active=r?e():a,this.xhr&&this.xhr.abort(),h.length||l.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(a),t),this._toggle(t,c))},_toggle:function(t,i){function n(){a.running=!1,a._trigger("activate",t,i)}function s(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&a.options.show?a._show(r,a.options.show,n):(r.show(),n())}var a=this,r=i.newPanel,o=i.oldPanel;this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),s()),o.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),r.length&&o.length?i.oldTab.attr("tabIndex",-1):r.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),r.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var i,n=this._findActive(t);n[0]!==this.active[0]&&(n.length||(n=this.active),i=n.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeData("href.tabs").removeData("load.tabs").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var n=this.options.disabled;n!==!1&&(i===t?n=!1:(i=this._getIndex(i),n=e.isArray(n)?e.map(n,function(e){return e!==i?e:null}):e.map(this.tabs,function(e,t){return t!==i?t:null})),this._setupDisabled(n))},disable:function(i){var n=this.options.disabled;if(n!==!0){if(i===t)n=!0;else{if(i=this._getIndex(i),-1!==e.inArray(i,n))return;n=e.isArray(n)?e.merge([i],n).sort():[i]}this._setupDisabled(n)}},load:function(t,i){t=this._getIndex(t);var s=this,a=this.tabs.eq(t),r=a.find(".ui-tabs-anchor"),o=this._getPanelForTab(a),l={tab:a,panel:o};n(r[0])||(this.xhr=e.ajax(this._ajaxSettings(r,i,l)),this.xhr&&"canceled"!==this.xhr.statusText&&(a.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,l)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),a.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,n){var s=this;return{url:t.attr("href"),beforeSend:function(t,a){return s._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},n))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.uiBackCompat!==!1&&(e.ui.tabs.prototype._ui=function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},e.widget("ui.tabs",e.ui.tabs,{url:function(e,t){this.anchors.eq(e).attr("href",t)}}),e.widget("ui.tabs",e.ui.tabs,{options:{ajaxOptions:null,cache:!1},_create:function(){this._super();var t=this;this._on({tabsbeforeload:function(i,n){return e.data(n.tab[0],"cache.tabs")?void i.preventDefault():void n.jqXHR.success(function(){t.options.cache&&e.data(n.tab[0],"cache.tabs",!0)})}})},_ajaxSettings:function(t,i,n){var s=this.options.ajaxOptions;return e.extend({},s,{error:function(e,t){try{s.error(e,t,n.tab.closest("li").index(),n.tab[0])}catch(i){}}},this._superApply(arguments))},_setOption:function(e,t){"cache"===e&&t===!1&&this.anchors.removeData("cache.tabs"),this._super(e,t)},_destroy:function(){this.anchors.removeData("cache.tabs"),this._super()},url:function(e){this.anchors.eq(e).removeData("cache.tabs"),this._superApply(arguments)}}),e.widget("ui.tabs",e.ui.tabs,{abort:function(){this.xhr&&this.xhr.abort()}}),e.widget("ui.tabs",e.ui.tabs,{options:{spinner:"<em>Loading&#8230;</em>"},_create:function(){this._super(),this._on({tabsbeforeload:function(e,t){if(e.target===this.element[0]&&this.options.spinner){var i=t.tab.find("span"),n=i.html();i.html(this.options.spinner),t.jqXHR.complete(function(){i.html(n)})}}})}}),e.widget("ui.tabs",e.ui.tabs,{options:{enable:null,disable:null},enable:function(t){var i,n=this.options;(t&&n.disabled===!0||e.isArray(n.disabled)&&-1!==e.inArray(t,n.disabled))&&(i=!0),this._superApply(arguments),i&&this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t]))},disable:function(t){var i,n=this.options;(t&&n.disabled===!1||e.isArray(n.disabled)&&-1===e.inArray(t,n.disabled))&&(i=!0),this._superApply(arguments),i&&this._trigger("disable",null,this._ui(this.anchors[t],this.panels[t]))}}),e.widget("ui.tabs",e.ui.tabs,{options:{add:null,remove:null,tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},add:function(i,n,s){s===t&&(s=this.anchors.length);var a,r,o=this.options,l=e(o.tabTemplate.replace(/#\{href\}/g,i).replace(/#\{label\}/g,n)),h=i.indexOf("#")?this._tabId(l):i.replace("#","");return l.addClass("ui-state-default ui-corner-top").data("ui-tabs-destroy",!0),l.attr("aria-controls",h),a=s>=this.tabs.length,r=this.element.find("#"+h),r.length||(r=this._createPanel(h),a?s>0?r.insertAfter(this.panels.eq(-1)):r.appendTo(this.element):r.insertBefore(this.panels[s])),r.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide(),a?l.appendTo(this.tablist):l.insertBefore(this.tabs[s]),o.disabled=e.map(o.disabled,function(e){return e>=s?++e:e}),this.refresh(),1===this.tabs.length&&o.active===!1&&this.option("active",0),this._trigger("add",null,this._ui(this.anchors[s],this.panels[s])),this},remove:function(t){t=this._getIndex(t);var i=this.options,n=this.tabs.eq(t).remove(),s=this._getPanelForTab(n).remove();return n.hasClass("ui-tabs-active")&&this.anchors.length>2&&this._activate(t+(t+1<this.anchors.length?1:-1)),i.disabled=e.map(e.grep(i.disabled,function(e){return e!==t}),function(e){return e>=t?--e:e}),this.refresh(),this._trigger("remove",null,this._ui(n.find("a")[0],s[0])),this}}),e.widget("ui.tabs",e.ui.tabs,{length:function(){return this.anchors.length}}),e.widget("ui.tabs",e.ui.tabs,{options:{idPrefix:"ui-tabs-"},_tabId:function(t){var n=t.is("li")?t.find("a[href]"):t;return n=n[0],e(n).closest("li").attr("aria-controls")||n.title&&n.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF\-]/g,"")||this.options.idPrefix+i()}}),e.widget("ui.tabs",e.ui.tabs,{options:{panelTemplate:"<div></div>"},_createPanel:function(t){return e(this.options.panelTemplate).attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)}}),e.widget("ui.tabs",e.ui.tabs,{_create:function(){var e=this.options;null===e.active&&e.selected!==t&&(e.active=-1===e.selected?!1:e.selected),this._super(),e.selected=e.active,e.selected===!1&&(e.selected=-1)},_setOption:function(e,t){if("selected"!==e)return this._super(e,t);var i=this.options;this._super("active",-1===t?!1:t),i.selected=i.active,i.selected===!1&&(i.selected=-1)},_eventHandler:function(){this._superApply(arguments),this.options.selected=this.options.active,this.options.selected===!1&&(this.options.selected=-1);
}}),e.widget("ui.tabs",e.ui.tabs,{options:{show:null,select:null},_create:function(){this._super(),this.options.active!==!1&&this._trigger("show",null,this._ui(this.active.find(".ui-tabs-anchor")[0],this._getPanelForTab(this.active)[0]))},_trigger:function(e,t,i){var n,s,a=this._superApply(arguments);return a?("beforeActivate"===e?(n=i.newTab.length?i.newTab:i.oldTab,s=i.newPanel.length?i.newPanel:i.oldPanel,a=this._super("select",t,{tab:n.find(".ui-tabs-anchor")[0],panel:s[0],index:n.closest("li").index()})):"activate"===e&&i.newTab.length&&(a=this._super("show",t,{tab:i.newTab.find(".ui-tabs-anchor")[0],panel:i.newPanel[0],index:i.newTab.closest("li").index()})),a):!1}}),e.widget("ui.tabs",e.ui.tabs,{select:function(e){if(e=this._getIndex(e),-1===e){if(!this.options.collapsible||-1===this.options.selected)return;e=this.options.selected}this.anchors.eq(e).trigger(this.options.event+this.eventNamespace)}}),function(){var t=0;e.widget("ui.tabs",e.ui.tabs,{options:{cookie:null},_create:function(){var e,t=this.options;null==t.active&&t.cookie&&(e=parseInt(this._cookie(),10),-1===e&&(e=!1),t.active=e),this._super()},_cookie:function(i){var n=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++t)];return arguments.length&&(n.push(i===!1?-1:i),n.push(this.options.cookie)),e.cookie.apply(null,n)},_refresh:function(){this._super(),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_eventHandler:function(){this._superApply(arguments),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super(),this.options.cookie&&this._cookie(null,this.options.cookie)}})}(),e.widget("ui.tabs",e.ui.tabs,{_trigger:function(t,i,n){var s=e.extend({},n);return"load"===t&&(s.panel=s.panel[0],s.tab=s.tab.find(".ui-tabs-anchor")[0]),this._super(t,i,s)}}),e.widget("ui.tabs",e.ui.tabs,{options:{fx:null},_getFx:function(){var t,i,n=this.options.fx;return n&&(e.isArray(n)?(t=n[0],i=n[1]):t=i=n),n?{show:i,hide:t}:null},_toggle:function(e,t){function i(){s.running=!1,s._trigger("activate",e,t)}function n(){t.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),a.length&&o.show?a.animate(o.show,o.show.duration,function(){i()}):(a.show(),i())}var s=this,a=t.newPanel,r=t.oldPanel,o=this._getFx();return o?(s.running=!0,void(r.length&&o.hide?r.animate(o.hide,o.hide.duration,function(){t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()))):this._super(e,t)}}))}(jQuery),function(e){function t(t,i){var n=(t.attr("aria-describedby")||"").split(/\s+/);n.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(n.join(" ")))}function i(t){var i=t.data("ui-tooltip-id"),n=(t.attr("aria-describedby")||"").split(/\s+/),s=e.inArray(i,n);-1!==s&&n.splice(s,1),t.removeData("ui-tooltip-id"),n=e.trim(n.join(" ")),n?t.attr("aria-describedby",n):t.removeAttr("aria-describedby")}var n=0;e.widget("ui.tooltip",{version:"1.9.2",options:{content:function(){return e(this).attr("title")},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,i){var n=this;return"disabled"===t?(this[i?"_disable":"_enable"](),void(this.options[t]=i)):(this._super(t,i),void("content"===t&&e.each(this.tooltips,function(e,t){n._updateContent(t)})))},_disable:function(){var t=this;e.each(this.tooltips,function(i,n){var s=e.Event("blur");s.target=s.currentTarget=n[0],t.close(s,!0)}),this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,n=e(t?t.target:this.element).closest(this.options.items);n.length&&!n.data("ui-tooltip-id")&&(n.attr("title")&&n.data("ui-tooltip-title",n.attr("title")),n.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&n.parents().each(function(){var t,n=e(this);n.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),n.attr("title")&&(n.uniqueId(),i.parents[this.id]={element:this,title:n.attr("title")},n.attr("title",""))}),this._updateContent(n,t))},_updateContent:function(e,t){var i,n=this.options.content,s=this,a=t?t.type:null;return"string"==typeof n?this._open(t,e,n):(i=n.call(e[0],function(i){e.data("ui-tooltip-open")&&s._delay(function(){t&&(t.type=a),this._open(t,e,i)})}),void(i&&this._open(t,e,i)))},_open:function(i,n,s){function a(e){h.of=e,r.is(":hidden")||r.position(h)}var r,o,l,h=e.extend({},this.options.position);if(s){if(r=this._find(n),r.length)return void r.find(".ui-tooltip-content").html(s);n.is("[title]")&&(i&&"mouseover"===i.type?n.attr("title",""):n.removeAttr("title")),r=this._tooltip(n),t(n,r.attr("id")),r.find(".ui-tooltip-content").html(s),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:a}),a(i)):r.position(e.extend({of:n},this.options.position)),r.hide(),this._show(r,this.options.show),this.options.show&&this.options.show.delay&&(l=setInterval(function(){r.is(":visible")&&(a(h.of),clearInterval(l))},e.fx.interval)),this._trigger("open",i,{tooltip:r}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var i=e.Event(t);i.currentTarget=n[0],this.close(i,!0)}},remove:function(){this._removeTooltip(r)}},i&&"mouseover"!==i.type||(o.mouseleave="close"),i&&"focusin"!==i.type||(o.focusout="close"),this._on(!0,n,o)}},close:function(t){var n=this,s=e(t?t.currentTarget:this.element),a=this._find(s);this.closing||(s.data("ui-tooltip-title")&&s.attr("title",s.data("ui-tooltip-title")),i(s),a.stop(!0),this._hide(a,this.options.hide,function(){n._removeTooltip(e(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:a}),this.closing=!1)},_tooltip:function(t){var i="ui-tooltip-"+n++,s=e("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(s),s.appendTo(this.document[0].body),e.fn.bgiframe&&s.bgiframe(),this.tooltips[i]=t,s},_find:function(t){var i=t.data("ui-tooltip-id");return i?e("#"+i):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,n){var s=e.Event("blur");s.target=s.currentTarget=n[0],t.close(s,!0),e("#"+i).remove(),n.data("ui-tooltip-title")&&(n.attr("title",n.data("ui-tooltip-title")),n.removeData("ui-tooltip-title"))})}})}(jQuery)},{}],25:[function(e,t,i){!function(e,t){function i(e){var t,i,n=F[e]={};for(e=e.split(/\s+/),t=0,i=e.length;i>t;t++)n[e[t]]=!0;return n}function n(e,i,n){if(n===t&&1===e.nodeType){var s="data-"+i.replace(z,"-$1").toLowerCase();if(n=e.getAttribute(s),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:H.isNumeric(n)?+n:O.test(n)?H.parseJSON(n):n}catch(a){}H.data(e,i,n)}else n=t}return n}function s(e){for(var t in e)if(("data"!==t||!H.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function a(e,t,i){var n=t+"defer",s=t+"queue",a=t+"mark",r=H._data(e,n);!r||"queue"!==i&&H._data(e,s)||"mark"!==i&&H._data(e,a)||setTimeout(function(){H._data(e,s)||H._data(e,a)||(H.removeData(e,n,!0),r.fire())},0)}function r(){return!1}function o(){return!0}function l(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function h(e,t,i){if(t=t||0,H.isFunction(t))return H.grep(e,function(e,n){var s=!!t.call(e,n,e);return s===i});if(t.nodeType)return H.grep(e,function(e,n){return e===t===i});if("string"==typeof t){var n=H.grep(e,function(e){return 1===e.nodeType});if(ce.test(t))return H.filter(t,n,!i);t=H.filter(t,n)}return H.grep(e,function(e,n){return H.inArray(e,t)>=0===i})}function c(e){var t=fe.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());return i}function d(e,t){return H.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function u(e,t){if(1===t.nodeType&&H.hasData(e)){var i,n,s,a=H._data(e),r=H._data(t,a),o=a.events;if(o){delete r.handle,r.events={};for(i in o)for(n=0,s=o[i].length;s>n;n++)H.event.add(t,i,o[i][n])}r.data&&(r.data=H.extend({},r.data))}}function p(e,t){var i;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),i=t.nodeName.toLowerCase(),"object"===i?t.outerHTML=e.outerHTML:"input"!==i||"checkbox"!==e.type&&"radio"!==e.type?"option"===i?t.selected=e.defaultSelected:"input"===i||"textarea"===i?t.defaultValue=e.defaultValue:"script"===i&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(H.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached"))}function f(e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName("*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll("*"):[]}function g(e){("checkbox"===e.type||"radio"===e.type)&&(e.defaultChecked=e.checked)}function m(e){var t=(e.nodeName||"").toLowerCase();"input"===t?g(e):"script"!==t&&"undefined"!=typeof e.getElementsByTagName&&H.grep(e.getElementsByTagName("input"),g)}function v(e){var t=N.createElement("div");return De.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function _(e,t,i){var n="width"===t?e.offsetWidth:e.offsetHeight,s="width"===t?1:0,a=4;if(n>0){if("border"!==i)for(;a>s;s+=2)i||(n-=parseFloat(H.css(e,"padding"+$e[s]))||0),"margin"===i?n+=parseFloat(H.css(e,i+$e[s]))||0:n-=parseFloat(H.css(e,"border"+$e[s]+"Width"))||0;return n+"px"}if(n=Ie(e,t),(0>n||null==n)&&(n=e.style[t]),Fe.test(n))return n;if(n=parseFloat(n)||0,i)for(;a>s;s+=2)n+=parseFloat(H.css(e,"padding"+$e[s]))||0,"padding"!==i&&(n+=parseFloat(H.css(e,"border"+$e[s]+"Width"))||0),"margin"===i&&(n+=parseFloat(H.css(e,i+$e[s]))||0);return n+"px"}function y(e){return function(t,i){if("string"!=typeof t&&(i=t,t="*"),H.isFunction(i))for(var n,s,a,r=t.toLowerCase().split(tt),o=0,l=r.length;l>o;o++)n=r[o],a=/^\+/.test(n),a&&(n=n.substr(1)||"*"),s=e[n]=e[n]||[],s[a?"unshift":"push"](i)}}function b(e,i,n,s,a,r){a=a||i.dataTypes[0],r=r||{},r[a]=!0;for(var o,l=e[a],h=0,c=l?l.length:0,d=e===at;c>h&&(d||!o);h++)o=l[h](i,n,s),"string"==typeof o&&(!d||r[o]?o=t:(i.dataTypes.unshift(o),o=b(e,i,n,s,o,r)));return!d&&o||r["*"]||(o=b(e,i,n,s,"*",r)),o}function x(e,i){var n,s,a=H.ajaxSettings.flatOptions||{};for(n in i)i[n]!==t&&((a[n]?e:s||(s={}))[n]=i[n]);s&&H.extend(!0,e,s)}function w(e,t,i,n){if(H.isArray(t))H.each(t,function(t,s){i||Be.test(e)?n(e,s):w(e+"["+("object"==typeof s?t:"")+"]",s,i,n)});else if(i||"object"!==H.type(t))n(e,t);else for(var s in t)w(e+"["+s+"]",t[s],i,n)}function k(e,i,n){var s,a,r,o,l=e.contents,h=e.dataTypes,c=e.responseFields;for(a in c)a in n&&(i[c[a]]=n[a]);for(;"*"===h[0];)h.shift(),s===t&&(s=e.mimeType||i.getResponseHeader("content-type"));if(s)for(a in l)if(l[a]&&l[a].test(s)){h.unshift(a);break}if(h[0]in n)r=h[0];else{for(a in n){if(!h[0]||e.converters[a+" "+h[0]]){r=a;break}o||(o=a)}r=r||o}return r?(r!==h[0]&&h.unshift(r),n[r]):void 0}function j(e,i){e.dataFilter&&(i=e.dataFilter(i,e.dataType));var n,s,a,r,o,l,h,c,d=e.dataTypes,u={},p=d.length,f=d[0];for(n=1;p>n;n++){if(1===n)for(s in e.converters)"string"==typeof s&&(u[s.toLowerCase()]=e.converters[s]);if(r=f,f=d[n],"*"===f)f=r;else if("*"!==r&&r!==f){if(o=r+" "+f,l=u[o]||u["* "+f],!l){c=t;for(h in u)if(a=h.split(" "),(a[0]===r||"*"===a[0])&&(c=u[a[1]+" "+f])){h=u[h],h===!0?l=c:c===!0&&(l=h);break}}l||c||H.error("No conversion from "+o.replace(" "," to ")),l!==!0&&(i=l?l(i):c(h(i)))}}return i}function C(){try{return new e.XMLHttpRequest}catch(t){}}function T(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function S(){return setTimeout(D,0),vt=H.now()}function D(){vt=t}function I(e,t){var i={};return H.each(xt.concat.apply([],xt.slice(0,t)),function(){i[this]=e}),i}function A(e){if(!_t[e]){var t=N.body,i=H("<"+e+">").appendTo(t),n=i.css("display");i.remove(),("none"===n||""===n)&&(ft||(ft=N.createElement("iframe"),ft.frameBorder=ft.width=ft.height=0),t.appendChild(ft),gt&&ft.createElement||(gt=(ft.contentWindow||ft.contentDocument).document,gt.write((H.support.boxModel?"<!doctype html>":"")+"<html><body>"),gt.close()),i=gt.createElement(e),gt.body.appendChild(i),n=H.css(i,"display"),t.removeChild(ft)),_t[e]=n}return _t[e]}function E(e){return H.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var N=e.document,M=e.navigator,P=e.location,H=function(){function i(){if(!o.isReady){try{N.documentElement.doScroll("left")}catch(e){return void setTimeout(i,1)}o.ready()}}var n,s,a,r,o=function(e,t){return new o.fn.init(e,t,n)},l=e.jQuery,h=e.$,c=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,d=/\S/,u=/^\s+/,p=/\s+$/,f=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,g=/^[\],:{}\s]*$/,m=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,v=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,_=/(?:^|:|,)(?:\s*\[)+/g,y=/(webkit)[ \/]([\w.]+)/,b=/(opera)(?:.*version)?[ \/]([\w.]+)/,x=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,k=/-([a-z]|[0-9])/gi,j=/^-ms-/,C=function(e,t){return(t+"").toUpperCase()},T=M.userAgent,S=Object.prototype.toString,D=Object.prototype.hasOwnProperty,I=Array.prototype.push,A=Array.prototype.slice,E=String.prototype.trim,P=Array.prototype.indexOf,H={};return o.fn=o.prototype={constructor:o,init:function(e,i,n){var s,a,r,l;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("body"===e&&!i&&N.body)return this.context=N,this[0]=N.body,this.selector=e,this.length=1,this;if("string"==typeof e){if(s="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:c.exec(e),!s||!s[1]&&i)return!i||i.jquery?(i||n).find(e):this.constructor(i).find(e);if(s[1])return i=i instanceof o?i[0]:i,l=i?i.ownerDocument||i:N,r=f.exec(e),r?o.isPlainObject(i)?(e=[N.createElement(r[1])],o.fn.attr.call(e,i,!0)):e=[l.createElement(r[1])]:(r=o.buildFragment([s[1]],[l]),e=(r.cacheable?o.clone(r.fragment):r.fragment).childNodes),o.merge(this,e);if(a=N.getElementById(s[2]),a&&a.parentNode){if(a.id!==s[2])return n.find(e);this.length=1,this[0]=a}return this.context=N,this.selector=e,this}return o.isFunction(e)?n.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),o.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return A.call(this,0)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,i){var n=this.constructor();return o.isArray(e)?I.apply(n,e):o.merge(n,e),n.prevObject=this,n.context=this.context,"find"===t?n.selector=this.selector+(this.selector?" ":"")+i:t&&(n.selector=this.selector+"."+t+"("+i+")"),n},each:function(e,t){return o.each(this,e,t)},ready:function(e){return o.bindReady(),a.add(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(A.apply(this,arguments),"slice",A.call(arguments).join(","))},map:function(e){return this.pushStack(o.map(this,function(t,i){return e.call(t,i,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:I,sort:[].sort,splice:[].splice},o.fn.init.prototype=o.fn,o.extend=o.fn.extend=function(){var e,i,n,s,a,r,l=arguments[0]||{},h=1,c=arguments.length,d=!1;for("boolean"==typeof l&&(d=l,l=arguments[1]||{},h=2),"object"==typeof l||o.isFunction(l)||(l={}),c===h&&(l=this,--h);c>h;h++)if(null!=(e=arguments[h]))for(i in e)n=l[i],s=e[i],l!==s&&(d&&s&&(o.isPlainObject(s)||(a=o.isArray(s)))?(a?(a=!1,r=n&&o.isArray(n)?n:[]):r=n&&o.isPlainObject(n)?n:{},l[i]=o.extend(d,r,s)):s!==t&&(l[i]=s));return l},o.extend({noConflict:function(t){return e.$===o&&(e.$=h),t&&e.jQuery===o&&(e.jQuery=l),o},isReady:!1,readyWait:1,holdReady:function(e){e?o.readyWait++:o.ready(!0)},ready:function(e){if(e===!0&&!--o.readyWait||e!==!0&&!o.isReady){if(!N.body)return setTimeout(o.ready,1);if(o.isReady=!0,e!==!0&&--o.readyWait>0)return;a.fireWith(N,[o]),o.fn.trigger&&o(N).trigger("ready").off("ready")}},bindReady:function(){if(!a){if(a=o.Callbacks("once memory"),"complete"===N.readyState)return setTimeout(o.ready,1);if(N.addEventListener)N.addEventListener("DOMContentLoaded",r,!1),e.addEventListener("load",o.ready,!1);else if(N.attachEvent){N.attachEvent("onreadystatechange",r),e.attachEvent("onload",o.ready);var t=!1;try{t=null==e.frameElement}catch(n){}N.documentElement.doScroll&&t&&i()}}},isFunction:function(e){return"function"===o.type(e)},isArray:Array.isArray||function(e){return"array"===o.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):H[S.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==o.type(e)||e.nodeType||o.isWindow(e))return!1;try{if(e.constructor&&!D.call(e,"constructor")&&!D.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(i){return!1}var n;for(n in e);return n===t||D.call(e,n)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw new Error(e)},parseJSON:function(t){return"string"==typeof t&&t?(t=o.trim(t),e.JSON&&e.JSON.parse?e.JSON.parse(t):g.test(t.replace(m,"@").replace(v,"]").replace(_,""))?new Function("return "+t)():void o.error("Invalid JSON: "+t)):null},parseXML:function(i){if("string"!=typeof i||!i)return null;var n,s;try{e.DOMParser?(s=new DOMParser,n=s.parseFromString(i,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(i))}catch(a){n=t}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||o.error("Invalid XML: "+i),n},noop:function(){},globalEval:function(t){t&&d.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(k,C)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,i,n){var s,a=0,r=e.length,l=r===t||o.isFunction(e);if(n)if(l){for(s in e)if(i.apply(e[s],n)===!1)break}else for(;r>a&&i.apply(e[a++],n)!==!1;);else if(l){for(s in e)if(i.call(e[s],s,e[s])===!1)break}else for(;r>a&&i.call(e[a],a,e[a++])!==!1;);return e},trim:E?function(e){return null==e?"":E.call(e)}:function(e){return null==e?"":e.toString().replace(u,"").replace(p,"")},makeArray:function(e,t){var i=t||[];if(null!=e){var n=o.type(e);null==e.length||"string"===n||"function"===n||"regexp"===n||o.isWindow(e)?I.call(i,e):o.merge(i,e)}return i},inArray:function(e,t,i){var n;if(t){if(P)return P.call(t,e,i);for(n=t.length,i=i?0>i?Math.max(0,n+i):i:0;n>i;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,i){var n=e.length,s=0;if("number"==typeof i.length)for(var a=i.length;a>s;s++)e[n++]=i[s];else for(;i[s]!==t;)e[n++]=i[s++];return e.length=n,e},grep:function(e,t,i){var n,s=[];i=!!i;for(var a=0,r=e.length;r>a;a++)n=!!t(e[a],a),i!==n&&s.push(e[a]);return s},map:function(e,i,n){var s,a,r=[],l=0,h=e.length,c=e instanceof o||h!==t&&"number"==typeof h&&(h>0&&e[0]&&e[h-1]||0===h||o.isArray(e));if(c)for(;h>l;l++)s=i(e[l],l,n),null!=s&&(r[r.length]=s);else for(a in e)s=i(e[a],a,n),null!=s&&(r[r.length]=s);return r.concat.apply([],r)},guid:1,proxy:function(e,i){if("string"==typeof i){var n=e[i];i=e,e=n}if(!o.isFunction(e))return t;var s=A.call(arguments,2),a=function(){return e.apply(i,s.concat(A.call(arguments)))};return a.guid=e.guid=e.guid||a.guid||o.guid++,a},access:function(e,i,n,s,a,r,l){var h,c=null==n,d=0,u=e.length;if(n&&"object"==typeof n){for(d in n)o.access(e,i,d,n[d],1,r,s);a=1}else if(s!==t){if(h=l===t&&o.isFunction(s),c&&(h?(h=i,i=function(e,t,i){return h.call(o(e),i)}):(i.call(e,s),i=null)),i)for(;u>d;d++)i(e[d],n,h?s.call(e[d],d,i(e[d],n)):s,l);a=1}return a?e:c?i.call(e):u?i(e[0],n):r},now:function(){return(new Date).getTime()},uaMatch:function(e){e=e.toLowerCase();var t=y.exec(e)||b.exec(e)||x.exec(e)||e.indexOf("compatible")<0&&w.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},sub:function(){function e(t,i){return new e.fn.init(t,i)}o.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(i,n){return n&&n instanceof o&&!(n instanceof e)&&(n=e(n)),o.fn.init.call(this,i,n,t)},e.fn.init.prototype=e.fn;var t=e(N);return e},browser:{}}),o.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){H["[object "+t+"]"]=t.toLowerCase()}),s=o.uaMatch(T),s.browser&&(o.browser[s.browser]=!0,o.browser.version=s.version),o.browser.webkit&&(o.browser.safari=!0),d.test(" ")&&(u=/^[\s\xA0]+/,p=/[\s\xA0]+$/),n=o(N),N.addEventListener?r=function(){N.removeEventListener("DOMContentLoaded",r,!1),o.ready()}:N.attachEvent&&(r=function(){"complete"===N.readyState&&(N.detachEvent("onreadystatechange",r),o.ready())}),o}(),F={};H.Callbacks=function(e){e=e?F[e]||i(e):{};var n,s,a,r,o,l,h=[],c=[],d=function(t){var i,n,s,a;for(i=0,n=t.length;n>i;i++)s=t[i],a=H.type(s),"array"===a?d(s):"function"===a&&(e.unique&&p.has(s)||h.push(s))},u=function(t,i){for(i=i||[],n=!e.memory||[t,i],s=!0,a=!0,l=r||0,r=0,o=h.length;h&&o>l;l++)if(h[l].apply(t,i)===!1&&e.stopOnFalse){n=!0;break}a=!1,h&&(e.once?n===!0?p.disable():h=[]:c&&c.length&&(n=c.shift(),p.fireWith(n[0],n[1])))},p={add:function(){if(h){var e=h.length;d(arguments),a?o=h.length:n&&n!==!0&&(r=e,u(n[0],n[1]))}return this},remove:function(){if(h)for(var t=arguments,i=0,n=t.length;n>i;i++)for(var s=0;s<h.length&&(t[i]!==h[s]||(a&&o>=s&&(o--,l>=s&&l--),h.splice(s--,1),!e.unique));s++);return this},has:function(e){if(h)for(var t=0,i=h.length;i>t;t++)if(e===h[t])return!0;return!1},empty:function(){return h=[],this},disable:function(){return h=c=n=t,this},disabled:function(){return!h},lock:function(){return c=t,n&&n!==!0||p.disable(),this},locked:function(){return!c},fireWith:function(t,i){return c&&(a?e.once||c.push([t,i]):e.once&&n||u(t,i)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!s}};return p};var L=[].slice;H.extend({Deferred:function(e){var t,i=H.Callbacks("once memory"),n=H.Callbacks("once memory"),s=H.Callbacks("memory"),a="pending",r={resolve:i,reject:n,notify:s},o={done:i.add,fail:n.add,progress:s.add,state:function(){return a},isResolved:i.fired,isRejected:n.fired,then:function(e,t,i){return l.done(e).fail(t).progress(i),this},always:function(){return l.done.apply(l,arguments).fail.apply(l,arguments),this},pipe:function(e,t,i){return H.Deferred(function(n){H.each({done:[e,"resolve"],fail:[t,"reject"],progress:[i,"notify"]},function(e,t){var i,s=t[0],a=t[1];H.isFunction(s)?l[e](function(){i=s.apply(this,arguments),i&&H.isFunction(i.promise)?i.promise().then(n.resolve,n.reject,n.notify):n[a+"With"](this===l?n:this,[i])}):l[e](n[a])})}).promise()},promise:function(e){if(null==e)e=o;else for(var t in o)e[t]=o[t];return e}},l=o.promise({});for(t in r)l[t]=r[t].fire,l[t+"With"]=r[t].fireWith;return l.done(function(){a="resolved"},n.disable,s.lock).fail(function(){a="rejected"},i.disable,s.lock),e&&e.call(l,l),l},when:function(e){function t(e){return function(t){n[e]=arguments.length>1?L.call(arguments,0):t,--o||l.resolveWith(l,n)}}function i(e){return function(t){r[e]=arguments.length>1?L.call(arguments,0):t,l.notifyWith(h,r)}}var n=L.call(arguments,0),s=0,a=n.length,r=new Array(a),o=a,l=1>=a&&e&&H.isFunction(e.promise)?e:H.Deferred(),h=l.promise();if(a>1){for(;a>s;s++)n[s]&&n[s].promise&&H.isFunction(n[s].promise)?n[s].promise().then(t(s),l.reject,i(s)):--o;o||l.resolveWith(l,n)}else l!==e&&l.resolveWith(l,a?[e]:[]);return h}}),H.support=function(){var t,i,n,s,a,r,o,l,h,c,d,u=N.createElement("div");N.documentElement;if(u.setAttribute("className","t"),u.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",i=u.getElementsByTagName("*"),n=u.getElementsByTagName("a")[0],!i||!i.length||!n)return{};s=N.createElement("select"),a=s.appendChild(N.createElement("option")),r=u.getElementsByTagName("input")[0],t={leadingWhitespace:3===u.firstChild.nodeType,tbody:!u.getElementsByTagName("tbody").length,htmlSerialize:!!u.getElementsByTagName("link").length,style:/top/.test(n.getAttribute("style")),hrefNormalized:"/a"===n.getAttribute("href"),opacity:/^0.55/.test(n.style.opacity),cssFloat:!!n.style.cssFloat,checkOn:"on"===r.value,optSelected:a.selected,getSetAttribute:"t"!==u.className,enctype:!!N.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==N.createElement("nav").cloneNode(!0).outerHTML,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},H.boxModel=t.boxModel="CSS1Compat"===N.compatMode,r.checked=!0,t.noCloneChecked=r.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!a.disabled;try{delete u.test}catch(p){t.deleteExpando=!1}if(!u.addEventListener&&u.attachEvent&&u.fireEvent&&(u.attachEvent("onclick",function(){t.noCloneEvent=!1}),u.cloneNode(!0).fireEvent("onclick")),r=N.createElement("input"),r.value="t",r.setAttribute("type","radio"),t.radioValue="t"===r.value,r.setAttribute("checked","checked"),r.setAttribute("name","t"),u.appendChild(r),o=N.createDocumentFragment(),o.appendChild(u.lastChild),t.checkClone=o.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=r.checked,o.removeChild(r),o.appendChild(u),u.attachEvent)for(c in{submit:1,change:1,focusin:1})h="on"+c,d=h in u,d||(u.setAttribute(h,"return;"),d="function"==typeof u[h]),t[c+"Bubbles"]=d;return o.removeChild(u),o=s=a=u=r=null,H(function(){var i,n,s,a,r,o,h,c,p,f,g,m,v=N.getElementsByTagName("body")[0];v&&(h=1,m="padding:0;margin:0;border:",f="position:absolute;top:0;left:0;width:1px;height:1px;",g=m+"0;visibility:hidden;",c="style='"+f+m+"5px solid #000;",p="<div "+c+"display:block;'><div style='"+m+"0;display:block;overflow:hidden;'></div></div><table "+c+"' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>",i=N.createElement("div"),i.style.cssText=g+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",v.insertBefore(i,v.firstChild),u=N.createElement("div"),i.appendChild(u),u.innerHTML="<table><tr><td style='"+m+"0;display:none'></td><td>t</td></tr></table>",l=u.getElementsByTagName("td"),d=0===l[0].offsetHeight,l[0].style.display="",l[1].style.display="none",t.reliableHiddenOffsets=d&&0===l[0].offsetHeight,e.getComputedStyle&&(u.innerHTML="",o=N.createElement("div"),o.style.width="0",o.style.marginRight="0",u.style.width="2px",u.appendChild(o),t.reliableMarginRight=0===(parseInt((e.getComputedStyle(o,null)||{marginRight:0}).marginRight,10)||0)),"undefined"!=typeof u.style.zoom&&(u.innerHTML="",u.style.width=u.style.padding="1px",u.style.border=0,u.style.overflow="hidden",u.style.display="inline",u.style.zoom=1,t.inlineBlockNeedsLayout=3===u.offsetWidth,u.style.display="block",u.style.overflow="visible",u.innerHTML="<div style='width:5px;'></div>",t.shrinkWrapBlocks=3!==u.offsetWidth),u.style.cssText=f+g,u.innerHTML=p,n=u.firstChild,s=n.firstChild,a=n.nextSibling.firstChild.firstChild,r={doesNotAddBorder:5!==s.offsetTop,doesAddBorderForTableAndCells:5===a.offsetTop},s.style.position="fixed",s.style.top="20px",r.fixedPosition=20===s.offsetTop||15===s.offsetTop,s.style.position=s.style.top="",n.style.overflow="hidden",n.style.position="relative",r.subtractsBorderForOverflowNotVisible=-5===s.offsetTop,r.doesNotIncludeMarginInBodyOffset=v.offsetTop!==h,e.getComputedStyle&&(u.style.marginTop="1%",t.pixelMargin="1%"!==(e.getComputedStyle(u,null)||{marginTop:0}).marginTop),"undefined"!=typeof i.style.zoom&&(i.style.zoom=1),v.removeChild(i),o=u=i=null,H.extend(t,r))}),t}();var O=/^(?:\{.*\}|\[.*\])$/,z=/([A-Z])/g;H.extend({cache:{},uuid:0,expando:"jQuery"+(H.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?H.cache[e[H.expando]]:e[H.expando],!!e&&!s(e)},data:function(e,i,n,s){if(H.acceptData(e)){var a,r,o,l=H.expando,h="string"==typeof i,c=e.nodeType,d=c?H.cache:e,u=c?e[l]:e[l]&&l,p="events"===i;if(u&&d[u]&&(p||s||d[u].data)||!h||n!==t)return u||(c?e[l]=u=++H.uuid:u=l),d[u]||(d[u]={},c||(d[u].toJSON=H.noop)),("object"==typeof i||"function"==typeof i)&&(s?d[u]=H.extend(d[u],i):d[u].data=H.extend(d[u].data,i)),a=r=d[u],s||(r.data||(r.data={}),r=r.data),n!==t&&(r[H.camelCase(i)]=n),p&&!r[i]?a.events:(h?(o=r[i],null==o&&(o=r[H.camelCase(i)])):o=r,o)}},removeData:function(e,t,i){if(H.acceptData(e)){var n,a,r,o=H.expando,l=e.nodeType,h=l?H.cache:e,c=l?e[o]:o;if(h[c]){if(t&&(n=i?h[c]:h[c].data)){H.isArray(t)||(t in n?t=[t]:(t=H.camelCase(t),t=t in n?[t]:t.split(" ")));for(a=0,r=t.length;r>a;a++)delete n[t[a]];if(!(i?s:H.isEmptyObject)(n))return}(i||(delete h[c].data,s(h[c])))&&(H.support.deleteExpando||!h.setInterval?delete h[c]:h[c]=null,l&&(H.support.deleteExpando?delete e[o]:e.removeAttribute?e.removeAttribute(o):e[o]=null))}}},_data:function(e,t,i){return H.data(e,t,i,!0)},acceptData:function(e){if(e.nodeName){var t=H.noData[e.nodeName.toLowerCase()];if(t)return!(t===!0||e.getAttribute("classid")!==t)}return!0}}),H.fn.extend({data:function(e,i){var s,a,r,o,l,h=this[0],c=0,d=null;if(e===t){if(this.length&&(d=H.data(h),1===h.nodeType&&!H._data(h,"parsedAttrs"))){for(r=h.attributes,l=r.length;l>c;c++)o=r[c].name,0===o.indexOf("data-")&&(o=H.camelCase(o.substring(5)),n(h,o,d[o]));H._data(h,"parsedAttrs",!0)}return d}return"object"==typeof e?this.each(function(){H.data(this,e)}):(s=e.split(".",2),s[1]=s[1]?"."+s[1]:"",a=s[1]+"!",H.access(this,function(i){return i===t?(d=this.triggerHandler("getData"+a,[s[0]]),d===t&&h&&(d=H.data(h,e),d=n(h,e,d)),d===t&&s[1]?this.data(s[0]):d):(s[1]=i,void this.each(function(){var t=H(this);t.triggerHandler("setData"+a,s),H.data(this,e,i),t.triggerHandler("changeData"+a,s)}))},null,i,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){H.removeData(this,e)})}}),H.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",H._data(e,t,(H._data(e,t)||0)+1))},_unmark:function(e,t,i){if(e!==!0&&(i=t,t=e,e=!1),t){i=i||"fx";var n=i+"mark",s=e?0:(H._data(t,n)||1)-1;s?H._data(t,n,s):(H.removeData(t,n,!0),a(t,i,"mark"))}},queue:function(e,t,i){var n;return e?(t=(t||"fx")+"queue",n=H._data(e,t),i&&(!n||H.isArray(i)?n=H._data(e,t,H.makeArray(i)):n.push(i)),n||[]):void 0},dequeue:function(e,t){t=t||"fx";var i=H.queue(e,t),n=i.shift(),s={};"inprogress"===n&&(n=i.shift()),n&&("fx"===t&&i.unshift("inprogress"),H._data(e,t+".run",s),n.call(e,function(){H.dequeue(e,t)},s)),i.length||(H.removeData(e,t+"queue "+t+".run",!0),a(e,t,"queue"))}}),H.fn.extend({queue:function(e,i){var n=2;return"string"!=typeof e&&(i=e,e="fx",n--),arguments.length<n?H.queue(this[0],e):i===t?this:this.each(function(){var t=H.queue(this,e,i);"fx"===e&&"inprogress"!==t[0]&&H.dequeue(this,e)})},dequeue:function(e){return this.each(function(){H.dequeue(this,e)})},delay:function(e,t){return e=H.fx?H.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var n=setTimeout(t,e);i.stop=function(){clearTimeout(n)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,i){function n(){--l||a.resolveWith(r,[r])}"string"!=typeof e&&(i=e,e=t),e=e||"fx";for(var s,a=H.Deferred(),r=this,o=r.length,l=1,h=e+"defer",c=e+"queue",d=e+"mark";o--;)(s=H.data(r[o],h,t,!0)||(H.data(r[o],c,t,!0)||H.data(r[o],d,t,!0))&&H.data(r[o],h,H.Callbacks("once memory"),!0))&&(l++,
s.add(n));return n(),a.promise(i)}});var $,R,W,q=/[\n\t\r]/g,B=/\s+/,U=/\r/g,Q=/^(?:button|input)$/i,V=/^(?:button|input|object|select|textarea)$/i,Y=/^a(?:rea)?$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,K=H.support.getSetAttribute;H.fn.extend({attr:function(e,t){return H.access(this,H.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){H.removeAttr(this,e)})},prop:function(e,t){return H.access(this,H.prop,e,t,arguments.length>1)},removeProp:function(e){return e=H.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(i){}})},addClass:function(e){var t,i,n,s,a,r,o;if(H.isFunction(e))return this.each(function(t){H(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(B),i=0,n=this.length;n>i;i++)if(s=this[i],1===s.nodeType)if(s.className||1!==t.length){for(a=" "+s.className+" ",r=0,o=t.length;o>r;r++)~a.indexOf(" "+t[r]+" ")||(a+=t[r]+" ");s.className=H.trim(a)}else s.className=e;return this},removeClass:function(e){var i,n,s,a,r,o,l;if(H.isFunction(e))return this.each(function(t){H(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(i=(e||"").split(B),n=0,s=this.length;s>n;n++)if(a=this[n],1===a.nodeType&&a.className)if(e){for(r=(" "+a.className+" ").replace(q," "),o=0,l=i.length;l>o;o++)r=r.replace(" "+i[o]+" "," ");a.className=H.trim(r)}else a.className="";return this},toggleClass:function(e,t){var i=typeof e,n="boolean"==typeof t;return H.isFunction(e)?this.each(function(i){H(this).toggleClass(e.call(this,i,this.className,t),t)}):this.each(function(){if("string"===i)for(var s,a=0,r=H(this),o=t,l=e.split(B);s=l[a++];)o=n?o:!r.hasClass(s),r[o?"addClass":"removeClass"](s);else("undefined"===i||"boolean"===i)&&(this.className&&H._data(this,"__className__",this.className),this.className=this.className||e===!1?"":H._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(q," ").indexOf(t)>-1)return!0;return!1},val:function(e){var i,n,s,a=this[0];{if(arguments.length)return s=H.isFunction(e),this.each(function(n){var a,r=H(this);1===this.nodeType&&(a=s?e.call(this,n,r.val()):e,null==a?a="":"number"==typeof a?a+="":H.isArray(a)&&(a=H.map(a,function(e){return null==e?"":e+""})),i=H.valHooks[this.type]||H.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,a,"value")!==t||(this.value=a))});if(a)return i=H.valHooks[a.type]||H.valHooks[a.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(a,"value"))!==t?n:(n=a.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),H.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,i,n,s,a=e.selectedIndex,r=[],o=e.options,l="select-one"===e.type;if(0>a)return null;for(i=l?a:0,n=l?a+1:o.length;n>i;i++)if(s=o[i],s.selected&&(H.support.optDisabled?!s.disabled:null===s.getAttribute("disabled"))&&(!s.parentNode.disabled||!H.nodeName(s.parentNode,"optgroup"))){if(t=H(s).val(),l)return t;r.push(t)}return l&&!r.length&&o.length?H(o[a]).val():r},set:function(e,t){var i=H.makeArray(t);return H(e).find("option").each(function(){this.selected=H.inArray(H(this).val(),i)>=0}),i.length||(e.selectedIndex=-1),i}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,i,n,s){var a,r,o,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return s&&i in H.attrFn?H(e)[i](n):"undefined"==typeof e.getAttribute?H.prop(e,i,n):(o=1!==l||!H.isXMLDoc(e),o&&(i=i.toLowerCase(),r=H.attrHooks[i]||(X.test(i)?R:$)),n!==t?null===n?void H.removeAttr(e,i):r&&"set"in r&&o&&(a=r.set(e,n,i))!==t?a:(e.setAttribute(i,""+n),n):r&&"get"in r&&o&&null!==(a=r.get(e,i))?a:(a=e.getAttribute(i),null===a?t:a))},removeAttr:function(e,t){var i,n,s,a,r,o=0;if(t&&1===e.nodeType)for(n=t.toLowerCase().split(B),a=n.length;a>o;o++)s=n[o],s&&(i=H.propFix[s]||s,r=X.test(s),r||H.attr(e,s,""),e.removeAttribute(K?s:i),r&&i in e&&(e[i]=!1))},attrHooks:{type:{set:function(e,t){if(Q.test(e.nodeName)&&e.parentNode)H.error("type property can't be changed");else if(!H.support.radioValue&&"radio"===t&&H.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}},value:{get:function(e,t){return $&&H.nodeName(e,"button")?$.get(e,t):t in e?e.value:null},set:function(e,t,i){return $&&H.nodeName(e,"button")?$.set(e,t,i):void(e.value=t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,i,n){var s,a,r,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return r=1!==o||!H.isXMLDoc(e),r&&(i=H.propFix[i]||i,a=H.propHooks[i]),n!==t?a&&"set"in a&&(s=a.set(e,n,i))!==t?s:e[i]=n:a&&"get"in a&&null!==(s=a.get(e,i))?s:e[i]},propHooks:{tabIndex:{get:function(e){var i=e.getAttributeNode("tabindex");return i&&i.specified?parseInt(i.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),H.attrHooks.tabindex=H.propHooks.tabIndex,R={get:function(e,i){var n,s=H.prop(e,i);return s===!0||"boolean"!=typeof s&&(n=e.getAttributeNode(i))&&n.nodeValue!==!1?i.toLowerCase():t},set:function(e,t,i){var n;return t===!1?H.removeAttr(e,i):(n=H.propFix[i]||i,n in e&&(e[n]=!0),e.setAttribute(i,i.toLowerCase())),i}},K||(W={name:!0,id:!0,coords:!0},$=H.valHooks.button={get:function(e,i){var n;return n=e.getAttributeNode(i),n&&(W[i]?""!==n.nodeValue:n.specified)?n.nodeValue:t},set:function(e,t,i){var n=e.getAttributeNode(i);return n||(n=N.createAttribute(i),e.setAttributeNode(n)),n.nodeValue=t+""}},H.attrHooks.tabindex.set=$.set,H.each(["width","height"],function(e,t){H.attrHooks[t]=H.extend(H.attrHooks[t],{set:function(e,i){return""===i?(e.setAttribute(t,"auto"),i):void 0}})}),H.attrHooks.contenteditable={get:$.get,set:function(e,t,i){""===t&&(t="false"),$.set(e,t,i)}}),H.support.hrefNormalized||H.each(["href","src","width","height"],function(e,i){H.attrHooks[i]=H.extend(H.attrHooks[i],{get:function(e){var n=e.getAttribute(i,2);return null===n?t:n}})}),H.support.style||(H.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),H.support.optSelected||(H.propHooks.selected=H.extend(H.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),H.support.enctype||(H.propFix.enctype="encoding"),H.support.checkOn||H.each(["radio","checkbox"],function(){H.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),H.each(["radio","checkbox"],function(){H.valHooks[this]=H.extend(H.valHooks[this],{set:function(e,t){return H.isArray(t)?e.checked=H.inArray(H(e).val(),t)>=0:void 0}})});var G=/^(?:textarea|input|select)$/i,J=/^([^\.]*)?(?:\.(.+))?$/,Z=/(?:^|\s)hover(\.\S+)?\b/,ee=/^key/,te=/^(?:mouse|contextmenu)|click/,ie=/^(?:focusinfocus|focusoutblur)$/,ne=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,se=function(e){var t=ne.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&new RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},ae=function(e,t){var i=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(i.id||{}).value===t[2])&&(!t[3]||t[3].test((i["class"]||{}).value))},re=function(e){return H.event.special.hover?e:e.replace(Z,"mouseenter$1 mouseleave$1")};H.event={add:function(e,i,n,s,a){var r,o,l,h,c,d,u,p,f,g,m;if(3!==e.nodeType&&8!==e.nodeType&&i&&n&&(r=H._data(e))){for(n.handler&&(f=n,n=f.handler,a=f.selector),n.guid||(n.guid=H.guid++),l=r.events,l||(r.events=l={}),o=r.handle,o||(r.handle=o=function(e){return"undefined"==typeof H||e&&H.event.triggered===e.type?t:H.event.dispatch.apply(o.elem,arguments)},o.elem=e),i=H.trim(re(i)).split(" "),h=0;h<i.length;h++)c=J.exec(i[h])||[],d=c[1],u=(c[2]||"").split(".").sort(),m=H.event.special[d]||{},d=(a?m.delegateType:m.bindType)||d,m=H.event.special[d]||{},p=H.extend({type:d,origType:c[1],data:s,handler:n,guid:n.guid,selector:a,quick:a&&se(a),namespace:u.join(".")},f),g=l[d],g||(g=l[d]=[],g.delegateCount=0,m.setup&&m.setup.call(e,s,u,o)!==!1||(e.addEventListener?e.addEventListener(d,o,!1):e.attachEvent&&e.attachEvent("on"+d,o))),m.add&&(m.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),a?g.splice(g.delegateCount++,0,p):g.push(p),H.event.global[d]=!0;e=null}},global:{},remove:function(e,t,i,n,s){var a,r,o,l,h,c,d,u,p,f,g,m,v=H.hasData(e)&&H._data(e);if(v&&(u=v.events)){for(t=H.trim(re(t||"")).split(" "),a=0;a<t.length;a++)if(r=J.exec(t[a])||[],o=l=r[1],h=r[2],o){for(p=H.event.special[o]||{},o=(n?p.delegateType:p.bindType)||o,g=u[o]||[],c=g.length,h=h?new RegExp("(^|\\.)"+h.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=0;d<g.length;d++)m=g[d],!s&&l!==m.origType||i&&i.guid!==m.guid||h&&!h.test(m.namespace)||n&&n!==m.selector&&("**"!==n||!m.selector)||(g.splice(d--,1),m.selector&&g.delegateCount--,p.remove&&p.remove.call(e,m));0===g.length&&c!==g.length&&(p.teardown&&p.teardown.call(e,h)!==!1||H.removeEvent(e,o,v.handle),delete u[o])}else for(o in u)H.event.remove(e,o+t[a],i,n,!0);H.isEmptyObject(u)&&(f=v.handle,f&&(f.elem=null),H.removeData(e,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(i,n,s,a){if(!s||3!==s.nodeType&&8!==s.nodeType){var r,o,l,h,c,d,u,p,f,g,m=i.type||i,v=[];if(!ie.test(m+H.event.triggered)&&(m.indexOf("!")>=0&&(m=m.slice(0,-1),o=!0),m.indexOf(".")>=0&&(v=m.split("."),m=v.shift(),v.sort()),s&&!H.event.customEvent[m]||H.event.global[m]))if(i="object"==typeof i?i[H.expando]?i:new H.Event(m,i):new H.Event(m),i.type=m,i.isTrigger=!0,i.exclusive=o,i.namespace=v.join("."),i.namespace_re=i.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=m.indexOf(":")<0?"on"+m:"",s){if(i.result=t,i.target||(i.target=s),n=null!=n?H.makeArray(n):[],n.unshift(i),u=H.event.special[m]||{},!u.trigger||u.trigger.apply(s,n)!==!1){if(f=[[s,u.bindType||m]],!a&&!u.noBubble&&!H.isWindow(s)){for(g=u.delegateType||m,h=ie.test(g+m)?s:s.parentNode,c=null;h;h=h.parentNode)f.push([h,g]),c=h;c&&c===s.ownerDocument&&f.push([c.defaultView||c.parentWindow||e,g])}for(l=0;l<f.length&&!i.isPropagationStopped();l++)h=f[l][0],i.type=f[l][1],p=(H._data(h,"events")||{})[i.type]&&H._data(h,"handle"),p&&p.apply(h,n),p=d&&h[d],p&&H.acceptData(h)&&p.apply(h,n)===!1&&i.preventDefault();return i.type=m,a||i.isDefaultPrevented()||u._default&&u._default.apply(s.ownerDocument,n)!==!1||"click"===m&&H.nodeName(s,"a")||!H.acceptData(s)||d&&s[m]&&("focus"!==m&&"blur"!==m||0!==i.target.offsetWidth)&&!H.isWindow(s)&&(c=s[d],c&&(s[d]=null),H.event.triggered=m,s[m](),H.event.triggered=t,c&&(s[d]=c)),i.result}}else{r=H.cache;for(l in r)r[l].events&&r[l].events[m]&&H.event.trigger(i,n,r[l].handle.elem,!0)}}},dispatch:function(i){i=H.event.fix(i||e.event);var n,s,a,r,o,l,h,c,d,u,p=(H._data(this,"events")||{})[i.type]||[],f=p.delegateCount,g=[].slice.call(arguments,0),m=!i.exclusive&&!i.namespace,v=H.event.special[i.type]||{},_=[];if(g[0]=i,i.delegateTarget=this,!v.preDispatch||v.preDispatch.call(this,i)!==!1){if(f&&(!i.button||"click"!==i.type))for(r=H(this),r.context=this.ownerDocument||this,a=i.target;a!=this;a=a.parentNode||this)if(a.disabled!==!0){for(l={},c=[],r[0]=a,n=0;f>n;n++)d=p[n],u=d.selector,l[u]===t&&(l[u]=d.quick?ae(a,d.quick):r.is(u)),l[u]&&c.push(d);c.length&&_.push({elem:a,matches:c})}for(p.length>f&&_.push({elem:this,matches:p.slice(f)}),n=0;n<_.length&&!i.isPropagationStopped();n++)for(h=_[n],i.currentTarget=h.elem,s=0;s<h.matches.length&&!i.isImmediatePropagationStopped();s++)d=h.matches[s],(m||!i.namespace&&!d.namespace||i.namespace_re&&i.namespace_re.test(d.namespace))&&(i.data=d.data,i.handleObj=d,o=((H.event.special[d.origType]||{}).handle||d.handler).apply(h.elem,g),o!==t&&(i.result=o,o===!1&&(i.preventDefault(),i.stopPropagation())));return v.postDispatch&&v.postDispatch.call(this,i),i.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,i){var n,s,a,r=i.button,o=i.fromElement;return null==e.pageX&&null!=i.clientX&&(n=e.target.ownerDocument||N,s=n.documentElement,a=n.body,e.pageX=i.clientX+(s&&s.scrollLeft||a&&a.scrollLeft||0)-(s&&s.clientLeft||a&&a.clientLeft||0),e.pageY=i.clientY+(s&&s.scrollTop||a&&a.scrollTop||0)-(s&&s.clientTop||a&&a.clientTop||0)),!e.relatedTarget&&o&&(e.relatedTarget=o===e.target?i.toElement:o),e.which||r===t||(e.which=1&r?1:2&r?3:4&r?2:0),e}},fix:function(e){if(e[H.expando])return e;var i,n,s=e,a=H.event.fixHooks[e.type]||{},r=a.props?this.props.concat(a.props):this.props;for(e=H.Event(s),i=r.length;i;)n=r[--i],e[n]=s[n];return e.target||(e.target=s.srcElement||N),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey===t&&(e.metaKey=e.ctrlKey),a.filter?a.filter(e,s):e},special:{ready:{setup:H.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,i){H.isWindow(this)&&(this.onbeforeunload=i)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,i,n){var s=H.extend(new H.Event,i,{type:e,isSimulated:!0,originalEvent:{}});n?H.event.trigger(s,null,t):H.event.dispatch.call(t,s),s.isDefaultPrevented()&&i.preventDefault()}},H.event.handle=H.event.dispatch,H.removeEvent=N.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,t,i){e.detachEvent&&e.detachEvent("on"+t,i)},H.Event=function(e,t){return this instanceof H.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?o:r):this.type=e,t&&H.extend(this,t),this.timeStamp=e&&e.timeStamp||H.now(),void(this[H.expando]=!0)):new H.Event(e,t)},H.Event.prototype={preventDefault:function(){this.isDefaultPrevented=o;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=o;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=o,this.stopPropagation()},isDefaultPrevented:r,isPropagationStopped:r,isImmediatePropagationStopped:r},H.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){H.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,n=this,s=e.relatedTarget,a=e.handleObj;a.selector;return(!s||s!==n&&!H.contains(n,s))&&(e.type=a.origType,i=a.handler.apply(this,arguments),e.type=t),i}}}),H.support.submitBubbles||(H.event.special.submit={setup:function(){return H.nodeName(this,"form")?!1:void H.event.add(this,"click._submit keypress._submit",function(e){var i=e.target,n=H.nodeName(i,"input")||H.nodeName(i,"button")?i.form:t;n&&!n._submit_attached&&(H.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),n._submit_attached=!0)})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&H.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return H.nodeName(this,"form")?!1:void H.event.remove(this,"._submit")}}),H.support.changeBubbles||(H.event.special.change={setup:function(){return G.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(H.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),H.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1,H.event.simulate("change",this,e,!0))})),!1):void H.event.add(this,"beforeactivate._change",function(e){var t=e.target;G.test(t.nodeName)&&!t._change_attached&&(H.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||H.event.simulate("change",this.parentNode,e,!0)}),t._change_attached=!0)})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return H.event.remove(this,"._change"),G.test(this.nodeName)}}),H.support.focusinBubbles||H.each({focus:"focusin",blur:"focusout"},function(e,t){var i=0,n=function(e){H.event.simulate(t,e.target,H.event.fix(e),!0)};H.event.special[t]={setup:function(){0===i++&&N.addEventListener(e,n,!0)},teardown:function(){0===--i&&N.removeEventListener(e,n,!0)}}}),H.fn.extend({on:function(e,i,n,s,a){var o,l;if("object"==typeof e){"string"!=typeof i&&(n=n||i,i=t);for(l in e)this.on(l,i,n,e[l],a);return this}if(null==n&&null==s?(s=i,n=i=t):null==s&&("string"==typeof i?(s=n,n=t):(s=n,n=i,i=t)),s===!1)s=r;else if(!s)return this;return 1===a&&(o=s,s=function(e){return H().off(e),o.apply(this,arguments)},s.guid=o.guid||(o.guid=H.guid++)),this.each(function(){H.event.add(this,e,s,n,i)})},one:function(e,t,i,n){return this.on(e,t,i,n,1)},off:function(e,i,n){if(e&&e.preventDefault&&e.handleObj){var s=e.handleObj;return H(e.delegateTarget).off(s.namespace?s.origType+"."+s.namespace:s.origType,s.selector,s.handler),this}if("object"==typeof e){for(var a in e)this.off(a,i,e[a]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=t),n===!1&&(n=r),this.each(function(){H.event.remove(this,e,n,i)})},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,i){return H(this.context).on(e,this.selector,t,i),this},die:function(e,t){return H(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1==arguments.length?this.off(e,"**"):this.off(t,e,i)},trigger:function(e,t){return this.each(function(){H.event.trigger(e,t,this)})},triggerHandler:function(e,t){return this[0]?H.event.trigger(e,t,this[0],!0):void 0},toggle:function(e){var t=arguments,i=e.guid||H.guid++,n=0,s=function(i){var s=(H._data(this,"lastToggle"+e.guid)||0)%n;return H._data(this,"lastToggle"+e.guid,s+1),i.preventDefault(),t[s].apply(this,arguments)||!1};for(s.guid=i;n<t.length;)t[n++].guid=i;return this.click(s)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),H.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){H.fn[t]=function(e,i){return null==i&&(i=e,e=null),arguments.length>0?this.on(t,null,e,i):this.trigger(t)},H.attrFn&&(H.attrFn[t]=!0),ee.test(t)&&(H.event.fixHooks[t]=H.event.keyHooks),te.test(t)&&(H.event.fixHooks[t]=H.event.mouseHooks)}),function(){function e(e,t,i,n,a,r){for(var o=0,l=n.length;l>o;o++){var h=n[o];if(h){var c=!1;for(h=h[e];h;){if(h[s]===i){c=n[h.sizset];break}if(1!==h.nodeType||r||(h[s]=i,h.sizset=o),h.nodeName.toLowerCase()===t){c=h;break}h=h[e]}n[o]=c}}}function i(e,t,i,n,a,r){for(var o=0,l=n.length;l>o;o++){var h=n[o];if(h){var c=!1;for(h=h[e];h;){if(h[s]===i){c=n[h.sizset];break}if(1===h.nodeType)if(r||(h[s]=i,h.sizset=o),"string"!=typeof t){if(h===t){c=!0;break}}else if(u.filter(t,[h]).length>0){c=h;break}h=h[e]}n[o]=c}}}var n=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,s="sizcache"+(Math.random()+"").replace(".",""),a=0,r=Object.prototype.toString,o=!1,l=!0,h=/\\/g,c=/\r\n/g,d=/\W/;[0,0].sort(function(){return l=!1,0});var u=function(e,t,i,s){i=i||[],t=t||N;var a=t;if(1!==t.nodeType&&9!==t.nodeType)return[];if(!e||"string"!=typeof e)return i;var o,l,h,c,d,p,m,v,y=!0,b=u.isXML(t),x=[],k=e;do if(n.exec(""),o=n.exec(k),o&&(k=o[3],x.push(o[1]),o[2])){c=o[3];break}while(o);if(x.length>1&&g.exec(e))if(2===x.length&&f.relative[x[0]])l=w(x[0]+x[1],t,s);else for(l=f.relative[x[0]]?[t]:u(x.shift(),t);x.length;)e=x.shift(),f.relative[e]&&(e+=x.shift()),l=w(e,l,s);else if(!s&&x.length>1&&9===t.nodeType&&!b&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])&&(d=u.find(x.shift(),t,b),t=d.expr?u.filter(d.expr,d.set)[0]:d.set[0]),t)for(d=s?{expr:x.pop(),set:_(s)}:u.find(x.pop(),1!==x.length||"~"!==x[0]&&"+"!==x[0]||!t.parentNode?t:t.parentNode,b),l=d.expr?u.filter(d.expr,d.set):d.set,x.length>0?h=_(l):y=!1;x.length;)p=x.pop(),m=p,f.relative[p]?m=x.pop():p="",null==m&&(m=t),f.relative[p](h,m,b);else h=x=[];if(h||(h=l),h||u.error(p||e),"[object Array]"===r.call(h))if(y)if(t&&1===t.nodeType)for(v=0;null!=h[v];v++)h[v]&&(h[v]===!0||1===h[v].nodeType&&u.contains(t,h[v]))&&i.push(l[v]);else for(v=0;null!=h[v];v++)h[v]&&1===h[v].nodeType&&i.push(l[v]);else i.push.apply(i,h);else _(h,i);return c&&(u(c,a,i,s),u.uniqueSort(i)),i};u.uniqueSort=function(e){if(b&&(o=l,e.sort(b),o))for(var t=1;t<e.length;t++)e[t]===e[t-1]&&e.splice(t--,1);return e},u.matches=function(e,t){return u(e,null,null,t)},u.matchesSelector=function(e,t){return u(t,null,null,[e]).length>0},u.find=function(e,t,i){var n,s,a,r,o,l;if(!e)return[];for(s=0,a=f.order.length;a>s;s++)if(o=f.order[s],(r=f.leftMatch[o].exec(e))&&(l=r[1],r.splice(1,1),"\\"!==l.substr(l.length-1)&&(r[1]=(r[1]||"").replace(h,""),n=f.find[o](r,t,i),null!=n))){e=e.replace(f.match[o],"");break}return n||(n="undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName("*"):[]),{set:n,expr:e}},u.filter=function(e,i,n,s){for(var a,r,o,l,h,c,d,p,g,m=e,v=[],_=i,y=i&&i[0]&&u.isXML(i[0]);e&&i.length;){for(o in f.filter)if(null!=(a=f.leftMatch[o].exec(e))&&a[2]){if(c=f.filter[o],d=a[1],r=!1,a.splice(1,1),"\\"===d.substr(d.length-1))continue;if(_===v&&(v=[]),f.preFilter[o])if(a=f.preFilter[o](a,_,n,v,s,y)){if(a===!0)continue}else r=l=!0;if(a)for(p=0;null!=(h=_[p]);p++)h&&(l=c(h,a,p,_),g=s^l,n&&null!=l?g?r=!0:_[p]=!1:g&&(v.push(h),r=!0));if(l!==t){if(n||(_=v),e=e.replace(f.match[o],""),!r)return[];break}}if(e===m){if(null!=r)break;u.error(e)}m=e}return _},u.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var p=u.getText=function(e){var t,i,n=e.nodeType,s="";if(n){if(1===n||9===n||11===n){if("string"==typeof e.textContent)return e.textContent;if("string"==typeof e.innerText)return e.innerText.replace(c,"");for(e=e.firstChild;e;e=e.nextSibling)s+=p(e)}else if(3===n||4===n)return e.nodeValue}else for(t=0;i=e[t];t++)8!==i.nodeType&&(s+=p(i));return s},f=u.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(e,t){var i="string"==typeof t,n=i&&!d.test(t),s=i&&!n;n&&(t=t.toLowerCase());for(var a,r=0,o=e.length;o>r;r++)if(a=e[r]){for(;(a=a.previousSibling)&&1!==a.nodeType;);e[r]=s||a&&a.nodeName.toLowerCase()===t?a||!1:a===t}s&&u.filter(t,e,!0)},">":function(e,t){var i,n="string"==typeof t,s=0,a=e.length;if(n&&!d.test(t)){for(t=t.toLowerCase();a>s;s++)if(i=e[s]){var r=i.parentNode;e[s]=r.nodeName.toLowerCase()===t?r:!1}}else{for(;a>s;s++)i=e[s],i&&(e[s]=n?i.parentNode:i.parentNode===t);n&&u.filter(t,e,!0)}},"":function(t,n,s){var r,o=a++,l=i;"string"!=typeof n||d.test(n)||(n=n.toLowerCase(),r=n,l=e),l("parentNode",n,o,t,r,s)},"~":function(t,n,s){var r,o=a++,l=i;"string"!=typeof n||d.test(n)||(n=n.toLowerCase(),r=n,l=e),l("previousSibling",n,o,t,r,s)}},find:{ID:function(e,t,i){if("undefined"!=typeof t.getElementById&&!i){var n=t.getElementById(e[1]);return n&&n.parentNode?[n]:[]}},NAME:function(e,t){if("undefined"!=typeof t.getElementsByName){for(var i=[],n=t.getElementsByName(e[1]),s=0,a=n.length;a>s;s++)n[s].getAttribute("name")===e[1]&&i.push(n[s]);return 0===i.length?null:i}},TAG:function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e[1]):void 0}},preFilter:{CLASS:function(e,t,i,n,s,a){if(e=" "+e[1].replace(h,"")+" ",a)return e;for(var r,o=0;null!=(r=t[o]);o++)r&&(s^(r.className&&(" "+r.className+" ").replace(/[\t\n\r]/g," ").indexOf(e)>=0)?i||n.push(r):i&&(t[o]=!1));return!1},ID:function(e){return e[1].replace(h,"")},TAG:function(e,t){return e[1].replace(h,"").toLowerCase()},CHILD:function(e){if("nth"===e[1]){e[2]||u.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===e[2]&&"2n"||"odd"===e[2]&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&u.error(e[0]);return e[0]=a++,e},ATTR:function(e,t,i,n,s,a){var r=e[1]=e[1].replace(h,"");return!a&&f.attrMap[r]&&(e[1]=f.attrMap[r]),e[4]=(e[4]||e[5]||"").replace(h,""),"~="===e[2]&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(e,t,i,s,a){if("not"===e[1]){if(!((n.exec(e[3])||"").length>1||/^\w/.test(e[3]))){var r=u.filter(e[3],t,i,!0^a);return i||s.push.apply(s,r),!1}e[3]=u(e[3],null,null,t)}else if(f.match.POS.test(e[0])||f.match.CHILD.test(e[0]))return!0;return e},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&"hidden"!==e.type},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,i){return!!u(i[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),i=e.type;return"input"===e.nodeName.toLowerCase()&&"text"===i&&(t===i||null===t)},radio:function(e){return"input"===e.nodeName.toLowerCase()&&"radio"===e.type},checkbox:function(e){return"input"===e.nodeName.toLowerCase()&&"checkbox"===e.type},file:function(e){return"input"===e.nodeName.toLowerCase()&&"file"===e.type},password:function(e){return"input"===e.nodeName.toLowerCase()&&"password"===e.type},submit:function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&"submit"===e.type},image:function(e){return"input"===e.nodeName.toLowerCase()&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return 0===t},last:function(e,t,i,n){return t===n.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,i){return t<i[3]-0},gt:function(e,t,i){return t>i[3]-0},nth:function(e,t,i){return i[3]-0===t},eq:function(e,t,i){return i[3]-0===t}},filter:{PSEUDO:function(e,t,i,n){var s=t[1],a=f.filters[s];if(a)return a(e,i,t,n);if("contains"===s)return(e.textContent||e.innerText||p([e])||"").indexOf(t[3])>=0;if("not"===s){for(var r=t[3],o=0,l=r.length;l>o;o++)if(r[o]===e)return!1;return!0}u.error(s)},CHILD:function(e,t){var i,n,a,r,o,l,h=t[1],c=e;switch(h){case"only":case"first":for(;c=c.previousSibling;)if(1===c.nodeType)return!1;if("first"===h)return!0;c=e;case"last":for(;c=c.nextSibling;)if(1===c.nodeType)return!1;return!0;case"nth":if(i=t[2],n=t[3],1===i&&0===n)return!0;if(a=t[0],r=e.parentNode,r&&(r[s]!==a||!e.nodeIndex)){for(o=0,c=r.firstChild;c;c=c.nextSibling)1===c.nodeType&&(c.nodeIndex=++o);r[s]=a}return l=e.nodeIndex-n,0===i?0===l:l%i===0&&l/i>=0}},ID:function(e,t){return 1===e.nodeType&&e.getAttribute("id")===t},TAG:function(e,t){return"*"===t&&1===e.nodeType||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var i=t[1],n=u.attr?u.attr(e,i):f.attrHandle[i]?f.attrHandle[i](e):null!=e[i]?e[i]:e.getAttribute(i),s=n+"",a=t[2],r=t[4];return null==n?"!="===a:!a&&u.attr?null!=n:"="===a?s===r:"*="===a?s.indexOf(r)>=0:"~="===a?(" "+s+" ").indexOf(r)>=0:r?"!="===a?s!==r:"^="===a?0===s.indexOf(r):"$="===a?s.substr(s.length-r.length)===r:"|="===a?s===r||s.substr(0,r.length+1)===r+"-":!1:s&&n!==!1},POS:function(e,t,i,n){var s=t[2],a=f.setFilters[s];return a?a(e,i,t,n):void 0}}},g=f.match.POS,m=function(e,t){return"\\"+(t-0+1)};for(var v in f.match)f.match[v]=new RegExp(f.match[v].source+/(?![^\[]*\])(?![^\(]*\))/.source),f.leftMatch[v]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[v].source.replace(/\\(\d+)/g,m));f.match.globalPOS=g;var _=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(N.documentElement.childNodes,0)[0].nodeType}catch(y){_=function(e,t){var i=0,n=t||[];if("[object Array]"===r.call(e))Array.prototype.push.apply(n,e);else if("number"==typeof e.length)for(var s=e.length;s>i;i++)n.push(e[i]);else for(;e[i];i++)n.push(e[i]);return n}}var b,x;N.documentElement.compareDocumentPosition?b=function(e,t){return e===t?(o=!0,0):e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t)?-1:1:e.compareDocumentPosition?-1:1}:(b=function(e,t){if(e===t)return o=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var i,n,s=[],a=[],r=e.parentNode,l=t.parentNode,h=r;if(r===l)return x(e,t);if(!r)return-1;if(!l)return 1;for(;h;)s.unshift(h),h=h.parentNode;for(h=l;h;)a.unshift(h),h=h.parentNode;i=s.length,n=a.length;for(var c=0;i>c&&n>c;c++)if(s[c]!==a[c])return x(s[c],a[c]);return c===i?x(e,a[c],-1):x(s[c],t,1)},x=function(e,t,i){if(e===t)return i;for(var n=e.nextSibling;n;){if(n===t)return-1;n=n.nextSibling}return 1}),function(){var e=N.createElement("div"),i="script"+(new Date).getTime(),n=N.documentElement;e.innerHTML="<a name='"+i+"'/>",n.insertBefore(e,n.firstChild),N.getElementById(i)&&(f.find.ID=function(e,i,n){if("undefined"!=typeof i.getElementById&&!n){var s=i.getElementById(e[1]);return s?s.id===e[1]||"undefined"!=typeof s.getAttributeNode&&s.getAttributeNode("id").nodeValue===e[1]?[s]:t:[]}},f.filter.ID=function(e,t){var i="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return 1===e.nodeType&&i&&i.nodeValue===t}),n.removeChild(e),n=e=null}(),function(){var e=N.createElement("div");e.appendChild(N.createComment("")),e.getElementsByTagName("*").length>0&&(f.find.TAG=function(e,t){var i=t.getElementsByTagName(e[1]);if("*"===e[1]){for(var n=[],s=0;i[s];s++)1===i[s].nodeType&&n.push(i[s]);i=n}return i}),e.innerHTML="<a href='#'></a>",e.firstChild&&"undefined"!=typeof e.firstChild.getAttribute&&"#"!==e.firstChild.getAttribute("href")&&(f.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),N.querySelectorAll&&!function(){var e=u,t=N.createElement("div"),i="__sizzle__";if(t.innerHTML="<p class='TEST'></p>",!t.querySelectorAll||0!==t.querySelectorAll(".TEST").length){u=function(t,n,s,a){if(n=n||N,!a&&!u.isXML(n)){var r=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);if(r&&(1===n.nodeType||9===n.nodeType)){if(r[1])return _(n.getElementsByTagName(t),s);if(r[2]&&f.find.CLASS&&n.getElementsByClassName)return _(n.getElementsByClassName(r[2]),s)}if(9===n.nodeType){if("body"===t&&n.body)return _([n.body],s);if(r&&r[3]){var o=n.getElementById(r[3]);if(!o||!o.parentNode)return _([],s);
if(o.id===r[3])return _([o],s)}try{return _(n.querySelectorAll(t),s)}catch(l){}}else if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){var h=n,c=n.getAttribute("id"),d=c||i,p=n.parentNode,g=/^\s*[+~]/.test(t);c?d=d.replace(/'/g,"\\$&"):n.setAttribute("id",d),g&&p&&(n=n.parentNode);try{if(!g||p)return _(n.querySelectorAll("[id='"+d+"'] "+t),s)}catch(m){}finally{c||h.removeAttribute("id")}}}return e(t,n,s,a)};for(var n in e)u[n]=e[n];t=null}}(),function(){var e=N.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var i=!t.call(N.createElement("div"),"div"),n=!1;try{t.call(N.documentElement,"[test!='']:sizzle")}catch(s){n=!0}u.matchesSelector=function(e,s){if(s=s.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']"),!u.isXML(e))try{if(n||!f.match.PSEUDO.test(s)&&!/!=/.test(s)){var a=t.call(e,s);if(a||!i||e.document&&11!==e.document.nodeType)return a}}catch(r){}return u(s,null,null,[e]).length>0}}}(),function(){var e=N.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>",e.getElementsByClassName&&0!==e.getElementsByClassName("e").length&&(e.lastChild.className="e",1!==e.getElementsByClassName("e").length&&(f.order.splice(1,0,"CLASS"),f.find.CLASS=function(e,t,i){return"undefined"==typeof t.getElementsByClassName||i?void 0:t.getElementsByClassName(e[1])},e=null))}(),N.documentElement.contains?u.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:N.documentElement.compareDocumentPosition?u.contains=function(e,t){return!!(16&e.compareDocumentPosition(t))}:u.contains=function(){return!1},u.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?"HTML"!==t.nodeName:!1};var w=function(e,t,i){for(var n,s=[],a="",r=t.nodeType?[t]:t;n=f.match.PSEUDO.exec(e);)a+=n[0],e=e.replace(f.match.PSEUDO,"");e=f.relative[e]?e+"*":e;for(var o=0,l=r.length;l>o;o++)u(e,r[o],s,i);return u.filter(a,s)};u.attr=H.attr,u.selectors.attrMap={},H.find=u,H.expr=u.selectors,H.expr[":"]=H.expr.filters,H.unique=u.uniqueSort,H.text=u.getText,H.isXMLDoc=u.isXML,H.contains=u.contains}();var oe=/Until$/,le=/^(?:parents|prevUntil|prevAll)/,he=/,/,ce=/^.[^:#\[\.,]*$/,de=Array.prototype.slice,ue=H.expr.match.globalPOS,pe={children:!0,contents:!0,next:!0,prev:!0};H.fn.extend({find:function(e){var t,i,n=this;if("string"!=typeof e)return H(e).filter(function(){for(t=0,i=n.length;i>t;t++)if(H.contains(n[t],this))return!0});var s,a,r,o=this.pushStack("","find",e);for(t=0,i=this.length;i>t;t++)if(s=o.length,H.find(e,this[t],o),t>0)for(a=s;a<o.length;a++)for(r=0;s>r;r++)if(o[r]===o[a]){o.splice(a--,1);break}return o},has:function(e){var t=H(e);return this.filter(function(){for(var e=0,i=t.length;i>e;e++)if(H.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(h(this,e,!1),"not",e)},filter:function(e){return this.pushStack(h(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?ue.test(e)?H(e,this.context).index(this[0])>=0:H.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var i,n,s=[],a=this[0];if(H.isArray(e)){for(var r=1;a&&a.ownerDocument&&a!==t;){for(i=0;i<e.length;i++)H(a).is(e[i])&&s.push({selector:e[i],elem:a,level:r});a=a.parentNode,r++}return s}var o=ue.test(e)||"string"!=typeof e?H(e,t||this.context):0;for(i=0,n=this.length;n>i;i++)for(a=this[i];a;){if(o?o.index(a)>-1:H.find.matchesSelector(a,e)){s.push(a);break}if(a=a.parentNode,!a||!a.ownerDocument||a===t||11===a.nodeType)break}return s=s.length>1?H.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?"string"==typeof e?H.inArray(this[0],H(e)):H.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var i="string"==typeof e?H(e,t):H.makeArray(e&&e.nodeType?[e]:e),n=H.merge(this.get(),i);return this.pushStack(l(i[0])||l(n[0])?n:H.unique(n))},andSelf:function(){return this.add(this.prevObject)}}),H.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return H.dir(e,"parentNode")},parentsUntil:function(e,t,i){return H.dir(e,"parentNode",i)},next:function(e){return H.nth(e,2,"nextSibling")},prev:function(e){return H.nth(e,2,"previousSibling")},nextAll:function(e){return H.dir(e,"nextSibling")},prevAll:function(e){return H.dir(e,"previousSibling")},nextUntil:function(e,t,i){return H.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return H.dir(e,"previousSibling",i)},siblings:function(e){return H.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return H.sibling(e.firstChild)},contents:function(e){return H.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:H.makeArray(e.childNodes)}},function(e,t){H.fn[e]=function(i,n){var s=H.map(this,t,i);return oe.test(e)||(n=i),n&&"string"==typeof n&&(s=H.filter(n,s)),s=this.length>1&&!pe[e]?H.unique(s):s,(this.length>1||he.test(n))&&le.test(e)&&(s=s.reverse()),this.pushStack(s,e,de.call(arguments).join(","))}}),H.extend({filter:function(e,t,i){return i&&(e=":not("+e+")"),1===t.length?H.find.matchesSelector(t[0],e)?[t[0]]:[]:H.find.matches(e,t)},dir:function(e,i,n){for(var s=[],a=e[i];a&&9!==a.nodeType&&(n===t||1!==a.nodeType||!H(a).is(n));)1===a.nodeType&&s.push(a),a=a[i];return s},nth:function(e,t,i,n){t=t||1;for(var s=0;e&&(1!==e.nodeType||++s!==t);e=e[i]);return e},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}});var fe="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ge=/ jQuery\d+="(?:\d+|null)"/g,me=/^\s+/,ve=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,_e=/<([\w:]+)/,ye=/<tbody/i,be=/<|&#?\w+;/,xe=/<(?:script|style)/i,we=/<(?:script|object|embed|option|style)/i,ke=new RegExp("<(?:"+fe+")[\\s/>]","i"),je=/checked\s*(?:[^=]|=\s*.checked.)/i,Ce=/\/(java|ecma)script/i,Te=/^\s*<!(?:\[CDATA\[|\-\-)/,Se={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},De=c(N);Se.optgroup=Se.option,Se.tbody=Se.tfoot=Se.colgroup=Se.caption=Se.thead,Se.th=Se.td,H.support.htmlSerialize||(Se._default=[1,"div<div>","</div>"]),H.fn.extend({text:function(e){return H.access(this,function(e){return e===t?H.text(this):this.empty().append((this[0]&&this[0].ownerDocument||N).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(H.isFunction(e))return this.each(function(t){H(this).wrapAll(e.call(this,t))});if(this[0]){var t=H(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return H.isFunction(e)?this.each(function(t){H(this).wrapInner(e.call(this,t))}):this.each(function(){var t=H(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=H.isFunction(e);return this.each(function(i){H(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){H.nodeName(this,"body")||H(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){1===this.nodeType&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){1===this.nodeType&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=H.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,H.clean(arguments)),e}},remove:function(e,t){for(var i,n=0;null!=(i=this[n]);n++)(!e||H.filter(e,[i]).length)&&(t||1!==i.nodeType||(H.cleanData(i.getElementsByTagName("*")),H.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&H.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return H.clone(this,e,t)})},html:function(e){return H.access(this,function(e){var i=this[0]||{},n=0,s=this.length;if(e===t)return 1===i.nodeType?i.innerHTML.replace(ge,""):null;if("string"==typeof e&&!xe.test(e)&&(H.support.leadingWhitespace||!me.test(e))&&!Se[(_e.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(ve,"<$1></$2>");try{for(;s>n;n++)i=this[n]||{},1===i.nodeType&&(H.cleanData(i.getElementsByTagName("*")),i.innerHTML=e);i=0}catch(a){}}i&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return this[0]&&this[0].parentNode?H.isFunction(e)?this.each(function(t){var i=H(this),n=i.html();i.replaceWith(e.call(this,t,n))}):("string"!=typeof e&&(e=H(e).detach()),this.each(function(){var t=this.nextSibling,i=this.parentNode;H(this).remove(),t?H(t).before(e):H(i).append(e)})):this.length?this.pushStack(H(H.isFunction(e)?e():e),"replaceWith",e):this},detach:function(e){return this.remove(e,!0)},domManip:function(e,i,n){var s,a,r,o,l=e[0],h=[];if(!H.support.checkClone&&3===arguments.length&&"string"==typeof l&&je.test(l))return this.each(function(){H(this).domManip(e,i,n,!0)});if(H.isFunction(l))return this.each(function(s){var a=H(this);e[0]=l.call(this,s,i?a.html():t),a.domManip(e,i,n)});if(this[0]){if(o=l&&l.parentNode,s=H.support.parentNode&&o&&11===o.nodeType&&o.childNodes.length===this.length?{fragment:o}:H.buildFragment(e,this,h),r=s.fragment,a=1===r.childNodes.length?r=r.firstChild:r.firstChild){i=i&&H.nodeName(a,"tr");for(var c=0,u=this.length,p=u-1;u>c;c++)n.call(i?d(this[c],a):this[c],s.cacheable||u>1&&p>c?H.clone(r,!0,!0):r)}h.length&&H.each(h,function(e,t){t.src?H.ajax({type:"GET",global:!1,url:t.src,async:!1,dataType:"script"}):H.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Te,"/*$0*/")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),H.buildFragment=function(e,t,i){var n,s,a,r,o=e[0];return t&&t[0]&&(r=t[0].ownerDocument||t[0]),r.createDocumentFragment||(r=N),!(1===e.length&&"string"==typeof o&&o.length<512&&r===N&&"<"===o.charAt(0))||we.test(o)||!H.support.checkClone&&je.test(o)||!H.support.html5Clone&&ke.test(o)||(s=!0,a=H.fragments[o],a&&1!==a&&(n=a)),n||(n=r.createDocumentFragment(),H.clean(e,r,n,i)),s&&(H.fragments[o]=a?n:1),{fragment:n,cacheable:s}},H.fragments={},H.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){H.fn[e]=function(i){var n=[],s=H(i),a=1===this.length&&this[0].parentNode;if(a&&11===a.nodeType&&1===a.childNodes.length&&1===s.length)return s[t](this[0]),this;for(var r=0,o=s.length;o>r;r++){var l=(r>0?this.clone(!0):this).get();H(s[r])[t](l),n=n.concat(l)}return this.pushStack(n,e,s.selector)}}),H.extend({clone:function(e,t,i){var n,s,a,r=H.support.html5Clone||H.isXMLDoc(e)||!ke.test("<"+e.nodeName+">")?e.cloneNode(!0):v(e);if(!(H.support.noCloneEvent&&H.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||H.isXMLDoc(e)))for(p(e,r),n=f(e),s=f(r),a=0;n[a];++a)s[a]&&p(n[a],s[a]);if(t&&(u(e,r),i))for(n=f(e),s=f(r),a=0;n[a];++a)u(n[a],s[a]);return n=s=null,r},clean:function(e,t,i,n){var s,a,r,o=[];t=t||N,"undefined"==typeof t.createElement&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||N);for(var l,h=0;null!=(l=e[h]);h++)if("number"==typeof l&&(l+=""),l){if("string"==typeof l)if(be.test(l)){l=l.replace(ve,"<$1></$2>");var d,u=(_e.exec(l)||["",""])[1].toLowerCase(),p=Se[u]||Se._default,f=p[0],g=t.createElement("div"),v=De.childNodes;for(t===N?De.appendChild(g):c(t).appendChild(g),g.innerHTML=p[1]+l+p[2];f--;)g=g.lastChild;if(!H.support.tbody){var _=ye.test(l),y="table"!==u||_?"<table>"!==p[1]||_?[]:g.childNodes:g.firstChild&&g.firstChild.childNodes;for(r=y.length-1;r>=0;--r)H.nodeName(y[r],"tbody")&&!y[r].childNodes.length&&y[r].parentNode.removeChild(y[r])}!H.support.leadingWhitespace&&me.test(l)&&g.insertBefore(t.createTextNode(me.exec(l)[0]),g.firstChild),l=g.childNodes,g&&(g.parentNode.removeChild(g),v.length>0&&(d=v[v.length-1],d&&d.parentNode&&d.parentNode.removeChild(d)))}else l=t.createTextNode(l);var b;if(!H.support.appendChecked)if(l[0]&&"number"==typeof(b=l.length))for(r=0;b>r;r++)m(l[r]);else m(l);l.nodeType?o.push(l):o=H.merge(o,l)}if(i)for(s=function(e){return!e.type||Ce.test(e.type)},h=0;o[h];h++)if(a=o[h],n&&H.nodeName(a,"script")&&(!a.type||Ce.test(a.type)))n.push(a.parentNode?a.parentNode.removeChild(a):a);else{if(1===a.nodeType){var x=H.grep(a.getElementsByTagName("script"),s);o.splice.apply(o,[h+1,0].concat(x))}i.appendChild(a)}return o},cleanData:function(e){for(var t,i,n,s=H.cache,a=H.event.special,r=H.support.deleteExpando,o=0;null!=(n=e[o]);o++)if((!n.nodeName||!H.noData[n.nodeName.toLowerCase()])&&(i=n[H.expando])){if(t=s[i],t&&t.events){for(var l in t.events)a[l]?H.event.remove(n,l):H.removeEvent(n,l,t.handle);t.handle&&(t.handle.elem=null)}r?delete n[H.expando]:n.removeAttribute&&n.removeAttribute(H.expando),delete s[i]}}});var Ie,Ae,Ee,Ne=/alpha\([^)]*\)/i,Me=/opacity=([^)]*)/,Pe=/([A-Z]|^ms)/g,He=/^[\-+]?(?:\d*\.)?\d+$/i,Fe=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,Le=/^([\-+])=([\-+.\de]+)/,Oe=/^margin/,ze={position:"absolute",visibility:"hidden",display:"block"},$e=["Top","Right","Bottom","Left"];H.fn.css=function(e,i){return H.access(this,function(e,i,n){return n!==t?H.style(e,i,n):H.css(e,i)},e,i,arguments.length>1)},H.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=Ie(e,"opacity");return""===i?"1":i}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":H.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,i,n,s){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var a,r,o=H.camelCase(i),l=e.style,h=H.cssHooks[o];if(i=H.cssProps[o]||o,n===t)return h&&"get"in h&&(a=h.get(e,!1,s))!==t?a:l[i];if(r=typeof n,"string"===r&&(a=Le.exec(n))&&(n=+(a[1]+1)*+a[2]+parseFloat(H.css(e,i)),r="number"),!(null==n||"number"===r&&isNaN(n)||("number"!==r||H.cssNumber[o]||(n+="px"),h&&"set"in h&&(n=h.set(e,n))===t)))try{l[i]=n}catch(c){}}},css:function(e,i,n){var s,a;return i=H.camelCase(i),a=H.cssHooks[i],i=H.cssProps[i]||i,"cssFloat"===i&&(i="float"),a&&"get"in a&&(s=a.get(e,!0,n))!==t?s:Ie?Ie(e,i):void 0},swap:function(e,t,i){var n,s,a={};for(s in t)a[s]=e.style[s],e.style[s]=t[s];n=i.call(e);for(s in t)e.style[s]=a[s];return n}}),H.curCSS=H.css,N.defaultView&&N.defaultView.getComputedStyle&&(Ae=function(e,t){var i,n,s,a,r=e.style;return t=t.replace(Pe,"-$1").toLowerCase(),(n=e.ownerDocument.defaultView)&&(s=n.getComputedStyle(e,null))&&(i=s.getPropertyValue(t),""!==i||H.contains(e.ownerDocument.documentElement,e)||(i=H.style(e,t))),!H.support.pixelMargin&&s&&Oe.test(t)&&Fe.test(i)&&(a=r.width,r.width=i,i=s.width,r.width=a),i}),N.documentElement.currentStyle&&(Ee=function(e,t){var i,n,s,a=e.currentStyle&&e.currentStyle[t],r=e.style;return null==a&&r&&(s=r[t])&&(a=s),Fe.test(a)&&(i=r.left,n=e.runtimeStyle&&e.runtimeStyle.left,n&&(e.runtimeStyle.left=e.currentStyle.left),r.left="fontSize"===t?"1em":a,a=r.pixelLeft+"px",r.left=i,n&&(e.runtimeStyle.left=n)),""===a?"auto":a}),Ie=Ae||Ee,H.each(["height","width"],function(e,t){H.cssHooks[t]={get:function(e,i,n){return i?0!==e.offsetWidth?_(e,t,n):H.swap(e,ze,function(){return _(e,t,n)}):void 0},set:function(e,t){return He.test(t)?t+"px":t}}}),H.support.opacity||(H.cssHooks.opacity={get:function(e,t){return Me.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var i=e.style,n=e.currentStyle,s=H.isNumeric(t)?"alpha(opacity="+100*t+")":"",a=n&&n.filter||i.filter||"";i.zoom=1,t>=1&&""===H.trim(a.replace(Ne,""))&&(i.removeAttribute("filter"),n&&!n.filter)||(i.filter=Ne.test(a)?a.replace(Ne,s):a+" "+s)}}),H(function(){H.support.reliableMarginRight||(H.cssHooks.marginRight={get:function(e,t){return H.swap(e,{display:"inline-block"},function(){return t?Ie(e,"margin-right"):e.style.marginRight})}})}),H.expr&&H.expr.filters&&(H.expr.filters.hidden=function(e){var t=e.offsetWidth,i=e.offsetHeight;return 0===t&&0===i||!H.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||H.css(e,"display"))},H.expr.filters.visible=function(e){return!H.expr.filters.hidden(e)}),H.each({margin:"",padding:"",border:"Width"},function(e,t){H.cssHooks[e+t]={expand:function(i){var n,s="string"==typeof i?i.split(" "):[i],a={};for(n=0;4>n;n++)a[e+$e[n]+t]=s[n]||s[n-2]||s[0];return a}}});var Re,We,qe=/%20/g,Be=/\[\]$/,Ue=/\r?\n/g,Qe=/#.*$/,Ve=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ye=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Xe=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ke=/^(?:GET|HEAD)$/,Ge=/^\/\//,Je=/\?/,Ze=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,et=/^(?:select|textarea)/i,tt=/\s+/,it=/([?&])_=[^&]*/,nt=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,st=H.fn.load,at={},rt={},ot=["*/"]+["*"];try{Re=P.href}catch(lt){Re=N.createElement("a"),Re.href="",Re=Re.href}We=nt.exec(Re.toLowerCase())||[],H.fn.extend({load:function(e,i,n){if("string"!=typeof e&&st)return st.apply(this,arguments);if(!this.length)return this;var s=e.indexOf(" ");if(s>=0){var a=e.slice(s,e.length);e=e.slice(0,s)}var r="GET";i&&(H.isFunction(i)?(n=i,i=t):"object"==typeof i&&(i=H.param(i,H.ajaxSettings.traditional),r="POST"));var o=this;return H.ajax({url:e,type:r,dataType:"html",data:i,complete:function(e,t,i){i=e.responseText,e.isResolved()&&(e.done(function(e){i=e}),o.html(a?H("<div>").append(i.replace(Ze,"")).find(a):i)),n&&o.each(n,[i,t,e])}}),this},serialize:function(){return H.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?H.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||et.test(this.nodeName)||Ye.test(this.type))}).map(function(e,t){var i=H(this).val();return null==i?null:H.isArray(i)?H.map(i,function(e,i){return{name:t.name,value:e.replace(Ue,"\r\n")}}):{name:t.name,value:i.replace(Ue,"\r\n")}}).get()}}),H.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){H.fn[t]=function(e){return this.on(t,e)}}),H.each(["get","post"],function(e,i){H[i]=function(e,n,s,a){return H.isFunction(n)&&(a=a||s,s=n,n=t),H.ajax({type:i,url:e,data:n,success:s,dataType:a})}}),H.extend({getScript:function(e,i){return H.get(e,t,i,"script")},getJSON:function(e,t,i){return H.get(e,t,i,"json")},ajaxSetup:function(e,t){return t?x(e,H.ajaxSettings):(t=e,e=H.ajaxSettings),x(e,t),e},ajaxSettings:{url:Re,isLocal:Xe.test(We[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ot},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":H.parseJSON,"text xml":H.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:y(at),ajaxTransport:y(rt),ajax:function(e,i){function n(e,i,n,r){if(2!==x){x=2,l&&clearTimeout(l),o=t,a=r||"",w.readyState=e>0?4:0;var h,d,_,y,b,C=i,T=n?k(u,w,n):t;if(e>=200&&300>e||304===e)if(u.ifModified&&((y=w.getResponseHeader("Last-Modified"))&&(H.lastModified[s]=y),(b=w.getResponseHeader("Etag"))&&(H.etag[s]=b)),304===e)C="notmodified",h=!0;else try{d=j(u,T),C="success",h=!0}catch(S){C="parsererror",_=S}else _=C,(!C||e)&&(C="error",0>e&&(e=0));w.status=e,w.statusText=""+(i||C),h?g.resolveWith(p,[d,C,w]):g.rejectWith(p,[w,C,_]),w.statusCode(v),v=t,c&&f.trigger("ajax"+(h?"Success":"Error"),[w,u,h?d:_]),m.fireWith(p,[w,C]),c&&(f.trigger("ajaxComplete",[w,u]),--H.active||H.event.trigger("ajaxStop"))}}"object"==typeof e&&(i=e,e=t),i=i||{};var s,a,r,o,l,h,c,d,u=H.ajaxSetup({},i),p=u.context||u,f=p!==u&&(p.nodeType||p instanceof H)?H(p):H.event,g=H.Deferred(),m=H.Callbacks("once memory"),v=u.statusCode||{},_={},y={},x=0,w={readyState:0,setRequestHeader:function(e,t){if(!x){var i=e.toLowerCase();e=y[i]=y[i]||e,_[e]=t}return this},getAllResponseHeaders:function(){return 2===x?a:null},getResponseHeader:function(e){var i;if(2===x){if(!r)for(r={};i=Ve.exec(a);)r[i[1].toLowerCase()]=i[2];i=r[e.toLowerCase()]}return i===t?null:i},overrideMimeType:function(e){return x||(u.mimeType=e),this},abort:function(e){return e=e||"abort",o&&o.abort(e),n(0,e),this}};if(g.promise(w),w.success=w.done,w.error=w.fail,w.complete=m.add,w.statusCode=function(e){if(e){var t;if(2>x)for(t in e)v[t]=[v[t],e[t]];else t=e[w.status],w.then(t,t)}return this},u.url=((e||u.url)+"").replace(Qe,"").replace(Ge,We[1]+"//"),u.dataTypes=H.trim(u.dataType||"*").toLowerCase().split(tt),null==u.crossDomain&&(h=nt.exec(u.url.toLowerCase()),u.crossDomain=!(!h||h[1]==We[1]&&h[2]==We[2]&&(h[3]||("http:"===h[1]?80:443))==(We[3]||("http:"===We[1]?80:443)))),u.data&&u.processData&&"string"!=typeof u.data&&(u.data=H.param(u.data,u.traditional)),b(at,u,i,w),2===x)return!1;if(c=u.global,u.type=u.type.toUpperCase(),u.hasContent=!Ke.test(u.type),c&&0===H.active++&&H.event.trigger("ajaxStart"),!u.hasContent&&(u.data&&(u.url+=(Je.test(u.url)?"&":"?")+u.data,delete u.data),s=u.url,u.cache===!1)){var C=H.now(),T=u.url.replace(it,"$1_="+C);u.url=T+(T===u.url?(Je.test(u.url)?"&":"?")+"_="+C:"")}(u.data&&u.hasContent&&u.contentType!==!1||i.contentType)&&w.setRequestHeader("Content-Type",u.contentType),u.ifModified&&(s=s||u.url,H.lastModified[s]&&w.setRequestHeader("If-Modified-Since",H.lastModified[s]),H.etag[s]&&w.setRequestHeader("If-None-Match",H.etag[s])),w.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+ot+"; q=0.01":""):u.accepts["*"]);for(d in u.headers)w.setRequestHeader(d,u.headers[d]);if(u.beforeSend&&(u.beforeSend.call(p,w,u)===!1||2===x))return w.abort(),!1;for(d in{success:1,error:1,complete:1})w[d](u[d]);if(o=b(rt,u,i,w)){w.readyState=1,c&&f.trigger("ajaxSend",[w,u]),u.async&&u.timeout>0&&(l=setTimeout(function(){w.abort("timeout")},u.timeout));try{x=1,o.send(_,n)}catch(S){if(!(2>x))throw S;n(-1,S)}}else n(-1,"No Transport");return w},param:function(e,i){var n=[],s=function(e,t){t=H.isFunction(t)?t():t,n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(i===t&&(i=H.ajaxSettings.traditional),H.isArray(e)||e.jquery&&!H.isPlainObject(e))H.each(e,function(){s(this.name,this.value)});else for(var a in e)w(a,e[a],i,s);return n.join("&").replace(qe,"+")}}),H.extend({active:0,lastModified:{},etag:{}});var ht=H.now(),ct=/(\=)\?(&|$)|\?\?/i;H.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return H.expando+"_"+ht++}}),H.ajaxPrefilter("json jsonp",function(t,i,n){var s="string"==typeof t.data&&/^application\/x\-www\-form\-urlencoded/.test(t.contentType);if("jsonp"===t.dataTypes[0]||t.jsonp!==!1&&(ct.test(t.url)||s&&ct.test(t.data))){var a,r=t.jsonpCallback=H.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,o=e[r],l=t.url,h=t.data,c="$1"+r+"$2";return t.jsonp!==!1&&(l=l.replace(ct,c),t.url===l&&(s&&(h=h.replace(ct,c)),t.data===h&&(l+=(/\?/.test(l)?"&":"?")+t.jsonp+"="+r))),t.url=l,t.data=h,e[r]=function(e){a=[e]},n.always(function(){e[r]=o,a&&H.isFunction(o)&&e[r](a[0])}),t.converters["script json"]=function(){return a||H.error(r+" was not called"),a[0]},t.dataTypes[0]="json","script"}}),H.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return H.globalEval(e),e}}}),H.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),H.ajaxTransport("script",function(e){if(e.crossDomain){var i,n=N.head||N.getElementsByTagName("head")[0]||N.documentElement;return{send:function(s,a){i=N.createElement("script"),i.async="async",e.scriptCharset&&(i.charset=e.scriptCharset),i.src=e.url,i.onload=i.onreadystatechange=function(e,s){(s||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,n&&i.parentNode&&n.removeChild(i),i=t,s||a(200,"success"))},n.insertBefore(i,n.firstChild)},abort:function(){i&&i.onload(0,1)}}}});var dt,ut=e.ActiveXObject?function(){for(var e in dt)dt[e](0,1)}:!1,pt=0;H.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&C()||T()}:C,function(e){H.extend(H.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(H.ajaxSettings.xhr()),H.support.ajax&&H.ajaxTransport(function(i){if(!i.crossDomain||H.support.cors){var n;return{send:function(s,a){var r,o,l=i.xhr();if(i.username?l.open(i.type,i.url,i.async,i.username,i.password):l.open(i.type,i.url,i.async),i.xhrFields)for(o in i.xhrFields)l[o]=i.xhrFields[o];i.mimeType&&l.overrideMimeType&&l.overrideMimeType(i.mimeType),i.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest");try{for(o in s)l.setRequestHeader(o,s[o])}catch(h){}l.send(i.hasContent&&i.data||null),n=function(e,s){var o,h,c,d,u;try{if(n&&(s||4===l.readyState))if(n=t,r&&(l.onreadystatechange=H.noop,ut&&delete dt[r]),s)4!==l.readyState&&l.abort();else{o=l.status,c=l.getAllResponseHeaders(),d={},u=l.responseXML,u&&u.documentElement&&(d.xml=u);try{d.text=l.responseText}catch(e){}try{h=l.statusText}catch(p){h=""}o||!i.isLocal||i.crossDomain?1223===o&&(o=204):o=d.text?200:404}}catch(f){s||a(-1,f)}d&&a(o,h,d,c)},i.async&&4!==l.readyState?(r=++pt,ut&&(dt||(dt={},H(e).unload(ut)),dt[r]=n),l.onreadystatechange=n):n()},abort:function(){n&&n(0,1)}}}});var ft,gt,mt,vt,_t={},yt=/^(?:toggle|show|hide)$/,bt=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,xt=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];H.fn.extend({show:function(e,t,i){var n,s;if(e||0===e)return this.animate(I("show",3),e,t,i);for(var a=0,r=this.length;r>a;a++)n=this[a],n.style&&(s=n.style.display,H._data(n,"olddisplay")||"none"!==s||(s=n.style.display=""),(""===s&&"none"===H.css(n,"display")||!H.contains(n.ownerDocument.documentElement,n))&&H._data(n,"olddisplay",A(n.nodeName)));for(a=0;r>a;a++)n=this[a],n.style&&(s=n.style.display,(""===s||"none"===s)&&(n.style.display=H._data(n,"olddisplay")||""));return this},hide:function(e,t,i){if(e||0===e)return this.animate(I("hide",3),e,t,i);for(var n,s,a=0,r=this.length;r>a;a++)n=this[a],n.style&&(s=H.css(n,"display"),"none"===s||H._data(n,"olddisplay")||H._data(n,"olddisplay",s));for(a=0;r>a;a++)this[a].style&&(this[a].style.display="none");return this},_toggle:H.fn.toggle,toggle:function(e,t,i){var n="boolean"==typeof e;return H.isFunction(e)&&H.isFunction(t)?this._toggle.apply(this,arguments):null==e||n?this.each(function(){var t=n?e:H(this).is(":hidden");H(this)[t?"show":"hide"]()}):this.animate(I("toggle",3),e,t,i),this},fadeTo:function(e,t,i,n){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:t},e,i,n)},animate:function(e,t,i,n){function s(){a.queue===!1&&H._mark(this);var t,i,n,s,r,o,l,h,c,d,u,p=H.extend({},a),f=1===this.nodeType,g=f&&H(this).is(":hidden");p.animatedProperties={};for(n in e)if(t=H.camelCase(n),n!==t&&(e[t]=e[n],delete e[n]),(r=H.cssHooks[t])&&"expand"in r){o=r.expand(e[t]),delete e[t];for(n in o)n in e||(e[n]=o[n])}for(t in e){if(i=e[t],H.isArray(i)?(p.animatedProperties[t]=i[1],i=e[t]=i[0]):p.animatedProperties[t]=p.specialEasing&&p.specialEasing[t]||p.easing||"swing","hide"===i&&g||"show"===i&&!g)return p.complete.call(this);!f||"height"!==t&&"width"!==t||(p.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],"inline"===H.css(this,"display")&&"none"===H.css(this,"float")&&(H.support.inlineBlockNeedsLayout&&"inline"!==A(this.nodeName)?this.style.zoom=1:this.style.display="inline-block"))}null!=p.overflow&&(this.style.overflow="hidden");for(n in e)s=new H.fx(this,p,n),i=e[n],yt.test(i)?(u=H._data(this,"toggle"+n)||("toggle"===i?g?"show":"hide":0),u?(H._data(this,"toggle"+n,"show"===u?"hide":"show"),s[u]()):s[i]()):(l=bt.exec(i),h=s.cur(),l?(c=parseFloat(l[2]),d=l[3]||(H.cssNumber[n]?"":"px"),"px"!==d&&(H.style(this,n,(c||1)+d),h=(c||1)/s.cur()*h,H.style(this,n,h+d)),l[1]&&(c=("-="===l[1]?-1:1)*c+h),s.custom(h,c,d)):s.custom(h,i,""));return!0}var a=H.speed(t,i,n);return H.isEmptyObject(e)?this.each(a.complete,[!1]):(e=H.extend({},e),a.queue===!1?this.each(s):this.queue(a.queue,s))},stop:function(e,i,n){return"string"!=typeof e&&(n=i,i=e,e=t),i&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){function t(e,t,i){var s=t[i];H.removeData(e,i,!0),s.stop(n)}var i,s=!1,a=H.timers,r=H._data(this);if(n||H._unmark(!0,this),null==e)for(i in r)r[i]&&r[i].stop&&i.indexOf(".run")===i.length-4&&t(this,r,i);else r[i=e+".run"]&&r[i].stop&&t(this,r,i);for(i=a.length;i--;)a[i].elem!==this||null!=e&&a[i].queue!==e||(n?a[i](!0):a[i].saveState(),s=!0,a.splice(i,1));n&&s||H.dequeue(this,e)})}}),H.each({slideDown:I("show",1),slideUp:I("hide",1),slideToggle:I("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){H.fn[e]=function(e,i,n){return this.animate(t,e,i,n)}}),H.extend({speed:function(e,t,i){var n=e&&"object"==typeof e?H.extend({},e):{complete:i||!i&&t||H.isFunction(e)&&e,duration:e,easing:i&&t||t&&!H.isFunction(t)&&t};return n.duration=H.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in H.fx.speeds?H.fx.speeds[n.duration]:H.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(e){H.isFunction(n.old)&&n.old.call(this),n.queue?H.dequeue(this,n.queue):e!==!1&&H._unmark(this)},n},easing:{linear:function(e){return e},swing:function(e){return-Math.cos(e*Math.PI)/2+.5}},timers:[],fx:function(e,t,i){this.options=t,this.elem=e,this.prop=i,t.orig=t.orig||{}}}),H.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(H.fx.step[this.prop]||H.fx.step._default)(this)},cur:function(){if(null!=this.elem[this.prop]&&(!this.elem.style||null==this.elem.style[this.prop]))return this.elem[this.prop];var e,t=H.css(this.elem,this.prop);return isNaN(e=parseFloat(t))?t&&"auto"!==t?t:0:e},custom:function(e,i,n){function s(e){return a.step(e)}var a=this,r=H.fx;this.startTime=vt||S(),this.end=i,this.now=this.start=e,this.pos=this.state=0,this.unit=n||this.unit||(H.cssNumber[this.prop]?"":"px"),s.queue=this.options.queue,s.elem=this.elem,s.saveState=function(){H._data(a.elem,"fxshow"+a.prop)===t&&(a.options.hide?H._data(a.elem,"fxshow"+a.prop,a.start):a.options.show&&H._data(a.elem,"fxshow"+a.prop,a.end))},s()&&H.timers.push(s)&&!mt&&(mt=setInterval(r.tick,r.interval))},show:function(){var e=H._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||H.style(this.elem,this.prop),this.options.show=!0,e!==t?this.custom(this.cur(),e):this.custom("width"===this.prop||"height"===this.prop?1:0,this.cur()),H(this.elem).show()},hide:function(){this.options.orig[this.prop]=H._data(this.elem,"fxshow"+this.prop)||H.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(e){var t,i,n,s=vt||S(),a=!0,r=this.elem,o=this.options;if(e||s>=o.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),o.animatedProperties[this.prop]=!0;for(t in o.animatedProperties)o.animatedProperties[t]!==!0&&(a=!1);if(a){if(null==o.overflow||H.support.shrinkWrapBlocks||H.each(["","X","Y"],function(e,t){r.style["overflow"+t]=o.overflow[e];
}),o.hide&&H(r).hide(),o.hide||o.show)for(t in o.animatedProperties)H.style(r,t,o.orig[t]),H.removeData(r,"fxshow"+t,!0),H.removeData(r,"toggle"+t,!0);n=o.complete,n&&(o.complete=!1,n.call(r))}return!1}return o.duration==1/0?this.now=s:(i=s-this.startTime,this.state=i/o.duration,this.pos=H.easing[o.animatedProperties[this.prop]](this.state,i,0,1,o.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},H.extend(H.fx,{tick:function(){for(var e,t=H.timers,i=0;i<t.length;i++)e=t[i],e()||t[i]!==e||t.splice(i--,1);t.length||H.fx.stop()},interval:13,stop:function(){clearInterval(mt),mt=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){H.style(e.elem,"opacity",e.now)},_default:function(e){e.elem.style&&null!=e.elem.style[e.prop]?e.elem.style[e.prop]=e.now+e.unit:e.elem[e.prop]=e.now}}}),H.each(xt.concat.apply([],xt),function(e,t){t.indexOf("margin")&&(H.fx.step[t]=function(e){H.style(e.elem,t,Math.max(0,e.now)+e.unit)})}),H.expr&&H.expr.filters&&(H.expr.filters.animated=function(e){return H.grep(H.timers,function(t){return e===t.elem}).length});var wt,kt=/^t(?:able|d|h)$/i,jt=/^(?:body|html)$/i;wt="getBoundingClientRect"in N.documentElement?function(e,t,i,n){try{n=e.getBoundingClientRect()}catch(s){}if(!n||!H.contains(i,e))return n?{top:n.top,left:n.left}:{top:0,left:0};var a=t.body,r=E(t),o=i.clientTop||a.clientTop||0,l=i.clientLeft||a.clientLeft||0,h=r.pageYOffset||H.support.boxModel&&i.scrollTop||a.scrollTop,c=r.pageXOffset||H.support.boxModel&&i.scrollLeft||a.scrollLeft,d=n.top+h-o,u=n.left+c-l;return{top:d,left:u}}:function(e,t,i){for(var n,s=e.offsetParent,a=e,r=t.body,o=t.defaultView,l=o?o.getComputedStyle(e,null):e.currentStyle,h=e.offsetTop,c=e.offsetLeft;(e=e.parentNode)&&e!==r&&e!==i&&(!H.support.fixedPosition||"fixed"!==l.position);)n=o?o.getComputedStyle(e,null):e.currentStyle,h-=e.scrollTop,c-=e.scrollLeft,e===s&&(h+=e.offsetTop,c+=e.offsetLeft,!H.support.doesNotAddBorder||H.support.doesAddBorderForTableAndCells&&kt.test(e.nodeName)||(h+=parseFloat(n.borderTopWidth)||0,c+=parseFloat(n.borderLeftWidth)||0),a=s,s=e.offsetParent),H.support.subtractsBorderForOverflowNotVisible&&"visible"!==n.overflow&&(h+=parseFloat(n.borderTopWidth)||0,c+=parseFloat(n.borderLeftWidth)||0),l=n;return("relative"===l.position||"static"===l.position)&&(h+=r.offsetTop,c+=r.offsetLeft),H.support.fixedPosition&&"fixed"===l.position&&(h+=Math.max(i.scrollTop,r.scrollTop),c+=Math.max(i.scrollLeft,r.scrollLeft)),{top:h,left:c}},H.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){H.offset.setOffset(this,e,t)});var i=this[0],n=i&&i.ownerDocument;return n?i===n.body?H.offset.bodyOffset(i):wt(i,n,n.documentElement):null},H.offset={bodyOffset:function(e){var t=e.offsetTop,i=e.offsetLeft;return H.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(H.css(e,"marginTop"))||0,i+=parseFloat(H.css(e,"marginLeft"))||0),{top:t,left:i}},setOffset:function(e,t,i){var n=H.css(e,"position");"static"===n&&(e.style.position="relative");var s,a,r=H(e),o=r.offset(),l=H.css(e,"top"),h=H.css(e,"left"),c=("absolute"===n||"fixed"===n)&&H.inArray("auto",[l,h])>-1,d={},u={};c?(u=r.position(),s=u.top,a=u.left):(s=parseFloat(l)||0,a=parseFloat(h)||0),H.isFunction(t)&&(t=t.call(e,i,o)),null!=t.top&&(d.top=t.top-o.top+s),null!=t.left&&(d.left=t.left-o.left+a),"using"in t?t.using.call(e,d):r.css(d)}},H.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),i=this.offset(),n=jt.test(t[0].nodeName)?{top:0,left:0}:t.offset();return i.top-=parseFloat(H.css(e,"marginTop"))||0,i.left-=parseFloat(H.css(e,"marginLeft"))||0,n.top+=parseFloat(H.css(t[0],"borderTopWidth"))||0,n.left+=parseFloat(H.css(t[0],"borderLeftWidth"))||0,{top:i.top-n.top,left:i.left-n.left}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||N.body;e&&!jt.test(e.nodeName)&&"static"===H.css(e,"position");)e=e.offsetParent;return e})}}),H.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n=/Y/.test(i);H.fn[e]=function(s){return H.access(this,function(e,s,a){var r=E(e);return a===t?r?i in r?r[i]:H.support.boxModel&&r.document.documentElement[s]||r.document.body[s]:e[s]:void(r?r.scrollTo(n?H(r).scrollLeft():a,n?a:H(r).scrollTop()):e[s]=a)},e,s,arguments.length,null)}}),H.each({Height:"height",Width:"width"},function(e,i){var n="client"+e,s="scroll"+e,a="offset"+e;H.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(H.css(e,i,"padding")):this[i]():null},H.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(H.css(t,i,e?"margin":"border")):this[i]():null},H.fn[i]=function(e){return H.access(this,function(e,i,r){var o,l,h,c;return H.isWindow(e)?(o=e.document,l=o.documentElement[n],H.support.boxModel&&l||o.body&&o.body[n]||l):9===e.nodeType?(o=e.documentElement,o[n]>=o[s]?o[n]:Math.max(e.body[s],o[s],e.body[a],o[a])):r===t?(h=H.css(e,i),c=parseFloat(h),H.isNumeric(c)?c:h):void H(e).css(i,r)},i,e,arguments.length,null)}}),e.jQuery=e.$=H,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return H})}(window)},{}],26:[function(require,module,exports){var JSON=JSON||{};!function(){function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var i,n,s,a,r,o=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,r=[],"[object Array]"===Object.prototype.toString.apply(l)){for(a=l.length,i=0;a>i;i+=1)r[i]=str(i,l)||"null";return s=0===r.length?"[]":gap?"[\n"+gap+r.join(",\n"+gap)+"\n"+o+"]":"["+r.join(",")+"]",gap=o,s}if(rep&&"object"==typeof rep)for(a=rep.length,i=0;a>i;i+=1)n=rep[i],"string"==typeof n&&(s=str(n,l),s&&r.push(quote(n)+(gap?": ":":")+s));else for(n in l)Object.hasOwnProperty.call(l,n)&&(s=str(n,l),s&&r.push(quote(n)+(gap?": ":":")+s));return s=0===r.length?"{}":gap?"{\n"+gap+r.join(",\n"+gap)+"\n"+o+"}":"{"+r.join(",")+"}",gap=o,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(e){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(e){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={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,i){var n;if(gap="",indent="","number"==typeof i)for(n=0;i>n;n+=1)indent+=" ";else"string"==typeof i&&(indent=i);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var i,n,s=e[t];if(s&&"object"==typeof s)for(i in s)Object.hasOwnProperty.call(s,i)&&(n=walk(s,i),void 0!==n?s[i]=n:delete s[i]);return reviver.call(e,t,s)}var j;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\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,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},{}],27:[function(e,t,i){"use strict";!function(){if(!jQuery||!jQuery.jstree){var e=!1,t=!1,i=!1;!function(n){n.vakata={},n.vakata.css={get_css:function(e,t,i){e=e.toLowerCase();var n=i.cssRules||i.rules,s=0;do{if(n.length&&s>n.length+5)return!1;if(n[s].selectorText&&n[s].selectorText.toLowerCase()==e)return t===!0?(i.removeRule&&i.removeRule(s),i.deleteRule&&i.deleteRule(s),!0):n[s]}while(n[++s]);return!1},add_css:function(e,t){return n.jstree.css.get_css(e,!1,t)?!1:(t.insertRule?t.insertRule(e+" { }",0):t.addRule(e,null,0),n.vakata.css.get_css(e))},remove_css:function(e,t){return n.vakata.css.get_css(e,!0,t)},add_sheet:function(e){}};var s=[],a=-1,r={},o={};n.fn.jstree=function(e){var t="string"==typeof e,i=Array.prototype.slice.call(arguments,1),a=this;if(t){if("_"==e.substring(0,1))return a;this.each(function(){var t=s[n.data(this,"jstree_instance_id")],r=t&&n.isFunction(t[e])?t[e].apply(t,i):t;return"undefined"!=typeof r&&(0===e.indexOf("is_")||r!==!0&&r!==!1)?(a=r,!1):void 0})}else this.each(function(){var t=n.data(this,"jstree_instance_id"),a=[],o=e?n.extend({},!0,e):{},l=n(this),h=!1,c=[];a=a.concat(i),l.data("jstree")&&a.push(l.data("jstree")),o=a.length?n.extend.apply(null,[!0,o].concat(a)):o,"undefined"!=typeof t&&s[t]&&s[t].destroy(),t=parseInt(s.push({}),10)-1,n.data(this,"jstree_instance_id",t),o.plugins=n.isArray(o.plugins)?o.plugins:n.jstree.defaults.plugins.slice(),o.plugins.unshift("core"),o.plugins=o.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(","),h=n.extend(!0,{},n.jstree.defaults,o),h.plugins=o.plugins,n.each(r,function(e,t){-1===n.inArray(e,h.plugins)?(h[e]=null,delete h[e]):c.push(e)}),h.plugins=c,s[t]=new n.jstree._instance(t,n(this).addClass("jstree jstree-"+t),h),n.each(s[t]._get_settings().plugins,function(e,i){s[t].data[i]={}}),n.each(s[t]._get_settings().plugins,function(e,i){r[i]&&r[i].__init.apply(s[t])}),setTimeout(function(){s[t]&&s[t].init()},0)});return a},n.jstree={defaults:{plugins:[]},_focused:function(){return s[a]||null},_reference:function(e){if(s[e])return s[e];var t=n(e);return t.length||"string"!=typeof e||(t=n("#"+e)),t.length?s[t.closest(".jstree").data("jstree_instance_id")]||null:null},_instance:function(e,t,i){this.data={core:{}},this.get_settings=function(){return n.extend(!0,{},i)},this._get_settings=function(){return i},this.get_index=function(){return e},this.get_container=function(){return t},this.get_container_ul=function(){return t.children("ul:eq(0)")},this._set_settings=function(e){i=n.extend(!0,{},i,e)}},_fn:{},plugin:function(e,t){t=n.extend({},{__init:n.noop,__destroy:n.noop,_fn:{},defaults:!1},t),r[e]=t,n.jstree.defaults[e]=t.defaults,n.each(t._fn,function(t,i){i.plugin=e,i.old=n.jstree._fn[t],n.jstree._fn[t]=function(){var e,s=i,a=Array.prototype.slice.call(arguments),r=new n.Event("before.jstree"),o=!1;if(this.data.core.locked!==!0||"unlock"===t||"is_locked"===t){do{if(s&&s.plugin&&-1!==n.inArray(s.plugin,this._get_settings().plugins))break;s=s.old}while(s);if(s){if(0===t.indexOf("_"))e=s.apply(this,a);else{if(e=this.get_container().triggerHandler(r,{func:t,inst:this,args:a,plugin:s.plugin}),e===!1)return;"undefined"!=typeof e&&(a=e),e=s.apply(n.extend({},this,{__callback:function(e){this.get_container().triggerHandler(t+".jstree",{inst:this,args:a,rslt:e,rlbk:o})},__rollback:function(){return o=this.get_rollback()},__call_old:function(e){return s.old.apply(this,e?Array.prototype.slice.call(arguments,1):a)}}),a)}return e}}},n.jstree._fn[t].old=i.old,n.jstree._fn[t].plugin=e})},rollback:function(e){e&&(n.isArray(e)||(e=[e]),n.each(e,function(e,t){s[t.i].set_rollback(t.h,t.d)}))}},n.jstree._fn=n.jstree._instance.prototype={},n(function(){var s=navigator.userAgent.toLowerCase(),a=(s.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],r=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";if(/msie/.test(s)&&6==parseInt(a,10)){e=!0;try{document.execCommand("BackgroundImageCache",!1,!0)}catch(o){}r+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}/msie/.test(s)&&7==parseInt(a,10)&&(t=!0,r+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } "),!/compatible/.test(s)&&/mozilla/.test(s)&&parseFloat(a,10)<1.9&&(i=!0,r+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "),n.vakata.css.add_sheet({str:r,title:"jstree"})}),n.jstree.plugin("core",{__init:function(){this.data.core.locked=!1,this.data.core.to_open=this.get_settings().core.initially_open,this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:!1,animation:500,initially_open:[],initially_load:[],open_parents:!0,notify_plugins:!0,rtl:!1,load_open:!1,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus(),this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl"),this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>"+this._get_string("loading")+"</a></li></ul>"),this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18,this.get_container().delegate("li > ins","click.jstree",n.proxy(function(e){var t=n(e.target);this.toggle_node(t)},this)).bind("mousedown.jstree",n.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(e){var t;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(i){}}}),this._get_settings().core.notify_plugins&&this.get_container().bind("load_node.jstree",n.proxy(function(e,t){var i=this._get_node(t.rslt.obj),s=this;-1===i&&(i=this.get_container_ul()),i.length&&i.find("li").each(function(){var e=n(this);e.data("jstree")&&n.each(e.data("jstree"),function(t,i){s.data[t]&&n.isFunction(s["_"+t+"_notify"])&&s["_"+t+"_notify"].call(s,e,i)})})},this)),this._get_settings().core.load_open&&this.get_container().bind("load_node.jstree",n.proxy(function(e,t){var i=this._get_node(t.rslt.obj),s=this;-1===i&&(i=this.get_container_ul()),i.length&&i.find("li.jstree-open:not(:has(ul))").each(function(){s.load_node(this,n.noop,n.noop)})},this)),this.__callback(),this.load_node(-1,function(){this.loaded(),this.reload_nodes()})},destroy:function(){var e,t=this.get_index(),i=this._get_settings(),o=this;if(n.each(i.plugins,function(e,t){try{r[t].__destroy.apply(o)}catch(i){}}),this.__callback(),this.is_focused())for(e in s)if(s.hasOwnProperty(e)&&e!=t){s[e].set_focus();break}t===a&&(a=-1),this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree_instance_id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),n(document).unbind(".jstree-"+t).undelegate(".jstree-"+t),s[t]=null,delete s[t]},_core_notify:function(e,t){t.opened&&this.open_node(e,!1,!0)},lock:function(){this.data.core.locked=!0,this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7"),this.__callback({})},unlock:function(){this.data.core.locked=!1,this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1"),this.__callback({})},is_locked:function(){return this.data.core.locked},save_opened:function(){var e=this;this.data.core.to_open=[],this.get_container_ul().find("li.jstree-open").each(function(){this.id&&e.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))}),this.__callback(e.data.core.to_open)},save_loaded:function(){},reload_nodes:function(e){var t=this,i=!0,s=[],a=[];e||(this.data.core.reopen=!1,this.data.core.refreshing=!0,this.data.core.to_open=n.map(n.makeArray(this.data.core.to_open),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_load=n.map(n.makeArray(this.data.core.to_load),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_open.length&&(this.data.core.to_load=this.data.core.to_load.concat(this.data.core.to_open))),this.data.core.to_load.length&&(n.each(this.data.core.to_load,function(e,t){return"#"==t?!0:void(n(t).length?s.push(t):a.push(t))}),s.length&&(this.data.core.to_load=a,n.each(s,function(e,n){t._is_loaded(n)||(t.load_node(n,function(){t.reload_nodes(!0)},function(){t.reload_nodes(!0)}),i=!1)}))),this.data.core.to_open.length&&n.each(this.data.core.to_open,function(e,i){t.open_node(i,!1,!0)}),i&&(this.data.core.reopen&&clearTimeout(this.data.core.reopen),this.data.core.reopen=setTimeout(function(){t.__callback({},t)},50),this.data.core.refreshing=!1,this.reopen())},reopen:function(){var e=this;this.data.core.to_open.length&&n.each(this.data.core.to_open,function(t,i){e.open_node(i,!1,!0)}),this.__callback({})},refresh:function(e,t,i){var n=this;this.save_opened(),e||(e=-1),e=this._get_node(e),e||(e=-1),-1!==e?e.children("UL").remove():this.get_container_ul().empty(),this.load_node(e,function(){n.__callback({obj:e}),n.reload_nodes(),t&&t.call(this)},i)},loaded:function(){this.__callback()},set_focus:function(){if(!this.is_focused()){var e=n.jstree._focused();e&&e.unset_focus(),this.get_container().addClass("jstree-focused"),a=this.get_index(),this.__callback()}},is_focused:function(){return a==this.get_index()},unset_focus:function(){this.is_focused()&&(this.get_container().removeClass("jstree-focused"),a=-1),this.__callback()},_get_node:function(e){var t=n(e,this.get_container());return t.is(".jstree")||-1==e?-1:(t=t.closest("li",this.get_container()),t.length?t:!1)},_get_next:function(e,t){return e=this._get_node(e),-1===e?this.get_container().find("> ul > li:first-child"):e.length?t?e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):!1:e.hasClass("jstree-open")?e.find("li:eq(0)"):e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):e.parentsUntil(".jstree","li").next("li").eq(0):!1},_get_prev:function(e,t){if(e=this._get_node(e),-1===e)return this.get_container().find("> ul > li:last-child");if(!e.length)return!1;if(t)return e.prevAll("li").length>0?e.prevAll("li:eq(0)"):!1;if(e.prev("li").length){for(e=e.prev("li").eq(0);e.hasClass("jstree-open");)e=e.children("ul:eq(0)").children("li:last");return e}var i=e.parentsUntil(".jstree","li:eq(0)");return i.length?i:!1},_get_parent:function(e){if(e=this._get_node(e),-1==e||!e.length)return!1;var t=e.parentsUntil(".jstree","li:eq(0)");return t.length?t:-1},_get_children:function(e){return e=this._get_node(e),-1===e?this.get_container().children("ul:eq(0)").children("li"):e.length?e.children("ul:eq(0)").children("li"):!1},get_path:function(e,t){var i=[],n=this;return e=this._get_node(e),-1!==e&&e&&e.length?(e.parentsUntil(".jstree","li").each(function(){i.push(t?this.id:n.get_text(this))}),i.reverse(),i.push(t?e.attr("id"):this.get_text(e)),i):!1},_get_string:function(e){return this._get_settings().core.strings[e]||e},is_open:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-open")},is_closed:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-closed")},is_leaf:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-leaf")},correct_state:function(e){return e=this._get_node(e),e&&-1!==e?(e.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove(),void this.__callback({obj:e})):!1},open_node:function(t,i,n){if(t=this._get_node(t),!t.length)return!1;if(!t.hasClass("jstree-closed"))return i&&i.call(),!1;var s=n||e?0:this._get_settings().core.animation,a=this;this._is_loaded(t)?(this._get_settings().core.open_parents&&t.parentsUntil(".jstree",".jstree-closed").each(function(){a.open_node(this,!1,!0)}),s&&t.children("ul").css("display","none"),t.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"),s?t.children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",a.after_open(t)}):a.after_open(t),this.__callback({obj:t}),i&&i.call()):(t.children("a").addClass("jstree-loading"),this.load_node(t,function(){a.open_node(t,i,n)},i))},after_open:function(e){this.__callback({obj:e})},close_node:function(t,i){t=this._get_node(t);var n=i||e?0:this._get_settings().core.animation,s=this;return t.length&&t.hasClass("jstree-open")?(n&&t.children("ul").attr("style","display:block !important"),t.removeClass("jstree-open").addClass("jstree-closed"),n?t.children("ul").stop(!0,!0).slideUp(n,function(){this.style.display="",s.after_close(t)}):s.after_close(t),void this.__callback({obj:t})):!1},after_close:function(e){this.__callback({obj:e})},toggle_node:function(e){return e=this._get_node(e),e.hasClass("jstree-closed")?this.open_node(e):e.hasClass("jstree-open")?this.close_node(e):void 0},open_all:function(e,t,i){e=e?this._get_node(e):-1,e&&-1!==e||(e=this.get_container_ul()),i?e=e.find("li.jstree-closed"):(i=e,e=e.is(".jstree-closed")?e.find("li.jstree-closed").andSelf():e.find("li.jstree-closed"));var n=this;e.each(function(){var e=this;n._is_loaded(this)?n.open_node(this,!1,!t):n.open_node(this,function(){n.open_all(e,t,i)},!t)}),0===i.find("li.jstree-closed").length&&this.__callback({obj:i})},close_all:function(e,t){var i=this;e=e?this._get_node(e):this.get_container(),e&&-1!==e||(e=this.get_container_ul()),e.find("li.jstree-open").andSelf().each(function(){i.close_node(this,!t)}),this.__callback({obj:e})},clean_node:function(e){e=e&&-1!=e?n(e):this.get_container_ul(),e=e.is("li")?e.find("li").andSelf():e.find("li"),e.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed"),e.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove(),this.__callback({obj:e})},get_rollback:function(){return this.__callback(),{i:this.get_index(),h:this.get_container().children("ul").clone(!0),d:this.data}},set_rollback:function(e,t){this.get_container().empty().append(e),this.data=t,this.__callback()},load_node:function(e,t,i){this.__callback({obj:e})},_is_loaded:function(e){return!0},create_node:function(e,t,i,s,a){e=this._get_node(e),t="undefined"==typeof t?"last":t;var r,o=n("<li />"),l=this._get_settings().core;if(-1!==e&&!e.length)return!1;if(!a&&!this._is_loaded(e))return this.load_node(e,function(){this.create_node(e,t,i,s,!0)}),!1;switch(this.__rollback(),"string"==typeof i&&(i={data:i}),i||(i={}),i.attr&&o.attr(i.attr),i.metadata&&o.data(i.metadata),i.state&&o.addClass("jstree-"+i.state),i.data||(i.data=this._get_string("new_node")),n.isArray(i.data)||(r=i.data,i.data=[],i.data.push(r)),n.each(i.data,function(e,t){r=n("<a />"),n.isFunction(t)&&(t=t.call(this,i)),"string"==typeof t?r.attr("href","#")[l.html_titles?"html":"text"](t):(t.attr||(t.attr={}),t.attr.href||(t.attr.href="#"),r.attr(t.attr)[l.html_titles?"html":"text"](t.title),t.language&&r.addClass(t.language)),r.prepend("<ins class='jstree-icon'>&#160;</ins>"),!t.icon&&i.icon&&(t.icon=i.icon),t.icon&&(-1===t.icon.indexOf("/")?r.children("ins").addClass(t.icon):r.children("ins").css("background","url('"+t.icon+"') center center no-repeat")),o.append(r)}),o.prepend("<ins class='jstree-icon'>&#160;</ins>"),-1===e&&(e=this.get_container(),"before"===t&&(t="first"),"after"===t&&(t="last")),t){case"before":e.before(o),r=this._get_parent(e);break;case"after":e.after(o),r=this._get_parent(e);break;case"inside":case"first":e.children("ul").length||e.append("<ul />"),e.children("ul").prepend(o),r=e;break;case"last":e.children("ul").length||e.append("<ul />"),e.children("ul").append(o),r=e;break;default:e.children("ul").length||e.append("<ul />"),t||(t=0),r=e.children("ul").children("li").eq(t),r.length?r.before(o):e.children("ul").append(o),r=e}return(-1===r||r.get(0)===this.get_container().get(0))&&(r=-1),this.clean_node(r),this.__callback({obj:o,parent:r}),s&&s.call(this,o),o},get_text:function(e){if(e=this._get_node(e),!e.length)return!1;var t=this._get_settings().core.html_titles;return e=e.children("a:eq(0)"),t?(e=e.clone(),e.children("INS").remove(),e.html()):(e=e.contents().filter(function(){return 3==this.nodeType})[0],e?e.nodeValue:"")},set_text:function(e,t){if(e=this._get_node(e),!e.length)return!1;if(e=e.children("a:eq(0)"),this._get_settings().core.html_titles){var i=e.children("INS").clone();return e.html(t).prepend(i),this.__callback({obj:e,name:t}),!0}return e=e.contents().filter(function(){return 3==this.nodeType})[0],this.__callback({obj:e,name:t}),e.nodeValue=t},rename_node:function(e,t){e=this._get_node(e),this.__rollback(),e&&e.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:e,name:t})},delete_node:function(e){if(e=this._get_node(e),!e.length)return!1;this.__rollback();var t=this._get_parent(e),i=n([]),s=this;return e.each(function(){i=i.add(s._get_prev(this))}),e=e.detach(),-1!==t&&0===t.find("> ul > li").length&&t.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"),this.clean_node(t),this.__callback({obj:e,prev:i,parent:t}),e},prepare_move:function(e,t,i,s,a){var r={};if(r.ot=n.jstree._reference(e)||this,r.o=r.ot._get_node(e),r.r=-1===t?-1:this._get_node(t),r.p="undefined"==typeof i||i===!1?"last":i,!a&&o.o&&o.o[0]===r.o[0]&&o.r[0]===r.r[0]&&o.p===r.p)return this.__callback(o),void(s&&s.call(this,o));if(r.ot=n.jstree._reference(r.o)||this,r.rt=n.jstree._reference(r.r)||this,-1!==r.r&&r.r){if(!/^(before|after)$/.test(r.p)&&!this._is_loaded(r.r))return this.load_node(r.r,function(){this.prepare_move(e,t,i,s,!0)});switch(r.p){case"before":r.cp=r.r.index(),r.cr=r.rt._get_parent(r.r);break;case"after":r.cp=r.r.index()+1,r.cr=r.rt._get_parent(r.r);break;case"inside":case"first":r.cp=0,r.cr=r.r;break;case"last":r.cp=r.r.find(" > ul > li").length,r.cr=r.r;break;default:r.cp=r.p,r.cr=r.r}}else switch(r.cr=-1,r.p){case"first":case"before":case"inside":r.cp=0;break;case"after":case"last":r.cp=r.rt.get_container().find(" > ul > li").length;break;default:r.cp=r.p}r.np=-1==r.cr?r.rt.get_container():r.cr,r.op=r.ot._get_parent(r.o),r.cop=r.o.index(),-1===r.op&&(r.op=r.ot?r.ot.get_container():this.get_container()),!/^(before|after)$/.test(r.p)&&r.op&&r.np&&r.op[0]===r.np[0]&&r.o.index()<r.cp&&r.cp++,r.or=r.np.find(" > ul > li:nth-child("+(r.cp+1)+")"),o=r,this.__callback(o),s&&s.call(this,o)},check_move:function(){var e=o,t=!0,i=-1===e.r?this.get_container():e.r;if(!e||!e.o||e.or[0]===e.o[0])return!1;if(!e.cy){if(e.op&&e.np&&e.op[0]===e.np[0]&&e.cp-1===e.o.index())return!1;e.o.each(function(){return-1!==i.parentsUntil(".jstree","li").andSelf().index(this)?(t=!1,!1):void 0})}return t},move_node:function(e,t,i,s,a,r){if(!a)return this.prepare_move(e,t,i,function(e){this.move_node(e,!1,!1,s,!0,r)});if(s&&(o.cy=!0),!r&&!this.check_move())return!1;this.__rollback();var l=!1;s?(l=e.o.clone(!0),l.find("*[id]").andSelf().each(function(){this.id&&(this.id="copy_"+this.id)})):l=e.o,e.or.length?e.or.before(l):(e.np.children("ul").length||n("<ul />").appendTo(e.np),e.np.children("ul:eq(0)").append(l));try{e.ot.clean_node(e.op),e.rt.clean_node(e.np),e.op.find("> ul > li").length||e.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(h){}return s&&(o.cy=!0,o.oc=l),this.__callback(o),o},_get_move:function(){return o}}})}(jQuery),function(e){var t,i,n;e(function(){/msie/.test(navigator.userAgent.toLowerCase())?(i=e('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),n=e('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),t=i.width()-n.width(),i.add(n).remove()):(i=e("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:0}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200}),t=100-i.width(),i.parent().remove())}),e.jstree.plugin("ui",{__init:function(){this.data.ui.selected=e(),this.data.ui.last_selected=!1,this.data.ui.hovered=null,this.data.ui.to_select=this.get_settings().ui.initially_select,this.get_container().delegate("a","click.jstree",e.proxy(function(t){t.preventDefault(),t.currentTarget.blur(),e(t.currentTarget).hasClass("jstree-loading")||this.select_node(t.currentTarget,!0,t)},this)).delegate("a","mouseenter.jstree",e.proxy(function(t){e(t.currentTarget).hasClass("jstree-loading")||this.hover_node(t.target)},this)).delegate("a","mouseleave.jstree",e.proxy(function(t){e(t.currentTarget).hasClass("jstree-loading")||this.dehover_node(t.target)},this)).bind("reopen.jstree",e.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",e.proxy(function(){this.dehover_node(),this.save_selected()},this)).bind("set_rollback.jstree",e.proxy(function(){this.reselect()},this)).bind("close_node.jstree",e.proxy(function(t,i){var n=this._get_settings().ui,s=this._get_node(i.rslt.obj),a=s&&s.length?s.children("ul").find("a.jstree-clicked"):e(),r=this;n.selected_parent_close!==!1&&a.length&&a.each(function(){r.deselect_node(this),"select_parent"===n.selected_parent_close&&r.select_node(s)})},this)).bind("delete_node.jstree",e.proxy(function(e,t){var i=this._get_settings().ui.select_prev_on_delete,n=this._get_node(t.rslt.obj),s=n&&n.length?n.find("a.jstree-clicked"):[],a=this;s.each(function(){a.deselect_node(this)}),i&&s.length&&t.rslt.prev.each(function(){return this.parentNode?(a.select_node(this),!1):void 0})},this)).bind("move_node.jstree",e.proxy(function(e,t){t.rslt.cy&&t.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",select_range_modifier:"shift",selected_parent_close:"select_parent",selected_parent_open:!0,select_prev_on_delete:!0,disable_selecting_children:!1,initially_select:[]},_fn:{_get_node:function(t,i){if("undefined"==typeof t||null===t)return i?this.data.ui.selected:this.data.ui.last_selected;var n=e(t,this.get_container());return n.is(".jstree")||-1==t?-1:(n=n.closest("li",this.get_container()),n.length?n:!1)},_ui_notify:function(e,t){t.selected&&this.select_node(e,!1)},save_selected:function(){var e=this;this.data.ui.to_select=[],this.data.ui.selected.each(function(){this.id&&e.data.ui.to_select.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"));
}),this.__callback(this.data.ui.to_select)},reselect:function(){var t=this,i=this.data.ui.to_select;i=e.map(e.makeArray(i),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),e.each(i,function(e,i){i&&"#"!==i&&t.select_node(i)}),this.data.ui.selected=this.data.ui.selected.filter(function(){return this.parentNode}),this.__callback()},refresh:function(e){return this.save_selected(),this.__call_old()},hover_node:function(e){return e=this._get_node(e),e.length?(e.hasClass("jstree-hovered")||this.dehover_node(),this.data.ui.hovered=e.children("a").addClass("jstree-hovered").parent(),this._fix_scroll(e),void this.__callback({obj:e})):!1},dehover_node:function(){var e,t=this.data.ui.hovered;return t&&t.length?(e=t.children("a").removeClass("jstree-hovered").parent(),this.data.ui.hovered[0]===e[0]&&(this.data.ui.hovered=null),void this.__callback({obj:t})):!1},select_node:function(e,t,i){if(e=this._get_node(e),-1==e||!e||!e.length)return!1;var n=this._get_settings().ui,s="on"==n.select_multiple_modifier||n.select_multiple_modifier!==!1&&i&&i[n.select_multiple_modifier+"Key"],a=n.select_range_modifier!==!1&&i&&i[n.select_range_modifier+"Key"]&&this.data.ui.last_selected&&this.data.ui.last_selected[0]!==e[0]&&this.data.ui.last_selected.parent()[0]===e.parent()[0],r=this.is_selected(e),o=!0,l=this;if(t){if(n.disable_selecting_children&&s&&(e.parentsUntil(".jstree","li").children("a.jstree-clicked").length||e.children("ul").find("a.jstree-clicked:eq(0)").length))return!1;switch(o=!1,!0){case a:this.data.ui.last_selected.addClass("jstree-last-selected"),e=e[e.index()<this.data.ui.last_selected.index()?"nextUntil":"prevUntil"](".jstree-last-selected").andSelf(),-1==n.select_limit||e.length<n.select_limit?(this.data.ui.last_selected.removeClass("jstree-last-selected"),this.data.ui.selected.each(function(){this!==l.data.ui.last_selected[0]&&l.deselect_node(this)}),r=!1,o=!0):o=!1;break;case r&&!s:this.deselect_all(),r=!1,o=!0;break;case!r&&!s:(-1==n.select_limit||n.select_limit>0)&&(this.deselect_all(),o=!0);break;case r&&s:this.deselect_node(e);break;case!r&&s:(-1==n.select_limit||this.data.ui.selected.length+1<=n.select_limit)&&(o=!0)}}o&&!r&&(a||(this.data.ui.last_selected=e),e.children("a").addClass("jstree-clicked"),n.selected_parent_open&&e.parents(".jstree-closed").each(function(){l.open_node(this,!1,!0)}),this.data.ui.selected=this.data.ui.selected.add(e),this._fix_scroll(e.eq(0)),this.__callback({obj:e,e:i}))},_fix_scroll:function(e){var i,n=this.get_container()[0];if(n.scrollHeight>n.offsetHeight){if(e=this._get_node(e),!e||-1===e||!e.length||!e.is(":visible"))return;i=e.offset().top-this.get_container().offset().top,0>i&&(n.scrollTop=n.scrollTop+i-1),i+this.data.core.li_height+(n.scrollWidth>n.offsetWidth?t:0)>n.offsetHeight&&(n.scrollTop=n.scrollTop+(i-n.offsetHeight+this.data.core.li_height+1+(n.scrollWidth>n.offsetWidth?t:0)))}},deselect_node:function(e){return e=this._get_node(e),e.length?void(this.is_selected(e)&&(e.children("a").removeClass("jstree-clicked"),this.data.ui.selected=this.data.ui.selected.not(e),this.data.ui.last_selected.get(0)===e.get(0)&&(this.data.ui.last_selected=this.data.ui.selected.eq(0)),this.__callback({obj:e}))):!1},toggle_select:function(e){return e=this._get_node(e),e.length?void(this.is_selected(e)?this.deselect_node(e):this.select_node(e)):!1},is_selected:function(e){return this.data.ui.selected.index(this._get_node(e))>=0},get_selected:function(t){return t?e(t).find("a.jstree-clicked").parent():this.data.ui.selected},deselect_all:function(t){var i=t?e(t).find("a.jstree-clicked").parent():this.get_container().find("a.jstree-clicked").parent();i.children("a.jstree-clicked").removeClass("jstree-clicked"),this.data.ui.selected=e([]),this.data.ui.last_selected=!1,this.__callback({obj:i})}}}),e.jstree.defaults.plugins.push("ui")}(jQuery),function(e){e.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",e.proxy(function(e,t){if(this._get_settings().crrm.move.open_onmove){var i=this;t.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){i.open_node(this,!1,!0)})}},this))},defaults:{input_width_limit:200,move:{always_copy:!1,open_onmove:!0,default_position:"last",check_move:function(e){return!0}}},_fn:{_show_input:function(t,i){t=this._get_node(t);var n=this._get_settings().core.rtl,s=this._get_settings().crrm.input_width_limit,a=t.children("ins").width(),r=t.find("> a:visible > ins").width()*t.find("> a:visible > ins").length,o=this.get_text(t),l=e("<div />",{css:{position:"absolute",top:"-200px",left:n?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),h=t.css("position","relative").append(e("<input />",{value:o,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver",position:"absolute",left:n?"auto":a+r+4+"px",right:n?a+r+4+"px":"auto",top:"0px",height:this.data.core.li_height-2+"px",lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:e.proxy(function(){var e=t.children(".jstree-rename-input"),n=e.val();""===n&&(n=o),l.remove(),e.remove(),this.set_text(t,o),this.rename_node(t,n),i.call(this,t,n,o),t.css("position","")},this),keyup:function(e){var t=e.keyCode||e.which;return 27==t?(this.value=o,void this.blur()):13==t?void this.blur():void h.width(Math.min(l.text("pW"+this.value).width(),s))},keypress:function(e){var t=e.keyCode||e.which;return 13==t?!1:void 0}})).children(".jstree-rename-input");this.set_text(t,""),l.css({fontFamily:h.css("fontFamily")||"",fontSize:h.css("fontSize")||"",fontWeight:h.css("fontWeight")||"",fontStyle:h.css("fontStyle")||"",fontStretch:h.css("fontStretch")||"",fontVariant:h.css("fontVariant")||"",letterSpacing:h.css("letterSpacing")||"",wordSpacing:h.css("wordSpacing")||""}),h.width(Math.min(l.text("pW"+h[0].value).width(),s))[0].select()},rename:function(e){e=this._get_node(e),this.__rollback();var t=this.__callback;this._show_input(e,function(e,i,n){t.call(this,{obj:e,new_name:i,old_name:n})})},create:function(t,i,n,s,a){var r,o=this;return t=this._get_node(t),t||(t=-1),this.__rollback(),r=this.create_node(t,i,n,function(t){var i=this._get_parent(t),n=e(t).index();s&&s.call(this,t),i.length&&i.hasClass("jstree-closed")&&this.open_node(i,!1,!0),a?o.__callback({obj:t,name:this.get_text(t),parent:i,position:n}):this._show_input(t,function(e,t,s){o.__callback({obj:e,name:t,parent:i,position:n})})})},remove:function(e){e=this._get_node(e,!0);var t=this._get_parent(e),i=this._get_prev(e);this.__rollback(),e=this.delete_node(e),e!==!1&&this.__callback({obj:e,prev:i,parent:t})},check_move:function(){if(!this.__call_old())return!1;var e=this._get_settings().crrm.move;return e.check_move.call(this,this._get_move())?!0:!1},move_node:function(e,t,i,n,s,a){var r=this._get_settings().crrm.move;return s?((r.always_copy===!0||"multitree"===r.always_copy&&e.rt.get_index()!==e.ot.get_index())&&(n=!0),void this.__call_old(!0,e,t,i,n,!0,a)):("undefined"==typeof i&&(i=r.default_position),"inside"!==i||r.default_position.match(/^(before|after)$/)||(i=r.default_position),this.__call_old(!0,e,t,i,n,!1,a))},cut:function(e){return e=this._get_node(e,!0),e&&e.length?(this.data.crrm.cp_nodes=!1,this.data.crrm.ct_nodes=e,void this.__callback({obj:e})):!1},copy:function(e){return e=this._get_node(e,!0),e&&e.length?(this.data.crrm.ct_nodes=!1,this.data.crrm.cp_nodes=e,void this.__callback({obj:e})):!1},paste:function(e){if(e=this._get_node(e),!e||!e.length)return!1;var t=this.data.crrm.ct_nodes?this.data.crrm.ct_nodes:this.data.crrm.cp_nodes;return this.data.crrm.ct_nodes||this.data.crrm.cp_nodes?(this.data.crrm.ct_nodes&&(this.move_node(this.data.crrm.ct_nodes,e),this.data.crrm.ct_nodes=!1),this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,e,!1,!0),void this.__callback({obj:e,nodes:t})):!1}}})}(jQuery),function(e){var t=[];e.jstree._themes=!1,e.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",e.proxy(function(){var e=this._get_settings().themes;this.data.themes.dots=e.dots,this.data.themes.icons=e.icons,this.set_theme(e.theme,e.url)},this)).bind("loaded.jstree",e.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots(),this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:!1,dots:!0,icons:!0},_fn:{set_theme:function(i,n){return i?(n||(n=e.jstree._themes+i+"/style.css"),-1==e.inArray(n,t)&&(e.vakata.css.add_sheet({url:n}),t.push(n)),this.data.themes.theme!=i&&(this.get_container().removeClass("jstree-"+this.data.themes.theme),this.data.themes.theme=i),this.get_container().addClass("jstree-"+i),this.data.themes.dots?this.show_dots():this.hide_dots(),this.data.themes.icons?this.show_icons():this.hide_icons(),void this.__callback()):!1},get_theme:function(){return this.data.themes.theme},show_dots:function(){this.data.themes.dots=!0,this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=!1,this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=!0,this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=!1,this.get_container().children("ul").addClass("jstree-no-icons")},toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}}),e(function(){e.jstree._themes===!1&&e("script").each(function(){return this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)?(e.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/",!1):void 0}),e.jstree._themes===!1&&(e.jstree._themes="themes/")}),e.jstree.defaults.plugins.push("themes")}(jQuery),function(e){function t(t,i){var n,s=e.jstree._focused();return s&&s.data&&s.data.hotkeys&&s.data.hotkeys.enabled&&(n=s._get_settings().hotkeys[t])?n.call(s,i):void 0}var i=[];e.jstree.plugin("hotkeys",{__init:function(){if("undefined"==typeof e.hotkeys)throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";e.each(this._get_settings().hotkeys,function(n,s){s!==!1&&-1==e.inArray(n,i)&&(e(document).bind("keydown",n,function(e){return t(n,e)}),i.push(n))}),this.get_container().bind("lock.jstree",e.proxy(function(){this.data.hotkeys.enabled&&(this.data.hotkeys.enabled=!1,this.data.hotkeys.revert=!0)},this)).bind("unlock.jstree",e.proxy(function(){this.data.hotkeys.revert&&(this.data.hotkeys.enabled=!0)},this)),this.enable_hotkeys()},defaults:{up:function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_prev(e)),!1},"ctrl+up":function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_prev(e)),!1},"shift+up":function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_prev(e)),!1},down:function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_next(e)),!1},"ctrl+down":function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_next(e)),!1},"shift+down":function(){var e=this.data.ui.hovered||this.data.ui.last_selected||-1;return this.hover_node(this._get_next(e)),!1},left:function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&(e.hasClass("jstree-open")?this.close_node(e):this.hover_node(this._get_prev(e))),!1},"ctrl+left":function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&(e.hasClass("jstree-open")?this.close_node(e):this.hover_node(this._get_prev(e))),!1},"shift+left":function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&(e.hasClass("jstree-open")?this.close_node(e):this.hover_node(this._get_prev(e))),!1},right:function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&e.length&&(e.hasClass("jstree-closed")?this.open_node(e):this.hover_node(this._get_next(e))),!1},"ctrl+right":function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&e.length&&(e.hasClass("jstree-closed")?this.open_node(e):this.hover_node(this._get_next(e))),!1},"shift+right":function(){var e=this.data.ui.hovered||this.data.ui.last_selected;return e&&e.length&&(e.hasClass("jstree-closed")?this.open_node(e):this.hover_node(this._get_next(e))),!1},space:function(){return this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click(),!1},"ctrl+space":function(e){return e.type="click",this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(e),!1},"shift+space":function(e){return e.type="click",this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(e),!1},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled=!0},disable_hotkeys:function(){this.data.hotkeys.enabled=!1}}})}(jQuery),function(e){e.jstree.plugin("json_data",{__init:function(){var e=this._get_settings().json_data;e.progressive_unload&&this.get_container().bind("after_close.jstree",function(e,t){t.rslt.obj.children("ul").remove()})},defaults:{data:!1,ajax:!1,correct_state:!0,progressive_render:!1,progressive_unload:!1},_fn:{load_node:function(e,t,i){var n=this;this.load_node_json(e,function(){n.__callback({obj:n._get_node(e)}),t.call(this)},i)},_is_loaded:function(t){var i=this._get_settings().json_data;return t=this._get_node(t),-1==t||!t||!i.ajax&&!i.progressive_render&&!e.isFunction(i.data)||t.is(".jstree-open, .jstree-leaf")||t.children("ul").children("li").length>0},refresh:function(t){t=this._get_node(t);var i=this._get_settings().json_data;return t&&-1!==t&&i.progressive_unload&&(e.isFunction(i.data)||i.ajax)&&t.removeData("jstree_children"),this.__call_old()},load_node_json:function(t,i,n){var s,a=this.get_settings().json_data,r=function(){},o=function(){};if(t=this._get_node(t),t&&-1!==t&&(a.progressive_render||a.progressive_unload)&&!t.is(".jstree-open, .jstree-leaf")&&0===t.children("ul").children("li").length&&t.data("jstree_children"))return s=this._parse_json(t.data("jstree_children"),t),s&&(t.append(s),a.progressive_unload||t.removeData("jstree_children")),this.clean_node(t),void(i&&i.call(this));if(t&&-1!==t){if(t.data("jstree_is_loading"))return;t.data("jstree_is_loading",!0)}switch(!0){case!a.data&&!a.ajax:throw"Neither data nor ajax settings supplied.";case e.isFunction(a.data):a.data.call(this,t,e.proxy(function(e){e=this._parse_json(e,t),e?(-1!==t&&t?(t.append(e).children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(e.children()),this.clean_node(t),i&&i.call(this)):(-1!==t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),a.correct_state&&this.correct_state(t)):a.correct_state&&this.get_container().children("ul").empty(),n&&n.call(this))},this));break;case!!a.data&&!a.ajax||!!a.data&&!!a.ajax&&(!t||-1===t):t&&-1!=t||(s=this._parse_json(a.data,t),s?(this.get_container().children("ul").empty().append(s.children()),this.clean_node()):a.correct_state&&this.get_container().children("ul").empty()),i&&i.call(this);break;case!a.data&&!!a.ajax||!!a.data&&!!a.ajax&&t&&-1!==t:r=function(e,i,s){var r=this.get_settings().json_data.ajax.error;r&&r.call(this,e,i,s),-1!=t&&t.length?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),"success"===i&&a.correct_state&&this.correct_state(t)):"success"===i&&a.correct_state&&this.get_container().children("ul").empty(),n&&n.call(this)},o=function(n,s,o){var l=this.get_settings().json_data.ajax.success;return l&&(n=l.call(this,n,s,o)||n),""===n||n&&n.toString&&""===n.toString().replace(/^[\s\n]+$/,"")||!e.isArray(n)&&!e.isPlainObject(n)?r.call(this,o,s,""):(n=this._parse_json(n,t),void(n?(-1!==t&&t?(t.append(n).children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(n.children()),this.clean_node(t),i&&i.call(this)):-1!==t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),a.correct_state&&(this.correct_state(t),i&&i.call(this))):a.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this))))},a.ajax.context=this,a.ajax.error=r,a.ajax.success=o,a.ajax.dataType||(a.ajax.dataType="json"),e.isFunction(a.ajax.url)&&(a.ajax.url=a.ajax.url.call(this,t)),e.isFunction(a.ajax.data)&&(a.ajax.data=a.ajax.data.call(this,t)),e.ajax(a.ajax)}},_parse_json:function(t,i,n){var s,a,r,o,l,h=!1,c=this._get_settings(),d=c.json_data,u=c.core.html_titles;if(!t)return h;if(d.progressive_unload&&i&&-1!==i&&i.data("jstree_children",h),e.isArray(t)){if(h=e(),!t.length)return!1;for(a=0,r=t.length;r>a;a++)s=this._parse_json(t[a],i,!0),s.length&&(h=h.add(s))}else{if("string"==typeof t&&(t={data:t}),!t.data&&""!==t.data)return h;h=e("<li />"),t.attr&&h.attr(t.attr),t.metadata&&h.data(t.metadata),t.state&&h.addClass("jstree-"+t.state),e.isArray(t.data)||(s=t.data,t.data=[],t.data.push(s)),e.each(t.data,function(i,n){s=e("<a />"),e.isFunction(n)&&(n=n.call(this,t)),"string"==typeof n?s.attr("href","#")[u?"html":"text"](n):(n.attr||(n.attr={}),n.attr.href||(n.attr.href="#"),s.attr(n.attr)[u?"html":"text"](n.title),n.language&&s.addClass(n.language)),s.prepend("<ins class='jstree-icon'>&#160;</ins>"),!n.icon&&t.icon&&(n.icon=t.icon),n.icon&&(-1===n.icon.indexOf("/")?s.children("ins").addClass(n.icon):s.children("ins").css("background","url('"+n.icon+"') center center no-repeat")),h.append(s)}),h.prepend("<ins class='jstree-icon'>&#160;</ins>"),t.children&&(d.progressive_render&&"open"!==t.state?h.addClass("jstree-closed").data("jstree_children",t.children):(d.progressive_unload&&h.data("jstree_children",t.children),e.isArray(t.children)&&t.children.length&&(s=this._parse_json(t.children,i,!0),s.length&&(l=e("<ul />"),l.append(s),h.append(l)))))}return n||(o=e("<ul />"),o.append(h),h=o),h},get_json:function(t,i,n,s){var a,r,o,l,h,c,d=[],u=this._get_settings(),p=this;return t=this._get_node(t),t&&-1!==t||(t=this.get_container().find("> ul > li")),i=e.isArray(i)?i:["id","class"],!s&&this.data.types&&i.push(u.types.type_attr),n=e.isArray(n)?n:[],t.each(function(){o=e(this),a={data:[]},i.length&&(a.attr={}),e.each(i,function(e,t){r=o.attr(t),r&&r.length&&r.replace(/jstree[^ ]*/gi,"").length&&(a.attr[t]=(" "+r).replace(/ jstree[^ ]*/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,""))}),o.hasClass("jstree-open")&&(a.state="open"),o.hasClass("jstree-closed")&&(a.state="closed"),o.data()&&(a.metadata=o.data()),l=o.children("a"),l.each(function(){h=e(this),n.length||-1!==e.inArray("languages",u.plugins)||h.children("ins").get(0).style.backgroundImage.length||h.children("ins").get(0).className&&h.children("ins").get(0).className.replace(/jstree[^ ]*|$/gi,"").length?(c=!1,-1!==e.inArray("languages",u.plugins)&&e.isArray(u.languages)&&u.languages.length&&e.each(u.languages,function(e,t){return h.hasClass(t)?(c=t,!1):void 0}),r={attr:{},title:p.get_text(h,c)},e.each(n,function(e,t){r.attr[t]=(" "+(h.attr(t)||"")).replace(/ jstree[^ ]*/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,"")}),-1!==e.inArray("languages",u.plugins)&&e.isArray(u.languages)&&u.languages.length&&e.each(u.languages,function(e,t){return h.hasClass(t)?(r.language=t,!0):void 0}),h.children("ins").get(0).className.replace(/jstree[^ ]*|$/gi,"").replace(/^\s+$/gi,"").length&&(r.icon=h.children("ins").get(0).className.replace(/jstree[^ ]*|$/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,"")),h.children("ins").get(0).style.backgroundImage.length&&(r.icon=h.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")",""))):r=p.get_text(h),l.length>1?a.data.push(r):a.data=r}),o=o.find("> ul > li"),o.length&&(a.children=p.get_json(o,i,n,!0)),d.push(a)}),d}}})}(jQuery),function(e){var t=!1;e.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(i){var n=this._get_settings().languages,s=!1,a=".jstree-"+this.get_index()+" a";if(!e.isArray(n)||0===n.length)return!1;if(-1==e.inArray(i,n)){if(!n[i])return!1;i=n[i]}return i==this.data.languages.current_language?!0:(s=e.vakata.css.get_css(a+"."+this.data.languages.current_language,!1,t),s!==!1&&(s.style.display="none"),s=e.vakata.css.get_css(a+"."+i,!1,t),s!==!1&&(s.style.display=""),this.data.languages.current_language=i,this.__callback(i),!0)},get_lang:function(){return this.data.languages.current_language},_get_string:function(t,i){var n=this._get_settings().languages,s=this._get_settings().core.strings;return e.isArray(n)&&n.length&&(i=i&&-1!=e.inArray(i,n)?i:this.data.languages.current_language),s[i]&&s[i][t]?s[i][t]:s[t]?s[t]:t},get_text:function(t,i){if(t=this._get_node(t)||this.data.ui.last_selected,!t.size())return!1;var n=this._get_settings().languages,s=this._get_settings().core.html_titles;return e.isArray(n)&&n.length?(i=i&&-1!=e.inArray(i,n)?i:this.data.languages.current_language,t=t.children("a."+i)):t=t.children("a:eq(0)"),s?(t=t.clone(),t.children("INS").remove(),t.html()):(t=t.contents().filter(function(){return 3==this.nodeType})[0],t.nodeValue)},set_text:function(t,i,n){if(t=this._get_node(t)||this.data.ui.last_selected,!t.size())return!1;var s,a=this._get_settings().languages,r=this._get_settings().core.html_titles;return e.isArray(a)&&a.length?(n=n&&-1!=e.inArray(n,a)?n:this.data.languages.current_language,t=t.children("a."+n)):t=t.children("a:eq(0)"),r?(s=t.children("INS").clone(),t.html(i).prepend(s),this.__callback({obj:t,name:i,lang:n}),!0):(t=t.contents().filter(function(){return 3==this.nodeType})[0],this.__callback({obj:t,name:i,lang:n}),t.nodeValue=i)},_load_css:function(){var i,n=this._get_settings().languages,s="/* languages css */",a=".jstree-"+this.get_index()+" a";if(e.isArray(n)&&n.length){for(this.data.languages.current_language=n[0],i=0;i<n.length;i++)s+=a+"."+n[i]+" {",n[i]!=this.data.languages.current_language&&(s+=" display:none; "),s+=" } ";t=e.vakata.css.add_sheet({str:s,title:"jstree-languages"})}},create_node:function(t,i,n,s){var a=this.__call_old(!0,t,i,n,function(t){var i,n=this._get_settings().languages,a=t.children("a");if(e.isArray(n)&&n.length){for(i=0;i<n.length;i++)a.is("."+n[i])||t.append(a.eq(0).clone().removeClass(n.join(" ")).addClass(n[i]));a.not("."+n.join(", .")).remove()}s&&s.call(this,t)});return a}}})}(jQuery),function(e){e.jstree.plugin("cookies",{__init:function(){if("undefined"==typeof e.cookie)throw"jsTree cookie: jQuery cookie plugin not included.";var t,i=this._get_settings().cookies;i.save_loaded&&(t=e.cookie(i.save_loaded),t&&t.length&&(this.data.core.to_load=t.split(","))),i.save_opened&&(t=e.cookie(i.save_opened),t&&t.length&&(this.data.core.to_open=t.split(","))),i.save_selected&&(t=e.cookie(i.save_selected),t&&t.length&&this.data.ui&&(this.data.ui.to_select=t.split(","))),this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",e.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",e.proxy(function(e){this._get_settings().cookies.auto_save&&this.save_cookie((e.handleObj.namespace+e.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_loaded:"jstree_load",save_opened:"jstree_open",save_selected:"jstree_select",auto_save:!0,cookie_options:{}},_fn:{save_cookie:function(t){if(!this.data.core.refreshing){var i=this._get_settings().cookies;if(!t)return i.save_loaded&&(this.save_loaded(),e.cookie(i.save_loaded,this.data.core.to_load.join(","),i.cookie_options)),i.save_opened&&(this.save_opened(),e.cookie(i.save_opened,this.data.core.to_open.join(","),i.cookie_options)),void(i.save_selected&&this.data.ui&&(this.save_selected(),e.cookie(i.save_selected,this.data.ui.to_select.join(","),i.cookie_options)));switch(t){case"open_node":case"close_node":i.save_opened&&(this.save_opened(),e.cookie(i.save_opened,this.data.core.to_open.join(","),i.cookie_options)),i.save_loaded&&(this.save_loaded(),e.cookie(i.save_loaded,this.data.core.to_load.join(","),i.cookie_options));break;case"select_node":case"deselect_node":i.save_selected&&this.data.ui&&(this.save_selected(),e.cookie(i.save_selected,this.data.ui.to_select.join(","),i.cookie_options))}}}}})}(jQuery),function(e){e.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",e.proxy(function(e,t){var i=this._get_node(t.rslt.obj);i=-1===i?this.get_container().children("ul"):i.children("ul"),this.sort(i)},this)).bind("rename_node.jstree create_node.jstree create.jstree",e.proxy(function(e,t){this.sort(t.rslt.obj.parent())},this)).bind("move_node.jstree",e.proxy(function(e,t){var i=-1==t.rslt.np?this.get_container():t.rslt.np;this.sort(i.children("ul"))},this))},defaults:function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},_fn:{sort:function(t){var i=this._get_settings().sort,n=this;t.append(e.makeArray(t.children("li")).sort(e.proxy(i,n))),t.find("> li > ul").each(function(){n.sort(e(this))}),this.clean_node(t)}}})}(jQuery),function(e){var t=!1,i=!1,n=!1,s=!1,a=!1,r=!1,o=!1,l=!1,h=!1;e.vakata.dnd={is_down:!1,is_drag:!1,helper:!1,scroll_spd:10,init_x:0,init_y:0,threshold:5,helper_left:5,helper_top:10,user_data:{},drag_start:function(t,i,n){e.vakata.dnd.is_drag&&e.vakata.drag_stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.MozUserSelect="none")}catch(s){}return e.vakata.dnd.init_x=t.pageX,e.vakata.dnd.init_y=t.pageY,e.vakata.dnd.user_data=i,e.vakata.dnd.is_down=!0,e.vakata.dnd.helper=e("<div id='vakata-dragged' />").html(n),e(document).bind("mousemove",e.vakata.dnd.drag),e(document).bind("mouseup",e.vakata.dnd.drag_stop),!1},drag:function(t){if(e.vakata.dnd.is_down){if(!e.vakata.dnd.is_drag){if(!(Math.abs(t.pageX-e.vakata.dnd.init_x)>5||Math.abs(t.pageY-e.vakata.dnd.init_y)>5))return;e.vakata.dnd.helper.appendTo("body"),e.vakata.dnd.is_drag=!0,e(document).triggerHandler("drag_start.vakata",{event:t,data:e.vakata.dnd.user_data})}if("mousemove"===t.type){var i=e(document),n=i.scrollTop(),s=i.scrollLeft();t.pageY-n<20?(r&&"down"===o&&(clearInterval(r),r=!1),r||(o="up",r=setInterval(function(){e(document).scrollTop(e(document).scrollTop()-e.vakata.dnd.scroll_spd)},150))):r&&"up"===o&&(clearInterval(r),r=!1),e(window).height()-(t.pageY-n)<20?(r&&"up"===o&&(clearInterval(r),r=!1),r||(o="down",r=setInterval(function(){e(document).scrollTop(e(document).scrollTop()+e.vakata.dnd.scroll_spd)},150))):r&&"down"===o&&(clearInterval(r),r=!1),t.pageX-s<20?(a&&"right"===l&&(clearInterval(a),a=!1),a||(l="left",a=setInterval(function(){e(document).scrollLeft(e(document).scrollLeft()-e.vakata.dnd.scroll_spd)},150))):a&&"left"===l&&(clearInterval(a),a=!1),e(window).width()-(t.pageX-s)<20?(a&&"left"===l&&(clearInterval(a),a=!1),a||(l="right",a=setInterval(function(){e(document).scrollLeft(e(document).scrollLeft()+e.vakata.dnd.scroll_spd)},150))):a&&"right"===l&&(clearInterval(a),a=!1)}e.vakata.dnd.helper.css({left:t.pageX+e.vakata.dnd.helper_left+"px",top:t.pageY+e.vakata.dnd.helper_top+"px"}),e(document).triggerHandler("drag.vakata",{event:t,data:e.vakata.dnd.user_data})}},drag_stop:function(t){a&&clearInterval(a),r&&clearInterval(r),e(document).unbind("mousemove",e.vakata.dnd.drag),e(document).unbind("mouseup",e.vakata.dnd.drag_stop),e(document).triggerHandler("drag_stop.vakata",{event:t,data:e.vakata.dnd.user_data}),e.vakata.dnd.helper.remove(),e.vakata.dnd.init_x=0,e.vakata.dnd.init_y=0,e.vakata.dnd.user_data={},e.vakata.dnd.is_down=!1,e.vakata.dnd.is_drag=!1}},e(function(){var t="#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ";e.vakata.css.add_sheet({str:t,title:"vakata"})}),e.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:!1,after:!1,inside:!1,before:!1,off:!1,prepared:!1,w:0,to1:!1,to2:!1,cof:!1,cw:!1,ch:!1,i1:!1,i2:!1,mto:!1},this.get_container().bind("mouseenter.jstree",e.proxy(function(i){if(e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&(this.data.themes&&(n.attr("class","jstree-"+this.data.themes.theme),s&&s.attr("class","jstree-"+this.data.themes.theme),e.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)),i.currentTarget===i.target&&e.vakata.dnd.user_data.obj&&e(e.vakata.dnd.user_data.obj).length&&e(e.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==i.target)){var a,r=e.jstree._reference(i.target);r.data.dnd.foreign?(a=r._get_settings().dnd.drag_check.call(this,{o:t,r:r.get_container(),is_root:!0}),(a===!0||a.inside===!0||a.before===!0||a.after===!0)&&e.vakata.dnd.helper.children("ins").attr("class","jstree-ok")):(r.prepare_move(t,r.get_container(),"last"),r.check_move()&&e.vakata.dnd.helper.children("ins").attr("class","jstree-ok"))}},this)).bind("mouseup.jstree",e.proxy(function(i){if(e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&i.currentTarget===i.target&&e.vakata.dnd.user_data.obj&&e(e.vakata.dnd.user_data.obj).length&&e(e.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==i.target){var n,s=e.jstree._reference(i.currentTarget);s.data.dnd.foreign?(n=s._get_settings().dnd.drag_check.call(this,{o:t,r:s.get_container(),is_root:!0}),(n===!0||n.inside===!0||n.before===!0||n.after===!0)&&s._get_settings().dnd.drag_finish.call(this,{o:t,r:s.get_container(),is_root:!0})):s.move_node(t,s.get_container(),"last",i[s._get_settings().dnd.copy_modifier+"Key"])}},this)).bind("mouseleave.jstree",e.proxy(function(t){return t.relatedTarget&&t.relatedTarget.id&&"jstree-marker-line"===t.relatedTarget.id?!1:void(e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&(this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),e.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&e.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")))},this)).bind("mousemove.jstree",e.proxy(function(t){if(e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree){var i=this.get_container()[0];t.pageX+24>this.data.dnd.cof.left+this.data.dnd.cw?(this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i1=setInterval(e.proxy(function(){this.scrollLeft+=e.vakata.dnd.scroll_spd},i),100)):t.pageX-24<this.data.dnd.cof.left?(this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i1=setInterval(e.proxy(function(){this.scrollLeft-=e.vakata.dnd.scroll_spd},i),100)):this.data.dnd.i1&&clearInterval(this.data.dnd.i1),t.pageY+24>this.data.dnd.cof.top+this.data.dnd.ch?(this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.i2=setInterval(e.proxy(function(){this.scrollTop+=e.vakata.dnd.scroll_spd},i),100)):t.pageY-24<this.data.dnd.cof.top?(this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.i2=setInterval(e.proxy(function(){this.scrollTop-=e.vakata.dnd.scroll_spd},i),100)):this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("scroll.jstree",e.proxy(function(t){e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&n&&s&&(n.hide(),s.hide())},this)).delegate("a","mousedown.jstree",e.proxy(function(e){return 1===e.which?(this.start_drag(e.currentTarget,e),!1):void 0},this)).delegate("a","mouseenter.jstree",e.proxy(function(t){e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&this.dnd_enter(t.currentTarget)},this)).delegate("a","mousemove.jstree",e.proxy(function(t){e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&(i&&i.length&&i.children("a")[0]===t.currentTarget||this.dnd_enter(t.currentTarget),"undefined"==typeof this.data.dnd.off.top&&(this.data.dnd.off=e(t.target).offset()),
this.data.dnd.w=(t.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height,this.data.dnd.w<0&&(this.data.dnd.w+=this.data.core.li_height),this.dnd_show())},this)).delegate("a","mouseleave.jstree",e.proxy(function(t){if(e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree){if(t.relatedTarget&&t.relatedTarget.id&&"jstree-marker-line"===t.relatedTarget.id)return!1;n&&n.hide(),s&&s.hide(),this.data.dnd.mto=setTimeout(function(e){return function(){e.dnd_leave(t)}}(this),0)}},this)).delegate("a, #jstree-marker-line","mouseup.jstree",e.proxy(function(t){e.vakata.dnd.is_drag&&e.vakata.dnd.user_data.jstree&&this.dnd_finish(t)},this)),e(document).bind("drag_stop.vakata",e.proxy(function(){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.after=!1,this.data.dnd.before=!1,this.data.dnd.inside=!1,this.data.dnd.off=!1,this.data.dnd.prepared=!1,this.data.dnd.w=!1,this.data.dnd.to1=!1,this.data.dnd.to2=!1,this.data.dnd.i1=!1,this.data.dnd.i2=!1,this.data.dnd.active=!1,this.data.dnd.foreign=!1,n&&n.css({top:"-2000px"}),s&&s.css({top:"-2000px"})},this)).bind("drag_start.vakata",e.proxy(function(t,i){if(i.data.jstree){var n=e(i.event.target);n.closest(".jstree").hasClass("jstree-"+this.get_index())&&this.dnd_enter(n)}},this));var a=this._get_settings().dnd;a.drag_target&&e(document).delegate(a.drag_target,"mousedown.jstree-"+this.get_index(),e.proxy(function(i){t=i.target,e.vakata.dnd.drag_start(i,{jstree:!0,obj:i.target},"<ins class='jstree-icon'></ins>"+e(i.target).text()),this.data.themes&&(n&&n.attr("class","jstree-"+this.data.themes.theme),s&&s.attr("class","jstree-"+this.data.themes.theme),e.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)),e.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");var a=this.get_container();this.data.dnd.cof=a.offset(),this.data.dnd.cw=parseInt(a.width(),10),this.data.dnd.ch=parseInt(a.height(),10),this.data.dnd.foreign=!0,i.preventDefault()},this)),a.drop_target&&e(document).delegate(a.drop_target,"mouseenter.jstree-"+this.get_index(),e.proxy(function(i){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:t,r:e(i.target),e:i})&&e.vakata.dnd.helper.children("ins").attr("class","jstree-ok")},this)).delegate(a.drop_target,"mouseleave.jstree-"+this.get_index(),e.proxy(function(t){this.data.dnd.active&&e.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(a.drop_target+", #jstree-marker-line","mouseup.jstree-"+this.get_index(),e.proxy(function(i){this.data.dnd.active&&e.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this._get_settings().dnd.drop_finish.call(this,{o:t,r:e(i.target),e:i})},this))},defaults:{copy_modifier:"ctrl",check_timeout:100,open_timeout:500,drop_target:".jstree-drop",drop_check:function(e){return!0},drop_finish:e.noop,drag_target:".jstree-draggable",drag_finish:e.noop,drag_check:function(e){return{after:!1,before:!1,inside:!0}}},__destroy:function(){e(".jstree").length<=1&&e(document).unbind("drag_start.vakata").unbind("drag_stop.vakata"),t=!1},_fn:{dnd_prepare:function(){if(i&&i.length){if(this.data.dnd.off=i.offset(),this._get_settings().core.rtl&&(this.data.dnd.off.right=this.data.dnd.off.left+i.width()),this.data.dnd.foreign){var e=this._get_settings().dnd.drag_check.call(this,{o:t,r:i});return this.data.dnd.after=e.after,this.data.dnd.before=e.before,this.data.dnd.inside=e.inside,this.data.dnd.prepared=!0,this.dnd_show()}return this.prepare_move(t,i,"before"),this.data.dnd.before=this.check_move(),this.prepare_move(t,i,"after"),this.data.dnd.after=this.check_move(),this._is_loaded(i)?(this.prepare_move(t,i,"inside"),this.data.dnd.inside=this.check_move()):this.data.dnd.inside=!1,this.data.dnd.prepared=!0,this.dnd_show()}},dnd_show:function(){if(this.data.dnd.prepared){var t,i=["before","inside","after"],a=!1,r=this._get_settings().core.rtl;switch(i=this.data.dnd.w<this.data.core.li_height/3?["before","inside","after"]:this.data.dnd.w<=2*this.data.core.li_height/3?this.data.dnd.w<this.data.core.li_height/2?["inside","before","after"]:["inside","after","before"]:["after","inside","before"],e.each(i,e.proxy(function(t,i){return this.data.dnd[i]?(e.vakata.dnd.helper.children("ins").attr("class","jstree-ok"),a=i,!1):void 0},this)),a===!1&&e.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"),t=r?this.data.dnd.off.right-18:this.data.dnd.off.left+10,a){case"before":n.css({left:t+"px",top:this.data.dnd.off.top-6+"px"}).show(),s&&s.css({left:t+8+"px",top:this.data.dnd.off.top-1+"px"}).show();break;case"after":n.css({left:t+"px",top:this.data.dnd.off.top+this.data.core.li_height-6+"px"}).show(),s&&s.css({left:t+8+"px",top:this.data.dnd.off.top+this.data.core.li_height-1+"px"}).show();break;case"inside":n.css({left:t+(r?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show(),s&&s.hide();break;default:n.hide(),s&&s.hide()}return h=a,a}},dnd_open:function(){this.data.dnd.to2=!1,this.open_node(i,e.proxy(this.dnd_prepare,this),!0)},dnd_finish:function(e){this.data.dnd.foreign?(this.data.dnd.after||this.data.dnd.before||this.data.dnd.inside)&&this._get_settings().dnd.drag_finish.call(this,{o:t,r:i,p:h}):(this.dnd_prepare(),this.move_node(t,i,h,e[this._get_settings().dnd.copy_modifier+"Key"])),t=!1,i=!1,n.hide(),s&&s.hide()},dnd_enter:function(t){this.data.dnd.mto&&(clearTimeout(this.data.dnd.mto),this.data.dnd.mto=!1);var n=this._get_settings().dnd;this.data.dnd.prepared=!1,i=this._get_node(t),n.check_timeout?(this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to1=setTimeout(e.proxy(this.dnd_prepare,this),n.check_timeout)):this.dnd_prepare(),n.open_timeout?(this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),i&&i.length&&i.hasClass("jstree-closed")&&(this.data.dnd.to2=setTimeout(e.proxy(this.dnd_open,this),n.open_timeout))):i&&i.length&&i.hasClass("jstree-closed")&&this.dnd_open()},dnd_leave:function(t){this.data.dnd.after=!1,this.data.dnd.before=!1,this.data.dnd.inside=!1,e.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"),n.hide(),s&&s.hide(),i&&i[0]===t.target.parentNode&&(this.data.dnd.to1&&(clearTimeout(this.data.dnd.to1),this.data.dnd.to1=!1),this.data.dnd.to2&&(clearTimeout(this.data.dnd.to2),this.data.dnd.to2=!1))},start_drag:function(i,a){t=this._get_node(i),this.data.ui&&this.is_selected(t)&&(t=this._get_node(null,!0));var r=t.length>1?this._get_string("multiple_selection"):this.get_text(t),o=this.get_container();this._get_settings().core.html_titles||(r=r.replace(/</gi,"&lt;").replace(/>/gi,"&gt;")),e.vakata.dnd.drag_start(a,{jstree:!0,obj:t},"<ins class='jstree-icon'></ins>"+r),this.data.themes&&(n&&n.attr("class","jstree-"+this.data.themes.theme),s&&s.attr("class","jstree-"+this.data.themes.theme),e.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)),this.data.dnd.cof=o.offset(),this.data.dnd.cw=parseInt(o.width(),10),this.data.dnd.ch=parseInt(o.height(),10),this.data.dnd.active=!0}}}),e(function(){var t="#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } #jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43; cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666; -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; }";e.vakata.css.add_sheet({str:t,title:"jstree"}),n=e("<div />").attr({id:"jstree-marker"}).hide().html("&raquo;").bind("mouseleave mouseenter",function(e){return n.hide(),s.hide(),e.preventDefault(),e.stopImmediatePropagation(),!1}).appendTo("body"),s=e("<div />").attr({id:"jstree-marker-line"}).hide().bind("mouseup",function(e){return i&&i.length?(i.children("a").trigger(e),e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}).bind("mouseleave",function(t){var a=e(t.relatedTarget);return(a.is(".jstree")||0===a.closest(".jstree").length)&&i&&i.length?(i.children("a").trigger(t),n.hide(),s.hide(),t.preventDefault(),t.stopImmediatePropagation(),!1):void 0}).appendTo("body"),e(document).bind("drag_start.vakata",function(e,t){t.data.jstree&&(n.show(),s&&s.show())}),e(document).bind("drag_stop.vakata",function(e,t){t.data.jstree&&(n.hide(),s&&s.hide())})})}(jQuery),function(e){e.jstree.plugin("checkbox",{__init:function(){this.data.checkbox.noui=this._get_settings().checkbox.override_ui,this.data.ui&&this.data.checkbox.noui&&(this.select_node=this.deselect_node=this.deselect_all=e.noop,this.get_selected=this.get_checked),this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree",e.proxy(function(e,t){this._prepare_checkboxes(t.rslt.obj)},this)).bind("loaded.jstree",e.proxy(function(e){this._prepare_checkboxes()},this)).delegate(this.data.ui&&this.data.checkbox.noui?"a":"ins.jstree-checkbox","click.jstree",e.proxy(function(e){return e.preventDefault(),this._get_node(e.target).hasClass("jstree-checked")?this.uncheck_node(e.target):this.check_node(e.target),this.data.ui&&this.data.checkbox.noui?(this.save_selected(),void(this.data.cookies&&this.save_cookie("select_node"))):(e.stopImmediatePropagation(),!1)},this))},defaults:{override_ui:!1,two_state:!1,real_checkboxes:!1,checked_parent_open:!0,real_checkboxes_names:function(e){return["check_"+(e[0].id||Math.ceil(1e4*Math.random())),1]}},__destroy:function(){this.get_container().find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end().find("ins.jstree-checkbox").remove()},_fn:{_checkbox_notify:function(e,t){t.checked&&this.check_node(e,!1)},_prepare_checkboxes:function(t){if(t=t&&-1!=t?this._get_node(t):this.get_container().find("> ul > li"),t!==!1){var i,n,s=this,a=this._get_settings().checkbox.two_state,r=this._get_settings().checkbox.real_checkboxes,o=this._get_settings().checkbox.real_checkboxes_names;t.each(function(){n=e(this),i=n.is("li")&&(n.hasClass("jstree-checked")||r&&n.children(":checked").length)?"jstree-checked":"jstree-unchecked",n.find("li").andSelf().each(function(){var t,n=e(this);n.children("a"+(s.data.languages?"":":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(a?"jstree-unchecked":i),r&&(n.children(":checkbox").length?n.children(":checkbox").addClass("jstree-real-checkbox"):(t=o.call(s,n),n.prepend("<input type='checkbox' class='jstree-real-checkbox' id='"+t[0]+"' name='"+t[0]+"' value='"+t[1]+"' />"))),a?(n.hasClass("jstree-checked")||n.children(":checked").length)&&n.addClass("jstree-checked").children(":checkbox").prop("checked",!0):("jstree-checked"===i||n.hasClass("jstree-checked")||n.children(":checked").length)&&n.find("li").andSelf().addClass("jstree-checked").children(":checkbox").prop("checked",!0)})}),a||t.find(".jstree-checked").parent().parent().each(function(){s._repair_state(this)})}},change_state:function(t,i){t=this._get_node(t);var n=!1,s=this._get_settings().checkbox.real_checkboxes;if(!t||-1===t)return!1;if(i=i===!1||i===!0?i:t.hasClass("jstree-checked"),this._get_settings().checkbox.two_state)i?(t.removeClass("jstree-checked").addClass("jstree-unchecked"),s&&t.children(":checkbox").prop("checked",!1)):(t.removeClass("jstree-unchecked").addClass("jstree-checked"),s&&t.children(":checkbox").prop("checked",!0));else{if(i){if(n=t.find("li").andSelf(),!n.filter(".jstree-checked, .jstree-undetermined").length)return!1;n.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"),s&&n.children(":checkbox").prop("checked",!1)}else{if(n=t.find("li").andSelf(),!n.filter(".jstree-unchecked, .jstree-undetermined").length)return!1;n.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"),s&&n.children(":checkbox").prop("checked",!0),this.data.ui&&(this.data.ui.last_selected=t),this.data.checkbox.last_selected=t}t.parentsUntil(".jstree","li").each(function(){var t=e(this);if(i){if(t.children("ul").children("li.jstree-checked, li.jstree-undetermined").length)return t.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),s&&t.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",!1),!1;t.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"),s&&t.children(":checkbox").prop("checked",!1)}else{if(t.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length)return t.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),s&&t.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",!1),!1;t.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"),s&&t.children(":checkbox").prop("checked",!0)}})}return this.data.ui&&this.data.checkbox.noui&&(this.data.ui.selected=this.get_checked()),this.__callback(t),!0},check_node:function(e){if(this.change_state(e,!1)){if(e=this._get_node(e),this._get_settings().checkbox.checked_parent_open){var t=this;e.parents(".jstree-closed").each(function(){t.open_node(this,!1,!0)})}this.__callback({obj:e})}},uncheck_node:function(e){this.change_state(e,!0)&&this.__callback({obj:this._get_node(e)})},check_all:function(){var e=this,t=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");t.each(function(){e.change_state(this,!1)}),this.__callback()},uncheck_all:function(){var e=this,t=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");t.each(function(){e.change_state(this,!0)}),this.__callback()},is_checked:function(e){return e=this._get_node(e),e.length?e.is(".jstree-checked"):!1},get_checked:function(e,t){return e=e&&-1!==e?this._get_node(e):this.get_container(),t||this._get_settings().checkbox.two_state?e.find(".jstree-checked"):e.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(e,t){return e=e&&-1!==e?this._get_node(e):this.get_container(),t||this._get_settings().checkbox.two_state?e.find(".jstree-unchecked"):e.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(e){if(e=this._get_node(e),e.length){if(this._get_settings().checkbox.two_state)return void e.find("li").andSelf().not(".jstree-checked").removeClass("jstree-undetermined").addClass("jstree-unchecked").children(":checkbox").prop("checked",!0);var t=this._get_settings().checkbox.real_checkboxes,i=e.find("> ul > .jstree-checked").length,n=e.find("> ul > .jstree-undetermined").length,s=e.find("> ul > li").length;0===s?e.hasClass("jstree-undetermined")&&this.change_state(e,!1):0===i&&0===n?this.change_state(e,!0):i===s?this.change_state(e,!1):(e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),t&&e.parentsUntil(".jstree","li").andSelf().children(":checkbox").prop("checked",!1))}},reselect:function(){if(this.data.ui&&this.data.checkbox.noui){var t=this,i=this.data.ui.to_select;i=e.map(e.makeArray(i),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.deselect_all(),e.each(i,function(e,i){t.check_node(i)}),this.__callback()}else this.__call_old()},save_loaded:function(){var e=this;this.data.core.to_load=[],this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function(){this.id&&e.data.core.to_load.push("#"+this.id)})}}}),e(function(){var t=".jstree .jstree-real-checkbox { display:none; } ";e.vakata.css.add_sheet({str:t,title:"jstree"})})}(jQuery),function(e){e.vakata.xslt=function(t,i,n){var s,a,r,o,l="";return document.recalc?(s=document.createElement("xml"),a=document.createElement("xml"),s.innerHTML=t,a.innerHTML=i,e("body").append(s).append(a),setTimeout(function(t,i,n){return function(){n.call(null,t.transformNode(i.XMLDocument)),setTimeout(function(t,i){return function(){e(t).remove(),e(i).remove()}}(t,i),200)}}(s,a,n),100),!0):("undefined"!=typeof window.DOMParser&&"undefined"!=typeof window.XMLHttpRequest&&"undefined"==typeof window.XSLTProcessor&&(t=(new DOMParser).parseFromString(t,"text/xml"),i=(new DOMParser).parseFromString(i,"text/xml")),"undefined"!=typeof window.DOMParser&&"undefined"!=typeof window.XMLHttpRequest&&"undefined"!=typeof window.XSLTProcessor?(r=new XSLTProcessor,(o=e.isFunction(r.transformDocument)?"undefined"!=typeof window.XMLSerializer:!0)?(t=(new DOMParser).parseFromString(t,"text/xml"),i=(new DOMParser).parseFromString(i,"text/xml"),e.isFunction(r.transformDocument)?(l=document.implementation.createDocument("","",null),r.transformDocument(t,i,l,null),n.call(null,(new XMLSerializer).serializeToString(l)),!0):(r.importStylesheet(i),l=r.transformToFragment(t,document),n.call(null,e("<div />").append(l).html()),!0)):!1):!1)};var t={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/"> <xsl:call-template name="nodes"> <xsl:with-param name="node" select="/root" /> </xsl:call-template></xsl:template><xsl:template name="nodes"> <xsl:param name="node" /> <ul> <xsl:for-each select="$node/item"> <xsl:variable name="children" select="count(./item) &gt; 0" /> <li> <xsl:attribute name="class"> <xsl:if test="position() = last()">jstree-last </xsl:if> <xsl:choose> <xsl:when test="@state = \'open\'">jstree-open </xsl:when> <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when> <xsl:otherwise>jstree-leaf </xsl:otherwise> </xsl:choose> <xsl:value-of select="@class" /> </xsl:attribute> <xsl:for-each select="@*"> <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'"> <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute> </xsl:if> </xsl:for-each> <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins> <xsl:for-each select="content/name"> <a> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when> <xsl:otherwise>#</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute> <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute> <xsl:for-each select="@*"> <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'"> <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute> </xsl:if> </xsl:for-each> <ins> <xsl:attribute name="class">jstree-icon <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if> </xsl:attribute> <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if> <xsl:text>&#xa0;</xsl:text> </ins> <xsl:copy-of select="./child::node()" /> </a> </xsl:for-each> <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if> </li> </xsl:for-each> </ul></xsl:template></xsl:stylesheet>',flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/"> <ul> <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]"> <xsl:call-template name="nodes"> <xsl:with-param name="node" select="." /> <xsl:with-param name="is_last" select="number(position() = last())" /> </xsl:call-template> </xsl:for-each> </ul></xsl:template><xsl:template name="nodes"> <xsl:param name="node" /> <xsl:param name="is_last" /> <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" /> <li> <xsl:attribute name="class"> <xsl:if test="$is_last = true()">jstree-last </xsl:if> <xsl:choose> <xsl:when test="@state = \'open\'">jstree-open </xsl:when> <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when> <xsl:otherwise>jstree-leaf </xsl:otherwise> </xsl:choose> <xsl:value-of select="@class" /> </xsl:attribute> <xsl:for-each select="@*"> <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'"> <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute> </xsl:if> </xsl:for-each> <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins> <xsl:for-each select="content/name"> <a> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when> <xsl:otherwise>#</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute> <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute> <xsl:for-each select="@*"> <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'"> <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute> </xsl:if> </xsl:for-each> <ins> <xsl:attribute name="class">jstree-icon <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if> </xsl:attribute> <xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if> <xsl:text>&#xa0;</xsl:text> </ins> <xsl:copy-of select="./child::node()" /> </a> </xsl:for-each> <xsl:if test="$children"> <ul> <xsl:for-each select="//item[@parent_id=$node/attribute::id]"> <xsl:call-template name="nodes"> <xsl:with-param name="node" select="." /> <xsl:with-param name="is_last" select="number(position() = last())" /> </xsl:call-template> </xsl:for-each> </ul> </xsl:if> </li></xsl:template></xsl:stylesheet>'},i=function(e){return e.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")};e.jstree.plugin("xml_data",{defaults:{data:!1,ajax:!1,xsl:"flat",clean_node:!1,correct_state:!0,get_skip_empty:!1,get_include_preamble:!0},_fn:{load_node:function(e,t,i){var n=this;this.load_node_xml(e,function(){n.__callback({obj:n._get_node(e)}),t.call(this)},i)},_is_loaded:function(t){var i=this._get_settings().xml_data;return t=this._get_node(t),-1==t||!t||!i.ajax&&!e.isFunction(i.data)||t.is(".jstree-open, .jstree-leaf")||t.children("ul").children("li").size()>0},load_node_xml:function(t,i,n){var s=this.get_settings().xml_data,a=function(){},r=function(){};if(t=this._get_node(t),t&&-1!==t){if(t.data("jstree_is_loading"))return;t.data("jstree_is_loading",!0)}switch(!0){case!s.data&&!s.ajax:throw"Neither data nor ajax settings supplied.";case e.isFunction(s.data):s.data.call(this,t,e.proxy(function(n){this.parse_xml(n,e.proxy(function(n){n&&(n=n.replace(/ ?xmlns="[^"]*"/gi,""),n.length>10?(n=e(n),-1!==t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.append(n),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(n.children()),s.clean_node&&this.clean_node(t),i&&i.call(this)):t&&-1!==t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),s.correct_state&&(this.correct_state(t),i&&i.call(this))):s.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this)))},this))},this));break;case!!s.data&&!s.ajax||!!s.data&&!!s.ajax&&(!t||-1===t):t&&-1!=t||this.parse_xml(s.data,e.proxy(function(n){n?(n=n.replace(/ ?xmlns="[^"]*"/gi,""),n.length>10&&(n=e(n),this.get_container().children("ul").empty().append(n.children()),s.clean_node&&this.clean_node(t),i&&i.call(this))):s.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this))},this));break;case!s.data&&!!s.ajax||!!s.data&&!!s.ajax&&t&&-1!==t:a=function(e,i,a){var r=this.get_settings().xml_data.ajax.error;r&&r.call(this,e,i,a),-1!==t&&t.length?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),"success"===i&&s.correct_state&&this.correct_state(t)):"success"===i&&s.correct_state&&this.get_container().children("ul").empty(),n&&n.call(this)},r=function(n,r,o){n=o.responseText;var l=this.get_settings().xml_data.ajax.success;return l&&(n=l.call(this,n,r,o)||n),""===n||n&&n.toString&&""===n.toString().replace(/^[\s\n]+$/,"")?a.call(this,o,r,""):void this.parse_xml(n,e.proxy(function(n){n&&(n=n.replace(/ ?xmlns="[^"]*"/gi,""),n.length>10?(n=e(n),-1!==t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.append(n),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(n.children()),s.clean_node&&this.clean_node(t),i&&i.call(this)):t&&-1!==t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),s.correct_state&&(this.correct_state(t),i&&i.call(this))):s.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this)))},this))},s.ajax.context=this,s.ajax.error=a,s.ajax.success=r,s.ajax.dataType||(s.ajax.dataType="xml"),e.isFunction(s.ajax.url)&&(s.ajax.url=s.ajax.url.call(this,t)),e.isFunction(s.ajax.data)&&(s.ajax.data=s.ajax.data.call(this,t)),e.ajax(s.ajax)}},parse_xml:function(i,n){var s=this._get_settings().xml_data;e.vakata.xslt(i,t[s.xsl],n)},get_xml:function(t,n,s,a,r){var o,l,h,c,d,u="",p=this._get_settings(),f=this;return t||(t="flat"),r||(r=0),n=this._get_node(n),n&&-1!==n||(n=this.get_container().find("> ul > li")),s=e.isArray(s)?s:["id","class"],!r&&this.data.types&&-1===e.inArray(p.types.type_attr,s)&&s.push(p.types.type_attr),a=e.isArray(a)?a:[],r||(p.xml_data.get_include_preamble&&(u+='<?xml version="1.0" encoding="UTF-8"?>'),u+="<root>"),n.each(function(){u+="<item",h=e(this),e.each(s,function(e,t){var n=h.attr(t);p.xml_data.get_skip_empty&&"undefined"==typeof n||(u+=" "+t+'="'+i((" "+(n||"")).replace(/ jstree[^ ]*/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,""))+'"')}),h.hasClass("jstree-open")&&(u+=' state="open"'),h.hasClass("jstree-closed")&&(u+=' state="closed"'),"flat"===t&&(u+=' parent_id="'+i(r)+'"'),u+=">",u+="<content>",c=h.children("a"),c.each(function(){o=e(this),d=!1,u+="<name",-1!==e.inArray("languages",p.plugins)&&e.each(p.languages,function(e,t){return o.hasClass(t)?(u+=' lang="'+i(t)+'"',d=t,!1):void 0}),a.length&&e.each(a,function(e,t){var n=o.attr(t);p.xml_data.get_skip_empty&&"undefined"==typeof n||(u+=" "+t+'="'+i((" "+n||"").replace(/ jstree[^ ]*/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,""))+'"')}),o.children("ins").get(0).className.replace(/jstree[^ ]*|$/gi,"").replace(/^\s+$/gi,"").length&&(u+=' icon="'+i(o.children("ins").get(0).className.replace(/jstree[^ ]*|$/gi,"").replace(/\s+$/gi," ").replace(/^ /,"").replace(/ $/,""))+'"'),o.children("ins").get(0).style.backgroundImage.length&&(u+=' icon="'+i(o.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/gi,"").replace(/"/gi,""))+'"'),u+=">",u+="<![CDATA["+f.get_text(o,d)+"]]>",u+="</name>"}),u+="</content>",l=h[0].id||!0,h=h.find("> ul > li"),l=h.length?f.get_xml(t,h,s,a,l):"","nest"==t&&(u+=l),u+="</item>","flat"==t&&(u+=l)}),r||(u+="</root>"),u}}})}(jQuery),function(e){e.expr[":"].jstree_contains=function(e,t,i){return(e.textContent||e.innerText||"").toLowerCase().indexOf(i[3].toLowerCase())>=0},e.expr[":"].jstree_title_contains=function(e,t,i){return(e.getAttribute("title")||"").toLowerCase().indexOf(i[3].toLowerCase())>=0},e.jstree.plugin("search",{__init:function(){this.data.search.str="",this.data.search.result=e(),this._get_settings().search.show_only_matches&&this.get_container().bind("search.jstree",function(t,i){e(this).children("ul").find("li").hide().removeClass("jstree-last"),i.rslt.nodes.parentsUntil(".jstree").andSelf().show().filter("ul").each(function(){e(this).children("li:visible").eq(-1).addClass("jstree-last")})}).bind("clear_search.jstree",function(){e(this).children("ul").find("li").css("display","").end().end().jstree("clean_node",-1)})},defaults:{ajax:!1,search_method:"jstree_contains",show_only_matches:!1},_fn:{search:function(t,i){if(""===e.trim(t))return void this.clear_search();var n=this.get_settings().search,s=this,a=function(){},r=function(){};return this.data.search.str=t,!i&&n.ajax!==!1&&this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length>0?(this.search.supress_callback=!0,a=function(){},r=function(e,t,i){var n=this.get_settings().search.ajax.success;n&&(e=n.call(this,e,t,i)||e),this.data.search.to_open=e,this._search_open()},n.ajax.context=this,n.ajax.error=a,n.ajax.success=r,e.isFunction(n.ajax.url)&&(n.ajax.url=n.ajax.url.call(this,t)),e.isFunction(n.ajax.data)&&(n.ajax.data=n.ajax.data.call(this,t)),n.ajax.data||(n.ajax.data={search_string:t}),(!n.ajax.dataType||/^json/.exec(n.ajax.dataType))&&(n.ajax.dataType="json"),void e.ajax(n.ajax)):(this.data.search.result.length&&this.clear_search(),this.data.search.result=this.get_container().find("a"+(this.data.languages?"."+this.get_lang():"")+":"+n.search_method+"("+this.data.search.str+")"),this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function(){s.open_node(this,!1,!0)}),void this.__callback({nodes:this.data.search.result,str:t}))},clear_search:function(t){this.data.search.result.removeClass("jstree-search"),this.__callback(this.data.search.result),this.data.search.result=e()},_search_open:function(t){var i=this,n=!0,s=[],a=[];this.data.search.to_open.length&&(e.each(this.data.search.to_open,function(t,i){return"#"==i?!0:void(e(i).length&&e(i).is(".jstree-closed")?s.push(i):a.push(i))}),s.length&&(this.data.search.to_open=a,e.each(s,function(e,t){i.open_node(t,function(){i._search_open(!0)})}),n=!1)),n&&this.search(this.data.search.str,!0)}}})}(jQuery),function(e){e.vakata.context={hide_on_mouseleave:!1,cnt:e("<div id='vakata-contextmenu' />"),vis:!1,tgt:!1,par:!1,func:!1,data:!1,rtl:!1,show:function(t,i,n,s,a,r,o){e.vakata.context.rtl=!!o;var l,h,c=e.vakata.context.parse(t);c&&(e.vakata.context.vis=!0,e.vakata.context.tgt=i,e.vakata.context.par=r||i||null,e.vakata.context.data=a||null,e.vakata.context.cnt.html(c).css({visibility:"hidden",display:"block",left:0,top:0}),e.vakata.context.hide_on_mouseleave&&e.vakata.context.cnt.one("mouseleave",function(t){e.vakata.context.hide()}),l=e.vakata.context.cnt.height(),
h=e.vakata.context.cnt.width(),n+h>e(document).width()&&(n=e(document).width()-(h+5),e.vakata.context.cnt.find("li > ul").addClass("right")),s+l>e(document).height()&&(s-=l+i[0].offsetHeight,e.vakata.context.cnt.find("li > ul").addClass("bottom")),e.vakata.context.cnt.css({left:n,top:s}).find("li:has(ul)").bind("mouseenter",function(t){var i=e(document).width(),n=e(document).height(),s=e(this).children("ul").show();i!==e(document).width()&&s.toggleClass("right"),n!==e(document).height()&&s.toggleClass("bottom")}).bind("mouseleave",function(t){e(this).children("ul").hide()}).end().css({visibility:"visible"}).show(),e(document).triggerHandler("context_show.vakata"))},hide:function(){e.vakata.context.vis=!1,e.vakata.context.cnt.attr("class","").css({visibility:"hidden"}),e(document).triggerHandler("context_hide.vakata")},parse:function(t,i){if(!t)return!1;var n="",s=!1,a=!0;return i||(e.vakata.context.func={}),n+="<ul>",e.each(t,function(t,i){return i?(e.vakata.context.func[t]=i.action,!a&&i.separator_before&&(n+="<li class='vakata-separator vakata-separator-before'></li>"),a=!1,n+="<li class='"+(i._class||"")+(i._disabled?" jstree-contextmenu-disabled ":"")+"'><ins ",i.icon&&-1===i.icon.indexOf("/")&&(n+=" class='"+i.icon+"' "),i.icon&&-1!==i.icon.indexOf("/")&&(n+=" style='background:url("+i.icon+") center center no-repeat;' "),n+=">&#160;</ins><a href='#' rel='"+t+"'>",i.submenu&&(n+="<span style='float:"+(e.vakata.context.rtl?"left":"right")+";'>&raquo;</span>"),n+=i.label+"</a>",i.submenu&&(s=e.vakata.context.parse(i.submenu,!0),s&&(n+=s)),n+="</li>",void(i.separator_after&&(n+="<li class='vakata-separator vakata-separator-after'></li>",a=!0))):!0}),n=n.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,""),n+="</ul>",e(document).triggerHandler("context_parse.vakata"),n.length>10?n:!1},exec:function(t){return e.isFunction(e.vakata.context.func[t])?(e.vakata.context.func[t].call(e.vakata.context.data,e.vakata.context.par),!0):!1}},e(function(){var t="#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ";e.vakata.css.add_sheet({str:t,title:"vakata"}),e.vakata.context.cnt.delegate("a","click",function(e){e.preventDefault()}).delegate("a","mouseup",function(t){!e(this).parent().hasClass("jstree-contextmenu-disabled")&&e.vakata.context.exec(e(this).attr("rel"))?e.vakata.context.hide():e(this).blur()}).delegate("a","mouseover",function(){e.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body"),e(document).bind("mousedown",function(t){e.vakata.context.vis&&!e.contains(e.vakata.context.cnt[0],t.target)&&e.vakata.context.hide()}),"undefined"!=typeof e.hotkeys&&e(document).bind("keydown","up",function(t){if(e.vakata.context.vis){var i=e.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();i.length||(i=e.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last()),i.addClass("vakata-hover"),t.stopImmediatePropagation(),t.preventDefault()}}).bind("keydown","down",function(t){if(e.vakata.context.vis){var i=e.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();i.length||(i=e.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first()),i.addClass("vakata-hover"),t.stopImmediatePropagation(),t.preventDefault()}}).bind("keydown","right",function(t){e.vakata.context.vis&&(e.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover"),t.stopImmediatePropagation(),t.preventDefault())}).bind("keydown","left",function(t){e.vakata.context.vis&&(e.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover"),t.stopImmediatePropagation(),t.preventDefault())}).bind("keydown","esc",function(t){e.vakata.context.hide(),t.preventDefault()}).bind("keydown","space",function(t){e.vakata.context.cnt.find(".vakata-hover").last().children("a").click(),t.preventDefault()})}),e.jstree.plugin("contextmenu",{__init:function(){this.get_container().delegate("a","contextmenu.jstree",e.proxy(function(t){t.preventDefault(),e(t.currentTarget).hasClass("jstree-loading")||this.show_contextmenu(t.currentTarget,t.pageX,t.pageY)},this)).delegate("a","click.jstree",e.proxy(function(t){this.data.contextmenu&&e.vakata.context.hide()},this)).bind("destroy.jstree",e.proxy(function(){this.data.contextmenu&&e.vakata.context.hide()},this)),e(document).bind("context_hide.vakata",e.proxy(function(){this.data.contextmenu=!1},this))},__destroy:function(){e(".jstree").length<=1&&e(document).unbind("context_hide.vakata")},defaults:{select_node:!1,show_at_node:!0,items:{create:{separator_before:!1,separator_after:!0,label:"Create",action:function(e){this.create(e)}},rename:{separator_before:!1,separator_after:!1,label:"Rename",action:function(e){this.rename(e)}},remove:{separator_before:!1,icon:!1,separator_after:!1,label:"Delete",action:function(e){this.is_selected(e)?this.remove():this.remove(e)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(e){this.cut(e)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(e){this.copy(e)}},paste:{separator_before:!1,icon:!1,separator_after:!1,label:"Paste",action:function(e){this.paste(e)}}}}}},_fn:{show_contextmenu:function(t,i,n){t=this._get_node(t);var s=this.get_settings().contextmenu,a=t.children("a:visible:eq(0)"),r=!1,o=!1;s.select_node&&this.data.ui&&!this.is_selected(t)&&(this.deselect_all(),this.select_node(t,!0)),(s.show_at_node||"undefined"==typeof i||"undefined"==typeof n)&&(r=a.offset(),i=r.left,n=r.top+this.data.core.li_height),o=t.data("jstree")&&t.data("jstree").contextmenu?t.data("jstree").contextmenu:s.items,e.isFunction(o)&&(o=o.call(this,t)),this.data.contextmenu=!0,e.vakata.context.show(o,a,i,n,this,t,this._get_settings().core.rtl),this.data.themes&&e.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})}(jQuery),function(t){t.jstree.plugin("types",{__init:function(){var i=this._get_settings().types;this.data.types.attach_to=[],this.get_container().bind("init.jstree",t.proxy(function(){var e=i.types,n=i.type_attr,s="",a=this;t.each(e,function(e,i){return t.each(i,function(e,t){/^(max_depth|max_children|icon|valid_children)$/.test(e)||a.data.types.attach_to.push(e)}),i.icon?void((i.icon.image||i.icon.position)&&(s+="default"==e?".jstree-"+a.get_index()+" a > .jstree-icon { ":".jstree-"+a.get_index()+" li["+n+'="'+e+'"] > a > .jstree-icon { ',i.icon.image&&(s+=" background-image:url("+i.icon.image+"); "),s+=i.icon.position?" background-position:"+i.icon.position+"; ":" background-position:0 0; ",s+="} ")):!0}),""!==s&&t.vakata.css.add_sheet({str:s,title:"jstree-types"})},this)).bind("before.jstree",t.proxy(function(e,i){var n,s,a=this._get_settings().types.use_data?this._get_node(i.args[0]):!1,r=a&&-1!==a&&a.length?a.data("jstree"):!1;if(r&&r.types&&r.types[i.func]===!1)return e.stopImmediatePropagation(),!1;if(-1!==t.inArray(i.func,this.data.types.attach_to)){if(!i.args[0]||!i.args[0].tagName&&!i.args[0].jquery)return;if(n=this._get_settings().types.types,s=this._get_type(i.args[0]),(n[s]&&"undefined"!=typeof n[s][i.func]||n["default"]&&"undefined"!=typeof n["default"][i.func])&&this._check(i.func,i.args[0])===!1)return e.stopImmediatePropagation(),!1}},this)),e&&this.get_container().bind("load_node.jstree set_type.jstree",t.proxy(function(e,i){var n=i&&i.rslt&&i.rslt.obj&&-1!==i.rslt.obj?this._get_node(i.rslt.obj).parent():this.get_container_ul(),s=!1,a=this._get_settings().types;t.each(a.types,function(e,t){t.icon&&(t.icon.image||t.icon.position)&&(s="default"===e?n.find("li > a > .jstree-icon"):n.find("li["+a.type_attr+"='"+e+"'] > a > .jstree-icon"),t.icon.image&&s.css("backgroundImage","url("+t.icon.image+")"),s.css("backgroundPosition",t.icon.position||"0 0"))})},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",use_data:!1,type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_types_notify:function(e,t){t.type&&this._get_settings().types.use_data&&this.set_type(t.type,e)},_get_type:function(e){return e=this._get_node(e),e&&e.length?e.attr(this._get_settings().types.type_attr)||"default":!1},set_type:function(e,t){t=this._get_node(t);var i=t.length&&e?t.attr(this._get_settings().types.type_attr,e):!1;return i&&this.__callback({obj:t,type:e}),i},_check:function(e,i,n){i=this._get_node(i);var s=!1,a=this._get_type(i),r=0,o=this,l=this._get_settings().types,h=!1;if(-1===i){if(!l[e])return;s=l[e]}else{if(a===!1)return;h=l.use_data?i.data("jstree"):!1,h&&h.types&&"undefined"!=typeof h.types[e]?s=h.types[e]:l.types[a]&&"undefined"!=typeof l.types[a][e]?s=l.types[a][e]:l.types["default"]&&"undefined"!=typeof l.types["default"][e]&&(s=l.types["default"][e])}return t.isFunction(s)&&(s=s.call(this,i)),"max_depth"===e&&-1!==i&&n!==!1&&-2!==l.max_depth&&0!==s&&i.children("a:eq(0)").parentsUntil(".jstree","li").each(function(t){return-1!==l.max_depth&&l.max_depth-(t+1)<=0?(s=0,!1):(r=0===t?s:o._check(e,this,!1),-1!==r&&0>=r-(t+1)?(s=0,!1):(r>=0&&(s>r-(t+1)||0>s)&&(s=r-(t+1)),void(l.max_depth>=0&&(l.max_depth-(t+1)<s||0>s)&&(s=l.max_depth-(t+1)))))}),s},check_move:function(){if(!this.__call_old())return!1;var e,i=this._get_move(),n=i.rt._get_settings().types,s=i.rt._check("max_children",i.cr),a=i.rt._check("max_depth",i.cr),r=i.rt._check("valid_children",i.cr),o=0,l=1;if("none"===r)return!1;if(t.isArray(r)&&i.ot&&i.ot._get_type&&(i.o.each(function(){return-1===t.inArray(i.ot._get_type(this),r)?(l=!1,!1):void 0}),l===!1))return!1;if(-2!==n.max_children&&-1!==s&&(o=-1===i.cr?this.get_container().find("> ul > li").not(i.o).length:i.cr.find("> ul > li").not(i.o).length,o+i.o.length>s))return!1;if(-2!==n.max_depth&&-1!==a){if(l=0,0===a)return!1;if("undefined"==typeof i.o.d){for(e=i.o;e.length>0;)e=e.find("> ul > li"),l++;i.o.d=l}if(a-i.o.d<0)return!1}return!0},create_node:function(e,i,n,s,a,r){if(!r&&(a||this._is_loaded(e))){var o,l="string"==typeof i&&i.match(/^before|after$/i)&&-1!==e?this._get_parent(e):this._get_node(e),h=this._get_settings().types,c=this._check("max_children",l),d=this._check("max_depth",l),u=this._check("valid_children",l);if("string"==typeof n&&(n={data:n}),n||(n={}),"none"===u)return!1;if(t.isArray(u))if(n.attr&&n.attr[h.type_attr]){if(-1===t.inArray(n.attr[h.type_attr],u))return!1}else n.attr||(n.attr={}),n.attr[h.type_attr]=u[0];if(-2!==h.max_children&&-1!==c&&(o=-1===l?this.get_container().find("> ul > li").length:l.find("> ul > li").length,o+1>c))return!1;if(-2!==h.max_depth&&-1!==d&&0>d-1)return!1}return this.__call_old(!0,e,i,n,s,a,r)}}})}(jQuery),function(e){e.jstree.plugin("html_data",{__init:function(){this.data.html_data.original_container_html=this.get_container().find(" > ul > li").clone(!0),this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function(){return 3==this.nodeType}).remove()},defaults:{data:!1,ajax:!1,correct_state:!0},_fn:{load_node:function(e,t,i){var n=this;this.load_node_html(e,function(){n.__callback({obj:n._get_node(e)}),t.call(this)},i)},_is_loaded:function(t){return t=this._get_node(t),-1==t||!t||!this._get_settings().html_data.ajax&&!e.isFunction(this._get_settings().html_data.data)||t.is(".jstree-open, .jstree-leaf")||t.children("ul").children("li").size()>0},load_node_html:function(t,i,n){var s,a=this.get_settings().html_data,r=function(){},o=function(){};if(t=this._get_node(t),t&&-1!==t){if(t.data("jstree_is_loading"))return;t.data("jstree_is_loading",!0)}switch(!0){case e.isFunction(a.data):a.data.call(this,t,e.proxy(function(n){n&&""!==n&&n.toString&&""!==n.toString().replace(/^[\s\n]+$/,"")?(n=e(n),n.is("ul")||(n=e("<ul />").append(n)),-1!=t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.append(n).children("ul").find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(n.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node(t),i&&i.call(this)):t&&-1!==t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),a.correct_state&&(this.correct_state(t),i&&i.call(this))):a.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this))},this));break;case!a.data&&!a.ajax:t&&-1!=t||(this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node()),i&&i.call(this);break;case!!a.data&&!a.ajax||!!a.data&&!!a.ajax&&(!t||-1===t):t&&-1!=t||(s=e(a.data),s.is("ul")||(s=e("<ul />").append(s)),this.get_container().children("ul").empty().append(s.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node()),i&&i.call(this);break;case!a.data&&!!a.ajax||!!a.data&&!!a.ajax&&t&&-1!==t:t=this._get_node(t),r=function(e,i,s){var r=this.get_settings().html_data.ajax.error;r&&r.call(this,e,i,s),-1!=t&&t.length?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),"success"===i&&a.correct_state&&this.correct_state(t)):"success"===i&&a.correct_state&&this.get_container().children("ul").empty(),n&&n.call(this)},o=function(n,s,o){var l=this.get_settings().html_data.ajax.success;return l&&(n=l.call(this,n,s,o)||n),""===n||n&&n.toString&&""===n.toString().replace(/^[\s\n]+$/,"")?r.call(this,o,s,""):void(n?(n=e(n),n.is("ul")||(n=e("<ul />").append(n)),-1!=t&&t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.append(n).children("ul").find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),t.removeData("jstree_is_loading")):this.get_container().children("ul").empty().append(n.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||"INS"!==this.firstChild.tagName}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node(t),i&&i.call(this)):t&&-1!==t?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree_is_loading"),a.correct_state&&(this.correct_state(t),i&&i.call(this))):a.correct_state&&(this.get_container().children("ul").empty(),i&&i.call(this)))},a.ajax.context=this,a.ajax.error=r,a.ajax.success=o,a.ajax.dataType||(a.ajax.dataType="html"),e.isFunction(a.ajax.url)&&(a.ajax.url=a.ajax.url.call(this,t)),e.isFunction(a.ajax.data)&&(a.ajax.data=a.ajax.data.call(this,t)),e.ajax(a.ajax)}}}}),e.jstree.defaults.plugins.push("html_data")}(jQuery),function(e){e.jstree.plugin("themeroller",{__init:function(){var t=this._get_settings().themeroller;this.get_container().addClass("ui-widget-content").addClass("jstree-themeroller").delegate("a","mouseenter.jstree",function(i){e(i.currentTarget).hasClass("jstree-loading")||e(this).addClass(t.item_h)}).delegate("a","mouseleave.jstree",function(){e(this).removeClass(t.item_h)}).bind("init.jstree",e.proxy(function(e,t){t.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh"),this._themeroller(t.inst.get_container().find("> ul > li"))},this)).bind("open_node.jstree create_node.jstree",e.proxy(function(e,t){this._themeroller(t.rslt.obj)},this)).bind("loaded.jstree refresh.jstree",e.proxy(function(e){this._themeroller()},this)).bind("close_node.jstree",e.proxy(function(e,t){this._themeroller(t.rslt.obj)},this)).bind("delete_node.jstree",e.proxy(function(e,t){this._themeroller(t.rslt.parent)},this)).bind("correct_state.jstree",e.proxy(function(e,i){i.rslt.obj.children("ins.jstree-icon").removeClass(t.opened+" "+t.closed+" ui-icon").end().find("> a > ins.ui-icon").filter(function(){return-1===this.className.toString().replace(t.item_clsd,"").replace(t.item_open,"").replace(t.item_leaf,"").indexOf("ui-icon-")}).removeClass(t.item_open+" "+t.item_clsd).addClass(t.item_leaf||"jstree-no-icon")},this)).bind("select_node.jstree",e.proxy(function(e,i){i.rslt.obj.children("a").addClass(t.item_a)},this)).bind("deselect_node.jstree deselect_all.jstree",e.proxy(function(e,i){this.get_container().find("a."+t.item_a).removeClass(t.item_a).end().find("a.jstree-clicked").addClass(t.item_a)},this)).bind("dehover_node.jstree",e.proxy(function(e,i){i.rslt.obj.children("a").removeClass(t.item_h)},this)).bind("hover_node.jstree",e.proxy(function(e,i){this.get_container().find("a."+t.item_h).not(i.rslt.obj).removeClass(t.item_h),i.rslt.obj.children("a").addClass(t.item_h)},this)).bind("move_node.jstree",e.proxy(function(e,t){this._themeroller(t.rslt.o),this._themeroller(t.rslt.op)},this))},__destroy:function(){var t=this._get_settings().themeroller,i=["ui-icon"];e.each(t,function(e,t){t=t.split(" "),t.length&&(i=i.concat(t))}),this.get_container().removeClass("ui-widget-content").find("."+i.join(", .")).removeClass(i.join(" "))},_fn:{_themeroller:function(e){var t=this._get_settings().themeroller;e=e&&-1!=e?this._get_node(e):this.get_container_ul(),e=e&&-1!=e?e.parent():this.get_container_ul(),e.find("li.jstree-closed").children("ins.jstree-icon").removeClass(t.opened).addClass("ui-icon "+t.closed).end().children("a").addClass(t.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(t.item_clsd,"").replace(t.item_open,"").replace(t.item_leaf,"").indexOf("ui-icon-")}).removeClass(t.item_leaf+" "+t.item_open).addClass(t.item_clsd||"jstree-no-icon").end().end().end().end().find("li.jstree-open").children("ins.jstree-icon").removeClass(t.closed).addClass("ui-icon "+t.opened).end().children("a").addClass(t.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(t.item_clsd,"").replace(t.item_open,"").replace(t.item_leaf,"").indexOf("ui-icon-")}).removeClass(t.item_leaf+" "+t.item_clsd).addClass(t.item_open||"jstree-no-icon").end().end().end().end().find("li.jstree-leaf").children("ins.jstree-icon").removeClass(t.closed+" ui-icon "+t.opened).end().children("a").addClass(t.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(t.item_clsd,"").replace(t.item_open,"").replace(t.item_leaf,"").indexOf("ui-icon-")}).removeClass(t.item_clsd+" "+t.item_open).addClass(t.item_leaf||"jstree-no-icon")}},defaults:{opened:"ui-icon-triangle-1-se",closed:"ui-icon-triangle-1-e",item:"ui-state-default",item_h:"ui-state-hover",item_a:"ui-state-active",item_open:"ui-icon-folder-open",item_clsd:"ui-icon-folder-collapsed",item_leaf:"ui-icon-document"}}),e(function(){var t=".jstree-themeroller .ui-icon { overflow:visible; } .jstree-themeroller a { padding:0 2px; } .jstree-themeroller .jstree-no-icon { display:none; }";e.vakata.css.add_sheet({str:t,title:"jstree"})})}(jQuery),function(e){e.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",e.proxy(function(t,i){var n,s,a=[],r=!0;return"move_node"==i.func&&i.args[4]===!0&&i.args[0].o&&i.args[0].o.length&&(i.args[0].o.children("a").each(function(){a.push(e(this).text().replace(/^\s+/g,""))}),r=this._check_unique(a,i.args[0].np.find("> ul > li").not(i.args[0].o),"move_node")),"create_node"==i.func&&(i.args[4]||this._is_loaded(i.args[0]))&&(n=this._get_node(i.args[0]),!i.args[1]||"before"!==i.args[1]&&"after"!==i.args[1]||(n=this._get_parent(i.args[0]),n&&-1!==n||(n=this.get_container())),"string"==typeof i.args[2]?a.push(i.args[2]):i.args[2]&&i.args[2].data?a.push(i.args[2].data):a.push(this._get_string("new_node")),r=this._check_unique(a,n.find("> ul > li"),"create_node")),"rename_node"==i.func&&(a.push(i.args[1]),s=this._get_node(i.args[0]),n=this._get_parent(s),n&&-1!==n||(n=this.get_container()),r=this._check_unique(a,n.find("> ul > li").not(s),"rename_node")),r?void 0:(t.stopPropagation(),!1)},this))},defaults:{error_callback:e.noop},_fn:{_check_unique:function(t,i,n){var s=[],a=!0;return i.children("a").each(function(){s.push(e(this).text().replace(/^\s+/g,""))}),s.length&&t.length?(e.each(t,function(t,i){return-1!==e.inArray(i,s)?(a=!1,!1):void 0}),a||this._get_settings().unique.error_callback.call(null,t,i,n),a):!0},check_move:function(){if(!this.__call_old())return!1;var t=this._get_move(),i=[];return t.o&&t.o.length?(t.o.children("a").each(function(){i.push(e(this).text().replace(/^\s+/g,""))}),this._check_unique(i,t.np.find("> ul > li").not(t.o),"check_move")):!0}}})}(jQuery),function(n){n.jstree.plugin("wholerow",{__init:function(){if(!this.data.ui)throw"jsTree wholerow: jsTree UI plugin not included.";this.data.wholerow.html=!1,this.data.wholerow.to=!1,this.get_container().bind("init.jstree",n.proxy(function(e,t){this._get_settings().core.animation=0},this)).bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree",n.proxy(function(e,t){this._prepare_wholerow_span(t&&t.rslt&&t.rslt.obj?t.rslt.obj:-1)},this)).bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree",n.proxy(function(e,t){this.data.to&&clearTimeout(this.data.to),this.data.to=setTimeout(function(e,t){return function(){e._prepare_wholerow_ul(t)}}(this,t&&t.rslt&&t.rslt.obj?t.rslt.obj:-1),0)},this)).bind("deselect_all.jstree",n.proxy(function(e,t){this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked "+(this.data.themeroller?this._get_settings().themeroller.item_a:""))},this)).bind("select_node.jstree deselect_node.jstree ",n.proxy(function(e,t){t.rslt.obj.each(function(){var e=t.inst.get_container().find(" > .jstree-wholerow li:visible:eq("+parseInt((n(this).offset().top-t.inst.get_container().offset().top+t.inst.get_container()[0].scrollTop)/t.inst.data.core.li_height,10)+")");e.children("a").attr("class",t.rslt.obj.children("a").attr("class"))})},this)).bind("hover_node.jstree dehover_node.jstree",n.proxy(function(e,t){if(this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered "+(this.data.themeroller?this._get_settings().themeroller.item_h:"")),"hover_node"===e.type){var i=this.get_container().find(" > .jstree-wholerow li:visible:eq("+parseInt((t.rslt.obj.offset().top-this.get_container().offset().top+this.get_container()[0].scrollTop)/this.data.core.li_height,10)+")");i.children("a").attr("class",t.rslt.obj.children(".jstree-hovered").attr("class"))}},this)).delegate(".jstree-wholerow-span, ins.jstree-icon, li","click.jstree",function(e){var t=n(e.currentTarget);"A"===e.target.tagName||"INS"===e.target.tagName&&t.closest("li").is(".jstree-open, .jstree-closed")||(t.closest("li").children("a:visible:eq(0)").click(),e.stopImmediatePropagation())}).delegate("li","mouseover.jstree",n.proxy(function(e){return e.stopImmediatePropagation(),n(e.currentTarget).children(".jstree-hovered, .jstree-clicked").length?!1:(this.hover_node(e.currentTarget),!1)},this)).delegate("li","mouseleave.jstree",n.proxy(function(e){n(e.currentTarget).children("a").hasClass("jstree-hovered").length||this.dehover_node(e.currentTarget)},this)),(t||e)&&n.vakata.css.add_sheet({str:".jstree-"+this.get_index()+" { position:relative; } ",title:"jstree"})},defaults:{},__destroy:function(){this.get_container().children(".jstree-wholerow").remove(),this.get_container().find(".jstree-wholerow-span").remove()},_fn:{_prepare_wholerow_span:function(e){e=e&&-1!=e?this._get_node(e):this.get_container().find("> ul > li"),e!==!1&&e.each(function(){n(this).find("li").andSelf().each(function(){var e=n(this);return e.children(".jstree-wholerow-span").length?!0:void e.prepend("<span class='jstree-wholerow-span' style='width:"+18*e.parentsUntil(".jstree","li").length+"px;'>&#160;</span>")})})},_prepare_wholerow_ul:function(){var e=this.get_container().children("ul").eq(0),i=e.html();e.addClass("jstree-wholerow-real"),this.data.wholerow.last_html!==i&&(this.data.wholerow.last_html=i,this.get_container().children(".jstree-wholerow").remove(),this.get_container().append(e.clone().removeClass("jstree-wholerow-real").wrapAll("<div class='jstree-wholerow' />").parent().width(e.parent()[0].scrollWidth).css("top",-1*(e.height()+(t?5:0))).find("li[id]").each(function(){this.removeAttribute("id")}).end()))}}}),n(function(){var s=".jstree .jstree-wholerow-real { position:relative; z-index:1; } .jstree .jstree-wholerow-real li { cursor:pointer; } .jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } .jstree .jstree-wholerow { position:relative; z-index:0; height:0; } .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } .jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }";i&&(s+=".jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } .jstree .jstree-wholerow-real a { border-color:transparent !important; } "),(t||e)&&(s+=".jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } .jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } "),n.vakata.css.add_sheet({str:s,title:"jstree"})})}(jQuery),function(e){var t=["getChildren","getChildrenCount","getAttr","getName","getProps"],i=function(t,i){var n=!0;return t=t||{},i=[].concat(i),e.each(i,function(i,s){return e.isFunction(t[s])?void 0:(n=!1,!1)}),n};e.jstree.plugin("model",{__init:function(){if(!this.data.json_data)throw"jsTree model: jsTree json_data plugin not included.";this._get_settings().json_data.data=function(n,s){var a=-1==n?this._get_settings().model.object:n.data("jstree_model");return i(a,t)?void(this._get_settings().model.async?a.getChildren(e.proxy(function(e){this.model_done(e,s)},this)):this.model_done(a.getChildren(),s)):s.call(null,!1)}},defaults:{object:!1,id_prefix:!1,async:!1},_fn:{model_done:function(t,i){var n=[],s=this._get_settings(),a=this;e.isArray(t)||(t=[t]),e.each(t,function(t,i){var r=i.getProps()||{};r.attr=i.getAttr()||{},i.getChildrenCount()&&(r.state="closed"),r.data=i.getName(),e.isArray(r.data)||(r.data=[r.data]),a.data.types&&e.isFunction(i.getType)&&(r.attr[s.types.type_attr]=i.getType()),r.attr.id&&s.model.id_prefix&&(r.attr.id=s.model.id_prefix+r.attr.id),r.metadata||(r.metadata={}),r.metadata.jstree_model=i,n.push(r)}),i.call(null,n)}}})}(jQuery)}}()},{}],i18n:[function(e,t,i){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function e(){n(this,e),this.currentLocale=null,this.defaultLocale="en_US",this.lang={}}return s(e,[{key:"setLocale",value:function(e){this.currentLocale=e}},{key:"getLocale",value:function(){return null!==this.currentLocale?this.currentLocale:this.defaultLocale}},{key:"_t",value:function(e,t,i,n){var s=this.getLocale().replace(/_[\w]+/i,""),a=this.defaultLocale.replace(/_[\w]+/i,"");return this.lang&&this.lang[this.getLocale()]&&this.lang[this.getLocale()][e]?this.lang[this.getLocale()][e]:this.lang&&this.lang[s]&&this.lang[s][e]?this.lang[s][e]:this.lang&&this.lang[this.defaultLocale]&&this.lang[this.defaultLocale][e]?this.lang[this.defaultLocale][e]:this.lang&&this.lang[a]&&this.lang[a][e]?this.lang[a][e]:t?t:""}},{key:"addDictionary",value:function(e,t){"undefined"==typeof this.lang[e]&&(this.lang[e]={});for(var i in t)this.lang[e][i]=t[i]}},{key:"getDictionary",value:function(e){return this.lang[e]}},{key:"stripStr",value:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},{key:"stripStrML",value:function(e){for(var t=e.split("\n"),i=0;i<t.length;i+=1)t[i]=stripStr(t[i]);return stripStr(t.join(" "))}},{key:"sprintf",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];if(0===i.length)return e;var s=new RegExp("(.?)(%s)","g"),a=0;return e.replace(s,function(e,t,n,s,r){return"%"===t?e:t+i[a+=1]})}},{key:"inject",value:function(e,t){var i=new RegExp("{([A-Za-z0-9_]*)}","g");return e.replace(i,function(e,i,n,s){return t[i]?t[i]:e})}},{key:"detectLocale",value:function(){var t,i;if(t=jQuery("body").attr("lang"),!t)for(var n=document.getElementsByTagName("meta"),s=0;s<n.length;s++)n[s].attributes["http-equiv"]&&"content-language"==n[s].attributes["http-equiv"].nodeValue.toLowerCase()&&(t=n[s].attributes.content.nodeValue);t||(t=this.defaultLocale);var a=t.match(/([^-|_]*)[-|_](.*)/);if(2==t.length){for(var r in e.lang)if(r.substr(0,2).toLowerCase()==t.toLowerCase()){i=r;break}}else a&&(i=a[1].toLowerCase()+"_"+a[2].toUpperCase());return i}},{key:"addEvent",value:function(e,t,i,n){
return e.addEventListener?(e.addEventListener(t,i,n),!0):e.attachEvent?e.attachEvent("on"+t,i):void console.log("Handler could not be attached")}}]),e}(),r=new a;window.ss="undefined"!=typeof window.ss?window.ss:{},window.ss.i18n=window.i18n=r,i["default"]=r},{}],jQuery:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n="undefined"!=typeof window.jQuery?window.jQuery:null;i["default"]=n},{}]},{},[1]);

63
admin/javascript/dist/leaktools.js vendored Normal file
View File

@ -0,0 +1,63 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.leaktools', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssLeaktools = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var getHTML = function getHTML(el) {
var clone = el.cloneNode(true);
var div = (0, _jQuery2.default)('<div></div>');
div.append(clone);
return div.html();
};
_jQuery2.default.leaktools = {
logDuplicateElements: function logDuplicateElements() {
var els = (0, _jQuery2.default)('*');
var dirty = false;
els.each(function (i, a) {
els.not(a).each(function (j, b) {
if (getHTML(a) == getHTML(b)) {
dirty = true;
console.log(a, b);
}
});
});
if (!dirty) console.log('No duplicates found');
},
logUncleanedElements: function logUncleanedElements(clean) {
_jQuery2.default.each(_jQuery2.default.cache, function () {
var source = this.handle && this.handle.elem;
if (!source) return;
var parent = source;
while (parent && parent.nodeType == 1) {
parent = parent.parentNode;
}
if (!parent) {
console.log('Unattached', source);
console.log(this.events);
if (clean) (0, _jQuery2.default)(source).unbind().remove();
} else if (parent !== document) console.log('Attached, but to', parent, 'not our document', source);
});
}
};
});

185
admin/javascript/dist/sspath.js vendored Normal file
View File

@ -0,0 +1,185 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.sspath', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssSspath = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var $window = (0, _jQuery2.default)(window),
$html = (0, _jQuery2.default)('html'),
$head = (0, _jQuery2.default)('head'),
path = {
urlParseRE: /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
parseUrl: function parseUrl(url) {
if (_jQuery2.default.type(url) === "object") {
return url;
}
var matches = path.urlParseRE.exec(url || "") || [];
return {
href: matches[0] || "",
hrefNoHash: matches[1] || "",
hrefNoSearch: matches[2] || "",
domain: matches[3] || "",
protocol: matches[4] || "",
doubleSlash: matches[5] || "",
authority: matches[6] || "",
username: matches[8] || "",
password: matches[9] || "",
host: matches[10] || "",
hostname: matches[11] || "",
port: matches[12] || "",
pathname: matches[13] || "",
directory: matches[14] || "",
filename: matches[15] || "",
search: matches[16] || "",
hash: matches[17] || ""
};
},
makePathAbsolute: function makePathAbsolute(relPath, absPath) {
if (relPath && relPath.charAt(0) === "/") {
return relPath;
}
relPath = relPath || "";
absPath = absPath ? absPath.replace(/^\/|(\/[^\/]*|[^\/]+)$/g, "") : "";
var absStack = absPath ? absPath.split("/") : [],
relStack = relPath.split("/");
for (var i = 0; i < relStack.length; i++) {
var d = relStack[i];
switch (d) {
case ".":
break;
case "..":
if (absStack.length) {
absStack.pop();
}
break;
default:
absStack.push(d);
break;
}
}
return "/" + absStack.join("/");
},
isSameDomain: function isSameDomain(absUrl1, absUrl2) {
return path.parseUrl(absUrl1).domain === path.parseUrl(absUrl2).domain;
},
isRelativeUrl: function isRelativeUrl(url) {
return path.parseUrl(url).protocol === "";
},
isAbsoluteUrl: function isAbsoluteUrl(url) {
return path.parseUrl(url).protocol !== "";
},
makeUrlAbsolute: function makeUrlAbsolute(relUrl, absUrl) {
if (!path.isRelativeUrl(relUrl)) {
return relUrl;
}
var relObj = path.parseUrl(relUrl),
absObj = path.parseUrl(absUrl),
protocol = relObj.protocol || absObj.protocol,
doubleSlash = relObj.protocol ? relObj.doubleSlash : relObj.doubleSlash || absObj.doubleSlash,
authority = relObj.authority || absObj.authority,
hasPath = relObj.pathname !== "",
pathname = path.makePathAbsolute(relObj.pathname || absObj.filename, absObj.pathname),
search = relObj.search || !hasPath && absObj.search || "",
hash = relObj.hash;
return protocol + doubleSlash + authority + pathname + search + hash;
},
addSearchParams: function addSearchParams(url, params) {
var u = path.parseUrl(url),
params = typeof params === "string" ? path.convertSearchToArray(params) : params,
newParams = _jQuery2.default.extend(path.convertSearchToArray(u.search), params);
return u.hrefNoSearch + '?' + _jQuery2.default.param(newParams) + (u.hash || "");
},
getSearchParams: function getSearchParams(url) {
var u = path.parseUrl(url);
return path.convertSearchToArray(u.search);
},
convertSearchToArray: function convertSearchToArray(search) {
var params = {},
search = search.replace(/^\?/, ''),
parts = search ? search.split('&') : [],
i,
tmp;
for (i = 0; i < parts.length; i++) {
tmp = parts[i].split('=');
params[tmp[0]] = tmp[1];
}
return params;
},
convertUrlToDataUrl: function convertUrlToDataUrl(absUrl) {
var u = path.parseUrl(absUrl);
if (path.isEmbeddedPage(u)) {
return u.hash.split(dialogHashKey)[0].replace(/^#/, "");
} else if (path.isSameDomain(u, document)) {
return u.hrefNoHash.replace(document.domain, "");
}
return absUrl;
},
get: function get(newPath) {
if (newPath === undefined) {
newPath = location.hash;
}
return path.stripHash(newPath).replace(/[^\/]*\.[^\/*]+$/, '');
},
getFilePath: function getFilePath(path) {
var splitkey = '&' + _jQuery2.default.mobile.subPageUrlKey;
return path && path.split(splitkey)[0].split(dialogHashKey)[0];
},
set: function set(path) {
location.hash = path;
},
isPath: function isPath(url) {
return (/\//.test(url)
);
},
clean: function clean(url) {
return url.replace(document.domain, "");
},
stripHash: function stripHash(url) {
return url.replace(/^#/, "");
},
cleanHash: function cleanHash(hash) {
return path.stripHash(hash.replace(/\?.*$/, "").replace(dialogHashKey, ""));
},
isExternal: function isExternal(url) {
var u = path.parseUrl(url);
return u.protocol && u.domain !== document.domain ? true : false;
},
hasProtocol: function hasProtocol(url) {
return (/^(:?\w+:)/.test(url)
);
}
};
_jQuery2.default.path = path;
});

249
admin/javascript/dist/ssui.core.js vendored Normal file
View File

@ -0,0 +1,249 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.ssui.core', ['jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssSsuiCore = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.widget('ssui.button', _jQuery2.default.ui.button, {
options: {
alternate: {
icon: null,
text: null
},
showingAlternate: false
},
toggleAlternate: function toggleAlternate() {
if (this._trigger('ontogglealternate') === false) return;
if (!this.options.alternate.icon && !this.options.alternate.text) return;
this.options.showingAlternate = !this.options.showingAlternate;
this.refresh();
},
_refreshAlternate: function _refreshAlternate() {
this._trigger('beforerefreshalternate');
if (!this.options.alternate.icon && !this.options.alternate.text) return;
if (this.options.showingAlternate) {
this.element.find('.ui-button-icon-primary').hide();
this.element.find('.ui-button-text').hide();
this.element.find('.ui-button-icon-alternate').show();
this.element.find('.ui-button-text-alternate').show();
} else {
this.element.find('.ui-button-icon-primary').show();
this.element.find('.ui-button-text').show();
this.element.find('.ui-button-icon-alternate').hide();
this.element.find('.ui-button-text-alternate').hide();
}
this._trigger('afterrefreshalternate');
},
_resetButton: function _resetButton() {
var iconPrimary = this.element.data('icon-primary'),
iconSecondary = this.element.data('icon-secondary');
if (!iconPrimary) iconPrimary = this.element.data('icon');
if (iconPrimary) this.options.icons.primary = 'btn-icon-' + iconPrimary;
if (iconSecondary) this.options.icons.secondary = 'btn-icon-' + iconSecondary;
_jQuery2.default.ui.button.prototype._resetButton.call(this);
if (!this.options.alternate.text) {
this.options.alternate.text = this.element.data('text-alternate');
}
if (!this.options.alternate.icon) {
this.options.alternate.icon = this.element.data('icon-alternate');
}
if (!this.options.showingAlternate) {
this.options.showingAlternate = this.element.hasClass('ss-ui-alternate');
}
if (this.options.alternate.icon) {
this.buttonElement.append("<span class='ui-button-icon-alternate ui-button-icon-primary ui-icon btn-icon-" + this.options.alternate.icon + "'></span>");
}
if (this.options.alternate.text) {
this.buttonElement.append("<span class='ui-button-text-alternate ui-button-text'>" + this.options.alternate.text + "</span>");
}
this._refreshAlternate();
},
refresh: function refresh() {
_jQuery2.default.ui.button.prototype.refresh.call(this);
this._refreshAlternate();
},
destroy: function destroy() {
this.element.find('.ui-button-text-alternate').remove();
this.element.find('.ui-button-icon-alternate').remove();
_jQuery2.default.ui.button.prototype.destroy.call(this);
}
});
_jQuery2.default.widget("ssui.ssdialog", _jQuery2.default.ui.dialog, {
options: {
iframeUrl: '',
reloadOnOpen: true,
dialogExtraClass: '',
modal: true,
bgiframe: true,
autoOpen: false,
autoPosition: true,
minWidth: 500,
maxWidth: 800,
minHeight: 300,
maxHeight: 700,
widthRatio: 0.8,
heightRatio: 0.8,
resizable: false
},
_create: function _create() {
_jQuery2.default.ui.dialog.prototype._create.call(this);
var self = this;
var iframe = (0, _jQuery2.default)('<iframe marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto"></iframe>');
iframe.bind('load', function (e) {
if ((0, _jQuery2.default)(this).attr('src') == 'about:blank') return;
iframe.addClass('loaded').show();
self._resizeIframe();
self.uiDialog.removeClass('loading');
}).hide();
if (this.options.dialogExtraClass) this.uiDialog.addClass(this.options.dialogExtraClass);
this.element.append(iframe);
if (this.options.iframeUrl) this.element.css('overflow', 'hidden');
},
open: function open() {
_jQuery2.default.ui.dialog.prototype.open.call(this);
var self = this,
iframe = this.element.children('iframe');
if (this.options.iframeUrl && (!iframe.hasClass('loaded') || this.options.reloadOnOpen)) {
iframe.hide();
iframe.attr('src', this.options.iframeUrl);
this.uiDialog.addClass('loading');
}
(0, _jQuery2.default)(window).bind('resize.ssdialog', function () {
self._resizeIframe();
});
},
close: function close() {
_jQuery2.default.ui.dialog.prototype.close.call(this);
this.uiDialog.unbind('resize.ssdialog');
(0, _jQuery2.default)(window).unbind('resize.ssdialog');
},
_resizeIframe: function _resizeIframe() {
var opts = {},
newWidth,
newHeight,
iframe = this.element.children('iframe');
;
if (this.options.widthRatio) {
newWidth = (0, _jQuery2.default)(window).width() * this.options.widthRatio;
if (this.options.minWidth && newWidth < this.options.minWidth) {
opts.width = this.options.minWidth;
} else if (this.options.maxWidth && newWidth > this.options.maxWidth) {
opts.width = this.options.maxWidth;
} else {
opts.width = newWidth;
}
}
if (this.options.heightRatio) {
newHeight = (0, _jQuery2.default)(window).height() * this.options.heightRatio;
if (this.options.minHeight && newHeight < this.options.minHeight) {
opts.height = this.options.minHeight;
} else if (this.options.maxHeight && newHeight > this.options.maxHeight) {
opts.height = this.options.maxHeight;
} else {
opts.height = newHeight;
}
}
if (!jQuery.isEmptyObject(opts)) {
this._setOptions(opts);
iframe.attr('width', opts.width - parseFloat(this.element.css('paddingLeft')) - parseFloat(this.element.css('paddingRight')));
iframe.attr('height', opts.height - parseFloat(this.element.css('paddingTop')) - parseFloat(this.element.css('paddingBottom')));
if (this.options.autoPosition) {
this._setOption("position", this.options.position);
}
}
}
});
_jQuery2.default.widget("ssui.titlebar", {
_create: function _create() {
this.originalTitle = this.element.attr('title');
var self = this;
var options = this.options;
var title = options.title || this.originalTitle || '&nbsp;';
var titleId = _jQuery2.default.ui.dialog.getTitleId(this.element);
this.element.parent().addClass('ui-dialog');
var uiDialogTitlebar = this.element.addClass('ui-dialog-titlebar ' + 'ui-widget-header ' + 'ui-corner-all ' + 'ui-helper-clearfix');
if (options.closeButton) {
var uiDialogTitlebarClose = (0, _jQuery2.default)('<a href="#"/>').addClass('ui-dialog-titlebar-close ' + 'ui-corner-all').attr('role', 'button').hover(function () {
uiDialogTitlebarClose.addClass('ui-state-hover');
}, function () {
uiDialogTitlebarClose.removeClass('ui-state-hover');
}).focus(function () {
uiDialogTitlebarClose.addClass('ui-state-focus');
}).blur(function () {
uiDialogTitlebarClose.removeClass('ui-state-focus');
}).mousedown(function (ev) {
ev.stopPropagation();
}).appendTo(uiDialogTitlebar);
var uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = (0, _jQuery2.default)('<span/>')).addClass('ui-icon ' + 'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose);
}
var uiDialogTitle = (0, _jQuery2.default)('<span/>').addClass('ui-dialog-title').attr('id', titleId).html(title).prependTo(uiDialogTitlebar);
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
},
destroy: function destroy() {
this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');
this.originalTitle && this.element.attr('title', this.originalTitle);
}
});
_jQuery2.default.extend(_jQuery2.default.ssui.titlebar, {
version: "0.0.1",
options: {
title: '',
closeButton: false,
closeText: 'close'
},
uuid: 0,
getTitleId: function getTitleId($el) {
return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
}
});
});

View File

@ -0,0 +1,23 @@
/**
* File: LeftAndMain.js
*/
import $ from 'jQuery';
$.noConflict();
// setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
$.entwine('ss', function($) {
// Make all buttons "hoverable" with jQuery theming.
$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({
onadd: function() {
this.addClass('ss-ui-button');
if(!this.data('button')) this.button();
this._super();
},
onremove: function() {
if(this.data('button')) this.button('destroy');
this._super();
}
});
});

View File

@ -0,0 +1,239 @@
/**
* File: LeftAndMain.ActionTabset.js
*
* Contains rules for .ss-ui-action-tabset, used for:
* * Site tree action tabs (to perform actions on the site tree)
* * Actions menu (Edit page actions)
*
*/
import $ from 'jQuery';
$.entwine('ss', function($) {
/**
* Generic rules for all ss-ui-action-tabsets
* * ActionMenus
* * SiteTree ActionTabs
*/
$('.ss-tabset.ss-ui-action-tabset').entwine({
// Ignore tab state so it will not be reopened on form submission.
IgnoreTabState: true,
onadd: function() {
// Make sure the .ss-tabset is already initialised to apply our modifications on top.
this._super();
//Set actionTabs to allow closing and be closed by default
this.tabs({'collapsible': true, 'active': false});
},
onremove: function() {
// Remove all bound events.
// This guards against an edge case where the click handlers are not unbound
// because the panel is still open when the ajax edit form reloads.
var frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset');
});
$(document).off('click.ss-ui-action-tabset');
this._super();
},
/**
* Deal with available vertical space
*/
'ontabsbeforeactivate': function(event, ui) {
this.riseUp(event, ui);
},
/**
* Handle opening and closing tabs
*/
onclick: function(event, ui) {
this.attachCloseHandler(event, ui);
},
/**
* Generic function to close open tabs. Stores event in a handler,
* and removes the bound event once activated.
*
* Note: Should be called by a click event attached to 'this'
*/
attachCloseHandler: function(event, ui) {
var that = this, frame = $('.cms-container').find('iframe'), closeHandler;
// Create a handler for the click event so we can close tabs
// and easily remove the event once done
closeHandler = function(event) {
var panel, frame;
panel = $(event.target).closest('.ss-ui-action-tabset .ui-tabs-panel');
// If anything except the ui-nav button or panel is clicked,
// close panel and remove handler. We can't close if click was
// within panel, as it might've caused a button action,
// and we need to show its loading indicator.
if (!$(event.target).closest(that).length && !panel.length) {
that.tabs('option', 'active', false); // close tabs
// remove click event from objects it is bound to (iframe's and document)
frame = $('.cms-container').find('iframe');
frame.each(function(index, iframe){
$(iframe).contents().off('click.ss-ui-action-tabset', closeHandler);
});
$(document).off('click.ss-ui-action-tabset', closeHandler);
}
};
// Bind click event to document, and use closeHandler to handle the event
$(document).on('click.ss-ui-action-tabset', closeHandler);
// Make sure iframe click also closes tab
// iframe needs a special case, else the click event will not register here
if(frame.length > 0){
frame.each(function(index, iframe) {
$(iframe).contents().on('click.ss-ui-action-tabset', closeHandler);
});
}
},
/**
* Function riseUp checks to see if a tab should be opened upwards
* (based on space concerns). If true, the rise-up class is applied
* and a new position is calculated and applied to the element.
*
* Note: Should be called by a tabsbeforeactivate event
*/
riseUp: function(event, ui) {
var elHeight, trigger, endOfWindow, elPos, activePanel, activeTab, topPosition, containerSouth, padding;
// Get the numbers needed to calculate positions
elHeight = $(this).find('.ui-tabs-panel').outerHeight();
trigger = $(this).find('.ui-tabs-nav').outerHeight();
endOfWindow = ($(window).height() + $(document).scrollTop()) - trigger;
elPos = $(this).find('.ui-tabs-nav').offset().top;
activePanel = ui.newPanel;
activeTab = ui.newTab;
if (elPos + elHeight >= endOfWindow && elPos - elHeight > 0){
this.addClass('rise-up');
if (activeTab.position() !== null){
topPosition = -activePanel.outerHeight();
containerSouth = activePanel.parents('.south');
if (containerSouth){
// If container is the southern panel, make tab appear from the top of the container
padding = activeTab.offset().top - containerSouth.offset().top;
topPosition = topPosition-padding;
}
$(activePanel).css('top',topPosition+"px");
}
} else {
// else remove the rise-up class and set top to 0
this.removeClass('rise-up');
if (activeTab.position() !== null){
$(activePanel).css('top','0px');
}
}
return false;
}
});
/**
* ActionMenus
* * Specific rules for ActionMenus, used for edit page actions
*/
$('.cms-content-actions .ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
//Set the position of the opening tab (if it exists)
if($(ui.newPanel).length > 0){
$(ui.newPanel).css('left', ui.newTab.position().left+"px");
}
}
});
/**
* SiteTree ActionTabs
* Specific rules for site tree action tabs. Applies to tabs
* within the expanded content area, and within the sidebar
*/
$('.cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
// Remove tabset open classes (Last gets a unique class
// in the bigger sitetree. Remove this if we have it)
$(this).closest('.ss-ui-action-tabset')
.removeClass('tabset-open tabset-open-last');
}
});
/**
* SiteTree ActionTabs: expanded
* * Specific rules for siteTree actions within the expanded content area.
*/
$('.cms-content-fields .ss-tabset.ss-ui-action-tabset').entwine({
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
if($( ui.newPanel).length > 0){
if($(ui.newTab).hasClass("last")){
// Align open tab to the right (because opened tab is last)
$(ui.newPanel).css({'left': 'auto', 'right': '0px'});
// Last needs to be styled differently when open, so apply a unique class
$(ui.newPanel).parent().addClass('tabset-open-last');
}else{
// Assign position to tabpanel based on position of relivent active tab item
$(ui.newPanel).css('left', ui.newTab.position().left+"px");
// If this is the first tab, make sure the position doesn't include border
// (hard set position to 0 ), and add the tab-set open class
if($(ui.newTab).hasClass("first")){
$(ui.newPanel).css('left',"0px");
$(ui.newPanel).parent().addClass('tabset-open');
}
}
}
}
});
/**
* SiteTree ActionTabs: sidebar
* * Specific rules for when the site tree actions panel appears in
* * the side-bar
*/
$('.cms-tree-view-sidebar .cms-actions-row.ss-tabset.ss-ui-action-tabset').entwine({
// If actions panel is within the sidebar, apply active class
// to help animate open/close on hover
'from .ui-tabs-nav li': {
onhover: function(e) {
$(e.target).parent().find('li .active').removeClass('active');
$(e.target).find('a').addClass('active');
}
},
/**
* Make necessary adjustments before tab is activated
*/
'ontabsbeforeactivate': function(event, ui) {
this._super(event, ui);
// Reset position of tabs, else anyone going between the large
// and the small sitetree will see broken tabs
// Apply styles with .css, to avoid overriding currently applied styles
$(ui.newPanel).css({'left': 'auto', 'right': 'auto'});
if($(ui.newPanel).length > 0){
$(ui.newPanel).parent().addClass('tabset-open');
}
}
});
});

View File

@ -0,0 +1,392 @@
/**
* File: LeftAndMain.BatchActions.js
*/
import $ from 'jQuery';
import i18n from 'i18n';
$.entwine('ss.tree', function($){
/**
* Class: #Form_BatchActionsForm
*
* Batch actions which take a bunch of selected pages,
* usually from the CMS tree implementation, and perform serverside
* callbacks on the whole set. We make the tree selectable when the jQuery.UI tab
* enclosing this form is opened.
*
* Events:
* register - Called before an action is added.
* unregister - Called before an action is removed.
*/
$('#Form_BatchActionsForm').entwine({
/**
* Variable: Actions
* (Array) Stores all actions that can be performed on the collected IDs as
* function closures. This might trigger filtering of the selected IDs,
* a confirmation message, etc.
*/
Actions: [],
getTree: function() {
return $('.cms-tree');
},
fromTree: {
oncheck_node: function(e, data){
this.serializeFromTree();
},
onuncheck_node: function(e, data){
this.serializeFromTree();
}
},
/**
* @func registerDefault
* @desc Register default bulk confirmation dialogs
*/
registerDefault: function() {
// Publish selected pages action
this.register('admin/pages/batchactions/publish', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_PUBLISH_PROMPT",
"You have {num} page(s) selected.\n\nDo you really want to publish?"
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
// Unpublish selected pages action
this.register('admin/pages/batchactions/unpublish', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_UNPUBLISH_PROMPT",
"You have {num} page(s) selected.\n\nDo you really want to unpublish"
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
// Delete selected pages action
// @deprecated since 4.0 Use archive instead
this.register('admin/pages/batchactions/delete', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_DELETE_PROMPT",
"You have {num} page(s) selected.\n\nDo you really want to delete?"
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
// Delete selected pages action
this.register('admin/pages/batchactions/archive', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_ARCHIVE_PROMPT",
"You have {num} page(s) selected.\n\nAre you sure you want to archive these pages?\n\nThese pages and all of their children pages will be unpublished and sent to the archive."
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
// Restore selected archived pages
this.register('admin/pages/batchactions/restore', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_RESTORE_PROMPT",
"You have {num} page(s) selected.\n\nDo you really want to restore to stage?\n\nChildren of archived pages will be restored to the root level, unless those pages are also being restored."
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
// Delete selected pages from live action
this.register('admin/pages/batchactions/deletefromlive', function(ids) {
var confirmed = confirm(
i18n.inject(
i18n._t(
"CMSMAIN.BATCH_DELETELIVE_PROMPT",
"You have {num} page(s) selected.\n\nDo you really want to delete these pages from live?"
),
{'num': ids.length}
)
);
return (confirmed) ? ids : false;
});
},
onadd: function() {
this.registerDefault();
this._super();
},
/**
* @func register
* @param {string} type
* @param {function} callback
*/
register: function(type, callback) {
this.trigger('register', {type: type, callback: callback});
var actions = this.getActions();
actions[type] = callback;
this.setActions(actions);
},
/**
* @func unregister
* @param {string} type
* @desc Remove an existing action.
*/
unregister: function(type) {
this.trigger('unregister', {type: type});
var actions = this.getActions();
if(actions[type]) delete actions[type];
this.setActions(actions);
},
/**
* @func refreshSelected
* @param {object} rootNode
* @desc Ajax callbacks determine which pages is selectable in a certain batch action.
*/
refreshSelected : function(rootNode) {
var self = this,
st = this.getTree(),
ids = this.getIDs(),
allIds = [],
viewMode = $('.cms-content-batchactions-button'),
selectedAction = this.find(':input[name=Action]').val();
// Default to refreshing the entire tree
if(rootNode == null) rootNode = st;
for(var idx in ids) {
$($(st).getNodeByID(idx)).addClass('selected').attr('selected', 'selected');
}
// If no action is selected, enable all nodes
if(!selectedAction || selectedAction == -1 || !viewMode.hasClass('active')) {
$(rootNode).find('li').each(function() {
$(this).setEnabled(true);
});
return;
}
// Disable the nodes while the ajax request is being processed
$(rootNode).find('li').each(function() {
allIds.push($(this).data('id'));
$(this).addClass('treeloading').setEnabled(false);
});
// Post to the server to ask which pages can have this batch action applied
var applicablePagesURL = selectedAction + '/applicablepages/?csvIDs=' + allIds.join(',');
jQuery.getJSON(applicablePagesURL, function(applicableIDs) {
// Set a CSS class on each tree node indicating which can be batch-actioned and which can't
jQuery(rootNode).find('li').each(function() {
$(this).removeClass('treeloading');
var id = $(this).data('id');
if(id == 0 || $.inArray(id, applicableIDs) >= 0) {
$(this).setEnabled(true);
} else {
// De-select the node if it's non-applicable
$(this).removeClass('selected').setEnabled(false);
$(this).prop('selected', false);
}
});
self.serializeFromTree();
});
},
/**
* @func serializeFromTree
* @return {boolean}
*/
serializeFromTree: function() {
var tree = this.getTree(), ids = tree.getSelectedIDs();
// write IDs to the hidden field
this.setIDs(ids);
return true;
},
/**
* @func setIDS
* @param {array} ids
*/
setIDs: function(ids) {
this.find(':input[name=csvIDs]').val(ids ? ids.join(',') : null);
},
/**
* @func getIDS
* @return {array}
*/
getIDs: function() {
// Map empty value to empty array
var value = this.find(':input[name=csvIDs]').val();
return value
? value.split(',')
: [];
},
onsubmit: function(e) {
var self = this, ids = this.getIDs(), tree = this.getTree(), actions = this.getActions();
// if no nodes are selected, return with an error
if(!ids || !ids.length) {
alert(i18n._t('CMSMAIN.SELECTONEPAGE', 'Please select at least one page'));
e.preventDefault();
return false;
}
// apply callback, which might modify the IDs
var type = this.find(':input[name=Action]').val();
if(actions[type]) {
ids = this.getActions()[type].apply(this, [ids]);
}
// Discontinue processing if there are no further items
if(!ids || !ids.length) {
e.preventDefault();
return false;
}
// write (possibly modified) IDs back into to the hidden field
this.setIDs(ids);
// Reset failure states
tree.find('li').removeClass('failed');
var button = this.find(':submit:first');
button.addClass('loading');
jQuery.ajax({
// don't use original form url
url: type,
type: 'POST',
data: this.serializeArray(),
complete: function(xmlhttp, status) {
button.removeClass('loading');
// Refresh the tree.
// Makes sure all nodes have the correct CSS classes applied.
tree.jstree('refresh', -1);
self.setIDs([]);
// Reset action
self.find(':input[name=Action]').val('').change();
// status message (decode into UTF-8, HTTP headers don't allow multibyte)
var msg = xmlhttp.getResponseHeader('X-Status');
if(msg) statusMessage(decodeURIComponent(msg), (status == 'success') ? 'good' : 'bad');
},
success: function(data, status) {
var id, node;
if(data.modified) {
var modifiedNodes = [];
for(id in data.modified) {
node = tree.getNodeByID(id);
tree.jstree('set_text', node, data.modified[id]['TreeTitle']);
modifiedNodes.push(node);
}
$(modifiedNodes).effect('highlight');
}
if(data.deleted) {
for(id in data.deleted) {
node = tree.getNodeByID(id);
if(node.length) tree.jstree('delete_node', node);
}
}
if(data.error) {
for(id in data.error) {
node = tree.getNodeByID(id);
$(node).addClass('failed');
}
}
},
dataType: 'json'
});
// Never process this action; Only invoke via ajax
e.preventDefault();
return false;
}
});
$('.cms-content-batchactions-button').entwine({
onmatch: function () {
this._super();
this.updateTree();
},
onunmatch: function () {
this._super();
},
onclick: function (e) {
this.updateTree();
},
updateTree: function () {
var tree = $('.cms-tree'),
form = $('#Form_BatchActionsForm');
this._super();
if(this.data('active')) {
tree.addClass('multiple');
tree.removeClass('draggable');
form.serializeFromTree();
} else {
tree.removeClass('multiple');
tree.addClass('draggable');
}
$('#Form_BatchActionsForm').refreshSelected();
}
});
/**
* Class: #Form_BatchActionsForm :select[name=Action]
*/
$('#Form_BatchActionsForm select[name=Action]').entwine({
onchange: function(e) {
var form = $(e.target.form),
btn = form.find(':submit'),
selected = $(e.target).val();
if(!selected || selected == -1) {
btn.attr('disabled', 'disabled').button('refresh');
} else {
btn.removeAttr('disabled').button('refresh');
}
// Refresh selected / enabled nodes
$('#Form_BatchActionsForm').refreshSelected();
// TODO Should work by triggering change() along, but doesn't - entwine event bubbling?
this.trigger("liszt:updated");
this._super(e);
}
});
});

View File

@ -0,0 +1,97 @@
import $ from 'jQuery';
$.entwine('ss', function($){
/**
* The "content" area contains all of the section specific UI (excluding the menu).
* This area can be a form itself, as well as contain one or more forms.
* For example, a page edit form might fill the whole area,
* while a ModelAdmin layout shows a search form on the left, and edit form on the right.
*/
$('.cms-content').entwine({
onadd: function() {
var self = this;
// Force initialization of certain UI elements to avoid layout glitches
this.find('.cms-tabset').redrawTabs();
this._super();
},
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Force initialization of certain UI elements to avoid layout glitches
this.add(this.find('.cms-tabset')).redrawTabs();
this.find('.cms-content-header').redraw();
this.find('.cms-content-actions').redraw();
}
});
/**
* Load edit form for the selected node when its clicked.
*/
$('.cms-content .cms-tree').entwine({
onadd: function() {
var self = this;
this._super();
this.bind('select_node.jstree', function(e, data) {
var node = data.rslt.obj, loadedNodeID = self.find(':input[name=ID]').val(), origEvent = data.args[2], container = $('.cms-container');
// Don't trigger unless coming from a click event.
// Avoids problems with automated section switches from tree to detail view
// when JSTree auto-selects elements on first load.
if(!origEvent) {
return false;
}
// Don't allow checking disabled nodes
if($(node).hasClass('disabled')) return false;
// Don't allow reloading of currently selected node,
// mainly to avoid doing an ajax request on initial page load
if($(node).data('id') == loadedNodeID) return;
var url = $(node).find('a:first').attr('href');
if(url && url != '#') {
// strip possible querystrings from the url to avoid duplicateing document.location.search
url = url.split('?')[0];
// Deselect all nodes (will be reselected after load according to form state)
self.jstree('deselect_all');
self.jstree('uncheck_all');
// Ensure URL is absolute (important for IE)
if($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
// Retain search parameters
if(document.location.search) url = $.path.addSearchParams(url, document.location.search.replace(/^\?/, ''));
// Load new page
container.loadPanel(url);
} else {
self.removeForm();
}
});
}
});
$('.cms-content .cms-content-fields').entwine({
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
}
});
$('.cms-content .cms-content-header, .cms-content .cms-content-actions').entwine({
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Fix dimensions to actual extents, in preparation for a relayout via jslayout.
this.height('auto');
this.height(this.innerHeight()-this.css('padding-top')-this.css('padding-bottom'));
}
});
});

View File

@ -0,0 +1,417 @@
/**
* File: LeftAndMain.EditForm.js
*/
import $ from 'jQuery';
import i18n from 'i18n';
// Can't bind this through jQuery
window.onbeforeunload = function(e) {
var form = $('.cms-edit-form');
form.trigger('beforesubmitform');
if(form.is('.changed')) return i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
};
$.entwine('ss', function($){
/**
* Class: .cms-edit-form
*
* Base edit form, provides ajaxified saving
* and reloading itself through the ajax return values.
* Takes care of resizing tabsets within the layout container.
*
* Change tracking is enabled on all fields within the form. If you want
* to disable change tracking for a specific field, add a "no-change-track"
* class to it.
*
* @name ss.Form_EditForm
* @require jquery.changetracker
*
* Events:
* ajaxsubmit - Form is about to be submitted through ajax
* validate - Contains validation result
* load - Form is about to be loaded through ajax
*/
$('.cms-edit-form').entwine(/** @lends ss.Form_EditForm */{
/**
* Variable: PlaceholderHtml
* (String_ HTML text to show when no form content is chosen.
* Will show inside the <form> tag.
*/
PlaceholderHtml: '',
/**
* Variable: ChangeTrackerOptions
* (Object)
*/
ChangeTrackerOptions: {
ignoreFieldSelector: '.no-change-track, .ss-upload :input, .cms-navigator :input'
},
/**
* Constructor: onmatch
*/
onadd: function() {
var self = this;
// Turn off autocomplete to fix the access tab randomly switching radio buttons in Firefox
// when refresh the page with an anchor tag in the URL. E.g: /admin#Root_Access.
// Autocomplete in the CMS also causes strangeness in other browsers,
// filling out sections of the form that the user does not want to be filled out,
// so this turns it off for all browsers.
// See the following page for demo and explanation of the Firefox bug:
// http://www.ryancramer.com/journal/entries/radio_buttons_firefox/
this.attr("autocomplete", "off");
this._setupChangeTracker();
// Catch navigation events before they reach handleStateChange(),
// in order to avoid changing the menu state if the action is cancelled by the user
// $('.cms-menu')
// Optionally get the form attributes from embedded fields, see Form->formHtmlContent()
for(var overrideAttr in {'action':true,'method':true,'enctype':true,'name':true}) {
var el = this.find(':input[name='+ '_form_' + overrideAttr + ']');
if(el) {
this.attr(overrideAttr, el.val());
el.remove();
}
}
// TODO
// // Rewrite # links
// html = html.replace(/(<a[^>]+href *= *")#/g, '$1' + window.location.href.replace(/#.*$/,'') + '#');
//
// // Rewrite iframe links (for IE)
// html = html.replace(/(<iframe[^>]*src=")([^"]+)("[^>]*>)/g, '$1' + $('base').attr('href') + '$2$3');
// Show validation errors if necessary
if(this.hasClass('validationerror')) {
// Ensure the first validation error is visible
var tabError = this.find('.message.validation, .message.required').first().closest('.tab');
$('.cms-container').clearCurrentTabState(); // clear state to avoid override later on
tabError.closest('.ss-tabset').tabs('option', 'active', tabError.index('.tab'));
}
this._super();
},
onremove: function() {
this.changetracker('destroy');
this._super();
},
onmatch: function() {
this._super();
},
onunmatch: function() {
this._super();
},
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Force initialization of tabsets to avoid layout glitches
this.add(this.find('.cms-tabset')).redrawTabs();
this.find('.cms-content-header').redraw();
},
/**
* Function: _setupChangeTracker
*/
_setupChangeTracker: function() {
// Don't bind any events here, as we dont replace the
// full <form> tag by any ajax updates they won't automatically reapply
this.changetracker(this.getChangeTrackerOptions());
},
/**
* Function: confirmUnsavedChanges
*
* Checks the jquery.changetracker plugin status for this form,
* and asks the user for confirmation via a browser dialog if changes are detected.
* Doesn't cancel any unload or form removal events, you'll need to implement this based on the return
* value of this message.
*
* If changes are confirmed for discard, the 'changed' flag is reset.
*
* Returns:
* (Boolean) FALSE if the user wants to abort with changes present, TRUE if no changes are detected
* or the user wants to discard them.
*/
confirmUnsavedChanges: function() {
this.trigger('beforesubmitform');
if(!this.is('.changed')) {
return true;
}
var confirmed = confirm(i18n._t('LeftAndMain.CONFIRMUNSAVED'));
if(confirmed) {
// confirm discard changes
this.removeClass('changed');
}
return confirmed;
},
/**
* Function: onsubmit
*
* Suppress submission unless it is handled through ajaxSubmit().
*/
onsubmit: function(e, button) {
// Only submit if a button is present.
// This supressed submits from ENTER keys in input fields,
// which means the browser auto-selects the first available form button.
// This might be an unrelated button of the form field,
// or a destructive action (if "save" is not available, or not on first position).
if(this.prop("target") != "_blank") {
if(button) this.closest('.cms-container').submitForm(this, button);
return false;
}
},
/**
* Function: validate
*
* Hook in (optional) validation routines.
* Currently clientside validation is not supported out of the box in the CMS.
*
* Todo:
* Placeholder implementation
*
* Returns:
* {boolean}
*/
validate: function() {
var isValid = true;
this.trigger('validate', {isValid: isValid});
return isValid;
},
/*
* Track focus on htmleditor fields
*/
'from .htmleditor': {
oneditorinit: function(e){
var self = this,
field = $(e.target).closest('.field.htmleditor'),
editor = field.find('textarea.htmleditor').getEditor().getInstance();
// TinyMCE 4 will add a focus event, but for now, use click
editor.onClick.add(function(e){
self.saveFieldFocus(field.attr('id'));
});
}
},
/*
* Track focus on inputs
*/
'from .cms-edit-form :input:not(:submit)': {
onclick: function(e){
this.saveFieldFocus($(e.target).attr('id'));
},
onfocus: function(e){
this.saveFieldFocus($(e.target).attr('id'));
}
},
/*
* Track focus on treedropdownfields.
*/
'from .cms-edit-form .treedropdown *': {
onfocusin: function(e){
var field = $(e.target).closest('.field.treedropdown');
this.saveFieldFocus(field.attr('id'));
}
},
/*
* Track focus on chosen selects
*/
'from .cms-edit-form .dropdown .chzn-container a': {
onfocusin: function(e){
var field = $(e.target).closest('.field.dropdown');
this.saveFieldFocus(field.attr('id'));
}
},
/*
* Restore fields after tabs are restored
*/
'from .cms-container': {
ontabstaterestored: function(e){
this.restoreFieldFocus();
}
},
/*
* Saves focus in Window session storage so it that can be restored on page load
*/
saveFieldFocus: function(selected){
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;
var id = $(this).attr('id'),
focusElements = [];
focusElements.push({
id:id,
selected:selected
});
if(focusElements) {
try {
window.sessionStorage.setItem(id, JSON.stringify(focusElements));
} catch(err) {
if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {
// If this fails we ignore the error as the only issue is that it
// does not remember the focus state.
// This is a Safari bug which happens when private browsing is enabled.
return;
} else {
throw err;
}
}
}
},
/**
* Set focus or window to previously saved fields.
* Requires HTML5 sessionStorage support.
*
* Must follow tab restoration, as reliant on active tab
*/
restoreFieldFocus: function(){
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;
var self = this,
hasSessionStorage = (typeof(window.sessionStorage)!=="undefined" && window.sessionStorage),
sessionData = hasSessionStorage ? window.sessionStorage.getItem(this.attr('id')) : null,
sessionStates = sessionData ? JSON.parse(sessionData) : false,
elementID,
tabbed = (this.find('.ss-tabset').length !== 0),
activeTab,
elementTab,
toggleComposite,
scrollY;
if(hasSessionStorage && sessionStates.length > 0){
$.each(sessionStates, function(i, sessionState) {
if(self.is('#' + sessionState.id)){
elementID = $('#' + sessionState.selected);
}
});
// If the element IDs saved in session states don't match up to anything in this particular form
// that probably means we haven't encountered this form yet, so focus on the first input
if($(elementID).length < 1){
this.focusFirstInput();
return;
}
activeTab = $(elementID).closest('.ss-tabset').find('.ui-tabs-nav .ui-tabs-active .ui-tabs-anchor').attr('id');
elementTab = 'tab-' + $(elementID).closest('.ss-tabset .ui-tabs-panel').attr('id');
// Last focussed element differs to last selected tab, do nothing
if(tabbed && elementTab !== activeTab){
return;
}
toggleComposite = $(elementID).closest('.togglecomposite');
//Reopen toggle fields
if(toggleComposite.length > 0){
toggleComposite.accordion('activate', toggleComposite.find('.ui-accordion-header'));
}
//Calculate position for scroll
scrollY = $(elementID).position().top;
//Fall back to nearest visible element if hidden (for select type fields)
if(!$(elementID).is(':visible')){
elementID = '#' + $(elementID).closest('.field').attr('id');
scrollY = $(elementID).position().top;
}
//set focus to focus variable if element focusable
$(elementID).focus();
// Scroll fallback when element is not focusable
// Only scroll if element at least half way down window
if(scrollY > $(window).height() / 2){
self.find('.cms-content-fields').scrollTop(scrollY);
}
} else {
// If session storage is not supported or there is nothing stored yet, focus on the first input
this.focusFirstInput();
}
},
/**
* Skip if an element in the form is already focused. Exclude elements which specifically
* opt-out of this behaviour via "data-skip-autofocus". This opt-out is useful if the
* first visible field is shown far down a scrollable area, for example for the pagination
* input field after a long GridField listing.
*/
focusFirstInput: function() {
this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(':visible:first').focus();
}
});
/**
* Class: .cms-edit-form .Actions :submit
*
* All buttons in the right CMS form go through here by default.
* We need this onclick overloading because we can't get to the
* clicked button from a form.onsubmit event.
*/
$('.cms-edit-form .Actions input.action[type=submit], .cms-edit-form .Actions button.action').entwine({
/**
* Function: onclick
*/
onclick: function(e) {
// Confirmation on delete.
if(
this.hasClass('gridfield-button-delete')
&& !confirm(i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))
) {
e.preventDefault();
return false;
}
if(!this.is(':disabled')) {
this.parents('form').trigger('submit', [this]);
}
e.preventDefault();
return false;
}
});
/**
* If we've a history state to go back to, go back, otherwise fall back to
* submitting the form with the 'doCancel' action.
*/
$('.cms-edit-form .Actions input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .Actions button.action.ss-ui-action-cancel').entwine({
onclick: function(e) {
if (History.getStateByIndex(1)) {
History.back();
} else {
this.parents('form').trigger('submit', [this]);
}
e.preventDefault();
}
});
/**
* Hide tabs when only one is available.
* Special case is actiontabs - tabs between buttons, where we want to have
* extra options hidden within a tab (even if only one) by default.
*/
$('.cms-edit-form .ss-tabset').entwine({
onmatch: function() {
if (!this.hasClass('ss-ui-action-tabset')) {
var tabs = this.find("> ul:first");
if(tabs.children("li").length == 1) {
tabs.hide().parent().addClass("ss-tabset-tabshidden");
}
}
this._super();
},
onunmatch: function() {
this._super();
}
});
});

View File

@ -0,0 +1,43 @@
/**
* Enable toggling (show/hide) of the field's description.
*/
import $ from 'jQuery';
$.entwine('ss', function ($) {
$('.cms-description-toggle').entwine({
onadd: function () {
var shown = false, // Current state of the description.
fieldId = this.prop('id').substr(0, this.prop('id').indexOf('_Holder')),
$trigger = this.find('.cms-description-trigger'), // Click target for toggling the description.
$description = this.find('.description');
// Prevent multiple events being added.
if (this.hasClass('description-toggle-enabled')) {
return;
}
// If a custom trigger han't been supplied use a sensible default.
if ($trigger.length === 0) {
$trigger = this
.find('.middleColumn')
.first() // Get the first middleColumn so we don't add multiple triggers on composite field types.
.after('<label class="right" for="' + fieldId + '"><a class="cms-description-trigger" href="javascript:void(0)"><span class="btn-icon-information"></span></a></label>')
.next();
}
this.addClass('description-toggle-enabled');
// Toggle next description when button is clicked.
$trigger.on('click', function() {
$description[shown ? 'hide' : 'show']();
shown = !shown;
});
// Hide next description by default.
$description.hide();
}
});
});

View File

@ -0,0 +1,37 @@
import $ from 'jQuery';
$.entwine('ss', function($) {
/**
* Converts an inline field description into a tooltip
* which is shown on hover over any part of the field container,
* as well as when focusing into an input element within the field container.
*
* Note that some fields don't have distinct focusable
* input fields (e.g. GridField), and aren't compatible
* with showing tooltips.
*/
$(".cms .field.cms-description-tooltip").entwine({
onmatch: function() {
this._super();
var descriptionEl = this.find('.description'), inputEl, tooltipEl;
if(descriptionEl.length) {
this
// TODO Remove title setting, shouldn't be necessary
.attr('title', descriptionEl.text())
.tooltip({content: descriptionEl.html()});
descriptionEl.remove();
}
},
});
$(".cms .field.cms-description-tooltip :input").entwine({
onfocusin: function(e) {
this.closest('.field').tooltip('open');
},
onfocusout: function(e) {
this.closest('.field').tooltip('close');
}
});
});

View File

@ -0,0 +1,178 @@
/**
* File: LeftAndMain.Layout.js
*/
import $ from 'jQuery';
$.fn.layout.defaults.resize = false;
/**
* Acccess the global variable in the same way the plugin does it.
*/
jLayout = (typeof jLayout === 'undefined') ? {} : jLayout;
/**
* Factory function for generating new type of algorithm for our CMS.
*
* Spec requires a definition of three column elements:
* - `menu` on the left
* - `content` area in the middle (includes the EditForm, side tool panel, actions, breadcrumbs and tabs)
* - `preview` on the right (will be shown if there is enough space)
*
* Required options:
* - `minContentWidth`: minimum size for the content display as long as the preview is visible
* - `minPreviewWidth`: preview will not be displayed below this size
* - `mode`: one of "split", "content" or "preview"
*
* The algorithm first checks which columns are to be visible and which hidden.
*
* In the case where both preview and content should be shown it first tries to assign half of non-menu space to
* preview and the other half to content. Then if there is not enough space for either content or preview, it tries
* to allocate the minimum acceptable space to that column, and the rest to the other one. If the minimum
* requirements are still not met, it falls back to showing content only.
*
* @param spec A structure defining columns and parameters as per above.
*/
jLayout.threeColumnCompressor = function (spec, options) {
// Spec sanity checks.
if (typeof spec.menu==='undefined' ||
typeof spec.content==='undefined' ||
typeof spec.preview==='undefined') {
throw 'Spec is invalid. Please provide "menu", "content" and "preview" elements.';
}
if (typeof options.minContentWidth==='undefined' ||
typeof options.minPreviewWidth==='undefined' ||
typeof options.mode==='undefined') {
throw 'Spec is invalid. Please provide "minContentWidth", "minPreviewWidth", "mode"';
}
if (options.mode!=='split' && options.mode!=='content' && options.mode!=='preview') {
throw 'Spec is invalid. "mode" should be either "split", "content" or "preview"';
}
// Instance of the algorithm being produced.
var obj = {
options: options
};
// Internal column handles, also implementing layout.
var menu = $.jLayoutWrap(spec.menu),
content = $.jLayoutWrap(spec.content),
preview = $.jLayoutWrap(spec.preview);
/**
* Required interface implementations follow.
* Refer to https://github.com/bramstein/jlayout#layout-algorithms for the interface spec.
*/
obj.layout = function (container) {
var size = container.bounds(),
insets = container.insets(),
top = insets.top,
bottom = size.height - insets.bottom,
left = insets.left,
right = size.width - insets.right;
var menuWidth = spec.menu.width(),
contentWidth = 0,
previewWidth = 0;
if (this.options.mode==='preview') {
// All non-menu space allocated to preview.
contentWidth = 0;
previewWidth = right - left - menuWidth;
} else if (this.options.mode==='content') {
// All non-menu space allocated to content.
contentWidth = right - left - menuWidth;
previewWidth = 0;
} else { // ==='split'
// Split view - first try 50-50 distribution.
contentWidth = (right - left - menuWidth) / 2;
previewWidth = right - left - (menuWidth + contentWidth);
// If violating one of the minima, try to readjust towards satisfying it.
if (contentWidth < this.options.minContentWidth) {
contentWidth = this.options.minContentWidth;
previewWidth = right - left - (menuWidth + contentWidth);
} else if (previewWidth < this.options.minPreviewWidth) {
previewWidth = this.options.minPreviewWidth;
contentWidth = right - left - (menuWidth + previewWidth);
}
// If still violating one of the (other) minima, remove the preview and allocate everything to content.
if (contentWidth < this.options.minContentWidth || previewWidth < this.options.minPreviewWidth) {
contentWidth = right - left - menuWidth;
previewWidth = 0;
}
}
// Calculate what columns are already hidden pre-layout
var prehidden = {
content: spec.content.hasClass('column-hidden'),
preview: spec.preview.hasClass('column-hidden')
};
// Calculate what columns will be hidden (zero width) post-layout
var posthidden = {
content: contentWidth === 0,
preview: previewWidth === 0
};
// Apply classes for elements that might not be visible at all.
spec.content.toggleClass('column-hidden', posthidden.content);
spec.preview.toggleClass('column-hidden', posthidden.preview);
// Apply the widths to columns, and call subordinate layouts to arrange the children.
menu.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': menuWidth});
menu.doLayout();
left += menuWidth;
content.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': contentWidth});
if (!posthidden.content) content.doLayout();
left += contentWidth;
preview.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': previewWidth});
if (!posthidden.preview) preview.doLayout();
if (posthidden.content !== prehidden.content) spec.content.trigger('columnvisibilitychanged');
if (posthidden.preview !== prehidden.preview) spec.preview.trigger('columnvisibilitychanged');
// Calculate whether preview is possible in split mode
if (contentWidth + previewWidth < options.minContentWidth + options.minPreviewWidth) {
spec.preview.trigger('disable');
} else {
spec.preview.trigger('enable');
}
return container;
};
/**
* Helper to generate the required `preferred`, `minimum` and `maximum` interface functions.
*/
function typeLayout(type) {
var func = type + 'Size';
return function (container) {
var menuSize = menu[func](),
contentSize = content[func](),
previewSize = preview[func](),
insets = container.insets();
width = menuSize.width + contentSize.width + previewSize.width;
height = Math.max(menuSize.height, contentSize.height, previewSize.height);
return {
'width': insets.left + insets.right + width,
'height': insets.top + insets.bottom + height
};
};
}
// Generate interface functions.
obj.preferred = typeLayout('preferred');
obj.minimum = typeLayout('minimum');
obj.maximum = typeLayout('maximum');
return obj;
};

View File

@ -0,0 +1,419 @@
import $ from 'jQuery';
$.entwine('ss', function($){
/**
* Vertical CMS menu with two levels, built from a nested unordered list.
* The (optional) second level is collapsible, hiding its children.
* The whole menu (including second levels) is collapsible as well,
* exposing only a preview for every menu item in order to save space.
* In this "preview/collapsed" mode, the secondary menu hovers over the menu item,
* rather than expanding it.
*
* Example:
*
* <ul class="cms-menu-list">
* <li><a href="#">Item 1</a></li>
* <li class="current opened">
* <a href="#">Item 2</a>
* <ul>
* <li class="current opened"><a href="#">Item 2.1</a></li>
* <li><a href="#">Item 2.2</a></li>
* </ul>
* </li>
* </ul>
*
* Custom Events:
* - 'select': Fires when a menu item is selected (on any level).
*/
$('.cms-panel.cms-menu').entwine({
togglePanel: function(doExpand, silent, doSaveState) {
//apply or unapply the flyout formatting, should only apply to cms-menu-list when the current collapsed panal is the cms menu.
$('.cms-menu-list').children('li').each(function(){
if (doExpand) { //expand
$(this).children('ul').each(function() {
$(this).removeClass('collapsed-flyout');
if ($(this).data('collapse')) {
$(this).removeData('collapse');
$(this).addClass('collapse');
}
});
} else { //collapse
$(this).children('ul').each(function() {
$(this).addClass('collapsed-flyout');
$(this).hasClass('collapse');
$(this).removeClass('collapse');
$(this).data('collapse', true);
});
}
});
this.toggleFlyoutState(doExpand);
this._super(doExpand, silent, doSaveState);
},
toggleFlyoutState: function(bool) {
if (bool) { //expand
//show the flyout
$('.collapsed').find('li').show();
//hide all the flyout-indicator
$('.cms-menu-list').find('.child-flyout-indicator').hide();
} else { //collapse
//hide the flyout only if it is not the current section
$('.collapsed-flyout').find('li').each(function() {
//if (!$(this).hasClass('current'))
$(this).hide();
});
//show all the flyout-indicators
var par = $('.cms-menu-list ul.collapsed-flyout').parent();
if (par.children('.child-flyout-indicator').length === 0) par.append('<span class="child-flyout-indicator"></span>').fadeIn();
par.children('.child-flyout-indicator').fadeIn();
}
},
siteTreePresent: function () {
return $('#cms-content-tools-CMSMain').length > 0;
},
/**
* @func getPersistedStickyState
* @return {boolean|undefined} - Returns true if the menu is sticky, false if unsticky. Returns undefined if there is no cookie set.
* @desc Get the sticky state of the menu according to the cookie.
*/
getPersistedStickyState: function () {
var persistedState, cookieValue;
if ($.cookie !== void 0) {
cookieValue = $.cookie('cms-menu-sticky');
if (cookieValue !== void 0 && cookieValue !== null) {
persistedState = cookieValue === 'true';
}
}
return persistedState;
},
/**
* @func setPersistedStickyState
* @param {boolean} isSticky - Pass true if you want the panel to be sticky, false for unsticky.
* @desc Set the collapsed value of the panel, stored in cookies.
*/
setPersistedStickyState: function (isSticky) {
if ($.cookie !== void 0) {
$.cookie('cms-menu-sticky', isSticky, { path: '/', expires: 31 });
}
},
/**
* @func getEvaluatedCollapsedState
* @return {boolean} - Returns true if the menu should be collapsed, false if expanded.
* @desc Evaluate whether the menu should be collapsed.
* The basic rule is "If the SiteTree (middle column) is present, collapse the menu, otherwise expand the menu".
* This reason behind this is to give the content area more real estate when the SiteTree is present.
* The user may wish to override this automatic behaviour and have the menu expanded or collapsed at all times.
* So unlike manually toggling the menu, the automatic behaviour never updates the menu's cookie value.
* Here we use the manually set state and the automatic behaviour to evaluate what the collapsed state should be.
*/
getEvaluatedCollapsedState: function () {
var shouldCollapse,
manualState = this.getPersistedCollapsedState(),
menuIsSticky = $('.cms-menu').getPersistedStickyState(),
automaticState = this.siteTreePresent();
if (manualState === void 0) {
// There is no manual state, use automatic state.
shouldCollapse = automaticState;
} else if (manualState !== automaticState && menuIsSticky) {
// The manual and automatic statea conflict, use manual state.
shouldCollapse = manualState;
} else {
// Use automatic state.
shouldCollapse = automaticState;
}
return shouldCollapse;
},
onadd: function () {
var self = this;
setTimeout(function () {
// Use a timeout so this happens after the redraw.
// Triggering a toggle before redraw will result in an incorrect
// menu 'expanded width' being calculated when then menu
// is added in a collapsed state.
self.togglePanel(!self.getEvaluatedCollapsedState(), false, false);
}, 0);
// Setup automatic expand / collapse behaviour.
$(window).on('ajaxComplete', function (e) {
setTimeout(function () { // Use a timeout so this happens after the redraw
self.togglePanel(!self.getEvaluatedCollapsedState(), false, false);
}, 0);
});
this._super();
}
});
$('.cms-menu-list').entwine({
onmatch: function() {
var self = this;
// Select default element (which might reveal children in hidden parents)
this.find('li.current').select();
this.updateItems();
this._super();
},
onunmatch: function() {
this._super();
},
updateMenuFromResponse: function(xhr) {
var controller = xhr.getResponseHeader('X-Controller');
if(controller) {
var item = this.find('li#Menu-' + controller.replace(/\\/g, '-').replace(/[^a-zA-Z0-9\-_:.]+/, ''));
if(!item.hasClass('current')) item.select();
}
this.updateItems();
},
'from .cms-container': {
onafterstatechange: function(e, data){
this.updateMenuFromResponse(data.xhr);
},
onaftersubmitform: function(e, data){
this.updateMenuFromResponse(data.xhr);
}
},
'from .cms-edit-form': {
onrelodeditform: function(e, data){
this.updateMenuFromResponse(data.xmlhttp);
}
},
getContainingPanel: function(){
return this.closest('.cms-panel');
},
fromContainingPanel: {
ontoggle: function(e){
this.toggleClass('collapsed', $(e.target).hasClass('collapsed'));
}
},
updateItems: function() {
// Hide "edit page" commands unless the section is activated
var editPageItem = this.find('#Menu-CMSMain');
editPageItem[editPageItem.is('.current') ? 'show' : 'hide']();
// Update the menu links to reflect the page ID if the page has changed the URL.
var currentID = $('.cms-content input[name=ID]').val();
if(currentID) {
this.find('li').each(function() {
if($.isFunction($(this).setRecordID)) $(this).setRecordID(currentID);
});
}
}
});
/** Toggle the flyout panel to appear/disappear when mouse over */
$('.cms-menu-list li').entwine({
toggleFlyout: function(bool) {
var fly = $(this);
if (fly.children('ul').first().hasClass('collapsed-flyout')) {
if (bool) { //expand
fly.children('ul').find('li').fadeIn('fast');
} else { //collapse
fly.children('ul').find('li').hide();
}
}
}
});
//slight delay to prevent flyout closing from "sloppy mouse movement"
$('.cms-menu-list li').hoverIntent(function(){$(this).toggleFlyout(true);},function(){$(this).toggleFlyout(false);});
$('.cms-menu-list .toggle').entwine({
onclick: function(e) {
this.getMenuItem().toggle();
e.preventDefault();
}
});
$('.cms-menu-list li').entwine({
onmatch: function() {
if(this.find('ul').length) {
this.find('a:first').append('<span class="toggle-children"><span class="toggle-children-icon"></span></span>');
}
this._super();
},
onunmatch: function() {
this._super();
},
toggle: function() {
this[this.hasClass('opened') ? 'close' : 'open']();
},
/**
* "Open" is just a visual state, and unrelated to "current".
* More than one item can be open at the same time.
*/
open: function() {
var parent = this.getMenuItem();
if(parent) parent.open();
this.addClass('opened').find('ul').show();
this.find('.toggle-children').addClass('opened');
},
close: function() {
this.removeClass('opened').find('ul').hide();
this.find('.toggle-children').removeClass('opened');
},
select: function() {
var parent = this.getMenuItem();
this.addClass('current').open();
// Remove "current" class from all siblings and their children
this.siblings().removeClass('current').close();
this.siblings().find('li').removeClass('current');
if(parent) {
var parentSiblings = parent.siblings();
parent.addClass('current');
parentSiblings.removeClass('current').close();
parentSiblings.find('li').removeClass('current').close();
}
this.getMenu().updateItems();
this.trigger('select');
}
});
$('.cms-menu-list *').entwine({
getMenu: function() {
return this.parents('.cms-menu-list:first');
}
});
$('.cms-menu-list li *').entwine({
getMenuItem: function() {
return this.parents('li:first');
}
});
/**
* Both primary and secondary nav.
*/
$('.cms-menu-list li a').entwine({
onclick: function(e) {
// Only catch left clicks, in order to allow opening in tabs.
// Ignore external links, fallback to standard link behaviour
var isExternal = $.path.isExternal(this.attr('href'));
if(e.which > 1 || isExternal) return;
// if the developer has this to open in a new window, handle
// that
if(this.attr('target') == "_blank") {
return;
}
e.preventDefault();
var item = this.getMenuItem();
var url = this.attr('href');
if(!isExternal) url = $('base').attr('href') + url;
var children = item.find('li');
if(children.length) {
children.first().find('a').click();
} else {
// Load URL, but give the loading logic an opportunity to veto the action
// (e.g. because of unsaved changes)
if(!$('.cms-container').loadPanel(url)) return false;
}
item.select();
}
});
$('.cms-menu-list li .toggle-children').entwine({
onclick: function(e) {
var li = this.closest('li');
li.toggle();
return false; // prevent wrapping link event to fire
}
});
$('.cms .profile-link').entwine({
onclick: function() {
$('.cms-container').loadPanel(this.attr('href'));
$('.cms-menu-list li').removeClass('current').close();
return false;
}
});
/**
* Toggles the manual override of the left menu's automatic expand / collapse behaviour.
*/
$('.cms-menu .sticky-toggle').entwine({
onadd: function () {
var isSticky = $('.cms-menu').getPersistedStickyState() ? true : false;
this.toggleCSS(isSticky);
this.toggleIndicator(isSticky);
this._super();
},
/**
* @func toggleCSS
* @param {boolean} isSticky - The current state of the menu.
* @desc Toggles the 'active' CSS class of the element.
*/
toggleCSS: function (isSticky) {
this[isSticky ? 'addClass' : 'removeClass']('active');
},
/**
* @func toggleIndicator
* @param {boolean} isSticky - The current state of the menu.
* @desc Updates the indicator's text based on the sticky state of the menu.
*/
toggleIndicator: function (isSticky) {
this.next('.sticky-status-indicator').text(isSticky ? 'fixed' : 'auto');
},
onclick: function () {
var $menu = this.closest('.cms-menu'),
persistedCollapsedState = $menu.getPersistedCollapsedState(),
persistedStickyState = $menu.getPersistedStickyState(),
newStickyState = persistedStickyState === void 0 ? !this.hasClass('active') : !persistedStickyState;
// Update the persisted collapsed state
if (persistedCollapsedState === void 0) {
// If there is no persisted menu state currently set, then set it to the menu's current state.
// This will be the case if the user has never manually expanded or collapsed the menu,
// or the menu has previously been made unsticky.
$menu.setPersistedCollapsedState($menu.hasClass('collapsed'));
} else if (persistedCollapsedState !== void 0 && newStickyState === false) {
// If there is a persisted state and the menu has been made unsticky, remove the persisted state.
$menu.clearPersistedCollapsedState();
}
// Persist the sticky state of the menu
$menu.setPersistedStickyState(newStickyState);
this.toggleCSS(newStickyState);
this.toggleIndicator(newStickyState);
this._super();
}
});
});

View File

@ -0,0 +1,219 @@
import $ from 'jQuery';
$.entwine('ss', function($) {
// setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
/**
* Horizontal collapsible panel. Generic enough to work with CMS menu as well as various "filter" panels.
*
* A panel consists of the following parts:
* - Container div: The outer element, with class ".cms-panel"
* - Header (optional)
* - Content
* - Expand and collapse toggle anchors (optional)
*
* Sample HTML:
* <div class="cms-panel">
* <div class="cms-panel-header">your header</div>
* <div class="cms-panel-content">your content here</div>
* <div class="cms-panel-toggle">
* <a href="#" class="toggle-expande">your toggle text</a>
* <a href="#" class="toggle-collapse">your toggle text</a>
* </div>
* </div>
*/
$('.cms-panel').entwine({
WidthExpanded: null,
WidthCollapsed: null,
/**
* @func canSetCookie
* @return {boolean}
* @desc Before trying to set a cookie, make sure $.cookie and the element's id are both defined.
*/
canSetCookie: function () {
return $.cookie !== void 0 && this.attr('id') !== void 0;
},
/**
* @func getPersistedCollapsedState
* @return {boolean|undefined} - Returns true if the panel is collapsed, false if expanded. Returns undefined if there is no cookie set.
* @desc Get the collapsed state of the panel according to the cookie.
*/
getPersistedCollapsedState: function () {
var isCollapsed, cookieValue;
if (this.canSetCookie()) {
cookieValue = $.cookie('cms-panel-collapsed-' + this.attr('id'));
if (cookieValue !== void 0 && cookieValue !== null) {
isCollapsed = cookieValue === 'true';
}
}
return isCollapsed;
},
/**
* @func setPersistedCollapsedState
* @param {boolean} newState - Pass true if you want the panel to be collapsed, false for expanded.
* @desc Set the collapsed value of the panel, stored in cookies.
*/
setPersistedCollapsedState: function (newState) {
if (this.canSetCookie()) {
$.cookie('cms-panel-collapsed-' + this.attr('id'), newState, { path: '/', expires: 31 });
}
},
/**
* @func clearPersistedState
* @desc Remove the cookie responsible for maintaing the collapsed state.
*/
clearPersistedCollapsedState: function () {
if (this.canSetCookie()) {
$.cookie('cms-panel-collapsed-' + this.attr('id'), '', { path: '/', expires: -1 });
}
},
/**
* @func getInitialCollapsedState
* @return {boolean} - Returns true if the the panel is collapsed, false if expanded.
* @desc Get the initial collapsed state of the panel. Check if a cookie value is set then fall back to checking CSS classes.
*/
getInitialCollapsedState: function () {
var isCollapsed = this.getPersistedCollapsedState();
// Fallback to getting the state from the default CSS class
if (isCollapsed === void 0) {
isCollapsed = this.hasClass('collapsed');
}
return isCollapsed;
},
onadd: function() {
var collapsedContent, container;
if(!this.find('.cms-panel-content').length) throw new Exception('Content panel for ".cms-panel" not found');
// Create default controls unless they already exist.
if(!this.find('.cms-panel-toggle').length) {
container = $("<div class='cms-panel-toggle south'></div>")
.append('<a class="toggle-expand" href="#"><span>&raquo;</span></a>')
.append('<a class="toggle-collapse" href="#"><span>&laquo;</span></a>');
this.append(container);
}
// Set panel width same as the content panel it contains. Assumes the panel has overflow: hidden.
this.setWidthExpanded(this.find('.cms-panel-content').innerWidth());
// Assumes the collapsed width is indicated by the toggle, or by an optionally collapsed view
collapsedContent = this.find('.cms-panel-content-collapsed');
this.setWidthCollapsed(collapsedContent.length ? collapsedContent.innerWidth() : this.find('.toggle-expand').innerWidth());
// Toggle visibility
this.togglePanel(!this.getInitialCollapsedState(), true, false);
this._super();
},
/**
* @func togglePanel
* @param doExpand {boolean} - true to expand, false to collapse.
* @param silent {boolean} - true means that events won't be fired, which is useful for the component initialization phase.
* @param doSaveState - if false, the panel's state will not be persisted via cookies.
* @desc Toggle the expanded / collapsed state of the panel.
*/
togglePanel: function(doExpand, silent, doSaveState) {
var newWidth, collapsedContent;
if(!silent) {
this.trigger('beforetoggle.sspanel', doExpand);
this.trigger(doExpand ? 'beforeexpand' : 'beforecollapse');
}
this.toggleClass('collapsed', !doExpand);
newWidth = doExpand ? this.getWidthExpanded() : this.getWidthCollapsed();
this.width(newWidth); // the content panel width always stays in "expanded state" to avoid floating elements
// If an alternative collapsed view exists, toggle it as well
collapsedContent = this.find('.cms-panel-content-collapsed');
if(collapsedContent.length) {
this.find('.cms-panel-content')[doExpand ? 'show' : 'hide']();
this.find('.cms-panel-content-collapsed')[doExpand ? 'hide' : 'show']();
}
if (doSaveState !== false) {
this.setPersistedCollapsedState(!doExpand);
}
// TODO Fix redraw order (inner to outer), and re-enable silent flag
// to avoid multiple expensive redraws on a single load.
// if(!silent) {
this.trigger('toggle', doExpand);
this.trigger(doExpand ? 'expand' : 'collapse');
// }
},
expandPanel: function(force) {
if(!force && !this.hasClass('collapsed')) return;
this.togglePanel(true);
},
collapsePanel: function(force) {
if(!force && this.hasClass('collapsed')) return;
this.togglePanel(false);
}
});
$('.cms-panel.collapsed .cms-panel-toggle').entwine({
onclick: function(e) {
this.expandPanel();
e.preventDefault();
}
});
$('.cms-panel *').entwine({
getPanel: function() {
return this.parents('.cms-panel:first');
}
});
$('.cms-panel .toggle-expand').entwine({
onclick: function(e) {
e.preventDefault();
e.stopPropagation();
this.getPanel().expandPanel();
this._super(e);
}
});
$('.cms-panel .toggle-collapse').entwine({
onclick: function(e) {
e.preventDefault();
e.stopPropagation();
this.getPanel().collapsePanel();
this._super(e);
}
});
$('.cms-content-tools.collapsed').entwine({
// Expand CMS' centre pane, when the pane itself is clicked somewhere
onclick: function(e) {
this.expandPanel();
this._super(e);
}
});
});

View File

@ -0,0 +1,50 @@
/**
* File: LeftAndMain.Ping.js
*/
import $ from 'jQuery';
$.entwine('ss.ping', function($){
$('.cms-container').entwine(/** @lends ss.Form_EditForm */{
/**
* Variable: PingIntervalSeconds
* (Number) Interval in which /Security/ping will be checked for a valid login session.
*/
PingIntervalSeconds: 5*60,
onadd: function() {
this._setupPinging();
this._super();
},
/**
* Function: _setupPinging
*
* This function is called by prototype when it receives notification that the user was logged out.
* It uses /Security/ping for this purpose, which should return '1' if a valid user session exists.
* It redirects back to the login form if the URL is either unreachable, or returns '0'.
*/
_setupPinging: function() {
var onSessionLost = function(xmlhttp, status) {
if(xmlhttp.status > 400 || xmlhttp.responseText == 0) {
// TODO will pile up additional alerts when left unattended
if(window.open('Security/login')) {
alert('Please log in and then try again');
} else {
alert('Please enable pop-ups for this site');
}
}
};
// setup pinging for login expiry
setInterval(function() {
$.ajax({
url: 'Security/ping',
global: false,
type: 'POST',
complete: onSessionLost
});
}, this.getPingIntervalSeconds() * 1000);
}
});
});

View File

@ -0,0 +1,845 @@
import $ from 'jQuery';
import i18n from 'i18n';
$.entwine('ss.preview', function($){
/**
* Shows a previewable website state alongside its editable version in backend UI.
*
* Relies on the server responses to indicate if a preview is available for the
* currently loaded admin interface - signified by class ".cms-previewable" being present.
*
* The preview options at the bottom are constructured by grabbing a SilverStripeNavigator
* structure also provided by the backend.
*/
$('.cms-preview').entwine({
/**
* List of SilverStripeNavigator states (SilverStripeNavigatorItem classes) to search for.
* The order is significant - if the state is not available, preview will start searching the list
* from the beginning.
*/
AllowedStates: ['StageLink', 'LiveLink','ArchiveLink'],
/**
* API
* Name of the current preview state - one of the "AllowedStates".
*/
CurrentStateName: null,
/**
* API
* Current size selection.
*/
CurrentSizeName: 'auto',
/**
* Flags whether the preview is available on this CMS section.
*/
IsPreviewEnabled: false,
/**
* Mode in which the preview will be enabled.
*/
DefaultMode: 'split',
Sizes: {
auto: {
width: '100%',
height: '100%'
},
mobile: {
width: '335px', // add 15px for approx desktop scrollbar
height: '568px'
},
mobileLandscape: {
width: '583px', // add 15px for approx desktop scrollbar
height: '320px'
},
tablet: {
width: '783px', // add 15px for approx desktop scrollbar
height: '1024px'
},
tabletLandscape: {
width: '1039px', // add 15px for approx desktop scrollbar
height: '768px'
},
desktop: {
width: '1024px',
height: '800px'
}
},
/**
* API
* Switch the preview to different state.
* stateName can be one of the "AllowedStates".
*
* @param {String}
* @param {Boolean} Set to FALSE to avoid persisting the state
*/
changeState: function(stateName, save) {
var self = this, states = this._getNavigatorStates();
if(save !== false) {
$.each(states, function(index, state) {
self.saveState('state', stateName);
});
}
this.setCurrentStateName(stateName);
this._loadCurrentState();
this.redraw();
return this;
},
/**
* API
* Change the preview mode.
* modeName can be: split, content, preview.
*/
changeMode: function(modeName, save) {
var container = $('.cms-container');
if (modeName == 'split') {
container.entwine('.ss').splitViewMode();
this.setIsPreviewEnabled(true);
this._loadCurrentState();
} else if (modeName == 'content') {
container.entwine('.ss').contentViewMode();
this.setIsPreviewEnabled(false);
// Do not load content as the preview is not visible.
} else if (modeName == 'preview') {
container.entwine('.ss').previewMode();
this.setIsPreviewEnabled(true);
this._loadCurrentState();
} else {
throw 'Invalid mode: ' + modeName;
}
if(save !== false) this.saveState('mode', modeName);
this.redraw();
return this;
},
/**
* API
* Change the preview size.
* sizeName can be: auto, desktop, tablet, mobile.
*/
changeSize: function(sizeName) {
var sizes = this.getSizes();
this.setCurrentSizeName(sizeName);
this.removeClass('auto desktop tablet mobile').addClass(sizeName);
this.find('.preview-device-outer')
.width(sizes[sizeName].width)
.height(sizes[sizeName].height);
this.find('.preview-device-inner')
.width(sizes[sizeName].width);
this.saveState('size', sizeName);
this.redraw();
return this;
},
/**
* API
* Update the visual appearance to match the internal preview state.
*/
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Update preview state selector.
var currentStateName = this.getCurrentStateName();
if (currentStateName) {
this.find('.cms-preview-states').changeVisibleState(currentStateName);
}
// Update preview mode selectors.
var layoutOptions = $('.cms-container').entwine('.ss').getLayoutOptions();
if (layoutOptions) {
// There are two mode selectors that we need to keep in sync. Redraw both.
$('.preview-mode-selector').changeVisibleMode(layoutOptions.mode);
}
// Update preview size selector.
var currentSizeName = this.getCurrentSizeName();
if (currentSizeName) {
this.find('.preview-size-selector').changeVisibleSize(this.getCurrentSizeName());
}
return this;
},
/**
* Store the preview options for this page.
*/
saveState : function(name, value) {
if(this._supportsLocalStorage()) window.localStorage.setItem('cms-preview-state-' + name, value);
},
/**
* Load previously stored preferences
*/
loadState : function(name) {
if(this._supportsLocalStorage()) return window.localStorage.getItem('cms-preview-state-' + name);
},
/**
* Disable the area - it will not appear in the GUI.
* Caveat: the preview will be automatically enabled when ".cms-previewable" class is detected.
*/
disablePreview: function() {
this.setPendingURL(null);
this._loadUrl('about:blank');
this._block();
this.changeMode('content', false);
this.setIsPreviewEnabled(false);
return this;
},
/**
* Enable the area and start updating to reflect the content editing.
*/
enablePreview: function() {
if (!this.getIsPreviewEnabled()) {
this.setIsPreviewEnabled(true);
// Initialise mode.
if ($.browser.msie && $.browser.version.slice(0,3)<=7) {
// We do not support the split mode in IE < 8.
this.changeMode('content');
} else {
this.changeMode(this.getDefaultMode(), false);
}
}
return this;
},
/**
* Return a style element we can use in IE8 to fix fonts (see readystatechange binding in onadd below)
*/
getOrAppendFontFixStyleElement: function() {
var style = $('#FontFixStyleElement');
if (!style.length) {
style = $(
'<style type="text/css" id="FontFixStyleElement" disabled="disabled">'+
':before,:after{content:none !important}'+
'</style>'
).appendTo('head');
}
return style;
},
/**
* Initialise the preview element.
*/
onadd: function() {
var self = this, layoutContainer = this.parent(), iframe = this.find('iframe');
// Create layout and controls
iframe.addClass('center');
iframe.bind('load', function() {
self._adjustIframeForPreview();
// Load edit view for new page, but only if the preview is activated at the moment.
// This avoids e.g. force-redirections of the edit view on RedirectorPage instances.
self._loadCurrentPage();
$(this).removeClass('loading');
});
// If there's any webfonts in the preview, IE8 will start glitching. This fixes that.
if ($.browser.msie && 8 === parseInt($.browser.version, 10)) {
iframe.bind('readystatechange', function(e) {
if(iframe[0].readyState == 'interactive') {
self.getOrAppendFontFixStyleElement().removeAttr('disabled');
setTimeout(function(){ self.getOrAppendFontFixStyleElement().attr('disabled', 'disabled'); }, 0);
}
});
}
// Preview might not be available in all admin interfaces - block/disable when necessary
this.append('<div class="cms-preview-overlay ui-widget-overlay-light"></div>');
this.find('.cms-preview-overlay').hide();
this.disablePreview();
this._super();
},
/**
* Detect and use localStorage if available. In IE11 windows 8.1 call to window.localStorage was throwing out an access denied error in some cases which was causing the preview window not to display correctly in the CMS admin area.
*/
_supportsLocalStorage: function() {
var uid = new Date;
var storage;
var result;
try {
(storage = window.localStorage).setItem(uid, uid);
result = storage.getItem(uid) == uid;
storage.removeItem(uid);
return result && storage;
} catch (exception) {
console.warn('localStorge is not available due to current browser / system settings.');
}
},
onenable: function () {
var $viewModeSelector = $('.preview-mode-selector');
$viewModeSelector.removeClass('split-disabled');
$viewModeSelector.find('.disabled-tooltip').hide();
},
ondisable: function () {
var $viewModeSelector = $('.preview-mode-selector');
$viewModeSelector.addClass('split-disabled');
$viewModeSelector.find('.disabled-tooltip').show();
},
/**
* Set the preview to unavailable - could be still visible. This is purely visual.
*/
_block: function() {
this.addClass('blocked');
this.find('.cms-preview-overlay').show();
return this;
},
/**
* Set the preview to available (remove the overlay);
*/
_unblock: function() {
this.removeClass('blocked');
this.find('.cms-preview-overlay').hide();
return this;
},
/**
* Update the preview according to browser and CMS section capabilities.
*/
_initialiseFromContent: function() {
var mode, size;
if (!$('.cms-previewable').length) {
this.disablePreview();
} else {
mode = this.loadState('mode');
size = this.loadState('size');
this._moveNavigator();
if(!mode || mode != 'content') {
this.enablePreview();
this._loadCurrentState();
}
this.redraw();
// now check the cookie to see if we have any preview settings that have been
// retained for this page from the last visit
if(mode) this.changeMode(mode);
if(size) this.changeSize(size);
}
return this;
},
/**
* Update preview whenever any panels are reloaded.
*/
'from .cms-container': {
onafterstatechange: function(e, data) {
// Don't update preview if we're dealing with a custom redirect
if(data.xhr.getResponseHeader('X-ControllerURL')) return;
this._initialiseFromContent();
}
},
/** @var string A URL that should be displayed in this preview panel once it becomes visible */
PendingURL: null,
oncolumnvisibilitychanged: function() {
var url = this.getPendingURL();
if (url && !this.is('.column-hidden')) {
this.setPendingURL(null);
this._loadUrl(url);
this._unblock();
}
},
/**
* Update preview whenever a form is submitted.
* This is an alternative to the LeftAndmMain::loadPanel functionality which we already
* cover in the onafterstatechange handler.
*/
'from .cms-container .cms-edit-form': {
onaftersubmitform: function(){
this._initialiseFromContent();
}
},
/**
* Change the URL of the preview iframe (if its not already displayed).
*/
_loadUrl: function(url) {
this.find('iframe').addClass('loading').attr('src', url);
return this;
},
/**
* Fetch available states from the current SilverStripeNavigator (SilverStripeNavigatorItems).
* Navigator is supplied by the backend and contains all state options for the current object.
*/
_getNavigatorStates: function() {
// Walk through available states and get the URLs.
var urlMap = $.map(this.getAllowedStates(), function(name) {
var stateLink = $('.cms-preview-states .state-name[data-name=' + name + ']');
if(stateLink.length) {
return {
name: name,
url: stateLink.attr('data-link'),
active: stateLink.is(':radio') ? stateLink.is(':checked') : stateLink.is(':selected')
};
} else {
return null;
}
});
return urlMap;
},
/**
* Load current state into the preview (e.g. StageLink or LiveLink).
* We try to reuse the state we have been previously in. Otherwise we fall back
* to the first state available on the "AllowedStates" list.
*
* @returns New state name.
*/
_loadCurrentState: function() {
if (!this.getIsPreviewEnabled()) return this;
var states = this._getNavigatorStates();
var currentStateName = this.getCurrentStateName();
var currentState = null;
// Find current state within currently available states.
if (states) {
currentState = $.grep(states, function(state, index) {
return (
currentStateName === state.name ||
(!currentStateName && state.active)
);
});
}
var url = null;
if (currentState[0]) {
// State is available on the newly loaded content. Get it.
url = currentState[0].url;
} else if (states.length) {
// Fall back to the first available content state.
this.setCurrentStateName(states[0].name);
url = states[0].url;
} else {
// No state available at all.
this.setCurrentStateName(null);
}
// If this preview panel isn't visible at the moment, delay loading the URL until it (maybe) is later
if (this.is('.column-hidden')) {
this.setPendingURL(url);
this._loadUrl('about:blank');
this._block();
}
else {
this.setPendingURL(null);
if (url) {
this._loadUrl(url);
this._unblock();
}
else {
this._block();
}
}
return this;
},
/**
* Move the navigator from the content to the preview bar.
*/
_moveNavigator: function() {
var previewEl = $('.cms-preview .cms-preview-controls');
var navigatorEl = $('.cms-edit-form .cms-navigator');
if (navigatorEl.length && previewEl.length) {
// Navigator is available - install the navigator.
previewEl.html($('.cms-edit-form .cms-navigator').detach());
} else {
// Navigator not available.
this._block();
}
},
/**
* Loads the matching edit form for a page viewed in the preview iframe,
* based on metadata sent along with this document.
*/
_loadCurrentPage: function() {
if (!this.getIsPreviewEnabled()) return;
var doc = this.find('iframe')[0].contentDocument,
containerEl = $('.cms-container');
// Load this page in the admin interface if appropriate
var id = $(doc).find('meta[name=x-page-id]').attr('content');
var editLink = $(doc).find('meta[name=x-cms-edit-link]').attr('content');
var contentPanel = $('.cms-content');
if(id && contentPanel.find(':input[name=ID]').val() != id) {
// Ignore behaviour without history support (as we need ajax loading
// for the new form to load in the background)
if(window.History.enabled)
$('.cms-container').entwine('.ss').loadPanel(editLink);
}
},
/**
* Prepare the iframe content for preview.
*/
_adjustIframeForPreview: function() {
var iframe = this.find('iframe')[0];
if(iframe){
var doc = iframe.contentDocument;
}else{
return;
}
if(!doc) return;
// Open external links in new window to avoid "escaping" the internal page context in the preview
// iframe, which is important to stay in for the CMS logic.
var links = doc.getElementsByTagName('A');
for (var i = 0; i < links.length; i++) {
var href = links[i].getAttribute('href');
if(!href) continue;
if (href.match(/^http:\/\//)) links[i].setAttribute('target', '_blank');
}
// Hide the navigator from the preview iframe and use only the CMS one.
var navi = doc.getElementById('SilverStripeNavigator');
if(navi) navi.style.display = 'none';
var naviMsg = doc.getElementById('SilverStripeNavigatorMessage');
if(naviMsg) naviMsg.style.display = 'none';
// Trigger extensions.
this.trigger('afterIframeAdjustedForPreview', [ doc ]);
}
});
$('.cms-edit-form').entwine({
onadd: function() {
this._super();
$('.cms-preview')._initialiseFromContent();
}
});
/**
* "Preview state" functions.
* -------------------------------------------------------------------
*/
$('.cms-preview-states').entwine({
/**
* Change the appearance of the state selector.
*/
changeVisibleState: function(state) {
this.find('input[data-name="'+state+'"]').prop('checked', true);
}
});
$('.cms-preview-states .state-name').entwine({
/**
* Reacts to the user changing the state of the preview.
*/
onclick: function(e) {
//Add and remove classes to make switch work ok in old IE
this.parent().find('.active').removeClass('active');
this.next('label').addClass('active');
var targetStateName = $(this).attr('data-name');
// Reload preview with the selected state.
$('.cms-preview').changeState(targetStateName);
}
});
/**
* "Preview mode" functions
* -------------------------------------------------------------------
*/
$('.preview-mode-selector').entwine({
/**
* Change the appearance of the mode selector.
*/
changeVisibleMode: function(mode) {
this.find('select')
.val(mode)
.trigger('liszt:updated')
._addIcon();
}
});
$('.preview-mode-selector select').entwine({
/**
* Reacts to the user changing the preview mode.
*/
onchange: function(e) {
this._super(e);
e.preventDefault();
var targetStateName = $(this).val();
$('.cms-preview').changeMode(targetStateName);
}
});
$('.preview-mode-selector .chzn-results li').entwine({
/**
* IE8 doesn't support programatic access to onchange event
* so react on click
*/
onclick:function(e){
if ($.browser.msie) {
e.preventDefault();
var index = this.index();
var targetStateName = this.closest('.preview-mode-selector').find('select option:eq('+index+')').val();
//var targetStateName = $(this).val();
$('.cms-preview').changeMode(targetStateName);
}
}
});
/**
* Adjust the visibility of the preview-mode selector in the CMS part (hidden if preview is visible).
*/
$('.cms-preview.column-hidden').entwine({
onmatch: function() {
$('#preview-mode-dropdown-in-content').show();
// Alert the user as to why the preview is hidden
if ($('.cms-preview .result-selected').hasClass('font-icon-columns')) {
statusMessage(i18n._t(
'LeftAndMain.DISABLESPLITVIEW',
"Screen too small to show site preview in split mode"),
"error");
}
this._super();
},
onunmatch: function() {
$('#preview-mode-dropdown-in-content').hide();
this._super();
}
});
/**
* Initialise the preview-mode selector in the CMS part (could be hidden if preview is visible).
*/
$('#preview-mode-dropdown-in-content').entwine({
onmatch: function() {
if ($('.cms-preview').is('.column-hidden')) {
this.show();
}
else {
this.hide();
}
this._super();
},
onunmatch: function() {
this._super();
}
});
/**
* "Preview size" functions
* -------------------------------------------------------------------
*/
$('.preview-size-selector').entwine({
/**
* Change the appearance of the size selector.
*/
changeVisibleSize: function(size) {
this.find('select')
.val(size)
.trigger('liszt:updated')
._addIcon();
}
});
$('.preview-size-selector select').entwine({
/**
* Trigger change in the preview size.
*/
onchange: function(e) {
e.preventDefault();
var targetSizeName = $(this).val();
$('.cms-preview').changeSize(targetSizeName);
}
});
/**
* "Chosen" plumbing.
* -------------------------------------------------------------------
*/
/*
* Add a class to the chzn select trigger based on the currently
* selected option. Update as this changes
*/
$('.preview-selector select.preview-dropdown').entwine({
'onliszt:showing_dropdown': function() {
this.siblings().find('.chzn-drop').addClass('open')._alignRight();
},
'onliszt:hiding_dropdown': function() {
this.siblings().find('.chzn-drop').removeClass('open')._removeRightAlign();
},
/**
* Trigger additional initial icon update when the control is fully loaded.
* Solves an IE8 timing issue.
*/
'onliszt:ready': function() {
this._super();
this._addIcon();
},
_addIcon: function(){
var selected = this.find(':selected');
var iconClass = selected.attr('data-icon');
var target = this.parent().find('.chzn-container a.chzn-single');
var oldIcon = target.attr('data-icon');
if(typeof oldIcon !== 'undefined'){
target.removeClass(oldIcon);
}
target.addClass(iconClass);
target.attr('data-icon', iconClass);
return this;
}
});
$('.preview-selector .chzn-drop').entwine({
_alignRight: function(){
var that = this;
$(this).hide();
/* Delay so styles applied after chosen applies css
(the line after we find out the dropdown is open)
*/
setTimeout(function(){
$(that).css({left:'auto', right:0});
$(that).show();
}, 100);
},
_removeRightAlign:function(){
$(this).css({right:'auto'});
}
});
/*
* Means of having extra styled data in chzn 'preview-selector' selects
* When chzn ul is ready, grab data-description from original select.
* If it exists, append to option and add description class to list item
*/
/*
Currently buggy (adds dexcription, then re-renders). This may need to
be done inside chosen. Chosen recommends to do this stuff in the css,
but that option is inaccessible and untranslatable
(https://github.com/harvesthq/chosen/issues/399)
$('.preview-selector .chzn-drop ul').entwine({
onmatch: function() {
this.extraData();
this._super();
},
onunmatch: function() {
this._super();
},
extraData: function(){
var that = this;
var options = this.closest('.preview-selector').find('select option');
$.each(options, function(index, option){
var target = $(that).find("li:eq(" + index + ")");
var description = $(option).attr('data-description');
if(description != undefined && !$(target).hasClass('description')){
$(target).append('<span>' + description + '</span>');
$(target).addClass('description');
}
});
}
}); */
$('.preview-mode-selector .chzn-drop li:last-child').entwine({
onmatch: function () {
if ($('.preview-mode-selector').hasClass('split-disabled')) {
this.parent().append('<div class="disabled-tooltip"></div>');
} else {
this.parent().append('<div class="disabled-tooltip" style="display: none;"></div>');
}
}
});
/**
* Recalculate the preview space to allow for horizontal scrollbar and the preview actions panel
*/
$('.preview-scroll').entwine({
/**
* Height of the preview actions panel
*/
ToolbarSize: 53,
_redraw: function() {
var toolbarSize = this.getToolbarSize();
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
var previewHeight = (this.height() - toolbarSize);
this.height(previewHeight);
},
onmatch: function() {
this._redraw();
this._super();
},
onunmatch: function() {
this._super();
}
// TODO: Need to recalculate on resize of browser
});
/**
* Rotate preview to landscape
*/
$('.preview-device-outer').entwine({
onclick: function () {
this.toggleClass('rotate');
}
});
});

View File

@ -0,0 +1,495 @@
/**
* File: LeftAndMain.Tree.js
*/
import $ from 'jQuery';
$.entwine('ss.tree', function($){
$('.cms-tree').entwine({
Hints: null,
IsUpdatingTree: false,
IsLoaded: false,
onadd: function(){
this._super();
// Don't reapply (expensive) tree behaviour if already present
if($.isNumeric(this.data('jstree_instance_id'))) return;
var hints = this.attr('data-hints');
if(hints) this.setHints($.parseJSON(hints));
/**
* @todo Icon and page type hover support
* @todo Sorting of sub nodes (originally placed in context menu)
* @todo Automatic load of full subtree via ajax on node checkbox selection (minNodeCount = 0)
* to avoid doing partial selection with "hidden nodes" (unloaded markup)
* @todo Disallow drag'n'drop when node has "noChildren" set (see siteTreeHints)
* @todo Disallow moving of pages marked as deleted
* most likely by server response codes rather than clientside
* @todo "defaultChild" when creating a page (sitetreeHints)
* @todo Duplicate page (originally located in context menu)
* @todo Update tree node title information and modified state after reordering (response is a JSON array)
*
* Tasks most likely not required after moving to a standalone tree:
*
* @todo Context menu - to be replaced by a bezel UI
* @todo Refresh form for selected tree node if affected by reordering (new parent relationship)
* @todo Cancel current form load via ajax when new load is requested (synchronous loading)
*/
var self = this;
this
.jstree(this.getTreeConfig())
.bind('loaded.jstree', function(e, data) {
self.setIsLoaded(true);
// Add ajax settings after init period to avoid unnecessary initial ajax load
// of existing tree in DOM - see load_node_html()
data.inst._set_settings({'html_data': {'ajax': {
'url': self.data('urlTree'),
'data': function(node) {
var params = self.data('searchparams') || [];
// Avoid duplication of parameters
params = $.grep(params, function(n, i) {return (n.name != 'ID' && n.name != 'value');});
params.push({name: 'ID', value: $(node).data("id") ? $(node).data("id") : 0});
params.push({name: 'ajax', value: 1});
return params;
}
}}});
self.updateFromEditForm();
self.css('visibility', 'visible');
// Only show checkboxes with .multiple class
data.inst.hide_checkboxes();
})
.bind('before.jstree', function(e, data) {
if(data.func == 'start_drag') {
// Don't allow drag'n'drop if multi-select is enabled'
if(!self.hasClass('draggable') || self.hasClass('multiselect')) {
e.stopImmediatePropagation();
return false;
}
}
if($.inArray(data.func, ['check_node', 'uncheck_node'])) {
// don't allow check and uncheck if parent is disabled
var node = $(data.args[0]).parents('li:first');
var allowedChildren = node.find('li:not(.disabled)');
// if there are child nodes that aren't disabled, allow expanding the tree
if(node.hasClass('disabled') && allowedChildren == 0) {
e.stopImmediatePropagation();
return false;
}
}
})
.bind('move_node.jstree', function(e, data) {
if(self.getIsUpdatingTree()) return;
var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode), newParentID = $(newParentNode).data('id') || 0, nodeID = $(movedNode).data('id');
var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {
return $(el).data('id');
});
$.ajax({
'url': self.data('urlSavetreenode'),
'type': 'POST',
'data': {
ID: nodeID,
ParentID: newParentID,
SiblingIDs: siblingIDs
},
success: function() {
// We only need to update the ParentID if the current page we're on is the page being moved
if ($('.cms-edit-form :input[name=ID]').val() == nodeID) {
$('.cms-edit-form :input[name=ParentID]').val(newParentID);
}
self.updateNodesFromServer([nodeID]);
},
statusCode: {
403: function() {
$.jstree.rollback(data.rlbk);
}
}
});
})
// Make some jstree events delegatable
.bind('select_node.jstree check_node.jstree uncheck_node.jstree', function(e, data) {
$(document).triggerHandler(e, data);
});
},
onremove: function(){
this.jstree('destroy');
this._super();
},
'from .cms-container': {
onafterstatechange: function(e){
this.updateFromEditForm();
// No need to refresh tree nodes, we assume only form submits cause state changes
}
},
'from .cms-container form': {
onaftersubmitform: function(e){
var id = $('.cms-edit-form :input[name=ID]').val();
// TODO Trigger by implementing and inspecting "changed records" metadata
// sent by form submission response (as HTTP response headers)
this.updateNodesFromServer([id]);
}
},
getTreeConfig: function() {
var self = this;
return {
'core': {
'initially_open': ['record-0'],
'animation': 0,
'html_titles': true
},
'html_data': {
// 'ajax' will be set on 'loaded.jstree' event
},
'ui': {
"select_limit" : 1,
'initially_select': [this.find('.current').attr('id')]
},
"crrm": {
'move': {
// Check if a node is allowed to be moved.
// Caution: Runs on every drag over a new node
'check_move': function(data) {
var movedNode = $(data.o), newParent = $(data.np),
isMovedOntoContainer = data.ot.get_container()[0] == data.np[0],
movedNodeClass = movedNode.getClassname(),
newParentClass = newParent.getClassname(),
// Check allowedChildren of newParent or against root node rules
hints = self.getHints(),
disallowedChildren = [],
hintKey = newParentClass ? newParentClass : 'Root',
hint = (hints && typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
// Special case for VirtualPage: Check that original page type is an allowed child
if(hint && movedNode.attr('class').match(/VirtualPage-([^\s]*)/)) movedNodeClass = RegExp.$1;
if(hint) disallowedChildren = (typeof hint.disallowedChildren != 'undefined') ? hint.disallowedChildren : [];
var isAllowed = (
// Don't allow moving the root node
movedNode.data('id') !== 0
// Archived pages can't be moved
&& !movedNode.hasClass('status-archived')
// Only allow moving node inside the root container, not before/after it
&& (!isMovedOntoContainer || data.p == 'inside')
// Children are generally allowed on parent
&& !newParent.hasClass('nochildren')
// movedNode is allowed as a child
&& (!disallowedChildren.length || $.inArray(movedNodeClass, disallowedChildren) == -1)
);
return isAllowed;
}
}
},
'dnd': {
"drop_target" : false,
"drag_target" : false
},
'checkbox': {
'two_state': true
},
'themes': {
'theme': 'apple',
'url': $('body').data('frameworkpath') + '/thirdparty/jstree/themes/apple/style.css'
},
// Caution: SilverStripe has disabled $.vakata.css.add_sheet() for performance reasons,
// which means you need to add any CSS manually to framework/admin/scss/_tree.css
'plugins': [
'html_data', 'ui', 'dnd', 'crrm', 'themes',
'checkbox' // checkboxes are hidden unless .multiple is set
]
};
},
/**
* Function:
* search
*
* Parameters:
* (Object) data Pass empty data to cancel search
* (Function) callback Success callback
*/
search: function(params, callback) {
if(params) this.data('searchparams', params);
else this.removeData('searchparams');
this.jstree('refresh', -1, callback);
},
/**
* Function: getNodeByID
*
* Parameters:
* (Int) id
*
* Returns
* DOMElement
*/
getNodeByID: function(id) {
return this.find('*[data-id='+id+']');
},
/**
* Creates a new node from the given HTML.
* Wrapping around jstree API because we want the flexibility to define
* the node's <li> ourselves. Places the node in the tree
* according to data.ParentID.
*
* Parameters:
* (String) HTML New node content (<li>)
* (Object) Map of additional data, e.g. ParentID
* (Function) Success callback
*/
createNode: function(html, data, callback) {
var self = this,
parentNode = data.ParentID !== void 0 ? self.getNodeByID(data.ParentID) : false, // Explicitly check for undefined as 0 is a valid ParentID
newNode = $(html);
// Extract the state for the new node from the properties taken from the provided HTML template.
// This will correctly initialise the behaviour of the node for ajax loading of children.
var properties = {data: ''};
if(newNode.hasClass('jstree-open')) {
properties.state = 'open';
} else if(newNode.hasClass('jstree-closed')) {
properties.state = 'closed';
}
this.jstree(
'create_node',
parentNode.length ? parentNode : -1,
'last',
properties,
function(node) {
var origClasses = node.attr('class');
// Copy attributes
for(var i=0; i<newNode[0].attributes.length; i++){
var attr = newNode[0].attributes[i];
node.attr(attr.name, attr.value);
}
// Substitute html from request for that generated by jstree
node.addClass(origClasses).html(newNode.html());
callback(node);
}
);
},
/**
* Updates a node's state in the tree,
* including all of its HTML, as well as its position.
*
* Parameters:
* (DOMElement) Existing node
* (String) HTML New node content (<li>)
* (Object) Map of additional data, e.g. ParentID
*/
updateNode: function(node, html, data) {
var self = this, newNode = $(html), origClasses = node.attr('class');
var nextNode = data.NextID ? this.getNodeByID(data.NextID) : false;
var prevNode = data.PrevID ? this.getNodeByID(data.PrevID) : false;
var parentNode = data.ParentID ? this.getNodeByID(data.ParentID) : false;
// Copy attributes. We can't replace the node completely
// without removing or detaching its children nodes.
$.each(['id', 'style', 'class', 'data-pagetype'], function(i, attrName) {
node.attr(attrName, newNode.attr(attrName));
});
// To avoid conflicting classes when the node gets its content replaced (see below)
// Filter out all previous status flags if they are not in the class property of the new node
origClasses = origClasses.replace(/status-[^\s]*/, '');
// Replace inner content
var origChildren = node.children('ul').detach();
node.addClass(origClasses).html(newNode.html()).append(origChildren);
if (nextNode && nextNode.length) {
this.jstree('move_node', node, nextNode, 'before');
}
else if (prevNode && prevNode.length) {
this.jstree('move_node', node, prevNode, 'after');
}
else {
this.jstree('move_node', node, parentNode.length ? parentNode : -1);
}
},
/**
* Sets the current state based on the form the tree is managing.
*/
updateFromEditForm: function() {
var node, id = $('.cms-edit-form :input[name=ID]').val();
if(id) {
node = this.getNodeByID(id);
if(node.length) {
this.jstree('deselect_all');
this.jstree('select_node', node);
} else {
// If form is showing an ID that doesn't exist in the tree,
// get it from the server
this.updateNodesFromServer([id]);
}
} else {
// If no ID exists in a form view, we're displaying the tree on its own,
// hence to page should show as active
this.jstree('deselect_all');
}
},
/**
* Reloads the view of one or more tree nodes
* from the server, ensuring that their state is up to date
* (icon, title, hierarchy, badges, etc).
* This is easier, more consistent and more extensible
* than trying to correct all aspects via DOM modifications,
* based on the sparse data available in the current edit form.
*
* Parameters:
* (Array) List of IDs to retrieve
*/
updateNodesFromServer: function(ids) {
if(this.getIsUpdatingTree() || !this.getIsLoaded()) return;
var self = this, i, includesNewNode = false;
this.setIsUpdatingTree(true);
self.jstree('save_selected');
var correctStateFn = function(node) {
// Duplicates can be caused by the subtree reloading through
// a tree "open"/"select" event, while at the same time creating a new node
self.getNodeByID(node.data('id')).not(node).remove();
// Select this node
self.jstree('deselect_all');
self.jstree('select_node', node);
};
// TODO 'initially_opened' config doesn't apply here
self.jstree('open_node', this.getNodeByID(0));
self.jstree('save_opened');
self.jstree('save_selected');
$.ajax({
url: $.path.addSearchParams(this.data('urlUpdatetreenodes'), 'ids=' + ids.join(',')),
dataType: 'json',
success: function(data, xhr) {
$.each(data, function(nodeId, nodeData) {
var node = self.getNodeByID(nodeId);
// If no node data is given, assume the node has been removed
if(!nodeData) {
self.jstree('delete_node', node);
return;
}
// Check if node exists, create if necessary
if(node.length) {
self.updateNode(node, nodeData.html, nodeData);
setTimeout(function() {
correctStateFn(node);
}, 500);
} else {
includesNewNode = true;
// If the parent node can't be found, it might have not been loaded yet.
// This can happen for deep trees which require ajax loading.
// Assumes that the new node has been submitted to the server already.
if(nodeData.ParentID && !self.find('li[data-id='+nodeData.ParentID+']').length) {
self.jstree('load_node', -1, function() {
newNode = self.find('li[data-id='+nodeId+']');
correctStateFn(newNode);
});
} else {
self.createNode(nodeData.html, nodeData, function(newNode) {
correctStateFn(newNode);
});
}
}
});
if(!includesNewNode) {
self.jstree('deselect_all');
self.jstree('reselect');
self.jstree('reopen');
}
},
complete: function() {
self.setIsUpdatingTree(false);
}
});
}
});
$('.cms-tree.multiple').entwine({
onmatch: function() {
this._super();
this.jstree('show_checkboxes');
},
onunmatch: function() {
this._super();
this.jstree('uncheck_all');
this.jstree('hide_checkboxes');
},
/**
* Function: getSelectedIDs
*
* Returns:
* (Array)
*/
getSelectedIDs: function() {
return $(this)
.jstree('get_checked')
.not('.disabled')
.map(function() {
return $(this).data('id');
})
.get();
}
});
$('.cms-tree li').entwine({
/**
* Function: setEnabled
*
* Parameters:
* (bool)
*/
setEnabled: function(bool) {
this.toggleClass('disabled', !(bool));
},
/**
* Function: getClassname
*
* Returns PHP class for this element. Useful to check business rules like valid drag'n'drop targets.
*/
getClassname: function() {
var matches = this.attr('class').match(/class-([^\s]*)/i);
return matches ? matches[1] : '';
},
/**
* Function: getID
*
* Returns:
* (Number)
*/
getID: function() {
return this.data('id');
}
});
});

View File

@ -0,0 +1,16 @@
import $ from 'jQuery';
$.entwine('ss', function($){
// Any TreeDowndownField needs to refresh it's contents after a form submission,
// because the tree on the backend might have changed
$('.TreeDropdownField').entwine({
'from .cms-container form': {
onaftersubmitform: function(e){
this.find('.tree-holder').empty();
this._super();
}
}
});
});

View File

@ -0,0 +1,1515 @@
/**
* File: LeftAndMain.js
*/
import $ from 'jQuery';
$.noConflict();
window.ss = window.ss || {};
var windowWidth, windowHeight;
/**
* @func debounce
* @param func {function} - The callback to invoke after `wait` milliseconds.
* @param wait {number} - Milliseconds to wait.
* @param immediate {boolean} - If true the callback will be invoked at the start rather than the end.
* @return {function}
* @desc Returns a function that will not be called until it hasn't been invoked for `wait` seconds.
*/
window.ss.debounce = function (func, wait, immediate) {
var timeout, context, args;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
return function() {
var callNow = immediate && !timeout;
context = this;
args = arguments;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
};
$(window).bind('resize.leftandmain', function(e) {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
var cb = function() {$('.cms-container').trigger('windowresize');};
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
// setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
$.entwine('ss', function($) {
/*
* Handle messages sent via nested iframes
* Messages should be raised via postMessage with an object with the 'type' parameter given.
* An optional 'target' and 'data' parameter can also be specified. If no target is specified
* events will be sent to the window instead.
* type should be one of:
* - 'event' - Will trigger the given event (specified by 'event') on the target
* - 'callback' - Will call the given method (specified by 'callback') on the target
*/
$(window).on("message", function(e) {
var target,
event = e.originalEvent,
data = typeof event.data === 'object' ? event.data : JSON.parse(event.data);
// Reject messages outside of the same origin
if($.path.parseUrl(window.location.href).domain !== $.path.parseUrl(event.origin).domain) return;
// Get target of this action
target = typeof(data.target) === 'undefined'
? $(window)
: $(data.target);
// Determine action
switch(data.type) {
case 'event':
target.trigger(data.event, data.data);
break;
case 'callback':
target[data.callback].call(target, data.data);
break;
}
});
/**
* Position the loading spinner animation below the ss logo
*/
var positionLoadingSpinner = function() {
var offset = 120; // offset from the ss logo
var spinner = $('.ss-loading-screen .loading-animation');
var top = ($(window).height() - spinner.height()) / 2;
spinner.css('top', top + offset);
spinner.show();
};
// apply an select element only when it is ready, ie. when it is rendered into a template
// with css applied and got a width value.
var applyChosen = function(el) {
if(el.is(':visible')) {
el.addClass('has-chzn').chosen({
allow_single_deselect: true,
disable_search_threshold: 20
});
var title = el.prop('title');
if(title) {
el.siblings('.chzn-container').prop('title', title);
}
} else {
setTimeout(function() {
// Make sure it's visible before applying the ui
el.show();
applyChosen(el); },
500);
}
};
/**
* Compare URLs, but normalize trailing slashes in
* URL to work around routing weirdnesses in SS_HTTPRequest.
* Also normalizes relative URLs by prefixing them with the <base>.
*/
var isSameUrl = function(url1, url2) {
var baseUrl = $('base').attr('href');
url1 = $.path.isAbsoluteUrl(url1) ? url1 : $.path.makeUrlAbsolute(url1, baseUrl),
url2 = $.path.isAbsoluteUrl(url2) ? url2 : $.path.makeUrlAbsolute(url2, baseUrl);
var url1parts = $.path.parseUrl(url1), url2parts = $.path.parseUrl(url2);
return (
url1parts.pathname.replace(/\/*$/, '') == url2parts.pathname.replace(/\/*$/, '') &&
url1parts.search == url2parts.search
);
};
var ajaxCompleteEvent = window.ss.debounce(function () {
$(window).trigger('ajaxComplete');
}, 1000, true);
$(window).bind('resize', positionLoadingSpinner).trigger('resize');
// global ajax handlers
$(document).ajaxComplete(function(e, xhr, settings) {
// Simulates a redirect on an ajax response.
if(window.History.enabled) {
var url = xhr.getResponseHeader('X-ControllerURL'),
// TODO Replaces trailing slashes added by History after locale (e.g. admin/?locale=en/)
origUrl = History.getPageUrl().replace(/\/$/, ''),
destUrl = settings.url,
opts;
// Only redirect if controller url differs to the requested or current one
if(url !== null &&
(!isSameUrl(origUrl, url) || !isSameUrl(destUrl, url))
) {
opts = {
// Ensure that redirections are followed through by history API by handing it a unique ID
id: (new Date()).getTime() + String(Math.random()).replace(/\D/g,''),
pjax: xhr.getResponseHeader('X-Pjax')
? xhr.getResponseHeader('X-Pjax')
: settings.headers['X-Pjax']
};
window.History.pushState(opts, '', url);
}
}
// Handle custom status message headers
var msg = (xhr.getResponseHeader('X-Status')) ? xhr.getResponseHeader('X-Status') : xhr.statusText,
reathenticate = xhr.getResponseHeader('X-Reauthenticate'),
msgType = (xhr.status < 200 || xhr.status > 399) ? 'bad' : 'good',
ignoredMessages = ['OK'];
// Enable reauthenticate dialog if requested
if(reathenticate) {
$('.cms-container').showLoginDialog();
return;
}
// Show message (but ignore aborted requests)
if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) {
// Decode into UTF-8, HTTP headers don't allow multibyte
statusMessage(decodeURIComponent(msg), msgType);
}
ajaxCompleteEvent(this);
});
/**
* Main LeftAndMain interface with some control panel and an edit form.
*
* Events:
* ajaxsubmit - ...
* validate - ...
* aftersubmitform - ...
*/
$('.cms-container').entwine({
/**
* Tracks current panel request.
*/
StateChangeXHR: null,
/**
* Tracks current fragment-only parallel PJAX requests.
*/
FragmentXHR: {},
StateChangeCount: 0,
/**
* Options for the threeColumnCompressor layout algorithm.
*
* See LeftAndMain.Layout.js for description of these options.
*/
LayoutOptions: {
minContentWidth: 940,
minPreviewWidth: 400,
mode: 'content'
},
/**
* Constructor: onmatch
*/
onadd: function() {
var self = this;
// Browser detection
if($.browser.msie && parseInt($.browser.version, 10) < 8) {
$('.ss-loading-screen').append(
'<p class="ss-loading-incompat-warning"><span class="notice">' +
'Your browser is not compatible with the CMS interface. Please use Internet Explorer 8+, Google Chrome or Mozilla Firefox.' +
'</span></p>'
).css('z-index', $('.ss-loading-screen').css('z-index')+1);
$('.loading-animation').remove();
this._super();
return;
}
// Initialize layouts
this.redraw();
// Remove loading screen
$('.ss-loading-screen').hide();
$('body').removeClass('loading');
$(window).unbind('resize', positionLoadingSpinner);
this.restoreTabState();
this._super();
},
fromWindow: {
onstatechange: function(e){
this.handleStateChange(e);
}
},
'onwindowresize': function() {
this.redraw();
},
'from .cms-panel': {
ontoggle: function(){ this.redraw(); }
},
'from .cms-container': {
onaftersubmitform: function(){ this.redraw(); }
},
/**
* Ensure the user can see the requested section - restore the default view.
*/
'from .cms-menu-list li a': {
onclick: function(e) {
var href = $(e.target).attr('href');
if(e.which > 1 || href == this._tabStateUrl()) return;
this.splitViewMode();
}
},
/**
* Change the options of the threeColumnCompressor layout, and trigger layouting if needed.
* You can provide any or all options. The remaining options will not be changed.
*/
updateLayoutOptions: function(newSpec) {
var spec = this.getLayoutOptions();
var dirty = false;
for (var k in newSpec) {
if (spec[k] !== newSpec[k]) {
spec[k] = newSpec[k];
dirty = true;
}
}
if (dirty) this.redraw();
},
/**
* Enable the split view - with content on the left and preview on the right.
*/
splitViewMode: function() {
this.updateLayoutOptions({
mode: 'split'
});
},
/**
* Content only.
*/
contentViewMode: function() {
this.updateLayoutOptions({
mode: 'content'
});
},
/**
* Preview only.
*/
previewMode: function() {
this.updateLayoutOptions({
mode: 'preview'
});
},
RedrawSuppression: false,
redraw: function() {
if (this.getRedrawSuppression()) return;
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Reset the algorithm.
this.data('jlayout', jLayout.threeColumnCompressor(
{
menu: this.children('.cms-menu'),
content: this.children('.cms-content'),
preview: this.children('.cms-preview')
},
this.getLayoutOptions()
));
// Trigger layout algorithm once at the top. This also lays out children - we move from outside to
// inside, resizing to fit the parent.
this.layout();
// Redraw on all the children that need it
this.find('.cms-panel-layout').redraw();
this.find('.cms-content-fields[data-layout-type]').redraw();
this.find('.cms-edit-form[data-layout-type]').redraw();
this.find('.cms-preview').redraw();
this.find('.cms-content').redraw();
},
/**
* Confirm whether the current user can navigate away from this page
*
* @param {array} selectors Optional list of selectors
* @returns {boolean} True if the navigation can proceed
*/
checkCanNavigate: function(selectors) {
// Check change tracking (can't use events as we need a way to cancel the current state change)
var contentEls = this._findFragments(selectors || ['Content']),
trackedEls = contentEls
.find(':data(changetracker)')
.add(contentEls.filter(':data(changetracker)')),
safe = true;
if(!trackedEls.length) {
return true;
}
trackedEls.each(function() {
// See LeftAndMain.EditForm.js
if(!$(this).confirmUnsavedChanges()) {
safe = false;
}
});
return safe;
},
/**
* Proxy around History.pushState() which handles non-HTML5 fallbacks,
* as well as global change tracking. Change tracking needs to be synchronous rather than event/callback
* based because the user needs to be able to abort the action completely.
*
* See handleStateChange() for more details.
*
* Parameters:
* - {String} url
* - {String} title New window title
* - {Object} data Any additional data passed through to History.pushState()
* - {boolean} forceReload Forces the replacement of the current history state, even if the URL is the same, i.e. allows reloading.
*/
loadPanel: function(url, title, data, forceReload, forceReferer) {
if(!data) data = {};
if(!title) title = "";
if (!forceReferer) forceReferer = History.getState().url;
// Check for unsaved changes
if(!this.checkCanNavigate(data.pjax ? data.pjax.split(',') : ['Content'])) {
return;
}
// Save tab selections so we can restore them later
this.saveTabState();
if(window.History.enabled) {
$.extend(data, {__forceReferer: forceReferer});
// Active menu item is set based on X-Controller ajax header,
// which matches one class on the menu
if(forceReload) {
// Add a parameter to make sure the page gets reloaded even if the URL is the same.
$.extend(data, {__forceReload: Math.random()});
window.History.replaceState(data, title, url);
} else {
window.History.pushState(data, title, url);
}
} else {
window.location = $.path.makeUrlAbsolute(url, $('base').attr('href'));
}
},
/**
* Nice wrapper for reloading current history state.
*/
reloadCurrentPanel: function() {
this.loadPanel(window.History.getState().url, null, null, true);
},
/**
* Function: submitForm
*
* Parameters:
* {DOMElement} form - The form to be submitted. Needs to be passed
* in to avoid entwine methods/context being removed through replacing the node itself.
* {DOMElement} button - The pressed button (optional)
* {Function} callback - Called in complete() handler of jQuery.ajax()
* {Object} ajaxOptions - Object literal to merge into $.ajax() call
*
* Returns:
* (boolean)
*/
submitForm: function(form, button, callback, ajaxOptions) {
var self = this;
// look for save button
if(!button) button = this.find('.Actions :submit[name=action_save]');
// default to first button if none given - simulates browser behaviour
if(!button) button = this.find('.Actions :submit:first');
form.trigger('beforesubmitform');
this.trigger('submitform', {form: form, button: button});
// set button to "submitting" state
$(button).addClass('loading');
// validate if required
var validationResult = form.validate();
if(typeof validationResult!=='undefined' && !validationResult) {
// TODO Automatically switch to the tab/position of the first error
statusMessage("Validation failed.", "bad");
$(button).removeClass('loading');
return false;
}
// get all data from the form
var formData = form.serializeArray();
// add button action
formData.push({name: $(button).attr('name'), value:'1'});
// Artificial HTTP referer, IE doesn't submit them via ajax.
// Also rewrites anchors to their page counterparts, which is important
// as automatic browser ajax response redirects seem to discard the hash/fragment.
// TODO Replaces trailing slashes added by History after locale (e.g. admin/?locale=en/)
formData.push({name: 'BackURL', value:History.getPageUrl().replace(/\/$/, '')});
// Save tab selections so we can restore them later
this.saveTabState();
// Standard Pjax behaviour is to replace the submitted form with new content.
// The returned view isn't always decided upon when the request
// is fired, so the server might decide to change it based on its own logic,
// sending back different `X-Pjax` headers and content
jQuery.ajax(jQuery.extend({
headers: {"X-Pjax" : "CurrentForm,Breadcrumbs"},
url: form.attr('action'),
data: formData,
type: 'POST',
complete: function() {
$(button).removeClass('loading');
},
success: function(data, status, xhr) {
form.removeClass('changed'); // TODO This should be using the plugin API
if(callback) callback(data, status, xhr);
var newContentEls = self.handleAjaxResponse(data, status, xhr);
if(!newContentEls) return;
newContentEls.filter('form').trigger('aftersubmitform', {status: status, xhr: xhr, formData: formData});
}
}, ajaxOptions));
return false;
},
/**
* Last html5 history state
*/
LastState: null,
/**
* Flag to pause handleStateChange
*/
PauseState: false,
/**
* Handles ajax loading of new panels through the window.History object.
* To trigger loading, pass a new URL to window.History.pushState().
* Use loadPanel() as a pushState() wrapper as it provides some additional functionality
* like global changetracking and user aborts.
*
* Due to the nature of history management, no callbacks are allowed.
* Use the 'beforestatechange' and 'afterstatechange' events instead,
* or overwrite the beforeLoad() and afterLoad() methods on the
* DOM element you're loading the new content into.
* Although you can pass data into pushState(), it shouldn't contain
* DOM elements or callback closures.
*
* The passed URL should allow reconstructing important interface state
* without additional parameters, in the following use cases:
* - Explicit loading through History.pushState()
* - Implicit loading through browser navigation event triggered by the user (forward or back)
* - Full window refresh without ajax
* For example, a ModelAdmin search event should contain the search terms
* as URL parameters, and the result display should automatically appear
* if the URL is loaded without ajax.
*/
handleStateChange: function() {
if(this.getPauseState()) {
return;
}
// Don't allow parallel loading to avoid edge cases
if(this.getStateChangeXHR()) this.getStateChangeXHR().abort();
var self = this, h = window.History, state = h.getState(),
fragments = state.data.pjax || 'Content', headers = {},
fragmentsArr = fragments.split(','),
contentEls = this._findFragments(fragmentsArr);
// For legacy IE versions (IE7 and IE8), reload without ajax
// as a crude way to fix memory leaks through whole window refreshes.
this.setStateChangeCount(this.getStateChangeCount() + 1);
var isLegacyIE = ($.browser.msie && parseInt($.browser.version, 10) < 9);
if(isLegacyIE && this.getStateChangeCount() > 20) {
document.location.href = state.url;
return;
}
if(!this.checkCanNavigate()) {
// If history is emulated (ie8 or below) disable attempting to restore
if(h.emulated.pushState) {
return;
}
var lastState = this.getLastState();
// Suppress panel loading while resetting state
this.setPauseState(true);
// Restore best last state
if(lastState) {
h.pushState(lastState.id, lastState.title, lastState.url);
} else {
h.back();
}
this.setPauseState(false);
// Abort loading of this panel
return;
}
this.setLastState(state);
// If any of the requested Pjax fragments don't exist in the current view,
// fetch the "Content" view instead, which is the "outermost" fragment
// that can be reloaded without reloading the whole window.
if(contentEls.length < fragmentsArr.length) {
fragments = 'Content', fragmentsArr = ['Content'];
contentEls = this._findFragments(fragmentsArr);
}
this.trigger('beforestatechange', {state: state, element: contentEls});
// Set Pjax headers, which can declare a preference for the returned view.
// The actually returned view isn't always decided upon when the request
// is fired, so the server might decide to change it based on its own logic.
headers['X-Pjax'] = fragments;
// Set 'fake' referer - we call pushState() before making the AJAX request, so we have to
// set our own referer here
if (typeof state.data.__forceReferer !== 'undefined') {
// Ensure query string is properly encoded if present
var url = state.data.__forceReferer;
try {
// Prevent double-encoding by attempting to decode
url = decodeURI(url);
} catch(e) {
// URL not encoded, or was encoded incorrectly, so do nothing
} finally {
// Set our referer header to the encoded URL
headers['X-Backurl'] = encodeURI(url);
}
}
contentEls.addClass('loading');
var xhr = $.ajax({
headers: headers,
url: state.url,
complete: function() {
self.setStateChangeXHR(null);
// Remove loading indication from old content els (regardless of which are replaced)
contentEls.removeClass('loading');
},
success: function(data, status, xhr) {
var els = self.handleAjaxResponse(data, status, xhr, state);
self.trigger('afterstatechange', {data: data, status: status, xhr: xhr, element: els, state: state});
}
});
this.setStateChangeXHR(xhr);
},
/**
* ALternative to loadPanel/submitForm.
*
* Triggers a parallel-fetch of a PJAX fragment, which is a separate request to the
* state change requests. There could be any amount of these fetches going on in the background,
* and they don't register as a HTML5 history states.
*
* This is meant for updating a PJAX areas that are not complete panel/form reloads. These you'd
* normally do via submitForm or loadPanel which have a lot of automation built in.
*
* On receiving successful response, the framework will update the element tagged with appropriate
* data-pjax-fragment attribute (e.g. data-pjax-fragment="<pjax-fragment-name>"). Make sure this element
* is available.
*
* Example usage:
* $('.cms-container').loadFragment('admin/foobar/', 'FragmentName');
*
* @param url string Relative or absolute url of the controller.
* @param pjaxFragments string PJAX fragment(s), comma separated.
*/
loadFragment: function(url, pjaxFragments) {
var self = this,
xhr,
headers = {},
baseUrl = $('base').attr('href'),
fragmentXHR = this.getFragmentXHR();
// Make sure only one XHR for a specific fragment is currently in progress.
if(
typeof fragmentXHR[pjaxFragments]!=='undefined' &&
fragmentXHR[pjaxFragments]!==null
) {
fragmentXHR[pjaxFragments].abort();
fragmentXHR[pjaxFragments] = null;
}
url = $.path.isAbsoluteUrl(url) ? url : $.path.makeUrlAbsolute(url, baseUrl);
headers['X-Pjax'] = pjaxFragments;
xhr = $.ajax({
headers: headers,
url: url,
success: function(data, status, xhr) {
var elements = self.handleAjaxResponse(data, status, xhr, null);
// We are fully done now, make it possible for others to hook in here.
self.trigger('afterloadfragment', { data: data, status: status, xhr: xhr, elements: elements });
},
error: function(xhr, status, error) {
self.trigger('loadfragmenterror', { xhr: xhr, status: status, error: error });
},
complete: function() {
// Reset the current XHR in tracking object.
var fragmentXHR = self.getFragmentXHR();
if(
typeof fragmentXHR[pjaxFragments]!=='undefined' &&
fragmentXHR[pjaxFragments]!==null
) {
fragmentXHR[pjaxFragments] = null;
}
}
});
// Store the fragment request so we can abort later, should we get a duplicate request.
fragmentXHR[pjaxFragments] = xhr;
return xhr;
},
/**
* Handles ajax responses containing plain HTML, or mulitple
* PJAX fragments wrapped in JSON (see PjaxResponseNegotiator PHP class).
* Can be hooked into an ajax 'success' callback.
*
* Parameters:
* (Object) data
* (String) status
* (XMLHTTPRequest) xhr
* (Object) state The original history state which the request was initiated with
*/
handleAjaxResponse: function(data, status, xhr, state) {
var self = this, url, selectedTabs, guessFragment, fragment, $data;
// Support a full reload
if(xhr.getResponseHeader('X-Reload') && xhr.getResponseHeader('X-ControllerURL')) {
var baseUrl = $('base').attr('href'),
rawURL = xhr.getResponseHeader('X-ControllerURL'),
url = $.path.isAbsoluteUrl(rawURL) ? rawURL : $.path.makeUrlAbsolute(rawURL, baseUrl);
document.location.href = url;
return;
}
// Pseudo-redirects via X-ControllerURL might return empty data, in which
// case we'll ignore the response
if(!data) return;
// Update title
var title = xhr.getResponseHeader('X-Title');
if(title) document.title = decodeURIComponent(title.replace(/\+/g, ' '));
var newFragments = {}, newContentEls;
// If content type is text/json (ignoring charset and other parameters)
if(xhr.getResponseHeader('Content-Type').match(/^((text)|(application))\/json[ \t]*;?/i)) {
newFragments = data;
} else {
// Fall back to replacing the content fragment if HTML is returned
fragment = document.createDocumentFragment();
jQuery.clean( [ data ], document, fragment, [] );
$data = $(jQuery.merge( [], fragment.childNodes ));
// Try and guess the fragment if none is provided
// TODO: data-pjax-fragment might actually give us the fragment. For now we just check most common case
guessFragment = 'Content';
if ($data.is('form') && !$data.is('[data-pjax-fragment~=Content]')) guessFragment = 'CurrentForm';
newFragments[guessFragment] = $data;
}
this.setRedrawSuppression(true);
try {
// Replace each fragment individually
$.each(newFragments, function(newFragment, html) {
var contentEl = $('[data-pjax-fragment]').filter(function() {
return $.inArray(newFragment, $(this).data('pjaxFragment').split(' ')) != -1;
}), newContentEl = $(html);
// Add to result collection
if(newContentEls) newContentEls.add(newContentEl);
else newContentEls = newContentEl;
// Update panels
if(newContentEl.find('.cms-container').length) {
throw 'Content loaded via ajax is not allowed to contain tags matching the ".cms-container" selector to avoid infinite loops';
}
// Set loading state and store element state
var origStyle = contentEl.attr('style');
var origParent = contentEl.parent();
var origParentLayoutApplied = (typeof origParent.data('jlayout')!=='undefined');
var layoutClasses = ['east', 'west', 'center', 'north', 'south', 'column-hidden'];
var elemClasses = contentEl.attr('class');
var origLayoutClasses = [];
if(elemClasses) {
origLayoutClasses = $.grep(
elemClasses.split(' '),
function(val) { return ($.inArray(val, layoutClasses) >= 0);}
);
}
newContentEl
.removeClass(layoutClasses.join(' '))
.addClass(origLayoutClasses.join(' '));
if(origStyle) newContentEl.attr('style', origStyle);
// Allow injection of inline styles, as they're not allowed in the document body.
// Not handling this through jQuery.ondemand to avoid parsing the DOM twice.
var styles = newContentEl.find('style').detach();
if(styles.length) $(document).find('head').append(styles);
// Replace panel completely (we need to override the "layout" attribute, so can't replace the child instead)
contentEl.replaceWith(newContentEl);
// Force jlayout to rebuild internal hierarchy to point to the new elements.
// This is only necessary for elements that are at least 3 levels deep. 2nd level elements will
// be taken care of when we lay out the top level element (.cms-container).
if (!origParent.is('.cms-container') && origParentLayoutApplied) {
origParent.layout();
}
});
// Re-init tabs (in case the form tag itself is a tabset)
var newForm = newContentEls.filter('form');
if(newForm.hasClass('cms-tabset')) newForm.removeClass('cms-tabset').addClass('cms-tabset');
}
finally {
this.setRedrawSuppression(false);
}
this.redraw();
this.restoreTabState((state && typeof state.data.tabState !== 'undefined') ? state.data.tabState : null);
return newContentEls;
},
/**
*
*
* Parameters:
* - fragments {Array}
* Returns: jQuery collection
*/
_findFragments: function(fragments) {
return $('[data-pjax-fragment]').filter(function() {
// Allows for more than one fragment per node
var i, nodeFragments = $(this).data('pjaxFragment').split(' ');
for(i in fragments) {
if($.inArray(fragments[i], nodeFragments) != -1) return true;
}
return false;
});
},
/**
* Function: refresh
*
* Updates the container based on the current url
*
* Returns: void
*/
refresh: function() {
$(window).trigger('statechange');
$(this).redraw();
},
/**
* Save tab selections in order to reconstruct them later.
* Requires HTML5 sessionStorage support.
*/
saveTabState: function() {
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage === null) return;
var selectedTabs = [], url = this._tabStateUrl();
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
var id = $(el).attr('id');
if(!id) return; // we need a unique reference
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
// Allow opt-out via data element or entwine property.
if($(el).data('ignoreTabState') || $(el).getIgnoreTabState()) return;
selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')});
});
if(selectedTabs) {
var tabsUrl = 'tabs-' + url;
try {
window.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs));
} catch(err) {
if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {
// If this fails we ignore the error as the only issue is that it
// does not remember the tab state.
// This is a Safari bug which happens when private browsing is enabled.
return;
} else {
throw err;
}
}
}
},
/**
* Re-select previously saved tabs.
* Requires HTML5 sessionStorage support.
*
* Parameters:
* (Object) Map of tab container selectors to tab selectors.
* Used to mark a specific tab as active regardless of the previously saved options.
*/
restoreTabState: function(overrideStates) {
var self = this, url = this._tabStateUrl(),
hasSessionStorage = (typeof(window.sessionStorage)!=="undefined" && window.sessionStorage),
sessionData = hasSessionStorage ? window.sessionStorage.getItem('tabs-' + url) : null,
sessionStates = sessionData ? JSON.parse(sessionData) : false;
this.find('.cms-tabset, .ss-tabset').each(function() {
var index, tabset = $(this), tabsetId = tabset.attr('id'), tab,
forcedTab = tabset.find('.ss-tabs-force-active');
if(!tabset.data('tabs')){
return; // don't act on uninit'ed controls
}
// The tabs may have changed, notify the widget that it should update its internal state.
tabset.tabs('refresh');
// Make sure the intended tab is selected.
if(forcedTab.length) {
index = forcedTab.index();
} else if(overrideStates && overrideStates[tabsetId]) {
tab = tabset.find(overrideStates[tabsetId].tabSelector);
if(tab.length){
index = tab.index();
}
} else if(sessionStates) {
$.each(sessionStates, function(i, sessionState) {
if(tabset.is('#' + sessionState.id)){
index = sessionState.selected;
}
});
}
if(index !== null){
tabset.tabs('option', 'active', index);
self.trigger('tabstaterestored');
}
});
},
/**
* Remove any previously saved state.
*
* Parameters:
* (String) url Optional (sanitized) URL to clear a specific state.
*/
clearTabState: function(url) {
if(typeof(window.sessionStorage)=="undefined") return;
var s = window.sessionStorage;
if(url) {
s.removeItem('tabs-' + url);
} else {
for(var i=0;i<s.length;i++) {
if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
}
}
},
/**
* Remove tab state for the current URL.
*/
clearCurrentTabState: function() {
this.clearTabState(this._tabStateUrl());
},
_tabStateUrl: function() {
return History.getState().url
.replace(/\?.*/, '')
.replace(/#.*/, '')
.replace($('base').attr('href'), '');
},
showLoginDialog: function() {
var tempid = $('body').data('member-tempid'),
dialog = $('.leftandmain-logindialog'),
url = 'CMSSecurity/login';
// Force regeneration of any existing dialog
if(dialog.length) dialog.remove();
// Join url params
url = $.path.addSearchParams(url, {
'tempid': tempid,
'BackURL': window.location.href
});
// Show a placeholder for instant feedback. Will be replaced with actual
// form dialog once its loaded.
dialog = $('<div class="leftandmain-logindialog"></div>');
dialog.attr('id', new Date().getTime());
dialog.data('url', url);
$('body').append(dialog);
}
});
// Login dialog page
$('.leftandmain-logindialog').entwine({
onmatch: function() {
this._super();
// Create jQuery dialog
this.ssdialog({
iframeUrl: this.data('url'),
dialogClass: "leftandmain-logindialog-dialog",
autoOpen: true,
minWidth: 500,
maxWidth: 500,
minHeight: 370,
maxHeight: 400,
closeOnEscape: false,
open: function() {
$('.ui-widget-overlay').addClass('leftandmain-logindialog-overlay');
},
close: function() {
$('.ui-widget-overlay').removeClass('leftandmain-logindialog-overlay');
}
});
},
onunmatch: function() {
this._super();
},
open: function() {
this.ssdialog('open');
},
close: function() {
this.ssdialog('close');
},
toggle: function(bool) {
if(this.is(':visible')) this.close();
else this.open();
},
/**
* Callback activated by CMSSecurity_success.ss
*/
reauthenticate: function(data) {
// Replace all SecurityID fields with the given value
if(typeof(data.SecurityID) !== 'undefined') {
$(':input[name=SecurityID]').val(data.SecurityID);
}
// Update TempID for current user
if(typeof(data.TempID) !== 'undefined') {
$('body').data('member-tempid', data.TempID);
}
this.close();
}
});
/**
* Add loading overlay to selected regions in the CMS automatically.
* Not applied to all "*.loading" elements to avoid secondary regions
* like the breadcrumbs showing unnecessary loading status.
*/
$('form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading').entwine({
onmatch: function() {
this.append('<div class="cms-content-loading-overlay ui-widget-overlay-light"></div><div class="cms-content-loading-spinner"></div>');
this._super();
},
onunmatch: function() {
this.find('.cms-content-loading-overlay,.cms-content-loading-spinner').remove();
this._super();
}
});
/** Make all buttons "hoverable" with jQuery theming. */
$('.cms input[type="submit"], .cms button, .cms input[type="reset"], .cms .ss-ui-button').entwine({
onadd: function() {
this.addClass('ss-ui-button');
if(!this.data('button')) this.button();
this._super();
},
onremove: function() {
if(this.data('button')) this.button('destroy');
this._super();
}
});
/**
* Loads the link's 'href' attribute into a panel via ajax,
* as opposed to triggering a full page reload.
* Little helper to avoid repetition, and make it easy to
* "opt in" to panel loading, while by default links still exhibit their default behaviour.
* The PJAX target can be specified via a 'data-pjax-target' attribute.
*/
$('.cms .cms-panel-link').entwine({
onclick: function(e) {
if($(this).hasClass('external-link')) {
e.stopPropagation();
return;
}
var href = this.attr('href'),
url = (href && !href.match(/^#/)) ? href : this.data('href'),
data = {pjax: this.data('pjaxTarget')};
$('.cms-container').loadPanel(url, null, data);
e.preventDefault();
}
});
/**
* Does an ajax loads of the link's 'href' attribute via ajax and displays any FormResponse messages from the CMS.
* Little helper to avoid repetition, and make it easy to trigger actions via a link,
* without reloading the page, changing the URL, or loading in any new panel content.
*/
$('.cms .ss-ui-button-ajax').entwine({
onclick: function(e) {
$(this).removeClass('ui-button-text-only');
$(this).addClass('ss-ui-button-loading ui-button-text-icons');
var loading = $(this).find(".ss-ui-loading-icon");
if(loading.length < 1) {
loading = $("<span></span>").addClass('ss-ui-loading-icon ui-button-icon-primary ui-icon');
$(this).prepend(loading);
}
loading.show();
var href = this.attr('href'), url = href ? href : this.data('href');
jQuery.ajax({
url: url,
// Ensure that form view is loaded (rather than whole "Content" template)
complete: function(xmlhttp, status) {
var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.responseText;
try {
if (typeof msg != "undefined" && msg !== null) eval(msg);
}
catch(e) {}
loading.hide();
$(".cms-container").refresh();
$(this).removeClass('ss-ui-button-loading ui-button-text-icons');
$(this).addClass('ui-button-text-only');
},
dataType: 'html'
});
e.preventDefault();
}
});
/**
* Trigger dialogs with iframe based on the links href attribute (see ssui-core.js).
*/
$('.cms .ss-ui-dialog-link').entwine({
UUID: null,
onmatch: function() {
this._super();
this.setUUID(new Date().getTime());
},
onunmatch: function() {
this._super();
},
onclick: function() {
this._super();
var self = this, id = 'ss-ui-dialog-' + this.getUUID();
var dialog = $('#' + id);
if(!dialog.length) {
dialog = $('<div class="ss-ui-dialog" id="' + id + '" />');
$('body').append(dialog);
}
var extraClass = this.data('popupclass')?this.data('popupclass'):'';
dialog.ssdialog({iframeUrl: this.attr('href'), autoOpen: true, dialogExtraClass: extraClass});
return false;
}
});
/**
* Add styling to all contained buttons, and create buttonsets if required.
*/
$('.cms-content .Actions').entwine({
onmatch: function() {
this.find('.ss-ui-button').click(function() {
var form = this.form;
// forms don't natively store the button they've been triggered with
if(form) {
form.clickedButton = this;
// Reset the clicked button shortly after the onsubmit handlers
// have fired on the form
setTimeout(function() {
form.clickedButton = null;
}, 10);
}
});
this.redraw();
this._super();
},
onunmatch: function() {
this._super();
},
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
// Remove whitespace to avoid gaps with inline elements
this.contents().filter(function() {
return (this.nodeType == 3 && !/\S/.test(this.nodeValue));
}).remove();
// Init buttons if required
this.find('.ss-ui-button').each(function() {
if(!$(this).data('button')) $(this).button();
});
// Mark up buttonsets
this.find('.ss-ui-buttonset').buttonset();
}
});
/**
* Duplicates functionality in DateField.js, but due to using entwine we can match
* the DOM element on creation, rather than onclick - which allows us to decorate
* the field with a calendar icon
*/
$('.cms .field.date input.text').entwine({
onmatch: function() {
var holder = $(this).parents('.field.date:first'), config = holder.data();
if(!config.showcalendar) {
this._super();
return;
}
config.showOn = 'button';
if(config.locale && $.datepicker.regional[config.locale]) {
config = $.extend(config, $.datepicker.regional[config.locale], {});
}
$(this).datepicker(config);
// // Unfortunately jQuery UI only allows configuration of icon images, not sprites
// this.next('button').button('option', 'icons', {primary : 'ui-icon-calendar'});
this._super();
},
onunmatch: function() {
this._super();
}
});
/**
* Styled dropdown select fields via chosen. Allows things like search and optgroup
* selection support. Rather than manually adding classes to selects we want
* styled, we style everything but the ones we tell it not to.
*
* For the CMS we also need to tell the parent div that it has a select so
* we can fix the height cropping.
*/
$('.cms .field.dropdown select, .cms .field select[multiple], .fieldholder-small select.dropdown').entwine({
onmatch: function() {
if(this.is('.no-chzn')) {
this._super();
return;
}
// Explicitly disable default placeholder if no custom one is defined
if(!this.data('placeholder')) this.data('placeholder', ' ');
// We could've gotten stale classes and DOM elements from deferred cache.
this.removeClass('has-chzn chzn-done');
this.siblings('.chzn-container').remove();
// Apply Chosen
applyChosen(this);
this._super();
},
onunmatch: function() {
this._super();
}
});
$(".cms-panel-layout").entwine({
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
}
});
/**
* Overload the default GridField behaviour (open a new URL in the browser)
* with the CMS-specific ajax loading.
*/
$('.cms .ss-gridfield').entwine({
showDetailView: function(url) {
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
var params = window.location.search.replace(/^\?/, '');
if(params) url = $.path.addSearchParams(url, params);
$('.cms-container').loadPanel(url);
}
});
/**
* Generic search form in the CMS, often hooked up to a GridField results display.
*/
$('.cms-search-form').entwine({
onsubmit: function(e) {
// Remove empty elements and make the URL prettier
var nonEmptyInputs,
url;
nonEmptyInputs = this.find(':input:not(:submit)').filter(function() {
// Use fieldValue() from jQuery.form plugin rather than jQuery.val(),
// as it handles checkbox values more consistently
var vals = $.grep($(this).fieldValue(), function(val) { return (val);});
return (vals.length);
});
url = this.attr('action');
if(nonEmptyInputs.length) {
url = $.path.addSearchParams(url, nonEmptyInputs.serialize());
}
var container = this.closest('.cms-container');
container.find('.cms-edit-form').tabs('select',0); //always switch to the first tab (list view) when searching
container.loadPanel(url, "", {}, true);
return false;
}
});
/**
* Reset button handler. IE8 does not bubble reset events to
*/
$(".cms-search-form button[type=reset], .cms-search-form input[type=reset]").entwine({
onclick: function(e) {
e.preventDefault();
var form = $(this).parents('form');
form.clearForm();
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js
form.submit();
}
});
/**
* Allows to lazy load a panel, by leaving it empty
* and declaring a URL to load its content via a 'url' HTML5 data attribute.
* The loaded HTML is cached, with cache key being the 'url' attribute.
* In order for this to work consistently, we assume that the responses are stateless.
* To avoid caching, add a 'deferred-no-cache' to the node.
*/
window._panelDeferredCache = {};
$('.cms-panel-deferred').entwine({
onadd: function() {
this._super();
this.redraw();
},
onremove: function() {
if(window.debug) console.log('saving', this.data('url'), this);
// Save the HTML state at the last possible moment.
// Don't store the DOM to avoid memory leaks.
if(!this.data('deferredNoCache')) window._panelDeferredCache[this.data('url')] = this.html();
this._super();
},
redraw: function() {
if(window.debug) console.log('redraw', this.attr('class'), this.get(0));
var self = this, url = this.data('url');
if(!url) throw 'Elements of class .cms-panel-deferred need a "data-url" attribute';
this._super();
// If the node is empty, try to either load it from cache or via ajax.
if(!this.children().length) {
if(!this.data('deferredNoCache') && typeof window._panelDeferredCache[url] !== 'undefined') {
this.html(window._panelDeferredCache[url]);
} else {
this.addClass('loading');
$.ajax({
url: url,
complete: function() {
self.removeClass('loading');
},
success: function(data, status, xhr) {
self.html(data);
}
});
}
}
}
});
/**
* Lightweight wrapper around jQuery UI tabs.
* Ensures that anchor links are set properly,
* and any nested tabs are scrolled if they have
* their height explicitly set. This is important
* for forms inside the CMS layout.
*/
$('.cms-tabset').entwine({
onadd: function() {
// Can't name redraw() as it clashes with other CMS entwine classes
this.redrawTabs();
this._super();
},
onremove: function() {
if (this.data('tabs')) this.tabs('destroy');
this._super();
},
redrawTabs: function() {
this.rewriteHashlinks();
var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');
if(!this.data('uiTabs')) this.tabs({
active: (activeTab.index() != -1) ? activeTab.index() : 0,
beforeLoad: function(e, ui) {
// Disable automatic ajax loading of tabs without matching DOM elements,
// determining if the current URL differs from the tab URL is too error prone.
return false;
},
activate: function(e, ui) {
// Accessibility: Simulate click to trigger panel load when tab is focused
// by a keyboard navigation event rather than a click
if(ui.newTab) {
ui.newTab.find('.cms-panel-link').click();
}
// Usability: Hide actions for "readonly" tabs (which don't contain any editable fields)
var actions = $(this).closest('form').find('.Actions');
if($(ui.newTab).closest('li').hasClass('readonly')) {
actions.fadeOut();
} else {
actions.show();
}
}
});
},
/**
* Ensure hash links are prefixed with the current page URL,
* otherwise jQuery interprets them as being external.
*/
rewriteHashlinks: function() {
$(this).find('ul a').each(function() {
if (!$(this).attr('href')) return;
var matches = $(this).attr('href').match(/#.*/);
if(!matches) return;
$(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]);
});
}
});
/**
* CMS content filters
*/
$('#filters-button').entwine({
onmatch: function () {
this._super();
this.data('collapsed', true); // The current collapsed state of the element.
this.data('animating', false); // True if the element is currently animating.
},
onunmatch: function () {
this._super();
},
showHide: function () {
var self = this,
$filters = $('.cms-content-filters').first(),
collapsed = this.data('collapsed');
// Prevent the user from spamming the UI with animation requests.
if (this.data('animating')) {
return;
}
this.toggleClass('active');
this.data('animating', true);
// Slide the element down / up based on it's current collapsed state.
$filters[collapsed ? 'slideDown' : 'slideUp']({
complete: function () {
// Update the element's state.
self.data('collapsed', !collapsed);
self.data('animating', false);
}
});
},
onclick: function () {
this.showHide();
}
});
});
var statusMessage = function(text, type) {
text = jQuery('<div/>').text(text).html(); // Escape HTML entities in text
jQuery.noticeAdd({text: text, type: type, stayTime: 5000, inEffect: {left: '0', opacity: 'show'}});
};
var errorMessage = function(text) {
jQuery.noticeAdd({text: text, type: 'error', stayTime: 5000, inEffect: {left: '0', opacity: 'show'}});
};

View File

@ -0,0 +1,19 @@
import $ from 'jQuery';
$.entwine('ss', function($){
$('.memberdatetimeoptionset').entwine({
onmatch: function() {
this.find('.description .toggle-content').hide();
this._super();
}
});
$('.memberdatetimeoptionset .toggle').entwine({
onclick: function(e) {
jQuery(this).closest('.description').find('.toggle-content').toggle();
return false;
}
});
});

View File

@ -0,0 +1,34 @@
/**
* File: MemberImportForm.js
*/
import $ from 'jQuery';
$.entwine('ss', function($){
/**
* Class: .import-form .advanced
*/
$('.import-form .advanced').entwine({
onmatch: function() {
this._super();
this.hide();
},
onunmatch: function() {
this._super();
}
});
/**
* Class: .import-form a.toggle-advanced
*/
$('.import-form a.toggle-advanced').entwine({
/**
* Function: onclick
*/
onclick: function(e) {
this.parents('form:eq(0)').find('.advanced').toggle();
return false;
}
});
});

View File

@ -0,0 +1,34 @@
/**
* File: ModelAdmin.js
*/
import $ from 'jQuery';
$.entwine('ss', function($){
$('.cms-content-tools #Form_SearchForm').entwine({
onsubmit: function(e) {
//We need to trigger handleStateChange() explicitly, otherwise handleStageChange()
//doesn't called if landing from another section of cms
this.trigger('beforeSubmit');
}
});
/**
* Class: .importSpec
*
* Toggle import specifications
*/
$('.importSpec').entwine({
onmatch: function() {
this.find('div.details').hide();
this.find('a.detailsLink').click(function() {
$('#' + $(this).attr('href').replace(/.*#/,'')).slideToggle();
return false;
});
this._super();
},
onunmatch: function() {
this._super();
}
});
});

View File

@ -0,0 +1,77 @@
/**
* File: SecurityAdmin.js
*/
import $ from 'jQuery';
var refreshAfterImport = function(e) {
// Check for a message <div>, an indication that the form has been submitted.
var existingFormMessage = $($(this).contents()).find('.message');
if(existingFormMessage && existingFormMessage.html()) {
// Refresh member listing
var memberTableField = $(window.parent.document).find('#Form_EditForm_Members').get(0);
if(memberTableField) memberTableField.refresh();
// Refresh tree
var tree = $(window.parent.document).find('.cms-tree').get(0);
if(tree) tree.reload();
}
};
/**
* Refresh the member listing every time the import iframe is loaded,
* which is most likely a form submission.
*/
$('#MemberImportFormIframe, #GroupImportFormIframe').entwine({
onadd: function() {
this._super();
// TODO entwine can't seem to bind to iframe load events
$(this).bind('load', refreshAfterImport);
}
});
$.entwine('ss', function($){
/**
* Class: #Permissions .checkbox[value=ADMIN]
*
* Automatically check and disable all checkboxes if ADMIN permissions are selected.
* As they're disabled, any changes won't be submitted (which is intended behaviour),
* checking all boxes is purely presentational.
*/
$('.permissioncheckboxset .checkbox[value=ADMIN]').entwine({
onmatch: function() {
this.toggleCheckboxes();
this._super();
},
onunmatch: function() {
this._super();
},
/**
* Function: onclick
*/
onclick: function(e) {
this.toggleCheckboxes();
},
/**
* Function: toggleCheckboxes
*/
toggleCheckboxes: function() {
var self = this,
checkboxes = this.parents('.field:eq(0)').find('.checkbox').not(this);
if(this.is(':checked')) {
checkboxes.each(function() {
$(this).data('SecurityAdmin.oldChecked', $(this).is(':checked'));
$(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled'));
$(this).prop('disabled', true);
$(this).prop('checked', true);
});
} else {
checkboxes.each(function() {
$(this).prop('checked', $(this).data('SecurityAdmin.oldChecked'));
$(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled'));
});
}
}
});
});

View File

@ -0,0 +1,13 @@
require('../../src/LeftAndMain.Layout.js');
require('../../src/LeftAndMain.js');
require('../../src/LeftAndMain.ActionTabSet.js');
require('../../src/LeftAndMain.Panel.js');
require('../../src/LeftAndMain.Tree.js');
require('../../src/LeftAndMain.Content.js');
require('../../src/LeftAndMain.EditForm.js');
require('../../src/LeftAndMain.Menu.js');
require('../../src/LeftAndMain.Preview.js');
require('../../src/LeftAndMain.BatchActions.js');
require('../../src/LeftAndMain.FieldHelp.js');
require('../../src/LeftAndMain.FieldDescriptionToggle.js');
require('../../src/LeftAndMain.TreeDropdownField.js');

View File

@ -0,0 +1,26 @@
require('../../../../thirdparty/jquery/jquery.js');
require('../../../../thirdparty/jquery-ondemand/jquery.ondemand.js');
require('../../src/sspath.js');
require('../../../../thirdparty/jquery-ui/jquery-ui.js');
require('../../../../thirdparty/json-js/json2.js');
require('../../../../thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
require('../../../../thirdparty/jquery-cookie/jquery.cookie.js');
require('../../../../thirdparty/jquery-query/jquery.query.js');
require('../../../../thirdparty/jquery-form/jquery.form.js');
require('../../../thirdparty/jquery-notice/jquery.notice.js');
require('../../../thirdparty/jsizes/lib/jquery.sizes.js');
require('../../../thirdparty/jlayout/lib/jlayout.border.js');
require('../../../thirdparty/jlayout/lib/jquery.jlayout.js');
require('../../../thirdparty/history-js/scripts/uncompressed/history.js');
require('../../../thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js');
require('../../../thirdparty/history-js/scripts/uncompressed/history.html4.js');
require('../../../../thirdparty/jstree/jquery.jstree.js');
require('../../../thirdparty/chosen/chosen/chosen.jquery.js');
require('../../../thirdparty/jquery-hoverIntent/jquery.hoverIntent.js');
require('../../../../thirdparty/jquery-changetracker/lib/jquery.changetracker.js');
require('../../../../javascript/src/TreeDropdownField.js');
require('../../../../javascript/src/DateField.js');
require('../../../../javascript/src/HtmlEditorField.js');
require('../../../../javascript/src/TabSet.js');
require('../../src/ssui.core.js');
require('../../../../javascript/src/GridField.js');

View File

@ -0,0 +1,46 @@
import $ from 'jQuery';
var getHTML = function(el) {
var clone = el.cloneNode(true);
var div = $('<div></div>');
div.append(clone);
return div.html();
}
$.leaktools = {
logDuplicateElements: function(){
var els = $('*');
var dirty = false;
els.each(function(i, a){
els.not(a).each(function(j, b){
if (getHTML(a) == getHTML(b)) {
dirty = true;
console.log(a, b);
}
})
})
if (!dirty) console.log('No duplicates found');
},
logUncleanedElements: function(clean){
$.each($.cache, function(){
var source = this.handle && this.handle.elem;
if (!source) return;
var parent = source;
while (parent && parent.nodeType == 1) parent = parent.parentNode;
if (!parent) {
console.log('Unattached', source);
console.log(this.events);
if (clean) $(source).unbind().remove();
}
else if (parent !== document) console.log('Attached, but to', parent, 'not our document', source);
})
}
};

View File

@ -0,0 +1,255 @@
import $ from 'jQuery';
// Copyright (c) 2011 John Resig, http://jquery.com/
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//define vars for interal use
var $window = $( window ),
$html = $( 'html' ),
$head = $( 'head' ),
//url path helpers for use in relative url management
path = {
// This scary looking regular expression parses an absolute URL or its relative
// variants (protocol, site, document, query, and hash), into the various
// components (protocol, host, path, query, fragment, etc that make up the
// URL as well as some other commonly used sub-parts. When used with RegExp.exec()
// or String.match, it parses the URL into a results array that looks like this:
//
// [0]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content
// [1]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread
// [2]: http://jblas:password@mycompany.com:8080/mail/inbox
// [3]: http://jblas:password@mycompany.com:8080
// [4]: http:
// [5]: //
// [6]: jblas:password@mycompany.com:8080
// [7]: jblas:password
// [8]: jblas
// [9]: password
// [10]: mycompany.com:8080
// [11]: mycompany.com
// [12]: 8080
// [13]: /mail/inbox
// [14]: /mail/
// [15]: inbox
// [16]: ?msg=1234&type=unread
// [17]: #msg-content
//
urlParseRE: /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
//Parse a URL into a structure that allows easy access to
//all of the URL components by name.
parseUrl: function( url ) {
// If we're passed an object, we'll assume that it is
// a parsed url object and just return it back to the caller.
if ( $.type( url ) === "object" ) {
return url;
}
var matches = path.urlParseRE.exec( url || "" ) || [];
// Create an object that allows the caller to access the sub-matches
// by name. Note that IE returns an empty string instead of undefined,
// like all other browsers do, so we normalize everything so its consistent
// no matter what browser we're running on.
return {
href: matches[ 0 ] || "",
hrefNoHash: matches[ 1 ] || "",
hrefNoSearch: matches[ 2 ] || "",
domain: matches[ 3 ] || "",
protocol: matches[ 4 ] || "",
doubleSlash: matches[ 5 ] || "",
authority: matches[ 6 ] || "",
username: matches[ 8 ] || "",
password: matches[ 9 ] || "",
host: matches[ 10 ] || "",
hostname: matches[ 11 ] || "",
port: matches[ 12 ] || "",
pathname: matches[ 13 ] || "",
directory: matches[ 14 ] || "",
filename: matches[ 15 ] || "",
search: matches[ 16 ] || "",
hash: matches[ 17 ] || ""
};
},
//Turn relPath into an asbolute path. absPath is
//an optional absolute path which describes what
//relPath is relative to.
makePathAbsolute: function( relPath, absPath ) {
if ( relPath && relPath.charAt( 0 ) === "/" ) {
return relPath;
}
relPath = relPath || "";
absPath = absPath ? absPath.replace( /^\/|(\/[^\/]*|[^\/]+)$/g, "" ) : "";
var absStack = absPath ? absPath.split( "/" ) : [],
relStack = relPath.split( "/" );
for ( var i = 0; i < relStack.length; i++ ) {
var d = relStack[ i ];
switch ( d ) {
case ".":
break;
case "..":
if ( absStack.length ) {
absStack.pop();
}
break;
default:
absStack.push( d );
break;
}
}
return "/" + absStack.join( "/" );
},
//Returns true if both urls have the same domain.
isSameDomain: function( absUrl1, absUrl2 ) {
return path.parseUrl( absUrl1 ).domain === path.parseUrl( absUrl2 ).domain;
},
//Returns true for any relative variant.
isRelativeUrl: function( url ) {
// All relative Url variants have one thing in common, no protocol.
return path.parseUrl( url ).protocol === "";
},
//Returns true for an absolute url.
isAbsoluteUrl: function( url ) {
return path.parseUrl( url ).protocol !== "";
},
//Turn the specified realtive URL into an absolute one. This function
//can handle all relative variants (protocol, site, document, query, fragment).
makeUrlAbsolute: function( relUrl, absUrl ) {
if ( !path.isRelativeUrl( relUrl ) ) {
return relUrl;
}
var relObj = path.parseUrl( relUrl ),
absObj = path.parseUrl( absUrl ),
protocol = relObj.protocol || absObj.protocol,
doubleSlash = relObj.protocol ? relObj.doubleSlash : ( relObj.doubleSlash || absObj.doubleSlash ),
authority = relObj.authority || absObj.authority,
hasPath = relObj.pathname !== "",
pathname = path.makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname ),
search = relObj.search || ( !hasPath && absObj.search ) || "",
hash = relObj.hash;
return protocol + doubleSlash + authority + pathname + search + hash;
},
//Add search (aka query) params to the specified url.
// 2013-12-06 ischommer: Customized to merge with existing keys
addSearchParams: function( url, params ) {
var u = path.parseUrl( url ),
params = ( typeof params === "string" ) ? path.convertSearchToArray( params ) : params,
newParams = $.extend( path.convertSearchToArray( u.search ), params );
return u.hrefNoSearch + '?' + $.param( newParams ) + ( u.hash || "" );
},
// 2013-12-06 ischommer: Added to allow merge with existing keys
getSearchParams: function(url) {
var u = path.parseUrl( url );
return path.convertSearchToArray( u.search );
},
// Converts query strings (foo=bar&baz=bla) to a hash.
// TODO Handle repeating elements (e.g. arr[]=one&arr[]=two)
// 2013-12-06 ischommer: Added to allow merge with existing keys
convertSearchToArray: function(search) {
var params = {},
search = search.replace( /^\?/, '' ),
parts = search ? search.split( '&' ) : [], i, tmp;
for(i=0; i < parts.length; i++) {
tmp = parts[i].split( '=' );
params[tmp[0]] = tmp[1];
}
return params;
},
convertUrlToDataUrl: function( absUrl ) {
var u = path.parseUrl( absUrl );
if ( path.isEmbeddedPage( u ) ) {
// For embedded pages, remove the dialog hash key as in getFilePath(),
// otherwise the Data Url won't match the id of the embedded Page.
return u.hash.split( dialogHashKey )[0].replace( /^#/, "" );
} else if ( path.isSameDomain( u, document ) ) {
return u.hrefNoHash.replace( document.domain, "" );
}
return absUrl;
},
//get path from current hash, or from a file path
get: function( newPath ) {
if( newPath === undefined ) {
newPath = location.hash;
}
return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, '' );
},
//return the substring of a filepath before the sub-page key, for making a server request
getFilePath: function( path ) {
var splitkey = '&' + $.mobile.subPageUrlKey;
return path && path.split( splitkey )[0].split( dialogHashKey )[0];
},
//set location hash to path
set: function( path ) {
location.hash = path;
},
//test if a given url (string) is a path
//NOTE might be exceptionally naive
isPath: function( url ) {
return ( /\// ).test( url );
},
//return a url path with the window's location protocol/hostname/pathname removed
clean: function( url ) {
return url.replace( document.domain, "" );
},
//just return the url without an initial #
stripHash: function( url ) {
return url.replace( /^#/, "" );
},
//remove the preceding hash, any query params, and dialog notations
cleanHash: function( hash ) {
return path.stripHash( hash.replace( /\?.*$/, "" ).replace( dialogHashKey, "" ) );
},
//check whether a url is referencing the same domain, or an external domain or different protocol
//could be mailto, etc
isExternal: function( url ) {
var u = path.parseUrl( url );
return u.protocol && u.domain !== document.domain ? true : false;
},
hasProtocol: function( url ) {
return ( /^(:?\w+:)/ ).test( url );
}
};
$.path = path;

View File

@ -0,0 +1,324 @@
import $ from 'jQuery';
/**
* Allows icon definition via HTML5 data attrs for easier handling in PHP.
*
* Adds an alternative appearance so we can toggle back and forth between them
* and register event handlers to add custom styling and behaviour. Example use
* is in the CMS with the saving buttons - depending on the page's state one of
* them will either say "Save draft" or "Saved", and will have different colour.
*/
$.widget('ssui.button', $.ui.button, {
options: {
alternate: {
icon: null,
text: null
},
showingAlternate: false
},
/**
* Switch between the alternate appearances.
*/
toggleAlternate: function() {
if (this._trigger('ontogglealternate')===false) return;
// Only switch to alternate if it has been enabled through options.
if (!this.options.alternate.icon && !this.options.alternate.text) return;
this.options.showingAlternate = !this.options.showingAlternate;
this.refresh();
},
/**
* Adjust the appearance to fit with the current settings.
*/
_refreshAlternate: function() {
this._trigger('beforerefreshalternate');
// Only switch to alternate if it has been enabled through options.
if (!this.options.alternate.icon && !this.options.alternate.text) return;
if (this.options.showingAlternate) {
this.element.find('.ui-button-icon-primary').hide();
this.element.find('.ui-button-text').hide();
this.element.find('.ui-button-icon-alternate').show();
this.element.find('.ui-button-text-alternate').show();
}
else {
this.element.find('.ui-button-icon-primary').show();
this.element.find('.ui-button-text').show();
this.element.find('.ui-button-icon-alternate').hide();
this.element.find('.ui-button-text-alternate').hide();
}
this._trigger('afterrefreshalternate');
},
/**
* Construct button - pulls in options from data attributes.
* Injects new elements for alternate appearance (if requested via options).
*/
_resetButton: function() {
var iconPrimary = this.element.data('icon-primary'),
iconSecondary = this.element.data('icon-secondary');
if (!iconPrimary) iconPrimary = this.element.data('icon');
// TODO Move prefix out of this method, without requriing it for every icon definition in a data attr
if(iconPrimary) this.options.icons.primary = 'btn-icon-' + iconPrimary;
if(iconSecondary) this.options.icons.secondary = 'btn-icon-' + iconSecondary;
$.ui.button.prototype._resetButton.call(this);
// Pull options from data attributes. Overriden by explicit options given on widget creation.
if (!this.options.alternate.text) {
this.options.alternate.text = this.element.data('text-alternate');
}
if (!this.options.alternate.icon) {
this.options.alternate.icon = this.element.data('icon-alternate');
}
if (!this.options.showingAlternate) {
this.options.showingAlternate = this.element.hasClass('ss-ui-alternate');
}
// Create missing elements.
if (this.options.alternate.icon) {
this.buttonElement.append(
"<span class='ui-button-icon-alternate ui-button-icon-primary ui-icon btn-icon-"
+ this.options.alternate.icon + "'></span>"
);
}
if (this.options.alternate.text) {
this.buttonElement.append(
"<span class='ui-button-text-alternate ui-button-text'>" + this.options.alternate.text + "</span>"
);
}
this._refreshAlternate();
},
refresh: function() {
$.ui.button.prototype.refresh.call(this);
this._refreshAlternate();
},
destroy: function() {
this.element.find('.ui-button-text-alternate').remove();
this.element.find('.ui-button-icon-alternate').remove();
$.ui.button.prototype.destroy.call( this );
}
});
/**
* Extends jQueryUI dialog with iframe abilities (and related resizing logic),
* and sets some CMS-wide defaults.
*
* Additional settings:
* - 'autoPosition': Automatically reposition window on resize based on 'position' option
* - 'widthRatio': Sets width based on percentage of window (value between 0 and 1)
* - 'heightRatio': Sets width based on percentage of window (value between 0 and 1)
* - 'reloadOnOpen': Reloads the iframe whenever the dialog is reopened
* - 'iframeUrl': Create an iframe element and load this URL when the dialog is created
*/
$.widget("ssui.ssdialog", $.ui.dialog, {
options: {
// Custom properties
iframeUrl: '',
reloadOnOpen: true,
dialogExtraClass: '',
// Defaults
modal: true,
bgiframe: true,
autoOpen: false,
autoPosition: true,
minWidth: 500,
maxWidth: 800,
minHeight: 300,
maxHeight: 700,
widthRatio: 0.8,
heightRatio: 0.8,
resizable: false
},
_create: function() {
$.ui.dialog.prototype._create.call(this);
var self = this;
// Create iframe
var iframe = $('<iframe marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto"></iframe>');
iframe.bind('load', function(e) {
if($(this).attr('src') == 'about:blank') return;
iframe.addClass('loaded').show(); // more reliable than 'src' attr check (in IE)
self._resizeIframe();
self.uiDialog.removeClass('loading');
}).hide();
if(this.options.dialogExtraClass) this.uiDialog.addClass(this.options.dialogExtraClass);
this.element.append(iframe);
// Let the iframe handle its scrolling
if(this.options.iframeUrl) this.element.css('overflow', 'hidden');
},
open: function() {
$.ui.dialog.prototype.open.call(this);
var self = this, iframe = this.element.children('iframe');
// Load iframe
if(this.options.iframeUrl && (!iframe.hasClass('loaded') || this.options.reloadOnOpen)) {
iframe.hide();
iframe.attr('src', this.options.iframeUrl);
this.uiDialog.addClass('loading');
}
// Resize events
$(window).bind('resize.ssdialog', function() {self._resizeIframe();});
},
close: function() {
$.ui.dialog.prototype.close.call(this);
this.uiDialog.unbind('resize.ssdialog');
$(window).unbind('resize.ssdialog');
},
_resizeIframe: function() {
var opts = {}, newWidth, newHeight, iframe = this.element.children('iframe');;
if(this.options.widthRatio) {
newWidth = $(window).width() * this.options.widthRatio;
if(this.options.minWidth && newWidth < this.options.minWidth) {
opts.width = this.options.minWidth
} else if(this.options.maxWidth && newWidth > this.options.maxWidth) {
opts.width = this.options.maxWidth;
} else {
opts.width = newWidth;
}
}
if(this.options.heightRatio) {
newHeight = $(window).height() * this.options.heightRatio;
if(this.options.minHeight && newHeight < this.options.minHeight) {
opts.height = this.options.minHeight
} else if(this.options.maxHeight && newHeight > this.options.maxHeight) {
opts.height = this.options.maxHeight;
} else {
opts.height = newHeight;
}
}
if(!jQuery.isEmptyObject(opts)) {
this._setOptions(opts);
// Resize iframe within dialog
iframe.attr('width',
opts.width
- parseFloat(this.element.css('paddingLeft'))
- parseFloat(this.element.css('paddingRight'))
);
iframe.attr('height',
opts.height
- parseFloat(this.element.css('paddingTop'))
- parseFloat(this.element.css('paddingBottom'))
);
// Enforce new position
if(this.options.autoPosition) {
this._setOption("position", this.options.position);
}
}
}
});
$.widget("ssui.titlebar", {
_create: function() {
this.originalTitle = this.element.attr('title');
var self = this;
var options = this.options;
var title = options.title || this.originalTitle || '&nbsp;';
var titleId = $.ui.dialog.getTitleId(this.element);
this.element.parent().addClass('ui-dialog');
var uiDialogTitlebar = this.element.
addClass(
'ui-dialog-titlebar ' +
'ui-widget-header ' +
'ui-corner-all ' +
'ui-helper-clearfix'
);
// By default, the
if(options.closeButton) {
var uiDialogTitlebarClose = $('<a href="#"/>')
.addClass(
'ui-dialog-titlebar-close ' +
'ui-corner-all'
)
.attr('role', 'button')
.hover(
function() {
uiDialogTitlebarClose.addClass('ui-state-hover');
},
function() {
uiDialogTitlebarClose.removeClass('ui-state-hover');
}
)
.focus(function() {
uiDialogTitlebarClose.addClass('ui-state-focus');
})
.blur(function() {
uiDialogTitlebarClose.removeClass('ui-state-focus');
})
.mousedown(function(ev) {
ev.stopPropagation();
})
.appendTo(uiDialogTitlebar);
var uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
.addClass(
'ui-icon ' +
'ui-icon-closethick'
)
.text(options.closeText)
.appendTo(uiDialogTitlebarClose);
}
var uiDialogTitle = $('<span/>')
.addClass('ui-dialog-title')
.attr('id', titleId)
.html(title)
.prependTo(uiDialogTitlebar);
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
},
destroy: function() {
this.element
.unbind('.dialog')
.removeData('dialog')
.removeClass('ui-dialog-content ui-widget-content')
.hide().appendTo('body');
(this.originalTitle && this.element.attr('title', this.originalTitle));
}
});
$.extend($.ssui.titlebar, {
version: "0.0.1",
options: {
title: '',
closeButton: false,
closeText: 'close'
},
uuid: 0,
getTitleId: function($el) {
return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
}
});

View File

@ -13,13 +13,17 @@
SelectParser = (function() {
SelectParser.name = 'SelectParser';
// Origional - You can't assign to functions like this in strict mode.
//SelectParser.name = 'SelectParser';
function SelectParser() {
this.options_index = 0;
this.parsed = [];
}
// SilverStripe custom
SelectParser.prototype.name = 'SelectParser';
SelectParser.prototype.add_node = function(child) {
if (child.nodeName.toUpperCase() === "OPTGROUP") {
return this.add_group(child);
@ -94,7 +98,11 @@
this.SelectParser = SelectParser;
}).call(this);
// Origional - 'this' !== 'window' in browserify
//}).call(this);
// SilverStripe custom
}).call(window);
/*
Chosen source: generate output using 'cake build'
@ -109,7 +117,8 @@ Copyright (c) 2011 by Harvest
AbstractChosen = (function() {
AbstractChosen.name = 'AbstractChosen';
// Origional - You can't assign to functions like this in strict mode.
//AbstractChosen.name = 'AbstractChosen';
function AbstractChosen(form_field, options) {
this.form_field = form_field;
@ -123,6 +132,9 @@ Copyright (c) 2011 by Harvest
this.finish_setup();
}
// SilverStripe custom
AbstractChosen.prototype.name = 'AbstractChosen';
AbstractChosen.prototype.set_default_values = function() {
var _this = this;
this.click_test_action = function(evt) {
@ -296,7 +308,11 @@ Copyright (c) 2011 by Harvest
root.AbstractChosen = AbstractChosen;
}).call(this);
// Origional - 'this' !== 'window' in browserify
//}).call(this);
// SilverStripe custom
}).call(window);
/*
Chosen source: generate output using 'cake build'
@ -332,12 +348,16 @@ Copyright (c) 2011 by Harvest
__extends(Chosen, _super);
Chosen.name = 'Chosen';
// Origional - You can't assign to functions like this in strict mode.
//Chosen.name = 'Chosen';
function Chosen() {
return Chosen.__super__.constructor.apply(this, arguments);
}
// SilverStripe custom
Chosen.prototype.name = 'Chosen';
Chosen.prototype.setup = function() {
this.form_field_jq = $(this.form_field);
this.current_value = this.form_field_jq.val();
@ -1121,4 +1141,8 @@ Copyright (c) 2011 by Harvest
root.get_side_border_padding = get_side_border_padding;
}).call(this);
// Origional - 'this' !== 'window' in browserify
//}).call(this);
// SilverStripe custom
}).call(window);

View File

@ -7,7 +7,14 @@
*/
/*global jLayout:true */
(function () {
jLayout = (typeof jLayout === 'undefined') ? {} : jLayout;
// Customised
// Defining global alias because Browserify adds 'use strict'
// which throws a runtime error if globals are undefined and not declared.
// Original
// jLayout = (typeof jLayout === 'undefined') ? {} : jLayout;
window.jLayout = (typeof window.jLayout === 'undefined') ? {} : window.jLayout;
jLayout.border = function (spec) {
var my = {},
@ -58,34 +65,34 @@
tmp = north.preferredSize();
north.bounds({'x': left, 'y': top, 'width': right - left, 'height': tmp.height});
north.doLayout();
top += tmp.height + my.vgap;
}
if (south && south.isVisible()) {
tmp = south.preferredSize();
south.bounds({'x': left, 'y': bottom - tmp.height, 'width': right - left, 'height': tmp.height});
south.doLayout();
bottom -= tmp.height + my.vgap;
}
if (east && east.isVisible()) {
tmp = east.preferredSize();
east.bounds({'x': right - tmp.width, 'y': top, 'width': tmp.width, 'height': bottom - top});
east.doLayout();
right -= tmp.width + my.hgap;
}
if (west && west.isVisible()) {
tmp = west.preferredSize();
west.bounds({'x': left, 'y': top, 'width': tmp.width, 'height': bottom - top});
west.doLayout();
left += tmp.width + my.hgap;
}
if (center && center.isVisible()) {
center.bounds({'x': left, 'y': top, 'width': right - left, 'height': bottom - top});
center.doLayout();
}
}
return container;
};

View File

@ -6,6 +6,13 @@
* All rights reserved.
*/
/*global jQuery jLayout*/
// Customised
// Defining global alias because Browserify adds 'use strict'
// which throws a runtime error if globals are undefined and not declared.
var jQuery = window.jQuery,
jLayout = window.jLayout;
if (jQuery && jLayout) {
(function ($) {
/**

View File

@ -77,7 +77,7 @@ to the `LeftAndMain.extra_requirements_javascript` [configuration value](../conf
- mysite/javascript/MyLeftAndMain.Preview.js
In order to find out which configuration values are available, the source code
is your best reference at the moment - have a look in `framework/admin/javascript/LeftAndMain.Preview.js`.
is your best reference at the moment - have a look in `framework/admin/javascript/src/LeftAndMain.Preview.js`.
To understand how layouts are handled in the CMS UI, have a look at the
[CMS Architecture](cms_architecture) guide.

View File

@ -174,8 +174,8 @@ Due to the procedural and selector-driven style of UI programming in jQuery.entw
it can be difficult to find the piece of code responsible for a certain behaviour.
Therefore it is important to adhere to file naming conventions.
E.g. a feature only applicable to `ModelAdmin` should be placed in
`framework/admin/javascript/ModelAdmin.js`, while something modifying all forms (including ModelAdmin forms)
would be better suited in `framework/admin/javascript/LeftAndMain.EditForm.js`.
`framework/admin/javascript/src/ModelAdmin.js`, while something modifying all forms (including ModelAdmin forms)
would be better suited in `framework/admin/javascript/src/LeftAndMain.EditForm.js`.
Selectors used in these files should mirrow the "scope" set by its filename,
so don't place a rule applying to all form buttons inside `ModelAdmin.js`.
@ -431,7 +431,7 @@ Note: You can see any additional HTTP headers through the web developer tools in
The CMS tree for viewing hierarchical structures (mostly pages) is powered
by the [jstree](http://jstree.com) library. It is configured through
`framework/admin/javascript/LeftAndMain.Tree.js`, as well as some
`framework/admin/javascript/src/LeftAndMain.Tree.js`, as well as some
HTML5 metadata generated on its container (see the `data-hints` attribute).
For more information, see the [Howto: Customise the CMS tree](/developer_guides/customising_the_admin_interface/how_tos/customise_cms_tree).

View File

@ -4,7 +4,7 @@
The CMS tree for viewing hierarchical structures (mostly pages) is powered
by the [jstree](http://jstree.com) library. It is configured through
`framework/admin/javascript/LeftAndMain.Tree.js`, as well as some
`framework/admin/javascript/src/LeftAndMain.Tree.js`, as well as some
HTML5 metadata generated on its container (see the `data-hints` attribute).
The tree is rendered through `[api:LeftAndMain->getSiteTreeFor()]`,

View File

@ -39,6 +39,15 @@
of linked assets and file protection.
* `ProtectedFileController` class is used to serve up protected assets.
### Front-end build tooling
* Dependency management via [npm](https://www.npmjs.com/)
* ES6 is now available in all core JavaScript files via [Babel](https://babeljs.io/)
* Front-end JavaScript bundling via [Browserify](http://browserify.org/)
* Build tasks managed by [Gulp](http://gulpjs.com/)
For more details see the docs on [working with client-side dependencies](../contributing/code#working-with-client-side-dependencies)
## Deprecated classes/methods
### ORM
@ -513,3 +522,10 @@ Where previously you could specify a list of grouped values in the same way as `
method now only accepts either a non-associative array of values (not titles) or an `SS_List`
of items to disable.
### Upgrading Requirements file paths
`Requirements` now throws an exception then a file is not found, rather than failing silently, so check your `Requirements` are pointing to files that exist.
Core JavaScript files paths have changed, so if you're referencing these, you'll have to update your file paths. Files previously in `admin/javascript` are now located in `admin/javascript/dist` and files previously located in `javascript` are now locatied in `javascript/dist`.
If you're not doing this already, we suggest looking into a JavaScript bundler like [Browserify](http://browserify.org/), to combine JavaScript files. SilverStripe core is moving away from `Requirements::combine_files` in favour of Browserify as of 4.0 and `Requirements::combine_files` is being considered for deprecation in future versions.

View File

@ -278,7 +278,7 @@ The [Node.js](https://nodejs.org) JavaScript runtime is the foundation of our cl
The configuration for an npm package goes in `package.json`. You'll see one in the root directory of `framework`. As well as being used for defining dependencies and basic package information, the `package.json` file has some handy scripts.
```
$ npm run build
$ npm run thirdparty
```
This script copies JavaScript files from the `node_modules` directory into the `thirdparty` directory. The `node_modules` directory is not part of source control, so you'll need to run this command if you have upgraded, or added a module.
@ -295,6 +295,104 @@ Of course to run these scripts, you'll need to get the dependencies, so run a `n
[Gulp](http://gulpjs.com/) is the build system which gets invoked when you run npm scripts in SilverStripe. All npm scripts have a corresponding Gulp task which you can find in `gulpfile.js`.
## Working with core JavaScript
Core JavaScript is managed by the same build tool chain as [client-side dependencies](#working-with-client-side-dependencies). Source file are located `javascript/src` directories, these are the files you should edit. Source files are input for the build tooling, which outputs distributions files, located in `javascript/dist` directories.
There are two parts of the build tooling which are important to understand when working with core JavaScript files.
### Babel
[Babel](https://babeljs.io/) is a JavaScript compiler. It takes JavaScript files as input, performs some transformations, and outputs JavaScript files. In SilverStripe we use Babel to transform our JavaScript in two ways.
#### Transforming ES6
ECMAScript 6 (ES6) is the newest version of the ECMAScript standard. It has some great new features, but the browser support is still patchy, so we use Babel to transform ES6 source files back to ES5 files for distribution.
To see some of the new features check out [https://github.com/lukehoban/es6features](https://github.com/lukehoban/es6features)
#### Transforming to UMD
[Universal Module Definition](https://github.com/umdjs/umd) (UMD) is a pattern for writing JavaScript modules. The advantage of UMD is modules can be 'required' by module loaders (AMD and ES6 / CommonJS) and can also be loaded via `<script>` tags. Here's a simple example.
```js
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jQuery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
module.exports = factory(require('jQuery'));
} else {
// Default browser with no bundling (global is window)
global.MyModule = factory(global.jQuery);
}
}(this, function (jQuery) {
// Module code here
}));
```
The UMD wrapper is generated by Babel so you'll never have to write it manually, all you have to do is `npm run umd`.
### Browserify bundles
One of the great new features of ES6 is [support for native modules](https://github.com/lukehoban/es6features#modules). In order to support modules, SilverStripe uses [Browserify](https://github.com/substack/node-browserify) to bundle modules for distribution.
Browserify takes in entry file, creates an abstract syntax tree (AST) by recursively looking up all the `require` statements it finds, and outputs a bundled JavaScript file which can be executed in a browser.
In addition to being a concatinated JavaScript file, Browserify bundles contain a lightweight `require()` implementation, and an API wrapper which allow modules to require each other. In most cases modules will require other modules from the same bundle. But it's also possible for bundled modules to require modules from other, external bundles.
In this example the `BetterField` module requires `jQuery` from another bundle.
__gulpfile.js__
```js
gulp.task('bundle-a', function () {
return browserify()
.transform(babelify.configure({
presets: ['es2015'] // Transform ES6 to ES5.
}))
.require('jQuery', { expose: 'jQuery' }) // Make jQuery available to other bundles.
.bundle()
.pipe(source('bundle-a.js'))
.pipe(gulp.dest('./dist'));
});
```
This generates a bundle which includes jQuery and makes it available to other bundles.
__better-field.js__
```js
import $ from 'jQuery';
$('.better-field').fadeIn();
```
__gulpfile.js__
```js
...
gulp.task('bundle-better-field', function () {
return browserify('./src/better-field.js')
.transform(babelify.configure({
presets: ['es2015'] // Transform ES6 to ES5.
}))
.external('jQuery') // Get jQuery from another bundle.
.bundle()
.pipe(source('bundle-b.js'))
.pipe(gulp.dest('./dist'));
});
```
When Browserify bundles `./src/better-field.js` (the entry file) it will ignore all require statement that refer to 'jQuery' as assume it will be available via another bundle at runtime.
To transform and bundle core JavaScript `npm run build`. This will also watch for changes to source files and re-build automatically.
For debugging you can generate a 'development' bundle which includes source maps with `npm run build --development`. Note this is for local development only and shouldn't be pushed up with a pull request.
## Some gotchas
Be careful not to commit any of your configuration files, logs, or throwaway test files to your GitHub repo. These files can contain information you wouldn't want publicly viewable and they will make it impossible to merge your contributions into the main development trunk.

View File

@ -491,7 +491,7 @@ class AssetField extends FileField {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js');
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
Requirements::combine_files('uploadfield.js', array(
@ -502,9 +502,9 @@ class AssetField extends FileField {
THIRDPARTY_DIR . '/jquery-fileupload/cors/jquery.xdr-transport.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload-ui.js',
FRAMEWORK_DIR . '/javascript/UploadField_uploadtemplate.js',
FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js',
FRAMEWORK_DIR . '/javascript/UploadField.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField_uploadtemplate.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField_downloadtemplate.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField.js',
));
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); // TODO hmmm, remove it?
Requirements::css(FRAMEWORK_DIR . '/css/UploadField.css');

View File

@ -124,7 +124,7 @@ class ConfirmedPasswordField extends FormField {
*/
public function Field($properties = array()) {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/ConfirmedPasswordField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/ConfirmedPasswordField.js');
Requirements::css(FRAMEWORK_DIR . '/css/ConfirmedPasswordField.css');
$content = '';

View File

@ -581,7 +581,7 @@ class DateField_View_JQuery extends Object {
Requirements::javascript($this->jqueryLocaleFile);
}
Requirements::javascript(FRAMEWORK_DIR . "/javascript/DateField.js");
Requirements::javascript(FRAMEWORK_DIR . "/javascript/dist/DateField.js");
}
return $html;

View File

@ -152,10 +152,10 @@ class HtmlEditorField_Toolbar extends RequestHandler {
Requirements::javascript(FRAMEWORK_DIR . "/thirdparty/jquery/jquery.js");
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js');
HtmlEditorConfig::require_js();
Requirements::javascript(FRAMEWORK_DIR ."/javascript/HtmlEditorField.js");
Requirements::javascript(FRAMEWORK_DIR ."/javascript/dist/HtmlEditorField.js");
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');

View File

@ -3,7 +3,7 @@
* Render a button that will submit the form its contained in through ajax.
* If you want to add custom behaviour, please set {@link includeDefaultJS()} to FALSE
*
* @see framework/javascript/InlineFormAction.js
* @see framework/javascript/dist/InlineFormAction.js
*
* @package forms
* @subpackage actions
@ -33,7 +33,7 @@ class InlineFormAction extends FormField {
*/
public function Field($properties = array()) {
if($this->includeDefaultJS) {
Requirements::javascriptTemplate(FRAMEWORK_DIR . '/javascript/InlineFormAction.js',
Requirements::javascriptTemplate(FRAMEWORK_DIR . '/javascript/dist/InlineFormAction.js',
array('ID'=>$this->id()));
}
@ -54,7 +54,7 @@ class InlineFormAction extends FormField {
}
/**
* Optionally disable the default javascript include (framework/javascript/InlineFormAction.js),
* Optionally disable the default javascript include (framework/javascript/dist/InlineFormAction.js),
* which routes to an "admin-custom"-URL.
*
* @param $bool boolean

View File

@ -16,7 +16,7 @@ class MemberDatetimeOptionsetField extends OptionsetField {
private static $preview_date = '25-12-2011 17:30:00';
public function Field($properties = array()) {
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/MemberDatetimeOptionsetField.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/MemberDatetimeOptionsetField.js');
$options = array();
$odd = false;

View File

@ -111,7 +111,7 @@ class SelectionGroup extends CompositeField {
public function FieldHolder($properties = array()) {
Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/SelectionGroup.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/SelectionGroup.js');
Requirements::css(FRAMEWORK_DIR . '/css/SelectionGroup.css');
$obj = $properties ? $this->customise($properties) : $this;

View File

@ -76,7 +76,7 @@ class TabSet extends CompositeField {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/TabSet.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/TabSet.js');
$obj = $properties ? $this->customise($properties) : $this;

View File

@ -38,7 +38,7 @@ class ToggleCompositeField extends CompositeField {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/ToggleCompositeField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/ToggleCompositeField.js');
Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');

View File

@ -212,7 +212,7 @@ class TreeDropdownField extends FormField {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jstree/jquery.jstree.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/TreeDropdownField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/TreeDropdownField.js');
Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');

View File

@ -94,7 +94,7 @@ class TreeMultiselectField extends TreeDropdownField {
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jstree/jquery.jstree.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/TreeDropdownField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/TreeDropdownField.js');
Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');

View File

@ -927,7 +927,7 @@ class UploadField extends FileField {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/dist/ssui.core.js');
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
Requirements::combine_files('uploadfield.js', array(
@ -938,9 +938,9 @@ class UploadField extends FileField {
THIRDPARTY_DIR . '/jquery-fileupload/cors/jquery.xdr-transport.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload.js',
THIRDPARTY_DIR . '/jquery-fileupload/jquery.fileupload-ui.js',
FRAMEWORK_DIR . '/javascript/UploadField_uploadtemplate.js',
FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js',
FRAMEWORK_DIR . '/javascript/UploadField.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField_uploadtemplate.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField_downloadtemplate.js',
FRAMEWORK_DIR . '/javascript/dist/UploadField.js',
));
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css'); // TODO hmmm, remove it?
Requirements::css(FRAMEWORK_DIR . '/css/UploadField.css');

View File

@ -293,10 +293,10 @@ class GridField extends FormField {
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/json-js/json2.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/i18n.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/i18n.js');
Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/GridField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/GridField.js');
$columns = $this->getColumns();

View File

@ -1,43 +1,65 @@
var gulp = require('gulp'),
babel = require('gulp-babel'),
diff = require('gulp-diff'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify');
gulpUtil = require('gulp-util'),
browserify = require('browserify'),
babelify = require('babelify'),
watchify = require('watchify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
path = require('path'),
glob = require('glob'),
eventStream = require('event-stream'),
semver = require('semver'),
packageJson = require('./package.json');
var paths = {
modules: './node_modules/',
frameworkThirdparty: './thirdparty/',
adminThirdparty: './admin/thirdparty/'
var PATHS = {
MODULES: './node_modules',
ADMIN_THIRDPARTY: './admin/thirdparty',
ADMIN_JAVASCRIPT_SRC: './admin/javascript/src',
ADMIN_JAVASCRIPT_DIST: './admin/javascript/dist',
FRAMEWORK_THIRDPARTY: './thirdparty',
FRAMEWORK_JAVASCRIPT_SRC: './javascript/src',
FRAMEWORK_JAVASCRIPT_DIST: './javascript/dist'
};
var browserifyOptions = {
cache: {},
packageCache: {},
poll: true,
plugin: [watchify]
};
var blueimpFileUploadConfig = {
src: paths.modules + 'blueimp-file-upload/',
dest: paths.frameworkThirdparty + 'jquery-fileupload/',
src: PATHS.MODULES + '/blueimp-file-upload',
dest: PATHS.FRAMEWORK_THIRDPARTY + '/jquery-fileupload',
files: [
'cors/jquery.postmessage-transport.js',
'cors/jquery.xdr-transport.js',
'jquery.fileupload-ui.js',
'jquery.fileupload.js',
'jquery.iframe-transport.js'
'/cors/jquery.postmessage-transport.js',
'/cors/jquery.xdr-transport.js',
'/jquery.fileupload-ui.js',
'/jquery.fileupload.js',
'/jquery.iframe-transport.js'
]
};
var blueimpLoadImageConfig = {
src: paths.modules + 'blueimp-load-image/',
dest: paths.frameworkThirdparty + 'javascript-loadimage/',
files: ['load-image.js']
src: PATHS.MODULES + '/blueimp-load-image',
dest: PATHS.FRAMEWORK_THIRDPARTY + '/javascript-loadimage',
files: ['/load-image.js']
};
var blueimpTmplConfig = {
src: paths.modules + 'blueimp-tmpl/',
dest: paths.frameworkThirdparty + 'javascript-templates/',
files: ['tmpl.js']
src: PATHS.MODULES + '/blueimp-tmpl',
dest: PATHS.FRAMEWORK_THIRDPARTY + '/javascript-templates',
files: ['/tmpl.js']
};
var jquerySizesConfig = {
src: paths.modules + 'jquery-sizes/',
dest: paths.adminThirdparty + 'jsizes/',
files: ['lib/jquery.sizes.js']
src: PATHS.MODULES + '/jquery-sizes',
dest: PATHS.ADMIN_THIRDPARTY + '/jsizes',
files: ['/lib/jquery.sizes.js']
};
/**
@ -79,17 +101,92 @@ function diffFiles(libConfig) {
});
}
/**
* Transforms the passed JavaScript files to UMD modules.
*
* @param array files - The files to transform.
* @param string dest - The output directory.
* @return object
*/
function transformToUmd(files, dest) {
return eventStream.merge(files.map(function (file) {
return gulp.src(file)
.pipe(babel({
presets: ['es2015'],
moduleId: 'ss.' + path.parse(file).name,
plugins: ['transform-es2015-modules-umd']
}))
.on('error', notify.onError({
message: 'Error: <%= error.message %>',
}))
.pipe(gulp.dest(dest));
}));
}
// Make sure the version of Node being used is valid.
if (!semver.satisfies(process.versions.node, packageJson.engines.node)) {
console.error('Invalid Node.js version. You need to be using ' + packageJson.engines.node + '. If you want to manage multiple Node.js versions try https://github.com/creationix/nvm');
process.exit(1);
}
gulp.task('build', function () {
copyFiles(blueimpFileUploadConfig);
copyFiles(blueimpLoadImageConfig);
copyFiles(blueimpTmplConfig);
copyFiles(jquerySizesConfig);
if (process.env.npm_config_development) {
browserifyOptions.debug = true;
}
gulp.task('build', ['umd', 'umd-watch', 'bundle']);
gulp.task('bundle', ['bundle-lib', 'bundle-leftandmain']);
gulp.task('bundle-leftandmain', function bundleLeftAndMain() {
var stream = browserify(Object.assign({}, browserifyOptions, {
entries: PATHS.ADMIN_JAVASCRIPT_SRC + '/bundles/leftandmain.js'
}))
.transform(babelify.configure({
presets: ['es2015'],
ignore: /(thirdparty)/
}))
.on('log', function (msg) { gulpUtil.log('Finished bundle-leftandmain.js ' + msg); })
.on('update', bundleLeftAndMain)
.external('jQuery')
.external('i18n')
.bundle()
.on('error', notify.onError({
message: 'Error: <%= error.message %>',
}))
.pipe(source('bundle-leftandmain.js'))
.pipe(buffer());
if (typeof process.env.npm_config_development === 'undefined') {
stream.pipe(uglify());
}
return stream.pipe(gulp.dest(PATHS.ADMIN_JAVASCRIPT_DIST));
});
gulp.task('bundle-lib', function bundleLib() {
var stream = browserify(Object.assign({}, browserifyOptions, {
entries: PATHS.ADMIN_JAVASCRIPT_SRC + '/bundles/lib.js'
}))
.transform(babelify.configure({
presets: ['es2015'],
ignore: /(thirdparty)/
}))
.on('log', function (msg) { gulpUtil.log('Finished bundle-lib.js ' + msg); })
.on('update', bundleLib)
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/jQuery.js', { expose: 'jQuery' })
.require(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/i18n.js', { expose: 'i18n' })
.bundle()
.on('error', notify.onError({
message: 'Error: <%= error.message %>',
}))
.pipe(source('bundle-lib.js'))
.pipe(buffer());
if (typeof process.env.npm_config_development === 'undefined') {
stream.pipe(uglify());
}
return stream.pipe(gulp.dest(PATHS.ADMIN_JAVASCRIPT_DIST));
});
gulp.task('sanity', function () {
@ -98,3 +195,27 @@ gulp.task('sanity', function () {
diffFiles(blueimpTmplConfig);
diffFiles(jquerySizesConfig);
});
gulp.task('thirdparty', function () {
copyFiles(blueimpFileUploadConfig);
copyFiles(blueimpLoadImageConfig);
copyFiles(blueimpTmplConfig);
copyFiles(jquerySizesConfig);
});
gulp.task('umd', ['umd-admin', 'umd-framework']);
gulp.task('umd-admin', function () {
var files = glob.sync(PATHS.ADMIN_JAVASCRIPT_SRC + '/*.js', { ignore: PATHS.ADMIN_JAVASCRIPT_SRC + '/LeftAndMain.!(Ping).js' });
return transformToUmd(files, PATHS.ADMIN_JAVASCRIPT_DIST);
});
gulp.task('umd-framework', function () {
return transformToUmd(glob.sync(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/*.js'), PATHS.FRAMEWORK_JAVASCRIPT_DIST);
});
gulp.task('umd-watch', function () {
gulp.watch(PATHS.ADMIN_JAVASCRIPT_SRC + '/*.js', ['umd-admin']);
gulp.watch(PATHS.FRAMEWORK_JAVASCRIPT_SRC + '/*.js', ['umd-framework']);
});

View File

@ -24,7 +24,7 @@ require_once 'i18nSSLegacyAdapter.php';
* <%t MyNamespace.MYENTITY 'Counting {count} things' count=$ThingsCount %>
* </code>
*
* Javascript (see framework/javascript/i18n.js):
* Javascript (see framework/javascript/dist/i18n.js):
* <code>
* ss.i18n._t('MyEntity.MyNamespace','My default natural language value');
* </code>
@ -127,7 +127,7 @@ class i18n extends Object implements TemplateGlobalProvider, Flushable {
/**
* Use javascript i18n through the ss.i18n class (enabled by default).
* If set to TRUE, includes javascript requirements for the base library
* (framework/javascript/i18n.js) and all necessary lang files (e.g. framework/lang/de_DE.js)
* (framework/javascript/dist/i18n.js) and all necessary lang files (e.g. framework/lang/de_DE.js)
* plus fallbacks to the default locale (e.g. framework/lang/en_US.js).
* If set to FALSE, only includes a stub implementation
* which is necessary. Mainly disabled to save bandwidth

View File

@ -1,29 +0,0 @@
(function($){
$.entwine('ss', function($){
$('.ss-toggle').entwine({
onadd: function() {
this._super();
this.accordion({
heightStyle: "content",
collapsible: true,
active: (this.hasClass("ss-toggle-start-closed")) ? false : 0
});
},
onremove: function() {
if (this.data('accordion')) this.accordion('destroy');
this._super();
},
getTabSet: function() {
return this.closest(".ss-tabset");
},
fromTabSet: {
ontabsshow: function() {
this.accordion("resize");
}
}
});
});
})(jQuery);

View File

@ -1,446 +0,0 @@
(function($) {
$.entwine('ss', function($){
/**
* On resize of any close the open treedropdownfields
* as we'll need to redo with widths
*/
var windowWidth, windowHeight;
$(window).bind('resize.treedropdownfield', function() {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
var cb = function() {$('.TreeDropdownField').closePanel();};
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
var strings = {
'openlink': ss.i18n._t('TreeDropdownField.OpenLink'),
'fieldTitle': '(' + ss.i18n._t('TreeDropdownField.FieldTitle') + ')',
'searchFieldTitle': '(' + ss.i18n._t('TreeDropdownField.SearchFieldTitle') + ')'
};
var _clickTestFn = function(e) {
// If the click target is not a child of the current field, close the panel automatically.
if(!$(e.target).parents('.TreeDropdownField').length) $('.TreeDropdownField').closePanel();
};
/**
* @todo Error display
* @todo No results display for search
* @todo Automatic expansion of ajax children when multiselect is triggered
* @todo Automatic panel positioning based on available space (top/bottom)
* @todo forceValue
* @todo Automatic width
* @todo Expand title height to fit all elements
*/
$('.TreeDropdownField').entwine({
// XMLHttpRequest
CurrentXhr: null,
onadd: function() {
this.append(
'<span class="treedropdownfield-title"></span>' +
'<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' +
'<div class="treedropdownfield-panel"><div class="tree-holder"></div></div>'
);
var linkTitle = strings.openLink;
if(linkTitle) this.find("treedropdownfield-toggle-panel-link a").attr('title', linkTitle);
if(this.data('title')) this.setTitle(this.data('title'));
this.getPanel().hide();
this._super();
},
getPanel: function() {
return this.find('.treedropdownfield-panel');
},
openPanel: function() {
// close all other panels
$('.TreeDropdownField').closePanel();
// Listen for clicks outside of the field to auto-close it
$('body').bind('click', _clickTestFn);
var panel = this.getPanel(), tree = this.find('.tree-holder');
panel.css('width', this.width());
panel.show();
// swap the down arrow with an up arrow
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.addClass('treedropdownfield-open-tree');
this.addClass("treedropdownfield-open-tree");
toggle.find("a")
.removeClass('ui-icon-triangle-1-s')
.addClass('ui-icon-triangle-1-n');
if(tree.is(':empty') && !panel.hasClass('loading')) {
this.loadTree(null, this._riseUp);
} else {
this._riseUp();
}
this.trigger('panelshow');
},
_riseUp: function() {
var container = this,
dropdown = this.getPanel(),
toggle = this.find(".treedropdownfield-toggle-panel-link"),
offsetTop = toggle.innerHeight(),
elHeight,
elPos,
endOfWindow;
if (toggle.length > 0) {
endOfWindow = ($(window).height() + $(document).scrollTop()) - toggle.innerHeight();
elPos = toggle.offset().top;
elHeight = dropdown.innerHeight();
// If the dropdown is too close to the bottom of the page, position it above the 'trigger'
if (elPos + elHeight > endOfWindow && elPos - elHeight > 0) {
container.addClass('treedropdownfield-with-rise');
offsetTop = -dropdown.outerHeight();
} else {
container.removeClass('treedropdownfield-with-rise');
}
}
dropdown.css({"top": offsetTop + "px"});
},
closePanel: function() {
jQuery('body').unbind('click', _clickTestFn);
// swap the up arrow with a down arrow
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.removeClass('treedropdownfield-open-tree');
this.removeClass('treedropdownfield-open-tree treedropdownfield-with-rise');
toggle.find("a")
.removeClass('ui-icon-triangle-1-n')
.addClass('ui-icon-triangle-1-s');
this.getPanel().hide();
this.trigger('panelhide');
},
togglePanel: function() {
this[this.getPanel().is(':visible') ? 'closePanel' : 'openPanel']();
},
setTitle: function(title) {
title = title || this.data('empty-title') || strings.fieldTitle;
this.find('.treedropdownfield-title').html(title);
this.data('title', title); // separate view from storage (important for search cancellation)
},
getTitle: function() {
return this.find('.treedropdownfield-title').text();
},
/**
* Update title from tree node value
*/
updateTitle: function() {
var self = this, tree = self.find('.tree-holder'), val = this.getValue();
var updateFn = function() {
var val = self.getValue();
if(val) {
var node = tree.find('*[data-id="' + val + '"]'),
title = node.children('a').find("span.jstree_pageicon")?node.children('a').find("span.item").html():null;
if(!title) title=(node.length > 0) ? tree.jstree('get_text', node[0]) : null;
if(title) {
self.setTitle(title);
self.data('title', title);
}
if(node) tree.jstree('select_node', node);
}
else {
self.setTitle(self.data('empty-title'));
self.removeData('title');
}
};
// Load the tree if its not already present
if(!tree.is(':empty') || !val) updateFn();
else this.loadTree({forceValue: val}, updateFn);
},
setValue: function(val) {
this.data('metadata', $.extend(this.data('metadata'), {id: val}));
this.find(':input:hidden').val(val)
// Trigger synthetic event so subscribers can workaround the IE8 problem with 'change' events
// not propagating on hidden inputs. 'change' is still triggered for backwards compatiblity.
.trigger('valueupdated')
.trigger('change');
},
getValue: function() {
return this.find(':input:hidden').val();
},
loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder'),
params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(), xhr;
if(this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function(xhr, status) {
panel.removeClass('loading');
},
success: function(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
treeHolder
.jstree('destroy')
.bind('loaded.jstree', function(e, data) {
var val = self.getValue(), selectNode = treeHolder.find('*[data-id="' + val + '"]'),
currentNode = data.inst.get_selected();
if(val && selectNode != currentNode) data.inst.select_node(selectNode);
firstLoad = false;
if(callback) callback.apply(self);
})
.jstree(self.getTreeConfig())
.bind('select_node.jstree', function(e, data) {
var node = data.rslt.obj, id = $(node).data('id');
if(!firstLoad && self.getValue() == id) {
// Value is already selected, unselect it (for lack of a better UI to do this)
self.data('metadata', null);
self.setTitle(null);
self.setValue(null);
data.inst.deselect_node(node);
} else {
self.data('metadata', $.extend({id: id}, $(node).getMetaData()));
self.setTitle(data.inst.get_text(node));
self.setValue(id);
}
// Avoid auto-closing panel on first load
if(!firstLoad) self.closePanel();
firstLoad=false;
});
self.setCurrentXhr(null);
}
});
this.setCurrentXhr(xhr);
},
getTreeConfig: function() {
var self = this;
return {
'core': {
'html_titles': true,
// 'initially_open': ['record-0'],
'animation': 0
},
'html_data': {
// TODO Hack to avoid ajax load on init, see http://code.google.com/p/jstree/issues/detail?id=911
'data': this.getPanel().find('.tree-holder').html(),
'ajax': {
'url': function(node) {
var url = $.path.parseUrl(self.data('urlTree')).hrefNoSearch;
return url + '/' + ($(node).data("id") ? $(node).data("id") : 0);
},
'data': function(node) {
var query = $.query.load(self.data('urlTree')).keys;
var params = self.getRequestParams();
params = $.extend({}, query, params, {ajax: 1});
return params;
}
}
},
'ui': {
"select_limit" : 1,
'initially_select': [this.getPanel().find('.current').attr('id')]
},
'themes': {
'theme': 'apple'
},
'types' : {
'types' : {
'default': {
'check_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'uncheck_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'select_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'deselect_node': function(node) {
return ( ! node.hasClass('disabled'));
}
}
}
},
'plugins': ['html_data', 'ui', 'themes', 'types']
};
},
/**
* If the field is contained in a form, submit all form parameters by default.
* This is useful to keep state like locale values which are typically
* encoded in hidden fields through the form.
*
* @return {object}
*/
getRequestParams: function() {
return {};
}
});
$('.TreeDropdownField .tree-holder li').entwine({
/**
* Overload to return more data. The same data should be set on initial
* value through PHP as well (see TreeDropdownField->Field()).
*
* @return {object}
*/
getMetaData: function() {
var matches = this.attr('class').match(/class-([^\s]*)/i);
var klass = matches ? matches[1] : '';
return {ClassName: klass};
}
});
$('.TreeDropdownField *').entwine({
getField: function() {
return this.parents('.TreeDropdownField:first');
}
});
$('.TreeDropdownField').entwine({
onclick: function(e) {
this.togglePanel();
return false;
}
});
$('.TreeDropdownField .treedropdownfield-panel').entwine({
onclick: function(e) {
return false;
}
});
$('.TreeDropdownField.searchable').entwine({
onadd: function() {
this._super();
var title = ss.i18n._t('TreeDropdownField.ENTERTOSEARCH');
this.find('.treedropdownfield-panel').prepend(
$('<input type="text" class="search treedropdownfield-search" data-skip-autofocus="true" placeholder="' + title + '" value="" />')
);
},
search: function(str, callback) {
this.openPanel();
this.loadTree({search: str}, callback);
},
cancelSearch: function() {
this.closePanel();
this.loadTree();
}
});
$('.TreeDropdownField.searchable input.search').entwine({
onkeydown: function(e) {
var field = this.getField();
if(e.keyCode == 13) {
// trigger search on ENTER key
field.search(this.val());
return false;
} else if(e.keyCode == 27) {
// cancel search on ESC key
field.cancelSearch();
}
}
});
$('.TreeDropdownField.multiple').entwine({
getTreeConfig: function() {
var cfg = this._super();
cfg.checkbox = {override_ui: true, two_state: true};
cfg.plugins.push('checkbox');
cfg.ui.select_limit = -1;
return cfg;
},
loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(), xhr;
if(this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function(xhr, status) {
panel.removeClass('loading');
},
success: function(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
self.setCurrentXhr(null);
treeHolder
.jstree('destroy')
.bind('loaded.jstree', function(e, data) {
$.each(self.getValue(), function(i, val) {
data.inst.check_node(treeHolder.find('*[data-id=' + val + ']'));
});
firstLoad = false;
if(callback) callback.apply(self);
})
.jstree(self.getTreeConfig())
.bind('uncheck_node.jstree check_node.jstree', function(e, data) {
var nodes = data.inst.get_checked(null, true);
self.setValue($.map(nodes, function(el, i) {
return $(el).data('id');
}));
self.setTitle($.map(nodes, function(el, i) {
return data.inst.get_text(el);
}));
self.data('metadata', $.map(nodes, function(el, i) {
return {id: $(el).data('id'), metadata: $(el).getMetaData()};
}));
});
}
});
this.setCurrentXhr(xhr);
},
getValue: function() {
var val = this._super();
return val.split(/ *, */);
},
setValue: function(val) {
this._super($.isArray(val) ? val.join(',') : val);
},
setTitle: function(title) {
this._super($.isArray(title) ? title.join(', ') : title);
},
updateTitle: function() {
// TODO Not supported due to multiple values/titles yet
}
});
$('.TreeDropdownField input[type=hidden]').entwine({
onadd: function() {
this._super();
this.bind('change.TreeDropdownField', function() {
$(this).getField().updateTitle();
});
},
onremove: function() {
this._super();
this.unbind('.TreeDropdownField');
}
});
});
}(jQuery));

View File

@ -1,566 +0,0 @@
(function($) {
$.widget('blueimpUIX.fileupload', $.blueimpUI.fileupload, {
_initTemplates: function() {
this.options.templateContainer = document.createElement(
this._files.prop('nodeName')
);
this.options.uploadTemplate = window.tmpl(this.options.uploadTemplateName);
this.options.downloadTemplate = window.tmpl(this.options.downloadTemplateName);
},
_enableFileInputButton: function() {
$.blueimpUI.fileupload.prototype._enableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').show();
},
_disableFileInputButton: function() {
$.blueimpUI.fileupload.prototype._disableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').hide();
},
_onAdd: function(e, data) {
// use _onAdd instead of add since we only want it called once for a file set, not for each file
var result = $.blueimpUI.fileupload.prototype._onAdd.call(this, e, data);
var firstNewFile = this._files.find('.ss-uploadfield-item').slice(data.files.length*-1).first();
var top = '+=' + (firstNewFile.position().top - parseInt(firstNewFile.css('marginTop'), 10) || 0 - parseInt(firstNewFile.css('borderTopWidth'), 10) || 0);
firstNewFile.offsetParent().animate({scrollTop: top}, 1000);
/* Compute total size of files */
var fSize = 0;
for(var i = 0; i < data.files.length; i++){
if(typeof data.files[i].size === 'number'){
fSize = fSize + data.files[i].size;
}
}
$('.fileOverview .uploadStatus .details .total').text(data.files.length);
if(typeof fSize === 'number' && fSize > 0){
fSize = this._formatFileSize(fSize);
$('.fileOverview .uploadStatus .details .fileSize').text(fSize);
}
//Fixes case where someone uploads a single erroring file
if(data.files.length == 1 && data.files[0].error !== null){
$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
$('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
}else{
$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.UPLOADINPROGRESS', 'Please wait… upload in progress'));//.show();
$('.ss-uploadfield-item-edit-all').hide();
$('.fileOverview .uploadStatus').addClass("notice").removeClass("good").removeClass("bad");
}
return result;
},
_onDone: function (result, textStatus, jqXHR, options) {
// Mark form as dirty on completion of successful upload
if(this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
$.blueimpUI.fileupload.prototype._onDone.call(this, result, textStatus, jqXHR, options);
},
_onSend: function (e, data) {
//check the array of existing files to see if we are trying to upload a file that already exists
var that = this;
var config = this.options;
if (config.overwriteWarning && config.replaceFile) {
$.get(
config['urlFileExists'],
{'filename': data.files[0].name},
function(response, status, xhr) {
if(response.exists) {
//display the dialogs with the question to overwrite or not
data.context.find('.ss-uploadfield-item-status')
.text(config.errorMessages.overwriteWarning)
.addClass('ui-state-warning-text');
data.context.find('.ss-uploadfield-item-progress').hide();
data.context.find('.ss-uploadfield-item-overwrite').show();
data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function(e){
data.context.find('.ss-uploadfield-item-progress').show();
data.context.find('.ss-uploadfield-item-overwrite').hide();
data.context.find('.ss-uploadfield-item-status')
.removeClass('ui-state-warning-text');
//upload only if the "overwrite" button is clicked
$.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
e.preventDefault(); // Avoid a form submit
return false;
});
} else { //regular file upload
return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
}
);
} else {
return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
},
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
$.blueimpUI.fileupload.prototype._onAlways.call(this, jqXHRorResult, textStatus, jqXHRorError, options);
if(typeof(jqXHRorError) === 'string') {
$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
$('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
} else if (jqXHRorError.status === 200) {
$('.fileOverview .uploadStatus .state').text(ss.i18n._t('AssetUploadField.FILEUPLOADCOMPLETED', 'File upload completed!'));//.hide();
$('.ss-uploadfield-item-edit-all').show();
$('.fileOverview .uploadStatus').addClass("good").removeClass("notice").removeClass("bad");
}
},
_create: function() {
$.blueimpUI.fileupload.prototype._create.call(this);
// Ensures that the visibility of the fileupload dialog is set correctly at initialisation
this._adjustMaxNumberOfFiles(0);
},
attach: function(data) {
if(this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
// Handles attachment of already uploaded files, similar to add
var self = this,
files = data.files,
replaceFileID = data.replaceFileID,
valid = true;
// If replacing an element (and it exists), adjust max number of files at this point
var replacedElement = null;
if(replaceFileID) {
replacedElement = $(".ss-uploadfield-item[data-fileid='"+replaceFileID+"']");
if(replacedElement.length === 0) {
replacedElement = null;
} else {
self._adjustMaxNumberOfFiles(1);
}
}
// Validate each file
$.each(files, function (index, file) {
self._adjustMaxNumberOfFiles(-1);
error = self._validate([file]);
valid = error && valid;
});
data.isAdjusted = true;
data.files.valid = data.isValidated = valid;
// Generate new file HTMl, and either append or replace (if replacing
// an already uploaded file).
data.context = this._renderDownload(files);
if(replacedElement) {
replacedElement.replaceWith(data.context);
} else {
data.context.appendTo(this._files);
}
data.context.data('data', data);
// Force reflow:
this._reflow = this._transition && data.context[0].offsetWidth;
data.context.addClass('in');
}
});
$.entwine('ss', function($) {
$('div.ss-upload').entwine({
Config: null,
onmatch: function() {
if (this.is('.readonly,.disabled')) {
return;
}
var $fileInput = this.find('.ss-uploadfield-fromcomputer-fileinput'),
$dropZone = $('.ss-uploadfield-dropzone'),
config = $fileInput.data('config');
// Drag & drop is opt-in so we have to prevent the default behaviour
// (which is 'do nothing') when the drop zone is dragged over.
$dropZone.on('dragover', function (e) {
e.preventDefault();
});
$dropZone.on('dragenter', function (e) {
$dropZone.addClass('hover active');
});
$dropZone.on('dragleave', function (e) {
if (e.target === $dropZone[0]) {
$dropZone.removeClass('hover active');
}
});
$dropZone.on('drop', function (e) {
$dropZone.removeClass('hover active');
if (e.target !== $dropZone[0]) {
return false;
}
})
this.setConfig(config);
this.fileupload($.extend(true, {
formData: function(form) {
var idVal = $(form).find(':input[name=ID]').val();
var data = [{name: 'SecurityID', value: $(form).find(':input[name=SecurityID]').val()}];
if(idVal) data.push({name: 'ID', value: idVal});
return data;
},
errorMessages: {
// errorMessages for all error codes suggested from the plugin author, some will be overwritten by the config coming from php
1: ss.i18n._t('UploadField.PHP_MAXFILESIZE'),
2: ss.i18n._t('UploadField.HTML_MAXFILESIZE'),
3: ss.i18n._t('UploadField.ONLYPARTIALUPLOADED'),
4: ss.i18n._t('UploadField.NOFILEUPLOADED'),
5: ss.i18n._t('UploadField.NOTMPFOLDER'),
6: ss.i18n._t('UploadField.WRITEFAILED'),
7: ss.i18n._t('UploadField.STOPEDBYEXTENSION'),
maxFileSize: ss.i18n._t('UploadField.TOOLARGESHORT'),
minFileSize: ss.i18n._t('UploadField.TOOSMALL'),
acceptFileTypes: ss.i18n._t('UploadField.INVALIDEXTENSIONSHORT'),
maxNumberOfFiles: ss.i18n._t('UploadField.MAXNUMBEROFFILESSHORT'),
uploadedBytes: ss.i18n._t('UploadField.UPLOADEDBYTES'),
emptyResult: ss.i18n._t('UploadField.EMPTYRESULT')
},
send: function(e, data) {
if (data.context && data.dataType && data.dataType.substr(0, 6) === 'iframe') {
// Iframe Transport does not support progress events.
// In lack of an indeterminate progress bar, we set
// the progress to 100%, showing the full animated bar:
data.total = 1;
data.loaded = 1;
$(this).data('fileupload').options.progress(e, data);
}
},
progress: function(e, data) {
if (data.context) {
var value = parseInt(data.loaded / data.total * 100, 10) + '%';
data.context.find('.ss-uploadfield-item-status').html((data.total == 1)?ss.i18n._t('UploadField.LOADING'):value);
data.context.find('.ss-uploadfield-item-progressbarvalue').css('width', value);
}
}
},
config,
{
fileInput: $fileInput,
dropZone: $dropZone,
form: $fileInput.closest('form'),
previewAsCanvas: false,
acceptFileTypes: new RegExp(config.acceptFileTypes, 'i')
}
));
if (this.data('fileupload')._isXHRUpload({multipart: true})) {
$('.ss-uploadfield-item-uploador').hide().show();
}
this._super();
},
onunmatch: function() {
$('.ss-uploadfield-dropzone').off('dragover dragenter dragleave drop');
this._super();
},
openSelectDialog: function(uploadedFile) {
// Create dialog and load iframe
var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = jQuery('#' + dialogId);
if(!dialog.length) dialog = jQuery('<div class="ss-uploadfield-dialog" id="' + dialogId + '" />');
// If user selected 'Choose another file', we need the ID of the file to replace
var iframeUrl = config['urlSelectDialog'];
var uploadedFileId = null;
if (uploadedFile && uploadedFile.attr('data-fileid') > 0){
uploadedFileId = uploadedFile.attr('data-fileid');
}
// Show dialog
dialog.ssdialog({iframeUrl: iframeUrl, height: 550});
// TODO Allow single-select
dialog.find('iframe').bind('load', function(e) {
var contents = $(this).contents(), gridField = contents.find('.ss-gridfield');
// TODO Fix jQuery custom event bubbling across iframes on same domain
// gridField.find('.ss-gridfield-items')).bind('selectablestop', function() {
// });
// Remove top margin (easier than including new selectors)
contents.find('table.ss-gridfield').css('margin-top', 0);
// Can't use live() in iframes...
contents.find('input[name=action_doAttach]').unbind('click.openSelectDialog').bind('click.openSelectDialog', function() {
// TODO Fix entwine method calls across iframe/document boundaries
var ids = $.map(gridField.find('.ss-gridfield-item.ui-selected'), function(el) {return $(el).data('id');});
if(ids && ids.length) self.attachFiles(ids, uploadedFileId);
dialog.ssdialog('close');
return false;
});
});
dialog.ssdialog('open');
},
attachFiles: function(ids, uploadedFileId) {
var self = this,
config = this.getConfig(),
indicator = $('<div class="loader" />'),
target = (uploadedFileId) ? this.find(".ss-uploadfield-item[data-fileid='"+uploadedFileId+"']") : this.find('.ss-uploadfield-addfile');
target.children().hide();
target.append(indicator);
$.ajax({
type: "POST",
url: config['urlAttach'],
data: {'ids': ids},
complete: function(xhr, status) {
target.children().show();
indicator.remove();
},
success: function(data, status, xhr) {
if (!data || $.isEmptyObject(data)) return;
self.fileupload('attach', {
files: data,
options: self.fileupload('option'),
replaceFileID: uploadedFileId
});
}
});
}
});
$('div.ss-upload *').entwine({
getUploadField: function() {
return this.parents('div.ss-upload:first');
}
});
$('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item').entwine({
onadd: function() {
this._super();
this.closest('.ss-upload').find('.ss-uploadfield-addfile').addClass('borderTop');
},
onremove: function() {
$('.ss-uploadfield-files:not(:has(.ss-uploadfield-item))').closest('.ss-upload').find('.ss-uploadfield-addfile').removeClass('borderTop');
this._super();
}
});
$('div.ss-upload .ss-uploadfield-startall').entwine({
onclick: function(e) {
this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click();
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({
onclick: function(e) {
this.closest('.ss-uploadfield-item').remove();
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-remove:not(.ui-state-disabled), .ss-uploadfield-item-delete:not(.ui-state-disabled)').entwine({
onclick: function(e) {
var field = this.closest('div.ss-upload'),
config = field.getConfig('changeDetection'),
fileupload = field.data('fileupload'),
item = this.closest('.ss-uploadfield-item'), msg = '';
if(this.is('.ss-uploadfield-item-delete')) {
if(confirm(ss.i18n._t('UploadField.ConfirmDelete'))) {
if(config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {
context: item,
url: this.data('href'),
type: 'get',
dataType: fileupload.options.dataType
});
}
}
} else {
// Removed files will be applied to object on save
if(config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {context: item});
}
}
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-edit-all').entwine({
onclick: function(e) {
if($(this).hasClass('opened')){
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon.opened').each(function(i){
$(this).closest('.ss-uploadfield-item-edit').click();
});
$(this).removeClass('opened').find('.toggle-details-icon').removeClass('opened');
}else{
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon').each(function(i){
if(!$(this).hasClass('opened')){
$(this).closest('.ss-uploadfield-item-edit').click();
}
});
$(this).addClass('opened').find('.toggle-details-icon').addClass('opened');
}
e.preventDefault(); // Avoid a form submit
return false;
}
});
$( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
onclick: function(e) {
var self = this,
editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
itemInfo = editform.prev('.ss-uploadfield-item-info'),
iframe = editform.find('iframe');
// Ignore clicks while the iframe is loading
if (iframe.parent().hasClass('loading')) {
e.preventDefault();
return false;
}
if (iframe.attr('src') == 'about:blank') {
// Lazy-load the iframe on editform toggle
iframe.attr('src', iframe.data('src'));
// Add loading class, disable buttons while loading is in progress
// (_prepareIframe() handles re-enabling them when appropriate)
iframe.parent().addClass('loading');
disabled=this.siblings();
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
iframe.on('load', function() {
iframe.parent().removeClass('loading');
// This ensures we only call _prepareIframe() on load once - otherwise it'll
// be superfluously called after clicking 'save' in the editform
if (iframe.data('src')) {
self._prepareIframe(iframe, editform, itemInfo);
iframe.data('src', '');
}
});
} else {
self._prepareIframe(iframe, editform, itemInfo);
}
e.preventDefault(); // Avoid a form submit
return false;
},
_prepareIframe: function(iframe, editform, itemInfo) {
var disabled;
// Mark the row as changed if any of its form fields are edited
iframe.contents().ready(function() {
// Need to use the iframe's own jQuery, as custom event triggers
// (e.g. from TreeDropdownField) can't be captured by the parent jQuery object.
var iframe_jQuery = iframe.get(0).contentWindow.jQuery;
iframe_jQuery(iframe_jQuery.find(':input')).bind('change', function(e){
editform.removeClass('edited');
editform.addClass('edited');
});
});
if (editform.hasClass('loading')) {
// TODO Display loading indication, and register an event to toggle edit form
} else {
if(this.hasClass('ss-uploadfield-item-edit')){
disabled=this.siblings();
}else{
disabled=this.find('ss-uploadfield-item-edit').siblings();
}
editform.parent('.ss-uploadfield-item').removeClass('ui-state-warning');
editform.toggleEditForm();
if (itemInfo.find('.toggle-details-icon').hasClass('opened')) {
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
} else {
disabled.removeClass('ui-state-disabled');
disabled.removeAttr('disabled');
}
}
}
});
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
fitHeight: function() {
var iframe = this.find('iframe'),
contents = iframe.contents().find('body'),
bodyH = contents.find('form').outerHeight(true), // We set the height to match the form's outer height
iframeH = bodyH + (iframe.outerHeight(true) - iframe.height()), // content's height + padding on iframe elem
containerH = iframeH + (this.outerHeight(true) - this.height()); // iframe height + padding on container elem
/* Set height of body except in IE8. Setting this in IE8 breaks the dropdown */
if( ! $.browser.msie && $.browser.version.slice(0,3) != "8.0"){
contents.find('body').css({'height': bodyH});
}
iframe.height(iframeH);
this.animate({height: containerH}, 500);
},
toggleEditForm: function() {
var itemInfo = this.prev('.ss-uploadfield-item-info'), status = itemInfo.find('.ss-uploadfield-item-status');
var iframe = this.find('iframe').contents(),
saved = iframe.find('#Form_EditForm_error');
var text = "";
if(this.height() === 0) {
text = ss.i18n._t('UploadField.Editing', "Editing ...");
this.fitHeight();
this.addClass('opened');
itemInfo.find('.toggle-details-icon').addClass('opened');
status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
iframe.find('#Form_EditForm_action_doEdit').click(function(){
itemInfo.find('label .name').text(iframe.find('#Name input').val());
});
if($('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item-actions .toggle-details-icon:not(.opened)').index() < 0){
$('div.ss-upload .ss-uploadfield-item-edit-all').addClass('opened').find('.toggle-details-icon').addClass('opened');
}
} else {
this.animate({height: 0}, 500);
this.removeClass('opened');
itemInfo.find('.toggle-details-icon').removeClass('opened');
$('div.ss-upload .ss-uploadfield-item-edit-all').removeClass('opened').find('.toggle-details-icon').removeClass('opened');
if(!this.hasClass('edited')){
text = ss.i18n._t('UploadField.NOCHANGES', 'No Changes');
status.addClass('ui-state-success-text');
}else{
if(saved.hasClass('good')){
text = ss.i18n._t('UploadField.CHANGESSAVED', 'Changes Saved');
this.removeClass('edited').parent('.ss-uploadfield-item').removeClass('ui-state-warning');
status.addClass('ui-state-success-text');
}else{
text = ss.i18n._t('UploadField.UNSAVEDCHANGES', 'Unsaved Changes');
this.parent('.ss-uploadfield-item').addClass('ui-state-warning');
status.addClass('ui-state-warning-text');
}
}
saved.removeClass('good').hide();
}
status.attr('title',text).text(text);
}
});
$('div.ss-upload .ss-uploadfield-fromfiles').entwine({
onclick: function(e) {
this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item'));
e.preventDefault(); // Avoid a form submit
return false;
}
});
});
}(jQuery));

View File

@ -1,21 +0,0 @@
(function($) {
$.entwine('ss', function($) {
// Install the directory selection handler
$('form.uploadfield-form .TreeDropdownField').entwine({
onmatch: function() {
this._super();
var self = this;
this.bind('change', function() {
// Display the contents of the folder in the listing field.
var fileList = self.closest('form').find('.ss-gridfield');
fileList.setState('ParentID', self.getValue());
fileList.reload();
});
},
onunmatch: function() {
this._super();
}
});
});
})(jQuery);

48
javascript/dist/AssetUploadField.js vendored Normal file
View File

@ -0,0 +1,48 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.AssetUploadField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssAssetUploadField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
(0, _jQuery2.default)('.ss-assetuploadfield').entwine({
onmatch: function onmatch() {
this._super();
this.find('.ss-uploadfield-editandorganize').hide();
},
onunmatch: function onunmatch() {
this._super();
},
onfileuploadadd: function onfileuploadadd(e) {
this.find('.ss-uploadfield-editandorganize').show();
},
onfileuploadstart: function onfileuploadstart(e) {
this.find('.ss-uploadfield-editandorganize').show();
}
});
(0, _jQuery2.default)('.ss-uploadfield-view-allowed-extensions .toggle').entwine({
onclick: function onclick(e) {
var allowedExt = this.closest('.ss-uploadfield-view-allowed-extensions'),
minHeightVal = this.closest('.ui-tabs-panel').height() + 20;
allowedExt.toggleClass('active');
allowedExt.find('.toggle-content').css('minHeight', minHeightVal);
}
});
});

View File

@ -0,0 +1,31 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.ConfirmedPasswordField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssConfirmedPasswordField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
(0, _jQuery2.default)(document).on('click', '.confirmedpassword .showOnClick a', function () {
var $container = (0, _jQuery2.default)('.showOnClickContainer', (0, _jQuery2.default)(this).parent());
$container.toggle('fast', function () {
$container.find('input[type="hidden"]').val($container.is(":visible") ? 1 : 0);
});
return false;
});
});

54
javascript/dist/DateField.js vendored Normal file
View File

@ -0,0 +1,54 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.DateField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssDateField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.fn.extend({
ssDatepicker: function ssDatepicker(opts) {
return (0, _jQuery2.default)(this).each(function () {
if ((0, _jQuery2.default)(this).data('datepicker')) return;
(0, _jQuery2.default)(this).siblings("button").addClass("ui-icon ui-icon-calendar");
var holder = (0, _jQuery2.default)(this).parents('.field.date:first'),
config = _jQuery2.default.extend(opts || {}, (0, _jQuery2.default)(this).data(), (0, _jQuery2.default)(this).data('jqueryuiconfig'), {});
if (!config.showcalendar) return;
if (config.locale && _jQuery2.default.datepicker.regional[config.locale]) {
config = _jQuery2.default.extend(config, _jQuery2.default.datepicker.regional[config.locale], {});
}
if (config.min) config.minDate = _jQuery2.default.datepicker.parseDate('yy-mm-dd', config.min);
if (config.max) config.maxDate = _jQuery2.default.datepicker.parseDate('yy-mm-dd', config.max);
config.dateFormat = config.jquerydateformat;
(0, _jQuery2.default)(this).datepicker(config);
});
}
});
(0, _jQuery2.default)(document).on("click", ".field.date input.text,input.text.date", function () {
(0, _jQuery2.default)(this).ssDatepicker();
if ((0, _jQuery2.default)(this).data('datepicker')) {
(0, _jQuery2.default)(this).datepicker('show');
}
});
});

362
javascript/dist/GridField.js vendored Normal file
View File

@ -0,0 +1,362 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.GridField', ['./jQuery', './i18n'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'), require('./i18n'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery, global.i18n);
global.ssGridField = mod.exports;
}
})(this, function (_jQuery, _i18n) {
var _jQuery2 = _interopRequireDefault(_jQuery);
var _i18n2 = _interopRequireDefault(_i18n);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.ss-gridfield').entwine({
reload: function reload(ajaxOpts, successCallback) {
var self = this,
form = this.closest('form'),
focusedElName = this.find(':input:focus').attr('name'),
data = form.find(':input').serializeArray();
if (!ajaxOpts) ajaxOpts = {};
if (!ajaxOpts.data) ajaxOpts.data = [];
ajaxOpts.data = ajaxOpts.data.concat(data);
if (window.location.search) {
ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data);
}
if (!window.history || !window.history.pushState) {
if (window.location.hash && window.location.hash.indexOf('?') != -1) {
ajaxOpts.data = window.location.hash.substring(window.location.hash.indexOf('?') + 1) + '&' + $.param(ajaxOpts.data);
}
}
form.addClass('loading');
$.ajax($.extend({}, {
headers: {
"X-Pjax": 'CurrentField'
},
type: "POST",
url: this.data('url'),
dataType: 'html',
success: function success(data) {
self.empty().append($(data).children());
if (focusedElName) self.find(':input[name="' + focusedElName + '"]').focus();
if (self.find('.filter-header').length) {
var content;
if (ajaxOpts.data[0].filter == "show") {
content = '<span class="non-sortable"></span>';
self.addClass('show-filter').find('.filter-header').show();
} else {
content = '<button type="button" name="showFilter" class="ss-gridfield-button-filter trigger"></button>';
self.removeClass('show-filter').find('.filter-header').hide();
}
self.find('.sortable-header th:last').html(content);
}
form.removeClass('loading');
if (successCallback) successCallback.apply(this, arguments);
self.trigger('reload', self);
},
error: function error(e) {
alert(_i18n2.default._t('GRIDFIELD.ERRORINTRANSACTION'));
form.removeClass('loading');
}
}, ajaxOpts));
},
showDetailView: function showDetailView(url) {
window.location.href = url;
},
getItems: function getItems() {
return this.find('.ss-gridfield-item');
},
setState: function setState(k, v) {
var state = this.getState();
state[k] = v;
this.find(':input[name="' + this.data('name') + '[GridState]"]').val(JSON.stringify(state));
},
getState: function getState() {
return JSON.parse(this.find(':input[name="' + this.data('name') + '[GridState]"]').val());
}
});
$('.ss-gridfield *').entwine({
getGridField: function getGridField() {
return this.closest('.ss-gridfield');
}
});
$('.ss-gridfield :button[name=showFilter]').entwine({
onclick: function onclick(e) {
$('.filter-header').show('slow').find(':input:first').focus();
this.closest('.ss-gridfield').addClass('show-filter');
this.parent().html('<span class="non-sortable"></span>');
e.preventDefault();
}
});
$('.ss-gridfield .ss-gridfield-item').entwine({
onclick: function onclick(e) {
if ($(e.target).closest('.action').length) {
this._super(e);
return false;
}
var editLink = this.find('.edit-link');
if (editLink.length) this.getGridField().showDetailView(editLink.prop('href'));
},
onmouseover: function onmouseover() {
if (this.find('.edit-link').length) this.css('cursor', 'pointer');
},
onmouseout: function onmouseout() {
this.css('cursor', 'default');
}
});
$('.ss-gridfield .action').entwine({
onclick: function onclick(e) {
var filterState = 'show';
if (this.button('option', 'disabled')) {
e.preventDefault();
return;
}
if (this.hasClass('ss-gridfield-button-close') || !this.closest('.ss-gridfield').hasClass('show-filter')) {
filterState = 'hidden';
}
this.getGridField().reload({
data: [{
name: this.attr('name'),
value: this.val(),
filter: filterState
}]
});
e.preventDefault();
}
});
$('.ss-gridfield .add-existing-autocompleter').entwine({
onbuttoncreate: function onbuttoncreate() {
var self = this;
this.toggleDisabled();
this.find('input[type="text"]').on('keyup', function () {
self.toggleDisabled();
});
},
onunmatch: function onunmatch() {
this.find('input[type="text"]').off('keyup');
},
toggleDisabled: function toggleDisabled() {
var $button = this.find('.ss-ui-button'),
$input = this.find('input[type="text"]'),
inputHasValue = $input.val() !== '',
buttonDisabled = $button.is(':disabled');
if (inputHasValue && buttonDisabled || !inputHasValue && !buttonDisabled) {
$button.button("option", "disabled", !buttonDisabled);
}
}
});
$('.ss-gridfield .col-buttons .action.gridfield-button-delete, .cms-edit-form .Actions button.action.action-delete').entwine({
onclick: function onclick(e) {
if (!confirm(_i18n2.default._t('TABLEFIELD.DELETECONFIRMMESSAGE'))) {
e.preventDefault();
return false;
} else {
this._super(e);
}
}
});
$('.ss-gridfield .action.gridfield-button-print').entwine({
UUID: null,
onmatch: function onmatch() {
this._super();
this.setUUID(new Date().getTime());
},
onunmatch: function onunmatch() {
this._super();
},
onclick: function onclick(e) {
var btn = this.closest(':button'),
grid = this.getGridField(),
form = this.closest('form'),
data = form.find(':input.gridstate').serialize();
;
data += "&" + encodeURIComponent(btn.attr('name')) + '=' + encodeURIComponent(btn.val());
if (window.location.search) {
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
var url = $.path.makeUrlAbsolute(grid.data('url') + connector + data, $('base').attr('href'));
var newWindow = window.open(url);
return false;
}
});
$('.ss-gridfield-print-iframe').entwine({
onmatch: function onmatch() {
this._super();
this.hide().bind('load', function () {
this.focus();
var ifWin = this.contentWindow || this;
ifWin.print();
});
},
onunmatch: function onunmatch() {
this._super();
}
});
$('.ss-gridfield .action.no-ajax').entwine({
onclick: function onclick(e) {
var self = this,
btn = this.closest(':button'),
grid = this.getGridField(),
form = this.closest('form'),
data = form.find(':input.gridstate').serialize();
data += "&" + encodeURIComponent(btn.attr('name')) + '=' + encodeURIComponent(btn.val());
if (window.location.search) {
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
window.location.href = $.path.makeUrlAbsolute(grid.data('url') + connector + data, $('base').attr('href'));
return false;
}
});
$('.ss-gridfield .action-detail').entwine({
onclick: function onclick() {
this.getGridField().showDetailView($(this).prop('href'));
return false;
}
});
$('.ss-gridfield[data-selectable]').entwine({
getSelectedItems: function getSelectedItems() {
return this.find('.ss-gridfield-item.ui-selected');
},
getSelectedIDs: function getSelectedIDs() {
return $.map(this.getSelectedItems(), function (el) {
return $(el).data('id');
});
}
});
$('.ss-gridfield[data-selectable] .ss-gridfield-items').entwine({
onadd: function onadd() {
this._super();
this.selectable();
},
onremove: function onremove() {
this._super();
if (this.data('selectable')) this.selectable('destroy');
}
});
$('.ss-gridfield .filter-header :input').entwine({
onmatch: function onmatch() {
var filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'),
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if (this.val()) {
filterbtn.addClass('filtered');
resetbtn.addClass('filtered');
}
this._super();
},
onunmatch: function onunmatch() {
this._super();
},
onkeydown: function onkeydown(e) {
if (this.closest('.ss-gridfield-button-reset').length) return;
var filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'),
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if (e.keyCode == '13') {
var btns = this.closest('.filter-header').find('.ss-gridfield-button-filter');
var filterState = 'show';
if (this.hasClass('ss-gridfield-button-close') || !this.closest('.ss-gridfield').hasClass('show-filter')) {
filterState = 'hidden';
}
this.getGridField().reload({
data: [{
name: btns.attr('name'),
value: btns.val(),
filter: filterState
}]
});
return false;
} else {
filterbtn.addClass('hover-alike');
resetbtn.addClass('hover-alike');
}
}
});
$(".ss-gridfield .relation-search").entwine({
onfocusin: function onfocusin(event) {
this.autocomplete({
source: function source(request, response) {
var searchField = $(this.element);
var form = $(this.element).closest("form");
$.ajax({
headers: {
"X-Pjax": 'Partial'
},
type: "GET",
url: $(searchField).data('searchUrl'),
data: encodeURIComponent(searchField.attr('name')) + '=' + encodeURIComponent(searchField.val()),
success: function success(data) {
response(JSON.parse(data));
},
error: function error(e) {
alert(_i18n2.default._t('GRIDFIELD.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.'));
}
});
},
select: function select(event, ui) {
$(this).closest(".ss-gridfield").find("#action_gridfield_relationfind").replaceWith('<input type="hidden" name="relationID" value="' + ui.item.id + '" id="relationID"/>');
var addbutton = $(this).closest(".ss-gridfield").find("#action_gridfield_relationadd");
if (addbutton.data('button')) {
addbutton.button('enable');
} else {
addbutton.removeAttr('disabled');
}
}
});
}
});
$(".ss-gridfield .pagination-page-number input").entwine({
onkeydown: function onkeydown(event) {
if (event.keyCode == 13) {
var newpage = parseInt($(this).val(), 10);
var gridfield = $(this).getGridField();
gridfield.setState('GridFieldPaginator', {
currentPage: newpage
});
gridfield.reload();
return false;
}
}
});
});
});

1223
javascript/dist/HtmlEditorField.js vendored Normal file
View File

@ -0,0 +1,1223 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.HtmlEditorField', ['./jQuery', './i18n'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'), require('./i18n'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery, global.i18n);
global.ssHtmlEditorField = mod.exports;
}
})(this, function (_jQuery, _i18n) {
var _jQuery2 = _interopRequireDefault(_jQuery);
var _i18n2 = _interopRequireDefault(_i18n);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var ss = typeof window.ss !== 'undefined' ? window.ss : {};
ss.editorWrappers = {};
ss.editorWrappers.tinyMCE = function () {
var instance;
return {
init: function init(config) {
if (!ss.editorWrappers.tinyMCE.initialized) {
tinyMCE.init(config);
ss.editorWrappers.tinyMCE.initialized = true;
}
},
getInstance: function getInstance() {
return this.instance;
},
onopen: function onopen() {},
onclose: function onclose() {},
save: function save() {
tinyMCE.triggerSave();
},
create: function create(domID, config) {
this.instance = new tinymce.Editor(domID, config);
this.instance.onInit.add(function (ed) {
if (!ss.editorWrappers.tinyMCE.patched) {
var originalDestroy = tinymce.themes.AdvancedTheme.prototype.destroy;
tinymce.themes.AdvancedTheme.prototype.destroy = function () {
originalDestroy.apply(this, arguments);
if (this.statusKeyboardNavigation) {
this.statusKeyboardNavigation.destroy();
this.statusKeyboardNavigation = null;
}
};
ss.editorWrappers.tinyMCE.patched = true;
}
jQuery(ed.getElement()).trigger('editorinit');
if (ed.settings.update_interval) {
var interval;
jQuery(ed.getBody()).on('focus', function () {
interval = setInterval(function () {
var element = jQuery(ed.getElement());
if (ed.isDirty()) {
element.val(ed.getContent({
format: 'raw',
no_events: 1
}));
}
}, ed.settings.update_interval);
});
jQuery(ed.getBody()).on('blur', function () {
clearInterval(interval);
});
}
});
this.instance.onChange.add(function (ed, l) {
ed.save();
jQuery(ed.getElement()).trigger('change');
});
this.instance.render();
},
repaint: function repaint() {
tinyMCE.execCommand("mceRepaint");
},
isDirty: function isDirty() {
return this.getInstance().isDirty();
},
getContent: function getContent() {
return this.getInstance().getContent();
},
getDOM: function getDOM() {
return this.getInstance().dom;
},
getContainer: function getContainer() {
return this.getInstance().getContainer();
},
getSelectedNode: function getSelectedNode() {
return this.getInstance().selection.getNode();
},
selectNode: function selectNode(node) {
this.getInstance().selection.select(node);
},
setContent: function setContent(html, opts) {
this.getInstance().execCommand('mceSetContent', false, html, opts);
},
insertContent: function insertContent(html, opts) {
this.getInstance().execCommand('mceInsertContent', false, html, opts);
},
replaceContent: function replaceContent(html, opts) {
this.getInstance().execCommand('mceReplaceContent', false, html, opts);
},
insertLink: function insertLink(attrs, opts) {
this.getInstance().execCommand("mceInsertLink", false, attrs, opts);
},
removeLink: function removeLink() {
this.getInstance().execCommand('unlink', false);
},
cleanLink: function cleanLink(href, node) {
var cb = tinyMCE.settings['urlconverter_callback'];
if (cb) href = eval(cb + "(href, node, true);");
if (href.match(new RegExp('^' + tinyMCE.settings['document_base_url'] + '(.*)$'))) {
href = RegExp.$1;
}
if (href.match(/^javascript:\s*mctmp/)) href = '';
return href;
},
createBookmark: function createBookmark() {
return this.getInstance().selection.getBookmark();
},
moveToBookmark: function moveToBookmark(bookmark) {
this.getInstance().selection.moveToBookmark(bookmark);
this.getInstance().focus();
},
blur: function blur() {
this.getInstance().selection.collapse();
},
addUndo: function addUndo() {
this.getInstance().undoManager.add();
}
};
};
ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
_jQuery2.default.entwine('ss', function ($) {
$('textarea.htmleditor').entwine({
Editor: null,
onadd: function onadd() {
var edClass = this.data('editor') || 'default',
ed = ss.editorWrappers[edClass]();
this.setEditor(ed);
if (typeof ssTinyMceConfig != 'undefined') this.redraw();
this._super();
},
onremove: function onremove() {
var ed = tinyMCE.get(this.attr('id'));
if (ed) {
try {
ed.remove();
} catch (ex) {}
try {
ed.destroy();
} catch (ex) {}
this.next('.mceEditor').remove();
$.each(jQuery.cache, function () {
var source = this.handle && this.handle.elem;
if (!source) return;
var parent = source;
try {
while (parent && parent.nodeType == 1) {
parent = parent.parentNode;
}
} catch (err) {}
if (!parent) $(source).unbind().remove();
});
}
this._super();
},
getContainingForm: function getContainingForm() {
return this.closest('form');
},
fromWindow: {
onload: function onload() {
this.redraw();
}
},
redraw: function redraw() {
var config = ssTinyMceConfig[this.data('config')],
self = this,
ed = this.getEditor();
ed.init(config);
ed.create(this.attr('id'), config);
this._super();
},
'from .cms-edit-form': {
onbeforesubmitform: function onbeforesubmitform(e) {
this.getEditor().save();
this._super();
}
},
oneditorinit: function oneditorinit() {
var redrawObj = $(this.getEditor().getInstance().getContainer());
setTimeout(function () {
redrawObj.show();
}, 10);
},
'from .cms-container': {
onbeforestatechange: function onbeforestatechange() {
this.css('visibility', 'hidden');
var ed = this.getEditor(),
container = ed && ed.getInstance() ? ed.getContainer() : null;
if (container && container.length) container.remove();
}
},
isChanged: function isChanged() {
var ed = this.getEditor();
return ed && ed.getInstance() && ed.isDirty();
},
resetChanged: function resetChanged() {
var ed = this.getEditor();
if (typeof tinyMCE == 'undefined') return;
var inst = tinyMCE.getInstanceById(this.attr('id'));
if (inst) inst.startContent = tinymce.trim(inst.getContent({
format: 'raw',
no_events: 1
}));
},
openLinkDialog: function openLinkDialog() {
this.openDialog('link');
},
openMediaDialog: function openMediaDialog() {
this.openDialog('media');
},
openDialog: function openDialog(type) {
var capitalize = function capitalize(text) {
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
};
var self = this,
url = $('#cms-editor-dialogs').data('url' + capitalize(type) + 'form'),
dialog = $('.htmleditorfield-' + type + 'dialog');
if (dialog.length) {
dialog.getForm().setElement(this);
dialog.open();
} else {
dialog = $('<div class="htmleditorfield-dialog htmleditorfield-' + type + 'dialog loading">');
$('body').append(dialog);
$.ajax({
url: url,
complete: function complete() {
dialog.removeClass('loading');
},
success: function success(html) {
dialog.html(html);
dialog.getForm().setElement(self);
dialog.trigger('ssdialogopen');
}
});
}
}
});
$('.htmleditorfield-dialog').entwine({
onadd: function onadd() {
if (!this.is('.ui-dialog-content')) {
this.ssdialog({
autoOpen: true,
buttons: {
'insert': {
text: _i18n2.default._t('HtmlEditorField.INSERT', 'Insert'),
'data-icon': 'accept',
class: 'ss-ui-action-constructive media-insert',
click: function click() {
$(this).find('form').submit();
}
}
}
});
}
this._super();
},
getForm: function getForm() {
return this.find('form');
},
open: function open() {
this.ssdialog('open');
},
close: function close() {
this.ssdialog('close');
},
toggle: function toggle(bool) {
if (this.is(':visible')) this.close();else this.open();
},
onscroll: function onscroll() {
this.animate({
scrollTop: this.find('form').height()
}, 500);
}
});
$('form.htmleditorfield-form').entwine({
Selection: null,
Bookmark: null,
Element: null,
setSelection: function setSelection(node) {
return this._super($(node));
},
onadd: function onadd() {
var titleEl = this.find(':header:first');
this.getDialog().attr('title', titleEl.text());
this._super();
},
onremove: function onremove() {
this.setSelection(null);
this.setBookmark(null);
this.setElement(null);
this._super();
},
getDialog: function getDialog() {
return this.closest('.htmleditorfield-dialog');
},
fromDialog: {
onssdialogopen: function onssdialogopen() {
var ed = this.getEditor();
ed.onopen();
this.setSelection(ed.getSelectedNode());
this.setBookmark(ed.createBookmark());
ed.blur();
this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(':visible:enabled').eq(0).focus();
this.redraw();
this.updateFromEditor();
},
onssdialogclose: function onssdialogclose() {
var ed = this.getEditor();
ed.onclose();
ed.moveToBookmark(this.getBookmark());
this.setSelection(null);
this.setBookmark(null);
this.resetFields();
}
},
getEditor: function getEditor() {
return this.getElement().getEditor();
},
modifySelection: function modifySelection(callback) {
var ed = this.getEditor();
ed.moveToBookmark(this.getBookmark());
callback.call(this, ed);
this.setSelection(ed.getSelectedNode());
this.setBookmark(ed.createBookmark());
ed.blur();
},
updateFromEditor: function updateFromEditor() {},
redraw: function redraw() {},
resetFields: function resetFields() {
this.find('.tree-holder').empty();
}
});
$('form.htmleditorfield-linkform').entwine({
onsubmit: function onsubmit(e) {
this.insertLink();
this.getDialog().close();
return false;
},
resetFields: function resetFields() {
this._super();
this[0].reset();
},
redraw: function redraw() {
this._super();
var linkType = this.find(':input[name=LinkType]:checked').val();
this.addAnchorSelector();
this.resetFileField();
this.find('div.content .field').hide();
this.find('.field[id$="LinkType"]').show();
this.find('.field[id$="' + linkType + '_Holder"]').show();
if (linkType == 'internal' || linkType == 'anchor') {
this.find('.field[id$="Anchor_Holder"]').show();
}
if (linkType == 'email') {
this.find('.field[id$="Subject_Holder"]').show();
} else {
this.find('.field[id$="TargetBlank_Holder"]').show();
}
if (linkType == 'anchor') {
this.find('.field[id$="AnchorSelector_Holder"]').show();
}
this.find('.field[id$="Description_Holder"]').show();
},
getLinkAttributes: function getLinkAttributes() {
var href,
target = null,
subject = this.find(':input[name=Subject]').val(),
anchor = this.find(':input[name=Anchor]').val();
if (this.find(':input[name=TargetBlank]').is(':checked')) {
target = '_blank';
}
switch (this.find(':input[name=LinkType]:checked').val()) {
case 'internal':
href = '[sitetree_link,id=' + this.find(':input[name=internal]').val() + ']';
if (anchor) {
href += '#' + anchor;
}
break;
case 'anchor':
href = '#' + anchor;
break;
case 'file':
href = '[file_link,id=' + this.find('.ss-uploadfield .ss-uploadfield-item').attr('data-fileid') + ']';
target = '_blank';
break;
case 'email':
href = 'mailto:' + this.find(':input[name=email]').val();
if (subject) {
href += '?subject=' + encodeURIComponent(subject);
}
target = null;
break;
default:
href = this.find(':input[name=external]').val();
if (href.indexOf('://') == -1) href = 'http://' + href;
break;
}
return {
href: href,
target: target,
title: this.find(':input[name=Description]').val()
};
},
insertLink: function insertLink() {
this.modifySelection(function (ed) {
ed.insertLink(this.getLinkAttributes());
});
},
removeLink: function removeLink() {
this.modifySelection(function (ed) {
ed.removeLink();
});
this.resetFileField();
this.close();
},
resetFileField: function resetFileField() {
var fileField = this.find('.ss-uploadfield[id$="file_Holder"]'),
fileUpload = fileField.data('fileupload'),
currentItem = fileField.find('.ss-uploadfield-item[data-fileid]');
if (currentItem.length) {
fileUpload._trigger('destroy', null, {
context: currentItem
});
fileField.find('.ss-uploadfield-addfile').removeClass('borderTop');
}
},
addAnchorSelector: function addAnchorSelector() {
if (this.find(':input[name=AnchorSelector]').length) return;
var self = this;
var anchorSelector = $('<select id="Form_EditorToolbarLinkForm_AnchorSelector" name="AnchorSelector"></select>');
this.find(':input[name=Anchor]').parent().append(anchorSelector);
this.updateAnchorSelector();
anchorSelector.change(function (e) {
self.find(':input[name="Anchor"]').val($(this).val());
});
},
getAnchors: function getAnchors() {
var linkType = this.find(':input[name=LinkType]:checked').val();
var dfdAnchors = $.Deferred();
switch (linkType) {
case 'anchor':
var collectedAnchors = [];
var ed = this.getEditor();
if (ed) {
var raw = ed.getContent().match(/\s+(name|id)\s*=\s*(["'])([^\2\s>]*?)\2|\s+(name|id)\s*=\s*([^"']+)[\s +>]/gim);
if (raw && raw.length) {
for (var i = 0; i < raw.length; i++) {
var indexStart = raw[i].indexOf('id=') == -1 ? 7 : 5;
collectedAnchors.push(raw[i].substr(indexStart).replace(/"$/, ''));
}
}
}
dfdAnchors.resolve(collectedAnchors);
break;
case 'internal':
var pageId = this.find(':input[name=internal]').val();
if (pageId) {
$.ajax({
url: $.path.addSearchParams(this.attr('action').replace('LinkForm', 'getanchors'), {
'PageID': parseInt(pageId)
}),
success: function success(body, status, xhr) {
dfdAnchors.resolve($.parseJSON(body));
},
error: function error(xhr, status) {
dfdAnchors.reject(xhr.responseText);
}
});
} else {
dfdAnchors.resolve([]);
}
break;
default:
dfdAnchors.reject(_i18n2.default._t('HtmlEditorField.ANCHORSNOTSUPPORTED', 'Anchors are not supported for this link type.'));
break;
}
return dfdAnchors.promise();
},
updateAnchorSelector: function updateAnchorSelector() {
var self = this;
var selector = this.find(':input[name=AnchorSelector]');
var dfdAnchors = this.getAnchors();
selector.empty();
selector.append($('<option value="" selected="1">' + _i18n2.default._t('HtmlEditorField.LOOKINGFORANCHORS', 'Looking for anchors...') + '</option>'));
dfdAnchors.done(function (anchors) {
selector.empty();
selector.append($('<option value="" selected="1">' + _i18n2.default._t('HtmlEditorField.SelectAnchor') + '</option>'));
if (anchors) {
for (var j = 0; j < anchors.length; j++) {
selector.append($('<option value="' + anchors[j] + '">' + anchors[j] + '</option>'));
}
}
}).fail(function (message) {
selector.empty();
selector.append($('<option value="" selected="1">' + message + '</option>'));
});
if ($.browser.msie) selector.hide().show();
},
updateFromEditor: function updateFromEditor() {
var htmlTagPattern = /<\S[^><]*>/g,
fieldName,
data = this.getCurrentLink();
if (data) {
for (fieldName in data) {
var el = this.find(':input[name=' + fieldName + ']'),
selected = data[fieldName];
if (typeof selected == 'string') selected = selected.replace(htmlTagPattern, '');
if (el.is(':checkbox')) {
el.prop('checked', selected).change();
} else if (el.is(':radio')) {
el.val([selected]).change();
} else if (fieldName == 'file') {
el = this.find(':input[name="' + fieldName + '[Uploads][]"]');
el = el.parents('.ss-uploadfield');
(function attach(el, selected) {
if (!el.getConfig()) {
setTimeout(function () {
attach(el, selected);
}, 50);
} else {
el.attachFiles([selected]);
}
})(el, selected);
} else {
el.val(selected).change();
}
}
}
},
getCurrentLink: function getCurrentLink() {
var selectedEl = this.getSelection(),
href = "",
target = "",
title = "",
action = "insert",
style_class = "";
var linkDataSource = null;
if (selectedEl.length) {
if (selectedEl.is('a')) {
linkDataSource = selectedEl;
} else {
linkDataSource = selectedEl = selectedEl.parents('a:first');
}
}
if (linkDataSource && linkDataSource.length) this.modifySelection(function (ed) {
ed.selectNode(linkDataSource[0]);
});
if (!linkDataSource.attr('href')) linkDataSource = null;
if (linkDataSource) {
href = linkDataSource.attr('href');
target = linkDataSource.attr('target');
title = linkDataSource.attr('title');
style_class = linkDataSource.attr('class');
href = this.getEditor().cleanLink(href, linkDataSource);
action = "update";
}
if (href.match(/^mailto:(.*)$/)) {
return {
LinkType: 'email',
email: RegExp.$1,
Description: title
};
} else if (href.match(/^(assets\/.*)$/) || href.match(/^\[file_link\s*(?:\s*|%20|,)?id=([0-9]+)\]?(#.*)?$/)) {
return {
LinkType: 'file',
file: RegExp.$1,
Description: title,
TargetBlank: target ? true : false
};
} else if (href.match(/^#(.*)$/)) {
return {
LinkType: 'anchor',
Anchor: RegExp.$1,
Description: title,
TargetBlank: target ? true : false
};
} else if (href.match(/^\[sitetree_link(?:\s*|%20|,)?id=([0-9]+)\]?(#.*)?$/i)) {
return {
LinkType: 'internal',
internal: RegExp.$1,
Anchor: RegExp.$2 ? RegExp.$2.substr(1) : '',
Description: title,
TargetBlank: target ? true : false
};
} else if (href) {
return {
LinkType: 'external',
external: href,
Description: title,
TargetBlank: target ? true : false
};
} else {
return null;
}
}
});
$('form.htmleditorfield-linkform input[name=LinkType]').entwine({
onclick: function onclick(e) {
this.parents('form:first').redraw();
this._super();
},
onchange: function onchange() {
this.parents('form:first').redraw();
var linkType = this.parent().find(':checked').val();
if (linkType === 'anchor' || linkType === 'internal') {
this.parents('form.htmleditorfield-linkform').updateAnchorSelector();
}
this._super();
}
});
$('form.htmleditorfield-linkform input[name=internal]').entwine({
onvalueupdated: function onvalueupdated() {
this.parents('form.htmleditorfield-linkform').updateAnchorSelector();
this._super();
}
});
$('form.htmleditorfield-linkform :submit[name=action_remove]').entwine({
onclick: function onclick(e) {
this.parents('form:first').removeLink();
this._super();
return false;
}
});
$('form.htmleditorfield-mediaform').entwine({
toggleCloseButton: function toggleCloseButton() {
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show']();
},
onsubmit: function onsubmit() {
this.modifySelection(function (ed) {
this.find('.ss-htmleditorfield-file').each(function () {
$(this).insertHTML(ed);
});
ed.repaint();
});
this.getDialog().close();
return false;
},
updateFromEditor: function updateFromEditor() {
var self = this,
node = this.getSelection();
if (node.is('img')) {
this.showFileView(node.data('url') || node.attr('src')).done(function (filefield) {
filefield.updateFromNode(node);
self.toggleCloseButton();
self.redraw();
});
}
this.redraw();
},
redraw: function redraw(updateExisting) {
this._super();
var node = this.getSelection(),
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
editingSelected = node.is('img'),
insertingURL = this.hasClass('insertingURL'),
header = this.find('.header-edit');
header[hasItems ? 'show' : 'hide']();
this.closest('ui-dialog').find('ui-dialog-buttonpane .media-insert').button(hasItems ? 'enable' : 'disable').toggleClass('ui-state-disabled', !hasItems);
this.find('.htmleditorfield-default-panel')[editingSelected || insertingURL ? 'hide' : 'show']();
this.find('.htmleditorfield-web-panel')[editingSelected || !insertingURL ? 'hide' : 'show']();
var mediaFormHeading = this.find('.htmleditorfield-mediaform-heading.insert');
if (editingSelected) {
mediaFormHeading.hide();
} else if (insertingURL) {
mediaFormHeading.show().text(_i18n2.default._t("HtmlEditorField.INSERTURL")).prepend('<button class="back-button font-icon-left-open no-text" title="' + _i18n2.default._t("HtmlEditorField.BACK") + '"></button>');
this.find('.htmleditorfield-web-panel input.remoteurl').focus();
} else {
mediaFormHeading.show().text(_i18n2.default._t("HtmlEditorField.INSERTFROM")).find('.back-button').remove();
}
this.find('.htmleditorfield-mediaform-heading.update')[editingSelected ? 'show' : 'hide']();
this.find('.ss-uploadfield-item-actions')[editingSelected ? 'hide' : 'show']();
this.find('.ss-uploadfield-item-name')[editingSelected ? 'hide' : 'show']();
this.find('.ss-uploadfield-item-preview')[editingSelected ? 'hide' : 'show']();
this.find('.Actions .media-update')[editingSelected ? 'show' : 'hide']();
this.find('.ss-uploadfield-item-editform').toggleEditForm(editingSelected);
this.find('.htmleditorfield-from-cms .field.treedropdown').css('left', $('.htmleditorfield-mediaform-heading:visible').outerWidth());
this.closest('.ui-dialog').addClass('ss-uploadfield-dropzone');
this.closest('.ui-dialog').find('.ui-dialog-buttonpane .media-insert .ui-button-text').text([editingSelected ? _i18n2.default._t('HtmlEditorField.UPDATE', 'Update') : _i18n2.default._t('HtmlEditorField.INSERT', 'Insert')]);
},
resetFields: function resetFields() {
this.find('.ss-htmleditorfield-file').remove();
this.find('.ss-gridfield-items .ui-selected').removeClass('ui-selected');
this.find('li.ss-uploadfield-item').remove();
this.redraw();
this._super();
},
getFileView: function getFileView(idOrUrl) {
return this.find('.ss-htmleditorfield-file[data-id=' + idOrUrl + ']');
},
showFileView: function showFileView(idOrUrl) {
var self = this,
params = Number(idOrUrl) == idOrUrl ? {
ID: idOrUrl
} : {
FileURL: idOrUrl
};
var item = $('<div class="ss-htmleditorfield-file loading" />');
this.find('.content-edit').prepend(item);
var dfr = $.Deferred();
$.ajax({
url: $.path.addSearchParams(this.attr('action').replace(/MediaForm/, 'viewfile'), params),
success: function success(html, status, xhr) {
var newItem = $(html).filter('.ss-htmleditorfield-file');
item.replaceWith(newItem);
self.redraw();
dfr.resolve(newItem);
},
error: function error() {
item.remove();
dfr.reject();
}
});
return dfr.promise();
}
});
$('form.htmleditorfield-mediaform div.ss-upload .upload-url').entwine({
onclick: function onclick() {
var form = this.closest('form');
form.addClass('insertingURL');
form.redraw();
}
});
$('form.htmleditorfield-mediaform .htmleditorfield-mediaform-heading .back-button').entwine({
onclick: function onclick() {
var form = this.closest('form');
form.removeClass('insertingURL');
form.redraw();
}
});
$('form.htmleditorfield-mediaform .ss-gridfield-items').entwine({
onselectableselected: function onselectableselected(e, ui) {
var form = this.closest('form'),
item = $(ui.selected);
if (!item.is('.ss-gridfield-item')) return;
form.closest('form').showFileView(item.data('id'));
form.redraw();
form.parent().trigger('scroll');
},
onselectableunselected: function onselectableunselected(e, ui) {
var form = this.closest('form'),
item = $(ui.unselected);
if (!item.is('.ss-gridfield-item')) return;
form.getFileView(item.data('id')).remove();
form.redraw();
}
});
$('form.htmleditorfield-form.htmleditorfield-mediaform div.ss-assetuploadfield').entwine({
onfileuploadstop: function onfileuploadstop(e) {
var form = this.closest('form');
var editFieldIDs = [];
form.find('div.content-edit').find('div.ss-htmleditorfield-file').each(function () {
editFieldIDs.push($(this).data('id'));
});
var uploadedFiles = $('.ss-uploadfield-files', this).children('.ss-uploadfield-item');
uploadedFiles.each(function () {
var uploadedID = $(this).data('fileid');
if (uploadedID && $.inArray(uploadedID, editFieldIDs) == -1) {
$(this).remove();
form.showFileView(uploadedID);
}
});
form.parent().trigger('scroll');
form.redraw();
}
});
$('form.htmleditorfield-form.htmleditorfield-mediaform input.remoteurl').entwine({
onadd: function onadd() {
this._super();
this.validate();
},
onkeyup: function onkeyup() {
this.validate();
},
onchange: function onchange() {
this.validate();
},
getAddButton: function getAddButton() {
return this.closest('.CompositeField').find('button.add-url');
},
validate: function validate() {
var val = this.val(),
orig = val;
val = $.trim(val);
val = val.replace(/^https?:\/\//i, '');
if (orig !== val) this.val(val);
this.getAddButton().button(!!val ? 'enable' : 'disable');
return !!val;
}
});
$('form.htmleditorfield-form.htmleditorfield-mediaform .add-url').entwine({
getURLField: function getURLField() {
return this.closest('.CompositeField').find('input.remoteurl');
},
onclick: function onclick(e) {
var urlField = this.getURLField(),
container = this.closest('.CompositeField'),
form = this.closest('form');
if (urlField.validate()) {
container.addClass('loading');
form.showFileView('http://' + urlField.val()).done(function () {
container.removeClass('loading');
form.parent().trigger('scroll');
});
form.redraw();
}
return false;
}
});
$('form.htmleditorfield-mediaform .ss-htmleditorfield-file').entwine({
getAttributes: function getAttributes() {},
getExtraData: function getExtraData() {},
getHTML: function getHTML() {
return $('<div>').append($('<a/>').attr({
href: this.data('url')
}).text(this.find('.name').text())).html();
},
insertHTML: function insertHTML(ed) {
ed.replaceContent(this.getHTML());
},
updateFromNode: function updateFromNode(node) {},
updateDimensions: function updateDimensions(constrainBy, maxW, maxH) {
var widthEl = this.find(':input[name=Width]'),
heightEl = this.find(':input[name=Height]'),
w = widthEl.val(),
h = heightEl.val(),
aspect;
if (w && h) {
if (constrainBy) {
aspect = heightEl.getOrigVal() / widthEl.getOrigVal();
if (constrainBy == 'Width') {
if (maxW && w > maxW) w = maxW;
h = Math.floor(w * aspect);
} else if (constrainBy == 'Height') {
if (maxH && h > maxH) h = maxH;
w = Math.ceil(h / aspect);
}
} else {
if (maxW && w > maxW) w = maxW;
if (maxH && h > maxH) h = maxH;
}
widthEl.val(w);
heightEl.val(h);
}
}
});
$('form.htmleditorfield-mediaform .ss-htmleditorfield-file.image').entwine({
getAttributes: function getAttributes() {
var width = this.find(':input[name=Width]').val(),
height = this.find(':input[name=Height]').val();
return {
'src': this.find(':input[name=URL]').val(),
'alt': this.find(':input[name=AltText]').val(),
'width': width ? parseInt(width, 10) : null,
'height': height ? parseInt(height, 10) : null,
'title': this.find(':input[name=Title]').val(),
'class': this.find(':input[name=CSSClass]').val(),
'data-fileid': this.find(':input[name=FileID]').val()
};
},
getExtraData: function getExtraData() {
return {
'CaptionText': this.find(':input[name=CaptionText]').val()
};
},
getHTML: function getHTML() {},
insertHTML: function insertHTML(ed) {
var form = this.closest('form');
var node = form.getSelection();
if (!ed) ed = form.getEditor();
var attrs = this.getAttributes(),
extraData = this.getExtraData();
var replacee = node && node.is('img') ? node : null;
if (replacee && replacee.parent().is('.captionImage')) replacee = replacee.parent();
var img = node && node.is('img') ? node : $('<img />');
img.attr(attrs);
var container = img.parent('.captionImage'),
caption = container.find('.caption');
if (extraData.CaptionText) {
if (!container.length) {
container = $('<div></div>');
}
container.attr('class', 'captionImage ' + attrs['class']).css('width', attrs.width);
if (!caption.length) {
caption = $('<p class="caption"></p>').appendTo(container);
}
caption.attr('class', 'caption ' + attrs['class']).text(extraData.CaptionText);
} else {
container = caption = null;
}
var replacer = container ? container : img;
if (replacee && replacee.not(replacer).length) {
replacee.replaceWith(replacer);
}
if (container) {
container.prepend(img);
}
if (!replacee) {
ed.repaint();
ed.insertContent($('<div />').append(replacer).html(), {
skip_undo: 1
});
}
ed.addUndo();
ed.repaint();
},
updateFromNode: function updateFromNode(node) {
this.find(':input[name=AltText]').val(node.attr('alt'));
this.find(':input[name=Title]').val(node.attr('title'));
this.find(':input[name=CSSClass]').val(node.attr('class'));
this.find(':input[name=Width]').val(node.width());
this.find(':input[name=Height]').val(node.height());
this.find(':input[name=CaptionText]').val(node.siblings('.caption:first').text());
this.find(':input[name=FileID]').val(node.data('fileid'));
}
});
$('form.htmleditorfield-mediaform .ss-htmleditorfield-file.flash').entwine({
getAttributes: function getAttributes() {
var width = this.find(':input[name=Width]').val(),
height = this.find(':input[name=Height]').val();
return {
'src': this.find(':input[name=URL]').val(),
'width': width ? parseInt(width, 10) : null,
'height': height ? parseInt(height, 10) : null,
'data-fileid': this.find(':input[name=FileID]').val()
};
},
getHTML: function getHTML() {
var attrs = this.getAttributes();
var el = tinyMCE.activeEditor.plugins.media.dataToImg({
'type': 'flash',
'width': attrs.width,
'height': attrs.height,
'params': {
'src': attrs.src
},
'video': {
'sources': []
}
});
return $('<div />').append(el).html();
},
updateFromNode: function updateFromNode(node) {}
});
$('form.htmleditorfield-mediaform .ss-htmleditorfield-file.embed').entwine({
getAttributes: function getAttributes() {
var width = this.find(':input[name=Width]').val(),
height = this.find(':input[name=Height]').val();
return {
'src': this.find('.thumbnail-preview').attr('src'),
'width': width ? parseInt(width, 10) : null,
'height': height ? parseInt(height, 10) : null,
'class': this.find(':input[name=CSSClass]').val(),
'alt': this.find(':input[name=AltText]').val(),
'title': this.find(':input[name=Title]').val(),
'data-fileid': this.find(':input[name=FileID]').val()
};
},
getExtraData: function getExtraData() {
var width = this.find(':input[name=Width]').val(),
height = this.find(':input[name=Height]').val();
return {
'CaptionText': this.find(':input[name=CaptionText]').val(),
'Url': this.find(':input[name=URL]').val(),
'thumbnail': this.find('.thumbnail-preview').attr('src'),
'width': width ? parseInt(width, 10) : null,
'height': height ? parseInt(height, 10) : null,
'cssclass': this.find(':input[name=CSSClass]').val()
};
},
getHTML: function getHTML() {
var el,
attrs = this.getAttributes(),
extraData = this.getExtraData(),
imgEl = $('<img />').attr(attrs).addClass('ss-htmleditorfield-file embed');
$.each(extraData, function (key, value) {
imgEl.attr('data-' + key, value);
});
if (extraData.CaptionText) {
el = $('<div style="width: ' + attrs['width'] + 'px;" class="captionImage ' + attrs['class'] + '"><p class="caption">' + extraData.CaptionText + '</p></div>').prepend(imgEl);
} else {
el = imgEl;
}
return $('<div />').append(el).html();
},
updateFromNode: function updateFromNode(node) {
this.find(':input[name=AltText]').val(node.attr('alt'));
this.find(':input[name=Title]').val(node.attr('title'));
this.find(':input[name=Width]').val(node.width());
this.find(':input[name=Height]').val(node.height());
this.find(':input[name=Title]').val(node.attr('title'));
this.find(':input[name=CSSClass]').val(node.data('cssclass'));
this.find(':input[name=FileID]').val(node.data('fileid'));
}
});
$('form.htmleditorfield-mediaform .ss-htmleditorfield-file .dimensions :input').entwine({
OrigVal: null,
onmatch: function onmatch() {
this._super();
this.setOrigVal(parseInt(this.val(), 10));
},
onunmatch: function onunmatch() {
this._super();
},
onfocusout: function onfocusout(e) {
this.closest('.ss-htmleditorfield-file').updateDimensions(this.attr('name'));
}
});
$('form.htmleditorfield-mediaform .ss-uploadfield-item .ss-uploadfield-item-cancel').entwine({
onclick: function onclick(e) {
var form = this.closest('form'),
file = this.closest('ss-uploadfield-item');
form.find('.ss-gridfield-item[data-id=' + file.data('id') + ']').removeClass('ui-selected');
this.closest('.ss-uploadfield-item').remove();
form.redraw();
e.preventDefault();
}
});
$('div.ss-assetuploadfield .ss-uploadfield-item-edit, div.ss-assetuploadfield .ss-uploadfield-item-name').entwine({
getEditForm: function getEditForm() {
return this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform');
},
fromEditForm: {
onchange: function onchange(e) {
var form = $(e.target);
form.removeClass('edited');
form.addClass('edited');
}
},
onclick: function onclick(e) {
var editForm = this.getEditForm();
if (this.closest('.ss-uploadfield-item').hasClass('ss-htmleditorfield-file')) {
editForm.parent('ss-uploadfield-item').removeClass('ui-state-warning');
editForm.toggleEditForm();
e.preventDefault();
return false;
}
this._super(e);
}
});
$('div.ss-assetuploadfield .ss-uploadfield-item-editform').entwine({
toggleEditForm: function toggleEditForm(bool) {
var itemInfo = this.prev('.ss-uploadfield-item-info'),
status = itemInfo.find('.ss-uploadfield-item-status');
var text = "";
if (bool === true || bool !== false && this.height() === 0) {
text = _i18n2.default._t('UploadField.Editing', "Editing ...");
this.height('auto');
itemInfo.find('.toggle-details-icon').addClass('opened');
status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
} else {
this.height(0);
itemInfo.find('.toggle-details-icon').removeClass('opened');
if (!this.hasClass('edited')) {
text = _i18n2.default._t('UploadField.NOCHANGES', 'No Changes');
status.addClass('ui-state-success-text');
} else {
text = _i18n2.default._t('UploadField.CHANGESSAVED', 'Changes Made');
this.removeClass('edited');
status.addClass('ui-state-success-text');
}
}
status.attr('title', text).text(text);
}
});
$('form.htmleditorfield-mediaform .field[id$="ParentID_Holder"] .TreeDropdownField').entwine({
onadd: function onadd() {
this._super();
var self = this;
this.bind('change', function () {
var fileList = self.closest('form').find('.ss-gridfield');
fileList.setState('ParentID', self.getValue());
fileList.reload();
});
}
});
});
window.sapphiremce_cleanup = function sapphiremce_cleanup(type, value) {
if (type == 'get_from_editor') {
value = value.replace(/<[a-z0-9]+:imagedata[^>]+src="?([^> "]+)"?[^>]*>/ig, "<img src=\"$1\">");
value = value.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), "");
value = value.replace(/([ \f\r\t\n\'\"])class=mso[a-z0-9]+[^ >]+/ig, "$1");
value = value.replace(/([ \f\r\t\n\'\"]class=")mso[a-z0-9]+[^ ">]+ /ig, "$1");
value = value.replace(/([ \f\r\t\n\'\"])class="mso[a-z0-9]+[^">]+"/ig, "$1");
value = value.replace(/([ \f\r\t\n\'\"])on[a-z]+=[^ >]+/ig, "$1");
value = value.replace(/ >/ig, ">");
value = value.replace(/<(\/[A-Za-z0-9]+)[ \f\r\t\n]+[^>]*>/ig, "<$1>");
}
if (type == 'get_from_editor_dom') {
jQuery(value).find('img').each(function () {
this.onresizestart = null;
this.onresizeend = null;
this.removeAttribute('onresizestart');
this.removeAttribute('onresizeend');
});
}
return value;
};
});

29
javascript/dist/InlineFormAction.js vendored Normal file
View File

@ -0,0 +1,29 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.InlineFormAction', [], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.ssInlineFormAction = mod.exports;
}
})(this, function () {
Behaviour.register({
'div.inlineformaction input#$ID': {
onclick: function onclick() {
var url = jQuery('base').attr('href') + 'admin-custom/' + this.name.substring(7) + '?ID=' + document.getElementById('Form_EditForm_ID').value + '&ajax=1';
jQuery.ajax({
'url': url,
success: Ajax.Evaluator,
success: Ajax.Evaluator
});
return false;
}
}
});
});

View File

@ -1,86 +1,92 @@
(function($) {
'use strict';
$.entwine('ss', function($){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.PermissionCheckboxSetField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssPermissionCheckboxSetField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
/**
* Automatically check and disable all checkboxes if ADMIN permissions are selected.
* As they're disabled, any changes won't be submitted (which is intended behaviour),
* checking all boxes is purely presentational.
*/
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.permissioncheckboxset .valADMIN input').entwine({
onmatch: function() {
onmatch: function onmatch() {
this._super();
},
onunmatch: function() {
onunmatch: function onunmatch() {
this._super();
},
onclick: function(e) {
onclick: function onclick(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function() {
toggleCheckboxes: function toggleCheckboxes() {
var checkboxes = $(this).parents('.field:eq(0)').find('.checkbox').not(this);
if($(this).is(':checked')) {
checkboxes.each(function() {
if ($(this).is(':checked')) {
checkboxes.each(function () {
$(this).data('SecurityAdmin.oldChecked', $(this).attr('checked'));
$(this).data('SecurityAdmin.oldDisabled', $(this).attr('disabled'));
$(this).attr('disabled', 'disabled');
$(this).attr('checked', 'checked');
});
} else {
checkboxes.each(function() {
// only update attributes if previous values have been saved
checkboxes.each(function () {
var oldChecked = $(this).data('SecurityAdmin.oldChecked');
var oldDisabled = $(this).data('SecurityAdmin.oldDisabled');
if(oldChecked !== null) $(this).attr('checked', oldChecked);
if(oldDisabled !== null) $(this).attr('disabled', oldDisabled);
if (oldChecked !== null) $(this).attr('checked', oldChecked);
if (oldDisabled !== null) $(this).attr('disabled', oldDisabled);
});
}
}
});
/**
* Automatically check all "CMS section" checkboxes when "Access to all CMS interfaces" is ticked.
*
* @todo This should really be abstracted into a declarative dependency system
* instead of custom logic.
*/
$('.permissioncheckboxset .valCMS_ACCESS_LeftAndMain input').entwine({
getCheckboxesExceptThisOne: function() {
return $(this).parents('.field:eq(0)').find('li').filter(function(i) {
getCheckboxesExceptThisOne: function getCheckboxesExceptThisOne() {
return $(this).parents('.field:eq(0)').find('li').filter(function (i) {
var klass = $(this).attr('class');
return (klass ? klass.match(/CMS_ACCESS_/) : false);
return klass ? klass.match(/CMS_ACCESS_/) : false;
}).find('.checkbox').not(this);
},
onmatch: function() {
onmatch: function onmatch() {
this.toggleCheckboxes();
this._super();
},
onunmatch: function() {
onunmatch: function onunmatch() {
this._super();
},
onclick: function(e) {
onclick: function onclick(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function() {
toggleCheckboxes: function toggleCheckboxes() {
var checkboxes = this.getCheckboxesExceptThisOne();
if($(this).is(':checked')) {
checkboxes.each(function() {
if ($(this).is(':checked')) {
checkboxes.each(function () {
$(this).data('PermissionCheckboxSetField.oldChecked', $(this).is(':checked'));
$(this).data('PermissionCheckboxSetField.oldDisabled', $(this).is(':disabled'));
$(this).prop('disabled', 'disabled');
$(this).prop('checked', 'checked');
});
} else {
checkboxes.each(function() {
checkboxes.each(function () {
$(this).prop('checked', $(this).data('PermissionCheckboxSetField.oldChecked'));
$(this).prop('disabled', $(this).data('PermissionCheckboxSetField.oldDisabled'));
});
}
}
});
});
}(jQuery));
});

35
javascript/dist/SelectionGroup.js vendored Normal file
View File

@ -0,0 +1,35 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.SelectionGroup', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssSelectionGroup = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
(0, _jQuery2.default)(document).ready(function () {
(0, _jQuery2.default)('ul.SelectionGroup input.selector').live('click', function () {
var li = (0, _jQuery2.default)(this).closest('li');
li.addClass('selected');
var prev = li.prevAll('li.selected');
if (prev.length) prev.removeClass('selected');
var next = li.nextAll('li.selected');
if (next.length) next.removeClass('selected');
(0, _jQuery2.default)(this).focus();
});
});
});

73
javascript/dist/TabSet.js vendored Normal file
View File

@ -0,0 +1,73 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.TabSet', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssTabSet = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.ss-tabset').entwine({
IgnoreTabState: false,
onadd: function onadd() {
var hash = window.location.hash;
this.redrawTabs();
if (hash !== '') {
this.openTabFromURL(hash);
}
this._super();
},
onremove: function onremove() {
if (this.data('tabs')) this.tabs('destroy');
this._super();
},
redrawTabs: function redrawTabs() {
this.rewriteHashlinks();
this.tabs();
},
openTabFromURL: function openTabFromURL(hash) {
var $trigger;
$.each(this.find('.cms-panel-link'), function () {
if (this.href.indexOf(hash) !== -1 && $(hash).length === 1) {
$trigger = $(this);
return false;
}
});
if ($trigger === void 0) {
return;
}
$(window).one('ajaxComplete', function () {
$trigger.click();
});
},
rewriteHashlinks: function rewriteHashlinks() {
$(this).find('ul a').each(function () {
if (!$(this).attr('href')) return;
var matches = $(this).attr('href').match(/#.*/);
if (!matches) return;
$(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]);
});
}
});
});
});

50
javascript/dist/ToggleCompositeField.js vendored Normal file
View File

@ -0,0 +1,50 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.ToggleCompositeField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssToggleCompositeField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('.ss-toggle').entwine({
onadd: function onadd() {
this._super();
this.accordion({
heightStyle: "content",
collapsible: true,
active: this.hasClass("ss-toggle-start-closed") ? false : 0
});
},
onremove: function onremove() {
if (this.data('accordion')) this.accordion('destroy');
this._super();
},
getTabSet: function getTabSet() {
return this.closest(".ss-tabset");
},
fromTabSet: {
ontabsshow: function ontabsshow() {
this.accordion("resize");
}
}
});
});
});

35
javascript/dist/ToggleField.js vendored Normal file
View File

@ -0,0 +1,35 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.ToggleField', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssToggleField = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var field = (0, _jQuery2.default)('div.toggleField');
if (field.hasClass('startClosed')) {
field.find('div.contentMore').hide();
field.find('div.contentLess').show();
}
(0, _jQuery2.default)('div.toggleField .triggerLess, div.toggleField .triggerMore').click(function () {
field.find('div.contentMore').toggle();
field.find('div.contentLess').toggle();
});
});

418
javascript/dist/TreeDropdownField.js vendored Normal file
View File

@ -0,0 +1,418 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.TreeDropdownField', ['./jQuery', './i18n'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'), require('./i18n'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery, global.i18n);
global.ssTreeDropdownField = mod.exports;
}
})(this, function (_jQuery, _i18n) {
var _jQuery2 = _interopRequireDefault(_jQuery);
var _i18n2 = _interopRequireDefault(_i18n);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
var windowWidth, windowHeight;
$(window).bind('resize.treedropdownfield', function () {
var cb = function cb() {
$('.TreeDropdownField').closePanel();
};
if ($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(),
newWindowHeight = $(window).height();
if (newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
var strings = {
'openlink': _i18n2.default._t('TreeDropdownField.OpenLink'),
'fieldTitle': '(' + _i18n2.default._t('TreeDropdownField.FieldTitle') + ')',
'searchFieldTitle': '(' + _i18n2.default._t('TreeDropdownField.SearchFieldTitle') + ')'
};
var _clickTestFn = function _clickTestFn(e) {
if (!$(e.target).parents('.TreeDropdownField').length) $('.TreeDropdownField').closePanel();
};
$('.TreeDropdownField').entwine({
CurrentXhr: null,
onadd: function onadd() {
this.append('<span class="treedropdownfield-title"></span>' + '<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' + '<div class="treedropdownfield-panel"><div class="tree-holder"></div></div>');
var linkTitle = strings.openLink;
if (linkTitle) this.find("treedropdownfield-toggle-panel-link a").attr('title', linkTitle);
if (this.data('title')) this.setTitle(this.data('title'));
this.getPanel().hide();
this._super();
},
getPanel: function getPanel() {
return this.find('.treedropdownfield-panel');
},
openPanel: function openPanel() {
$('.TreeDropdownField').closePanel();
$('body').bind('click', _clickTestFn);
var panel = this.getPanel(),
tree = this.find('.tree-holder');
panel.css('width', this.width());
panel.show();
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.addClass('treedropdownfield-open-tree');
this.addClass("treedropdownfield-open-tree");
toggle.find("a").removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-n');
if (tree.is(':empty') && !panel.hasClass('loading')) {
this.loadTree(null, this._riseUp);
} else {
this._riseUp();
}
this.trigger('panelshow');
},
_riseUp: function _riseUp() {
var container = this,
dropdown = this.getPanel(),
toggle = this.find(".treedropdownfield-toggle-panel-link"),
offsetTop = toggle.innerHeight(),
elHeight,
elPos,
endOfWindow;
if (toggle.length > 0) {
endOfWindow = $(window).height() + $(document).scrollTop() - toggle.innerHeight();
elPos = toggle.offset().top;
elHeight = dropdown.innerHeight();
if (elPos + elHeight > endOfWindow && elPos - elHeight > 0) {
container.addClass('treedropdownfield-with-rise');
offsetTop = -dropdown.outerHeight();
} else {
container.removeClass('treedropdownfield-with-rise');
}
}
dropdown.css({
"top": offsetTop + "px"
});
},
closePanel: function closePanel() {
jQuery('body').unbind('click', _clickTestFn);
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.removeClass('treedropdownfield-open-tree');
this.removeClass('treedropdownfield-open-tree treedropdownfield-with-rise');
toggle.find("a").removeClass('ui-icon-triangle-1-n').addClass('ui-icon-triangle-1-s');
this.getPanel().hide();
this.trigger('panelhide');
},
togglePanel: function togglePanel() {
this[this.getPanel().is(':visible') ? 'closePanel' : 'openPanel']();
},
setTitle: function setTitle(title) {
title = title || this.data('title') || strings.fieldTitle;
this.find('.treedropdownfield-title').html(title);
this.data('title', title);
},
getTitle: function getTitle() {
return this.find('.treedropdownfield-title').text();
},
updateTitle: function updateTitle() {
var self = this,
tree = self.find('.tree-holder'),
val = this.getValue();
var updateFn = function updateFn() {
var val = self.getValue();
if (val) {
var node = tree.find('*[data-id="' + val + '"]'),
title = node.children('a').find("span.jstree_pageicon") ? node.children('a').find("span.item").html() : null;
if (!title) title = node.length > 0 ? tree.jstree('get_text', node[0]) : null;
if (title) {
self.setTitle(title);
self.data('title', title);
}
if (node) tree.jstree('select_node', node);
} else {
self.setTitle(self.data('empty-title'));
self.removeData('title');
}
};
if (!tree.is(':empty') || !val) updateFn();else this.loadTree({
forceValue: val
}, updateFn);
},
setValue: function setValue(val) {
this.data('metadata', $.extend(this.data('metadata'), {
id: val
}));
this.find(':input:hidden').val(val).trigger('valueupdated').trigger('change');
},
getValue: function getValue() {
return this.find(':input:hidden').val();
},
loadTree: function loadTree(params, callback) {
var self = this,
panel = this.getPanel(),
treeHolder = $(panel).find('.tree-holder'),
params = params ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(),
xhr;
if (this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function complete(xhr, status) {
panel.removeClass('loading');
},
success: function success(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
treeHolder.jstree('destroy').bind('loaded.jstree', function (e, data) {
var val = self.getValue(),
selectNode = treeHolder.find('*[data-id="' + val + '"]'),
currentNode = data.inst.get_selected();
if (val && selectNode != currentNode) data.inst.select_node(selectNode);
firstLoad = false;
if (callback) callback.apply(self);
}).jstree(self.getTreeConfig()).bind('select_node.jstree', function (e, data) {
var node = data.rslt.obj,
id = $(node).data('id');
if (!firstLoad && self.getValue() == id) {
self.data('metadata', null);
self.setTitle(null);
self.setValue(null);
data.inst.deselect_node(node);
} else {
self.data('metadata', $.extend({
id: id
}, $(node).getMetaData()));
self.setTitle(data.inst.get_text(node));
self.setValue(id);
}
if (!firstLoad) self.closePanel();
firstLoad = false;
});
self.setCurrentXhr(null);
}
});
this.setCurrentXhr(xhr);
},
getTreeConfig: function getTreeConfig() {
var self = this;
return {
'core': {
'html_titles': true,
'animation': 0
},
'html_data': {
'data': this.getPanel().find('.tree-holder').html(),
'ajax': {
'url': function url(node) {
var url = $.path.parseUrl(self.data('urlTree')).hrefNoSearch;
return url + '/' + ($(node).data("id") ? $(node).data("id") : 0);
},
'data': function data(node) {
var query = $.query.load(self.data('urlTree')).keys;
var params = self.getRequestParams();
params = $.extend({}, query, params, {
ajax: 1
});
return params;
}
}
},
'ui': {
"select_limit": 1,
'initially_select': [this.getPanel().find('.current').attr('id')]
},
'themes': {
'theme': 'apple'
},
'types': {
'types': {
'default': {
'check_node': function check_node(node) {
return !node.hasClass('disabled');
},
'uncheck_node': function uncheck_node(node) {
return !node.hasClass('disabled');
},
'select_node': function select_node(node) {
return !node.hasClass('disabled');
},
'deselect_node': function deselect_node(node) {
return !node.hasClass('disabled');
}
}
}
},
'plugins': ['html_data', 'ui', 'themes', 'types']
};
},
getRequestParams: function getRequestParams() {
return {};
}
});
$('.TreeDropdownField .tree-holder li').entwine({
getMetaData: function getMetaData() {
var matches = this.attr('class').match(/class-([^\s]*)/i);
var klass = matches ? matches[1] : '';
return {
ClassName: klass
};
}
});
$('.TreeDropdownField *').entwine({
getField: function getField() {
return this.parents('.TreeDropdownField:first');
}
});
$('.TreeDropdownField').entwine({
onclick: function onclick(e) {
this.togglePanel();
return false;
}
});
$('.TreeDropdownField .treedropdownfield-panel').entwine({
onclick: function onclick(e) {
return false;
}
});
$('.TreeDropdownField.searchable').entwine({
onadd: function onadd() {
this._super();
var title = _i18n2.default._t('TreeDropdownField.ENTERTOSEARCH');
this.find('.treedropdownfield-panel').prepend($('<input type="text" class="search treedropdownfield-search" data-skip-autofocus="true" placeholder="' + title + '" value="" />'));
},
search: function search(str, callback) {
this.openPanel();
this.loadTree({
search: str
}, callback);
},
cancelSearch: function cancelSearch() {
this.closePanel();
this.loadTree();
}
});
$('.TreeDropdownField.searchable input.search').entwine({
onkeydown: function onkeydown(e) {
var field = this.getField();
if (e.keyCode == 13) {
field.search(this.val());
return false;
} else if (e.keyCode == 27) {
field.cancelSearch();
}
}
});
$('.TreeDropdownField.multiple').entwine({
getTreeConfig: function getTreeConfig() {
var cfg = this._super();
cfg.checkbox = {
override_ui: true,
two_state: true
};
cfg.plugins.push('checkbox');
cfg.ui.select_limit = -1;
return cfg;
},
loadTree: function loadTree(params, callback) {
var self = this,
panel = this.getPanel(),
treeHolder = $(panel).find('.tree-holder');
var params = params ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(),
xhr;
if (this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function complete(xhr, status) {
panel.removeClass('loading');
},
success: function success(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
self.setCurrentXhr(null);
treeHolder.jstree('destroy').bind('loaded.jstree', function (e, data) {
$.each(self.getValue(), function (i, val) {
data.inst.check_node(treeHolder.find('*[data-id=' + val + ']'));
});
firstLoad = false;
if (callback) callback.apply(self);
}).jstree(self.getTreeConfig()).bind('uncheck_node.jstree check_node.jstree', function (e, data) {
var nodes = data.inst.get_checked(null, true);
self.setValue($.map(nodes, function (el, i) {
return $(el).data('id');
}));
self.setTitle($.map(nodes, function (el, i) {
return data.inst.get_text(el);
}));
self.data('metadata', $.map(nodes, function (el, i) {
return {
id: $(el).data('id'),
metadata: $(el).getMetaData()
};
}));
});
}
});
this.setCurrentXhr(xhr);
},
getValue: function getValue() {
var val = this._super();
return val.split(/ *, */);
},
setValue: function setValue(val) {
this._super($.isArray(val) ? val.join(',') : val);
},
setTitle: function setTitle(title) {
this._super($.isArray(title) ? title.join(', ') : title);
},
updateTitle: function updateTitle() {}
});
$('.TreeDropdownField input[type=hidden]').entwine({
onadd: function onadd() {
this._super();
this.bind('change.TreeDropdownField', function () {
$(this).getField().updateTitle();
});
},
onremove: function onremove() {
this._super();
this.unbind('.TreeDropdownField');
}
});
});
});

558
javascript/dist/UploadField.js vendored Normal file
View File

@ -0,0 +1,558 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.UploadField', ['./jQuery', './i18n'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'), require('./i18n'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery, global.i18n);
global.ssUploadField = mod.exports;
}
})(this, function (_jQuery, _i18n) {
var _jQuery2 = _interopRequireDefault(_jQuery);
var _i18n2 = _interopRequireDefault(_i18n);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.widget('blueimpUIX.fileupload', _jQuery2.default.blueimpUI.fileupload, {
_initTemplates: function _initTemplates() {
this.options.templateContainer = document.createElement(this._files.prop('nodeName'));
this.options.uploadTemplate = window.tmpl(this.options.uploadTemplateName);
this.options.downloadTemplate = window.tmpl(this.options.downloadTemplateName);
},
_enableFileInputButton: function _enableFileInputButton() {
_jQuery2.default.blueimpUI.fileupload.prototype._enableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').show();
},
_disableFileInputButton: function _disableFileInputButton() {
_jQuery2.default.blueimpUI.fileupload.prototype._disableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').hide();
},
_onAdd: function _onAdd(e, data) {
var result = _jQuery2.default.blueimpUI.fileupload.prototype._onAdd.call(this, e, data);
var firstNewFile = this._files.find('.ss-uploadfield-item').slice(data.files.length * -1).first();
var top = '+=' + (firstNewFile.position().top - parseInt(firstNewFile.css('marginTop'), 10) || 0 - parseInt(firstNewFile.css('borderTopWidth'), 10) || 0);
firstNewFile.offsetParent().animate({
scrollTop: top
}, 1000);
var fSize = 0;
for (var i = 0; i < data.files.length; i++) {
if (typeof data.files[i].size === 'number') {
fSize = fSize + data.files[i].size;
}
}
(0, _jQuery2.default)('.fileOverview .uploadStatus .details .total').text(data.files.length);
if (typeof fSize === 'number' && fSize > 0) {
fSize = this._formatFileSize(fSize);
(0, _jQuery2.default)('.fileOverview .uploadStatus .details .fileSize').text(fSize);
}
if (data.files.length == 1 && data.files[0].error !== null) {
(0, _jQuery2.default)('.fileOverview .uploadStatus .state').text(_i18n2.default._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
(0, _jQuery2.default)('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
} else {
(0, _jQuery2.default)('.fileOverview .uploadStatus .state').text(_i18n2.default._t('AssetUploadField.UPLOADINPROGRESS', 'Please wait… upload in progress'));
(0, _jQuery2.default)('.ss-uploadfield-item-edit-all').hide();
(0, _jQuery2.default)('.fileOverview .uploadStatus').addClass("notice").removeClass("good").removeClass("bad");
}
return result;
},
_onDone: function _onDone(result, textStatus, jqXHR, options) {
if (this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
_jQuery2.default.blueimpUI.fileupload.prototype._onDone.call(this, result, textStatus, jqXHR, options);
},
_onSend: function _onSend(e, data) {
var that = this;
var config = this.options;
if (config.overwriteWarning && config.replaceFile) {
_jQuery2.default.get(config['urlFileExists'], {
'filename': data.files[0].name
}, function (response, status, xhr) {
if (response.exists) {
data.context.find('.ss-uploadfield-item-status').text(config.errorMessages.overwriteWarning).addClass('ui-state-warning-text');
data.context.find('.ss-uploadfield-item-progress').hide();
data.context.find('.ss-uploadfield-item-overwrite').show();
data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function (e) {
data.context.find('.ss-uploadfield-item-progress').show();
data.context.find('.ss-uploadfield-item-overwrite').hide();
data.context.find('.ss-uploadfield-item-status').removeClass('ui-state-warning-text');
_jQuery2.default.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
e.preventDefault();
return false;
});
} else {
return _jQuery2.default.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
});
} else {
return _jQuery2.default.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
},
_onAlways: function _onAlways(jqXHRorResult, textStatus, jqXHRorError, options) {
_jQuery2.default.blueimpUI.fileupload.prototype._onAlways.call(this, jqXHRorResult, textStatus, jqXHRorError, options);
if (typeof jqXHRorError === 'string') {
(0, _jQuery2.default)('.fileOverview .uploadStatus .state').text(_i18n2.default._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
(0, _jQuery2.default)('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
} else if (jqXHRorError.status === 200) {
(0, _jQuery2.default)('.fileOverview .uploadStatus .state').text(_i18n2.default._t('AssetUploadField.FILEUPLOADCOMPLETED', 'File upload completed!'));
(0, _jQuery2.default)('.ss-uploadfield-item-edit-all').show();
(0, _jQuery2.default)('.fileOverview .uploadStatus').addClass("good").removeClass("notice").removeClass("bad");
}
},
_create: function _create() {
_jQuery2.default.blueimpUI.fileupload.prototype._create.call(this);
this._adjustMaxNumberOfFiles(0);
},
attach: function attach(data) {
if (this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
var self = this,
files = data.files,
replaceFileID = data.replaceFileID,
valid = true;
var replacedElement = null;
if (replaceFileID) {
replacedElement = (0, _jQuery2.default)(".ss-uploadfield-item[data-fileid='" + replaceFileID + "']");
if (replacedElement.length === 0) {
replacedElement = null;
} else {
self._adjustMaxNumberOfFiles(1);
}
}
_jQuery2.default.each(files, function (index, file) {
self._adjustMaxNumberOfFiles(-1);
error = self._validate([file]);
valid = error && valid;
});
data.isAdjusted = true;
data.files.valid = data.isValidated = valid;
data.context = this._renderDownload(files);
if (replacedElement) {
replacedElement.replaceWith(data.context);
} else {
data.context.appendTo(this._files);
}
data.context.data('data', data);
this._reflow = this._transition && data.context[0].offsetWidth;
data.context.addClass('in');
}
});
_jQuery2.default.entwine('ss', function ($) {
$('div.ss-upload').entwine({
Config: null,
onmatch: function onmatch() {
if (this.is('.readonly,.disabled')) {
return;
}
var $fileInput = this.find('.ss-uploadfield-fromcomputer-fileinput'),
$dropZone = $('.ss-uploadfield-dropzone'),
config = $fileInput.data('config');
$dropZone.on('dragover', function (e) {
e.preventDefault();
});
$dropZone.on('dragenter', function (e) {
$dropZone.addClass('hover active');
});
$dropZone.on('dragleave', function (e) {
if (e.target === $dropZone[0]) {
$dropZone.removeClass('hover active');
}
});
$dropZone.on('drop', function (e) {
$dropZone.removeClass('hover active');
if (e.target !== $dropZone[0]) {
return false;
}
});
this.setConfig(config);
this.fileupload($.extend(true, {
formData: function formData(form) {
var idVal = $(form).find(':input[name=ID]').val();
var data = [{
name: 'SecurityID',
value: $(form).find(':input[name=SecurityID]').val()
}];
if (idVal) data.push({
name: 'ID',
value: idVal
});
return data;
},
errorMessages: {
1: _i18n2.default._t('UploadField.PHP_MAXFILESIZE'),
2: _i18n2.default._t('UploadField.HTML_MAXFILESIZE'),
3: _i18n2.default._t('UploadField.ONLYPARTIALUPLOADED'),
4: _i18n2.default._t('UploadField.NOFILEUPLOADED'),
5: _i18n2.default._t('UploadField.NOTMPFOLDER'),
6: _i18n2.default._t('UploadField.WRITEFAILED'),
7: _i18n2.default._t('UploadField.STOPEDBYEXTENSION'),
maxFileSize: _i18n2.default._t('UploadField.TOOLARGESHORT'),
minFileSize: _i18n2.default._t('UploadField.TOOSMALL'),
acceptFileTypes: _i18n2.default._t('UploadField.INVALIDEXTENSIONSHORT'),
maxNumberOfFiles: _i18n2.default._t('UploadField.MAXNUMBEROFFILESSHORT'),
uploadedBytes: _i18n2.default._t('UploadField.UPLOADEDBYTES'),
emptyResult: _i18n2.default._t('UploadField.EMPTYRESULT')
},
send: function send(e, data) {
if (data.context && data.dataType && data.dataType.substr(0, 6) === 'iframe') {
data.total = 1;
data.loaded = 1;
$(this).data('fileupload').options.progress(e, data);
}
},
progress: function progress(e, data) {
if (data.context) {
var value = parseInt(data.loaded / data.total * 100, 10) + '%';
data.context.find('.ss-uploadfield-item-status').html(data.total == 1 ? _i18n2.default._t('UploadField.LOADING') : value);
data.context.find('.ss-uploadfield-item-progressbarvalue').css('width', value);
}
}
}, config, {
fileInput: $fileInput,
dropZone: $dropZone,
form: $fileInput.closest('form'),
previewAsCanvas: false,
acceptFileTypes: new RegExp(config.acceptFileTypes, 'i')
}));
if (this.data('fileupload')._isXHRUpload({
multipart: true
})) {
$('.ss-uploadfield-item-uploador').hide().show();
}
this._super();
},
onunmatch: function onunmatch() {
$('.ss-uploadfield-dropzone').off('dragover dragenter dragleave drop');
this._super();
},
openSelectDialog: function openSelectDialog(uploadedFile) {
var self = this,
config = this.getConfig(),
dialogId = 'ss-uploadfield-dialog-' + this.attr('id'),
dialog = jQuery('#' + dialogId);
if (!dialog.length) dialog = jQuery('<div class="ss-uploadfield-dialog" id="' + dialogId + '" />');
var iframeUrl = config['urlSelectDialog'];
var uploadedFileId = null;
if (uploadedFile && uploadedFile.attr('data-fileid') > 0) {
uploadedFileId = uploadedFile.attr('data-fileid');
}
dialog.ssdialog({
iframeUrl: iframeUrl,
height: 550
});
dialog.find('iframe').bind('load', function (e) {
var contents = $(this).contents(),
gridField = contents.find('.ss-gridfield');
contents.find('table.ss-gridfield').css('margin-top', 0);
contents.find('input[name=action_doAttach]').unbind('click.openSelectDialog').bind('click.openSelectDialog', function () {
var ids = $.map(gridField.find('.ss-gridfield-item.ui-selected'), function (el) {
return $(el).data('id');
});
if (ids && ids.length) self.attachFiles(ids, uploadedFileId);
dialog.ssdialog('close');
return false;
});
});
dialog.ssdialog('open');
},
attachFiles: function attachFiles(ids, uploadedFileId) {
var self = this,
config = this.getConfig(),
indicator = $('<div class="loader" />'),
target = uploadedFileId ? this.find(".ss-uploadfield-item[data-fileid='" + uploadedFileId + "']") : this.find('.ss-uploadfield-addfile');
target.children().hide();
target.append(indicator);
$.ajax({
type: "POST",
url: config['urlAttach'],
data: {
'ids': ids
},
complete: function complete(xhr, status) {
target.children().show();
indicator.remove();
},
success: function success(data, status, xhr) {
if (!data || $.isEmptyObject(data)) return;
self.fileupload('attach', {
files: data,
options: self.fileupload('option'),
replaceFileID: uploadedFileId
});
}
});
}
});
$('div.ss-upload *').entwine({
getUploadField: function getUploadField() {
return this.parents('div.ss-upload:first');
}
});
$('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item').entwine({
onadd: function onadd() {
this._super();
this.closest('.ss-upload').find('.ss-uploadfield-addfile').addClass('borderTop');
},
onremove: function onremove() {
$('.ss-uploadfield-files:not(:has(.ss-uploadfield-item))').closest('.ss-upload').find('.ss-uploadfield-addfile').removeClass('borderTop');
this._super();
}
});
$('div.ss-upload .ss-uploadfield-startall').entwine({
onclick: function onclick(e) {
this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click();
e.preventDefault();
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({
onclick: function onclick(e) {
this.closest('.ss-uploadfield-item').remove();
e.preventDefault();
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-remove:not(.ui-state-disabled), .ss-uploadfield-item-delete:not(.ui-state-disabled)').entwine({
onclick: function onclick(e) {
var field = this.closest('div.ss-upload'),
config = field.getConfig('changeDetection'),
fileupload = field.data('fileupload'),
item = this.closest('.ss-uploadfield-item'),
msg = '';
if (this.is('.ss-uploadfield-item-delete')) {
if (confirm(_i18n2.default._t('UploadField.ConfirmDelete'))) {
if (config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {
context: item,
url: this.data('href'),
type: 'get',
dataType: fileupload.options.dataType
});
}
}
} else {
if (config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {
context: item
});
}
}
e.preventDefault();
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-edit-all').entwine({
onclick: function onclick(e) {
if ($(this).hasClass('opened')) {
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon.opened').each(function (i) {
$(this).closest('.ss-uploadfield-item-edit').click();
});
$(this).removeClass('opened').find('.toggle-details-icon').removeClass('opened');
} else {
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon').each(function (i) {
if (!$(this).hasClass('opened')) {
$(this).closest('.ss-uploadfield-item-edit').click();
}
});
$(this).addClass('opened').find('.toggle-details-icon').addClass('opened');
}
e.preventDefault();
return false;
}
});
$('div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
onclick: function onclick(e) {
var self = this,
editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
itemInfo = editform.prev('.ss-uploadfield-item-info'),
iframe = editform.find('iframe');
if (iframe.parent().hasClass('loading')) {
e.preventDefault();
return false;
}
if (iframe.attr('src') == 'about:blank') {
iframe.attr('src', iframe.data('src'));
iframe.parent().addClass('loading');
disabled = this.siblings();
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
iframe.on('load', function () {
iframe.parent().removeClass('loading');
if (iframe.data('src')) {
self._prepareIframe(iframe, editform, itemInfo);
iframe.data('src', '');
}
});
} else {
self._prepareIframe(iframe, editform, itemInfo);
}
e.preventDefault();
return false;
},
_prepareIframe: function _prepareIframe(iframe, editform, itemInfo) {
var disabled;
iframe.contents().ready(function () {
var iframe_jQuery = iframe.get(0).contentWindow.jQuery;
iframe_jQuery(iframe_jQuery.find(':input')).bind('change', function (e) {
editform.removeClass('edited');
editform.addClass('edited');
});
});
if (editform.hasClass('loading')) {} else {
if (this.hasClass('ss-uploadfield-item-edit')) {
disabled = this.siblings();
} else {
disabled = this.find('ss-uploadfield-item-edit').siblings();
}
editform.parent('.ss-uploadfield-item').removeClass('ui-state-warning');
editform.toggleEditForm();
if (itemInfo.find('.toggle-details-icon').hasClass('opened')) {
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
} else {
disabled.removeClass('ui-state-disabled');
disabled.removeAttr('disabled');
}
}
}
});
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
fitHeight: function fitHeight() {
var iframe = this.find('iframe'),
contents = iframe.contents().find('body'),
bodyH = contents.find('form').outerHeight(true),
iframeH = bodyH + (iframe.outerHeight(true) - iframe.height()),
containerH = iframeH + (this.outerHeight(true) - this.height());
if (!$.browser.msie && $.browser.version.slice(0, 3) != "8.0") {
contents.find('body').css({
'height': bodyH
});
}
iframe.height(iframeH);
this.animate({
height: containerH
}, 500);
},
toggleEditForm: function toggleEditForm() {
var itemInfo = this.prev('.ss-uploadfield-item-info'),
status = itemInfo.find('.ss-uploadfield-item-status');
var iframe = this.find('iframe').contents(),
saved = iframe.find('#Form_EditForm_error');
var text = "";
if (this.height() === 0) {
text = _i18n2.default._t('UploadField.Editing', "Editing ...");
this.fitHeight();
this.addClass('opened');
itemInfo.find('.toggle-details-icon').addClass('opened');
status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
iframe.find('#Form_EditForm_action_doEdit').click(function () {
itemInfo.find('label .name').text(iframe.find('#Name input').val());
});
if ($('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item-actions .toggle-details-icon:not(.opened)').index() < 0) {
$('div.ss-upload .ss-uploadfield-item-edit-all').addClass('opened').find('.toggle-details-icon').addClass('opened');
}
} else {
this.animate({
height: 0
}, 500);
this.removeClass('opened');
itemInfo.find('.toggle-details-icon').removeClass('opened');
$('div.ss-upload .ss-uploadfield-item-edit-all').removeClass('opened').find('.toggle-details-icon').removeClass('opened');
if (!this.hasClass('edited')) {
text = _i18n2.default._t('UploadField.NOCHANGES', 'No Changes');
status.addClass('ui-state-success-text');
} else {
if (saved.hasClass('good')) {
text = _i18n2.default._t('UploadField.CHANGESSAVED', 'Changes Saved');
this.removeClass('edited').parent('.ss-uploadfield-item').removeClass('ui-state-warning');
status.addClass('ui-state-success-text');
} else {
text = _i18n2.default._t('UploadField.UNSAVEDCHANGES', 'Unsaved Changes');
this.parent('.ss-uploadfield-item').addClass('ui-state-warning');
status.addClass('ui-state-warning-text');
}
}
saved.removeClass('good').hide();
}
status.attr('title', text).text(text);
}
});
$('div.ss-upload .ss-uploadfield-fromfiles').entwine({
onclick: function onclick(e) {
this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item'));
e.preventDefault();
return false;
}
});
});
});

View File

@ -0,0 +1,17 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.UploadField_downloadtemplate', [], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.ssUploadField_downloadtemplate = mod.exports;
}
})(this, function () {
window.tmpl.cache['ss-uploadfield-downloadtemplate'] = tmpl('{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' + '<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% } %}" data-fileid="{%=file.id%}">' + '{% if (file.thumbnail_url) { %}' + '<div class="ss-uploadfield-item-preview preview"><span>' + '<img src="{%=file.thumbnail_url%}" alt="" />' + '</span></div>' + '{% } %}' + '<div class="ss-uploadfield-item-info">' + '{% if (!file.error && file.id) { %}' + '<input type="hidden" name="{%=file.fieldname%}[Files][]" value="{%=file.id%}" />' + '{% } %}' + '{% if (!file.error && file.filename) { %}' + '<input type="hidden" value="{%=file.filename%}" name="{%=file.fieldname%}[Filename]" />' + '<input type="hidden" value="{%=file.hash%}" name="{%=file.fieldname%}[Hash]" />' + '<input type="hidden" value="{%=file.variant%}" name="{%=file.fieldname%}[Variant]" />' + '{% } %}' + '<label class="ss-uploadfield-item-name">' + '<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' + '<span class="size">{%=o.formatFileSize(file.size)%}</span>' + '{% if (!file.error) { %}' + '<div class="ss-uploadfield-item-status ui-state-success-text" title="' + ss.i18n._t('UploadField.Uploaded', 'Uploaded') + '">' + ss.i18n._t('UploadField.Uploaded', 'Uploaded') + '</div>' + '{% } else { %}' + '<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' + '{% } %}' + '<div class="clear"><!-- --></div>' + '</label>' + '{% if (file.error) { %}' + '<div class="ss-uploadfield-item-actions">' + '<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed delete"><button type="button" class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' + '</div>' + '{% } else { %}' + '<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' + '{% } %}' + '</div>' + '{% if (!file.error) { %}' + '<div class="ss-uploadfield-item-editform"><iframe frameborder="0" data-src="{%=file.edit_url%}" src="about:blank"></iframe></div>' + '{% } %}' + '</li>' + '{% } %}');
});

41
javascript/dist/UploadField_select.js vendored Normal file
View File

@ -0,0 +1,41 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.UploadField_select', ['./jQuery'], factory);
} else if (typeof exports !== "undefined") {
factory(require('./jQuery'));
} else {
var mod = {
exports: {}
};
factory(global.jQuery);
global.ssUploadField_select = mod.exports;
}
})(this, function (_jQuery) {
var _jQuery2 = _interopRequireDefault(_jQuery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
_jQuery2.default.entwine('ss', function ($) {
$('form.uploadfield-form .TreeDropdownField').entwine({
onmatch: function onmatch() {
this._super();
var self = this;
this.bind('change', function () {
var fileList = self.closest('form').find('.ss-gridfield');
fileList.setState('ParentID', self.getValue());
fileList.reload();
});
},
onunmatch: function onunmatch() {
this._super();
}
});
});
});

View File

@ -0,0 +1,17 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.UploadField_uploadtemplate', [], factory);
} else if (typeof exports !== "undefined") {
factory();
} else {
var mod = {
exports: {}
};
factory();
global.ssUploadField_uploadtemplate = mod.exports;
}
})(this, function () {
window.tmpl.cache['ss-uploadfield-uploadtemplate'] = tmpl('{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' + '<li class="ss-uploadfield-item template-upload{% if (file.error) { %} ui-state-error{% } %}">' + '<div class="ss-uploadfield-item-preview preview"><span></span></div>' + '<div class="ss-uploadfield-item-info">' + '<label class="ss-uploadfield-item-name">' + '<span class="name" title="{% if (file.name) { %}{%=file.name%}{% } else { %}' + ss.i18n._t('UploadField.NOFILENAME', 'Untitled') + '{% } %}">' + '{% if (file.name) { %}{%=file.name%}{% } else { %}' + ss.i18n._t('UploadField.NOFILENAME', 'Untitled') + '{% } %}</span> ' + '{% if (!file.error) { %}' + '<div class="ss-uploadfield-item-status">0%</div>' + '{% } else { %}' + '<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' + '{% } %}' + '<div class="clear"><!-- --></div>' + '</label>' + '<div class="ss-uploadfield-item-actions">' + '{% if (!file.error) { %}' + '<div class="ss-uploadfield-item-progress"><div class="ss-uploadfield-item-progressbar"><div class="ss-uploadfield-item-progressbarvalue"></div></div></div>' + '{% if (!o.options.autoUpload) { %}' + '<div class="ss-uploadfield-item-start start"><button type="button" class="icon icon-16" data-icon="navigation">' + ss.i18n._t('UploadField.START', 'Start') + '</button></div>' + '{% } %}' + '{% } %}' + '<div class="ss-uploadfield-item-cancel cancel">' + '<button type="button" class="icon icon-16" data-icon="minus-circle" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button>' + '</div>' + '<div class="ss-uploadfield-item-overwrite hide ">' + '<button type="button" data-icon="drive-upload" class="ss-uploadfield-item-overwrite-warning" title="' + ss.i18n._t('UploadField.OVERWRITE', 'Overwrite') + '">' + ss.i18n._t('UploadField.OVERWRITE', 'Overwrite') + '</button>' + '</div>' + '</div>' + '</div>' + '</li>' + '{% } %}');
});

202
javascript/dist/i18n.js vendored Normal file
View File

@ -0,0 +1,202 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.i18n', ['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.ssI18n = mod.exports;
}
})(this, function (exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var i18n = function () {
function i18n() {
_classCallCheck(this, i18n);
this.currentLocale = null;
this.defaultLocale = 'en_US';
this.lang = {};
}
_createClass(i18n, [{
key: 'setLocale',
value: function setLocale(locale) {
this.currentLocale = locale;
}
}, {
key: 'getLocale',
value: function getLocale() {
return this.currentLocale !== null ? this.currentLocale : this.defaultLocale;
}
}, {
key: '_t',
value: function _t(entity, fallbackString, priority, context) {
var langName = this.getLocale().replace(/_[\w]+/i, '');
var defaultlangName = this.defaultLocale.replace(/_[\w]+/i, '');
if (this.lang && this.lang[this.getLocale()] && this.lang[this.getLocale()][entity]) {
return this.lang[this.getLocale()][entity];
} else if (this.lang && this.lang[langName] && this.lang[langName][entity]) {
return this.lang[langName][entity];
} else if (this.lang && this.lang[this.defaultLocale] && this.lang[this.defaultLocale][entity]) {
return this.lang[this.defaultLocale][entity];
} else if (this.lang && this.lang[defaultlangName] && this.lang[defaultlangName][entity]) {
return this.lang[defaultlangName][entity];
} else if (fallbackString) {
return fallbackString;
} else {
return '';
}
}
}, {
key: 'addDictionary',
value: function addDictionary(locale, dict) {
if (typeof this.lang[locale] === 'undefined') {
this.lang[locale] = {};
}
for (var entity in dict) {
this.lang[locale][entity] = dict[entity];
}
}
}, {
key: 'getDictionary',
value: function getDictionary(locale) {
return this.lang[locale];
}
}, {
key: 'stripStr',
value: function stripStr(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
}, {
key: 'stripStrML',
value: function stripStrML(str) {
var parts = str.split('\n');
for (var i = 0; i < parts.length; i += 1) {
parts[i] = stripStr(parts[i]);
}
return stripStr(parts.join(' '));
}
}, {
key: 'sprintf',
value: function sprintf(s) {
for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
params[_key - 1] = arguments[_key];
}
if (params.length === 0) {
return s;
}
var regx = new RegExp('(.?)(%s)', 'g');
var i = 0;
return s.replace(regx, function (match, subMatch1, subMatch2, offset, string) {
if (subMatch1 === '%') {
return match;
}
return subMatch1 + params[i += 1];
});
}
}, {
key: 'inject',
value: function inject(s, map) {
var regx = new RegExp('\{([A-Za-z0-9_]*)\}', 'g');
return s.replace(regx, function (match, key, offset, string) {
return map[key] ? map[key] : match;
});
}
}, {
key: 'detectLocale',
value: function detectLocale() {
var rawLocale;
var detectedLocale;
rawLocale = jQuery('body').attr('lang');
if (!rawLocale) {
var metas = document.getElementsByTagName('meta');
for (var i = 0; i < metas.length; i++) {
if (metas[i].attributes['http-equiv'] && metas[i].attributes['http-equiv'].nodeValue.toLowerCase() == 'content-language') {
rawLocale = metas[i].attributes['content'].nodeValue;
}
}
}
if (!rawLocale) {
rawLocale = this.defaultLocale;
}
var rawLocaleParts = rawLocale.match(/([^-|_]*)[-|_](.*)/);
if (rawLocale.length == 2) {
for (var compareLocale in i18n.lang) {
if (compareLocale.substr(0, 2).toLowerCase() == rawLocale.toLowerCase()) {
detectedLocale = compareLocale;
break;
}
}
} else if (rawLocaleParts) {
detectedLocale = rawLocaleParts[1].toLowerCase() + '_' + rawLocaleParts[2].toUpperCase();
}
return detectedLocale;
}
}, {
key: 'addEvent',
value: function addEvent(obj, evType, fn, useCapture) {
if (obj.addEventListener) {
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent) {
return obj.attachEvent('on' + evType, fn);
} else {
console.log('Handler could not be attached');
}
}
}]);
return i18n;
}();
var _i18n = new i18n();
window.ss = typeof window.ss !== 'undefined' ? window.ss : {};
window.ss.i18n = window.i18n = _i18n;
exports.default = _i18n;
});

102
javascript/dist/i18nx.js vendored Normal file
View File

@ -0,0 +1,102 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.i18nx', ['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.ssI18nx = mod.exports;
}
})(this, function (exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var i18nx = function () {
function i18nx() {
_classCallCheck(this, i18nx);
this.currentLocale = 'en_US';
this.defaultLocale = 'en_US';
}
_createClass(i18nx, [{
key: '_t',
value: function _t(entity, fallbackString, priority, context) {
return fallbackString;
}
}, {
key: 'sprintf',
value: function sprintf(s) {
for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
params[_key - 1] = arguments[_key];
}
if (params.length === 0) {
return s;
}
var regx = new RegExp('(.?)(%s)', 'g');
var i = 0;
return s.replace(regx, function (match, subMatch1, subMatch2, offset, string) {
if (subMatch1 === '%') {
return match;
}
return subMatch1 + params[i += 1];
});
}
}, {
key: 'inject',
value: function inject(s, map) {
var regx = new RegExp('\{([A-Za-z0-9_]*)\}', 'g');
return s.replace(regx, function (match, key, offset, string) {
return map[key] ? map[key] : match;
});
}
}, {
key: 'addDictionary',
value: function addDictionary() {}
}, {
key: 'getDictionary',
value: function getDictionary() {}
}]);
return i18nx;
}();
;
var _i18nx = new i18nx();
exports.default = _i18nx;
});

21
javascript/dist/jQuery.js vendored Normal file
View File

@ -0,0 +1,21 @@
'use strict';
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define('ss.jQuery', ['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.ssJQuery = mod.exports;
}
})(this, function (exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var jQuery = typeof window.jQuery !== 'undefined' ? window.jQuery : null;
exports.default = jQuery;
});

View File

@ -0,0 +1,29 @@
import $ from './jQuery';
$('.ss-assetuploadfield').entwine({
onmatch: function() {
this._super();
// Hide the "second step" part until we're actually uploading
this.find('.ss-uploadfield-editandorganize').hide();
},
onunmatch: function() {
this._super();
},
onfileuploadadd: function(e) {
this.find('.ss-uploadfield-editandorganize').show();
},
onfileuploadstart: function(e) {
this.find('.ss-uploadfield-editandorganize').show();
}
});
$('.ss-uploadfield-view-allowed-extensions .toggle').entwine({
onclick: function(e) {
var allowedExt = this.closest('.ss-uploadfield-view-allowed-extensions'),
minHeightVal = this.closest('.ui-tabs-panel').height() + 20;
allowedExt.toggleClass('active');
allowedExt.find('.toggle-content').css('minHeight', minHeightVal);
}
});

View File

@ -0,0 +1,11 @@
import $ from './jQuery';
$(document).on('click', '.confirmedpassword .showOnClick a', function () {
var $container = $('.showOnClickContainer', $(this).parent());
$container.toggle('fast', function() {
$container.find('input[type="hidden"]').val($container.is(":visible") ? 1 : 0);
});
return false;
});

View File

@ -0,0 +1,35 @@
import $ from './jQuery';
$.fn.extend({
ssDatepicker: function(opts) {
return $(this).each(function() {
if($(this).data('datepicker')) return; // already applied
$(this).siblings("button").addClass("ui-icon ui-icon-calendar");
var holder = $(this).parents('.field.date:first'),
config = $.extend(opts || {}, $(this).data(), $(this).data('jqueryuiconfig'), {});
if(!config.showcalendar) return;
if(config.locale && $.datepicker.regional[config.locale]) {
config = $.extend(config, $.datepicker.regional[config.locale], {});
}
if(config.min) config.minDate = $.datepicker.parseDate('yy-mm-dd', config.min);
if(config.max) config.maxDate = $.datepicker.parseDate('yy-mm-dd', config.max);
// Initialize and open a datepicker
// live() doesn't have "onmatch", and jQuery.entwine is a bit too heavyweight for this, so we need to do this onclick.
config.dateFormat = config.jquerydateformat;
$(this).datepicker(config);
});
}
});
$(document).on("click", ".field.date input.text,input.text.date", function() {
$(this).ssDatepicker();
if($(this).data('datepicker')) {
$(this).datepicker('show');
}
});

410
javascript/src/GridField.js Normal file
View File

@ -0,0 +1,410 @@
import $ from './jQuery';
import i18n from './i18n';
$.entwine('ss', function($) {
$('.ss-gridfield').entwine({
/**
* @param {Object} Additional options for jQuery.ajax() call
* @param {successCallback} callback to call after reloading succeeded.
*/
reload: function(ajaxOpts, successCallback) {
var self = this, form = this.closest('form'),
focusedElName = this.find(':input:focus').attr('name'), // Save focused element for restoring after refresh
data = form.find(':input').serializeArray();
if(!ajaxOpts) ajaxOpts = {};
if(!ajaxOpts.data) ajaxOpts.data = [];
ajaxOpts.data = ajaxOpts.data.concat(data);
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
if(window.location.search) {
ajaxOpts.data = window.location.search.replace(/^\?/, '') + '&' + $.param(ajaxOpts.data);
}
// For browsers which do not support history.pushState like IE9, ss framework uses hash to track
// the current location for PJAX, so for them we pass the query string stored in the hash instead
if(!window.history || !window.history.pushState){
if(window.location.hash && window.location.hash.indexOf('?') != -1){
ajaxOpts.data = window.location.hash.substring(window.location.hash.indexOf('?') + 1) + '&' + $.param(ajaxOpts.data);
}
}
form.addClass('loading');
$.ajax($.extend({}, {
headers: {"X-Pjax" : 'CurrentField'},
type: "POST",
url: this.data('url'),
dataType: 'html',
success: function(data) {
// Replace the grid field with response, not the form.
// TODO Only replaces all its children, to avoid replacing the current scope
// of the executing method. Means that it doesn't retrigger the onmatch() on the main container.
self.empty().append($(data).children());
// Refocus previously focused element. Useful e.g. for finding+adding
// multiple relationships via keyboard.
if(focusedElName) self.find(':input[name="' + focusedElName + '"]').focus();
// Update filter
if(self.find('.filter-header').length) {
var content;
if(ajaxOpts.data[0].filter=="show") {
content = '<span class="non-sortable"></span>';
self.addClass('show-filter').find('.filter-header').show();
} else {
content = '<button type="button" name="showFilter" class="ss-gridfield-button-filter trigger"></button>';
self.removeClass('show-filter').find('.filter-header').hide();
}
self.find('.sortable-header th:last').html(content);
}
form.removeClass('loading');
if(successCallback) successCallback.apply(this, arguments);
self.trigger('reload', self);
},
error: function(e) {
alert(i18n._t('GRIDFIELD.ERRORINTRANSACTION'));
form.removeClass('loading');
}
}, ajaxOpts));
},
showDetailView: function(url) {
window.location.href = url;
},
getItems: function() {
return this.find('.ss-gridfield-item');
},
/**
* @param {String}
* @param {Mixed}
*/
setState: function(k, v) {
var state = this.getState();
state[k] = v;
this.find(':input[name="' + this.data('name') + '[GridState]"]').val(JSON.stringify(state));
},
/**
* @return {Object}
*/
getState: function() {
return JSON.parse(this.find(':input[name="' + this.data('name') + '[GridState]"]').val());
}
});
$('.ss-gridfield *').entwine({
getGridField: function() {
return this.closest('.ss-gridfield');
}
});
$('.ss-gridfield :button[name=showFilter]').entwine({
onclick: function(e) {
$('.filter-header')
.show('slow') // animate visibility
.find(':input:first').focus(); // focus first search field
this.closest('.ss-gridfield').addClass('show-filter');
this.parent().html('<span class="non-sortable"></span>');
e.preventDefault();
}
});
$('.ss-gridfield .ss-gridfield-item').entwine({
onclick: function(e) {
if($(e.target).closest('.action').length) {
this._super(e);
return false;
}
var editLink = this.find('.edit-link');
if(editLink.length) this.getGridField().showDetailView(editLink.prop('href'));
},
onmouseover: function() {
if(this.find('.edit-link').length) this.css('cursor', 'pointer');
},
onmouseout: function() {
this.css('cursor', 'default');
}
});
$('.ss-gridfield .action').entwine({
onclick: function(e){
var filterState='show'; //filterstate should equal current state.
// If the button is disabled, do nothing.
if (this.button('option', 'disabled')) {
e.preventDefault();
return;
}
if(this.hasClass('ss-gridfield-button-close') || !(this.closest('.ss-gridfield').hasClass('show-filter'))){
filterState='hidden';
}
this.getGridField().reload({data: [{name: this.attr('name'), value: this.val(), filter: filterState}]});
e.preventDefault();
}
});
/**
* Don't allow users to submit empty values in grid field auto complete inputs.
*/
$('.ss-gridfield .add-existing-autocompleter').entwine({
onbuttoncreate: function () {
var self = this;
this.toggleDisabled();
this.find('input[type="text"]').on('keyup', function () {
self.toggleDisabled();
});
},
onunmatch: function () {
this.find('input[type="text"]').off('keyup');
},
toggleDisabled: function () {
var $button = this.find('.ss-ui-button'),
$input = this.find('input[type="text"]'),
inputHasValue = $input.val() !== '',
buttonDisabled = $button.is(':disabled');
if ((inputHasValue && buttonDisabled) || (!inputHasValue && !buttonDisabled)) {
$button.button("option", "disabled", !buttonDisabled);
}
}
});
// Covers both tabular delete button, and the button on the detail form
$('.ss-gridfield .col-buttons .action.gridfield-button-delete, .cms-edit-form .Actions button.action.action-delete').entwine({
onclick: function(e){
if(!confirm(i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE'))) {
e.preventDefault();
return false;
} else {
this._super(e);
}
}
});
$('.ss-gridfield .action.gridfield-button-print').entwine({
UUID: null,
onmatch: function() {
this._super();
this.setUUID(new Date().getTime());
},
onunmatch: function() {
this._super();
},
onclick: function(e){
var btn = this.closest(':button'), grid = this.getGridField(),
form = this.closest('form'), data = form.find(':input.gridstate').serialize();;
// Add current button
data += "&" + encodeURIComponent(btn.attr('name')) + '=' + encodeURIComponent(btn.val());
// Include any GET parameters from the current URL, as the view
// state might depend on it.
// For example, a list prefiltered through external search criteria
// might be passed to GridField.
if(window.location.search) {
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
// decide whether we should use ? or & to connect the URL
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
var url = $.path.makeUrlAbsolute(
grid.data('url') + connector + data,
$('base').attr('href')
);
var newWindow = window.open(url);
return false;
}
});
$('.ss-gridfield-print-iframe').entwine({
onmatch: function(){
this._super();
this.hide().bind('load', function() {
this.focus();
var ifWin = this.contentWindow || this;
ifWin.print();
});
},
onunmatch: function() {
this._super();
}
});
/**
* Prevents actions from causing an ajax reload of the field.
*
* Useful e.g. for actions which rely on HTTP response headers being
* interpreted natively by the browser, like file download triggers.
*/
$('.ss-gridfield .action.no-ajax').entwine({
onclick: function(e){
var self = this, btn = this.closest(':button'), grid = this.getGridField(),
form = this.closest('form'), data = form.find(':input.gridstate').serialize();
// Add current button
data += "&" + encodeURIComponent(btn.attr('name')) + '=' + encodeURIComponent(btn.val());
// Include any GET parameters from the current URL, as the view
// state might depend on it. For example, a list pre-filtered
// through external search criteria might be passed to GridField.
if(window.location.search) {
data = window.location.search.replace(/^\?/, '') + '&' + data;
}
// decide whether we should use ? or & to connect the URL
var connector = grid.data('url').indexOf('?') == -1 ? '?' : '&';
window.location.href = $.path.makeUrlAbsolute(
grid.data('url') + connector + data,
$('base').attr('href')
);
return false;
}
});
$('.ss-gridfield .action-detail').entwine({
onclick: function() {
this.getGridField().showDetailView($(this).prop('href'));
return false;
}
});
/**
* Allows selection of one or more rows in the grid field.
* Purely clientside at the moment.
*/
$('.ss-gridfield[data-selectable]').entwine({
/**
* @return {jQuery} Collection
*/
getSelectedItems: function() {
return this.find('.ss-gridfield-item.ui-selected');
},
/**
* @return {Array} Of record IDs
*/
getSelectedIDs: function() {
return $.map(this.getSelectedItems(), function(el) {return $(el).data('id');});
}
});
$('.ss-gridfield[data-selectable] .ss-gridfield-items').entwine({
onadd: function() {
this._super();
// TODO Limit to single selection
this.selectable();
},
onremove: function() {
this._super();
if (this.data('selectable')) this.selectable('destroy');
}
});
/**
* Catch submission event in filter input fields, and submit the correct button
* rather than the whole form.
*/
$('.ss-gridfield .filter-header :input').entwine({
onmatch: function() {
var filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'),
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if(this.val()) {
filterbtn.addClass('filtered');
resetbtn.addClass('filtered');
}
this._super();
},
onunmatch: function() {
this._super();
},
onkeydown: function(e) {
// Skip reset button events, they should trigger default submission
if(this.closest('.ss-gridfield-button-reset').length) return;
var filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'),
resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset');
if(e.keyCode == '13') {
var btns = this.closest('.filter-header').find('.ss-gridfield-button-filter');
var filterState='show'; //filterstate should equal current state.
if(this.hasClass('ss-gridfield-button-close')||!(this.closest('.ss-gridfield').hasClass('show-filter'))){
filterState='hidden';
}
this.getGridField().reload({data: [{name: btns.attr('name'), value: btns.val(), filter: filterState}]});
return false;
}else{
filterbtn.addClass('hover-alike');
resetbtn.addClass('hover-alike');
}
}
});
$(".ss-gridfield .relation-search").entwine({
onfocusin: function (event) {
this.autocomplete({
source: function(request, response){
var searchField = $(this.element);
var form = $(this.element).closest("form");
$.ajax({
headers: {
"X-Pjax" : 'Partial'
},
type: "GET",
url: $(searchField).data('searchUrl'),
data: encodeURIComponent(searchField.attr('name'))+'='+encodeURIComponent(searchField.val()),
success: function(data) {
response(JSON.parse(data));
},
error: function(e) {
alert(i18n._t('GRIDFIELD.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.'));
}
});
},
select: function(event, ui) {
$(this).closest(".ss-gridfield").find("#action_gridfield_relationfind").replaceWith(
'<input type="hidden" name="relationID" value="'+ui.item.id+'" id="relationID"/>'
);
var addbutton = $(this).closest(".ss-gridfield").find("#action_gridfield_relationadd");
if(addbutton.data('button')){
addbutton.button('enable');
}else{
addbutton.removeAttr('disabled');
}
}
});
}
});
$(".ss-gridfield .pagination-page-number input").entwine({
onkeydown: function(event) {
if(event.keyCode == 13) {
var newpage = parseInt($(this).val(), 10);
var gridfield = $(this).getGridField();
gridfield.setState('GridFieldPaginator', {currentPage: newpage});
gridfield.reload();
return false;
}
}
});
});

View File

@ -6,7 +6,11 @@
* ajax / iframe submissions
*/
var ss = ss || {};
import $ from './jQuery';
import i18n from './i18n';
var ss = typeof window.ss !== 'undefined' ? window.ss : {};
/**
* Wrapper for HTML WYSIWYG libraries, which abstracts library internals
* from interface concerns like inserting and editing links.
@ -259,9 +263,6 @@ ss.editorWrappers.tinyMCE = (function() {
// Override this to switch editor wrappers
ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
(function($) {
$.entwine('ss', function($) {
/**
@ -434,7 +435,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
autoOpen: true,
buttons: {
'insert': {
text: ss.i18n._t(
text: i18n._t(
'HtmlEditorField.INSERT',
'Insert'
),
@ -776,7 +777,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
default:
// This type does not support anchors at all.
dfdAnchors.reject(ss.i18n._t(
dfdAnchors.reject(i18n._t(
'HtmlEditorField.ANCHORSNOTSUPPORTED',
'Anchors are not supported for this link type.'
));
@ -798,7 +799,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
selector.empty();
selector.append($(
'<option value="" selected="1">' +
ss.i18n._t('HtmlEditorField.LOOKINGFORANCHORS', 'Looking for anchors...') +
i18n._t('HtmlEditorField.LOOKINGFORANCHORS', 'Looking for anchors...') +
'</option>'
));
@ -806,7 +807,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
selector.empty();
selector.append($(
'<option value="" selected="1">' +
ss.i18n._t('HtmlEditorField.SelectAnchor') +
i18n._t('HtmlEditorField.SelectAnchor') +
'</option>'
));
@ -1059,15 +1060,15 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
//When inserting an image from a URL
mediaFormHeading
.show()
.text(ss.i18n._t("HtmlEditorField.INSERTURL"))
.prepend('<button class="back-button font-icon-left-open no-text" title="' + ss.i18n._t("HtmlEditorField.BACK") + '"></button>');
.text(i18n._t("HtmlEditorField.INSERTURL"))
.prepend('<button class="back-button font-icon-left-open no-text" title="' + i18n._t("HtmlEditorField.BACK") + '"></button>');
this.find('.htmleditorfield-web-panel input.remoteurl').focus();
} else {
//Default view when modal is opened
mediaFormHeading
.show()
.text(ss.i18n._t("HtmlEditorField.INSERTFROM"))
.text(i18n._t("HtmlEditorField.INSERTFROM"))
.find('.back-button').remove();
}
@ -1082,10 +1083,10 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this.closest('.ui-dialog').addClass('ss-uploadfield-dropzone');
this.closest('.ui-dialog')
.find('.ui-dialog-buttonpane .media-insert .ui-button-text')
.text([editingSelected ? ss.i18n._t(
.text([editingSelected ? i18n._t(
'HtmlEditorField.UPDATE',
'Update'
) : ss.i18n._t(
) : i18n._t(
'HtmlEditorField.INSERT',
'Insert'
)]);
@ -1588,7 +1589,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
var text="";
if(bool === true || (bool !== false && this.height() === 0)) {
text = ss.i18n._t('UploadField.Editing', "Editing ...");
text = i18n._t('UploadField.Editing', "Editing ...");
this.height('auto');
itemInfo.find('.toggle-details-icon').addClass('opened');
status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
@ -1596,10 +1597,10 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this.height(0);
itemInfo.find('.toggle-details-icon').removeClass('opened');
if(!this.hasClass('edited')){
text = ss.i18n._t('UploadField.NOCHANGES', 'No Changes');
text = i18n._t('UploadField.NOCHANGES', 'No Changes');
status.addClass('ui-state-success-text');
}else{
text = ss.i18n._t('UploadField.CHANGESSAVED', 'Changes Made');
text = i18n._t('UploadField.CHANGESSAVED', 'Changes Made');
this.removeClass('edited');
status.addClass('ui-state-success-text');
}
@ -1625,13 +1626,12 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
});
});
})(jQuery);
/**
* These callback globals hook it into tinymce. They need to be referenced in the TinyMCE config.
*/
function sapphiremce_cleanup(type, value) {
window.sapphiremce_cleanup = function sapphiremce_cleanup(type, value) {
if(type == 'get_from_editor') {
// replace VML pixel image references with image tags - experimental

View File

@ -0,0 +1,83 @@
import $ from './jQuery';
$.entwine('ss', function($){
/**
* Automatically check and disable all checkboxes if ADMIN permissions are selected.
* As they're disabled, any changes won't be submitted (which is intended behaviour),
* checking all boxes is purely presentational.
*/
$('.permissioncheckboxset .valADMIN input').entwine({
onmatch: function() {
this._super();
},
onunmatch: function() {
this._super();
},
onclick: function(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function() {
var checkboxes = $(this).parents('.field:eq(0)').find('.checkbox').not(this);
if($(this).is(':checked')) {
checkboxes.each(function() {
$(this).data('SecurityAdmin.oldChecked', $(this).attr('checked'));
$(this).data('SecurityAdmin.oldDisabled', $(this).attr('disabled'));
$(this).attr('disabled', 'disabled');
$(this).attr('checked', 'checked');
});
} else {
checkboxes.each(function() {
// only update attributes if previous values have been saved
var oldChecked = $(this).data('SecurityAdmin.oldChecked');
var oldDisabled = $(this).data('SecurityAdmin.oldDisabled');
if(oldChecked !== null) $(this).attr('checked', oldChecked);
if(oldDisabled !== null) $(this).attr('disabled', oldDisabled);
});
}
}
});
/**
* Automatically check all "CMS section" checkboxes when "Access to all CMS interfaces" is ticked.
*
* @todo This should really be abstracted into a declarative dependency system
* instead of custom logic.
*/
$('.permissioncheckboxset .valCMS_ACCESS_LeftAndMain input').entwine({
getCheckboxesExceptThisOne: function() {
return $(this).parents('.field:eq(0)').find('li').filter(function(i) {
var klass = $(this).attr('class');
return (klass ? klass.match(/CMS_ACCESS_/) : false);
}).find('.checkbox').not(this);
},
onmatch: function() {
this.toggleCheckboxes();
this._super();
},
onunmatch: function() {
this._super();
},
onclick: function(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function() {
var checkboxes = this.getCheckboxesExceptThisOne();
if($(this).is(':checked')) {
checkboxes.each(function() {
$(this).data('PermissionCheckboxSetField.oldChecked', $(this).is(':checked'));
$(this).data('PermissionCheckboxSetField.oldDisabled', $(this).is(':disabled'));
$(this).prop('disabled', 'disabled');
$(this).prop('checked', 'checked');
});
} else {
checkboxes.each(function() {
$(this).prop('checked', $(this).data('PermissionCheckboxSetField.oldChecked'));
$(this).prop('disabled', $(this).data('PermissionCheckboxSetField.oldDisabled'));
});
}
}
});
});

View File

@ -0,0 +1,15 @@
import $ from './jQuery';
$(document).ready(function() {
$('ul.SelectionGroup input.selector').live('click', function() {
var li = $(this).closest('li');
li.addClass('selected');
var prev = li.prevAll('li.selected');
if(prev.length) prev.removeClass('selected');
var next = li.nextAll('li.selected');
if(next.length) next.removeClass('selected');
$(this).focus();
});
});

75
javascript/src/TabSet.js Normal file
View File

@ -0,0 +1,75 @@
import $ from './jQuery';
$.entwine('ss', function($){
/**
* Lightweight wrapper around jQuery UI tabs for generic tab set-up
*/
$('.ss-tabset').entwine({
IgnoreTabState: false,
onadd: function() {
var hash = window.location.hash;
// Can't name redraw() as it clashes with other CMS entwine classes
this.redrawTabs();
if (hash !== '') {
this.openTabFromURL(hash);
}
this._super();
},
onremove: function() {
if(this.data('tabs')) this.tabs('destroy');
this._super();
},
redrawTabs: function() {
this.rewriteHashlinks();
this.tabs();
},
/**
* @func openTabFromURL
* @param {string} hash
* @desc Allows linking to a specific tab.
*/
openTabFromURL: function (hash) {
var $trigger;
// Make sure the hash relates to a valid tab.
$.each(this.find('.cms-panel-link'), function () {
// The hash in in the button's href and there is exactly one tab with that id.
if (this.href.indexOf(hash) !== -1 && $(hash).length === 1) {
$trigger = $(this);
return false; // break the loop
}
});
// If there's no tab, it means the hash is invalid, so do nothing.
if ($trigger === void 0) {
return;
}
// Switch to the correct tab when AJAX loading completes.
$(window).one('ajaxComplete', function () {
$trigger.click();
});
},
/**
* @func rewriteHashlinks
* @desc Ensure hash links are prefixed with the current page URL, otherwise jQuery interprets them as being external.
*/
rewriteHashlinks: function() {
$(this).find('ul a').each(function() {
if (!$(this).attr('href')) return;
var matches = $(this).attr('href').match(/#.*/);
if(!matches) return;
$(this).attr('href', document.location.href.replace(/#.*/, '') + matches[0]);
});
}
});
});

View File

@ -0,0 +1,29 @@
import $ from './jQuery';
$.entwine('ss', function($){
$('.ss-toggle').entwine({
onadd: function() {
this._super();
this.accordion({
heightStyle: "content",
collapsible: true,
active: (this.hasClass("ss-toggle-start-closed")) ? false : 0
});
},
onremove: function() {
if (this.data('accordion')) this.accordion('destroy');
this._super();
},
getTabSet: function() {
return this.closest(".ss-tabset");
},
fromTabSet: {
ontabsshow: function() {
this.accordion("resize");
}
}
});
});

View File

@ -1,3 +1,5 @@
import $ from './jQuery';
var field = $('div.toggleField');
if(field.hasClass('startClosed')) {
@ -9,4 +11,3 @@ $('div.toggleField .triggerLess, div.toggleField .triggerMore').click(function()
field.find('div.contentMore').toggle();
field.find('div.contentLess').toggle();
});

View File

@ -0,0 +1,447 @@
import $ from './jQuery';
import i18n from './i18n';
$.entwine('ss', function($){
/**
* On resize of any close the open treedropdownfields
* as we'll need to redo with widths
*/
var windowWidth, windowHeight;
$(window).bind('resize.treedropdownfield', function() {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
var cb = function() {$('.TreeDropdownField').closePanel();};
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
var strings = {
'openlink': i18n._t('TreeDropdownField.OpenLink'),
'fieldTitle': '(' + i18n._t('TreeDropdownField.FieldTitle') + ')',
'searchFieldTitle': '(' + i18n._t('TreeDropdownField.SearchFieldTitle') + ')'
};
var _clickTestFn = function(e) {
// If the click target is not a child of the current field, close the panel automatically.
if(!$(e.target).parents('.TreeDropdownField').length) $('.TreeDropdownField').closePanel();
};
/**
* @todo Error display
* @todo No results display for search
* @todo Automatic expansion of ajax children when multiselect is triggered
* @todo Automatic panel positioning based on available space (top/bottom)
* @todo forceValue
* @todo Automatic width
* @todo Expand title height to fit all elements
*/
$('.TreeDropdownField').entwine({
// XMLHttpRequest
CurrentXhr: null,
onadd: function() {
this.append(
'<span class="treedropdownfield-title"></span>' +
'<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' +
'<div class="treedropdownfield-panel"><div class="tree-holder"></div></div>'
);
var linkTitle = strings.openLink;
if(linkTitle) this.find("treedropdownfield-toggle-panel-link a").attr('title', linkTitle);
if(this.data('title')) this.setTitle(this.data('title'));
this.getPanel().hide();
this._super();
},
getPanel: function() {
return this.find('.treedropdownfield-panel');
},
openPanel: function() {
// close all other panels
$('.TreeDropdownField').closePanel();
// Listen for clicks outside of the field to auto-close it
$('body').bind('click', _clickTestFn);
var panel = this.getPanel(), tree = this.find('.tree-holder');
panel.css('width', this.width());
panel.show();
// swap the down arrow with an up arrow
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.addClass('treedropdownfield-open-tree');
this.addClass("treedropdownfield-open-tree");
toggle.find("a")
.removeClass('ui-icon-triangle-1-s')
.addClass('ui-icon-triangle-1-n');
if(tree.is(':empty') && !panel.hasClass('loading')) {
this.loadTree(null, this._riseUp);
} else {
this._riseUp();
}
this.trigger('panelshow');
},
_riseUp: function() {
var container = this,
dropdown = this.getPanel(),
toggle = this.find(".treedropdownfield-toggle-panel-link"),
offsetTop = toggle.innerHeight(),
elHeight,
elPos,
endOfWindow;
if (toggle.length > 0) {
endOfWindow = ($(window).height() + $(document).scrollTop()) - toggle.innerHeight();
elPos = toggle.offset().top;
elHeight = dropdown.innerHeight();
// If the dropdown is too close to the bottom of the page, position it above the 'trigger'
if (elPos + elHeight > endOfWindow && elPos - elHeight > 0) {
container.addClass('treedropdownfield-with-rise');
offsetTop = -dropdown.outerHeight();
} else {
container.removeClass('treedropdownfield-with-rise');
}
}
dropdown.css({"top": offsetTop + "px"});
},
closePanel: function() {
jQuery('body').unbind('click', _clickTestFn);
// swap the up arrow with a down arrow
var toggle = this.find(".treedropdownfield-toggle-panel-link");
toggle.removeClass('treedropdownfield-open-tree');
this.removeClass('treedropdownfield-open-tree treedropdownfield-with-rise');
toggle.find("a")
.removeClass('ui-icon-triangle-1-n')
.addClass('ui-icon-triangle-1-s');
this.getPanel().hide();
this.trigger('panelhide');
},
togglePanel: function() {
this[this.getPanel().is(':visible') ? 'closePanel' : 'openPanel']();
},
setTitle: function(title) {
title = title || this.data('title') || strings.fieldTitle;
this.find('.treedropdownfield-title').html(title);
this.data('title', title); // separate view from storage (important for search cancellation)
},
getTitle: function() {
return this.find('.treedropdownfield-title').text();
},
/**
* Update title from tree node value
*/
updateTitle: function() {
var self = this, tree = self.find('.tree-holder'), val = this.getValue();
var updateFn = function() {
var val = self.getValue();
if(val) {
var node = tree.find('*[data-id="' + val + '"]'),
title = node.children('a').find("span.jstree_pageicon")?node.children('a').find("span.item").html():null;
if(!title) title=(node.length > 0) ? tree.jstree('get_text', node[0]) : null;
if(title) {
self.setTitle(title);
self.data('title', title);
}
if(node) tree.jstree('select_node', node);
}
else {
self.setTitle(self.data('empty-title'));
self.removeData('title');
}
};
// Load the tree if its not already present
if(!tree.is(':empty') || !val) updateFn();
else this.loadTree({forceValue: val}, updateFn);
},
setValue: function(val) {
this.data('metadata', $.extend(this.data('metadata'), {id: val}));
this.find(':input:hidden').val(val)
// Trigger synthetic event so subscribers can workaround the IE8 problem with 'change' events
// not propagating on hidden inputs. 'change' is still triggered for backwards compatiblity.
.trigger('valueupdated')
.trigger('change');
},
getValue: function() {
return this.find(':input:hidden').val();
},
loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder'),
params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(), xhr;
if(this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function(xhr, status) {
panel.removeClass('loading');
},
success: function(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
treeHolder
.jstree('destroy')
.bind('loaded.jstree', function(e, data) {
var val = self.getValue(), selectNode = treeHolder.find('*[data-id="' + val + '"]'),
currentNode = data.inst.get_selected();
if(val && selectNode != currentNode) data.inst.select_node(selectNode);
firstLoad = false;
if(callback) callback.apply(self);
})
.jstree(self.getTreeConfig())
.bind('select_node.jstree', function(e, data) {
var node = data.rslt.obj, id = $(node).data('id');
if(!firstLoad && self.getValue() == id) {
// Value is already selected, unselect it (for lack of a better UI to do this)
self.data('metadata', null);
self.setTitle(null);
self.setValue(null);
data.inst.deselect_node(node);
} else {
self.data('metadata', $.extend({id: id}, $(node).getMetaData()));
self.setTitle(data.inst.get_text(node));
self.setValue(id);
}
// Avoid auto-closing panel on first load
if(!firstLoad) self.closePanel();
firstLoad=false;
});
self.setCurrentXhr(null);
}
});
this.setCurrentXhr(xhr);
},
getTreeConfig: function() {
var self = this;
return {
'core': {
'html_titles': true,
// 'initially_open': ['record-0'],
'animation': 0
},
'html_data': {
// TODO Hack to avoid ajax load on init, see http://code.google.com/p/jstree/issues/detail?id=911
'data': this.getPanel().find('.tree-holder').html(),
'ajax': {
'url': function(node) {
var url = $.path.parseUrl(self.data('urlTree')).hrefNoSearch;
return url + '/' + ($(node).data("id") ? $(node).data("id") : 0);
},
'data': function(node) {
var query = $.query.load(self.data('urlTree')).keys;
var params = self.getRequestParams();
params = $.extend({}, query, params, {ajax: 1});
return params;
}
}
},
'ui': {
"select_limit" : 1,
'initially_select': [this.getPanel().find('.current').attr('id')]
},
'themes': {
'theme': 'apple'
},
'types' : {
'types' : {
'default': {
'check_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'uncheck_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'select_node': function(node) {
return ( ! node.hasClass('disabled'));
},
'deselect_node': function(node) {
return ( ! node.hasClass('disabled'));
}
}
}
},
'plugins': ['html_data', 'ui', 'themes', 'types']
};
},
/**
* If the field is contained in a form, submit all form parameters by default.
* This is useful to keep state like locale values which are typically
* encoded in hidden fields through the form.
*
* @return {object}
*/
getRequestParams: function() {
return {};
}
});
$('.TreeDropdownField .tree-holder li').entwine({
/**
* Overload to return more data. The same data should be set on initial
* value through PHP as well (see TreeDropdownField->Field()).
*
* @return {object}
*/
getMetaData: function() {
var matches = this.attr('class').match(/class-([^\s]*)/i);
var klass = matches ? matches[1] : '';
return {ClassName: klass};
}
});
$('.TreeDropdownField *').entwine({
getField: function() {
return this.parents('.TreeDropdownField:first');
}
});
$('.TreeDropdownField').entwine({
onclick: function(e) {
this.togglePanel();
return false;
}
});
$('.TreeDropdownField .treedropdownfield-panel').entwine({
onclick: function(e) {
return false;
}
});
$('.TreeDropdownField.searchable').entwine({
onadd: function() {
this._super();
var title = i18n._t('TreeDropdownField.ENTERTOSEARCH');
this.find('.treedropdownfield-panel').prepend(
$('<input type="text" class="search treedropdownfield-search" data-skip-autofocus="true" placeholder="' + title + '" value="" />')
);
},
search: function(str, callback) {
this.openPanel();
this.loadTree({search: str}, callback);
},
cancelSearch: function() {
this.closePanel();
this.loadTree();
}
});
$('.TreeDropdownField.searchable input.search').entwine({
onkeydown: function(e) {
var field = this.getField();
if(e.keyCode == 13) {
// trigger search on ENTER key
field.search(this.val());
return false;
} else if(e.keyCode == 27) {
// cancel search on ESC key
field.cancelSearch();
}
}
});
$('.TreeDropdownField.multiple').entwine({
getTreeConfig: function() {
var cfg = this._super();
cfg.checkbox = {override_ui: true, two_state: true};
cfg.plugins.push('checkbox');
cfg.ui.select_limit = -1;
return cfg;
},
loadTree: function(params, callback) {
var self = this, panel = this.getPanel(), treeHolder = $(panel).find('.tree-holder');
var params = (params) ? $.extend({}, this.getRequestParams(), params) : this.getRequestParams(), xhr;
if(this.getCurrentXhr()) this.getCurrentXhr().abort();
panel.addClass('loading');
xhr = $.ajax({
url: this.data('urlTree'),
data: params,
complete: function(xhr, status) {
panel.removeClass('loading');
},
success: function(html, status, xhr) {
treeHolder.html(html);
var firstLoad = true;
self.setCurrentXhr(null);
treeHolder
.jstree('destroy')
.bind('loaded.jstree', function(e, data) {
$.each(self.getValue(), function(i, val) {
data.inst.check_node(treeHolder.find('*[data-id=' + val + ']'));
});
firstLoad = false;
if(callback) callback.apply(self);
})
.jstree(self.getTreeConfig())
.bind('uncheck_node.jstree check_node.jstree', function(e, data) {
var nodes = data.inst.get_checked(null, true);
self.setValue($.map(nodes, function(el, i) {
return $(el).data('id');
}));
self.setTitle($.map(nodes, function(el, i) {
return data.inst.get_text(el);
}));
self.data('metadata', $.map(nodes, function(el, i) {
return {id: $(el).data('id'), metadata: $(el).getMetaData()};
}));
});
}
});
this.setCurrentXhr(xhr);
},
getValue: function() {
var val = this._super();
return val.split(/ *, */);
},
setValue: function(val) {
this._super($.isArray(val) ? val.join(',') : val);
},
setTitle: function(title) {
this._super($.isArray(title) ? title.join(', ') : title);
},
updateTitle: function() {
// TODO Not supported due to multiple values/titles yet
}
});
$('.TreeDropdownField input[type=hidden]').entwine({
onadd: function() {
this._super();
this.bind('change.TreeDropdownField', function() {
$(this).getField().updateTitle();
});
},
onremove: function() {
this._super();
this.unbind('.TreeDropdownField');
}
});
});

View File

@ -0,0 +1,567 @@
import $ from './jQuery';
import i18n from './i18n';
$.widget('blueimpUIX.fileupload', $.blueimpUI.fileupload, {
_initTemplates: function() {
this.options.templateContainer = document.createElement(
this._files.prop('nodeName')
);
this.options.uploadTemplate = window.tmpl(this.options.uploadTemplateName);
this.options.downloadTemplate = window.tmpl(this.options.downloadTemplateName);
},
_enableFileInputButton: function() {
$.blueimpUI.fileupload.prototype._enableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').show();
},
_disableFileInputButton: function() {
$.blueimpUI.fileupload.prototype._disableFileInputButton.call(this);
this.element.find('.ss-uploadfield-addfile').hide();
},
_onAdd: function(e, data) {
// use _onAdd instead of add since we only want it called once for a file set, not for each file
var result = $.blueimpUI.fileupload.prototype._onAdd.call(this, e, data);
var firstNewFile = this._files.find('.ss-uploadfield-item').slice(data.files.length*-1).first();
var top = '+=' + (firstNewFile.position().top - parseInt(firstNewFile.css('marginTop'), 10) || 0 - parseInt(firstNewFile.css('borderTopWidth'), 10) || 0);
firstNewFile.offsetParent().animate({scrollTop: top}, 1000);
/* Compute total size of files */
var fSize = 0;
for(var i = 0; i < data.files.length; i++){
if(typeof data.files[i].size === 'number'){
fSize = fSize + data.files[i].size;
}
}
$('.fileOverview .uploadStatus .details .total').text(data.files.length);
if(typeof fSize === 'number' && fSize > 0){
fSize = this._formatFileSize(fSize);
$('.fileOverview .uploadStatus .details .fileSize').text(fSize);
}
//Fixes case where someone uploads a single erroring file
if(data.files.length == 1 && data.files[0].error !== null){
$('.fileOverview .uploadStatus .state').text(i18n._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
$('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
}else{
$('.fileOverview .uploadStatus .state').text(i18n._t('AssetUploadField.UPLOADINPROGRESS', 'Please wait… upload in progress'));//.show();
$('.ss-uploadfield-item-edit-all').hide();
$('.fileOverview .uploadStatus').addClass("notice").removeClass("good").removeClass("bad");
}
return result;
},
_onDone: function (result, textStatus, jqXHR, options) {
// Mark form as dirty on completion of successful upload
if(this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
$.blueimpUI.fileupload.prototype._onDone.call(this, result, textStatus, jqXHR, options);
},
_onSend: function (e, data) {
//check the array of existing files to see if we are trying to upload a file that already exists
var that = this;
var config = this.options;
if (config.overwriteWarning && config.replaceFile) {
$.get(
config['urlFileExists'],
{'filename': data.files[0].name},
function(response, status, xhr) {
if(response.exists) {
//display the dialogs with the question to overwrite or not
data.context.find('.ss-uploadfield-item-status')
.text(config.errorMessages.overwriteWarning)
.addClass('ui-state-warning-text');
data.context.find('.ss-uploadfield-item-progress').hide();
data.context.find('.ss-uploadfield-item-overwrite').show();
data.context.find('.ss-uploadfield-item-overwrite-warning').on('click', function(e){
data.context.find('.ss-uploadfield-item-progress').show();
data.context.find('.ss-uploadfield-item-overwrite').hide();
data.context.find('.ss-uploadfield-item-status')
.removeClass('ui-state-warning-text');
//upload only if the "overwrite" button is clicked
$.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
e.preventDefault(); // Avoid a form submit
return false;
});
} else { //regular file upload
return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
}
);
} else {
return $.blueimpUI.fileupload.prototype._onSend.call(that, e, data);
}
},
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
$.blueimpUI.fileupload.prototype._onAlways.call(this, jqXHRorResult, textStatus, jqXHRorError, options);
if(typeof(jqXHRorError) === 'string') {
$('.fileOverview .uploadStatus .state').text(i18n._t('AssetUploadField.UploadField.UPLOADFAIL', 'Sorry your upload failed'));
$('.fileOverview .uploadStatus').addClass("bad").removeClass("good").removeClass("notice");
} else if (jqXHRorError.status === 200) {
$('.fileOverview .uploadStatus .state').text(i18n._t('AssetUploadField.FILEUPLOADCOMPLETED', 'File upload completed!'));//.hide();
$('.ss-uploadfield-item-edit-all').show();
$('.fileOverview .uploadStatus').addClass("good").removeClass("notice").removeClass("bad");
}
},
_create: function() {
$.blueimpUI.fileupload.prototype._create.call(this);
// Ensures that the visibility of the fileupload dialog is set correctly at initialisation
this._adjustMaxNumberOfFiles(0);
},
attach: function(data) {
if(this.options.changeDetection) {
this.element.closest('form').trigger('dirty');
}
// Handles attachment of already uploaded files, similar to add
var self = this,
files = data.files,
replaceFileID = data.replaceFileID,
valid = true;
// If replacing an element (and it exists), adjust max number of files at this point
var replacedElement = null;
if(replaceFileID) {
replacedElement = $(".ss-uploadfield-item[data-fileid='"+replaceFileID+"']");
if(replacedElement.length === 0) {
replacedElement = null;
} else {
self._adjustMaxNumberOfFiles(1);
}
}
// Validate each file
$.each(files, function (index, file) {
self._adjustMaxNumberOfFiles(-1);
error = self._validate([file]);
valid = error && valid;
});
data.isAdjusted = true;
data.files.valid = data.isValidated = valid;
// Generate new file HTMl, and either append or replace (if replacing
// an already uploaded file).
data.context = this._renderDownload(files);
if(replacedElement) {
replacedElement.replaceWith(data.context);
} else {
data.context.appendTo(this._files);
}
data.context.data('data', data);
// Force reflow:
this._reflow = this._transition && data.context[0].offsetWidth;
data.context.addClass('in');
}
});
$.entwine('ss', function($) {
$('div.ss-upload').entwine({
Config: null,
onmatch: function() {
if (this.is('.readonly,.disabled')) {
return;
}
var $fileInput = this.find('.ss-uploadfield-fromcomputer-fileinput'),
$dropZone = $('.ss-uploadfield-dropzone'),
config = $fileInput.data('config');
// Drag & drop is opt-in so we have to prevent the default behaviour
// (which is 'do nothing') when the drop zone is dragged over.
$dropZone.on('dragover', function (e) {
e.preventDefault();
});
$dropZone.on('dragenter', function (e) {
$dropZone.addClass('hover active');
});
$dropZone.on('dragleave', function (e) {
if (e.target === $dropZone[0]) {
$dropZone.removeClass('hover active');
}
});
$dropZone.on('drop', function (e) {
$dropZone.removeClass('hover active');
if (e.target !== $dropZone[0]) {
return false;
}
})
this.setConfig(config);
this.fileupload($.extend(true, {
formData: function(form) {
var idVal = $(form).find(':input[name=ID]').val();
var data = [{name: 'SecurityID', value: $(form).find(':input[name=SecurityID]').val()}];
if(idVal) data.push({name: 'ID', value: idVal});
return data;
},
errorMessages: {
// errorMessages for all error codes suggested from the plugin author, some will be overwritten by the config coming from php
1: i18n._t('UploadField.PHP_MAXFILESIZE'),
2: i18n._t('UploadField.HTML_MAXFILESIZE'),
3: i18n._t('UploadField.ONLYPARTIALUPLOADED'),
4: i18n._t('UploadField.NOFILEUPLOADED'),
5: i18n._t('UploadField.NOTMPFOLDER'),
6: i18n._t('UploadField.WRITEFAILED'),
7: i18n._t('UploadField.STOPEDBYEXTENSION'),
maxFileSize: i18n._t('UploadField.TOOLARGESHORT'),
minFileSize: i18n._t('UploadField.TOOSMALL'),
acceptFileTypes: i18n._t('UploadField.INVALIDEXTENSIONSHORT'),
maxNumberOfFiles: i18n._t('UploadField.MAXNUMBEROFFILESSHORT'),
uploadedBytes: i18n._t('UploadField.UPLOADEDBYTES'),
emptyResult: i18n._t('UploadField.EMPTYRESULT')
},
send: function(e, data) {
if (data.context && data.dataType && data.dataType.substr(0, 6) === 'iframe') {
// Iframe Transport does not support progress events.
// In lack of an indeterminate progress bar, we set
// the progress to 100%, showing the full animated bar:
data.total = 1;
data.loaded = 1;
$(this).data('fileupload').options.progress(e, data);
}
},
progress: function(e, data) {
if (data.context) {
var value = parseInt(data.loaded / data.total * 100, 10) + '%';
data.context.find('.ss-uploadfield-item-status').html((data.total == 1)?i18n._t('UploadField.LOADING'):value);
data.context.find('.ss-uploadfield-item-progressbarvalue').css('width', value);
}
}
},
config,
{
fileInput: $fileInput,
dropZone: $dropZone,
form: $fileInput.closest('form'),
previewAsCanvas: false,
acceptFileTypes: new RegExp(config.acceptFileTypes, 'i')
}
));
if (this.data('fileupload')._isXHRUpload({multipart: true})) {
$('.ss-uploadfield-item-uploador').hide().show();
}
this._super();
},
onunmatch: function() {
$('.ss-uploadfield-dropzone').off('dragover dragenter dragleave drop');
this._super();
},
openSelectDialog: function(uploadedFile) {
// Create dialog and load iframe
var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = jQuery('#' + dialogId);
if(!dialog.length) dialog = jQuery('<div class="ss-uploadfield-dialog" id="' + dialogId + '" />');
// If user selected 'Choose another file', we need the ID of the file to replace
var iframeUrl = config['urlSelectDialog'];
var uploadedFileId = null;
if (uploadedFile && uploadedFile.attr('data-fileid') > 0){
uploadedFileId = uploadedFile.attr('data-fileid');
}
// Show dialog
dialog.ssdialog({iframeUrl: iframeUrl, height: 550});
// TODO Allow single-select
dialog.find('iframe').bind('load', function(e) {
var contents = $(this).contents(), gridField = contents.find('.ss-gridfield');
// TODO Fix jQuery custom event bubbling across iframes on same domain
// gridField.find('.ss-gridfield-items')).bind('selectablestop', function() {
// });
// Remove top margin (easier than including new selectors)
contents.find('table.ss-gridfield').css('margin-top', 0);
// Can't use live() in iframes...
contents.find('input[name=action_doAttach]').unbind('click.openSelectDialog').bind('click.openSelectDialog', function() {
// TODO Fix entwine method calls across iframe/document boundaries
var ids = $.map(gridField.find('.ss-gridfield-item.ui-selected'), function(el) {return $(el).data('id');});
if(ids && ids.length) self.attachFiles(ids, uploadedFileId);
dialog.ssdialog('close');
return false;
});
});
dialog.ssdialog('open');
},
attachFiles: function(ids, uploadedFileId) {
var self = this,
config = this.getConfig(),
indicator = $('<div class="loader" />'),
target = (uploadedFileId) ? this.find(".ss-uploadfield-item[data-fileid='"+uploadedFileId+"']") : this.find('.ss-uploadfield-addfile');
target.children().hide();
target.append(indicator);
$.ajax({
type: "POST",
url: config['urlAttach'],
data: {'ids': ids},
complete: function(xhr, status) {
target.children().show();
indicator.remove();
},
success: function(data, status, xhr) {
if (!data || $.isEmptyObject(data)) return;
self.fileupload('attach', {
files: data,
options: self.fileupload('option'),
replaceFileID: uploadedFileId
});
}
});
}
});
$('div.ss-upload *').entwine({
getUploadField: function() {
return this.parents('div.ss-upload:first');
}
});
$('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item').entwine({
onadd: function() {
this._super();
this.closest('.ss-upload').find('.ss-uploadfield-addfile').addClass('borderTop');
},
onremove: function() {
$('.ss-uploadfield-files:not(:has(.ss-uploadfield-item))').closest('.ss-upload').find('.ss-uploadfield-addfile').removeClass('borderTop');
this._super();
}
});
$('div.ss-upload .ss-uploadfield-startall').entwine({
onclick: function(e) {
this.closest('.ss-upload').find('.ss-uploadfield-item-start button').click();
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-cancelfailed').entwine({
onclick: function(e) {
this.closest('.ss-uploadfield-item').remove();
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-remove:not(.ui-state-disabled), .ss-uploadfield-item-delete:not(.ui-state-disabled)').entwine({
onclick: function(e) {
var field = this.closest('div.ss-upload'),
config = field.getConfig('changeDetection'),
fileupload = field.data('fileupload'),
item = this.closest('.ss-uploadfield-item'), msg = '';
if(this.is('.ss-uploadfield-item-delete')) {
if(confirm(i18n._t('UploadField.ConfirmDelete'))) {
if(config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {
context: item,
url: this.data('href'),
type: 'get',
dataType: fileupload.options.dataType
});
}
}
} else {
// Removed files will be applied to object on save
if(config.changeDetection) {
this.closest('form').trigger('dirty');
}
if (fileupload) {
fileupload._trigger('destroy', e, {context: item});
}
}
e.preventDefault(); // Avoid a form submit
return false;
}
});
$('div.ss-upload .ss-uploadfield-item-edit-all').entwine({
onclick: function(e) {
if($(this).hasClass('opened')){
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon.opened').each(function(i){
$(this).closest('.ss-uploadfield-item-edit').click();
});
$(this).removeClass('opened').find('.toggle-details-icon').removeClass('opened');
}else{
$('.ss-uploadfield-item .ss-uploadfield-item-edit .toggle-details-icon').each(function(i){
if(!$(this).hasClass('opened')){
$(this).closest('.ss-uploadfield-item-edit').click();
}
});
$(this).addClass('opened').find('.toggle-details-icon').addClass('opened');
}
e.preventDefault(); // Avoid a form submit
return false;
}
});
$( 'div.ss-upload:not(.disabled):not(.readonly) .ss-uploadfield-item-edit').entwine({
onclick: function(e) {
var self = this,
editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
itemInfo = editform.prev('.ss-uploadfield-item-info'),
iframe = editform.find('iframe');
// Ignore clicks while the iframe is loading
if (iframe.parent().hasClass('loading')) {
e.preventDefault();
return false;
}
if (iframe.attr('src') == 'about:blank') {
// Lazy-load the iframe on editform toggle
iframe.attr('src', iframe.data('src'));
// Add loading class, disable buttons while loading is in progress
// (_prepareIframe() handles re-enabling them when appropriate)
iframe.parent().addClass('loading');
disabled=this.siblings();
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
iframe.on('load', function() {
iframe.parent().removeClass('loading');
// This ensures we only call _prepareIframe() on load once - otherwise it'll
// be superfluously called after clicking 'save' in the editform
if (iframe.data('src')) {
self._prepareIframe(iframe, editform, itemInfo);
iframe.data('src', '');
}
});
} else {
self._prepareIframe(iframe, editform, itemInfo);
}
e.preventDefault(); // Avoid a form submit
return false;
},
_prepareIframe: function(iframe, editform, itemInfo) {
var disabled;
// Mark the row as changed if any of its form fields are edited
iframe.contents().ready(function() {
// Need to use the iframe's own jQuery, as custom event triggers
// (e.g. from TreeDropdownField) can't be captured by the parent jQuery object.
var iframe_jQuery = iframe.get(0).contentWindow.jQuery;
iframe_jQuery(iframe_jQuery.find(':input')).bind('change', function(e){
editform.removeClass('edited');
editform.addClass('edited');
});
});
if (editform.hasClass('loading')) {
// TODO Display loading indication, and register an event to toggle edit form
} else {
if(this.hasClass('ss-uploadfield-item-edit')){
disabled=this.siblings();
}else{
disabled=this.find('ss-uploadfield-item-edit').siblings();
}
editform.parent('.ss-uploadfield-item').removeClass('ui-state-warning');
editform.toggleEditForm();
if (itemInfo.find('.toggle-details-icon').hasClass('opened')) {
disabled.addClass('ui-state-disabled');
disabled.attr('disabled', 'disabled');
} else {
disabled.removeClass('ui-state-disabled');
disabled.removeAttr('disabled');
}
}
}
});
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
fitHeight: function() {
var iframe = this.find('iframe'),
contents = iframe.contents().find('body'),
bodyH = contents.find('form').outerHeight(true), // We set the height to match the form's outer height
iframeH = bodyH + (iframe.outerHeight(true) - iframe.height()), // content's height + padding on iframe elem
containerH = iframeH + (this.outerHeight(true) - this.height()); // iframe height + padding on container elem
/* Set height of body except in IE8. Setting this in IE8 breaks the dropdown */
if( ! $.browser.msie && $.browser.version.slice(0,3) != "8.0"){
contents.find('body').css({'height': bodyH});
}
iframe.height(iframeH);
this.animate({height: containerH}, 500);
},
toggleEditForm: function() {
var itemInfo = this.prev('.ss-uploadfield-item-info'), status = itemInfo.find('.ss-uploadfield-item-status');
var iframe = this.find('iframe').contents(),
saved = iframe.find('#Form_EditForm_error');
var text = "";
if(this.height() === 0) {
text = i18n._t('UploadField.Editing', "Editing ...");
this.fitHeight();
this.addClass('opened');
itemInfo.find('.toggle-details-icon').addClass('opened');
status.removeClass('ui-state-success-text').removeClass('ui-state-warning-text');
iframe.find('#Form_EditForm_action_doEdit').click(function(){
itemInfo.find('label .name').text(iframe.find('#Name input').val());
});
if($('div.ss-upload .ss-uploadfield-files .ss-uploadfield-item-actions .toggle-details-icon:not(.opened)').index() < 0){
$('div.ss-upload .ss-uploadfield-item-edit-all').addClass('opened').find('.toggle-details-icon').addClass('opened');
}
} else {
this.animate({height: 0}, 500);
this.removeClass('opened');
itemInfo.find('.toggle-details-icon').removeClass('opened');
$('div.ss-upload .ss-uploadfield-item-edit-all').removeClass('opened').find('.toggle-details-icon').removeClass('opened');
if(!this.hasClass('edited')){
text = i18n._t('UploadField.NOCHANGES', 'No Changes');
status.addClass('ui-state-success-text');
}else{
if(saved.hasClass('good')){
text = i18n._t('UploadField.CHANGESSAVED', 'Changes Saved');
this.removeClass('edited').parent('.ss-uploadfield-item').removeClass('ui-state-warning');
status.addClass('ui-state-success-text');
}else{
text = i18n._t('UploadField.UNSAVEDCHANGES', 'Unsaved Changes');
this.parent('.ss-uploadfield-item').addClass('ui-state-warning');
status.addClass('ui-state-warning-text');
}
}
saved.removeClass('good').hide();
}
status.attr('title',text).text(text);
}
});
$('div.ss-upload .ss-uploadfield-fromfiles').entwine({
onclick: function(e) {
this.getUploadField().openSelectDialog(this.closest('.ss-uploadfield-item'));
e.preventDefault(); // Avoid a form submit
return false;
}
});
});

View File

@ -19,7 +19,7 @@ window.tmpl.cache['ss-uploadfield-downloadtemplate'] = tmpl(
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
'<span class="size">{%=o.formatFileSize(file.size)%}</span>' +
'{% if (!file.error) { %}' +
'<div class="ss-uploadfield-item-status ui-state-success-text" title="'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'">'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'</div>' +
'<div class="ss-uploadfield-item-status ui-state-success-text" title="'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'">'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'</div>' +
'{% } else { %}' +
'<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' +
'{% } %}' +
@ -38,4 +38,4 @@ window.tmpl.cache['ss-uploadfield-downloadtemplate'] = tmpl(
'{% } %}' +
'</li>' +
'{% } %}'
);
);

View File

@ -0,0 +1,21 @@
import $ from './jQuery';
$.entwine('ss', function($) {
// Install the directory selection handler
$('form.uploadfield-form .TreeDropdownField').entwine({
onmatch: function() {
this._super();
var self = this;
this.bind('change', function() {
// Display the contents of the folder in the listing field.
var fileList = self.closest('form').find('.ss-gridfield');
fileList.setState('ParentID', self.getValue());
fileList.reload();
});
},
onunmatch: function() {
this._super();
}
});
});

240
javascript/src/i18n.js Normal file
View File

@ -0,0 +1,240 @@
/*
* Lightweight clientside i18n implementation.
* Caution: Only available after DOM loaded because we need to detect the language
*
* For non-i18n stub implementation, see framework/javascript/src/i18nx.js
*
* Based on jQuery i18n plugin: 1.0.0 Feb-10-2008
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Based on 'javascript i18n that almost doesn't suck' by markos
* http://markos.gaivo.net/blog/?p=100
*/
class i18n {
constructor() {
this.currentLocale = null;
this.defaultLocale = 'en_US';
this.lang = {};
}
/**
* Set locale in long format, e.g. "de_AT" for Austrian German.
*
* @param string locale
*/
setLocale(locale) {
this.currentLocale = locale;
}
/**
* Get locale in long format. Falls back to i18n.defaut_locale.
*
* @return string
*/
getLocale() {
return this.currentLocale !== null ? this.currentLocale : this.defaultLocale;
}
/**
* The actual translation function. Looks the given string up in the
* dictionary and returns the translation if one exists. If a translation
* is not found, returns the original word.
*
* @param string entity - A "long" locale format, e.g. "de_DE" (Required)
* @param string fallbackString - (Required)
* @param int priority - (not used)
* @param string context - Give translators context for the string
* @return string : Translated word
*/
_t(entity, fallbackString, priority, context) {
const langName = this.getLocale().replace(/_[\w]+/i, '');
const defaultlangName = this.defaultLocale.replace(/_[\w]+/i, '');
if (this.lang && this.lang[this.getLocale()] && this.lang[this.getLocale()][entity]) {
return this.lang[this.getLocale()][entity];
} else if (this.lang && this.lang[langName] && this.lang[langName][entity]) {
return this.lang[langName][entity];
} else if (this.lang && this.lang[this.defaultLocale] && this.lang[this.defaultLocale][entity]) {
return this.lang[this.defaultLocale][entity];
} else if (this.lang && this.lang[defaultlangName] && this.lang[defaultlangName][entity]) {
return this.lang[defaultlangName][entity];
} else if(fallbackString) {
return fallbackString;
} else {
return '';
}
}
/**
* Add entities to a dictionary. If a dictionary doesn't
* exist for this locale, its automatically created.
* Existing entities are overwritten.
*
* @param string locale
* @param Object dict
*/
addDictionary(locale, dict) {
if (typeof this.lang[locale] === 'undefined') {
this.lang[locale] = {};
}
for (let entity in dict) {
this.lang[locale][entity] = dict[entity];
}
}
/**
* Get dictionary for a specific locale.
*
* @param string locale
*/
getDictionary(locale) {
return this.lang[locale];
}
/**
* @param string str - The string to strip.
* @return string result - Stripped string.
*
*/
stripStr(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
/**
* @param string str - The multi-line string to strip.
* @return string result - Stripped string.
*
*/
stripStrML(str) {
// Split because m flag doesn't exist before JS1.5 and we need to
// strip newlines anyway
var parts = str.split('\n');
for (let i = 0; i < parts.length; i += 1) {
parts[i] = stripStr(parts[i]);
}
// Don't join with empty strings, because it "concats" words
// And strip again
return stripStr(parts.join(' '));
}
/**
* Substitutes %s with parameters
* given in list. %%s is used to escape %s.
*
* @param string s - The string to perform the substitutions on.
* @return string - The new string with substitutions made.
*/
sprintf(s, ...params) {
if (params.length === 0) {
return s;
}
const regx = new RegExp('(.?)(%s)', 'g');
let i = 0;
return s.replace(regx, function (match, subMatch1, subMatch2, offset, string) {
// skip %%s
if (subMatch1 === '%') {
return match;
}
return subMatch1 + params[i += 1];
});
}
/**
* Substitutes variables with a list of injections.
*
* @param string s - The string to perform the substitutions on.
* @param object map - An object with the substitions map e.g. {var: value}.
* @return string - The new string with substitutions made.
*/
inject(s, map) {
const regx = new RegExp('\{([A-Za-z0-9_]*)\}', 'g');
return s.replace(regx, function (match, key, offset, string) {
return (map[key]) ? map[key] : match;
});
}
/**
* Detect document language settings by looking at <meta> tags.
* If no match is found, returns this.defaultLocale.
*
* @todo get by <html lang=''> - needs modification of SSViewer
*
* @return string - Locale in mixed lowercase/uppercase format suitable
* for usage in i18n.lang arrays (e.g. 'en_US').
*/
detectLocale() {
var rawLocale;
var detectedLocale;
// Get by container tag
rawLocale = jQuery('body').attr('lang');
// Get by meta
if (!rawLocale) {
var metas = document.getElementsByTagName('meta');
for (var i=0; i<metas.length; i++) {
if (metas[i].attributes['http-equiv'] && metas[i].attributes['http-equiv'].nodeValue.toLowerCase() == 'content-language') {
rawLocale = metas[i].attributes['content'].nodeValue;
}
}
}
// Fallback to default locale
if (!rawLocale) {
rawLocale = this.defaultLocale;
}
var rawLocaleParts = rawLocale.match(/([^-|_]*)[-|_](.*)/);
// Get locale (e.g. 'en_US') from common name (e.g. 'en')
// by looking at i18n.lang tables
if (rawLocale.length == 2) {
for (let compareLocale in i18n.lang) {
if (compareLocale.substr(0,2).toLowerCase() == rawLocale.toLowerCase()) {
detectedLocale = compareLocale;
break;
}
}
} else if (rawLocaleParts) {
detectedLocale = rawLocaleParts[1].toLowerCase() + '_' + rawLocaleParts[2].toUpperCase();
}
return detectedLocale;
}
/**
* Attach an event listener to the given object.
* Modeled after behaviour.js, but externalized
* to keep the i18n library standalone for now.
*/
addEvent(obj, evType, fn, useCapture) {
if (obj.addEventListener) {
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent) {
return obj.attachEvent('on' + evType, fn);
} else {
console.log('Handler could not be attached');
}
}
}
let _i18n = new i18n();
// This module has to support legacy loading...
window.ss = typeof window.ss !== 'undefined' ? window.ss : {};
window.ss.i18n = window.i18n = _i18n;
export default _i18n;

55
javascript/src/i18nx.js Normal file
View File

@ -0,0 +1,55 @@
/**
* Stub implementation for i18n code.
* Use instead of framework/javascript/src/i18n.js
* if you want to use any SilverStripe javascript
* without internationalization support.
*/
class i18nx {
constructor() {
this.currentLocale = 'en_US';
this.defaultLocale = 'en_US';
}
_t(entity, fallbackString, priority, context) {
return fallbackString;
}
sprintf(s, ...params) {
if (params.length === 0) {
return s;
}
const regx = new RegExp('(.?)(%s)', 'g');
let i = 0;
return s.replace(regx, function (match, subMatch1, subMatch2, offset, string) {
// skip %%s
if (subMatch1 === '%') {
return match;
}
return subMatch1 + params[i += 1];
});
}
inject(s, map) {
const regx = new RegExp('\{([A-Za-z0-9_]*)\}', 'g');
return s.replace(regx, function (match, key, offset, string) {
return (map[key]) ? map[key] : match;
});
}
addDictionary() {
}
getDictionary() {
}
};
let _i18nx = new i18nx();
export default _i18nx;

8
javascript/src/jQuery.js Normal file
View File

@ -0,0 +1,8 @@
/**
* This wraps the global jQuery so jQuery can be imported
* like other modules. Once jQuery is updated and managed
* by npm we can get rid of this wrapper.
*/
var jQuery = typeof window.jQuery !== 'undefined' ? window.jQuery : null;
export default jQuery;

View File

@ -1,24 +0,0 @@
* Copyright (c) 2008, Silverstripe Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Silverstripe Ltd. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Silverstripe Ltd. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,104 +0,0 @@
# JavaScript Tree Control
## Maintainers
* Sam Minnee (sam at silverstripe dot com)
## Features
* Build trees using semantic HTML and unobtrusive JavaScript.
* Style the tree to suit your application you with CSS.
* Demo: http://www.silverstripe.org/assets/tree/demo.html
## Usage
The first thing to do is include the appropriate JavaScript and CSS files:
<code html>
<link rel="stylesheet" type="text/css" media="all" href="tree.css" />
<script type="application/javascript" src="tree.js"></script>
</code>
Then, create the HTML for you tree. This is basically a nested set of bullet pointed links. The "tree" class at the top is what the script will look for. Note that you can make a tree node closed to begin with by adding `class="closed"`.
Here's the HTML code that I inserted to create the demo tree above.
<code html>
<ul class="tree">
<li><a href="#">item 1</a>
<ul>
<li><a href="#">item 1.1</a></li>
<li class="closed"><a href="#">item 1.2</a>
<ul>
<li><a href="#">item 1.2.1</a></li>
<li><a href="#">item 1.2.2</a></li>
<li><a href="#">item 1.2.3</a></li>
</ul>
</li>
<li><a href="#">item 1.3</a></li>
</ul>
</li>
<li><a href="#">item 2</a>
<ul>
<li><a href="#">item 2.1</a></li>
<li><a href="#">item 2.2</a></li>
<li><a href="#">item 2.3</a></li>
</ul>
</li>
</ul>
</code>
Your tree is now complete!
## How it works
Obviously, this isn't a complete detail of everything that's going on, but it gives you an insight into the overall process.
### Starting the script
In simple situations, creating an auto-loading script is a simple matter of setting window.onload to a function. But what if there's more than one script? To this end, we created an appendLoader() function that will execute multiple loader functions, including a previously defined loader function
### Finding the tree content
Rather than write a piece of script to define where your tree is, we've tried to make the script as automatic as possible - it finds all ULs with a class name containing "tree".
### Augmenting the HTML
Unfortunately, an LI containing an A isn't sufficient for doing all of the necessary tree styling. Rather than force people to put non-semantic HTML into their file, the script generates extra `<span>` tags.
So, the following HTML:
<code html>
<li>
<a href="#">My item</a>
</li>
</code>
Is turned into the more ungainly, and yet more easily styled:
<code html>
<li>
<span class="a"><span class="b"><span class="c">
<a href="#">My item</a>
</span></span></span>
</li>
</code>
Additionally, some helper classes are applied to the `<li>` and `<span class="a">` elements:
* `"last"` is applied to the last node of any subtree.
* `"children"` is applied to any node that has children.
### Styling it up
Why the heck do we need 5 styling elements? Basically, because there are 5 background-images to apply:
* li: A repeating vertical line is shown. Nested <li> tags give us the multiple vertical lines that we need.
* span.a: We overlay the vertical line with 'L' and 'T' elements as needed.
* span.b: We overlay '+' or '-' signs on nodes with children.
* span.c: This is needed to fix up the vertical line.
* a: Finally, we apply the page icon.
### Opening / closing nodes
Having come this far, the "dynamic" aspect of the tree control is very trivial. We set a "closed" class on the `<li>` and `<span class="a">` elements, and our CSS takes care of hiding the children, changing the - to a + and changing the folder icon.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

View File

@ -11,7 +11,8 @@
},
"scripts": {
"build": "gulp build",
"sanity": "gulp sanity"
"sanity": "gulp sanity",
"thirdparty": "gulp thirdparty"
},
"repository": {
"type": "git",
@ -28,9 +29,23 @@
},
"homepage": "https://github.com/silverstripe/silverstripe-framework#readme",
"devDependencies": {
"babel-core": "^6.4.0",
"babel-plugin-transform-es2015-modules-umd": "^6.4.0",
"babel-preset-es2015": "^6.3.13",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"event-stream": "^3.3.2",
"glob": "^6.0.4",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.1",
"gulp-diff": "^1.0.0",
"semver": "^5.1.0"
"gulp-notify": "^2.2.0",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"semver": "^5.1.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
"dependencies": {
"blueimp-file-upload": "^6.0.3",

View File

@ -36,8 +36,8 @@ class CMSSecurity extends Security {
THIRDPARTY_DIR . '/jquery/jquery.js',
THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js',
THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js',
FRAMEWORK_ADMIN_DIR . '/javascript/lib.js',
FRAMEWORK_ADMIN_DIR . '/javascript/CMSSecurity.js'
FRAMEWORK_ADMIN_DIR . '/javascript/dist/sspath.js',
FRAMEWORK_ADMIN_DIR . '/javascript/dist/CMSSecurity.js'
)
);
}

View File

@ -73,7 +73,7 @@ class Group extends DataObject {
* @return FieldList
*/
public function getCMSFields() {
Requirements::javascript(FRAMEWORK_DIR . '/javascript/PermissionCheckboxSetField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/PermissionCheckboxSetField.js');
$fields = new FieldList(
new TabSet("Root",

View File

@ -77,7 +77,7 @@ class PermissionCheckboxSetField extends FormField {
*/
public function Field($properties = array()) {
Requirements::css(FRAMEWORK_DIR . '/css/CheckboxSetField.css');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/PermissionCheckboxSetField.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/dist/PermissionCheckboxSetField.js');
$uninheritedCodes = array();
$inheritedCodes = array();

View File

@ -16,8 +16,7 @@
<script type="application/javascript" src="../../../thirdparty/jquery/jquery.js"></script>
<script type="application/javascript" src="../../../thirdparty/jquery-entwine/dist/jquery.entwine-dist.js"></script>
<script type="application/javascript" src="../../../thirdparty/jstree/jquery.jstree.js"></script>
<script type="application/javascript" src="../../../javascript/TreeDropdownField.js"></script>
<script type="application/javascript" src="../../../javascript/dist/TreeDropdownField.js"></script>
<script type="application/javascript" src="TreeDropdownField.js"></script>
</head>

View File

@ -2,7 +2,7 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="../../javascript/i18n.js"></script>
<script src="../../javascript/dist/i18n.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/qunit/testsuite.css" type="text/css" media="screen" />
<!-- Needed for testing purposes -->

View File

@ -11,5 +11,5 @@ load:
- ../../thirdparty/jquery/jquery.js
- ../../thirdparty/jquery-entwine/dist/*
- ../../thirdparty/jstree/jquery.jstree.js
- ../../javascript/TreeDropdownField.js
- ../../javascript/dist/TreeDropdownField.js
- TreeDropdownField/TreeDropdownField.js

View File

@ -1,38 +1,38 @@
(function($){
// Copyright (c) 2009, SilverStripe Ltd.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the <organization> nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SilverStripe Ltd. ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL SilverStripe Ltd. BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Copyright (c) 2009, SilverStripe Ltd.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the <organization> nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SilverStripe Ltd. ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL SilverStripe Ltd. BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/**
* @class Tracks onchange events on all form fields.
*
* @todo Implement form reset handling
*
* @name jQuery.changetracker
* @author Ingo Schommer, SilverStripe Ltd.
* @license BSD License
*/
/**
* @class Tracks onchange events on all form fields.
*
* @todo Implement form reset handling
*
* @name jQuery.changetracker
* @author Ingo Schommer, SilverStripe Ltd.
* @license BSD License
*/
(function($) {
$.fn.changetracker = function(_options) {
var self = this;

View File

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 154 B

View File

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

View File

@ -1718,7 +1718,7 @@ catch (e) {
var rulelists = store[event] || (store[event] = {});
var rulelist = rulelists[name] || (rulelists[name] = $.entwine.RuleList());
rule = rulelist.addRule(selector, event);
var rule = rulelist.addRule(selector, event);
rule.handler = name;
this.bind_proxy(selector, name, capture);

View File

@ -1718,7 +1718,7 @@ catch (e) {
var rulelists = store[event] || (store[event] = {});
var rulelist = rulelists[name] || (rulelists[name] = $.entwine.RuleList());
rule = rulelist.addRule(selector, event);
var rule = rulelist.addRule(selector, event);
rule.handler = name;
this.bind_proxy(selector, name, capture);

View File

@ -6,7 +6,7 @@
var rulelists = store[event] || (store[event] = {});
var rulelist = rulelists[name] || (rulelists[name] = $.entwine.RuleList());
rule = rulelist.addRule(selector, event);
var rule = rulelist.addRule(selector, event);
rule.handler = name;
this.bind_proxy(selector, name, capture);

View File

@ -1248,7 +1248,7 @@ class Requirements_Backend
// Include i18n.js even if no languages are found. The fact that
// add_i18n_javascript() was called indicates that the methods in
// here are needed.
if(!$langOnly) $files[] = FRAMEWORK_DIR . '/javascript/i18n.js';
if(!$langOnly) $files[] = FRAMEWORK_DIR . '/javascript/dist/i18n.js';
if(substr($langDir,-1) != '/') $langDir .= '/';
@ -1268,7 +1268,7 @@ class Requirements_Backend
} else {
// Stub i18n implementation for when i18n is disabled.
if(!$langOnly) {
$files[] = FRAMEWORK_DIR . '/javascript/i18nx.js';
$files[] = FRAMEWORK_DIR . '/javascript/dist/i18nx.js';
}
}
@ -1311,7 +1311,7 @@ class Requirements_Backend
}
return "{$prefix}{$fileOrUrl}{$mtimesuffix}{$suffix}";
} else {
return false;
throw new InvalidArgumentException("File {$fileOrUrl} does not exist");
}
}