9516 lines
417 KiB
JavaScript
9516 lines
417 KiB
JavaScript
/*minified*/
|
||
!function(C, k, S) {
|
||
|
||
}(_jq, x5engine, window),
|
||
function(r, h) {
|
||
|
||
}(_jq, x5engine),
|
||
function(t, a) {
|
||
|
||
}(_jq, x5engine),
|
||
function(z, j, H) {
|
||
|
||
}(_jq, x5engine, window),
|
||
function(g, m) {
|
||
"use strict";
|
||
g.extend(!0, m.cart.search, {
|
||
cartSearchContainer: g("#im-cartsearch-container"),
|
||
jsonFilter: {
|
||
start: 0,
|
||
length: 10,
|
||
sortOrderBy: "relevance",
|
||
custom: "",
|
||
rootCategory: "",
|
||
rootCategoryCategories: [],
|
||
rootCategoryFilterIgnore: !1,
|
||
categories: [],
|
||
priceStart: -1,
|
||
priceEnd: -1,
|
||
onlyNew: 0,
|
||
onlyDiscounted: 0,
|
||
onlyAvailable: 0
|
||
},
|
||
jsonFilterCache: {},
|
||
currentUrl: window.location.href + (-1 < window.location.href.indexOf("?") ? "" : "?"),
|
||
dataSource: "",
|
||
checkedNodes: [],
|
||
hiddenNodes: {},
|
||
numTotCategories: 0,
|
||
buildInProgress: !1,
|
||
istanceRangeSlider: "",
|
||
initRangeSlider: function() {
|
||
var t = void 0 === g(".js-range-slider").data().from ? 0 : g(".js-range-slider").data().from
|
||
, e = void 0 === g(".js-range-slider").data().to ? 1e12 : g(".js-range-slider").data().to
|
||
, i = g("#im-cartsearch-container .range-slider-container .js-range-slider");
|
||
i.ionRangeSlider({
|
||
type: "double",
|
||
min: t,
|
||
max: e,
|
||
from: t,
|
||
to: e,
|
||
grid: !0,
|
||
hide_min_max: !0,
|
||
hide_from_to: !1,
|
||
force_edges: !0,
|
||
decorate_both: !0,
|
||
skin: "round",
|
||
grid_num: 2,
|
||
prettify_enabled: !0,
|
||
prettify: function(t) {
|
||
return m.cart.formatCurrency(t, void 0, void 0, !0)
|
||
},
|
||
onChange: function(t) {
|
||
m.cart.search.istanceRangeSlider.userFrom = t.from,
|
||
m.cart.search.istanceRangeSlider.userTo = t.to
|
||
},
|
||
onFinish: function(t) {
|
||
m.cart.search.refreshProducts(!0)
|
||
}
|
||
}),
|
||
m.cart.search.istanceRangeSlider = i.data("ionRangeSlider")
|
||
},
|
||
updateRangeSlider: function(t, e, i, n) {
|
||
var r, a;
|
||
x5CartData.searchPage.searchFieldVisibility.price && (r = null != (r = m.cart.search.istanceRangeSlider.userFrom) && t <= r ? r : t,
|
||
a = null != (a = m.cart.search.istanceRangeSlider.userTo) && a <= e ? a : e,
|
||
i = {
|
||
from: i || r,
|
||
to: n || a
|
||
},
|
||
m.cart.search.istanceRangeSlider.result.min != t && (i.min = t),
|
||
m.cart.search.istanceRangeSlider.result.max != e && (i.max = e),
|
||
m.cart.search.istanceRangeSlider.update(i))
|
||
},
|
||
clickPagination: function(t, e) {
|
||
m.cart.search.jsonFilter.start = t,
|
||
m.cart.search.refreshProducts()
|
||
},
|
||
paginate: function() {
|
||
var t = m.cart.htmlProducts.getCounterProducts()
|
||
, e = m.cart.search.jsonFilter.start
|
||
, i = m.cart.search.jsonFilter.length
|
||
, n = '<div id="im-cartsearch-pagination" class="im-cartsearch-pagination pagination-container">'
|
||
, r = (m.l10n.get,
|
||
Math.ceil(t / i))
|
||
, a = e / i + 1;
|
||
if (r < 2)
|
||
return "";
|
||
0 < e && (n += '<a class="page page-prev" onclick="x5engine.cart.search.clickPagination(' + (e - i) + ', this); return false;" data-history="start=' + (e - i) + "&length=" + i + '"></a>');
|
||
for (var s = !1, o = !1, c = 1; c <= r; c++)
|
||
r < 7 || 1 == c || c == r || a - 1 <= c && c <= 1 + a ? n += '<a onclick="x5engine.cart.search.clickPagination(' + i * (c - 1) + ', this); return false;" class="page' + (c == a ? " current" : "") + '" data-history="start=' + i * (c - 1) + "&length=" + i + '">' + c + "</a>" : c < a - 1 && !s ? (n += '<span class="dots-page">...</span>',
|
||
s = !0) : 1 + a < c && !o && (n += '<span class="dots-page">...</span>',
|
||
o = !0);
|
||
return e + i < t && (n += '<a class="page page-next" onclick="x5engine.cart.search.clickPagination(' + (e + i) + ', this); return false;" data-history="start=' + (e + i) + "&length=" + i + '"></a>'),
|
||
n += "</div>"
|
||
},
|
||
paginateCheckOverflow: function() {
|
||
var t, e, i, n = g("#im-cartsearch-pagination");
|
||
n.length && (i = g("#im-cartsearch-container .items-container"),
|
||
t = g("#im-cartsearch-pagination .page-prev"),
|
||
e = g("#im-cartsearch-pagination .page-next"),
|
||
n.css("display", "none"),
|
||
i = i.width(),
|
||
n.css("visibility", "hidden"),
|
||
n.css("display", "block"),
|
||
t.text(m.l10n.get("cmn_pagination_prev")),
|
||
e.text(m.l10n.get("cmn_pagination_next")),
|
||
n.width() > i && (t.text("<"),
|
||
e.text(">")),
|
||
n.css("visibility", "visible"))
|
||
},
|
||
init: function() {
|
||
var t, e, i, n, r = x5CartData.searchPage.searchFieldVisibility, s = (m.cart.ecommerce(x5CartData),
|
||
3);
|
||
function a(t) {
|
||
m.cart.search.cartSearchContainer.hasClass("filter-sidebar-open") && m.cart.search.closeSidebarCSS(),
|
||
m.cart.search.refreshProducts(!0),
|
||
t.stopPropagation()
|
||
}
|
||
m.cart.search.jsonFilter.length = x5CartData.searchPage.cardStyle.cardsPerRow * x5CartData.searchPage.cardStyle.rowsPerPage,
|
||
m.cart.search.urlToJsonFilter(),
|
||
m.cart.search.cartSearchContainer.click(function(t) {
|
||
t.stopPropagation(),
|
||
"main" == t.target.parentNode.nodeName.toLowerCase() && m.cart.search.cartSearchContainer.hasClass("cart-overlay") && m.cart.search.closeSidebarCSS()
|
||
}),
|
||
0 != g("#im-cartsearch-container .btn-sidebar").length && (t = Math.floor(g("#im-cartsearch-container .bar-order .sort-by").height()),
|
||
g("#im-cartsearch-container .btn-sidebar").css({
|
||
height: t,
|
||
width: t
|
||
}),
|
||
g("#im-cartsearch-container .btn-sidebar").click(function(t) {
|
||
t.stopPropagation(),
|
||
m.cart.search.cartSearchContainer.hasClass("filter-sidebar-open") ? m.cart.search.closeSidebarCSS() : m.cart.search.openSidebarCSS()
|
||
}),
|
||
g("#im-cartsearch-container .to-close-sidebar").click(function(t) {
|
||
t.stopPropagation(),
|
||
m.cart.search.closeSidebarCSS()
|
||
})),
|
||
r.custom && (g("#im-cartsearch-container .search").val(m.cart.search.jsonFilter.custom || ""),
|
||
g("#im-cartsearch-container .search-button").click(a),
|
||
g("#im-cartsearch-container .search").keydown(function(t) {
|
||
if (13 == t.which || 13 == t.keyCode)
|
||
return a(t),
|
||
!1
|
||
})),
|
||
r.sortOrderBy && (e = g("#im-cartsearch-container .items-container .bar-order .sort-by .c-order > ul.dropdown-sort .icon-arrow"),
|
||
i = g("#im-cartsearch-container .items-container .bar-order .sort-by .c-order > ul.dropdown-sort .dropdown-sort-inside"),
|
||
g("#im-cartsearch-container .items-container .bar-order .sort-by .c-order > ul.dropdown-sort").click(function() {
|
||
(i.hasClass("show") ? d : l)()
|
||
}),
|
||
g("#im-cartsearch-container .items-container .bar-order .sort-by .c-order > ul.dropdown-sort .dropdown-sort-inside li").click(function(t) {
|
||
t.stopPropagation();
|
||
t = m.l10n.get("cart_search_page_sort_by") + " " + g(this).text();
|
||
g("#im-cartsearch-container .items-container .bar-order .sort-by .c-order > ul.dropdown-sort li .order-selected").text(t),
|
||
d(),
|
||
m.cart.search.refreshProducts(!0)
|
||
})),
|
||
r.price && m.cart.search.initRangeSlider(),
|
||
f(r.discounted, g('input[type="checkbox"][data-id="discounted-products"]'), m.cart.search.jsonFilter.onlyDiscounted),
|
||
f(r.available, g('input[type="checkbox"][data-id="available-products"]'), m.cart.search.jsonFilter.onlyAvailable),
|
||
f(r.new, g('input[type="checkbox"][data-id="new-products"]'), m.cart.search.jsonFilter.onlyNew),
|
||
g('#im-cartsearch-container .filter-sidebar .filter-container[data-id^="property-"]').each(function() {
|
||
var t = g(this)
|
||
, e = m.cart.search.jsonFilter.properties && m.cart.search.jsonFilter.properties[t.attr("data-id").slice(9)] || [];
|
||
t.find('input[type="checkbox"]').each(function() {
|
||
var t = g(this);
|
||
f(!0, t, e.includes(t.attr("data-id")) ? 1 : 0)
|
||
})
|
||
}),
|
||
"Mozilla Firefox" == m.utils.getCurrentBrowser() && g("body").append("<style>#im-cartsearch-container .filter-sidebar .checkbox-list .k-checkbox-label:before { left: 0; }</style>");
|
||
var o = !1
|
||
, c = !1;
|
||
g("#treeview").kendoTreeView({
|
||
checkboxes: {
|
||
checkChildren: !1
|
||
},
|
||
loadOnDemand: !0,
|
||
check: function(t) {
|
||
p(t, this)
|
||
},
|
||
collapse: function(t) {
|
||
o || (o = !0,
|
||
t.preventDefault(),
|
||
this.collapse(t.node),
|
||
o = !1)
|
||
},
|
||
expand: function(t) {
|
||
c || (c = !0,
|
||
t.preventDefault(),
|
||
this.expand(t.node),
|
||
c = !1)
|
||
},
|
||
dataBound: function(t) {
|
||
this.expandRoot && this.expand(t.node.find(".k-item"))
|
||
},
|
||
select: function(t) {
|
||
t.preventDefault(),
|
||
this.dataItem(t.node).set("checked", !this.dataItem(t.node).checked),
|
||
p(t, this)
|
||
},
|
||
dataSource: function() {
|
||
if (null == x5CartData.categories || null == x5CartData.categories.dataSource || 0 == x5CartData.categories.dataSource.length)
|
||
return m.cart.search.dataSource;
|
||
0 < m.cart.search.jsonFilter.rootCategory.length ? function(t, e) {
|
||
for (var i = 0; i < e.length; i++) {
|
||
if (0 < m.cart.search.dataSource.length)
|
||
return;
|
||
if (e[i].id == t)
|
||
return m.cart.search.dataSource = e[i].items,
|
||
g('#im-cartsearch-container [data-id="categories"] .lbl-title').html("").html(e[i].text);
|
||
!function t(e, i) {
|
||
if (null == e)
|
||
return;
|
||
for (var n = 0; n < e.length; n++) {
|
||
if (0 < m.cart.search.dataSource.length)
|
||
return;
|
||
if ("category" == e[n].type && null != e[n].items && 0 < e[n].items.length) {
|
||
if (i == e[n].id)
|
||
return m.cart.search.dataSource = e[n].items,
|
||
void g('#im-cartsearch-container [data-id="categories"] .lbl-title').html("").html(e[n].text);
|
||
t(e[n].items, i)
|
||
}
|
||
}
|
||
}(e[i].items, t)
|
||
}
|
||
}(m.cart.search.jsonFilter.rootCategory, x5CartData.categories.dataSource) : m.cart.search.dataSource = x5CartData.categories.dataSource;
|
||
for (var t = [], e = 0; e < m.cart.search.dataSource.length; e++) {
|
||
var i, n = m.cart.search.dataSource[e];
|
||
"category" == n.type && (m.cart.search.numTotCategories++,
|
||
(i = {}).id = n.id,
|
||
i.text = n.text,
|
||
i.type = n.type,
|
||
i.items = [],
|
||
i.expanded = !1,
|
||
i.checked = -1 < m.cart.search.jsonFilter.categories.indexOf(i.id),
|
||
function t(e, i, n) {
|
||
if (null == n)
|
||
return;
|
||
for (var r = 0; r < n.length; r++) {
|
||
var a;
|
||
"category" == n[r].type && null != n[r].items && 0 < n[r].items.length && (m.cart.search.numTotCategories++,
|
||
(a = {}).id = n[r].id,
|
||
a.text = n[r].text,
|
||
a.type = n[r].type,
|
||
a.items = [],
|
||
a.checked = -1 < m.cart.search.jsonFilter.categories.indexOf(a.id),
|
||
e < s ? t(e + 1, a, n[r].items) : h(a, n[r].items),
|
||
i.items.push(a),
|
||
0 != m.cart.search.jsonFilter.categories.length && !i.checked || m.cart.search.checkedNodes.push(a.id))
|
||
}
|
||
return
|
||
}(2, i, n.items),
|
||
t.push(i),
|
||
0 != m.cart.search.jsonFilter.categories.length && !i.checked || m.cart.search.checkedNodes.push(n.id))
|
||
}
|
||
0 < m.cart.search.jsonFilter.rootCategory.length && (m.cart.search.jsonFilter.rootCategoryCategories = m.cart.search.checkedNodes);
|
||
return t
|
||
}()
|
||
}),
|
||
0 == m.cart.search.jsonFilter.categories.length && (m.cart.search.jsonFilter.categories = m.cart.search.checkedNodes),
|
||
r.categories && 0 < g("#treeview").data("kendoTreeView").options.dataSource.length && (0 == g("#im-cartsearch-container #treeview .k-item div .k-icon").length && g("#im-cartsearch-container #treeview .k-item").css("padding", "0px"),
|
||
5 < g("#treeview").data("kendoTreeView").options.dataSource.length && (g("#im-cartsearch-container #treeview > ul.k-treeview-lines > li.k-item:nth-child(1n+6)").css("display", "none"),
|
||
(n = g('#im-cartsearch-container [data-id="categories"] .show-all-categories')).css("display", "block"),
|
||
n.click(function(t) {
|
||
g("#im-cartsearch-container #treeview > ul.k-treeview-lines > li.k-item:nth-child(1n+6)").css("display", "block"),
|
||
n.css("display", "none")
|
||
})),
|
||
g('#im-cartsearch-container [data-id="categories"]').removeClass("hidden"));
|
||
g("#im-cartsearch-container .filter-sidebar .filter-container").each(function() {
|
||
var e = g(this);
|
||
e.find(".lbl-title").click(function(t) {
|
||
e.toggleClass("closed")
|
||
})
|
||
}),
|
||
m.cart.search.fastRefreshProducts();
|
||
var l = function() {
|
||
i.addClass("show"),
|
||
e.addClass("open")
|
||
}
|
||
, d = function() {
|
||
i.removeClass("show"),
|
||
e.removeClass("open")
|
||
};
|
||
function u(t, e) {
|
||
for (var i, n = 0; n < t.length; n++)
|
||
(t[n].checked || (i = t[n],
|
||
0 < g("#im-cartsearch-container #treeview .k-item input#_" + i.uid + "[type=checkbox]:indeterminate").length)) && e.push(t[n].id),
|
||
t[n].hasChildren && u(t[n].children.view(), e)
|
||
}
|
||
function p(i, t) {
|
||
t.expandRoot = i.node,
|
||
t.expand(g(t.expandRoot).find(".k-item").addBack());
|
||
var n = g(i.node).find("input[type=checkbox]").filter(":first").is(":checked")
|
||
, t = (g(i.node).find(".k-group input").prop("checked", n),
|
||
g(i.node).find(".k-group li.k-item").each(function(t, e) {
|
||
i.sender.dataSource.getByUid(g(e).attr("data-uid")).checked = n
|
||
}),
|
||
[]);
|
||
u(i.sender.dataSource.view(), t),
|
||
m.cart.search.checkedNodes = t,
|
||
m.cart.search.jsonFilter.rootCategoryFilterIgnore = "" != m.cart.search.jsonFilter.rootCategory && 0 < t.length,
|
||
m.cart.search.refreshProducts(!0, !0)
|
||
}
|
||
function h(t, e) {
|
||
if (null != e)
|
||
for (var i, n = 0; n < e.length; n++)
|
||
"category" == e[n].type && null != e[n].items && 0 < e[n].items.length && ((i = {}).id = e[n].id,
|
||
i.type = e[n].type,
|
||
i.items = [],
|
||
null == m.cart.search.hiddenNodes[t.id] && (m.cart.search.hiddenNodes[t.id] = []),
|
||
m.cart.search.hiddenNodes[t.id].push(i.id),
|
||
h(t, e[n].items))
|
||
}
|
||
function f(t, e, i) {
|
||
var n;
|
||
t && (i && 1 == i && e.prop("checked", !0),
|
||
(n = e.parent().parent()).on("click", function() {
|
||
n.find(".k-checkbox-wrapper").find(e).prop("checked", !e.prop("checked")),
|
||
m.cart.search.refreshProducts(!0)
|
||
}))
|
||
}
|
||
},
|
||
updateFiltersVisibilityAfterSearchExecution: function(i) {
|
||
var t = g('#im-cartsearch-container .filter-sidebar .filter-container[data-id="price"]');
|
||
i.minPrice || i.maxPrice ? (t.show(),
|
||
m.cart.search.updateRangeSlider(i.minPrice, i.maxPrice, i.priceStart, i.priceEnd)) : t.hide(),
|
||
g('#im-cartsearch-container .filter-sidebar .filter-container[data-id^="property-"]').each(function() {
|
||
var t = g(this)
|
||
, e = i.properties[t.attr("data-id").slice(9)];
|
||
e && e.length ? (t.show(),
|
||
t.find("li").each(function() {
|
||
var t = g(this);
|
||
t.toggle(e.includes(t.attr("data-id")))
|
||
})) : t.hide()
|
||
})
|
||
},
|
||
urlToJsonFilter: function() {
|
||
var t = m.cart.search.jsonFilter
|
||
, e = window.location.search.substring(1);
|
||
if ("" != e) {
|
||
var i, e = function(t) {
|
||
for (var e = t.split("&"), i = {}, n = 0; n < e.length; n++) {
|
||
var r = e[n].split("=")
|
||
, a = decodeURIComponent(r[0])
|
||
, r = decodeURIComponent(r[1]);
|
||
void 0 === i[a] ? i[a] = r : "string" == typeof i[a] ? i[a] = [i[a], r] : i[a].push(r)
|
||
}
|
||
return i
|
||
}(e);
|
||
if (null != e.start && null != e.length && (t.start = e.start,
|
||
t.length = e.length),
|
||
null != e.sortOrderBy && (t.sortOrderBy = e.sortOrderBy),
|
||
null != e.q && (t.custom = e.q.replace(/\+/g, " ").trim()),
|
||
e.rootCategory && (t.rootCategory = e.rootCategory),
|
||
e.categories) {
|
||
var n = e.categories.split("|");
|
||
if (0 < n.length) {
|
||
t.categories = [];
|
||
for (var r = 0; r < n.length; r++)
|
||
t.categories.push(n[r])
|
||
}
|
||
}
|
||
e.prc && (i = e.prc.split("-"),
|
||
t.priceStart = i[0],
|
||
t.priceEnd = i[1]),
|
||
null != e.new && (t.onlyNew = e.new),
|
||
null != e.discounted && (t.onlyDiscounted = e.discounted),
|
||
null != e.available && (t.onlyAvailable = e.available),
|
||
e.properties && (t.properties = JSON.parse(decodeURIComponent(escape(window.atob(decodeURIComponent(e.properties))))))
|
||
}
|
||
},
|
||
fieldsToJsonFilter: function() {
|
||
var t, e = x5CartData.searchPage.searchFieldVisibility, i = m.cart.search.jsonFilter;
|
||
if (e.sortOrderBy && (t = (t = g(".order-selected").text().replace(m.l10n.get("cart_search_page_sort_by"), "").trim()) == m.l10n.get("cart_search_page_sort_price_asc") ? "price_asc" : t == m.l10n.get("cart_search_page_sort_price_desc") ? "price_desc" : "relevance",
|
||
i.sortOrderBy = t),
|
||
e.custom && (t = g("#im-cartsearch-container .filter-sidebar .search").val(),
|
||
i.custom = t.replace(/\+/g, " ").trim()),
|
||
e.categories) {
|
||
var n = m.cart.search.checkedNodes;
|
||
if (i.categories = [],
|
||
0 < n.length)
|
||
for (var r = 0; r < n.length; r++)
|
||
i.categories.push(n[r]);
|
||
else if (0 < m.cart.search.jsonFilter.rootCategory.length)
|
||
for (r = 0; r < m.cart.search.jsonFilter.rootCategoryCategories.length; r++)
|
||
i.categories.push(m.cart.search.jsonFilter.rootCategoryCategories[r])
|
||
}
|
||
e.price && (i.priceStart = null != m.cart.search.istanceRangeSlider.userFrom ? m.cart.search.istanceRangeSlider.userFrom : -1,
|
||
i.priceEnd = null != m.cart.search.istanceRangeSlider.userTo ? m.cart.search.istanceRangeSlider.userTo : -1),
|
||
e.new && (t = g('input[type="checkbox"][data-id="new-products"]'),
|
||
i.onlyNew = t.is(":checked") ? 1 : 0),
|
||
e.discounted && (t = g('input[type="checkbox"][data-id="discounted-products"]'),
|
||
i.onlyDiscounted = t.is(":checked") ? 1 : 0),
|
||
e.available && (t = g('input[type="checkbox"][data-id="available-products"]'),
|
||
i.onlyAvailable = t.is(":checked") ? 1 : 0),
|
||
delete i.properties,
|
||
g('#im-cartsearch-container .filter-sidebar [data-id^="property-"]').each(function() {
|
||
var t = [];
|
||
g(this).find('input[type="checkbox"]:checked').each(function() {
|
||
t.push(g(this).attr("data-id"))
|
||
}),
|
||
0 < t.length && (i.properties = i.properties || {},
|
||
i.properties[g(this).attr("data-id").slice(9)] = t)
|
||
})
|
||
},
|
||
jsonFilterToUrl: function() {
|
||
var t = m.cart.search.jsonFilter
|
||
, e = "";
|
||
if (0 !== Object.keys(t).length) {
|
||
if (t.start && t.length && (e += "&start=" + t.start + "&length=" + t.length),
|
||
t.sortOrderBy && (e += "&sortOrderBy=" + t.sortOrderBy),
|
||
t.custom && "" != t.custom && (e += "&q=" + t.custom.trim().replace(/ /g, "+")),
|
||
t.rootCategory && "" != t.rootCategory && (e += "&rootCategory=" + t.rootCategory),
|
||
t.categories) {
|
||
var i = m.cart.search.checkedNodes;
|
||
if (0 < i.length) {
|
||
e += "&categories=";
|
||
for (var n = 0; n < i.length; n++)
|
||
e += i[n] + "|";
|
||
e = e.substring(0, e.length - 1)
|
||
}
|
||
}
|
||
null != t.priceStart && -1 < t.priceStart && (e += "&prc=" + t.priceStart + "-" + t.priceEnd),
|
||
t.onlyNew && (e += "&new=" + t.onlyNew),
|
||
t.onlyDiscounted && (e += "&discounted=" + t.onlyDiscounted),
|
||
t.onlyAvailable && (e += "&available=" + t.onlyAvailable),
|
||
t.properties && (e += "&properties=" + encodeURIComponent(window.btoa(unescape(encodeURIComponent(JSON.stringify(t.properties)))))),
|
||
"" != e && (e = "?" + e),
|
||
m.cart.search.currentUrl = (x5CartData.settings.searchpage_url + e).replace("?&", "?"),
|
||
window.history.pushState("", "", m.cart.search.currentUrl)
|
||
}
|
||
},
|
||
refreshProducts: function(t, e) {
|
||
m.cart.search.buildInProgress = !0,
|
||
m.cart.search.showSidebarLoading(),
|
||
t && (m.cart.search.jsonFilter.start = 0),
|
||
e && (m.cart.search.jsonFilterCache = {}),
|
||
m.utils.scrollTo(0),
|
||
m.cart.search.fieldsToJsonFilter(),
|
||
m.cart.search.loadProducts(),
|
||
m.cart.search.jsonFilterToUrl()
|
||
},
|
||
fastRefreshProducts: function() {
|
||
m.cart.search.buildInProgress = !0,
|
||
m.cart.search.showLoading(),
|
||
m.cart.search.loadProducts()
|
||
},
|
||
loadProducts: function() {
|
||
m.cart.search.deepCompare(m.cart.search.jsonFilter, m.cart.search.jsonFilterCache) ? m.cart.search.hideLoading() : (m.cart.search.jsonFilterCache = JSON.parse(JSON.stringify(m.cart.search.jsonFilter)),
|
||
m.cart.htmlProducts.build(m.cart.search.jsonFilter))
|
||
},
|
||
draw: function(t) {
|
||
"" == (t += m.cart.search.paginate()) && (t = '<p class="search-empty">' + m.l10n.get("search_empty") + "</p>"),
|
||
g("#im-products").html("").append(t),
|
||
g("#im-cartsearch-container .bar-order .total-results .total_product_found").html("").html(m.cart.htmlProducts.getCounterProducts()),
|
||
1 == m.cart.htmlProducts.getCounterProducts() ? g("#im-cartsearch-container .bar-order .total-results .label-products-found").html("").html(" " + m.l10n.get("cart_search_page_product_found")) : g("#im-cartsearch-container .bar-order .total-results .label-products-found").html("").html(" " + m.l10n.get("cart_search_page_products_found")),
|
||
m.cart.search.paginateCheckOverflow(),
|
||
m.cart.search.buildInProgress = !1,
|
||
m.cart.search.hideLoading()
|
||
},
|
||
deepCompare: function(t, e) {
|
||
var r, a;
|
||
return r = [],
|
||
a = [],
|
||
!!function t(e, i) {
|
||
if (isNaN(e) && isNaN(i) && "number" == typeof e && "number" == typeof i)
|
||
return 1;
|
||
if (e === i)
|
||
return 1;
|
||
if ("function" == typeof e && "function" == typeof i || e instanceof Date && i instanceof Date || e instanceof RegExp && i instanceof RegExp || e instanceof String && i instanceof String || e instanceof Number && i instanceof Number)
|
||
return e.toString() === i.toString();
|
||
if (e instanceof Object && i instanceof Object && !e.isPrototypeOf(i) && !i.isPrototypeOf(e) && e.constructor === i.constructor && e.prototype === i.prototype && !(-1 < r.indexOf(e) || -1 < a.indexOf(i))) {
|
||
for (var n in i) {
|
||
if (i.hasOwnProperty(n) !== e.hasOwnProperty(n))
|
||
return;
|
||
if (typeof i[n] != typeof e[n])
|
||
return
|
||
}
|
||
for (n in e) {
|
||
if (i.hasOwnProperty(n) !== e.hasOwnProperty(n))
|
||
return;
|
||
if (typeof i[n] != typeof e[n])
|
||
return;
|
||
switch (typeof e[n]) {
|
||
case "object":
|
||
case "function":
|
||
if (r.push(e),
|
||
a.push(i),
|
||
!t(e[n], i[n]))
|
||
return;
|
||
r.pop(),
|
||
a.pop();
|
||
break;
|
||
default:
|
||
if (e[n] !== i[n])
|
||
return
|
||
}
|
||
}
|
||
return 1
|
||
}
|
||
}(t, e)
|
||
},
|
||
closeSidebarCSS: function() {
|
||
g("body").removeClass("filter-sidebar-open"),
|
||
m.cart.search.cartSearchContainer.removeClass("filter-sidebar-open"),
|
||
m.cart.search.cartSearchContainer.removeClass("cart-overlay")
|
||
},
|
||
openSidebarCSS: function() {
|
||
g("body").addClass("filter-sidebar-open"),
|
||
m.cart.search.cartSearchContainer.addClass("filter-sidebar-open"),
|
||
m.cart.search.cartSearchContainer.addClass("cart-overlay")
|
||
},
|
||
cleanOverlay: function() {
|
||
"fixed" != g("#im-cartsearch-container .filter-sidebar").css("position") && m.cart.search.cartSearchContainer.hasClass("cart-overlay") && m.cart.search.closeSidebarCSS();
|
||
var t = Math.floor(g("#im-cartsearch-container .bar-order .sort-by").height());
|
||
g("#im-cartsearch-container .btn-sidebar").css({
|
||
height: t,
|
||
width: t
|
||
})
|
||
},
|
||
showSidebarLoading: function() {
|
||
m.cart.search.cartSearchContainer.hasClass("filter-sidebar-open") && (g("#im-cartsearch-container .search-button").hide(),
|
||
g("#im-cartsearch-container .search-spinner").show())
|
||
},
|
||
showLoading: function() {
|
||
m.cart.search.showSidebarLoading(),
|
||
m.cart.search.buildInProgress && g("#im-spinner-overlay").length < 1 && (g("#im-cartsearch-container").prepend('<div id="im-spinner-overlay" style="position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 10703;"></div>'),
|
||
g("#im-cartsearch-container .items-container .content #im-spinner-wrapper").css("display", "flex"))
|
||
},
|
||
hideLoading: function() {
|
||
g("#im-cartsearch-container .search-button").show(),
|
||
g("#im-cartsearch-container .search-spinner").hide(),
|
||
0 < g("#im-spinner-overlay").length && g("#im-spinner-overlay").fadeOut(500, function() {
|
||
g("#im-cartsearch-container .items-container .content #im-spinner-wrapper").css("display", "none"),
|
||
g("#im-spinner-overlay").remove()
|
||
})
|
||
}
|
||
})
|
||
}(_jq, x5engine, window),
|
||
function(t, e) {
|
||
"use strict";
|
||
t.extend(!0, e.cart, {
|
||
productsDataSettings: {
|
||
getSearchPageCardLinks: function(t) {
|
||
var e = x5CartData.searchPage.cardStyle.card.image.isLink && t.showboxLink;
|
||
return {
|
||
image: e || t.link,
|
||
title: t.link || e
|
||
}
|
||
},
|
||
showAvailability: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showAvailability
|
||
},
|
||
showOptions: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showOptions
|
||
},
|
||
showCategory: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showCategory
|
||
},
|
||
showPrice: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showPrice
|
||
},
|
||
showQuantity: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showQuantity
|
||
},
|
||
showVat: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.details.showVat
|
||
},
|
||
showName: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.name.show
|
||
},
|
||
showDescription: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.description.show
|
||
},
|
||
showButton: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.button.show
|
||
},
|
||
buttonType: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.button.useAddToCartImage
|
||
},
|
||
goToCartAfterProductAdding: function() {
|
||
return x5CartData.searchPage.cardStyle.card.goCartAfterProductAdding
|
||
},
|
||
availabilityImage: function() {
|
||
return "../" + x5CartData.settings.availabilityImage
|
||
},
|
||
noPreviewImage: function() {
|
||
return x5CartData.settings.noPreviewImage
|
||
},
|
||
cockadesNewImage: function() {
|
||
return x5CartData.searchPage.cardStyle.card.cockades.new
|
||
},
|
||
cockadesDiscountImage: function() {
|
||
return x5CartData.searchPage.cardStyle.card.cockades.discount
|
||
},
|
||
addToCartImage: function() {
|
||
return x5CartData.searchPage.cardStyle.card.txtBlock.button.image_obj
|
||
}
|
||
}
|
||
})
|
||
}(_jq, x5engine),
|
||
function(n, G) {
|
||
"use strict";
|
||
n.extend(!0, G.cart, {
|
||
htmlProducts: {
|
||
counterProducts: 0,
|
||
getCounterProducts: function() {
|
||
return G.cart.htmlProducts.counterProducts
|
||
},
|
||
setCounterProducts: function(t) {
|
||
G.cart.htmlProducts.counterProducts = t
|
||
},
|
||
prodCache: {},
|
||
build: function(t) {
|
||
function e() {
|
||
var t, e = ("relevance" == v.sortOrderBy ? (t = x5CartData.products,
|
||
Object.keys(t)) : (t = x5CartData.products_ordered_by_price.slice(0),
|
||
x5CartData.products_ordered_by_price)).length, i = "", n = [], r = 0, a = (G.cart.htmlProducts.setCounterProducts(r),
|
||
"price_desc" == v.sortOrderBy ? e - 1 : 0), s = v.start, o = e < s + v.length ? e : s + v.length;
|
||
if (!(e <= s || o <= s)) {
|
||
for (var c = new Date, l = !1, d = function(t) {
|
||
var e, i = {
|
||
properties: {}
|
||
};
|
||
for (e in t.priceStart && -1 != t.priceStart && (i.priceStart = t.priceStart),
|
||
t.priceEnd && -1 != t.priceEnd && (i.priceEnd = t.priceEnd),
|
||
t.properties) {
|
||
i.properties[e] = [];
|
||
for (var n = 0; n < t.properties[e].length; n++)
|
||
i.properties[e].push(t.properties[e][n])
|
||
}
|
||
return i
|
||
}(v), u = function(t, e) {
|
||
function i(t, e) {
|
||
e && (d.properties[t] = d.properties[t] || [],
|
||
d.properties[t].includes(e) || d.properties[t].push(e))
|
||
}
|
||
var n;
|
||
e && "price" != e || (n = _(t).singlePrice(void 0, !0),
|
||
(null == d.minPrice || d.minPrice > n) && (d.minPrice = n),
|
||
(null == d.maxPrice || d.maxPrice < n) && (d.maxPrice = n));
|
||
if (e)
|
||
e.startsWith("property-") && i(r = e.slice(9), t.properties[r]);
|
||
else
|
||
for (var r in t.properties)
|
||
i(r, t.properties[r])
|
||
}, p = function(c) {
|
||
var t = [];
|
||
if (c.custom != "")
|
||
t.push({
|
||
id: "custom",
|
||
check: function(t) {
|
||
var e = t.name != "" ? t.name.toLowerCase().trim() : "";
|
||
var i = t.description != "" ? t.description.toLowerCase().trim() : "";
|
||
var n = t.sku != "" ? t.sku.toLowerCase().trim() : "";
|
||
var r = c.custom.toLowerCase();
|
||
var a = '"';
|
||
var s = G.utils.splitWordByText(r, " ", a);
|
||
for (var o = 0; o < s.length; o++)
|
||
if (e.indexOf(s[o]) > -1 || i.indexOf(s[o]) > -1 || n.indexOf(s[o]) > -1)
|
||
return true;
|
||
return false
|
||
}
|
||
});
|
||
if (c.rootCategory || c.categories.length && c.categories.length != G.cart.search.numTotCategories)
|
||
t.push({
|
||
id: "category",
|
||
check: function(r) {
|
||
var t = function(t) {
|
||
for (var e = 0; e < t.length; e++) {
|
||
if (t[e] == r.category)
|
||
return true;
|
||
if (t[e]in G.cart.search.hiddenNodes) {
|
||
var i = G.cart.search.hiddenNodes[t[e]];
|
||
for (var n = 0; n < i.length; n++)
|
||
if (i[n] == r.category)
|
||
return true
|
||
}
|
||
}
|
||
return false
|
||
};
|
||
if (!c.rootCategoryFilterIgnore && c.rootCategory == r.category)
|
||
return true;
|
||
else if (c.categories.length <= G.cart.search.numTotCategories)
|
||
return t(c.categories);
|
||
return false
|
||
}
|
||
});
|
||
if (c.onlyNew == 1)
|
||
t.push({
|
||
id: "only-new",
|
||
check: function(t) {
|
||
return t.isNew
|
||
}
|
||
});
|
||
if (c.onlyDiscounted == 1)
|
||
t.push({
|
||
id: "only-discounted",
|
||
check: V
|
||
});
|
||
if (c.onlyAvailable == 1)
|
||
t.push({
|
||
id: "only-available",
|
||
check: function(t) {
|
||
if (t.availabilityType != "unset")
|
||
if (t.availabilityType == "fixed") {
|
||
if (t.staticAvailValue == "notavailable" || t.staticAvailValue == "unknown")
|
||
return false
|
||
} else if (!G.utils.isOnline()) {
|
||
if (t.staticAvailValue == "notavailable" || t.staticAvailValue == "unknown")
|
||
return false
|
||
} else if (S[t.id])
|
||
if (S[t.id].availability == "notavailable")
|
||
return false;
|
||
return true
|
||
}
|
||
});
|
||
var e = function(e, i) {
|
||
return {
|
||
id: "property-" + e,
|
||
check: function(t) {
|
||
return t.properties && t.properties[e] && i.includes(t.properties[e])
|
||
}
|
||
}
|
||
};
|
||
if (c.properties)
|
||
for (var i in c.properties)
|
||
t.push(e(i, c.properties[i]));
|
||
if (c.priceStart >= 0 || c.priceEnd >= 0)
|
||
t.push({
|
||
id: "price",
|
||
check: function(t) {
|
||
var e = _(t).singlePrice(undefined, true);
|
||
return e >= c.priceStart && (c.priceEnd < 0 || e <= c.priceEnd)
|
||
}
|
||
});
|
||
return t
|
||
}(v); "price_desc" == v.sortOrderBy ? -1 < a : a < e; ) {
|
||
var h, f = new Date, f = (!l && 1 <= (f - c) / 1e3 && (G.cart.search.showLoading(),
|
||
l = !0),
|
||
f = ("relevance" == v.sortOrderBy ? Object.keys(t) : t)[a],
|
||
x5CartData.products[f]), g = function(t, e) {
|
||
for (var i = [], n = 0; n < t.length && i.length < 2; n++)
|
||
if (!t[n].check(e))
|
||
i.push(t[n].id);
|
||
return i
|
||
}(p, f);
|
||
0 == g.length ? (u(f),
|
||
s <= r && r < o && (null != (h = function(t) {
|
||
var e = '\t<div id="' + P + "_" + t.id + '" class="im-products-card' + (N && t.availabilityType != "unset" ? " im-products-card-with-availability" : "") + (M && t.options != undefined ? " im-products-card-with-options" : "") + '">\n', i = D.getSearchPageCardLinks(t), n = "", r = "im-products-image", a, s, o;
|
||
if (t.media != null && t.media.length > 0 && t.media[0] != null)
|
||
n = "../" + (t.media[0].type === "video" ? "res/video_thumb.svg" : t.media[0].url);
|
||
else {
|
||
n = "../" + D.noPreviewImage();
|
||
r += " contain"
|
||
}
|
||
if (e = (e += '\t\t<div class="im-wrapper-products-image">') + ('\t\t\t<img class="' + r + '"' + (n != "" ? ' src="' + n + '"' : "") + ' alt="' + t.name + '" ' + G.utils.linkJs(i.image, {
|
||
baseUrl: "../"
|
||
}) + "/>") + "\t\t</div>",
|
||
A)
|
||
e += '\t\t<div class="im-products-name">' + G.utils.linkHtml(i.title, {
|
||
content: t.name,
|
||
baseUrl: "../"
|
||
}) + "</div>\n";
|
||
if (I) {
|
||
var c = null;
|
||
if (x5CartData.categories != undefined && x5CartData.categories.dataSource != undefined) {
|
||
var l = function(t, e) {
|
||
if (e == undefined || e == null)
|
||
return;
|
||
for (var i = 0; i < e.length; i++)
|
||
if (e[i].type == "category")
|
||
if (e[i].id == t)
|
||
return e[i].text;
|
||
else if (e[i].items != undefined && e[i].items.length > 0) {
|
||
var n = l(t, e[i].items);
|
||
if (n)
|
||
return n
|
||
}
|
||
return null
|
||
};
|
||
c = l(t.category, x5CartData.categories.dataSource);
|
||
if (c != null)
|
||
e += '\t\t<div class="im-products-category">' + c + "</div>\n"
|
||
}
|
||
}
|
||
if (O) {
|
||
var d = t.description.replace("\n", "<br />").replace("\r", "").replace("\\", "\\\\").replace("'", "'");
|
||
e += '\t\t<div class="im-products-description">' + d + '<div class="im-products-description-fade"></div></div>\n'
|
||
}
|
||
if (M || N || E || q)
|
||
e += '\t\t<div class="im-products-separator"></div>\n';
|
||
if (N && t.availabilityType != "unset") {
|
||
e += '\t\t<div class="im-products-availability">';
|
||
if (t.availabilityType == "fixed") {
|
||
if (!G.utils.isNullOrEmpty($) && t.staticAvailValue != "unknown")
|
||
e += U(t.staticAvailValue) + j(t.staticAvailValue)
|
||
} else if (!T) {
|
||
e += "<table><tr>" + '<td style="vertical-align: middle">' + U(t.staticAvailValue) + "</td>";
|
||
e += '<td style="vertical-align: middle">' + H(t.staticAvailValue, t.offlineAvailableItems) + "</td>";
|
||
e += "</tr></table>"
|
||
} else if (S[t.id]) {
|
||
var u = S[t.id].availability;
|
||
e += "<table><tr>";
|
||
e += '<td style="vertical-align: middle">';
|
||
e += U(u);
|
||
e += "</td>";
|
||
e += '<td style="vertical-align: middle">';
|
||
e += H(u, S[t.id].quantity);
|
||
e += "</td></tr></table>"
|
||
}
|
||
e += "</div>\n"
|
||
}
|
||
if (t.quantityDiscounts && F) {
|
||
e += "\t\t<div class=\"im-products-qty-discount\" onmouseover=\"x5engine.imTip.Show(this, {target: $(this).find('img'), text: '<div>" + G.l10n.get("cart_discount") + ":</div><ul>";
|
||
for (var p in t.quantityDiscounts) {
|
||
var h = p;
|
||
var f = (t.quantityDiscounts[p] * 100).toFixed(2);
|
||
var g = f % 1 == 0 ? parseInt(f) : f;
|
||
e += "<li>" + G.l10n.get("cart_discount_per_qty").replace("[QUANTITY]", h).replace("[DISCOUNT]", g) + "</li>"
|
||
}
|
||
e += "</ul>'})\">\n" + '\t\t\t<img alt="' + G.l10n.get("cart_qty_discount") + '" width="16" height="16" src="../res/info.gif" />\n' + "\t\t\t" + G.l10n.get("cart_qty_discount") + "\n" + "\t\t</div>\n"
|
||
}
|
||
if (M && t.options) {
|
||
var m = 0;
|
||
var v = '\t\t<div class="im-products-options">\n';
|
||
for (o in t.options)
|
||
if (t.options[o].suboptions != undefined && t.options[o].suboptions.length > 0)
|
||
m = m + t.options[o].suboptions.length;
|
||
if (m == 0) {
|
||
v += '\t\t\t<select id="product_' + t.id + '_opt" onchange="x5engine.cart.ui.updateProductListOptions(\'' + t.id + "', this, 'product_" + t.id + "', " + (R ? "true" : "false") + ');" style="' + (t.options[Object.keys(t.options)[0]].suboptions == undefined || t.options[Object.keys(t.options)[0]].suboptions.length == 0 ? "width: 99%; " : "width: 47%;") + '">\n';
|
||
for (o in t.options) {
|
||
a = o;
|
||
s = t.options[o];
|
||
v += '\t\t\t\t<option value="' + a + '">' + s.name + "</option>\n"
|
||
}
|
||
v += "\t\t\t</select>\n"
|
||
} else {
|
||
v += '\t\t\t<select id="product_' + t.id + '_opt" onchange="x5engine.cart.ui.updateProductListOptions(\'' + t.id + "', this, 'product_" + t.id + "', " + (R ? "true" : "false") + ');" style="' + (t.options[Object.keys(t.options)[0]].suboptions == undefined || t.options[Object.keys(t.options)[0]].suboptions.length == 0 ? "width: 99%; " : "width: 47%;") + '">\n';
|
||
for (o in t.options) {
|
||
a = o;
|
||
s = t.options[o];
|
||
v += '\t\t\t\t<option value="' + a + '">' + G.utils.htmlDecode(s.name) + "</option>\n"
|
||
}
|
||
v += "\t\t\t</select>\n";
|
||
var _ = t.options[Object.keys(t.options)[0]];
|
||
if (_.suboptions != undefined && _.suboptions.length > 0) {
|
||
v += '\t\t\t<select id="product_' + t.id + '_subopt" style="width: 47%;">\n';
|
||
for (var y = 0; y < _.suboptions.length; y++)
|
||
v += '\t\t\t\t<option value="' + y + '">' + G.utils.htmlDecode(_.suboptions[y]) + "</option>\n";
|
||
v += "\t\t\t</select>\n"
|
||
}
|
||
}
|
||
v += "\t\t</div>\n";
|
||
e += v
|
||
}
|
||
if (E) {
|
||
e += '\t\t<div class="im-products-price">\n';
|
||
e += L(t, P);
|
||
e += "</div>"
|
||
}
|
||
if (q && F)
|
||
e += '\t\t<input type="number" id="product_' + t.id + '_qty" class="im-products-qty" value="1" min="1" />\n';
|
||
if (q) {
|
||
var b = G.l10n.get("cart_add");
|
||
if (D.buttonType() == "image") {
|
||
var x = D.addToCartImage();
|
||
if (x) {
|
||
var w = "../" + x.image;
|
||
b = '<img width="' + x.width + '" height="' + x.height + '" src="' + w + '" alt="' + b + '" title="' + b + '" />'
|
||
}
|
||
}
|
||
e += '\t\t<div class="im-products-button" onclick="x5engine.cart.ui.addToCart(\'' + t.id + "', $('#product_" + t.id + "_qty').val(), $('#product_" + t.id + "_opt').val(), $('#product_" + t.id + "_subopt').val(), " + (D.goToCartAfterProductAdding() ? "true" : "false") + ", '" + "../" + "');\">" + b + "</div>\n"
|
||
}
|
||
if (t.isNew)
|
||
e += B(D.cockadesNewImage(), "New!");
|
||
if (V(t))
|
||
e += B(D.cockadesDiscountImage(), "Discount!");
|
||
e += "\t</div>\n";
|
||
var C = null;
|
||
if (t.schemaOrg) {
|
||
var k = G.cart.search.currentUrl + "#" + P + "_" + t.id;
|
||
t.schemaOrg.url = k;
|
||
if (t.schemaOrg.offers) {
|
||
t.schemaOrg.offers.url = k;
|
||
if (t.availabilityType == "dynamic" && T && S[t.id])
|
||
t.schemaOrg.offers.availability = z(S[t.id].availability)
|
||
}
|
||
C = t.schemaOrg
|
||
}
|
||
return {
|
||
html: e,
|
||
schemaOrg: C
|
||
}
|
||
}(f)).schemaOrg && n.push(h.schemaOrg),
|
||
i += h.html),
|
||
r++) : 1 == g.length && u(f, g[0]),
|
||
a = "price_desc" == v.sortOrderBy ? a - 1 : a + 1
|
||
}
|
||
if (G.cart.htmlProducts.setCounterProducts(r),
|
||
G.cart.search.updateFiltersVisibilityAfterSearchExecution(d),
|
||
0 < n.length) {
|
||
for (var m = [], a = 0; a < n.length; a++)
|
||
m.push({
|
||
"@type": "ListItem",
|
||
position: a + 1,
|
||
item: n[a]
|
||
});
|
||
i = '<script type="application/ld+json">' + JSON.stringify({
|
||
"@context": "https://schema.org",
|
||
"@type": "ItemList",
|
||
numberOfItems: n.length,
|
||
itemListElement: m
|
||
}) + "<\/script>" + i
|
||
}
|
||
return i
|
||
}
|
||
}
|
||
function r(t) {
|
||
return -1 < i.regardlessOfCouponAndQuantity.indexOf(t.id)
|
||
}
|
||
var S, i, v = n.extend(!0, {
|
||
start: "0",
|
||
length: "10",
|
||
sortOrderBy: "relevance",
|
||
custom: "",
|
||
categories: [],
|
||
priceStart: -1,
|
||
priceEnd: -1,
|
||
onlyNew: 0,
|
||
onlyDiscounted: 0,
|
||
onlyAvailable: 0
|
||
}, t), P = "im-products", t = G.cart.settings(), T = G.utils.isOnline(), D = G.cart.productsDataSettings, N = D.showAvailability(), M = D.showOptions(), A = D.showName(), O = D.showDescription(), I = D.showCategory(), E = D.showPrice(), F = D.showQuantity(), R = "included" === t.vattype, q = D.showButton(), $ = D.availabilityImage(), _ = function(t) {
|
||
return G.cart.htmlProducts.prodCache[t.id] || (G.cart.htmlProducts.prodCache[t.id] = new G.cart.product(x5CartData.products[t.id],{
|
||
quiet: !0
|
||
})),
|
||
G.cart.htmlProducts.prodCache[t.id]
|
||
}, U = function(t) {
|
||
var e = ""
|
||
, i = "../" + x5CartData.settings.availabilityImage;
|
||
if (null != i)
|
||
switch (t) {
|
||
case "available":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: 0 0;\"></span>\n";
|
||
break;
|
||
case "lacking":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: -22px 0;\"></span>\n";
|
||
break;
|
||
case "notavailable":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: -44px 0;\"></span>\n"
|
||
}
|
||
return e
|
||
}, z = function(t) {
|
||
switch (t) {
|
||
case "available":
|
||
return "http://schema.org/InStock";
|
||
case "lacking":
|
||
return "http://schema.org/LimitedAvailability";
|
||
default:
|
||
return "http://schema.org/OutOfStock"
|
||
}
|
||
}, j = function(t) {
|
||
switch (t) {
|
||
case "available":
|
||
return G.l10n.get("cart_fixedproduct_available");
|
||
case "lacking":
|
||
return G.l10n.get("cart_fixedproduct_lack");
|
||
case "notavailable":
|
||
return G.l10n.get("cart_fixedproduct_unavailable")
|
||
}
|
||
return ""
|
||
}, H = function(t, e) {
|
||
switch (t) {
|
||
case "available":
|
||
return G.l10n.get("cart_dynamicproduct_available").replace("[QUANTITY]", e);
|
||
case "lacking":
|
||
return G.l10n.get("cart_dynamicproduct_lack").replace("[QUANTITY]", e);
|
||
case "notavailable":
|
||
return G.l10n.get("cart_dynamicproduct_unavailable").replace("[QUANTITY]", e)
|
||
}
|
||
return ""
|
||
}, B = function(t, e) {
|
||
return t && t.image_obj ? '\t\t<img src="../' + t.image_obj.image + '" style="position: absolute; max-height: ' + t.image_obj.height + "px; max-width: " + t.image_obj.width + "px; width: " + t.size + "%; z-index: 2; " + function(t) {
|
||
switch (t) {
|
||
case "topleft":
|
||
return "top: 0; left: 0;";
|
||
case "topright":
|
||
return "top: 0; right: 0;";
|
||
case "bottomright":
|
||
return "bottom: 0; right: 0;";
|
||
case "bottomleft":
|
||
return "bottom: 0; left: 0;"
|
||
}
|
||
return ""
|
||
}(t.align) + '" alt="' + e + '" />\n' : ""
|
||
}, L = function(t) {
|
||
var e, i = G.cart.productsDataSettings.showVat() && "none" != x5CartData.settings.vattype ? '<span style="margin: 3px; font-size: 0.85em;">' + G.l10n.get(R ? "cart_showvat_included" : "cart_showvat_excluded").replace("[FIELD]", t.vat).replace("[NAME]", t.vatName) + "</span>" : "", n = _(t).singleFullPrice(void 0, R), n = G.cart.formatCurrency(n);
|
||
return r(t) ? (e = _(t).singlePrice(void 0, R),
|
||
e = G.cart.formatCurrency(e),
|
||
'\t\t\t<span id="product_' + t.id + '_price">' + e + "</span>" + i + '\n\t\t\t<span style="text-decoration: line-through; margin-left: 2px;" id="product_' + t.id + '_fullprice">' + n + "</span>\n") : '\t\t\t<span id="product_' + t.id + '_fullprice">' + n + "</span>" + i + "\n"
|
||
}, V = function(t) {
|
||
return r(t) || -1 < i.becauseOfQuantity.indexOf(t.id)
|
||
};
|
||
G.cart.manager.callWithSearchPageAdditionalInfos(function(t) {
|
||
S = t.availabilityData,
|
||
i = t.discountedProducts,
|
||
G.cart.search.draw(e())
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}(_jq, x5engine),
|
||
function(C, k) {
|
||
"use strict";
|
||
C.extend(!0, k.cart.productDetails, {
|
||
init: function(t) {
|
||
function e(t) {
|
||
var r, i, n;
|
||
if (t.name && C("#" + b + " .product-title").text(t.name).attr("title", t.name),
|
||
t.category && (m = "",
|
||
null != x5CartData.categories && null != x5CartData.categories.dataSource && null != (m = (r = function(t, e) {
|
||
if (null != e) {
|
||
for (var i = 0; i < e.length; i++)
|
||
if ("category" == e[i].type) {
|
||
if (e[i].id == t)
|
||
return e[i].text;
|
||
if (null != e[i].items && 0 < e[i].items.length) {
|
||
var n = r(t, e[i].items);
|
||
if (n)
|
||
return n
|
||
}
|
||
}
|
||
return null
|
||
}
|
||
}
|
||
)(t.category, x5CartData.categories.dataSource)) && C("#" + b + " .product-category").text(m)),
|
||
k.utils.isNullOrEmpty(y.averageRating) || k.utils.isNullOrEmpty(y.totalComments) ? C("#" + b + " .product-stars").css("display", "none") : (m = '<span class="topic-star-container-small" title="' + y.averageRating + '/5"><span class="topic-star-fixer-small" style="width: ' + Math.round(y.averageRating / 5 * 100) + '%;"></span></span>',
|
||
m += "<span>" + y.averageRating + " (" + y.totalComments + " " + k.l10n.get("comments_and_ratings_label_reviews") + ")</span>",
|
||
C("#" + b + " .product-stars").append(m)),
|
||
t.description && (m = k.utils.replaceAll(t.description, "\n", "<br />"),
|
||
m = k.utils.replaceAll(m, "\\", "\\\\"),
|
||
m = k.utils.replaceAll(m, "'", "'"),
|
||
C("#" + b + " .product-description").append(m + '<div class="im-products-description-fade"></div>')),
|
||
"unset" != t.availabilityType && (i = function(t) {
|
||
var e = ""
|
||
, i = "../" + x5CartData.settings.availabilityImage;
|
||
if (null != i)
|
||
switch (t) {
|
||
case "available":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: 0 0;\"></span>\n";
|
||
break;
|
||
case "lack":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: -22px 0;\"></span>\n";
|
||
break;
|
||
case "notavailable":
|
||
e += "\t\t\t\t<span style=\"vertical-align: middle; display: inline-block; width: 22px; height: 22px; background-image: url('" + i + "'); background-position: -44px 0;\"></span>\n"
|
||
}
|
||
return e
|
||
}
|
||
,
|
||
m = function(t, e) {
|
||
return '<table><tr><td style="vertical-align: middle">' + i(t) + '</td><td style="vertical-align: middle">' + function(t, e) {
|
||
switch (t) {
|
||
case "available":
|
||
return k.l10n.get("cart_dynamicproduct_available").replace("[QUANTITY]", e);
|
||
case "lack":
|
||
return k.l10n.get("cart_dynamicproduct_lack").replace("[QUANTITY]", e);
|
||
case "notavailable":
|
||
return k.l10n.get("cart_dynamicproduct_unavailable").replace("[QUANTITY]", e)
|
||
}
|
||
return ""
|
||
}(t, e) + "</td></tr></table>"
|
||
}
|
||
,
|
||
d = "",
|
||
"fixed" == t.availabilityType ? k.utils.isNullOrEmpty(x5CartData.settings.availabilityImage) || "unknown" == t.staticAvailValue || (d += i(t.staticAvailValue) + function(t) {
|
||
switch (t) {
|
||
case "available":
|
||
return k.l10n.get("cart_fixedproduct_available");
|
||
case "lack":
|
||
return k.l10n.get("cart_fixedproduct_lack");
|
||
case "notavailable":
|
||
return k.l10n.get("cart_fixedproduct_unavailable")
|
||
}
|
||
return ""
|
||
}(t.staticAvailValue)) : k.utils.isOnline() ? "dynamic" == t.availabilityType && t.dynamicAvailValue && (d += m(t.dynamicAvailValue, t.availableItems)) : d += m(t.staticAvailValue, t.offlineAvailableItems),
|
||
C("#" + b + " .product-available").html(d)),
|
||
t.quantityDiscounts && (n = "\t\t<div class=\"im-products-qty-discount\" onmouseover=\"x5engine.imTip.Show(this, {target: $(this).find('img'), text: '<div>" + k.l10n.get("cart_discount") + ":</div><ul>",
|
||
t.quantityDiscounts.forEach(function(t) {
|
||
var e = t.minimum
|
||
, t = t.value.toFixed(2)
|
||
, t = t % 1 == 0 ? parseInt(t) : t;
|
||
n += "<li>" + k.l10n.get("cart_discount_per_qty").replace("[QUANTITY]", e).replace("[DISCOUNT]", t) + "</li>"
|
||
}),
|
||
n += '</ul>\'})">\n\t\t\t<img alt="' + k.l10n.get("cart_qty_discount") + '" width="16" height="16" src="../res/info.gif" />\n\t\t\t' + k.l10n.get("cart_qty_discount") + "\n\t\t</div>\n",
|
||
C("#" + b + " .product-qty-discount").append(n)),
|
||
t.options && 0 < t.options.length) {
|
||
var e = 0
|
||
, a = "";
|
||
if (t.options.forEach(function(t) {
|
||
null != t.suboptions && 0 < t.suboptions.length && (e += t.suboptions.length)
|
||
}),
|
||
0 == e)
|
||
a += '\t\t\t<select id="product_' + t.id + '_opt" onchange="x5engine.cart.ui.updateProductListOptions(\'' + t.id + "', this, 'product_" + t.id + "', " + (w ? "true" : "false") + ');" class="opt">\n',
|
||
t.options.forEach(function(t) {
|
||
a += '\t\t\t\t<option value="' + t.id + '">' + t.name + "</option>\n"
|
||
}),
|
||
a += "\t\t\t</select>\n";
|
||
else {
|
||
a += '\t\t\t<select id="product_' + t.id + '_opt" class="opt" onchange="x5engine.cart.ui.updateProductListOptions(\'' + t.id + "', this, 'product_" + t.id + "', " + (w ? "true" : "false") + ', true);">\n',
|
||
t.options.forEach(function(t) {
|
||
a += '\t\t\t\t<option value="' + t.id + '">' + t.name + "</option>\n"
|
||
}),
|
||
a += "\t\t\t</select>\n";
|
||
var s = t.options[0];
|
||
if (null != s.suboptions && 0 < s.suboptions.length) {
|
||
a += '\t\t\t<select id="product_' + t.id + '_subopt" class="subopt">\n';
|
||
for (var o = 0; o < s.suboptions.length; o++)
|
||
a += '\t\t\t\t<option value="' + o + '">' + s.suboptions[o] + "</option>\n";
|
||
a += "\t\t\t</select>\n"
|
||
}
|
||
}
|
||
C("#" + b + " .product-options").append(a)
|
||
}
|
||
var c, l = !1;
|
||
for (c in x5CartData.payments)
|
||
x5CartData.payments[c] && x5CartData.payments[c].extra && !0 === x5CartData.payments[c].extra.ppcpPayLater && (l = !0);
|
||
l && paypal && paypal.Messages && (m = {
|
||
amount: k.cart.productDetails.getProdClass(t).singlePrice(void 0, w),
|
||
placement: "product"
|
||
},
|
||
paypal.Messages(m).render(".product-ppcp-pay-later")),
|
||
C("#" + b + " .im-products-qty").attr("id", "product_" + t.id + "_qty");
|
||
var d = k.l10n.get("cart_add");
|
||
if (C("#" + b + " .product-add").append('<input type="button" value="' + d + '" class="im-products-button" onclick="x5engine.cart.ui.addToCart(\'' + t.id + "', $('#product_" + t.id + "_qty').val(), $('#product_" + t.id + "_opt').val(), $('#product_" + t.id + "_subopt').val(), false, '../');\"/>"),
|
||
C("#" + b + " .product-price").append(k.cart.productDetails.getPriceBoxCode(t, w, !0)),
|
||
k.cart.productDetails.initGallery(b, t, y, 0),
|
||
k.utils.isNullOrEmpty(t.productPageDetailsRichText) || (C("#" + b + " .container-details").append(k.utils.isOnline() ? t.productPageDetailsRichText.html.online : t.productPageDetailsRichText.html.preview),
|
||
C('<style type="text/css">' + t.productPageDetailsRichText.css + "</style>").appendTo(C("head")),
|
||
C("#" + b + " .container-details").removeClass("hidden")),
|
||
y.showRelatedProducts) {
|
||
var u, p = {};
|
||
if (0 < k.settings.breakPoints.length)
|
||
for (o = 0; o < y.innerWidths.length; o++) {
|
||
var h = "Desktop" == k.responsive.getCurrentBreakPoint().name && 1 == y.innerWidths.length ? 1 : k.settings.breakPoints[o].end;
|
||
0 != h && (u = Math.floor(y.innerWidths[o] / 260),
|
||
p[h] = {},
|
||
p[h].slidesPerView = Math.max(1, u))
|
||
}
|
||
var f = function() {
|
||
var t = y.offsetFromRelatedProducts
|
||
, e = y.offsetToRelatedProducts;
|
||
k.cart.api.getRelatedProducts(_, t, e).then(function(t) {
|
||
0 < t.length ? (C("#" + b + " .container-related-products").removeClass("d-none"),
|
||
t = Object.values(t),
|
||
x.appendSlide(g(t)),
|
||
y.offsetFromRelatedProducts += y.offsetToRelatedProducts) : y.offsetFromRelatedProducts = y.offsetMaxRelatedProducts
|
||
})
|
||
}
|
||
, g = function(t) {
|
||
for (var e = [], i = 0; i < t.length; i++) {
|
||
var n = t[i]
|
||
, r = "../" + x5CartData.settings.noPreviewImage
|
||
, a = (0 < n.media.length && (r = "../" + ("video" === (a = n.media[0]).type || "youtube" === a.type || "vimeo" === a.type ? "res/video_thumb.svg" : k.utils.isNullOrEmpty(a.url) ? x5CartData.settings.noPreviewImage : a.url)),
|
||
[])
|
||
, r = (a.push('<div class="swiper-slide" ' + k.utils.linkJs(n.link, {
|
||
baseUrl: "../"
|
||
}) + ' data-product-id="' + n.id + '">'),
|
||
a.push('<div class="swiper-slide-wrapper-image"><img class="swiper-slide-image" src="' + r + '" alt="' + n.name + '"></div>'),
|
||
a.push('<div class="product-title three-lines lines-ellipsis" title="' + n.name + '">' + n.name + "</div>"),
|
||
a.push('<div class="product-price">'),
|
||
a.push(k.cart.productDetails.getPriceBoxCode(n, w, !1)),
|
||
a.push("</div>"),
|
||
a.push("</div>"),
|
||
a.join(""));
|
||
e.push(r)
|
||
}
|
||
return e
|
||
};
|
||
(x = new Swiper("#" + b + " .container-related-products .swiper-container",{
|
||
slidesPerView: 1,
|
||
centeredSlides: !1,
|
||
spaceBetween: 10,
|
||
loop: !1,
|
||
allowTouchMove: !1,
|
||
preventClicks: !0,
|
||
preventClicksPropagation: !0,
|
||
freeMode: !1,
|
||
pagination: {
|
||
el: ".container-related-products .swiper-pagination",
|
||
type: "null"
|
||
},
|
||
navigation: {
|
||
nextEl: "#" + b + " .container-related-products .swiper-button-next",
|
||
prevEl: "#" + b + " .container-related-products .swiper-button-prev"
|
||
},
|
||
breakpoints: p
|
||
})).on("slideNextTransitionEnd", function() {
|
||
y.offsetFromRelatedProducts < y.offsetMaxRelatedProducts && f()
|
||
}),
|
||
f()
|
||
}
|
||
var m = t.schemaOrg;
|
||
function v(t, e) {
|
||
var i = C('meta[content*="[' + t + '-placeholder]"]');
|
||
i && i.attr("content") && (e ? (t = i.attr("content").replace("[" + t + "-placeholder]", e),
|
||
i.attr("content", t)) : i.remove())
|
||
}
|
||
m && (m["@context"] = "https://schema.org",
|
||
C('<script type="application/ld+json">' + JSON.stringify(m) + "<\/script>").appendTo(C("head"))),
|
||
C("title").html(C("title").html().replace("[title-placeholder]", t.name).replace("[tag-title-placeholder]", t.seo.tagTitle)),
|
||
v("title", t.name),
|
||
v("tag-title", t.seo.tagTitle),
|
||
v("tag-description", t.seo.tagDescription),
|
||
v("tag-keywords", t.seo.tagKeywords),
|
||
v("slug", t.slug),
|
||
v("og-image", t.thumb.url),
|
||
v("og-image-type", t.thumb.type),
|
||
v("og-image-width", t.thumb.width),
|
||
v("og-image-height", t.thumb.height)
|
||
}
|
||
var _, y = C.extend({
|
||
target: null,
|
||
galleryHeightPx: 400,
|
||
galleryWidthPerc: 50,
|
||
galleryThumbnailHeightPx: 64,
|
||
showRelatedProducts: !1,
|
||
innerWidths: [],
|
||
averageRating: null,
|
||
totalComments: null,
|
||
minWidthCategoryBox: 250,
|
||
offsetFromRelatedProducts: 0,
|
||
offsetToRelatedProducts: 10,
|
||
offsetMaxRelatedProducts: 50,
|
||
minThumbSize: 48,
|
||
videoHiresWidth: 2560,
|
||
videoHiresHeight: 1440
|
||
}, t), b = y.target, x = null, w = "included" == x5CartData.settings.vattype;
|
||
k.cart.ecommerce(x5CartData);
|
||
k.cart.productDetails.getIdFromQueryString().then(function(t) {
|
||
_ = t,
|
||
k.utils.isNullOrEmpty(_) || k.cart.api.getProductData(_).then(function(i) {
|
||
var n, r, a;
|
||
0 < i.length && (e(i[0]),
|
||
C("#" + b).removeClass("hidden"),
|
||
n = null,
|
||
a = !(r = 0),
|
||
k.utils.onElementResize(document.getElementById(b), function(t, e) {
|
||
r != t.width && (r = t.width,
|
||
n && clearTimeout(n),
|
||
n = setTimeout(function() {
|
||
var t;
|
||
a ? a = !1 : (t = C(".swiper-container.gallery-top .swiper-slide-active").attr("data-position"),
|
||
document.querySelector("#" + y.target + " .swiper-container.gallery-top").swiper.destroy(!0, !0),
|
||
C("#" + y.target + " .swiper-container.gallery-top .swiper-wrapper").empty(),
|
||
1 < i[0].media.length && (document.querySelector("#" + y.target + " .swiper-container.gallery-thumbs").swiper.destroy(!0, !0),
|
||
C("#" + y.target + " .swiper-container.gallery-thumbs .swiper-wrapper").empty()),
|
||
k.cart.productDetails.initGallery(y.target, i[0], y, t))
|
||
}, 50))
|
||
}))
|
||
})
|
||
})
|
||
},
|
||
getProdClass: function(t) {
|
||
return new k.cart.product(x5CartData.products[t.id],{
|
||
quiet: !0
|
||
})
|
||
},
|
||
getPriceBoxCode: function(t, e, i) {
|
||
var n = ""
|
||
, i = i && "none" != x5CartData.settings.vattype ? '<span class="vat-info small-font">' + k.l10n.get(e ? "cart_showvat_included" : "cart_showvat_excluded").replace("[FIELD]", t.vat).replace("[NAME]", t.vatName) + "</span>" : ""
|
||
, r = k.cart.productDetails.getProdClass(t).singleFullPrice(void 0, e)
|
||
, r = k.cart.formatCurrency(r);
|
||
return t.isDiscountedRegardlessOfCouponAndQuantity ? (e = k.cart.productDetails.getProdClass(t).singlePrice(void 0, e),
|
||
e = k.cart.formatCurrency(e),
|
||
n = (n += '<div class="product-price-full-price" id="product_' + t.id + '_fullprice">' + r + "</div>") + '<span class="big-font bold product-price-price" id="product_' + t.id + '_price">' + e + "</span>" + i) : n += '<span class="big-font bold product-price-price" id="product_' + t.id + '_fullprice">' + r + "</span>" + i,
|
||
n
|
||
},
|
||
initGallery: function(p, h, f, t) {
|
||
function e(r, a) {
|
||
function s(i, n, t, e, r, a, s) {
|
||
var o, c, l, d, u = '<div class="swiper-slide" data-position="' + n + '"';
|
||
"galleryTop" == e && r ? (u += "></div>",
|
||
"video" == s.type && (s.url = "../" + s.url),
|
||
o = f.videoHiresWidth,
|
||
c = f.videoHiresHeight,
|
||
(l = C("#" + f.target + " .swiper-container.gallery-top").width()) < o && (c *= l / o,
|
||
o = l),
|
||
(d = C("#" + f.target + " .swiper-container.gallery-top").height()) < c && (o *= d / c,
|
||
c = d),
|
||
new k.mediaObject(C.extend(s, {
|
||
showControls: !1,
|
||
touchDevice: C("html").hasClass("touchevents"),
|
||
contentWidth: l,
|
||
contentHeight: d,
|
||
width: o,
|
||
height: c,
|
||
load: function(t) {
|
||
i.append(u);
|
||
var e = i.find(".swiper-slide[data-position='" + n + "']");
|
||
e.append(t.DOMObject()),
|
||
t.AnimateIn(e, function() {})
|
||
},
|
||
error: function(t, e) {}
|
||
}))) : ("galleryTop" == e ? u += '><img class="swiper-slide-image" ' + k.utils.linkJs(h.showboxLinks[n], {
|
||
baseUrl: "../"
|
||
}) + ' src="' + t + '" alt="' + h.name + '">' : (u += '><img src="' + t + '"',
|
||
r && (s = C("#" + p + " .swiper-container.gallery-thumbs .swiper-wrapper").height(),
|
||
u += "style='width: " + s + "px;'"),
|
||
u += ' alt="">'),
|
||
u += "</div>",
|
||
i.append(u))
|
||
}
|
||
0 < h.media.length ? h.media.forEach(function(t, e) {
|
||
var i, n;
|
||
null != t && ((i = "video" === t.type || "youtube" === t.type || "vimeo" === t.type) || "galleryTop" != a || t.width < r.width() && (t.height,
|
||
r.height()),
|
||
n = "../" + (i ? "res/video_thumb.svg" : k.utils.isNullOrEmpty(t.url) ? x5CartData.settings.noPreviewImage : t.url),
|
||
s(r, e, n, a, i, 0, t))
|
||
}) : s(r, 0, "../" + x5CartData.settings.noPreviewImage, a, !1)
|
||
}
|
||
var i = 1 < h.media.length
|
||
, n = (e(C("#" + p + " .swiper-container.gallery-top .swiper-wrapper"), "galleryTop"),
|
||
C("#" + p + " .swiper-container.gallery-thumbs .swiper-wrapper"))
|
||
, n = (1 < h.media.length ? e(n, "galleryThumbs") : C("#" + p + " .container-gallery").addClass("one-image"),
|
||
null)
|
||
, r = (i && (n = new Swiper("#" + p + " .swiper-container.gallery-thumbs",{
|
||
spaceBetween: 5,
|
||
slidesPerView: "auto",
|
||
loop: !1,
|
||
freeMode: !1,
|
||
centerInsufficientSlides: !1,
|
||
centeredSlides: !0,
|
||
slideToClickedSlide: !0,
|
||
observer: !0,
|
||
observeParents: !0,
|
||
navigation: {
|
||
nextEl: "#" + p + " .container-gallery .swiper-button-next.thumbs",
|
||
prevEl: "#" + p + " .container-gallery .swiper-button-prev.thumbs"
|
||
},
|
||
on: {
|
||
init: function() {},
|
||
imagesReady: function() {
|
||
var t, e;
|
||
i && (t = C("#" + p + " .swiper-container.gallery-thumbs").width(),
|
||
e = 0,
|
||
C("#" + p + " .swiper-container.gallery-thumbs .swiper-wrapper .swiper-slide").each(function() {
|
||
e += C(this).width() + 5
|
||
}),
|
||
e < t && (C("#" + p + " .container-gallery .swiper-button-next.thumbs").css("display", "none"),
|
||
C("#" + p + " .container-gallery .swiper-button-prev.thumbs").css("display", "none")))
|
||
}
|
||
}
|
||
})),
|
||
null)
|
||
, r = new Swiper("#" + p + " .swiper-container.gallery-top",{
|
||
navigation: {
|
||
nextEl: "#" + p + " .container-gallery .swiper-button-next.top",
|
||
prevEl: "#" + p + " .container-gallery .swiper-button-prev.top"
|
||
},
|
||
spaceBetween: 5,
|
||
loop: !1,
|
||
allowTouchMove: i,
|
||
observer: !0,
|
||
observeParents: !0,
|
||
thumbs: {
|
||
swiper: n
|
||
}
|
||
});
|
||
0 < t && (n.slideTo(parseInt(t)),
|
||
r.slideTo(parseInt(t)))
|
||
},
|
||
getIdFromQueryString: function() {
|
||
if (!k.utils.isNullOrEmpty(window.location.search) && 1 < window.location.search.length) {
|
||
var t, e = [];
|
||
for (t in window.location.search.substring(1).split("&").forEach(function(t) {
|
||
e.push(t.split("="))
|
||
}),
|
||
e) {
|
||
var i = e[t];
|
||
if (1 == i.length)
|
||
return k.cart.api.getIdBySlug(i[0]);
|
||
if (2 == i.length && "id" == i[0])
|
||
return Promise.resolve(i[1])
|
||
}
|
||
}
|
||
return Promise.resolve(null)
|
||
}
|
||
})
|
||
}(_jq, x5engine, window),
|
||
function(a, r, s) {
|
||
"use strict";
|
||
var t = new Promise(function(t) {
|
||
r.boot.push(function() {
|
||
t(r.settings)
|
||
})
|
||
}
|
||
)
|
||
, n = t.then(function(n) {
|
||
if (n.islocal)
|
||
return {
|
||
getVersion: function() {
|
||
return Promise.resolve(Date.now())
|
||
},
|
||
getProducts: function(e) {
|
||
return new Promise(function(t) {
|
||
var i = {};
|
||
e.forEach(function(t) {
|
||
var e = n.imCart.localProductsData[t];
|
||
e && (i[t] = e)
|
||
}),
|
||
t(i)
|
||
}
|
||
)
|
||
},
|
||
getProductsDynamicData: function(i) {
|
||
return new Promise(function(t) {
|
||
var e = {};
|
||
i.forEach(function(t) {
|
||
e[t] = {}
|
||
}),
|
||
t(e)
|
||
}
|
||
)
|
||
},
|
||
getIdBySlug: function(t) {
|
||
return Promise.resolve(r.settings.imCart.slugToProductIdMap[t])
|
||
}
|
||
};
|
||
if ("undefined" != typeof x5CartData) {
|
||
const i = n.currentPath + "cart/x5cart.php";
|
||
var t = e({
|
||
url: i + "?action=crtvrs",
|
||
type: "GET"
|
||
});
|
||
return {
|
||
getVersion: function() {
|
||
return t
|
||
},
|
||
getProducts: function(t) {
|
||
return e({
|
||
url: i + "?action=prdinfo",
|
||
type: "POST",
|
||
data: {
|
||
products: t
|
||
}
|
||
})
|
||
},
|
||
getProductsDynamicData: function(t) {
|
||
return e({
|
||
url: i + "?action=prddyna",
|
||
type: "POST",
|
||
data: {
|
||
products: t
|
||
}
|
||
})
|
||
},
|
||
getIdBySlug: function(t) {
|
||
return e({
|
||
url: i + "?action=prdid",
|
||
type: "POST",
|
||
data: {
|
||
slug: t
|
||
}
|
||
})
|
||
}
|
||
};
|
||
function e(t) {
|
||
return new Promise(function(e, i) {
|
||
a.ajax(t).always(function(t) {
|
||
t.status && "ok" === t.status ? e(t.data) : i(t)
|
||
})
|
||
}
|
||
)
|
||
}
|
||
}
|
||
})
|
||
, e = n.then(function(t) {
|
||
return t.getVersion()
|
||
})
|
||
, i = new Promise(function(t) {
|
||
try {
|
||
var e, i, n;
|
||
"localStorage"in s && s.localStorage && (e = "test",
|
||
(i = s.localStorage).setItem(e, "asd"),
|
||
n = "asd" == i.getItem(e),
|
||
i.removeItem(e),
|
||
n && t(s.localStorage))
|
||
} catch (t) {}
|
||
t({
|
||
_data: {},
|
||
setItem: function(t, e) {
|
||
return this._data[t] = String(e)
|
||
},
|
||
getItem: function(t) {
|
||
return this._data.hasOwnProperty(t) ? this._data[t] : void 0
|
||
},
|
||
removeItem: function(t) {
|
||
return delete this._data[t]
|
||
},
|
||
clear: function() {
|
||
return this._data = {}
|
||
}
|
||
})
|
||
}
|
||
)
|
||
, i = Promise.all([i, t]).then(function(t) {
|
||
var e = t[0];
|
||
const i = t[1].siteId + "_cart_api_cache";
|
||
return {
|
||
loadCache: function() {
|
||
try {
|
||
return JSON.parse(e.getItem(i))
|
||
} catch (t) {}
|
||
},
|
||
saveCache: function(t) {
|
||
try {
|
||
e.setItem(i, JSON.stringify(t))
|
||
} catch (t) {
|
||
console.error(t)
|
||
}
|
||
}
|
||
}
|
||
})
|
||
, o = Promise.all([i, e]).then(function(t) {
|
||
var n = t[0]
|
||
, r = t[1]
|
||
, t = n.loadCache();
|
||
return t && t.version && r == t.version || n.saveCache({
|
||
version: r,
|
||
products: {},
|
||
slugToIdMap: {}
|
||
}),
|
||
{
|
||
getProductData: function(t) {
|
||
var e = n.loadCache();
|
||
return e && e.products ? e.products[t] : void 0
|
||
},
|
||
getIdBySlug: function(t) {
|
||
var e = n.loadCache();
|
||
return e && e.slugToIdMap ? e.slugToIdMap[t] : void 0
|
||
},
|
||
addProduct: function(t) {
|
||
var e = n.loadCache();
|
||
if (e) {
|
||
if (e.products || (e.products = {}),
|
||
!e.slugToIdMap)
|
||
for (var i in e.slugToIdMap = {},
|
||
e.products)
|
||
e.slugToIdMap[e.products[i].slug] = i
|
||
} else
|
||
e = {
|
||
version: r,
|
||
products: {},
|
||
slugToIdMap: {}
|
||
};
|
||
e.products[t.id] = t,
|
||
e.slugToIdMap[t.slug] = t.id,
|
||
n.saveCache(e)
|
||
}
|
||
}
|
||
}).catch(function(t) {});
|
||
function c(n, r) {
|
||
return o.then(function(e) {
|
||
var t, i = {
|
||
ids: null == (t = n) ? [] : Array.isArray(t) ? t : [t],
|
||
cached: [],
|
||
uncached: []
|
||
};
|
||
return i.ids.forEach(function(t) {
|
||
e.getProductData(t) ? r || i.cached.push(t) : i.uncached.push(t)
|
||
}),
|
||
i
|
||
})
|
||
}
|
||
function l(i) {
|
||
return i.ids.length ? n.then(function(t) {
|
||
var e = 0 < i.cached.length ? t.getProductsDynamicData(i.cached) : Promise.resolve([])
|
||
, t = 0 < i.uncached.length ? t.getProducts(i.uncached) : Promise.resolve([]);
|
||
return Promise.all([t, e])
|
||
}).then(function(t) {
|
||
return {
|
||
ids: i.ids,
|
||
uncached: t[0],
|
||
cached: t[1]
|
||
}
|
||
}) : Promise.resolve({})
|
||
}
|
||
function d(t, e) {
|
||
t = c(t, e).then(l);
|
||
return Promise.all([o, t]).then(function(t) {
|
||
var e = t[0]
|
||
, i = t[1];
|
||
if (i.uncached)
|
||
for (var n in i.uncached)
|
||
e.addProduct(i.uncached[n]);
|
||
if (i.cached)
|
||
for (var n in i.cached)
|
||
e.addProduct(a.extend(!0, e.getProductData(n), i.cached[n]));
|
||
var r = [];
|
||
return i.ids && i.ids.forEach(function(t) {
|
||
r.push(e.getProductData(t))
|
||
}),
|
||
r
|
||
})
|
||
}
|
||
a.extend(!0, r.cart, {
|
||
api: {
|
||
getIdBySlug: function(e) {
|
||
return o.then(function(t) {
|
||
t = t.getIdBySlug(e);
|
||
return t || n.then(function(t) {
|
||
return t.getIdBySlug(e)
|
||
})
|
||
})
|
||
},
|
||
getProductData: d,
|
||
getRelatedProducts: function(t, e, i) {
|
||
return d(t, !0).then(function(t) {
|
||
if (0 < t.length)
|
||
return e = e || 0,
|
||
(t = t[0]).relatedProducts && t.relatedProducts.length && t.relatedProducts.length > e ? d(t.relatedProducts.slice(e, e + i || t.relatedProducts.length), !0) : [];
|
||
throw "there's no product with requested id"
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}(_jq, x5engine, window),
|
||
function() {
|
||
"use strict";
|
||
var e;
|
||
e = function(s, o, c, t, l) {
|
||
function e(t, e, i) {
|
||
this.VERSION = "2.3.0",
|
||
this.input = t,
|
||
this.plugin_count = i,
|
||
this.current_plugin = 0,
|
||
this.calc_count = 0,
|
||
this.update_tm = 0,
|
||
this.old_from = 0,
|
||
this.old_to = 0,
|
||
this.old_min_interval = null,
|
||
this.raf_id = null,
|
||
this.dragging = !1,
|
||
this.force_redraw = !1,
|
||
this.no_diapason = !1,
|
||
this.has_tab_index = !0,
|
||
this.is_key = !1,
|
||
this.is_update = !1,
|
||
this.is_start = !0,
|
||
this.is_finish = !1,
|
||
this.is_active = !1,
|
||
this.is_resize = !1,
|
||
this.is_click = !1,
|
||
e = e || {},
|
||
this.$cache = {
|
||
win: s(c),
|
||
body: s(o.body),
|
||
input: s(t),
|
||
cont: null,
|
||
rs: null,
|
||
min: null,
|
||
max: null,
|
||
from: null,
|
||
to: null,
|
||
single: null,
|
||
bar: null,
|
||
line: null,
|
||
s_single: null,
|
||
s_from: null,
|
||
s_to: null,
|
||
shad_single: null,
|
||
shad_from: null,
|
||
shad_to: null,
|
||
edge: null,
|
||
grid: null,
|
||
grid_labels: []
|
||
},
|
||
this.coords = {
|
||
x_gap: 0,
|
||
x_pointer: 0,
|
||
w_rs: 0,
|
||
w_rs_old: 0,
|
||
w_handle: 0,
|
||
p_gap: 0,
|
||
p_gap_left: 0,
|
||
p_gap_right: 0,
|
||
p_step: 0,
|
||
p_pointer: 0,
|
||
p_handle: 0,
|
||
p_single_fake: 0,
|
||
p_single_real: 0,
|
||
p_from_fake: 0,
|
||
p_from_real: 0,
|
||
p_to_fake: 0,
|
||
p_to_real: 0,
|
||
p_bar_x: 0,
|
||
p_bar_w: 0,
|
||
grid_gap: 0,
|
||
big_num: 0,
|
||
big: [],
|
||
big_w: [],
|
||
big_p: [],
|
||
big_x: []
|
||
},
|
||
this.labels = {
|
||
w_min: 0,
|
||
w_max: 0,
|
||
w_from: 0,
|
||
w_to: 0,
|
||
w_single: 0,
|
||
p_min: 0,
|
||
p_max: 0,
|
||
p_from_fake: 0,
|
||
p_from_left: 0,
|
||
p_to_fake: 0,
|
||
p_to_left: 0,
|
||
p_single_fake: 0,
|
||
p_single_left: 0
|
||
};
|
||
var n, r, t = (i = this.$cache.input).prop("value"), a = {
|
||
skin: "flat",
|
||
type: "single",
|
||
min: 10,
|
||
max: 100,
|
||
from: null,
|
||
to: null,
|
||
step: 1,
|
||
min_interval: 0,
|
||
max_interval: 0,
|
||
drag_interval: !1,
|
||
values: [],
|
||
p_values: [],
|
||
from_fixed: !1,
|
||
from_min: null,
|
||
from_max: null,
|
||
from_shadow: !1,
|
||
to_fixed: !1,
|
||
to_min: null,
|
||
to_max: null,
|
||
to_shadow: !1,
|
||
prettify_enabled: !0,
|
||
prettify_separator: " ",
|
||
prettify: null,
|
||
force_edges: !1,
|
||
keyboard: !0,
|
||
grid: !1,
|
||
grid_margin: !0,
|
||
grid_num: 4,
|
||
grid_snap: !1,
|
||
hide_min_max: !1,
|
||
hide_from_to: !1,
|
||
prefix: "",
|
||
postfix: "",
|
||
max_postfix: "",
|
||
decorate_both: !0,
|
||
values_separator: " — ",
|
||
input_values_separator: ";",
|
||
disable: !1,
|
||
block: !1,
|
||
extra_classes: "",
|
||
scope: null,
|
||
onStart: null,
|
||
onChange: null,
|
||
onFinish: null,
|
||
onUpdate: null
|
||
};
|
||
for (r in "INPUT" !== i[0].nodeName && console && console.warn && console.warn("Base element should be <input>!", i[0]),
|
||
(n = {
|
||
skin: i.data("skin"),
|
||
type: i.data("type"),
|
||
min: i.data("min"),
|
||
max: i.data("max"),
|
||
from: i.data("from"),
|
||
to: i.data("to"),
|
||
step: i.data("step"),
|
||
min_interval: i.data("minInterval"),
|
||
max_interval: i.data("maxInterval"),
|
||
drag_interval: i.data("dragInterval"),
|
||
values: i.data("values"),
|
||
from_fixed: i.data("fromFixed"),
|
||
from_min: i.data("fromMin"),
|
||
from_max: i.data("fromMax"),
|
||
from_shadow: i.data("fromShadow"),
|
||
to_fixed: i.data("toFixed"),
|
||
to_min: i.data("toMin"),
|
||
to_max: i.data("toMax"),
|
||
to_shadow: i.data("toShadow"),
|
||
prettify_enabled: i.data("prettifyEnabled"),
|
||
prettify_separator: i.data("prettifySeparator"),
|
||
force_edges: i.data("forceEdges"),
|
||
keyboard: i.data("keyboard"),
|
||
grid: i.data("grid"),
|
||
grid_margin: i.data("gridMargin"),
|
||
grid_num: i.data("gridNum"),
|
||
grid_snap: i.data("gridSnap"),
|
||
hide_min_max: i.data("hideMinMax"),
|
||
hide_from_to: i.data("hideFromTo"),
|
||
prefix: i.data("prefix"),
|
||
postfix: i.data("postfix"),
|
||
max_postfix: i.data("maxPostfix"),
|
||
decorate_both: i.data("decorateBoth"),
|
||
values_separator: i.data("valuesSeparator"),
|
||
input_values_separator: i.data("inputValuesSeparator"),
|
||
disable: i.data("disable"),
|
||
block: i.data("block"),
|
||
extra_classes: i.data("extraClasses")
|
||
}).values = n.values && n.values.split(","),
|
||
n)
|
||
!n.hasOwnProperty(r) || n[r] !== l && "" !== n[r] || delete n[r];
|
||
t !== l && "" !== t && ((t = t.split(n.input_values_separator || e.input_values_separator || ";"))[0] && t[0] == +t[0] && (t[0] = +t[0]),
|
||
t[1] && t[1] == +t[1] && (t[1] = +t[1]),
|
||
e && e.values && e.values.length ? (a.from = t[0] && e.values.indexOf(t[0]),
|
||
a.to = t[1] && e.values.indexOf(t[1])) : (a.from = t[0] && +t[0],
|
||
a.to = t[1] && +t[1])),
|
||
s.extend(a, e),
|
||
s.extend(a, n),
|
||
this.options = a,
|
||
this.update_check = {},
|
||
this.validate(),
|
||
this.result = {
|
||
input: this.$cache.input,
|
||
slider: null,
|
||
min: this.options.min,
|
||
max: this.options.max,
|
||
from: this.options.from,
|
||
from_percent: 0,
|
||
from_value: null,
|
||
to: this.options.to,
|
||
to_percent: 0,
|
||
to_value: null
|
||
},
|
||
this.init()
|
||
}
|
||
var i, n = 0, r = 0 < (t = t.userAgent).search(i = /msie\s\d+/i) && i.exec(t).toString().split(" ")[1] < 9 && (s("html").addClass("lt-ie9"),
|
||
!0);
|
||
Function.prototype.bind || (Function.prototype.bind = function(i) {
|
||
var n = this
|
||
, r = [].slice;
|
||
if ("function" != typeof n)
|
||
throw new TypeError;
|
||
var a = r.call(arguments, 1)
|
||
, s = function() {
|
||
var t, e;
|
||
return this instanceof s ? ((t = function() {}
|
||
).prototype = n.prototype,
|
||
t = new t,
|
||
e = n.apply(t, a.concat(r.call(arguments))),
|
||
Object(e) === e ? e : t) : n.apply(i, a.concat(r.call(arguments)))
|
||
};
|
||
return s
|
||
}
|
||
),
|
||
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, e) {
|
||
var i;
|
||
if (null == this)
|
||
throw new TypeError('"this" is null or not defined');
|
||
var n = Object(this)
|
||
, r = n.length >>> 0;
|
||
if (0 != r) {
|
||
e = +e || 0;
|
||
if (!(r <= (e = Math.abs(e) === 1 / 0 ? 0 : e)))
|
||
for (i = Math.max(0 <= e ? e : r - Math.abs(e), 0); i < r; ) {
|
||
if (i in n && n[i] === t)
|
||
return i;
|
||
i++
|
||
}
|
||
}
|
||
return -1
|
||
}
|
||
);
|
||
e.prototype = {
|
||
init: function(t) {
|
||
this.no_diapason = !1,
|
||
this.coords.p_step = this.convertToPercent(this.options.step, !0),
|
||
this.target = "base",
|
||
this.toggleInput(),
|
||
this.append(),
|
||
this.setMinMax(),
|
||
t ? (this.force_redraw = !0,
|
||
this.calc(!0),
|
||
this.callOnUpdate()) : (this.force_redraw = !0,
|
||
this.calc(!0),
|
||
this.callOnStart()),
|
||
this.updateScene()
|
||
},
|
||
append: function() {
|
||
var t = '<span class="irs irs--' + this.options.skin + " js-irs-" + this.plugin_count + " " + this.options.extra_classes + '"></span>';
|
||
this.$cache.input.before(t),
|
||
this.$cache.input.prop("readonly", !0),
|
||
this.$cache.cont = this.$cache.input.prev(),
|
||
this.result.slider = this.$cache.cont,
|
||
this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="0"></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span>'),
|
||
this.$cache.rs = this.$cache.cont.find(".irs"),
|
||
this.$cache.min = this.$cache.cont.find(".irs-min"),
|
||
this.$cache.max = this.$cache.cont.find(".irs-max"),
|
||
this.$cache.from = this.$cache.cont.find(".irs-from"),
|
||
this.$cache.to = this.$cache.cont.find(".irs-to"),
|
||
this.$cache.single = this.$cache.cont.find(".irs-single"),
|
||
this.$cache.line = this.$cache.cont.find(".irs-line"),
|
||
this.$cache.grid = this.$cache.cont.find(".irs-grid"),
|
||
"single" === this.options.type ? (this.$cache.cont.append('<span class="irs-bar irs-bar--single"></span><span class="irs-shadow shadow-single"></span><span class="irs-handle single"><i></i><i></i><i></i></span>'),
|
||
this.$cache.bar = this.$cache.cont.find(".irs-bar"),
|
||
this.$cache.edge = this.$cache.cont.find(".irs-bar-edge"),
|
||
this.$cache.s_single = this.$cache.cont.find(".single"),
|
||
this.$cache.from[0].style.visibility = "hidden",
|
||
this.$cache.to[0].style.visibility = "hidden",
|
||
this.$cache.shad_single = this.$cache.cont.find(".shadow-single")) : (this.$cache.cont.append('<span class="irs-bar"></span><span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-handle from"><i></i><i></i><i></i></span><span class="irs-handle to"><i></i><i></i><i></i></span>'),
|
||
this.$cache.bar = this.$cache.cont.find(".irs-bar"),
|
||
this.$cache.s_from = this.$cache.cont.find(".from"),
|
||
this.$cache.s_to = this.$cache.cont.find(".to"),
|
||
this.$cache.shad_from = this.$cache.cont.find(".shadow-from"),
|
||
this.$cache.shad_to = this.$cache.cont.find(".shadow-to"),
|
||
this.setTopHandler()),
|
||
this.options.hide_from_to && (this.$cache.from[0].style.display = "none",
|
||
this.$cache.to[0].style.display = "none",
|
||
this.$cache.single[0].style.display = "none"),
|
||
this.appendGrid(),
|
||
this.options.disable ? (this.appendDisableMask(),
|
||
this.$cache.input[0].disabled = !0) : (this.$cache.input[0].disabled = !1,
|
||
this.removeDisableMask(),
|
||
this.bindEvents()),
|
||
this.options.disable || (this.options.block ? this.appendDisableMask() : this.removeDisableMask()),
|
||
this.options.drag_interval && (this.$cache.bar[0].style.cursor = "ew-resize")
|
||
},
|
||
setTopHandler: function() {
|
||
var t = this.options.min
|
||
, e = this.options.max
|
||
, i = this.options.from
|
||
, n = this.options.to;
|
||
t < i && n === e ? this.$cache.s_from.addClass("type_last") : n < e && this.$cache.s_to.addClass("type_last")
|
||
},
|
||
changeLevel: function(t) {
|
||
switch (t) {
|
||
case "single":
|
||
this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_single_fake),
|
||
this.$cache.s_single.addClass("state_hover");
|
||
break;
|
||
case "from":
|
||
this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake),
|
||
this.$cache.s_from.addClass("state_hover"),
|
||
this.$cache.s_from.addClass("type_last"),
|
||
this.$cache.s_to.removeClass("type_last");
|
||
break;
|
||
case "to":
|
||
this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_to_fake),
|
||
this.$cache.s_to.addClass("state_hover"),
|
||
this.$cache.s_to.addClass("type_last"),
|
||
this.$cache.s_from.removeClass("type_last");
|
||
break;
|
||
case "both":
|
||
this.coords.p_gap_left = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake),
|
||
this.coords.p_gap_right = this.toFixed(this.coords.p_to_fake - this.coords.p_pointer),
|
||
this.$cache.s_to.removeClass("type_last"),
|
||
this.$cache.s_from.removeClass("type_last")
|
||
}
|
||
},
|
||
appendDisableMask: function() {
|
||
this.$cache.cont.append('<span class="irs-disable-mask"></span>'),
|
||
this.$cache.cont.addClass("irs-disabled")
|
||
},
|
||
removeDisableMask: function() {
|
||
this.$cache.cont.remove(".irs-disable-mask"),
|
||
this.$cache.cont.removeClass("irs-disabled")
|
||
},
|
||
remove: function() {
|
||
this.$cache.cont.remove(),
|
||
this.$cache.cont = null,
|
||
this.$cache.line.off("keydown.irs_" + this.plugin_count),
|
||
this.$cache.body.off("touchmove.irs_" + this.plugin_count),
|
||
this.$cache.body.off("mousemove.irs_" + this.plugin_count),
|
||
this.$cache.win.off("touchend.irs_" + this.plugin_count),
|
||
this.$cache.win.off("mouseup.irs_" + this.plugin_count),
|
||
r && (this.$cache.body.off("mouseup.irs_" + this.plugin_count),
|
||
this.$cache.body.off("mouseleave.irs_" + this.plugin_count)),
|
||
this.$cache.grid_labels = [],
|
||
this.coords.big = [],
|
||
this.coords.big_w = [],
|
||
this.coords.big_p = [],
|
||
this.coords.big_x = [],
|
||
cancelAnimationFrame(this.raf_id)
|
||
},
|
||
bindEvents: function() {
|
||
this.no_diapason || (this.$cache.body.on("touchmove.irs_" + this.plugin_count, this.pointerMove.bind(this)),
|
||
this.$cache.body.on("mousemove.irs_" + this.plugin_count, this.pointerMove.bind(this)),
|
||
this.$cache.win.on("touchend.irs_" + this.plugin_count, this.pointerUp.bind(this)),
|
||
this.$cache.win.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this)),
|
||
this.$cache.line.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.line.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.line.on("focus.irs_" + this.plugin_count, this.pointerFocus.bind(this)),
|
||
this.options.drag_interval && "double" === this.options.type ? (this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "both")),
|
||
this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "both"))) : (this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"))),
|
||
("single" === this.options.type ? (this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")),
|
||
this.$cache.s_single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")),
|
||
this.$cache.shad_single.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")),
|
||
this.$cache.s_single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")),
|
||
this.$cache.edge.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.shad_single) : (this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, null)),
|
||
this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, null)),
|
||
this.$cache.from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")),
|
||
this.$cache.s_from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")),
|
||
this.$cache.to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")),
|
||
this.$cache.s_to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")),
|
||
this.$cache.shad_from.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.shad_to.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")),
|
||
this.$cache.s_from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")),
|
||
this.$cache.to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")),
|
||
this.$cache.s_to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")),
|
||
this.$cache.shad_from.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.$cache.shad_to)).on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")),
|
||
this.options.keyboard && this.$cache.line.on("keydown.irs_" + this.plugin_count, this.key.bind(this, "keyboard")),
|
||
r && (this.$cache.body.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this)),
|
||
this.$cache.body.on("mouseleave.irs_" + this.plugin_count, this.pointerUp.bind(this))))
|
||
},
|
||
pointerFocus: function(t) {
|
||
var e, i;
|
||
this.target || (e = (i = "single" === this.options.type ? this.$cache.single : this.$cache.from).offset().left,
|
||
e += i.width() / 2 - 1,
|
||
this.pointerClick("single", {
|
||
preventDefault: function() {},
|
||
pageX: e
|
||
}))
|
||
},
|
||
pointerMove: function(t) {
|
||
this.dragging && (t = t.pageX || t.originalEvent.touches && t.originalEvent.touches[0].pageX,
|
||
this.coords.x_pointer = t - this.coords.x_gap,
|
||
this.calc())
|
||
},
|
||
pointerUp: function(t) {
|
||
this.current_plugin === this.plugin_count && this.is_active && (this.is_active = !1,
|
||
this.$cache.cont.find(".state_hover").removeClass("state_hover"),
|
||
this.force_redraw = !0,
|
||
r && s("*").prop("unselectable", !1),
|
||
this.updateScene(),
|
||
this.restoreOriginalMinInterval(),
|
||
(s.contains(this.$cache.cont[0], t.target) || this.dragging) && this.callOnFinish(),
|
||
this.dragging = !1)
|
||
},
|
||
pointerDown: function(t, e) {
|
||
e.preventDefault();
|
||
var i = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
|
||
2 !== e.button && ("both" === t && this.setTempMinInterval(),
|
||
t = t || this.target || "from",
|
||
this.current_plugin = this.plugin_count,
|
||
this.target = t,
|
||
this.is_active = !0,
|
||
this.dragging = !0,
|
||
this.coords.x_gap = this.$cache.rs.offset().left,
|
||
this.coords.x_pointer = i - this.coords.x_gap,
|
||
this.calcPointerPercent(),
|
||
this.changeLevel(t),
|
||
r && s("*").prop("unselectable", !0),
|
||
this.$cache.line.trigger("focus"),
|
||
this.updateScene())
|
||
},
|
||
pointerClick: function(t, e) {
|
||
e.preventDefault();
|
||
var i = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
|
||
2 !== e.button && (this.current_plugin = this.plugin_count,
|
||
this.target = t,
|
||
this.is_click = !0,
|
||
this.coords.x_gap = this.$cache.rs.offset().left,
|
||
this.coords.x_pointer = +(i - this.coords.x_gap).toFixed(),
|
||
this.force_redraw = !0,
|
||
this.calc(),
|
||
this.$cache.line.trigger("focus"))
|
||
},
|
||
key: function(t, e) {
|
||
if (!(this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||
switch (e.which) {
|
||
case 83:
|
||
case 65:
|
||
case 40:
|
||
case 37:
|
||
e.preventDefault(),
|
||
this.moveByKey(!1);
|
||
break;
|
||
case 87:
|
||
case 68:
|
||
case 38:
|
||
case 39:
|
||
e.preventDefault(),
|
||
this.moveByKey(!0)
|
||
}
|
||
return !0
|
||
}
|
||
},
|
||
moveByKey: function(t) {
|
||
var e = this.coords.p_pointer
|
||
, i = (this.options.max - this.options.min) / 100
|
||
, i = this.options.step / i;
|
||
t ? e += i : e -= i,
|
||
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * e),
|
||
this.is_key = !0,
|
||
this.calc()
|
||
},
|
||
setMinMax: function() {
|
||
var t, e;
|
||
this.options && (this.options.hide_min_max ? (this.$cache.min[0].style.display = "none",
|
||
this.$cache.max[0].style.display = "none") : (this.options.values.length ? (this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),
|
||
this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))) : (t = this._prettify(this.options.min),
|
||
e = this._prettify(this.options.max),
|
||
this.result.min_pretty = t,
|
||
this.result.max_pretty = e,
|
||
this.$cache.min.html(this.decorate(t, this.options.min)),
|
||
this.$cache.max.html(this.decorate(e, this.options.max))),
|
||
this.labels.w_min = this.$cache.min.outerWidth(!1),
|
||
this.labels.w_max = this.$cache.max.outerWidth(!1)))
|
||
},
|
||
setTempMinInterval: function() {
|
||
var t = this.result.to - this.result.from;
|
||
null === this.old_min_interval && (this.old_min_interval = this.options.min_interval),
|
||
this.options.min_interval = t
|
||
},
|
||
restoreOriginalMinInterval: function() {
|
||
null !== this.old_min_interval && (this.options.min_interval = this.old_min_interval,
|
||
this.old_min_interval = null)
|
||
},
|
||
calc: function(t) {
|
||
if (this.options && (this.calc_count++,
|
||
10 !== this.calc_count && !t || (this.calc_count = 0,
|
||
this.coords.w_rs = this.$cache.rs.outerWidth(!1),
|
||
this.calcHandlePercent()),
|
||
this.coords.w_rs)) {
|
||
this.calcPointerPercent();
|
||
var e, i, n = this.getHandleX();
|
||
switch ("both" === this.target && (this.coords.p_gap = 0,
|
||
n = this.getHandleX()),
|
||
"click" === this.target && (this.coords.p_gap = this.coords.p_handle / 2,
|
||
n = this.getHandleX(),
|
||
this.options.drag_interval ? this.target = "both_one" : this.target = this.chooseHandle(n)),
|
||
this.target) {
|
||
case "base":
|
||
var r = (this.options.max - this.options.min) / 100
|
||
, a = (this.result.from - this.options.min) / r
|
||
, r = (this.result.to - this.options.min) / r;
|
||
this.coords.p_single_real = this.toFixed(a),
|
||
this.coords.p_from_real = this.toFixed(a),
|
||
this.coords.p_to_real = this.toFixed(r),
|
||
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max),
|
||
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real),
|
||
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real),
|
||
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real),
|
||
this.target = null;
|
||
break;
|
||
case "single":
|
||
this.options.from_fixed || (this.coords.p_single_real = this.convertToRealPercent(n),
|
||
this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real),
|
||
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real));
|
||
break;
|
||
case "from":
|
||
this.options.from_fixed || (this.coords.p_from_real = this.convertToRealPercent(n),
|
||
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real),
|
||
this.coords.p_from_real > this.coords.p_to_real && (this.coords.p_from_real = this.coords.p_to_real),
|
||
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"),
|
||
this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from"),
|
||
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real));
|
||
break;
|
||
case "to":
|
||
this.options.to_fixed || (this.coords.p_to_real = this.convertToRealPercent(n),
|
||
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real),
|
||
this.coords.p_to_real < this.coords.p_from_real && (this.coords.p_to_real = this.coords.p_from_real),
|
||
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max),
|
||
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"),
|
||
this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to"),
|
||
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real));
|
||
break;
|
||
case "both":
|
||
this.options.from_fixed || this.options.to_fixed || (n = this.toFixed(n + .001 * this.coords.p_handle),
|
||
this.coords.p_from_real = this.convertToRealPercent(n) - this.coords.p_gap_left,
|
||
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real),
|
||
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"),
|
||
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real),
|
||
this.coords.p_to_real = this.convertToRealPercent(n) + this.coords.p_gap_right,
|
||
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real),
|
||
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max),
|
||
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"),
|
||
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real));
|
||
break;
|
||
case "both_one":
|
||
this.options.from_fixed || this.options.to_fixed || (a = this.convertToRealPercent(n),
|
||
r = this.result.from_percent,
|
||
i = a + (e = (r = this.result.to_percent - r) / 2),
|
||
100 < (i = (a = a - e) < 0 ? (a = 0) + r : i) && (a = (i = 100) - r),
|
||
this.coords.p_from_real = this.calcWithStep(a),
|
||
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max),
|
||
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real),
|
||
this.coords.p_to_real = this.calcWithStep(i),
|
||
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max),
|
||
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real))
|
||
}
|
||
"single" === this.options.type ? (this.coords.p_bar_x = this.coords.p_handle / 2,
|
||
this.coords.p_bar_w = this.coords.p_single_fake,
|
||
this.result.from_percent = this.coords.p_single_real,
|
||
this.result.from = this.convertToValue(this.coords.p_single_real),
|
||
this.result.from_pretty = this._prettify(this.result.from),
|
||
this.options.values.length && (this.result.from_value = this.options.values[this.result.from])) : (this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + this.coords.p_handle / 2),
|
||
this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake),
|
||
this.result.from_percent = this.coords.p_from_real,
|
||
this.result.from = this.convertToValue(this.coords.p_from_real),
|
||
this.result.from_pretty = this._prettify(this.result.from),
|
||
this.result.to_percent = this.coords.p_to_real,
|
||
this.result.to = this.convertToValue(this.coords.p_to_real),
|
||
this.result.to_pretty = this._prettify(this.result.to),
|
||
this.options.values.length && (this.result.from_value = this.options.values[this.result.from],
|
||
this.result.to_value = this.options.values[this.result.to])),
|
||
this.calcMinMax(),
|
||
this.calcLabels()
|
||
}
|
||
},
|
||
calcPointerPercent: function() {
|
||
this.coords.w_rs ? (this.coords.x_pointer < 0 || isNaN(this.coords.x_pointer) ? this.coords.x_pointer = 0 : this.coords.x_pointer > this.coords.w_rs && (this.coords.x_pointer = this.coords.w_rs),
|
||
this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100)) : this.coords.p_pointer = 0
|
||
},
|
||
convertToRealPercent: function(t) {
|
||
return t / (100 - this.coords.p_handle) * 100
|
||
},
|
||
convertToFakePercent: function(t) {
|
||
return t / 100 * (100 - this.coords.p_handle)
|
||
},
|
||
getHandleX: function() {
|
||
var t = 100 - this.coords.p_handle
|
||
, e = this.toFixed(this.coords.p_pointer - this.coords.p_gap);
|
||
return e < 0 ? e = 0 : t < e && (e = t),
|
||
e
|
||
},
|
||
calcHandlePercent: function() {
|
||
"single" === this.options.type ? this.coords.w_handle = this.$cache.s_single.outerWidth(!1) : this.coords.w_handle = this.$cache.s_from.outerWidth(!1),
|
||
this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100)
|
||
},
|
||
chooseHandle: function(t) {
|
||
return "single" === this.options.type ? "single" : this.coords.p_from_real + (this.coords.p_to_real - this.coords.p_from_real) / 2 <= t ? this.options.to_fixed ? "from" : "to" : this.options.from_fixed ? "to" : "from"
|
||
},
|
||
calcMinMax: function() {
|
||
this.coords.w_rs && (this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100,
|
||
this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100)
|
||
},
|
||
calcLabels: function() {
|
||
this.coords.w_rs && !this.options.hide_from_to && ("single" === this.options.type ? (this.labels.w_single = this.$cache.single.outerWidth(!1),
|
||
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100,
|
||
this.labels.p_single_left = this.coords.p_single_fake + this.coords.p_handle / 2 - this.labels.p_single_fake / 2) : (this.labels.w_from = this.$cache.from.outerWidth(!1),
|
||
this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100,
|
||
this.labels.p_from_left = this.coords.p_from_fake + this.coords.p_handle / 2 - this.labels.p_from_fake / 2,
|
||
this.labels.p_from_left = this.toFixed(this.labels.p_from_left),
|
||
this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake),
|
||
this.labels.w_to = this.$cache.to.outerWidth(!1),
|
||
this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100,
|
||
this.labels.p_to_left = this.coords.p_to_fake + this.coords.p_handle / 2 - this.labels.p_to_fake / 2,
|
||
this.labels.p_to_left = this.toFixed(this.labels.p_to_left),
|
||
this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake),
|
||
this.labels.w_single = this.$cache.single.outerWidth(!1),
|
||
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100,
|
||
this.labels.p_single_left = (this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2 - this.labels.p_single_fake / 2,
|
||
this.labels.p_single_left = this.toFixed(this.labels.p_single_left)),
|
||
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake))
|
||
},
|
||
updateScene: function() {
|
||
this.raf_id && (cancelAnimationFrame(this.raf_id),
|
||
this.raf_id = null),
|
||
clearTimeout(this.update_tm),
|
||
this.update_tm = null,
|
||
this.options && (this.drawHandles(),
|
||
this.is_active ? this.raf_id = requestAnimationFrame(this.updateScene.bind(this)) : this.update_tm = setTimeout(this.updateScene.bind(this), 300))
|
||
},
|
||
drawHandles: function() {
|
||
this.coords.w_rs = this.$cache.rs.outerWidth(!1),
|
||
this.coords.w_rs && (this.coords.w_rs !== this.coords.w_rs_old && (this.target = "base",
|
||
this.is_resize = !0),
|
||
this.coords.w_rs === this.coords.w_rs_old && !this.force_redraw || (this.setMinMax(),
|
||
this.calc(!0),
|
||
this.drawLabels(),
|
||
this.options.grid && (this.calcGridMargin(),
|
||
this.calcGridLabels()),
|
||
this.force_redraw = !0,
|
||
this.coords.w_rs_old = this.coords.w_rs,
|
||
this.drawShadow()),
|
||
this.coords.w_rs && (this.dragging || this.force_redraw || this.is_key) && ((this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) && (this.drawLabels(),
|
||
this.$cache.bar[0].style.left = this.coords.p_bar_x + "%",
|
||
this.$cache.bar[0].style.width = this.coords.p_bar_w + "%",
|
||
"single" === this.options.type ? (this.$cache.bar[0].style.left = 0,
|
||
this.$cache.bar[0].style.width = this.coords.p_bar_w + this.coords.p_bar_x + "%",
|
||
this.$cache.s_single[0].style.left = this.coords.p_single_fake + "%") : (this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%",
|
||
this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%",
|
||
this.old_from === this.result.from && !this.force_redraw || (this.$cache.from[0].style.left = this.labels.p_from_left + "%"),
|
||
this.old_to === this.result.to && !this.force_redraw || (this.$cache.to[0].style.left = this.labels.p_to_left + "%")),
|
||
this.$cache.single[0].style.left = this.labels.p_single_left + "%",
|
||
this.writeToInput(),
|
||
this.old_from === this.result.from && this.old_to === this.result.to || this.is_start || (this.$cache.input.trigger("change"),
|
||
this.$cache.input.trigger("input")),
|
||
this.old_from = this.result.from,
|
||
this.old_to = this.result.to,
|
||
this.is_resize || this.is_update || this.is_start || this.is_finish || this.callOnChange(),
|
||
(this.is_key || this.is_click) && (this.is_key = !1,
|
||
this.is_click = !1,
|
||
this.callOnFinish()),
|
||
this.is_update = !1,
|
||
this.is_resize = !1,
|
||
this.is_finish = !1),
|
||
this.is_start = !1,
|
||
this.is_key = !1,
|
||
this.is_click = !1,
|
||
this.force_redraw = !1))
|
||
},
|
||
drawLabels: function() {
|
||
var t, e, i, n, r;
|
||
this.options && (i = this.options.values.length,
|
||
t = this.options.p_values,
|
||
this.options.hide_from_to || ("single" === this.options.type ? (n = i ? this.decorate(t[this.result.from]) : (e = this._prettify(this.result.from),
|
||
this.decorate(e, this.result.from)),
|
||
this.$cache.single.html(n),
|
||
this.calcLabels(),
|
||
this.labels.p_single_left < this.labels.p_min + 1 ? this.$cache.min[0].style.visibility = "hidden" : this.$cache.min[0].style.visibility = "visible",
|
||
this.labels.p_single_left + this.labels.p_single_fake > 100 - this.labels.p_max - 1 ? this.$cache.max[0].style.visibility = "hidden" : this.$cache.max[0].style.visibility = "visible") : (t = i ? (this.options.decorate_both ? (n = this.decorate(t[this.result.from]),
|
||
n = (n += this.options.values_separator) + this.decorate(t[this.result.to])) : n = this.decorate(t[this.result.from] + this.options.values_separator + t[this.result.to]),
|
||
r = this.decorate(t[this.result.from]),
|
||
this.decorate(t[this.result.to])) : (e = this._prettify(this.result.from),
|
||
i = this._prettify(this.result.to),
|
||
this.options.decorate_both ? (n = this.decorate(e, this.result.from),
|
||
n = (n += this.options.values_separator) + this.decorate(i, this.result.to)) : n = this.decorate(e + this.options.values_separator + i, this.result.to),
|
||
r = this.decorate(e, this.result.from),
|
||
this.decorate(i, this.result.to)),
|
||
this.$cache.single.html(n),
|
||
this.$cache.from.html(r),
|
||
this.$cache.to.html(t),
|
||
this.calcLabels(),
|
||
e = Math.min(this.labels.p_single_left, this.labels.p_from_left),
|
||
i = this.labels.p_single_left + this.labels.p_single_fake,
|
||
n = this.labels.p_to_left + this.labels.p_to_fake,
|
||
r = Math.max(i, n),
|
||
this.labels.p_from_left + this.labels.p_from_fake >= this.labels.p_to_left ? (this.$cache.from[0].style.visibility = "hidden",
|
||
this.$cache.to[0].style.visibility = "hidden",
|
||
this.$cache.single[0].style.visibility = "visible",
|
||
r = this.result.from === this.result.to ? ("from" === this.target ? this.$cache.from[0].style.visibility = "visible" : "to" === this.target ? this.$cache.to[0].style.visibility = "visible" : this.target || (this.$cache.from[0].style.visibility = "visible"),
|
||
this.$cache.single[0].style.visibility = "hidden",
|
||
n) : (this.$cache.from[0].style.visibility = "hidden",
|
||
this.$cache.to[0].style.visibility = "hidden",
|
||
this.$cache.single[0].style.visibility = "visible",
|
||
Math.max(i, n))) : (this.$cache.from[0].style.visibility = "visible",
|
||
this.$cache.to[0].style.visibility = "visible",
|
||
this.$cache.single[0].style.visibility = "hidden"),
|
||
e < this.labels.p_min + 1 ? this.$cache.min[0].style.visibility = "hidden" : this.$cache.min[0].style.visibility = "visible",
|
||
r > 100 - this.labels.p_max - 1 ? this.$cache.max[0].style.visibility = "hidden" : this.$cache.max[0].style.visibility = "visible")))
|
||
},
|
||
drawShadow: function() {
|
||
var t, e, i = this.options, n = this.$cache, r = "number" == typeof i.from_min && !isNaN(i.from_min), a = "number" == typeof i.from_max && !isNaN(i.from_max), s = "number" == typeof i.to_min && !isNaN(i.to_min), o = "number" == typeof i.to_max && !isNaN(i.to_max);
|
||
"single" === i.type ? i.from_shadow && (r || a) ? (t = this.convertToPercent(r ? i.from_min : i.min),
|
||
e = this.convertToPercent(a ? i.from_max : i.max) - t,
|
||
t = this.toFixed(t - this.coords.p_handle / 100 * t),
|
||
e = this.toFixed(e - this.coords.p_handle / 100 * e),
|
||
t += this.coords.p_handle / 2,
|
||
n.shad_single[0].style.display = "block",
|
||
n.shad_single[0].style.left = t + "%",
|
||
n.shad_single[0].style.width = e + "%") : n.shad_single[0].style.display = "none" : (i.from_shadow && (r || a) ? (t = this.convertToPercent(r ? i.from_min : i.min),
|
||
e = this.convertToPercent(a ? i.from_max : i.max) - t,
|
||
t = this.toFixed(t - this.coords.p_handle / 100 * t),
|
||
e = this.toFixed(e - this.coords.p_handle / 100 * e),
|
||
t += this.coords.p_handle / 2,
|
||
n.shad_from[0].style.display = "block",
|
||
n.shad_from[0].style.left = t + "%",
|
||
n.shad_from[0].style.width = e + "%") : n.shad_from[0].style.display = "none",
|
||
i.to_shadow && (s || o) ? (r = this.convertToPercent(s ? i.to_min : i.min),
|
||
a = this.convertToPercent(o ? i.to_max : i.max) - r,
|
||
r = this.toFixed(r - this.coords.p_handle / 100 * r),
|
||
a = this.toFixed(a - this.coords.p_handle / 100 * a),
|
||
r += this.coords.p_handle / 2,
|
||
n.shad_to[0].style.display = "block",
|
||
n.shad_to[0].style.left = r + "%",
|
||
n.shad_to[0].style.width = a + "%") : n.shad_to[0].style.display = "none")
|
||
},
|
||
writeToInput: function() {
|
||
"single" === this.options.type ? (this.options.values.length ? this.$cache.input.prop("value", this.result.from_value) : this.$cache.input.prop("value", this.result.from),
|
||
this.$cache.input.data("from", this.result.from)) : (this.options.values.length ? this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value) : this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to),
|
||
this.$cache.input.data("from", this.result.from),
|
||
this.$cache.input.data("to", this.result.to))
|
||
},
|
||
callOnStart: function() {
|
||
this.writeToInput(),
|
||
this.options.onStart && "function" == typeof this.options.onStart && (this.options.scope ? this.options.onStart.call(this.options.scope, this.result) : this.options.onStart(this.result))
|
||
},
|
||
callOnChange: function() {
|
||
this.writeToInput(),
|
||
this.options.onChange && "function" == typeof this.options.onChange && (this.options.scope ? this.options.onChange.call(this.options.scope, this.result) : this.options.onChange(this.result))
|
||
},
|
||
callOnFinish: function() {
|
||
this.writeToInput(),
|
||
this.options.onFinish && "function" == typeof this.options.onFinish && (this.options.scope ? this.options.onFinish.call(this.options.scope, this.result) : this.options.onFinish(this.result))
|
||
},
|
||
callOnUpdate: function() {
|
||
this.writeToInput(),
|
||
this.options.onUpdate && "function" == typeof this.options.onUpdate && (this.options.scope ? this.options.onUpdate.call(this.options.scope, this.result) : this.options.onUpdate(this.result))
|
||
},
|
||
toggleInput: function() {
|
||
this.$cache.input.toggleClass("irs-hidden-input"),
|
||
this.has_tab_index ? this.$cache.input.prop("tabindex", -1) : this.$cache.input.removeProp("tabindex"),
|
||
this.has_tab_index = !this.has_tab_index
|
||
},
|
||
convertToPercent: function(t, e) {
|
||
var i = this.options.max - this.options.min;
|
||
return i ? (e = (e ? t : t - this.options.min) / (i / 100),
|
||
this.toFixed(e)) : (this.no_diapason = !0,
|
||
0)
|
||
},
|
||
convertToValue: function(t) {
|
||
var e, i = this.options.min, n = this.options.max, r = i.toString().split(".")[1], a = n.toString().split(".")[1], s = 0, o = 0;
|
||
if (0 === t)
|
||
return this.options.min;
|
||
if (100 === t)
|
||
return this.options.max;
|
||
r && (s = c = r.length),
|
||
a && (s = e = a.length),
|
||
c && e && (s = e <= c ? c : e),
|
||
i < 0 && (i = +(i + (o = Math.abs(i))).toFixed(s),
|
||
n = +(n + o).toFixed(s));
|
||
var c, r = (n - i) / 100 * t + i, a = this.options.step.toString().split(".")[1], r = a ? +r.toFixed(a.length) : +(r = (r /= this.options.step) * this.options.step).toFixed(0);
|
||
return o && (r -= o),
|
||
(c = a ? +r.toFixed(a.length) : this.toFixed(r)) < this.options.min ? c = this.options.min : c > this.options.max && (c = this.options.max),
|
||
c
|
||
},
|
||
calcWithStep: function(t) {
|
||
var e = Math.round(t / this.coords.p_step) * this.coords.p_step;
|
||
return 100 < e && (e = 100),
|
||
this.toFixed(e = 100 === t ? 100 : e)
|
||
},
|
||
checkMinInterval: function(t, e, i) {
|
||
var n, r = this.options;
|
||
return r.min_interval ? (n = this.convertToValue(t),
|
||
e = this.convertToValue(e),
|
||
"from" === i ? e - n < r.min_interval && (n = e - r.min_interval) : n - e < r.min_interval && (n = e + r.min_interval),
|
||
this.convertToPercent(n)) : t
|
||
},
|
||
checkMaxInterval: function(t, e, i) {
|
||
var n, r = this.options;
|
||
return r.max_interval ? (n = this.convertToValue(t),
|
||
e = this.convertToValue(e),
|
||
"from" === i ? e - n > r.max_interval && (n = e - r.max_interval) : n - e > r.max_interval && (n = e + r.max_interval),
|
||
this.convertToPercent(n)) : t
|
||
},
|
||
checkDiapason: function(t, e, i) {
|
||
var t = this.convertToValue(t)
|
||
, n = this.options;
|
||
return "number" != typeof e && (e = n.min),
|
||
(i = "number" != typeof i ? n.max : i) < (t = t < e ? e : t) && (t = i),
|
||
this.convertToPercent(t)
|
||
},
|
||
toFixed: function(t) {
|
||
return +t.toFixed(20)
|
||
},
|
||
_prettify: function(t) {
|
||
return this.options.prettify_enabled ? (this.options.prettify && "function" == typeof this.options.prettify ? this.options : this).prettify(t) : t
|
||
},
|
||
prettify: function(t) {
|
||
return t.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + this.options.prettify_separator)
|
||
},
|
||
checkEdges: function(t, e) {
|
||
return this.options.force_edges && (t < 0 ? t = 0 : 100 - e < t && (t = 100 - e)),
|
||
this.toFixed(t)
|
||
},
|
||
validate: function() {
|
||
var t, e, i = this.options, n = this.result, r = i.values, a = r.length;
|
||
if ("string" == typeof i.min && (i.min = +i.min),
|
||
"string" == typeof i.max && (i.max = +i.max),
|
||
"string" == typeof i.from && (i.from = +i.from),
|
||
"string" == typeof i.to && (i.to = +i.to),
|
||
"string" == typeof i.step && (i.step = +i.step),
|
||
"string" == typeof i.from_min && (i.from_min = +i.from_min),
|
||
"string" == typeof i.from_max && (i.from_max = +i.from_max),
|
||
"string" == typeof i.to_min && (i.to_min = +i.to_min),
|
||
"string" == typeof i.to_max && (i.to_max = +i.to_max),
|
||
"string" == typeof i.grid_num && (i.grid_num = +i.grid_num),
|
||
i.max < i.min && (i.max = i.min),
|
||
a)
|
||
for (i.p_values = [],
|
||
i.min = 0,
|
||
i.max = a - 1,
|
||
i.step = 1,
|
||
i.grid_num = i.max,
|
||
i.grid_snap = !0,
|
||
e = 0; e < a; e++)
|
||
t = +r[e],
|
||
t = isNaN(t) ? r[e] : (r[e] = t,
|
||
this._prettify(t)),
|
||
i.p_values.push(t);
|
||
"number" == typeof i.from && !isNaN(i.from) || (i.from = i.min),
|
||
"number" == typeof i.to && !isNaN(i.to) || (i.to = i.max),
|
||
"single" === i.type ? (i.from < i.min && (i.from = i.min),
|
||
i.from > i.max && (i.from = i.max)) : (i.from < i.min && (i.from = i.min),
|
||
i.from > i.max && (i.from = i.max),
|
||
i.to < i.min && (i.to = i.min),
|
||
i.to > i.max && (i.to = i.max),
|
||
this.update_check.from && (this.update_check.from !== i.from && i.from > i.to && (i.from = i.to),
|
||
this.update_check.to !== i.to && i.to < i.from && (i.to = i.from)),
|
||
i.from > i.to && (i.from = i.to),
|
||
i.to < i.from && (i.to = i.from)),
|
||
("number" != typeof i.step || isNaN(i.step) || !i.step || i.step < 0) && (i.step = 1),
|
||
"number" == typeof i.from_min && i.from < i.from_min && (i.from = i.from_min),
|
||
"number" == typeof i.from_max && i.from > i.from_max && (i.from = i.from_max),
|
||
"number" == typeof i.to_min && i.to < i.to_min && (i.to = i.to_min),
|
||
"number" == typeof i.to_max && i.from > i.to_max && (i.to = i.to_max),
|
||
n && (n.min !== i.min && (n.min = i.min),
|
||
n.max !== i.max && (n.max = i.max),
|
||
(n.from < n.min || n.from > n.max) && (n.from = i.from),
|
||
(n.to < n.min || n.to > n.max) && (n.to = i.to)),
|
||
("number" != typeof i.min_interval || isNaN(i.min_interval) || !i.min_interval || i.min_interval < 0) && (i.min_interval = 0),
|
||
("number" != typeof i.max_interval || isNaN(i.max_interval) || !i.max_interval || i.max_interval < 0) && (i.max_interval = 0),
|
||
i.min_interval && i.min_interval > i.max - i.min && (i.min_interval = i.max - i.min),
|
||
i.max_interval && i.max_interval > i.max - i.min && (i.max_interval = i.max - i.min)
|
||
},
|
||
decorate: function(t, e) {
|
||
var i = ""
|
||
, n = this.options;
|
||
return n.prefix && (i += n.prefix),
|
||
i += t,
|
||
n.max_postfix && (n.values.length && t === n.p_values[n.max] || e === n.max) && (i += n.max_postfix,
|
||
n.postfix && (i += " ")),
|
||
n.postfix && (i += n.postfix),
|
||
i
|
||
},
|
||
updateFrom: function() {
|
||
this.result.from = this.options.from,
|
||
this.result.from_percent = this.convertToPercent(this.result.from),
|
||
this.result.from_pretty = this._prettify(this.result.from),
|
||
this.options.values && (this.result.from_value = this.options.values[this.result.from])
|
||
},
|
||
updateTo: function() {
|
||
this.result.to = this.options.to,
|
||
this.result.to_percent = this.convertToPercent(this.result.to),
|
||
this.result.to_pretty = this._prettify(this.result.to),
|
||
this.options.values && (this.result.to_value = this.options.values[this.result.to])
|
||
},
|
||
updateResult: function() {
|
||
this.result.min = this.options.min,
|
||
this.result.max = this.options.max,
|
||
this.updateFrom(),
|
||
this.updateTo()
|
||
},
|
||
appendGrid: function() {
|
||
if (this.options.grid) {
|
||
var t, e, i, n, r, a, s = this.options, o = s.max - s.min, c = s.grid_num, l = 0, d = 4, u = "";
|
||
for (this.calcGridMargin(),
|
||
s.grid_snap && (c = o / s.step),
|
||
i = this.toFixed(100 / (c = 50 < c ? 50 : c)),
|
||
4 < c && (d = 3),
|
||
7 < c && (d = 2),
|
||
14 < c && (d = 1),
|
||
28 < c && (d = 0),
|
||
t = 0; t < c + 1; t++) {
|
||
for (n = d,
|
||
100 < (l = this.toFixed(i * t)) && (l = 100),
|
||
r = ((this.coords.big[t] = l) - i * (t - 1)) / (n + 1),
|
||
e = 1; e <= n && 0 !== l; e++)
|
||
u += '<span class="irs-grid-pol small" style="left: ' + this.toFixed(l - r * e) + '%"></span>';
|
||
u += '<span class="irs-grid-pol" style="left: ' + l + '%"></span>',
|
||
a = this.convertToValue(l),
|
||
u += '<span class="irs-grid-text js-grid-text-' + t + '" style="left: ' + l + '%">' + (s.values.length ? s.p_values[a] : this._prettify(a)) + "</span>"
|
||
}
|
||
this.coords.big_num = Math.ceil(c + 1),
|
||
this.$cache.cont.addClass("irs-with-grid"),
|
||
this.$cache.grid.html(u),
|
||
this.cacheGridLabels()
|
||
}
|
||
},
|
||
cacheGridLabels: function() {
|
||
for (var t, e = this.coords.big_num, i = 0; i < e; i++)
|
||
t = this.$cache.grid.find(".js-grid-text-" + i),
|
||
this.$cache.grid_labels.push(t);
|
||
this.calcGridLabels()
|
||
},
|
||
calcGridLabels: function() {
|
||
for (var t, e = [], i = [], n = this.coords.big_num, r = 0; r < n; r++)
|
||
this.coords.big_w[r] = this.$cache.grid_labels[r].outerWidth(!1),
|
||
this.coords.big_p[r] = this.toFixed(this.coords.big_w[r] / this.coords.w_rs * 100),
|
||
this.coords.big_x[r] = this.toFixed(this.coords.big_p[r] / 2),
|
||
e[r] = this.toFixed(this.coords.big[r] - this.coords.big_x[r]),
|
||
i[r] = this.toFixed(e[r] + this.coords.big_p[r]);
|
||
for (this.options.force_edges && (e[0] < -this.coords.grid_gap && (e[0] = -this.coords.grid_gap,
|
||
i[0] = this.toFixed(e[0] + this.coords.big_p[0]),
|
||
this.coords.big_x[0] = this.coords.grid_gap),
|
||
i[n - 1] > 100 + this.coords.grid_gap && (i[n - 1] = 100 + this.coords.grid_gap,
|
||
e[n - 1] = this.toFixed(i[n - 1] - this.coords.big_p[n - 1]),
|
||
this.coords.big_x[n - 1] = this.toFixed(this.coords.big_p[n - 1] - this.coords.grid_gap))),
|
||
this.calcGridCollision(2, e, i),
|
||
this.calcGridCollision(4, e, i),
|
||
r = 0; r < n; r++)
|
||
t = this.$cache.grid_labels[r][0],
|
||
this.coords.big_x[r] !== Number.POSITIVE_INFINITY && (t.style.marginLeft = -this.coords.big_x[r] + "%")
|
||
},
|
||
calcGridCollision: function(t, e, i) {
|
||
for (var n, r, a = this.coords.big_num, s = 0; s < a && !(a <= (n = s + t / 2)); s += t)
|
||
r = this.$cache.grid_labels[n][0],
|
||
i[s] <= e[n] ? r.style.visibility = "visible" : r.style.visibility = "hidden"
|
||
},
|
||
calcGridMargin: function() {
|
||
this.options.grid_margin && (this.coords.w_rs = this.$cache.rs.outerWidth(!1),
|
||
this.coords.w_rs && ("single" === this.options.type ? this.coords.w_handle = this.$cache.s_single.outerWidth(!1) : this.coords.w_handle = this.$cache.s_from.outerWidth(!1),
|
||
this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100),
|
||
this.coords.grid_gap = this.toFixed(this.coords.p_handle / 2 - .1),
|
||
this.$cache.grid[0].style.width = this.toFixed(100 - this.coords.p_handle) + "%",
|
||
this.$cache.grid[0].style.left = this.coords.grid_gap + "%"))
|
||
},
|
||
update: function(t) {
|
||
this.input && (this.is_update = !0,
|
||
this.options.from = this.result.from,
|
||
this.options.to = this.result.to,
|
||
this.update_check.from = this.result.from,
|
||
this.update_check.to = this.result.to,
|
||
this.options = s.extend(this.options, t),
|
||
this.validate(),
|
||
this.updateResult(t),
|
||
this.toggleInput(),
|
||
this.remove(),
|
||
this.init(!0))
|
||
},
|
||
reset: function() {
|
||
this.input && (this.updateResult(),
|
||
this.update())
|
||
},
|
||
destroy: function() {
|
||
this.input && (this.toggleInput(),
|
||
this.$cache.input.prop("readonly", !1),
|
||
s.data(this.input, "ionRangeSlider", null),
|
||
this.remove(),
|
||
this.input = null,
|
||
this.options = null)
|
||
}
|
||
},
|
||
s.fn.ionRangeSlider = function(t) {
|
||
return this.each(function() {
|
||
s.data(this, "ionRangeSlider") || s.data(this, "ionRangeSlider", new e(this,t,n++))
|
||
})
|
||
}
|
||
;
|
||
for (var a = 0, d = ["ms", "moz", "webkit", "o"], u = 0; u < d.length && !c.requestAnimationFrame; ++u)
|
||
c.requestAnimationFrame = c[d[u] + "RequestAnimationFrame"],
|
||
c.cancelAnimationFrame = c[d[u] + "CancelAnimationFrame"] || c[d[u] + "CancelRequestAnimationFrame"];
|
||
c.requestAnimationFrame || (c.requestAnimationFrame = function(t, e) {
|
||
var i = (new Date).getTime()
|
||
, n = Math.max(0, 16 - (i - a))
|
||
, r = c.setTimeout(function() {
|
||
t(i + n)
|
||
}, n);
|
||
return a = i + n,
|
||
r
|
||
}
|
||
),
|
||
c.cancelAnimationFrame || (c.cancelAnimationFrame = function(t) {
|
||
clearTimeout(t)
|
||
}
|
||
)
|
||
}
|
||
,
|
||
!jQuery && "function" == typeof define && define.amd ? define(["jquery"], function(t) {
|
||
return e(t, document, window, navigator)
|
||
}) : jQuery || "object" != typeof exports ? e(jQuery, document, window, navigator) : e(require("jquery"), document, window, navigator)
|
||
}(),
|
||
function() {
|
||
"use strict";
|
||
("function" == typeof define && define.amd ? define : function(t, e, i) {
|
||
(i || e)()
|
||
}
|
||
)("kendo.core.min", ["jquery"], function() {
|
||
var m = jQuery
|
||
, v = window
|
||
, q = void 0;
|
||
function D() {}
|
||
function N(t, e) {
|
||
if (e)
|
||
return "'" + t.split("'").join("\\'").split('\\"').join('\\\\\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t") + "'";
|
||
var i = t.charAt(0)
|
||
, n = t.substring(1);
|
||
return "=" === i ? "+(" + n + ")+" : ":" === i ? "+$kendoHtmlEncode(" + n + ")+" : ";" + t + ";$kendoOutput+="
|
||
}
|
||
function c(t, e, i) {
|
||
return t += "",
|
||
e = e || 2,
|
||
i = e - t.length,
|
||
i ? vt[e].substring(0, i) + t : t
|
||
}
|
||
function M(t) {
|
||
var e = t.css(F.support.transitions.css + "box-shadow") || t.css("box-shadow")
|
||
, i = e ? e.match(Qt) || [0, 0, 0, 0, 0] : [0, 0, 0, 0, 0]
|
||
, n = h.max(+i[3], +(i[4] || 0));
|
||
return {
|
||
left: -i[1] + n,
|
||
right: +i[1] + n,
|
||
bottom: +i[2] + n
|
||
}
|
||
}
|
||
function A(t, e) {
|
||
var i, n, r, a, s, o, c, l, d = f.browser, u = F._outerWidth, p = F._outerHeight;
|
||
return t.parent().hasClass("k-animation-container") ? (c = t.parent(".k-animation-container"),
|
||
l = c[0].style,
|
||
c.is(":hidden") && c.css({
|
||
display: "",
|
||
position: ""
|
||
}),
|
||
i = Gt.test(l.width) || Gt.test(l.height),
|
||
i || c.css({
|
||
width: e ? u(t) + 1 : u(t),
|
||
height: p(t),
|
||
boxSizing: "content-box",
|
||
mozBoxSizing: "content-box",
|
||
webkitBoxSizing: "content-box"
|
||
})) : (n = t[0].style.width,
|
||
r = t[0].style.height,
|
||
a = Gt.test(n),
|
||
s = Gt.test(r),
|
||
o = t.hasClass("k-tooltip") || t.is(".k-menu-horizontal.k-context-menu"),
|
||
i = a || s,
|
||
!a && (!e || e && n || o) && (n = e ? u(t) + 1 : u(t)),
|
||
!s && (!e || e && r) && (r = p(t)),
|
||
t.wrap(m("<div/>").addClass("k-animation-container").css({
|
||
width: n,
|
||
height: r
|
||
})),
|
||
i && t.css({
|
||
width: "100%",
|
||
height: "100%",
|
||
boxSizing: "border-box",
|
||
mozBoxSizing: "border-box",
|
||
webkitBoxSizing: "border-box"
|
||
})),
|
||
d.msie && h.floor(d.version) <= 7 && (t.css({
|
||
zoom: 1
|
||
}),
|
||
t.children(".k-menu").width(t.width())),
|
||
t.parent()
|
||
}
|
||
function O(t) {
|
||
var e = 1
|
||
, i = arguments.length;
|
||
for (e = 1; e < i; e++)
|
||
I(t, arguments[e]);
|
||
return t
|
||
}
|
||
function I(t, e) {
|
||
var i, n, r, a, s, o = F.data.ObservableArray, c = F.data.LazyObservableArray, l = F.data.DataSource, d = F.data.HierarchicalDataSource;
|
||
for (i in e)
|
||
n = e[i],
|
||
r = typeof n,
|
||
a = r === b && null !== n ? n.constructor : null,
|
||
a && a !== Array && a !== o && a !== c && a !== l && a !== d && a !== RegExp ? n instanceof Date ? t[i] = new Date(n.getTime()) : u(n.clone) ? t[i] = n.clone() : (s = t[i],
|
||
t[i] = typeof s === b ? s || {} : {},
|
||
I(t[i], n)) : r !== Kt && (t[i] = n);
|
||
return t
|
||
}
|
||
function E(t, e, i) {
|
||
for (var n in e)
|
||
if (e.hasOwnProperty(n) && e[n].test(t))
|
||
return n;
|
||
return i !== q ? i : t
|
||
}
|
||
function B(t) {
|
||
return t.replace(/([a-z][A-Z])/g, function(t) {
|
||
return t.charAt(0) + "-" + t.charAt(1).toLowerCase()
|
||
})
|
||
}
|
||
function L(t) {
|
||
return t.replace(/\-(\w)/g, function(t, e) {
|
||
return e.toUpperCase()
|
||
})
|
||
}
|
||
function V(t, e) {
|
||
var i, n = {};
|
||
return document.defaultView && document.defaultView.getComputedStyle ? (i = document.defaultView.getComputedStyle(t, ""),
|
||
e && m.each(e, function(t, e) {
|
||
n[e] = i.getPropertyValue(e)
|
||
})) : (i = t.currentStyle,
|
||
e && m.each(e, function(t, e) {
|
||
n[e] = i[L(e)]
|
||
})),
|
||
F.size(n) || (n = i),
|
||
n
|
||
}
|
||
function G(t) {
|
||
if (t && t.className && "string" == typeof t.className && t.className.indexOf("k-auto-scrollable") > -1)
|
||
return !0;
|
||
var e = V(t, ["overflow"]).overflow;
|
||
return "auto" == e || "scroll" == e
|
||
}
|
||
function W(t, e) {
|
||
var i, n = f.browser.webkit, r = f.browser.mozilla, a = t instanceof m ? t[0] : t;
|
||
if (t)
|
||
return i = f.isRtl(t),
|
||
e === q ? i && n ? a.scrollWidth - a.clientWidth - a.scrollLeft : Math.abs(a.scrollLeft) : (a.scrollLeft = i && n ? a.scrollWidth - a.clientWidth - e : i && r ? -e : e,
|
||
q)
|
||
}
|
||
function Q(t) {
|
||
var e, i = 0;
|
||
for (e in t)
|
||
t.hasOwnProperty(e) && "toJSON" != e && i++;
|
||
return i
|
||
}
|
||
function J(t, e, i) {
|
||
var n, r, a;
|
||
return e || (e = "offset"),
|
||
n = t[e](),
|
||
r = {
|
||
top: n.top,
|
||
right: n.right,
|
||
bottom: n.bottom,
|
||
left: n.left
|
||
},
|
||
f.browser.msie && (f.pointers || f.msPointers) && !i && (a = f.isRtl(t) ? 1 : -1,
|
||
r.top -= v.pageYOffset - document.documentElement.scrollTop,
|
||
r.left -= v.pageXOffset + a * document.documentElement.scrollLeft),
|
||
r
|
||
}
|
||
function Y(t) {
|
||
var e = {};
|
||
return jt("string" == typeof t ? t.split(" ") : t, function(t) {
|
||
e[t] = this
|
||
}),
|
||
e
|
||
}
|
||
function Z(t) {
|
||
return new F.effects.Element(t)
|
||
}
|
||
function K(t, e, i, n) {
|
||
return typeof t === _ && (u(e) && (n = e,
|
||
e = 400,
|
||
i = !1),
|
||
u(i) && (n = i,
|
||
i = !1),
|
||
typeof e === Zt && (i = e,
|
||
e = 400),
|
||
t = {
|
||
effects: t,
|
||
duration: e,
|
||
reverse: i,
|
||
complete: n
|
||
}),
|
||
p({
|
||
effects: {},
|
||
duration: 400,
|
||
reverse: !1,
|
||
init: Lt,
|
||
teardown: Lt,
|
||
hide: !1
|
||
}, t, {
|
||
completeCallback: t.complete,
|
||
complete: Lt
|
||
})
|
||
}
|
||
function X(t, e, i, n, r) {
|
||
for (var a, s = 0, o = t.length; s < o; s++)
|
||
a = m(t[s]),
|
||
a.queue(function() {
|
||
l.promise(a, K(e, i, n, r))
|
||
});
|
||
return t
|
||
}
|
||
function tt(i, t, e, n) {
|
||
return t && (t = t.split(" "),
|
||
jt(t, function(t, e) {
|
||
i.toggleClass(e, n)
|
||
})),
|
||
i
|
||
}
|
||
function et(t) {
|
||
return ("" + t).replace(yt, "&").replace(bt, "<").replace(Ct, ">").replace(xt, """).replace(wt, "'")
|
||
}
|
||
function it(t, e) {
|
||
var i;
|
||
return 0 === e.indexOf("data") && (e = e.substring(4),
|
||
e = e.charAt(0).toLowerCase() + e.substring(1)),
|
||
e = e.replace(At, "-$1"),
|
||
i = t.getAttribute("data-" + F.ns + e),
|
||
null === i ? i = q : "null" === i ? i = null : "true" === i ? i = !0 : "false" === i ? i = !1 : Jt.test(i) && "mask" != e ? i = parseFloat(i) : Nt.test(i) && !Mt.test(i) && (i = Function("return (" + i + ")")()),
|
||
i
|
||
}
|
||
function nt(t, e, i) {
|
||
var n, r, a = {};
|
||
for (n in e)
|
||
r = it(t, n),
|
||
r !== q && (Dt.test(n) && ("string" == typeof r ? m("#" + r).length ? r = F.template(m("#" + r).html()) : i && (r = F.template(i[r])) : r = t.getAttribute(n)),
|
||
a[n] = r);
|
||
return a
|
||
}
|
||
function rt(t, e) {
|
||
return m.contains(t, e) ? -1 : 1
|
||
}
|
||
function at() {
|
||
var t = m(this);
|
||
return m.inArray(t.attr("data-" + F.ns + "role"), ["slider", "rangeslider"]) > -1 || t.is(":visible")
|
||
}
|
||
function st(t, e) {
|
||
var i = t.nodeName.toLowerCase();
|
||
return (/input|select|textarea|button|object/.test(i) ? !t.disabled : "a" === i ? t.href || e : e) && ot(t)
|
||
}
|
||
function ot(t) {
|
||
return m.expr.filters.visible(t) && !m(t).parents().addBack().filter(function() {
|
||
return "hidden" === m.css(this, "visibility")
|
||
}).length
|
||
}
|
||
function i(t, e) {
|
||
return new i.fn.init(t,e)
|
||
}
|
||
var t, u, ct, lt, dt, ut, pt, ht, ft, gt, mt, vt, _t, l, yt, bt, xt, wt, Ct, kt, St, Pt, n, Tt, Dt, Nt, Mt, At, Ot, It, Et, Ft, d, e, Rt, qt, $t, Ut, zt, r, F = v.kendo = v.kendo || {
|
||
cultures: {}
|
||
}, p = m.extend, jt = m.each, Ht = m.isArray, Bt = m.proxy, Lt = m.noop, h = Math, Vt = v.JSON || {}, f = {}, Gt = /%/, Wt = /\{(\d+)(:[^\}]+)?\}/g, Qt = /(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+)?/i, Jt = /^(\+|-?)\d+(\.?)\d*$/, g = "function", _ = "string", y = "number", b = "object", Yt = "null", Zt = "boolean", Kt = "undefined", Xt = {}, te = {}, ee = [].slice, a, s, o, ie, x, w, C, ne, re, ae;
|
||
function se(t) {
|
||
return le.lastIndex = 0,
|
||
le.test(t) ? '"' + t.replace(le, function(t) {
|
||
var e = de[t];
|
||
return typeof e === _ ? e : "\\u" + ("0000" + t.charCodeAt(0).toString(16)).slice(-4)
|
||
}) + '"' : '"' + t + '"'
|
||
}
|
||
function oe(t, e) {
|
||
var i, n, r, a, s, o, c = k, l = e[t];
|
||
if (l && typeof l === b && typeof l.toJSON === g && (l = l.toJSON(t)),
|
||
typeof S === g && (l = S.call(e, t, l)),
|
||
o = typeof l,
|
||
o === _)
|
||
return se(l);
|
||
if (o === y)
|
||
return isFinite(l) ? l + "" : Yt;
|
||
if (o === Zt || o === Yt)
|
||
return l + "";
|
||
if (o === b) {
|
||
if (!l)
|
||
return Yt;
|
||
if (k += ce,
|
||
s = [],
|
||
"[object Array]" === ue.apply(l)) {
|
||
for (a = l.length,
|
||
i = 0; i < a; i++)
|
||
s[i] = oe(i, l) || Yt;
|
||
return r = 0 === s.length ? "[]" : k ? "[\n" + k + s.join(",\n" + k) + "\n" + c + "]" : "[" + s.join(",") + "]",
|
||
k = c,
|
||
r
|
||
}
|
||
if (S && typeof S === b)
|
||
for (a = S.length,
|
||
i = 0; i < a; i++)
|
||
typeof S[i] === _ && (n = S[i],
|
||
r = oe(n, l),
|
||
r && s.push(se(n) + (k ? ": " : ":") + r));
|
||
else
|
||
for (n in l)
|
||
Object.hasOwnProperty.call(l, n) && (r = oe(n, l),
|
||
r && s.push(se(n) + (k ? ": " : ":") + r));
|
||
return r = 0 === s.length ? "{}" : k ? "{\n" + k + s.join(",\n" + k) + "\n" + c + "}" : "{" + s.join(",") + "}",
|
||
k = c,
|
||
r
|
||
}
|
||
}
|
||
F.version = "2019.1.220".replace(/^\s+|\s+$/g, ""),
|
||
D.extend = function(t) {
|
||
var e, i, n = function() {}, r = this, a = t && t.init ? t.init : function() {
|
||
r.apply(this, arguments)
|
||
}
|
||
;
|
||
n.prototype = r.prototype,
|
||
i = a.fn = a.prototype = new n;
|
||
for (e in t)
|
||
i[e] = null != t[e] && t[e].constructor === Object ? p(!0, {}, n.prototype[e], t[e]) : t[e];
|
||
return i.constructor = a,
|
||
a.extend = r.extend,
|
||
a
|
||
}
|
||
,
|
||
D.prototype._initOptions = function(t) {
|
||
this.options = O({}, this.options, t)
|
||
}
|
||
,
|
||
u = F.isFunction = function(t) {
|
||
return "function" == typeof t
|
||
}
|
||
,
|
||
ct = function() {
|
||
this._defaultPrevented = !0
|
||
}
|
||
,
|
||
lt = function() {
|
||
return this._defaultPrevented === !0
|
||
}
|
||
,
|
||
dt = D.extend({
|
||
init: function() {
|
||
this._events = {}
|
||
},
|
||
bind: function(t, e, i) {
|
||
var n, r, a, s, o, c = this, l = typeof t === _ ? [t] : t, d = typeof e === g;
|
||
if (e === q) {
|
||
for (n in t)
|
||
c.bind(n, t[n]);
|
||
return c
|
||
}
|
||
for (n = 0,
|
||
r = l.length; n < r; n++)
|
||
t = l[n],
|
||
s = d ? e : e[t],
|
||
s && (i && (a = s,
|
||
s = function() {
|
||
c.unbind(t, s),
|
||
a.apply(c, arguments)
|
||
}
|
||
,
|
||
s.original = a),
|
||
o = c._events[t] = c._events[t] || [],
|
||
o.push(s));
|
||
return c
|
||
},
|
||
one: function(t, e) {
|
||
return this.bind(t, e, !0)
|
||
},
|
||
first: function(t, e) {
|
||
var i, n, r, a, s = this, o = typeof t === _ ? [t] : t, c = typeof e === g;
|
||
for (i = 0,
|
||
n = o.length; i < n; i++)
|
||
t = o[i],
|
||
r = c ? e : e[t],
|
||
r && (a = s._events[t] = s._events[t] || [],
|
||
a.unshift(r));
|
||
return s
|
||
},
|
||
trigger: function(t, e) {
|
||
var i, n, r = this, a = r._events[t];
|
||
if (a) {
|
||
for (e = e || {},
|
||
e.sender = r,
|
||
e._defaultPrevented = !1,
|
||
e.preventDefault = ct,
|
||
e.isDefaultPrevented = lt,
|
||
a = a.slice(),
|
||
i = 0,
|
||
n = a.length; i < n; i++)
|
||
a[i].call(r, e);
|
||
return e._defaultPrevented === !0
|
||
}
|
||
return !1
|
||
},
|
||
unbind: function(t, e) {
|
||
var i, n = this, r = n._events[t];
|
||
if (t === q)
|
||
n._events = {};
|
||
else if (r)
|
||
if (e)
|
||
for (i = r.length - 1; i >= 0; i--)
|
||
r[i] !== e && r[i].original !== e || r.splice(i, 1);
|
||
else
|
||
n._events[t] = [];
|
||
return n
|
||
}
|
||
}),
|
||
ut = /^\w+/,
|
||
pt = /\$\{([^}]*)\}/g,
|
||
ht = /\\\}/g,
|
||
ft = /__CURLY__/g,
|
||
gt = /\\#/g,
|
||
mt = /__SHARP__/g,
|
||
vt = ["", "0", "00", "000", "0000"],
|
||
t = {
|
||
paramName: "data",
|
||
useWithBlock: !0,
|
||
render: function(t, e) {
|
||
var i, n, r = "";
|
||
for (i = 0,
|
||
n = e.length; i < n; i++)
|
||
r += t(e[i]);
|
||
return r
|
||
},
|
||
compile: function(e, t) {
|
||
var i, n, r, a = p({}, this, t), s = a.paramName, o = s.match(ut)[0], c = a.useWithBlock, l = "var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;";
|
||
if (u(e))
|
||
return e;
|
||
for (l += c ? "with(" + s + "){" : "",
|
||
l += "$kendoOutput=",
|
||
n = e.replace(ht, "__CURLY__").replace(pt, "#=$kendoHtmlEncode($1)#").replace(ft, "}").replace(gt, "__SHARP__").split("#"),
|
||
r = 0; r < n.length; r++)
|
||
l += N(n[r], r % 2 === 0);
|
||
l += c ? ";}" : ";",
|
||
l += "return $kendoOutput;",
|
||
l = l.replace(mt, "#");
|
||
try {
|
||
return i = Function(o, l),
|
||
i._slotCount = Math.floor(n.length / 2),
|
||
i
|
||
} catch (t) {
|
||
throw Error(F.format("Invalid template:'{0}' Generated code:'{1}'", e, l))
|
||
}
|
||
}
|
||
};
|
||
var k, ce, S, le = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, de = {
|
||
"\b": "\\b",
|
||
"\t": "\\t",
|
||
"\n": "\\n",
|
||
"\f": "\\f",
|
||
"\r": "\\r",
|
||
'"': '\\"',
|
||
"\\": "\\\\"
|
||
}, ue = {}.toString;
|
||
function pe(t) {
|
||
if (t) {
|
||
if (t.numberFormat)
|
||
return t;
|
||
if (typeof t === _) {
|
||
var e = F.cultures;
|
||
return e[t] || e[t.split("-")[0]] || null
|
||
}
|
||
return null
|
||
}
|
||
return null
|
||
}
|
||
function he(t) {
|
||
return t && (t = pe(t)),
|
||
t || F.cultures.current
|
||
}
|
||
function fe(r, t, e) {
|
||
e = he(e);
|
||
var a = e.calendars.standard
|
||
, s = a.days
|
||
, o = a.months;
|
||
return t = a.patterns[t] || t,
|
||
t.replace(_e, function(t) {
|
||
var e, i, n;
|
||
return "d" === t ? i = r.getDate() : "dd" === t ? i = c(r.getDate()) : "ddd" === t ? i = s.namesAbbr[r.getDay()] : "dddd" === t ? i = s.names[r.getDay()] : "M" === t ? i = r.getMonth() + 1 : "MM" === t ? i = c(r.getMonth() + 1) : "MMM" === t ? i = o.namesAbbr[r.getMonth()] : "MMMM" === t ? i = o.names[r.getMonth()] : "yy" === t ? i = c(r.getFullYear() % 100) : "yyyy" === t ? i = c(r.getFullYear(), 4) : "h" === t ? i = r.getHours() % 12 || 12 : "hh" === t ? i = c(r.getHours() % 12 || 12) : "H" === t ? i = r.getHours() : "HH" === t ? i = c(r.getHours()) : "m" === t ? i = r.getMinutes() : "mm" === t ? i = c(r.getMinutes()) : "s" === t ? i = r.getSeconds() : "ss" === t ? i = c(r.getSeconds()) : "f" === t ? i = h.floor(r.getMilliseconds() / 100) : "ff" === t ? (i = r.getMilliseconds(),
|
||
i > 99 && (i = h.floor(i / 10)),
|
||
i = c(i)) : "fff" === t ? i = c(r.getMilliseconds(), 3) : "tt" === t ? i = r.getHours() < 12 ? a.AM[0] : a.PM[0] : "zzz" === t ? (e = r.getTimezoneOffset(),
|
||
n = e < 0,
|
||
i = ("" + h.abs(e / 60)).split(".")[0],
|
||
e = h.abs(e) - 60 * i,
|
||
i = (n ? "+" : "-") + c(i),
|
||
i += ":" + c(e)) : "zz" !== t && "z" !== t || (i = r.getTimezoneOffset() / 60,
|
||
n = i < 0,
|
||
i = ("" + h.abs(i)).split(".")[0],
|
||
i = (n ? "+" : "-") + ("zz" === t ? c(i) : i)),
|
||
i !== q ? i : t.slice(1, t.length - 1)
|
||
})
|
||
}
|
||
function ge(t, e, i) {
|
||
var n, r, a, s, o, c, l, d, u, p, h, f, g, m, v, _, y, b, x, w, C, k, S, P, T, D, N, M, A, R, O, I, E, F;
|
||
if (i = he(i),
|
||
n = i.numberFormat,
|
||
r = n[z],
|
||
a = n.decimals,
|
||
s = n.pattern[0],
|
||
o = [],
|
||
h = t < 0,
|
||
_ = U,
|
||
y = U,
|
||
O = -1,
|
||
t === q)
|
||
return U;
|
||
if (!isFinite(t))
|
||
return t;
|
||
if (!e)
|
||
return i.name.length ? t.toLocaleString() : "" + t;
|
||
if (p = ye.exec(e)) {
|
||
if (e = p[1].toLowerCase(),
|
||
l = "c" === e,
|
||
d = "p" === e,
|
||
(l || d) && (n = l ? n.currency : n.percent,
|
||
r = n[z],
|
||
a = n.decimals,
|
||
c = n.symbol,
|
||
s = n.pattern[h ? 0 : 1]),
|
||
u = p[2],
|
||
u && (a = +u),
|
||
"e" === e)
|
||
return E = u ? t.toExponential(a) : t.toExponential(),
|
||
E.replace(z, n[z]);
|
||
if (d && (t *= 100),
|
||
t = $(t, a),
|
||
h = t < 0,
|
||
t = t.split(z),
|
||
f = t[0],
|
||
g = t[1],
|
||
h && (f = f.substring(1)),
|
||
y = me(f, 0, f.length, n),
|
||
g && (y += r + g),
|
||
"n" === e && !h)
|
||
return y;
|
||
for (t = U,
|
||
b = 0,
|
||
x = s.length; b < x; b++)
|
||
w = s.charAt(b),
|
||
t += "n" === w ? y : "$" === w || "%" === w ? c : w;
|
||
return t
|
||
}
|
||
if ((e.indexOf("'") > -1 || e.indexOf('"') > -1 || e.indexOf("\\") > -1) && (e = e.replace(be, function(t) {
|
||
var e = t.charAt(0).replace("\\", "")
|
||
, i = t.slice(1).replace(e, "");
|
||
return o.push(i),
|
||
Ce
|
||
})),
|
||
e = e.split(";"),
|
||
h && e[1])
|
||
e = e[1],
|
||
k = !0;
|
||
else if (0 === t && e[2]) {
|
||
if (e = e[2],
|
||
e.indexOf(j) == -1 && e.indexOf(H) == -1)
|
||
return e
|
||
} else
|
||
e = e[0];
|
||
if (M = e.indexOf("%"),
|
||
A = e.indexOf("$"),
|
||
d = M != -1,
|
||
l = A != -1,
|
||
d && (t *= 100),
|
||
l && "\\" === e[A - 1] && (e = e.split("\\").join(""),
|
||
l = !1),
|
||
(l || d) && (n = l ? n.currency : n.percent,
|
||
r = n[z],
|
||
a = n.decimals,
|
||
c = n.symbol),
|
||
C = e.indexOf(we) > -1,
|
||
C && (e = e.replace(xe, U)),
|
||
S = e.indexOf(z),
|
||
x = e.length,
|
||
S != -1)
|
||
if (g = ("" + t).split("e"),
|
||
g = g[1] ? $(t, Math.abs(g[1])) : g[0],
|
||
g = g.split(z)[1] || U,
|
||
T = e.lastIndexOf(H) - S,
|
||
P = e.lastIndexOf(j) - S,
|
||
D = T > -1,
|
||
N = P > -1,
|
||
b = g.length,
|
||
D || N || (e = e.substring(0, S) + e.substring(S + 1),
|
||
x = e.length,
|
||
S = -1,
|
||
b = 0),
|
||
D && T > P)
|
||
b = T;
|
||
else if (P > T)
|
||
if (N && b > P) {
|
||
for (F = $(t, P, h); F.charAt(F.length - 1) === H && P > 0 && P > T; )
|
||
P--,
|
||
F = $(t, P, h);
|
||
b = P
|
||
} else
|
||
D && b < T && (b = T);
|
||
if (t = $(t, b, h),
|
||
P = e.indexOf(j),
|
||
R = T = e.indexOf(H),
|
||
O = P == -1 && T != -1 ? T : P != -1 && T == -1 ? P : P > T ? T : P,
|
||
P = e.lastIndexOf(j),
|
||
T = e.lastIndexOf(H),
|
||
I = P == -1 && T != -1 ? T : P != -1 && T == -1 ? P : P > T ? P : T,
|
||
O == x && (I = O),
|
||
O != -1) {
|
||
for (y = ("" + t).split(z),
|
||
f = y[0],
|
||
g = y[1] || U,
|
||
m = f.length,
|
||
v = g.length,
|
||
h && t * -1 >= 0 && (h = !1),
|
||
t = e.substring(0, O),
|
||
h && !k && (t += "-"),
|
||
b = O; b < x; b++) {
|
||
if (w = e.charAt(b),
|
||
S == -1) {
|
||
if (I - b < m) {
|
||
t += f;
|
||
break
|
||
}
|
||
} else if (T != -1 && T < b && (_ = U),
|
||
S - b <= m && S - b > -1 && (t += f,
|
||
b = S),
|
||
S === b) {
|
||
t += (g ? r : U) + g,
|
||
b += I - S + 1;
|
||
continue
|
||
}
|
||
w === H ? (t += w,
|
||
_ = w) : w === j && (t += _)
|
||
}
|
||
if (C && (t = me(t, O + (h && !k ? 1 : 0), Math.max(I, m + O), n)),
|
||
I >= O && (t += e.substring(I + 1)),
|
||
l || d) {
|
||
for (y = U,
|
||
b = 0,
|
||
x = t.length; b < x; b++)
|
||
w = t.charAt(b),
|
||
y += "$" === w || "%" === w ? c : w;
|
||
t = y
|
||
}
|
||
if (x = o.length)
|
||
for (b = 0; b < x; b++)
|
||
t = t.replace(Ce, o[b])
|
||
}
|
||
return t
|
||
}
|
||
typeof Date.prototype.toJSON !== g && (Date.prototype.toJSON = function() {
|
||
var t = this;
|
||
return isFinite(t.valueOf()) ? c(t.getUTCFullYear(), 4) + "-" + c(t.getUTCMonth() + 1) + "-" + c(t.getUTCDate()) + "T" + c(t.getUTCHours()) + ":" + c(t.getUTCMinutes()) + ":" + c(t.getUTCSeconds()) + "Z" : null
|
||
}
|
||
,
|
||
String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {
|
||
return this.valueOf()
|
||
}
|
||
),
|
||
typeof Vt.stringify !== g && (Vt.stringify = function(t, e, i) {
|
||
var n;
|
||
if (k = "",
|
||
ce = "",
|
||
typeof i === y)
|
||
for (n = 0; n < i; n += 1)
|
||
ce += " ";
|
||
else
|
||
typeof i === _ && (ce = i);
|
||
if (S = e,
|
||
e && typeof e !== g && (typeof e !== b || typeof e.length !== y))
|
||
throw Error("JSON.stringify");
|
||
return oe("", {
|
||
"": t
|
||
})
|
||
}
|
||
);
|
||
var me, $, ve, _e = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|"[^"]*"|'[^']*'/g, ye = /^(n|c|p|e)(\d*)$/i, be = /(\\.)|(['][^']*[']?)|(["][^"]*["]?)/g, xe = /\,/g, U = "", z = ".", we = ",", j = "#", H = "0", Ce = "??", ke = "en-US", Se = {}.toString;
|
||
function R(t, e, i) {
|
||
return !(t >= e && t <= i)
|
||
}
|
||
function Pe(t) {
|
||
return t.charAt(0)
|
||
}
|
||
function Te(t) {
|
||
return m.map(t, Pe)
|
||
}
|
||
function De(t, e) {
|
||
e || 23 !== t.getHours() || t.setHours(t.getHours() + 2)
|
||
}
|
||
function Ne(t) {
|
||
for (var e = 0, i = t.length, n = []; e < i; e++)
|
||
n[e] = (t[e] + "").toLowerCase();
|
||
return n
|
||
}
|
||
function Me(t) {
|
||
var e, i = {};
|
||
for (e in t)
|
||
i[e] = Ne(t[e]);
|
||
return i
|
||
}
|
||
function Ae(l, i, t, e) {
|
||
if (!l)
|
||
return null;
|
||
var n, r, a, s, o, c, d, u, p, h, f, g, m, v = function(t) {
|
||
for (var e = 0; i[N] === t; )
|
||
e++,
|
||
N++;
|
||
return e > 0 && (N -= 1),
|
||
e
|
||
}, _ = function(t) {
|
||
var e = Be[t] || RegExp("^\\d{1," + t + "}")
|
||
, i = l.substr(M, t).match(e);
|
||
return i ? (i = i[0],
|
||
M += i.length,
|
||
parseInt(i, 10)) : null
|
||
}, y = function(t, e) {
|
||
for (var i, n, r, a = 0, s = t.length, o = 0, c = 0; a < s; a++)
|
||
i = t[a],
|
||
n = i.length,
|
||
r = l.substr(M, n),
|
||
e && (r = r.toLowerCase()),
|
||
r == i && n > o && (o = n,
|
||
c = a);
|
||
return o ? (M += o,
|
||
c + 1) : null
|
||
}, b = function() {
|
||
var t = !1;
|
||
return l.charAt(M) === i[N] && (M++,
|
||
t = !0),
|
||
t
|
||
}, x = t.calendars.standard, w = null, C = null, k = null, S = null, P = null, T = null, D = null, N = 0, M = 0, A = !1, O = new Date, I = x.twoDigitYearMax || 2029, E = O.getFullYear();
|
||
for (i || (i = "d"),
|
||
s = x.patterns[i],
|
||
s && (i = s),
|
||
i = i.split(""),
|
||
a = i.length; N < a; N++)
|
||
if (n = i[N],
|
||
A)
|
||
"'" === n ? A = !1 : b();
|
||
else if ("d" === n) {
|
||
if (r = v("d"),
|
||
x._lowerDays || (x._lowerDays = Me(x.days)),
|
||
null !== k && r > 2)
|
||
continue;
|
||
if (k = r < 3 ? _(2) : y(x._lowerDays[3 == r ? "namesAbbr" : "names"], !0),
|
||
null === k || R(k, 1, 31))
|
||
return null
|
||
} else if ("M" === n) {
|
||
if (r = v("M"),
|
||
x._lowerMonths || (x._lowerMonths = Me(x.months)),
|
||
C = r < 3 ? _(2) : y(x._lowerMonths[3 == r ? "namesAbbr" : "names"], !0),
|
||
null === C || R(C, 1, 12))
|
||
return null;
|
||
C -= 1
|
||
} else if ("y" === n) {
|
||
if (r = v("y"),
|
||
w = _(r),
|
||
null === w)
|
||
return null;
|
||
2 == r && ("string" == typeof I && (I = E + parseInt(I, 10)),
|
||
w = E - E % 100 + w,
|
||
w > I && (w -= 100))
|
||
} else if ("h" === n) {
|
||
if (v("h"),
|
||
S = _(2),
|
||
12 == S && (S = 0),
|
||
null === S || R(S, 0, 11))
|
||
return null
|
||
} else if ("H" === n) {
|
||
if (v("H"),
|
||
S = _(2),
|
||
null === S || R(S, 0, 23))
|
||
return null
|
||
} else if ("m" === n) {
|
||
if (v("m"),
|
||
P = _(2),
|
||
null === P || R(P, 0, 59))
|
||
return null
|
||
} else if ("s" === n) {
|
||
if (v("s"),
|
||
T = _(2),
|
||
null === T || R(T, 0, 59))
|
||
return null
|
||
} else if ("f" === n) {
|
||
if (r = v("f"),
|
||
m = l.substr(M, r).match(Be[3]),
|
||
D = _(r),
|
||
null !== D && (D = parseFloat("0." + m[0], 10),
|
||
D = F._round(D, 3),
|
||
D *= 1e3),
|
||
null === D || R(D, 0, 999))
|
||
return null
|
||
} else if ("t" === n) {
|
||
if (r = v("t"),
|
||
u = x.AM,
|
||
p = x.PM,
|
||
1 === r && (u = Te(u),
|
||
p = Te(p)),
|
||
o = y(p),
|
||
!o && !y(u))
|
||
return null
|
||
} else if ("z" === n) {
|
||
if (c = !0,
|
||
r = v("z"),
|
||
"Z" === l.substr(M, 1)) {
|
||
b();
|
||
continue
|
||
}
|
||
if (d = l.substr(M, 6).match(r > 2 ? $e : qe),
|
||
!d)
|
||
return null;
|
||
if (d = d[0].split(":"),
|
||
h = d[0],
|
||
f = d[1],
|
||
!f && h.length > 3 && (M = h.length - 2,
|
||
f = h.substring(M),
|
||
h = h.substring(0, M)),
|
||
h = parseInt(h, 10),
|
||
R(h, -12, 13))
|
||
return null;
|
||
if (r > 2 && (f = d[0][0] + f,
|
||
f = parseInt(f, 10),
|
||
isNaN(f) || R(f, -59, 59)))
|
||
return null
|
||
} else if ("'" === n)
|
||
A = !0,
|
||
b();
|
||
else if (!b())
|
||
return null;
|
||
return e && !/^\s*$/.test(l.substr(M)) ? null : (g = null !== S || null !== P || T || null,
|
||
null === w && null === C && null === k && g ? (w = E,
|
||
C = O.getMonth(),
|
||
k = O.getDate()) : (null === w && (w = E),
|
||
null === k && (k = 1)),
|
||
o && S < 12 && (S += 12),
|
||
c ? (h && (S += -h),
|
||
f && (P += -f),
|
||
l = new Date(Date.UTC(w, C, k, S, P, T, D))) : (l = new Date(w,C,k,S,P,T,D),
|
||
De(l, S)),
|
||
w < 100 && l.setFullYear(w),
|
||
l.getDate() !== k && c === q ? null : l)
|
||
}
|
||
function Oe(t) {
|
||
var e = "-" === t.substr(0, 1) ? -1 : 1;
|
||
return t = t.substring(1),
|
||
t = 60 * parseInt(t.substr(0, 2), 10) + parseInt(t.substring(2), 10),
|
||
e * t
|
||
}
|
||
function Ie(t) {
|
||
var e, i, n, r = h.max(je.length, He.length), a = t.calendar || t.calendars.standard, s = a.patterns, o = [];
|
||
for (n = 0; n < r; n++) {
|
||
for (e = je[n],
|
||
i = 0; i < e.length; i++)
|
||
o.push(s[e[i]]);
|
||
o = o.concat(He[n])
|
||
}
|
||
return o
|
||
}
|
||
function Ee(t, e, i, n) {
|
||
var r, a, s, o;
|
||
if ("[object Date]" === Le.call(t))
|
||
return t;
|
||
if (r = 0,
|
||
a = null,
|
||
t && 0 === t.indexOf("/D") && (a = Ue.exec(t)))
|
||
return a = a[1],
|
||
o = ze.exec(a.substring(1)),
|
||
a = new Date(parseInt(a, 10)),
|
||
o && (o = Oe(o[0]),
|
||
a = F.timezone.apply(a, 0),
|
||
a = F.timezone.convert(a, 0, -1 * o)),
|
||
a;
|
||
for (i = F.getCulture(i),
|
||
e || (e = Ie(i)),
|
||
e = Ht(e) ? e : [e],
|
||
s = e.length; r < s; r++)
|
||
if (a = Ae(t, e[r], i, n))
|
||
return a;
|
||
return a
|
||
}
|
||
F.cultures["en-US"] = {
|
||
name: ke,
|
||
numberFormat: {
|
||
pattern: ["-n"],
|
||
decimals: 2,
|
||
",": ",",
|
||
".": ".",
|
||
groupSize: [3],
|
||
percent: {
|
||
pattern: ["-n %", "n %"],
|
||
decimals: 2,
|
||
",": ",",
|
||
".": ".",
|
||
groupSize: [3],
|
||
symbol: "%"
|
||
},
|
||
currency: {
|
||
name: "US Dollar",
|
||
abbr: "USD",
|
||
pattern: ["($n)", "$n"],
|
||
decimals: 2,
|
||
",": ",",
|
||
".": ".",
|
||
groupSize: [3],
|
||
symbol: "$"
|
||
}
|
||
},
|
||
calendars: {
|
||
standard: {
|
||
days: {
|
||
names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||
namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
||
namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
||
},
|
||
months: {
|
||
names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||
namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
||
},
|
||
AM: ["AM", "am", "AM"],
|
||
PM: ["PM", "pm", "PM"],
|
||
patterns: {
|
||
d: "M/d/yyyy",
|
||
D: "dddd, MMMM dd, yyyy",
|
||
F: "dddd, MMMM dd, yyyy h:mm:ss tt",
|
||
g: "M/d/yyyy h:mm tt",
|
||
G: "M/d/yyyy h:mm:ss tt",
|
||
m: "MMMM dd",
|
||
M: "MMMM dd",
|
||
s: "yyyy'-'MM'-'ddTHH':'mm':'ss",
|
||
t: "h:mm tt",
|
||
T: "h:mm:ss tt",
|
||
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
|
||
y: "MMMM, yyyy",
|
||
Y: "MMMM, yyyy"
|
||
},
|
||
"/": "/",
|
||
":": ":",
|
||
firstDay: 0,
|
||
twoDigitYearMax: 2029
|
||
}
|
||
}
|
||
},
|
||
F.culture = function(t) {
|
||
var e, i = F.cultures;
|
||
return t === q ? i.current : (e = pe(t) || i[ke],
|
||
e.calendar = e.calendars.standard,
|
||
i.current = e,
|
||
q)
|
||
}
|
||
,
|
||
F.findCulture = pe,
|
||
F.getCulture = he,
|
||
F.culture(ke),
|
||
me = function(t, e, i, n) {
|
||
var r, a, s, o, c, l, d = t.indexOf(n[z]), u = n.groupSize.slice(), p = u.shift();
|
||
if (i = d !== -1 ? d : i + 1,
|
||
r = t.substring(e, i),
|
||
a = r.length,
|
||
a >= p) {
|
||
for (s = a,
|
||
o = []; s > -1; )
|
||
if (c = r.substring(s - p, s),
|
||
c && o.push(c),
|
||
s -= p,
|
||
l = u.shift(),
|
||
p = l !== q ? l : p,
|
||
0 === p) {
|
||
s > 0 && o.push(r.substring(0, s));
|
||
break
|
||
}
|
||
r = o.reverse().join(n[we]),
|
||
t = t.substring(0, e) + r + t.substring(i)
|
||
}
|
||
return t
|
||
}
|
||
,
|
||
$ = function(t, e, i) {
|
||
return e = e || 0,
|
||
t = ("" + t).split("e"),
|
||
t = Math.round(+(t[0] + "e" + (t[1] ? +t[1] + e : e))),
|
||
i && (t = -t),
|
||
t = ("" + t).split("e"),
|
||
t = +(t[0] + "e" + (t[1] ? +t[1] - e : -e)),
|
||
t.toFixed(Math.min(e, 20))
|
||
}
|
||
,
|
||
ve = function(t, e, i) {
|
||
if (e) {
|
||
if ("[object Date]" === Se.call(t))
|
||
return fe(t, e, i);
|
||
if (typeof t === y)
|
||
return ge(t, e, i)
|
||
}
|
||
return t !== q ? t : ""
|
||
}
|
||
,
|
||
F.format = function(t) {
|
||
var r = arguments;
|
||
return t.replace(Wt, function(t, e, i) {
|
||
var n = r[parseInt(e, 10) + 1];
|
||
return ve(n, i ? i.substring(1) : "")
|
||
})
|
||
}
|
||
,
|
||
F._extractFormat = function(t) {
|
||
return "{0:" === t.slice(0, 3) && (t = t.slice(3, t.length - 1)),
|
||
t
|
||
}
|
||
,
|
||
F._activeElement = function() {
|
||
try {
|
||
return document.activeElement
|
||
} catch (t) {
|
||
return document.documentElement.activeElement
|
||
}
|
||
}
|
||
,
|
||
F._round = $,
|
||
F._outerWidth = function(t, e) {
|
||
return m(t).outerWidth(e || !1) || 0
|
||
}
|
||
,
|
||
F._outerHeight = function(t, e) {
|
||
return m(t).outerHeight(e || !1) || 0
|
||
}
|
||
,
|
||
F.toString = ve;
|
||
var Fe = /\u00A0/g
|
||
, Re = /[eE][\-+]?[0-9]+/
|
||
, qe = /[+|\-]\d{1,2}/
|
||
, $e = /[+|\-]\d{1,2}:?\d{2}/
|
||
, Ue = /^\/Date\((.*?)\)\/$/
|
||
, ze = /[+-]\d*/
|
||
, je = [[], ["G", "g", "F"], ["D", "d", "y", "m", "T", "t"]]
|
||
, He = [["yyyy-MM-ddTHH:mm:ss.fffffffzzz", "yyyy-MM-ddTHH:mm:ss.fffffff", "yyyy-MM-ddTHH:mm:ss.fffzzz", "yyyy-MM-ddTHH:mm:ss.fff", "ddd MMM dd yyyy HH:mm:ss", "yyyy-MM-ddTHH:mm:sszzz", "yyyy-MM-ddTHH:mmzzz", "yyyy-MM-ddTHH:mmzz", "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ss", "yyyy/MM/dd HH:mm:ss"], ["yyyy-MM-ddTHH:mm", "yyyy-MM-dd HH:mm", "yyyy/MM/dd HH:mm"], ["yyyy/MM/dd", "yyyy-MM-dd", "HH:mm:ss", "HH:mm"]]
|
||
, Be = {
|
||
2: /^\d{1,2}/,
|
||
3: /^\d{1,3}/,
|
||
4: /^\d{4}/
|
||
}
|
||
, Le = {}.toString;
|
||
F.parseDate = function(t, e, i) {
|
||
return Ee(t, e, i, !1)
|
||
}
|
||
,
|
||
F.parseExactDate = function(t, e, i) {
|
||
return Ee(t, e, i, !0)
|
||
}
|
||
,
|
||
F.parseInt = function(t, e) {
|
||
var i = F.parseFloat(t, e);
|
||
return i && (i = 0 | i),
|
||
i
|
||
}
|
||
,
|
||
F.parseFloat = function(t, e, i) {
|
||
if (!t && 0 !== t)
|
||
return null;
|
||
if (typeof t === y)
|
||
return t;
|
||
t = "" + t,
|
||
e = F.getCulture(e);
|
||
var n, r, a = e.numberFormat, s = a.percent, o = a.currency, c = o.symbol, l = s.symbol, d = t.indexOf("-");
|
||
return Re.test(t) ? (t = parseFloat(t.replace(a["."], ".")),
|
||
isNaN(t) && (t = null),
|
||
t) : d > 0 ? null : (d = d > -1,
|
||
t.indexOf(c) > -1 || i && i.toLowerCase().indexOf("c") > -1 ? (a = o,
|
||
n = a.pattern[0].replace("$", c).split("n"),
|
||
t.indexOf(n[0]) > -1 && t.indexOf(n[1]) > -1 && (t = t.replace(n[0], "").replace(n[1], ""),
|
||
d = !0)) : t.indexOf(l) > -1 && (r = !0,
|
||
a = s,
|
||
c = l),
|
||
t = t.replace("-", "").replace(c, "").replace(Fe, " ").split(a[","].replace(Fe, " ")).join("").replace(a["."], "."),
|
||
t = parseFloat(t),
|
||
isNaN(t) ? t = null : d && (t *= -1),
|
||
t && r && (t /= 100),
|
||
t)
|
||
}
|
||
,
|
||
f._scrollbar = q,
|
||
f.scrollbar = function(t) {
|
||
if (isNaN(f._scrollbar) || t) {
|
||
var e, i = document.createElement("div");
|
||
return i.style.cssText = "overflow:scroll;overflow-x:hidden;zoom:1;clear:both;display:block",
|
||
i.innerHTML = " ",
|
||
document.body.appendChild(i),
|
||
f._scrollbar = e = i.offsetWidth - i.scrollWidth,
|
||
document.body.removeChild(i),
|
||
e
|
||
}
|
||
return f._scrollbar
|
||
}
|
||
,
|
||
f.isRtl = function(t) {
|
||
return m(t).closest(".k-rtl").length > 0
|
||
}
|
||
,
|
||
a = document.createElement("table");
|
||
try {
|
||
a.innerHTML = "<tr><td></td></tr>",
|
||
f.tbodyInnerHtml = !0
|
||
} catch (t) {
|
||
f.tbodyInnerHtml = !1
|
||
}
|
||
f.touch = "ontouchstart"in v,
|
||
s = document.documentElement.style,
|
||
o = f.transitions = !1,
|
||
ie = f.transforms = !1,
|
||
x = "HTMLElement"in v ? HTMLElement.prototype : [],
|
||
f.hasHW3D = "WebKitCSSMatrix"in v && "m11"in new v.WebKitCSSMatrix || "MozPerspective"in s || "msPerspective"in s,
|
||
f.cssFlexbox = "flexWrap"in s || "WebkitFlexWrap"in s || "msFlexWrap"in s,
|
||
jt(["Moz", "webkit", "O", "ms"], function() {
|
||
var t, e = "" + this, i = typeof a.style[e + "Transition"] === _;
|
||
if (i || typeof a.style[e + "Transform"] === _)
|
||
return t = e.toLowerCase(),
|
||
ie = {
|
||
css: "ms" != t ? "-" + t + "-" : "",
|
||
prefix: e,
|
||
event: "o" === t || "webkit" === t ? t : ""
|
||
},
|
||
i && (o = ie,
|
||
o.event = o.event ? o.event + "TransitionEnd" : "transitionend"),
|
||
!1
|
||
}),
|
||
a = null,
|
||
f.transforms = ie,
|
||
f.transitions = o,
|
||
f.devicePixelRatio = v.devicePixelRatio === q ? 1 : v.devicePixelRatio;
|
||
try {
|
||
f.screenWidth = v.outerWidth || v.screen ? v.screen.availWidth : v.innerWidth,
|
||
f.screenHeight = v.outerHeight || v.screen ? v.screen.availHeight : v.innerHeight
|
||
} catch (t) {
|
||
f.screenWidth = v.screen.availWidth,
|
||
f.screenHeight = v.screen.availHeight
|
||
}
|
||
f.detectOS = function(t) {
|
||
var e, i, n = !1, r = [], a = !/mobile safari/i.test(t), s = {
|
||
wp: /(Windows Phone(?: OS)?)\s(\d+)\.(\d+(\.\d+)?)/,
|
||
fire: /(Silk)\/(\d+)\.(\d+(\.\d+)?)/,
|
||
android: /(Android|Android.*(?:Opera|Firefox).*?\/)\s*(\d+)\.?(\d+(\.\d+)?)?/,
|
||
iphone: /(iPhone|iPod).*OS\s+(\d+)[\._]([\d\._]+)/,
|
||
ipad: /(iPad).*OS\s+(\d+)[\._]([\d_]+)/,
|
||
meego: /(MeeGo).+NokiaBrowser\/(\d+)\.([\d\._]+)/,
|
||
webos: /(webOS)\/(\d+)\.(\d+(\.\d+)?)/,
|
||
blackberry: /(BlackBerry|BB10).*?Version\/(\d+)\.(\d+(\.\d+)?)/,
|
||
playbook: /(PlayBook).*?Tablet\s*OS\s*(\d+)\.(\d+(\.\d+)?)/,
|
||
windows: /(MSIE)\s+(\d+)\.(\d+(\.\d+)?)/,
|
||
tizen: /(tizen).*?Version\/(\d+)\.(\d+(\.\d+)?)/i,
|
||
sailfish: /(sailfish).*rv:(\d+)\.(\d+(\.\d+)?).*firefox/i,
|
||
ffos: /(Mobile).*rv:(\d+)\.(\d+(\.\d+)?).*Firefox/
|
||
}, o = {
|
||
ios: /^i(phone|pad|pod)$/i,
|
||
android: /^android|fire$/i,
|
||
blackberry: /^blackberry|playbook/i,
|
||
windows: /windows/,
|
||
wp: /wp/,
|
||
flat: /sailfish|ffos|tizen/i,
|
||
meego: /meego/
|
||
}, c = {
|
||
tablet: /playbook|ipad|fire/i
|
||
}, l = {
|
||
omini: /Opera\sMini/i,
|
||
omobile: /Opera\sMobi/i,
|
||
firefox: /Firefox|Fennec/i,
|
||
mobilesafari: /version\/.*safari/i,
|
||
ie: /MSIE|Windows\sPhone/i,
|
||
chrome: /chrome|crios/i,
|
||
webkit: /webkit/i
|
||
};
|
||
for (i in s)
|
||
if (s.hasOwnProperty(i) && (r = t.match(s[i]))) {
|
||
if ("windows" == i && "plugins"in navigator)
|
||
return !1;
|
||
n = {},
|
||
n.device = i,
|
||
n.tablet = E(i, c, !1),
|
||
n.browser = E(t, l, "default"),
|
||
n.name = E(i, o),
|
||
n[n.name] = !0,
|
||
n.majorVersion = r[2],
|
||
n.minorVersion = (r[3] || "0").replace("_", "."),
|
||
e = n.minorVersion.replace(".", "").substr(0, 2),
|
||
n.flatVersion = n.majorVersion + e + Array(3 - (e.length < 3 ? e.length : 2)).join("0"),
|
||
n.cordova = typeof v.PhoneGap !== Kt || typeof v.cordova !== Kt,
|
||
n.appMode = v.navigator.standalone || /file|local|wmapp/.test(v.location.protocol) || n.cordova,
|
||
n.android && (f.devicePixelRatio < 1.5 && n.flatVersion < 400 || a) && (f.screenWidth > 800 || f.screenHeight > 800) && (n.tablet = i);
|
||
break
|
||
}
|
||
return n
|
||
}
|
||
,
|
||
w = f.mobileOS = f.detectOS(navigator.userAgent),
|
||
f.wpDevicePixelRatio = w.wp ? screen.width / 320 : 0,
|
||
f.hasNativeScrolling = !1,
|
||
(w.ios || w.android && w.majorVersion > 2 || w.wp) && (f.hasNativeScrolling = w),
|
||
f.delayedClick = function() {
|
||
if (f.touch) {
|
||
if (w.ios)
|
||
return !0;
|
||
if (w.android)
|
||
return !f.browser.chrome || !(f.browser.version < 32) && !(m("meta[name=viewport]").attr("content") || "").match(/user-scalable=no/i)
|
||
}
|
||
return !1
|
||
}
|
||
,
|
||
f.mouseAndTouchPresent = f.touch && !(f.mobileOS.ios || f.mobileOS.android),
|
||
f.detectBrowser = function(t) {
|
||
var e, i = !1, n = [], r = {
|
||
edge: /(edge)[ \/]([\w.]+)/i,
|
||
webkit: /(chrome|crios)[ \/]([\w.]+)/i,
|
||
safari: /(webkit)[ \/]([\w.]+)/i,
|
||
opera: /(opera)(?:.*version|)[ \/]([\w.]+)/i,
|
||
msie: /(msie\s|trident.*? rv:)([\w.]+)/i,
|
||
mozilla: /(mozilla)(?:.*? rv:([\w.]+)|)/i
|
||
};
|
||
for (e in r)
|
||
if (r.hasOwnProperty(e) && (n = t.match(r[e]))) {
|
||
i = {},
|
||
i[e] = !0,
|
||
i[n[1].toLowerCase().split(" ")[0].split("/")[0]] = !0,
|
||
i.version = parseInt(document.documentMode || n[2], 10);
|
||
break
|
||
}
|
||
return i
|
||
}
|
||
,
|
||
f.browser = f.detectBrowser(navigator.userAgent),
|
||
f.detectClipboardAccess = function() {
|
||
var t = {
|
||
copy: !!document.queryCommandSupported && document.queryCommandSupported("copy"),
|
||
cut: !!document.queryCommandSupported && document.queryCommandSupported("cut"),
|
||
paste: !!document.queryCommandSupported && document.queryCommandSupported("paste")
|
||
};
|
||
return f.browser.chrome && (t.paste = !1,
|
||
f.browser.version >= 43 && (t.copy = !0,
|
||
t.cut = !0)),
|
||
t
|
||
}
|
||
,
|
||
f.clipboard = f.detectClipboardAccess(),
|
||
f.zoomLevel = function() {
|
||
var t, e, i;
|
||
try {
|
||
return t = f.browser,
|
||
e = 0,
|
||
i = document.documentElement,
|
||
t.msie && 11 == t.version && i.scrollHeight > i.clientHeight && !f.touch && (e = f.scrollbar()),
|
||
f.touch ? i.clientWidth / v.innerWidth : t.msie && t.version >= 10 ? ((top || v).document.documentElement.offsetWidth + e) / (top || v).innerWidth : 1
|
||
} catch (t) {
|
||
return 1
|
||
}
|
||
}
|
||
,
|
||
f.cssBorderSpacing = q !== s.borderSpacing && !(f.browser.msie && f.browser.version < 8);
|
||
var P = f.browser
|
||
, T = ""
|
||
, Ve = m(document.documentElement)
|
||
, Ge = parseInt(P.version, 10);
|
||
function We(t, e, i, n) {
|
||
var r, a, s = m("<form>").attr({
|
||
action: i,
|
||
method: "POST",
|
||
target: n
|
||
}), o = F.antiForgeryTokens();
|
||
o.fileName = e,
|
||
r = t.split(";base64,"),
|
||
o.contentType = r[0].replace("data:", ""),
|
||
o.base64 = r[1];
|
||
for (a in o)
|
||
o.hasOwnProperty(a) && m("<input>").attr({
|
||
value: o[a],
|
||
name: a,
|
||
type: "hidden"
|
||
}).appendTo(s);
|
||
s.appendTo("body").submit().remove()
|
||
}
|
||
function Qe(t, e) {
|
||
var i, n, r, a, s, o = t;
|
||
if ("string" == typeof t) {
|
||
for (i = t.split(";base64,"),
|
||
n = i[0],
|
||
r = atob(i[1]),
|
||
a = new Uint8Array(r.length),
|
||
s = 0; s < r.length; s++)
|
||
a[s] = r.charCodeAt(s);
|
||
o = new Blob([a.buffer],{
|
||
type: n
|
||
})
|
||
}
|
||
navigator.msSaveBlob(o, e)
|
||
}
|
||
function Je(t, e) {
|
||
v.Blob && t instanceof Blob && (t = URL.createObjectURL(t)),
|
||
Ye.download = e,
|
||
Ye.href = t;
|
||
var i = document.createEvent("MouseEvents");
|
||
i.initMouseEvent("click", !0, !1, v, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null),
|
||
Ye.dispatchEvent(i),
|
||
setTimeout(function() {
|
||
URL.revokeObjectURL(t)
|
||
})
|
||
}
|
||
P.msie ? T = "ie" : P.mozilla ? T = "ff" : P.safari ? T = "safari" : P.webkit ? T = "webkit" : P.opera ? T = "opera" : P.edge && (T = "edge"),
|
||
T && (T = "k-" + T + " k-" + T + Ge),
|
||
f.mobileOS && (T += " k-mobile"),
|
||
f.cssFlexbox || (T += " k-no-flexbox"),
|
||
Ve.addClass(T),
|
||
f.eventCapture = document.documentElement.addEventListener,
|
||
C = document.createElement("input"),
|
||
f.placeholder = "placeholder"in C,
|
||
f.propertyChangeEvent = "onpropertychange"in C,
|
||
f.input = function() {
|
||
for (var t, e = ["number", "date", "time", "month", "week", "datetime", "datetime-local"], i = e.length, n = "test", r = {}, a = 0; a < i; a++)
|
||
t = e[a],
|
||
C.setAttribute("type", t),
|
||
C.value = n,
|
||
r[t.replace("-", "")] = "text" !== C.type && C.value !== n;
|
||
return r
|
||
}(),
|
||
C.style.cssText = "float:left;",
|
||
f.cssFloat = !!C.style.cssFloat,
|
||
C = null,
|
||
f.stableSort = function() {
|
||
var t, e = 513, i = [{
|
||
index: 0,
|
||
field: "b"
|
||
}];
|
||
for (t = 1; t < e; t++)
|
||
i.push({
|
||
index: t,
|
||
field: "a"
|
||
});
|
||
return i.sort(function(t, e) {
|
||
return t.field > e.field ? 1 : t.field < e.field ? -1 : 0
|
||
}),
|
||
1 === i[0].index
|
||
}(),
|
||
f.matchesSelector = x.webkitMatchesSelector || x.mozMatchesSelector || x.msMatchesSelector || x.oMatchesSelector || x.matchesSelector || x.matches || function(t) {
|
||
for (var e = document.querySelectorAll ? (this.parentNode || document).querySelectorAll(t) || [] : m(t), i = e.length; i--; )
|
||
if (e[i] == this)
|
||
return !0;
|
||
return !1
|
||
}
|
||
,
|
||
f.matchMedia = "matchMedia"in v,
|
||
f.pushState = v.history && v.history.pushState,
|
||
ne = document.documentMode,
|
||
f.hashChange = "onhashchange"in v && !(f.browser.msie && (!ne || ne <= 8)),
|
||
f.customElements = "registerElement"in v.document,
|
||
re = f.browser.chrome,
|
||
ae = f.browser.mozilla,
|
||
f.msPointers = !re && v.MSPointerEvent,
|
||
f.pointers = !re && !ae && v.PointerEvent,
|
||
f.kineticScrollNeeded = w && (f.touch || f.msPointers || f.pointers),
|
||
_t = {
|
||
left: {
|
||
reverse: "right"
|
||
},
|
||
right: {
|
||
reverse: "left"
|
||
},
|
||
down: {
|
||
reverse: "up"
|
||
},
|
||
up: {
|
||
reverse: "down"
|
||
},
|
||
top: {
|
||
reverse: "bottom"
|
||
},
|
||
bottom: {
|
||
reverse: "top"
|
||
},
|
||
in: {
|
||
reverse: "out"
|
||
},
|
||
out: {
|
||
reverse: "in"
|
||
}
|
||
},
|
||
l = {},
|
||
m.extend(l, {
|
||
enabled: !0,
|
||
Element: function(t) {
|
||
this.element = m(t)
|
||
},
|
||
promise: function(t, e) {
|
||
t.is(":visible") || t.css({
|
||
display: t.data("olddisplay") || "block"
|
||
}).css("display"),
|
||
e.hide && t.data("olddisplay", t.css("display")).hide(),
|
||
e.init && e.init(),
|
||
e.completeCallback && e.completeCallback(t),
|
||
t.dequeue()
|
||
},
|
||
disable: function() {
|
||
this.enabled = !1,
|
||
this.promise = this.promiseShim
|
||
},
|
||
enable: function() {
|
||
this.enabled = !0,
|
||
this.promise = this.animatedPromise
|
||
}
|
||
}),
|
||
l.promiseShim = l.promise,
|
||
"kendoAnimate"in m.fn || p(m.fn, {
|
||
kendoStop: function(t, e) {
|
||
return this.stop(t, e)
|
||
},
|
||
kendoAnimate: function(t, e, i, n) {
|
||
return X(this, t, e, i, n)
|
||
},
|
||
kendoAddClass: function(t, e) {
|
||
return F.toggleClass(this, t, e, !0)
|
||
},
|
||
kendoRemoveClass: function(t, e) {
|
||
return F.toggleClass(this, t, e, !1)
|
||
},
|
||
kendoToggleClass: function(t, e, i) {
|
||
return F.toggleClass(this, t, e, i)
|
||
}
|
||
}),
|
||
yt = /&/g,
|
||
bt = /</g,
|
||
xt = /"/g,
|
||
wt = /'/g,
|
||
Ct = />/g,
|
||
kt = function(t) {
|
||
return t.target
|
||
}
|
||
,
|
||
f.touch && (kt = function(t) {
|
||
var e = "originalEvent"in t ? t.originalEvent.changedTouches : "changedTouches"in t ? t.changedTouches : null;
|
||
return e ? document.elementFromPoint(e[0].clientX, e[0].clientY) : t.target
|
||
}
|
||
,
|
||
jt(["swipe", "swipeLeft", "swipeRight", "swipeUp", "swipeDown", "doubleTap", "tap"], function(t, e) {
|
||
m.fn[e] = function(t) {
|
||
return this.bind(e, t)
|
||
}
|
||
})),
|
||
f.touch ? f.mobileOS ? (f.mousedown = "touchstart",
|
||
f.mouseup = "touchend",
|
||
f.mousemove = "touchmove",
|
||
f.mousecancel = "touchcancel",
|
||
f.click = "touchend",
|
||
f.resize = "orientationchange") : (f.mousedown = "mousedown touchstart",
|
||
f.mouseup = "mouseup touchend",
|
||
f.mousemove = "mousemove touchmove",
|
||
f.mousecancel = "mouseleave touchcancel",
|
||
f.click = "click",
|
||
f.resize = "resize") : f.pointers ? (f.mousemove = "pointermove",
|
||
f.mousedown = "pointerdown",
|
||
f.mouseup = "pointerup",
|
||
f.mousecancel = "pointercancel",
|
||
f.click = "pointerup",
|
||
f.resize = "orientationchange resize") : f.msPointers ? (f.mousemove = "MSPointerMove",
|
||
f.mousedown = "MSPointerDown",
|
||
f.mouseup = "MSPointerUp",
|
||
f.mousecancel = "MSPointerCancel",
|
||
f.click = "MSPointerUp",
|
||
f.resize = "orientationchange resize") : (f.mousemove = "mousemove",
|
||
f.mousedown = "mousedown",
|
||
f.mouseup = "mouseup",
|
||
f.mousecancel = "mouseleave",
|
||
f.click = "click",
|
||
f.resize = "resize"),
|
||
St = function(t, e) {
|
||
var i, n, r, a, s = e || "d", o = 1;
|
||
for (n = 0,
|
||
r = t.length; n < r; n++)
|
||
a = t[n],
|
||
"" !== a && (i = a.indexOf("["),
|
||
0 !== i && (i == -1 ? a = "." + a : (o++,
|
||
a = "." + a.substring(0, i) + " || {})" + a.substring(i))),
|
||
o++,
|
||
s += a + (n < r - 1 ? " || {})" : ")"));
|
||
return Array(o).join("(") + s
|
||
}
|
||
,
|
||
Pt = /^([a-z]+:)?\/\//i,
|
||
p(F, {
|
||
widgets: [],
|
||
_widgetRegisteredCallbacks: [],
|
||
ui: F.ui || {},
|
||
fx: F.fx || Z,
|
||
effects: F.effects || l,
|
||
mobile: F.mobile || {},
|
||
data: F.data || {},
|
||
dataviz: F.dataviz || {},
|
||
drawing: F.drawing || {},
|
||
spreadsheet: {
|
||
messages: {}
|
||
},
|
||
keys: {
|
||
INSERT: 45,
|
||
DELETE: 46,
|
||
BACKSPACE: 8,
|
||
TAB: 9,
|
||
ENTER: 13,
|
||
ESC: 27,
|
||
LEFT: 37,
|
||
UP: 38,
|
||
RIGHT: 39,
|
||
DOWN: 40,
|
||
END: 35,
|
||
HOME: 36,
|
||
SPACEBAR: 32,
|
||
PAGEUP: 33,
|
||
PAGEDOWN: 34,
|
||
F2: 113,
|
||
F10: 121,
|
||
F12: 123,
|
||
NUMPAD_PLUS: 107,
|
||
NUMPAD_MINUS: 109,
|
||
NUMPAD_DOT: 110
|
||
},
|
||
support: F.support || f,
|
||
animate: F.animate || X,
|
||
ns: "",
|
||
attr: function(t) {
|
||
return "data-" + F.ns + t
|
||
},
|
||
getShadows: M,
|
||
wrap: A,
|
||
deepExtend: O,
|
||
getComputedStyles: V,
|
||
isScrollable: G,
|
||
scrollLeft: W,
|
||
size: Q,
|
||
toCamelCase: L,
|
||
toHyphens: B,
|
||
getOffset: F.getOffset || J,
|
||
parseEffects: F.parseEffects || Y,
|
||
toggleClass: F.toggleClass || tt,
|
||
directions: F.directions || _t,
|
||
Observable: dt,
|
||
Class: D,
|
||
Template: t,
|
||
template: Bt(t.compile, t),
|
||
render: Bt(t.render, t),
|
||
stringify: Bt(Vt.stringify, Vt),
|
||
eventTarget: kt,
|
||
htmlEncode: et,
|
||
isLocalUrl: function(t) {
|
||
return t && !Pt.test(t)
|
||
},
|
||
expr: function(t, e, i) {
|
||
return t = t || "",
|
||
typeof e == _ && (i = e,
|
||
e = !1),
|
||
i = i || "d",
|
||
t && "[" !== t.charAt(0) && (t = "." + t),
|
||
e ? (t = t.replace(/"([^.]*)\.([^"]*)"/g, '"$1_$DOT$_$2"'),
|
||
t = t.replace(/'([^.]*)\.([^']*)'/g, "'$1_$DOT$_$2'"),
|
||
t = St(t.split("."), i),
|
||
t = t.replace(/_\$DOT\$_/g, ".")) : t = i + t,
|
||
t
|
||
},
|
||
getter: function(t, e) {
|
||
var i = t + e;
|
||
return Xt[i] = Xt[i] || Function("d", "return " + F.expr(t, e))
|
||
},
|
||
setter: function(t) {
|
||
return te[t] = te[t] || Function("d,value", F.expr(t) + "=value")
|
||
},
|
||
accessor: function(t) {
|
||
return {
|
||
get: F.getter(t),
|
||
set: F.setter(t)
|
||
}
|
||
},
|
||
guid: function() {
|
||
var t, e, i = "";
|
||
for (t = 0; t < 32; t++)
|
||
e = 16 * h.random() | 0,
|
||
8 != t && 12 != t && 16 != t && 20 != t || (i += "-"),
|
||
i += (12 == t ? 4 : 16 == t ? 3 & e | 8 : e).toString(16);
|
||
return i
|
||
},
|
||
roleSelector: function(t) {
|
||
return t.replace(/(\S+)/g, "[" + F.attr("role") + "=$1],").slice(0, -1)
|
||
},
|
||
directiveSelector: function(t) {
|
||
var e, i = t.split(" ");
|
||
if (i)
|
||
for (e = 0; e < i.length; e++)
|
||
"view" != i[e] && (i[e] = i[e].replace(/(\w*)(view|bar|strip|over)$/, "$1-$2"));
|
||
return i.join(" ").replace(/(\S+)/g, "kendo-mobile-$1,").slice(0, -1)
|
||
},
|
||
triggeredByInput: function(t) {
|
||
return /^(label|input|textarea|select)$/i.test(t.target.tagName)
|
||
},
|
||
onWidgetRegistered: function(t) {
|
||
for (var e = 0, i = F.widgets.length; e < i; e++)
|
||
t(F.widgets[e]);
|
||
F._widgetRegisteredCallbacks.push(t)
|
||
},
|
||
logToConsole: function(t, e) {
|
||
var i = v.console;
|
||
!F.suppressLog && q !== i && i.log && i[e || "log"](t)
|
||
}
|
||
}),
|
||
n = dt.extend({
|
||
init: function(t, e) {
|
||
var i, n = this;
|
||
n.element = F.jQuery(t).handler(n),
|
||
n.angular("init", e),
|
||
dt.fn.init.call(n),
|
||
i = e ? e.dataSource : null,
|
||
i && (e = p({}, e, {
|
||
dataSource: {}
|
||
})),
|
||
e = n.options = p(!0, {}, n.options, e),
|
||
i && (e.dataSource = i),
|
||
n.element.attr(F.attr("role")) || n.element.attr(F.attr("role"), (e.name || "").toLowerCase()),
|
||
n.element.data("kendo" + e.prefix + e.name, n),
|
||
n.bind(n.events, e)
|
||
},
|
||
events: [],
|
||
options: {
|
||
prefix: ""
|
||
},
|
||
_hasBindingTarget: function() {
|
||
return !!this.element[0].kendoBindingTarget
|
||
},
|
||
_tabindex: function(t) {
|
||
t = t || this.wrapper;
|
||
var e = this.element
|
||
, i = "tabindex"
|
||
, n = t.attr(i) || e.attr(i);
|
||
e.removeAttr(i),
|
||
t.attr(i, isNaN(n) ? 0 : n)
|
||
},
|
||
setOptions: function(t) {
|
||
this._setEvents(t),
|
||
m.extend(this.options, t)
|
||
},
|
||
_setEvents: function(t) {
|
||
for (var e, i = this, n = 0, r = i.events.length; n < r; n++)
|
||
e = i.events[n],
|
||
i.options[e] && t[e] && i.unbind(e, i.options[e]);
|
||
i.bind(i.events, t)
|
||
},
|
||
resize: function(t) {
|
||
var e = this.getSize()
|
||
, i = this._size;
|
||
(t || (e.width > 0 || e.height > 0) && (!i || e.width !== i.width || e.height !== i.height)) && (this._size = e,
|
||
this._resize(e, t),
|
||
this.trigger("resize", e))
|
||
},
|
||
getSize: function() {
|
||
return F.dimensions(this.element)
|
||
},
|
||
size: function(t) {
|
||
return t ? (this.setSize(t),
|
||
q) : this.getSize()
|
||
},
|
||
setSize: m.noop,
|
||
_resize: m.noop,
|
||
destroy: function() {
|
||
var t = this;
|
||
t.element.removeData("kendo" + t.options.prefix + t.options.name),
|
||
t.element.removeData("handler"),
|
||
t.unbind()
|
||
},
|
||
_destroy: function() {
|
||
this.destroy()
|
||
},
|
||
angular: function() {},
|
||
_muteAngularRebind: function(t) {
|
||
this._muteRebind = !0,
|
||
t.call(this),
|
||
this._muteRebind = !1
|
||
}
|
||
}),
|
||
Tt = n.extend({
|
||
dataItems: function() {
|
||
return this.dataSource.flatView()
|
||
},
|
||
_angularItems: function(t) {
|
||
var e = this;
|
||
e.angular(t, function() {
|
||
return {
|
||
elements: e.items(),
|
||
data: m.map(e.dataItems(), function(t) {
|
||
return {
|
||
dataItem: t
|
||
}
|
||
})
|
||
}
|
||
})
|
||
}
|
||
}),
|
||
F.dimensions = function(t, e) {
|
||
var i = t[0];
|
||
return e && t.css(e),
|
||
{
|
||
width: i.offsetWidth,
|
||
height: i.offsetHeight
|
||
}
|
||
}
|
||
,
|
||
F.notify = Lt,
|
||
Dt = /template$/i,
|
||
Nt = /^\s*(?:\{(?:.|\r\n|\n)*\}|\[(?:.|\r\n|\n)*\])\s*$/,
|
||
Mt = /^\{(\d+)(:[^\}]+)?\}|^\[[A-Za-z_]+\]$/,
|
||
At = /([A-Z])/g,
|
||
F.initWidget = function(t, e, i) {
|
||
var n, r, a, s, o, c, l, d, u, p, h, f, g;
|
||
if (i ? i.roles && (i = i.roles) : i = F.ui.roles,
|
||
t = t.nodeType ? t : t[0],
|
||
c = t.getAttribute("data-" + F.ns + "role")) {
|
||
u = c.indexOf(".") === -1,
|
||
a = u ? i[c] : F.getter(c)(v),
|
||
h = m(t).data(),
|
||
f = a ? "kendo" + a.fn.options.prefix + a.fn.options.name : "",
|
||
p = u ? RegExp("^kendo.*" + c + "$", "i") : RegExp("^" + f + "$", "i");
|
||
for (g in h)
|
||
if (g.match(p)) {
|
||
if (g !== f)
|
||
return h[g];
|
||
n = h[g]
|
||
}
|
||
if (a) {
|
||
for (d = it(t, "dataSource"),
|
||
e = m.extend({}, nt(t, a.fn.options), e),
|
||
d && (e.dataSource = typeof d === _ ? F.getter(d)(v) : d),
|
||
s = 0,
|
||
o = a.fn.events.length; s < o; s++)
|
||
r = a.fn.events[s],
|
||
l = it(t, r),
|
||
l !== q && (e[r] = F.getter(l)(v));
|
||
return n ? m.isEmptyObject(e) || n.setOptions(e) : n = new a(t,e),
|
||
n
|
||
}
|
||
}
|
||
}
|
||
,
|
||
F.rolesFromNamespaces = function(t) {
|
||
var e, i, n = [];
|
||
for (t[0] || (t = [F.ui, F.dataviz.ui]),
|
||
e = 0,
|
||
i = t.length; e < i; e++)
|
||
n[e] = t[e].roles;
|
||
return p.apply(null, [{}].concat(n.reverse()))
|
||
}
|
||
,
|
||
F.init = function(t) {
|
||
var e = F.rolesFromNamespaces(ee.call(arguments, 1));
|
||
m(t).find("[data-" + F.ns + "role]").addBack().each(function() {
|
||
F.initWidget(this, {}, e)
|
||
})
|
||
}
|
||
,
|
||
F.destroy = function(t) {
|
||
m(t).find("[data-" + F.ns + "role]").addBack().each(function() {
|
||
var t, e = m(this).data();
|
||
for (t in e)
|
||
0 === t.indexOf("kendo") && typeof e[t].destroy === g && e[t].destroy()
|
||
})
|
||
}
|
||
,
|
||
F.resize = function(t, e) {
|
||
var i, n = m(t).find("[data-" + F.ns + "role]").addBack().filter(at);
|
||
n.length && (i = m.makeArray(n),
|
||
i.sort(rt),
|
||
m.each(i, function() {
|
||
var t = F.widgetInstance(m(this));
|
||
t && t.resize(e)
|
||
}))
|
||
}
|
||
,
|
||
F.parseOptions = nt,
|
||
p(F.ui, {
|
||
Widget: n,
|
||
DataBoundWidget: Tt,
|
||
roles: {},
|
||
progress: function(t, e, i) {
|
||
var n, r, a, s, o, c = t.find(".k-loading-mask"), l = F.support, d = l.browser;
|
||
i = m.extend({}, {
|
||
width: "100%",
|
||
height: "100%",
|
||
top: t.scrollTop(),
|
||
opacity: !1
|
||
}, i),
|
||
o = i.opacity ? "k-loading-mask k-opaque" : "k-loading-mask",
|
||
e ? c.length || (n = l.isRtl(t),
|
||
r = n ? "right" : "left",
|
||
s = t.scrollLeft(),
|
||
a = d.webkit && n ? t[0].scrollWidth - t.width() - 2 * s : 0,
|
||
c = m(F.format("<div class='{0}'><span class='k-loading-text'>{1}</span><div class='k-loading-image'/><div class='k-loading-color'/></div>", o, F.ui.progress.messages.loading)).width(i.width).height(i.height).css("top", i.top).css(r, Math.abs(s) + a).prependTo(t)) : c && c.remove()
|
||
},
|
||
plugin: function(t, e, i) {
|
||
var n, r, a, s, o = t.fn.options.name;
|
||
for (e = e || F.ui,
|
||
i = i || "",
|
||
e[o] = t,
|
||
e.roles[o.toLowerCase()] = t,
|
||
n = "getKendo" + i + o,
|
||
o = "kendo" + i + o,
|
||
r = {
|
||
name: o,
|
||
widget: t,
|
||
prefix: i || ""
|
||
},
|
||
F.widgets.push(r),
|
||
a = 0,
|
||
s = F._widgetRegisteredCallbacks.length; a < s; a++)
|
||
F._widgetRegisteredCallbacks[a](r);
|
||
m.fn[o] = function(n) {
|
||
var r, a = this;
|
||
return typeof n === _ ? (r = ee.call(arguments, 1),
|
||
this.each(function() {
|
||
var t, e, i = m.data(this, o);
|
||
if (!i)
|
||
throw Error(F.format("Cannot call method '{0}' of {1} before it is initialized", n, o));
|
||
if (t = i[n],
|
||
typeof t !== g)
|
||
throw Error(F.format("Cannot find method '{0}' of {1}", n, o));
|
||
if (e = t.apply(i, r),
|
||
e !== q)
|
||
return a = e,
|
||
!1
|
||
})) : this.each(function() {
|
||
return new t(this,n)
|
||
}),
|
||
a
|
||
}
|
||
,
|
||
m.fn[o].widget = t,
|
||
m.fn[n] = function() {
|
||
return this.data(o)
|
||
}
|
||
}
|
||
}),
|
||
F.ui.progress.messages = {
|
||
loading: "Loading..."
|
||
},
|
||
Ot = {
|
||
bind: function() {
|
||
return this
|
||
},
|
||
nullObject: !0,
|
||
options: {}
|
||
},
|
||
It = n.extend({
|
||
init: function(t, e) {
|
||
n.fn.init.call(this, t, e),
|
||
this.element.autoApplyNS(),
|
||
this.wrapper = this.element,
|
||
this.element.addClass("km-widget")
|
||
},
|
||
destroy: function() {
|
||
n.fn.destroy.call(this),
|
||
this.element.kendoDestroy()
|
||
},
|
||
options: {
|
||
prefix: "Mobile"
|
||
},
|
||
events: [],
|
||
view: function() {
|
||
var t = this.element.closest(F.roleSelector("view splitview modalview drawer"));
|
||
return F.widgetInstance(t, F.mobile.ui) || Ot
|
||
},
|
||
viewHasNativeScrolling: function() {
|
||
var t = this.view();
|
||
return t && t.options.useNativeScrolling
|
||
},
|
||
container: function() {
|
||
var t = this.element.closest(F.roleSelector("view layout modalview drawer splitview"));
|
||
return F.widgetInstance(t.eq(0), F.mobile.ui) || Ot
|
||
}
|
||
}),
|
||
p(F.mobile, {
|
||
init: function(t) {
|
||
F.init(t, F.mobile.ui, F.ui, F.dataviz.ui)
|
||
},
|
||
appLevelNativeScrolling: function() {
|
||
return F.mobile.application && F.mobile.application.options && F.mobile.application.options.useNativeScrolling
|
||
},
|
||
roles: {},
|
||
ui: {
|
||
Widget: It,
|
||
DataBoundWidget: Tt.extend(It.prototype),
|
||
roles: {},
|
||
plugin: function(t) {
|
||
F.ui.plugin(t, F.mobile.ui, "Mobile")
|
||
}
|
||
}
|
||
}),
|
||
O(F.dataviz, {
|
||
init: function(t) {
|
||
F.init(t, F.dataviz.ui)
|
||
},
|
||
ui: {
|
||
roles: {},
|
||
themes: {},
|
||
views: [],
|
||
plugin: function(t) {
|
||
F.ui.plugin(t, F.dataviz.ui)
|
||
}
|
||
},
|
||
roles: {}
|
||
}),
|
||
F.touchScroller = function(t, i) {
|
||
return i || (i = {}),
|
||
i.useNative = !0,
|
||
m(t).map(function(t, e) {
|
||
return e = m(e),
|
||
!(!f.kineticScrollNeeded || !F.mobile.ui.Scroller || e.data("kendoMobileScroller")) && (e.kendoMobileScroller(i),
|
||
e.data("kendoMobileScroller"))
|
||
})[0]
|
||
}
|
||
,
|
||
F.preventDefault = function(t) {
|
||
t.preventDefault()
|
||
}
|
||
,
|
||
F.widgetInstance = function(t, e) {
|
||
var i, n, r, a, s, o = t.data(F.ns + "role"), c = [];
|
||
if (o) {
|
||
if ("content" === o && (o = "scroller"),
|
||
"editortoolbar" === o && (r = t.data("kendoEditorToolbar")))
|
||
return r;
|
||
if (e)
|
||
if (e[0])
|
||
for (i = 0,
|
||
n = e.length; i < n; i++)
|
||
c.push(e[i].roles[o]);
|
||
else
|
||
c.push(e.roles[o]);
|
||
else
|
||
c = [F.ui.roles[o], F.dataviz.ui.roles[o], F.mobile.ui.roles[o]];
|
||
for (o.indexOf(".") >= 0 && (c = [F.getter(o)(v)]),
|
||
i = 0,
|
||
n = c.length; i < n; i++)
|
||
if (a = c[i],
|
||
a && (s = t.data("kendo" + a.fn.options.prefix + a.fn.options.name)))
|
||
return s
|
||
}
|
||
}
|
||
,
|
||
F.onResize = function(t) {
|
||
var e = t;
|
||
return f.mobileOS.android && (e = function() {
|
||
setTimeout(t, 600)
|
||
}
|
||
),
|
||
m(v).on(f.resize, e),
|
||
e
|
||
}
|
||
,
|
||
F.unbindResize = function(t) {
|
||
m(v).off(f.resize, t)
|
||
}
|
||
,
|
||
F.attrValue = function(t, e) {
|
||
return t.data(F.ns + e)
|
||
}
|
||
,
|
||
F.days = {
|
||
Sunday: 0,
|
||
Monday: 1,
|
||
Tuesday: 2,
|
||
Wednesday: 3,
|
||
Thursday: 4,
|
||
Friday: 5,
|
||
Saturday: 6
|
||
},
|
||
m.extend(m.expr[":"], {
|
||
kendoFocusable: function(t) {
|
||
var e = m.attr(t, "tabindex");
|
||
return st(t, !isNaN(e) && e > -1)
|
||
}
|
||
}),
|
||
Et = ["mousedown", "mousemove", "mouseenter", "mouseleave", "mouseover", "mouseout", "mouseup", "click"],
|
||
Ft = "label, input, [data-rel=external]",
|
||
d = {
|
||
setupMouseMute: function() {
|
||
var t, e = 0, i = Et.length, n = document.documentElement;
|
||
if (!d.mouseTrap && f.eventCapture)
|
||
for (d.mouseTrap = !0,
|
||
d.bustClick = !1,
|
||
d.captureMouse = !1,
|
||
t = function(t) {
|
||
d.captureMouse && ("click" === t.type ? d.bustClick && !m(t.target).is(Ft) && (t.preventDefault(),
|
||
t.stopPropagation()) : t.stopPropagation())
|
||
}
|
||
; e < i; e++)
|
||
n.addEventListener(Et[e], t, !0)
|
||
},
|
||
muteMouse: function(t) {
|
||
d.captureMouse = !0,
|
||
t.data.bustClick && (d.bustClick = !0),
|
||
clearTimeout(d.mouseTrapTimeoutID)
|
||
},
|
||
unMuteMouse: function() {
|
||
clearTimeout(d.mouseTrapTimeoutID),
|
||
d.mouseTrapTimeoutID = setTimeout(function() {
|
||
d.captureMouse = !1,
|
||
d.bustClick = !1
|
||
}, 400)
|
||
}
|
||
},
|
||
e = {
|
||
down: "touchstart mousedown",
|
||
move: "mousemove touchmove",
|
||
up: "mouseup touchend touchcancel",
|
||
cancel: "mouseleave touchcancel"
|
||
},
|
||
f.touch && (f.mobileOS.ios || f.mobileOS.android) ? e = {
|
||
down: "touchstart",
|
||
move: "touchmove",
|
||
up: "touchend touchcancel",
|
||
cancel: "touchcancel"
|
||
} : f.pointers ? e = {
|
||
down: "pointerdown",
|
||
move: "pointermove",
|
||
up: "pointerup",
|
||
cancel: "pointercancel pointerleave"
|
||
} : f.msPointers && (e = {
|
||
down: "MSPointerDown",
|
||
move: "MSPointerMove",
|
||
up: "MSPointerUp",
|
||
cancel: "MSPointerCancel MSPointerLeave"
|
||
}),
|
||
!f.msPointers || "onmspointerenter"in v || m.each({
|
||
MSPointerEnter: "MSPointerOver",
|
||
MSPointerLeave: "MSPointerOut"
|
||
}, function(t, a) {
|
||
m.event.special[t] = {
|
||
delegateType: a,
|
||
bindType: a,
|
||
handle: function(t) {
|
||
var e, i = this, n = t.relatedTarget, r = t.handleObj;
|
||
return n && (n === i || m.contains(i, n)) || (t.type = r.origType,
|
||
e = r.handler.apply(this, arguments),
|
||
t.type = a),
|
||
e
|
||
}
|
||
}
|
||
}),
|
||
Rt = function(t) {
|
||
return e[t] || t
|
||
}
|
||
,
|
||
qt = /([^ ]+)/g,
|
||
F.applyEventMap = function(t, e) {
|
||
return t = t.replace(qt, Rt),
|
||
e && (t = t.replace(qt, "$1." + e)),
|
||
t
|
||
}
|
||
,
|
||
$t = m.fn.on,
|
||
p(!0, i, m),
|
||
((i.fn = i.prototype = new m).constructor = i).fn.init = function(t, e) {
|
||
return e && e instanceof m && !(e instanceof i) && (e = i(e)),
|
||
m.fn.init.call(this, t, e, Ut)
|
||
}
|
||
,
|
||
i.fn.init.prototype = i.fn,
|
||
Ut = i(document),
|
||
p(i.fn, {
|
||
handler: function(t) {
|
||
return this.data("handler", t),
|
||
this
|
||
},
|
||
autoApplyNS: function(t) {
|
||
return this.data("kendoNS", t || F.guid()),
|
||
this
|
||
},
|
||
on: function() {
|
||
var e, t, i, n, r, a, s = this, o = s.data("kendoNS");
|
||
return 1 === arguments.length ? $t.call(s, arguments[0]) : (e = s,
|
||
t = ee.call(arguments),
|
||
typeof t[t.length - 1] === Kt && t.pop(),
|
||
i = t[t.length - 1],
|
||
n = F.applyEventMap(t[0], o),
|
||
f.mouseAndTouchPresent && n.search(/mouse|click/) > -1 && this[0] !== document.documentElement && (d.setupMouseMute(),
|
||
r = 2 === t.length ? null : t[1],
|
||
a = n.indexOf("click") > -1 && n.indexOf("touchend") > -1,
|
||
$t.call(this, {
|
||
touchstart: d.muteMouse,
|
||
touchend: d.unMuteMouse
|
||
}, r, {
|
||
bustClick: a
|
||
})),
|
||
typeof i === _ && (e = s.data("handler"),
|
||
i = e[i],
|
||
t[t.length - 1] = function(t) {
|
||
i.call(e, t)
|
||
}
|
||
),
|
||
t[0] = n,
|
||
$t.apply(s, t),
|
||
s)
|
||
},
|
||
kendoDestroy: function(t) {
|
||
return t = t || this.data("kendoNS"),
|
||
t && this.off("." + t),
|
||
this
|
||
}
|
||
}),
|
||
F.jQuery = i,
|
||
F.eventMap = e,
|
||
F.timezone = function() {
|
||
function o(t, e) {
|
||
var i, n, r, a = e[3], s = e[4], o = e[5], c = e[8];
|
||
return c || (e[8] = c = {}),
|
||
c[t] ? c[t] : (isNaN(s) ? 0 === s.indexOf("last") ? (i = new Date(Date.UTC(t, d[a] + 1, 1, o[0] - 24, o[1], o[2], 0)),
|
||
n = u[s.substr(4, 3)],
|
||
r = i.getUTCDay(),
|
||
i.setUTCDate(i.getUTCDate() + n - r - (n > r ? 7 : 0))) : s.indexOf(">=") >= 0 && (i = new Date(Date.UTC(t, d[a], s.substr(5), o[0], o[1], o[2], 0)),
|
||
n = u[s.substr(0, 3)],
|
||
r = i.getUTCDay(),
|
||
i.setUTCDate(i.getUTCDate() + n - r + (n < r ? 7 : 0))) : i = new Date(Date.UTC(t, d[a], s, o[0], o[1], o[2], 0)),
|
||
c[t] = i)
|
||
}
|
||
function a(t, e, i) {
|
||
var n, r, a, s;
|
||
return (e = e[i]) ? (a = new Date(t).getUTCFullYear(),
|
||
e = jQuery.grep(e, function(t) {
|
||
var e = t[0]
|
||
, i = t[1];
|
||
return e <= a && (i >= a || e == a && "only" == i || "max" == i)
|
||
}),
|
||
e.push(t),
|
||
e.sort(function(t, e) {
|
||
return "number" != typeof t && (t = +o(a, t)),
|
||
"number" != typeof e && (e = +o(a, e)),
|
||
t - e
|
||
}),
|
||
s = e[jQuery.inArray(t, e) - 1] || e[e.length - 1],
|
||
isNaN(s) ? s : null) : (n = i.split(":"),
|
||
r = 0,
|
||
n.length > 1 && (r = 60 * n[0] + +n[1]),
|
||
[-1e6, "max", "-", "Jan", 1, [0, 0, 0], r, "-"])
|
||
}
|
||
function s(t, e, i) {
|
||
var n, r, a, s = e[i];
|
||
if ("string" == typeof s && (s = e[s]),
|
||
!s)
|
||
throw Error('Timezone "' + i + '" is either incorrect, or kendo.timezones.min.js is not included.');
|
||
for (n = s.length - 1; n >= 0 && (r = s[n][3],
|
||
!(r && t > r)); n--)
|
||
;
|
||
if (a = s[n + 1],
|
||
!a)
|
||
throw Error('Timezone "' + i + '" not found on ' + t + ".");
|
||
return a
|
||
}
|
||
function c(t, e, i, n) {
|
||
typeof t != y && (t = Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()));
|
||
var r = s(t, e, n);
|
||
return {
|
||
zone: r,
|
||
rule: a(t, i, r[1])
|
||
}
|
||
}
|
||
function t(t, e) {
|
||
var i, n, r;
|
||
return "Etc/UTC" == e || "Etc/GMT" == e ? 0 : (i = c(t, this.zones, this.rules, e),
|
||
n = i.zone,
|
||
r = i.rule,
|
||
F.parseFloat(r ? n[0] - r[6] : n[0]))
|
||
}
|
||
function e(t, e) {
|
||
var i = c(t, this.zones, this.rules, e)
|
||
, n = i.zone
|
||
, r = i.rule
|
||
, a = n[2];
|
||
return a.indexOf("/") >= 0 ? a.split("/")[r && +r[6] ? 1 : 0] : a.indexOf("%s") >= 0 ? a.replace("%s", r && "-" != r[7] ? r[7] : "") : a
|
||
}
|
||
function i(t, e, i) {
|
||
var n, r, a, s = i;
|
||
return typeof e == _ && (e = this.offset(t, e)),
|
||
typeof i == _ && (i = this.offset(t, i)),
|
||
r = t.getTimezoneOffset(),
|
||
t = new Date(t.getTime() + 6e4 * (e - i)),
|
||
a = t.getTimezoneOffset(),
|
||
typeof s == _ && (s = this.offset(t, s)),
|
||
n = a - r + (i - s),
|
||
new Date(t.getTime() + 6e4 * n)
|
||
}
|
||
function n(t, e) {
|
||
return this.convert(t, t.getTimezoneOffset(), e)
|
||
}
|
||
function r(t, e) {
|
||
return this.convert(t, e, t.getTimezoneOffset())
|
||
}
|
||
function l(t) {
|
||
return this.apply(new Date(t), "Etc/UTC")
|
||
}
|
||
var d = {
|
||
Jan: 0,
|
||
Feb: 1,
|
||
Mar: 2,
|
||
Apr: 3,
|
||
May: 4,
|
||
Jun: 5,
|
||
Jul: 6,
|
||
Aug: 7,
|
||
Sep: 8,
|
||
Oct: 9,
|
||
Nov: 10,
|
||
Dec: 11
|
||
}
|
||
, u = {
|
||
Sun: 0,
|
||
Mon: 1,
|
||
Tue: 2,
|
||
Wed: 3,
|
||
Thu: 4,
|
||
Fri: 5,
|
||
Sat: 6
|
||
};
|
||
return {
|
||
zones: {},
|
||
rules: {},
|
||
offset: t,
|
||
convert: i,
|
||
apply: n,
|
||
remove: r,
|
||
abbr: e,
|
||
toLocalDate: l
|
||
}
|
||
}(),
|
||
F.date = function() {
|
||
function r(t, e) {
|
||
return 0 === e && 23 === t.getHours() && (t.setHours(t.getHours() + 2),
|
||
!0)
|
||
}
|
||
function n(t, e, i) {
|
||
var n = t.getHours();
|
||
i = i || 1,
|
||
e = (e - t.getDay() + 7 * i) % 7,
|
||
t.setDate(t.getDate() + e),
|
||
r(t, n)
|
||
}
|
||
function i(t, e, i) {
|
||
return t = new Date(t),
|
||
n(t, e, i),
|
||
t
|
||
}
|
||
function a(t) {
|
||
return new Date(t.getFullYear(),t.getMonth(),1)
|
||
}
|
||
function t(t) {
|
||
var e = new Date(t.getFullYear(),t.getMonth() + 1,0)
|
||
, i = a(t)
|
||
, n = Math.abs(e.getTimezoneOffset() - i.getTimezoneOffset());
|
||
return n && e.setHours(i.getHours() + n / 60),
|
||
e
|
||
}
|
||
function s(t, e) {
|
||
return 1 !== e ? h(i(t, e, -1), 4) : h(t, 4 - (t.getDay() || 7))
|
||
}
|
||
function o(t, e) {
|
||
var i = new Date(t.getFullYear(),0,1,-6)
|
||
, n = s(t, e)
|
||
, r = n.getTime() - i.getTime()
|
||
, a = Math.floor(r / b);
|
||
return 1 + Math.floor(a / 7)
|
||
}
|
||
function e(t, e) {
|
||
var i, n, r;
|
||
return e === q && (e = F.culture().calendar.firstDay),
|
||
i = h(t, -7),
|
||
n = h(t, 7),
|
||
r = o(t, e),
|
||
0 === r ? o(i, e) + 1 : 53 === r && o(n, e) > 1 ? 1 : r
|
||
}
|
||
function c(t) {
|
||
return t = new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0),
|
||
r(t, 0),
|
||
t
|
||
}
|
||
function l(t) {
|
||
return Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds())
|
||
}
|
||
function d(t) {
|
||
return _(t).getTime() - c(_(t))
|
||
}
|
||
function u(t, e, i) {
|
||
var n, r = d(e), a = d(i);
|
||
return !t || r == a || (e >= i && (i += b),
|
||
n = d(t),
|
||
r > n && (n += b),
|
||
a < r && (a += b),
|
||
n >= r && n <= a)
|
||
}
|
||
function p(t, e, i) {
|
||
var n, r = e.getTime(), a = i.getTime();
|
||
return r >= a && (a += b),
|
||
n = t.getTime(),
|
||
n >= r && n <= a
|
||
}
|
||
function h(t, e) {
|
||
var i = t.getHours();
|
||
return t = new Date(t),
|
||
f(t, e * b),
|
||
r(t, i),
|
||
t
|
||
}
|
||
function f(t, e, i) {
|
||
var n, r = t.getTimezoneOffset();
|
||
t.setTime(t.getTime() + e),
|
||
i || (n = t.getTimezoneOffset() - r,
|
||
t.setTime(t.getTime() + n * y))
|
||
}
|
||
function g(t, e) {
|
||
return t = new Date(F.date.getDate(t).getTime() + F.date.getMilliseconds(e)),
|
||
r(t, e.getHours()),
|
||
t
|
||
}
|
||
function m() {
|
||
return c(new Date)
|
||
}
|
||
function v(t) {
|
||
return c(t).getTime() == m().getTime()
|
||
}
|
||
function _(t) {
|
||
var e = new Date(1980,1,1,0,0,0);
|
||
return t && e.setHours(t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()),
|
||
e
|
||
}
|
||
var y = 6e4
|
||
, b = 864e5;
|
||
return {
|
||
adjustDST: r,
|
||
dayOfWeek: i,
|
||
setDayOfWeek: n,
|
||
getDate: c,
|
||
isInDateRange: p,
|
||
isInTimeRange: u,
|
||
isToday: v,
|
||
nextDay: function(t) {
|
||
return h(t, 1)
|
||
},
|
||
previousDay: function(t) {
|
||
return h(t, -1)
|
||
},
|
||
toUtcTime: l,
|
||
MS_PER_DAY: b,
|
||
MS_PER_HOUR: 60 * y,
|
||
MS_PER_MINUTE: y,
|
||
setTime: f,
|
||
setHours: g,
|
||
addDays: h,
|
||
today: m,
|
||
toInvariantTime: _,
|
||
firstDayOfMonth: a,
|
||
lastDayOfMonth: t,
|
||
weekInYear: e,
|
||
getMilliseconds: d
|
||
}
|
||
}(),
|
||
F.stripWhitespace = function(e) {
|
||
var t, i, n;
|
||
if (document.createNodeIterator)
|
||
for (t = document.createNodeIterator(e, NodeFilter.SHOW_TEXT, function(t) {
|
||
return t.parentNode == e ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
||
}, !1); t.nextNode(); )
|
||
t.referenceNode && !t.referenceNode.textContent.trim() && t.referenceNode.parentNode.removeChild(t.referenceNode);
|
||
else
|
||
for (i = 0; i < e.childNodes.length; i++)
|
||
n = e.childNodes[i],
|
||
3 != n.nodeType || /\S/.test(n.nodeValue) || (e.removeChild(n),
|
||
i--),
|
||
1 == n.nodeType && F.stripWhitespace(n)
|
||
}
|
||
,
|
||
zt = v.requestAnimationFrame || v.webkitRequestAnimationFrame || v.mozRequestAnimationFrame || v.oRequestAnimationFrame || v.msRequestAnimationFrame || function(t) {
|
||
setTimeout(t, 1e3 / 60)
|
||
}
|
||
,
|
||
F.animationFrame = function(t) {
|
||
zt.call(v, t)
|
||
}
|
||
,
|
||
r = [],
|
||
F.queueAnimation = function(t) {
|
||
r[r.length] = t,
|
||
1 === r.length && F.runNextAnimation()
|
||
}
|
||
,
|
||
F.runNextAnimation = function() {
|
||
F.animationFrame(function() {
|
||
r[0] && (r.shift()(),
|
||
r[0] && F.runNextAnimation())
|
||
})
|
||
}
|
||
,
|
||
F.parseQueryStringParams = function(t) {
|
||
for (var e = t.split("?")[1] || "", i = {}, n = e.split(/&|=/), r = n.length, a = 0; a < r; a += 2)
|
||
"" !== n[a] && (i[decodeURIComponent(n[a])] = decodeURIComponent(n[a + 1]));
|
||
return i
|
||
}
|
||
,
|
||
F.elementUnderCursor = function(t) {
|
||
if (q !== t.x.client)
|
||
return document.elementFromPoint(t.x.client, t.y.client)
|
||
}
|
||
,
|
||
F.wheelDeltaY = function(t) {
|
||
var e, i = t.originalEvent, n = i.wheelDeltaY;
|
||
return i.wheelDelta ? (n === q || n) && (e = i.wheelDelta) : i.detail && i.axis === i.VERTICAL_AXIS && (e = 10 * -i.detail),
|
||
e
|
||
}
|
||
,
|
||
F.throttle = function(r, a) {
|
||
var s, t, o = 0;
|
||
return !a || a <= 0 ? r : (t = function() {
|
||
function t() {
|
||
r.apply(e, n),
|
||
o = +new Date
|
||
}
|
||
var e = this
|
||
, i = +new Date - o
|
||
, n = arguments;
|
||
return o ? (s && clearTimeout(s),
|
||
i > a ? t() : s = setTimeout(t, a - i),
|
||
q) : t()
|
||
}
|
||
,
|
||
t.cancel = function() {
|
||
clearTimeout(s)
|
||
}
|
||
,
|
||
t)
|
||
}
|
||
,
|
||
F.caret = function(t, e, i) {
|
||
var n, r, a, s, o, c = e !== q;
|
||
if (i === q && (i = e),
|
||
t[0] && (t = t[0]),
|
||
!c || !t.disabled) {
|
||
try {
|
||
t.selectionStart !== q ? c ? (t.focus(),
|
||
r = f.mobileOS,
|
||
r.wp || r.android ? setTimeout(function() {
|
||
t.setSelectionRange(e, i)
|
||
}, 0) : t.setSelectionRange(e, i)) : e = [t.selectionStart, t.selectionEnd] : document.selection && (m(t).is(":visible") && t.focus(),
|
||
n = t.createTextRange(),
|
||
c ? (n.collapse(!0),
|
||
n.moveStart("character", e),
|
||
n.moveEnd("character", i - e),
|
||
n.select()) : (a = n.duplicate(),
|
||
n.moveToBookmark(document.selection.createRange().getBookmark()),
|
||
a.setEndPoint("EndToStart", n),
|
||
s = a.text.length,
|
||
o = s + n.text.length,
|
||
e = [s, o]))
|
||
} catch (t) {
|
||
e = []
|
||
}
|
||
return e
|
||
}
|
||
}
|
||
,
|
||
F.compileMobileDirective = function(e, i) {
|
||
var t = v.angular;
|
||
return e.attr("data-" + F.ns + "role", e[0].tagName.toLowerCase().replace("kendo-mobile-", "").replace("-", "")),
|
||
t.element(e).injector().invoke(["$compile", function(t) {
|
||
t(e)(i),
|
||
/^\$(digest|apply)$/.test(i.$$phase) || i.$digest()
|
||
}
|
||
]),
|
||
F.widgetInstance(e, F.mobile.ui)
|
||
}
|
||
,
|
||
F.antiForgeryTokens = function() {
|
||
var t = {}
|
||
, e = m("meta[name=csrf-token],meta[name=_csrf]").attr("content")
|
||
, i = m("meta[name=csrf-param],meta[name=_csrf_header]").attr("content");
|
||
return m("input[name^='__RequestVerificationToken']").each(function() {
|
||
t[this.name] = this.value
|
||
}),
|
||
i !== q && e !== q && (t[i] = e),
|
||
t
|
||
}
|
||
,
|
||
F.cycleForm = function(t) {
|
||
function e(t) {
|
||
var e = F.widgetInstance(t);
|
||
e && e.focus ? e.focus() : t.focus()
|
||
}
|
||
var i = t.find("input, .k-widget").first()
|
||
, n = t.find("button, .k-button").last();
|
||
n.on("keydown", function(t) {
|
||
t.keyCode != F.keys.TAB || t.shiftKey || (t.preventDefault(),
|
||
e(i))
|
||
}),
|
||
i.on("keydown", function(t) {
|
||
t.keyCode == F.keys.TAB && t.shiftKey && (t.preventDefault(),
|
||
e(n))
|
||
})
|
||
}
|
||
,
|
||
F.focusElement = function(e) {
|
||
var i = []
|
||
, t = e.parentsUntil("body").filter(function(t, e) {
|
||
var i = F.getComputedStyles(e, ["overflow"]);
|
||
return "visible" !== i.overflow
|
||
}).add(v);
|
||
t.each(function(t, e) {
|
||
i[t] = m(e).scrollTop()
|
||
});
|
||
try {
|
||
e[0].setActive()
|
||
} catch (t) {
|
||
e[0].focus()
|
||
}
|
||
t.each(function(t, e) {
|
||
m(e).scrollTop(i[t])
|
||
})
|
||
}
|
||
,
|
||
F.matchesMedia = function(t) {
|
||
var e = F._bootstrapToMedia(t) || t;
|
||
return f.matchMedia && v.matchMedia(e).matches
|
||
}
|
||
,
|
||
F._bootstrapToMedia = function(t) {
|
||
return {
|
||
xs: "(max-width: 576px)",
|
||
sm: "(min-width: 576px)",
|
||
md: "(min-width: 768px)",
|
||
lg: "(min-width: 992px)",
|
||
xl: "(min-width: 1200px)"
|
||
}[t]
|
||
}
|
||
;
|
||
var Ye = document.createElement("a")
|
||
, Ze = "download"in Ye && !F.support.browser.edge;
|
||
return F.saveAs = function(t) {
|
||
var e = We;
|
||
t.forceProxy || (Ze ? e = Je : navigator.msSaveBlob && (e = Qe)),
|
||
e(t.dataURI, t.fileName, t.proxyURL, t.proxyTarget)
|
||
}
|
||
,
|
||
F.proxyModelSetters = function(i) {
|
||
var t = {};
|
||
return Object.keys(i || {}).forEach(function(e) {
|
||
Object.defineProperty(t, e, {
|
||
get: function() {
|
||
return i[e]
|
||
},
|
||
set: function(t) {
|
||
i[e] = t,
|
||
i.dirty = !0
|
||
}
|
||
})
|
||
}),
|
||
t
|
||
}
|
||
,
|
||
window.kendo
|
||
}),
|
||
("function" == typeof define && define.amd ? define : function(t, e, i) {
|
||
(i || e)()
|
||
}
|
||
)("kendo.data.min", ["kendo.core.min", "kendo.data.odata.min", "kendo.data.xml.min"], function() {
|
||
var v = window.kendo.jQuery
|
||
, y = void 0;
|
||
function U(n, r, a, s) {
|
||
return function(t) {
|
||
var e, i = {};
|
||
for (e in t)
|
||
i[e] = t[e];
|
||
i.field = s ? a + "." + t.field : a,
|
||
r == M && n._notifyChange && n._notifyChange(i),
|
||
n.trigger(r, i)
|
||
}
|
||
}
|
||
function z(t, e) {
|
||
if (t === e)
|
||
return !0;
|
||
var i, n = v.type(t), r = v.type(e);
|
||
if (n !== r)
|
||
return !1;
|
||
if ("date" === n)
|
||
return t.getTime() === e.getTime();
|
||
if ("object" !== n && "array" !== n)
|
||
return !1;
|
||
for (i in t)
|
||
if (!z(t[i], e[i]))
|
||
return !1;
|
||
return !0
|
||
}
|
||
function j(t, e) {
|
||
var i, n;
|
||
for (n in t) {
|
||
if (i = t[n],
|
||
C(i) && i.field && i.field === e)
|
||
return i;
|
||
if (i === e)
|
||
return i
|
||
}
|
||
return null
|
||
}
|
||
function g(t) {
|
||
this.data = t || []
|
||
}
|
||
function b(t, e) {
|
||
if (t) {
|
||
var i = typeof t === N ? {
|
||
field: t,
|
||
dir: e
|
||
} : t
|
||
, n = k(i) ? i : i !== y ? [i] : [];
|
||
return Et(n, function(t) {
|
||
return !!t.dir
|
||
})
|
||
}
|
||
}
|
||
function H(t) {
|
||
var e, i, n, r, a = t.filters;
|
||
if (a)
|
||
for (e = 0,
|
||
i = a.length; e < i; e++)
|
||
n = a[e],
|
||
r = n.operator,
|
||
r && typeof r === N && (n.operator = St[r.toLowerCase()] || r),
|
||
H(n)
|
||
}
|
||
function u(t) {
|
||
if (t && !f(t))
|
||
return !k(t) && t.filters || (t = {
|
||
logic: "and",
|
||
filters: k(t) ? t : [t]
|
||
}),
|
||
H(t),
|
||
t
|
||
}
|
||
function B(t, e) {
|
||
return !t.logic && !e.logic && (t.field === e.field && t.value === e.value && t.operator === e.operator)
|
||
}
|
||
function L(t) {
|
||
return t = t || {},
|
||
f(t) ? {
|
||
logic: "and",
|
||
filters: []
|
||
} : u(t)
|
||
}
|
||
function V(t, e) {
|
||
return e.logic || t.field > e.field ? 1 : t.field < e.field ? -1 : 0
|
||
}
|
||
function G(t, e) {
|
||
var i, n, r, a, s;
|
||
if (t = L(t),
|
||
e = L(e),
|
||
t.logic !== e.logic)
|
||
return !1;
|
||
if (r = (t.filters || []).slice(),
|
||
a = (e.filters || []).slice(),
|
||
r.length !== a.length)
|
||
return !1;
|
||
for (r = r.sort(V),
|
||
a = a.sort(V),
|
||
s = 0; s < r.length; s++)
|
||
if (i = r[s],
|
||
n = a[s],
|
||
i.logic && n.logic) {
|
||
if (!G(i, n))
|
||
return !1
|
||
} else if (!B(i, n))
|
||
return !1;
|
||
return !0
|
||
}
|
||
function i(t) {
|
||
return k(t) ? t : [t]
|
||
}
|
||
function m(t, e, i, n) {
|
||
var r = typeof t === N ? {
|
||
field: t,
|
||
dir: e,
|
||
compare: i,
|
||
skipItemSorting: n
|
||
} : t
|
||
, a = k(r) ? r : r !== y ? [r] : [];
|
||
return yt(a, function(t) {
|
||
return {
|
||
field: t.field,
|
||
dir: t.dir || "asc",
|
||
aggregates: t.aggregates,
|
||
compare: t.compare,
|
||
skipItemSorting: t.skipItemSorting
|
||
}
|
||
})
|
||
}
|
||
function W(t, e, i) {
|
||
var n, r = m(t, e, i);
|
||
for (n = 0; n < r.length; n++)
|
||
delete r[n].compare;
|
||
return r
|
||
}
|
||
function Q(t) {
|
||
var e, i = k(t) ? t : [t];
|
||
for (e = 0; e < i.length; e++)
|
||
if (i[e] && T(i[e].compare))
|
||
return !0;
|
||
return !1
|
||
}
|
||
function J(t, e) {
|
||
return t && t.getTime && e && e.getTime ? t.getTime() === e.getTime() : t === e
|
||
}
|
||
function Y(t, e, i, n, r, a) {
|
||
var s, o, c, l, d;
|
||
for (e = e || [],
|
||
l = e.length,
|
||
s = 0; s < l; s++)
|
||
o = e[s],
|
||
c = o.aggregate,
|
||
d = o.field,
|
||
t[d] = t[d] || {},
|
||
a[d] = a[d] || {},
|
||
a[d][c] = a[d][c] || {},
|
||
t[d][c] = Pt[c.toLowerCase()](t[d][c], i, P.accessor(d), n, r, a[d][c])
|
||
}
|
||
function o(t) {
|
||
return "number" == typeof t && !isNaN(t)
|
||
}
|
||
function r(t) {
|
||
return t && t.getTime
|
||
}
|
||
function c(t) {
|
||
var e, i = t.length, n = Array(i);
|
||
for (e = 0; e < i; e++)
|
||
n[e] = t[e].toJSON();
|
||
return n
|
||
}
|
||
function Z(t, e, i, n, r) {
|
||
var a, s, o, c, l, d = {};
|
||
for (c = 0,
|
||
l = t.length; c < l; c++) {
|
||
a = t[c];
|
||
for (s in e)
|
||
o = r[s],
|
||
o && o !== s && (d[o] || (d[o] = P.setter(o)),
|
||
d[o](a, e[s](a)),
|
||
delete a[s])
|
||
}
|
||
}
|
||
function K(t, e, i, n, r) {
|
||
var a, s, o, c, l;
|
||
for (c = 0,
|
||
l = t.length; c < l; c++) {
|
||
a = t[c];
|
||
for (s in e)
|
||
a[s] = i._parse(s, e[s](a)),
|
||
o = r[s],
|
||
o && o !== s && delete a[o]
|
||
}
|
||
}
|
||
function X(t, e, i, n, r) {
|
||
var a, s, o, c;
|
||
for (s = 0,
|
||
c = t.length; s < c; s++)
|
||
a = t[s],
|
||
o = n[a.field],
|
||
o && o != a.field && (a.field = o),
|
||
a.value = i._parse(a.field, a.value),
|
||
a.hasSubgroups ? X(a.items, e, i, n, r) : K(a.items, e, i, n, r)
|
||
}
|
||
function tt(e, i, n, r, a, s) {
|
||
return function(t) {
|
||
return t = e(t),
|
||
et(i, n, r, a, s)(t)
|
||
}
|
||
}
|
||
function et(e, i, n, r, a) {
|
||
return function(t) {
|
||
return t && !f(n) && ("[object Array]" === te.call(t) || t instanceof $ || (t = [t]),
|
||
i(t, n, new e, r, a)),
|
||
t || []
|
||
}
|
||
}
|
||
function it(t, e) {
|
||
var i, n, r;
|
||
if (e.items && e.items.length)
|
||
for (r = 0; r < e.items.length; r++)
|
||
i = t.items[r],
|
||
n = e.items[r],
|
||
i && n ? i.hasSubgroups ? it(i, n) : i.field && i.value == n.value ? i.items.push.apply(i.items, n.items) : t.items.push.apply(t.items, [n]) : n && t.items.push.apply(t.items, [n])
|
||
}
|
||
function nt(t, e, i, n) {
|
||
for (var r, a, s, o = 0; e.length && n && (r = e[o],
|
||
a = r.items,
|
||
s = a.length,
|
||
t && t.field === r.field && t.value === r.value ? (t.hasSubgroups && t.items.length ? nt(t.items[t.items.length - 1], r.items, i, n) : (a = a.slice(i, i + n),
|
||
t.items = t.items.concat(a)),
|
||
e.splice(o--, 1)) : r.hasSubgroups && a.length ? (nt(r, a, i, n),
|
||
r.items.length || e.splice(o--, 1)) : (a = a.slice(i, i + n),
|
||
r.items = a,
|
||
r.items.length || e.splice(o--, 1)),
|
||
0 === a.length ? i -= s : (i = 0,
|
||
n -= a.length),
|
||
!(++o >= e.length)); )
|
||
;
|
||
o < e.length && e.splice(o, e.length - o)
|
||
}
|
||
function rt(t, e) {
|
||
var i, n, r, a, s = [], o = (t || []).length, c = T(e) ? e : function(t, e) {
|
||
return t[e]
|
||
}
|
||
;
|
||
for (r = 0; r < o; r++)
|
||
if (i = c(t, r),
|
||
i.hasSubgroups)
|
||
s = s.concat(rt(i.items));
|
||
else
|
||
for (n = i.items,
|
||
a = 0; a < n.length; a++)
|
||
s.push(c(n, a));
|
||
return s
|
||
}
|
||
function at(t) {
|
||
var e, i, n, r, a, s = [];
|
||
for (e = 0,
|
||
i = t.length; e < i; e++)
|
||
if (a = t.at(e),
|
||
a.hasSubgroups)
|
||
s = s.concat(at(a.items));
|
||
else
|
||
for (n = a.items,
|
||
r = 0; r < n.length; r++)
|
||
s.push(n.at(r));
|
||
return s
|
||
}
|
||
function st(t, e) {
|
||
var i, n, r;
|
||
if (e)
|
||
for (i = 0,
|
||
n = t.length; i < n; i++)
|
||
r = t.at(i),
|
||
r.hasSubgroups ? st(r.items, e) : r.items = new a(r.items,e,r.items._events)
|
||
}
|
||
function n(t, e) {
|
||
for (var i = 0; i < t.length; i++)
|
||
if (t[i].hasSubgroups) {
|
||
if (n(t[i].items, e))
|
||
return !0
|
||
} else if (e(t[i].items, t[i]))
|
||
return !0
|
||
}
|
||
function ot(t, e, i, n) {
|
||
for (var r = 0; r < t.length && t[r].data !== e && !ct(t[r].data, i, n); r++)
|
||
;
|
||
}
|
||
function ct(t, e, i) {
|
||
for (var n = 0, r = t.length; n < r; n++) {
|
||
if (t[n] && t[n].hasSubgroups)
|
||
return ct(t[n].items, e, i);
|
||
if (t[n] === e || t[n] === i)
|
||
return t[n] = i,
|
||
!0
|
||
}
|
||
}
|
||
function lt(t, e, i, n, r) {
|
||
var a, s, o, c;
|
||
for (a = 0,
|
||
s = t.length; a < s; a++)
|
||
if (o = t[a],
|
||
o && !(o instanceof n))
|
||
if (o.hasSubgroups === y || r) {
|
||
for (c = 0; c < e.length; c++)
|
||
if (e[c] === o) {
|
||
t[a] = e.at(c),
|
||
ot(i, e, o, t[a]);
|
||
break
|
||
}
|
||
} else
|
||
lt(o.items, e, i, n, r)
|
||
}
|
||
function dt(t, e) {
|
||
var i, n, r = t.length;
|
||
for (n = 0; n < r; n++)
|
||
if (i = t[n],
|
||
i.uid && i.uid == e.uid)
|
||
return t.splice(n, 1),
|
||
i
|
||
}
|
||
function ut(t, e) {
|
||
return e ? ht(t, function(t) {
|
||
return t.uid && t.uid == e.uid || t[e.idField] === e.id && e.id !== e._defaultId
|
||
}) : -1
|
||
}
|
||
function pt(t, e) {
|
||
return e ? ht(t, function(t) {
|
||
return t.uid == e.uid
|
||
}) : -1
|
||
}
|
||
function ht(t, e) {
|
||
var i, n;
|
||
for (i = 0,
|
||
n = t.length; i < n; i++)
|
||
if (e(t[i]))
|
||
return i;
|
||
return -1
|
||
}
|
||
function ft(t, e) {
|
||
var i, n;
|
||
return t && !f(t) ? (i = t[e],
|
||
n = C(i) ? i.from || i.field || e : t[e] || e,
|
||
T(n) ? e : n) : e
|
||
}
|
||
function gt(t, e) {
|
||
var i, n, r, a = {};
|
||
for (r in t)
|
||
"filters" !== r && (a[r] = t[r]);
|
||
if (t.filters)
|
||
for (a.filters = [],
|
||
i = 0,
|
||
n = t.filters.length; i < n; i++)
|
||
a.filters[i] = gt(t.filters[i], e);
|
||
else
|
||
a.field = ft(e.fields, a.field);
|
||
return a
|
||
}
|
||
function l(t, e) {
|
||
var i, n, r, a, s, o = [];
|
||
for (i = 0,
|
||
n = t.length; i < n; i++) {
|
||
r = {},
|
||
a = t[i];
|
||
for (s in a)
|
||
r[s] = a[s];
|
||
r.field = ft(e.fields, r.field),
|
||
r.aggregates && k(r.aggregates) && (r.aggregates = l(r.aggregates, e)),
|
||
o.push(r)
|
||
}
|
||
return o
|
||
}
|
||
function mt(t, e) {
|
||
var i, n, r, a, s, o, c, l, d, u;
|
||
for (t = v(t)[0],
|
||
i = t.options,
|
||
n = e[0],
|
||
r = e[1],
|
||
a = [],
|
||
s = 0,
|
||
o = i.length; s < o; s++)
|
||
d = {},
|
||
l = i[s],
|
||
c = l.parentNode,
|
||
c === t && (c = null),
|
||
l.disabled || c && c.disabled || (c && (d.optgroup = c.label),
|
||
d[n.field] = l.text,
|
||
u = l.attributes.value,
|
||
u = u && u.specified ? l.value : l.text,
|
||
d[r.field] = u,
|
||
a.push(d));
|
||
return a
|
||
}
|
||
function vt(t, e) {
|
||
var i, n, r, a, s, o, c, l = v(t)[0].tBodies[0], d = l ? l.rows : [], u = e.length, p = [];
|
||
for (i = 0,
|
||
n = d.length; i < n; i++) {
|
||
for (s = {},
|
||
c = !0,
|
||
a = d[i].cells,
|
||
r = 0; r < u; r++)
|
||
o = a[r],
|
||
"th" !== o.nodeName.toLowerCase() && (c = !1,
|
||
s[e[r].field] = o.innerHTML);
|
||
c || p.push(s)
|
||
}
|
||
return p
|
||
}
|
||
function t(i) {
|
||
return function() {
|
||
var t = this._data
|
||
, e = p.fn[i].apply(this, q.call(arguments));
|
||
return this._data != t && this._attachBubbleHandlers(),
|
||
e
|
||
}
|
||
}
|
||
function _t(t, e) {
|
||
function i(t, e) {
|
||
return t.filter(e).add(t.find(e))
|
||
}
|
||
var n, r, a, s, o, c, l, d, u = v(t).children(), p = [], h = e[0].field, f = e[1] && e[1].field, g = e[2] && e[2].field, m = e[3] && e[3].field;
|
||
for (n = 0,
|
||
r = u.length; n < r; n++)
|
||
a = {
|
||
_loaded: !0
|
||
},
|
||
s = u.eq(n),
|
||
c = s[0].firstChild,
|
||
d = s.children(),
|
||
t = d.filter("ul"),
|
||
d = d.filter(":not(ul)"),
|
||
o = s.attr("data-id"),
|
||
o && (a.id = o),
|
||
c && (a[h] = 3 == c.nodeType ? c.nodeValue : d.text()),
|
||
f && (a[f] = i(d, "a").attr("href")),
|
||
m && (a[m] = i(d, "img").attr("src")),
|
||
g && (l = i(d, ".k-sprite").prop("className"),
|
||
a[g] = l && v.trim(l.replace("k-sprite", ""))),
|
||
t.length && (a.items = _t(t.eq(0), e)),
|
||
"true" == s.attr("data-hasChildren") && (a.hasChildren = !0),
|
||
p.push(a);
|
||
return p
|
||
}
|
||
var yt, a, d, bt, xt, _, wt, Ct, kt, St, Pt, Tt, Dt, s, Nt, p, Mt, At, h, Ot, It, x = v.extend, w = v.proxy, C = v.isPlainObject, f = v.isEmptyObject, k = v.isArray, Et = v.grep, Ft = v.ajax, Rt = v.each, S = v.noop, P = window.kendo, T = P.isFunction, D = P.Observable, qt = P.Class, N = "string", $t = "function", Ut = "asc", zt = "create", jt = "read", Ht = "update", Bt = "destroy", M = "change", Lt = "sync", Vt = "get", A = "error", O = "requestStart", I = "progress", E = "requestEnd", Gt = [zt, jt, Ht, Bt], e = function(t) {
|
||
return t
|
||
}, F = P.getter, Wt = P.stringify, R = Math, Qt = [].push, Jt = [].join, Yt = [].pop, Zt = [].splice, Kt = [].shift, q = [].slice, Xt = [].unshift, te = {}.toString, ee = P.support.stableSort, ie = /^\/Date\((.*?)\)\/$/, $ = D.extend({
|
||
init: function(t, e) {
|
||
var i = this;
|
||
i.type = e || d,
|
||
D.fn.init.call(i),
|
||
i.length = t.length,
|
||
i.wrapAll(t, i)
|
||
},
|
||
at: function(t) {
|
||
return this[t]
|
||
},
|
||
toJSON: function() {
|
||
var t, e, i = this.length, n = Array(i);
|
||
for (t = 0; t < i; t++)
|
||
e = this[t],
|
||
e instanceof d && (e = e.toJSON()),
|
||
n[t] = e;
|
||
return n
|
||
},
|
||
parent: S,
|
||
wrapAll: function(t, e) {
|
||
var i, n, r = this, a = function() {
|
||
return r
|
||
};
|
||
for (e = e || [],
|
||
i = 0,
|
||
n = t.length; i < n; i++)
|
||
e[i] = r.wrap(t[i], a);
|
||
return e
|
||
},
|
||
wrap: function(t, e) {
|
||
var i, n = this;
|
||
return null !== t && "[object Object]" === te.call(t) && (i = t instanceof n.type || t instanceof _,
|
||
i || (t = t instanceof d ? t.toJSON() : t,
|
||
t = new n.type(t)),
|
||
t.parent = e,
|
||
t.bind(M, function(t) {
|
||
n.trigger(M, {
|
||
field: t.field,
|
||
node: t.node,
|
||
index: t.index,
|
||
items: t.items || [this],
|
||
action: t.node ? t.action || "itemloaded" : "itemchange"
|
||
})
|
||
})),
|
||
t
|
||
},
|
||
push: function() {
|
||
var t, e = this.length, i = this.wrapAll(arguments);
|
||
return t = Qt.apply(this, i),
|
||
this.trigger(M, {
|
||
action: "add",
|
||
index: e,
|
||
items: i
|
||
}),
|
||
t
|
||
},
|
||
slice: q,
|
||
sort: [].sort,
|
||
join: Jt,
|
||
pop: function() {
|
||
var t = this.length
|
||
, e = Yt.apply(this);
|
||
return t && this.trigger(M, {
|
||
action: "remove",
|
||
index: t - 1,
|
||
items: [e]
|
||
}),
|
||
e
|
||
},
|
||
splice: function(t, e, i) {
|
||
var n, r, a, s = this.wrapAll(q.call(arguments, 2));
|
||
if (n = Zt.apply(this, [t, e].concat(s)),
|
||
n.length)
|
||
for (this.trigger(M, {
|
||
action: "remove",
|
||
index: t,
|
||
items: n
|
||
}),
|
||
r = 0,
|
||
a = n.length; r < a; r++)
|
||
n[r] && n[r].children && n[r].unbind(M);
|
||
return i && this.trigger(M, {
|
||
action: "add",
|
||
index: t,
|
||
items: s
|
||
}),
|
||
n
|
||
},
|
||
shift: function() {
|
||
var t = this.length
|
||
, e = Kt.apply(this);
|
||
return t && this.trigger(M, {
|
||
action: "remove",
|
||
index: 0,
|
||
items: [e]
|
||
}),
|
||
e
|
||
},
|
||
unshift: function() {
|
||
var t, e = this.wrapAll(arguments);
|
||
return t = Xt.apply(this, e),
|
||
this.trigger(M, {
|
||
action: "add",
|
||
index: 0,
|
||
items: e
|
||
}),
|
||
t
|
||
},
|
||
indexOf: function(t) {
|
||
var e, i, n = this;
|
||
for (e = 0,
|
||
i = n.length; e < i; e++)
|
||
if (n[e] === t)
|
||
return e;
|
||
return -1
|
||
},
|
||
forEach: function(t, e) {
|
||
for (var i = 0, n = this.length, r = e || window; i < n; i++)
|
||
t.call(r, this[i], i, this)
|
||
},
|
||
map: function(t, e) {
|
||
for (var i = 0, n = [], r = this.length, a = e || window; i < r; i++)
|
||
n[i] = t.call(a, this[i], i, this);
|
||
return n
|
||
},
|
||
reduce: function(t) {
|
||
var e, i = 0, n = this.length;
|
||
for (2 == arguments.length ? e = arguments[1] : i < n && (e = this[i++]); i < n; i++)
|
||
e = t(e, this[i], i, this);
|
||
return e
|
||
},
|
||
reduceRight: function(t) {
|
||
var e, i = this.length - 1;
|
||
for (2 == arguments.length ? e = arguments[1] : i > 0 && (e = this[i--]); i >= 0; i--)
|
||
e = t(e, this[i], i, this);
|
||
return e
|
||
},
|
||
filter: function(t, e) {
|
||
for (var i, n = 0, r = [], a = this.length, s = e || window; n < a; n++)
|
||
i = this[n],
|
||
t.call(s, i, n, this) && (r[r.length] = i);
|
||
return r
|
||
},
|
||
find: function(t, e) {
|
||
for (var i, n = 0, r = this.length, a = e || window; n < r; n++)
|
||
if (i = this[n],
|
||
t.call(a, i, n, this))
|
||
return i
|
||
},
|
||
every: function(t, e) {
|
||
for (var i, n = 0, r = this.length, a = e || window; n < r; n++)
|
||
if (i = this[n],
|
||
!t.call(a, i, n, this))
|
||
return !1;
|
||
return !0
|
||
},
|
||
some: function(t, e) {
|
||
for (var i, n = 0, r = this.length, a = e || window; n < r; n++)
|
||
if (i = this[n],
|
||
t.call(a, i, n, this))
|
||
return !0;
|
||
return !1
|
||
},
|
||
remove: function(t) {
|
||
var e = this.indexOf(t);
|
||
e !== -1 && this.splice(e, 1)
|
||
},
|
||
empty: function() {
|
||
this.splice(0, this.length)
|
||
}
|
||
});
|
||
return "undefined" != typeof Symbol && Symbol.iterator && !$.prototype[Symbol.iterator] && ($.prototype[Symbol.iterator] = [][Symbol.iterator]),
|
||
a = $.extend({
|
||
init: function(t, e, i) {
|
||
D.fn.init.call(this),
|
||
this.type = e || d,
|
||
i && (this._events = i);
|
||
for (var n = 0; n < t.length; n++)
|
||
this[n] = t[n];
|
||
this.length = n,
|
||
this._parent = w(function() {
|
||
return this
|
||
}, this)
|
||
},
|
||
at: function(t) {
|
||
var e = this[t];
|
||
return e instanceof this.type ? e.parent = this._parent : e = this[t] = this.wrap(e, this._parent),
|
||
e
|
||
}
|
||
}),
|
||
d = D.extend({
|
||
init: function(t) {
|
||
var e, i, n = this, r = function() {
|
||
return n
|
||
};
|
||
D.fn.init.call(this),
|
||
this._handlers = {};
|
||
for (i in t)
|
||
e = t[i],
|
||
"object" == typeof e && e && !e.getTime && "_" != i.charAt(0) && (e = n.wrap(e, i, r)),
|
||
n[i] = e;
|
||
n.uid = P.guid()
|
||
},
|
||
shouldSerialize: function(t) {
|
||
return this.hasOwnProperty(t) && "_handlers" !== t && "_events" !== t && typeof this[t] !== $t && "uid" !== t
|
||
},
|
||
forEach: function(t) {
|
||
for (var e in this)
|
||
this.shouldSerialize(e) && t(this[e], e)
|
||
},
|
||
toJSON: function() {
|
||
var t, e, i = {};
|
||
for (e in this)
|
||
this.shouldSerialize(e) && (t = this[e],
|
||
(t instanceof d || t instanceof $) && (t = t.toJSON()),
|
||
i[e] = t);
|
||
return i
|
||
},
|
||
get: function(t) {
|
||
var e, i = this;
|
||
return i.trigger(Vt, {
|
||
field: t
|
||
}),
|
||
e = "this" === t ? i : P.getter(t, !0)(i)
|
||
},
|
||
_set: function(t, e) {
|
||
var i, n, r, a = this, s = t.indexOf(".") >= 0;
|
||
if (s)
|
||
for (i = t.split("."),
|
||
n = ""; i.length > 1; ) {
|
||
if (n += i.shift(),
|
||
r = P.getter(n, !0)(a),
|
||
r instanceof d)
|
||
return r.set(i.join("."), e),
|
||
s;
|
||
n += "."
|
||
}
|
||
return P.setter(t)(a, e),
|
||
s
|
||
},
|
||
set: function(t, e) {
|
||
var i = this
|
||
, n = !1
|
||
, r = t.indexOf(".") >= 0
|
||
, a = P.getter(t, !0)(i);
|
||
return a !== e && (a instanceof D && this._handlers[t] && (this._handlers[t].get && a.unbind(Vt, this._handlers[t].get),
|
||
a.unbind(M, this._handlers[t].change)),
|
||
n = i.trigger("set", {
|
||
field: t,
|
||
value: e
|
||
}),
|
||
n || (r || (e = i.wrap(e, t, function() {
|
||
return i
|
||
})),
|
||
(!i._set(t, e) || t.indexOf("(") >= 0 || t.indexOf("[") >= 0) && i.trigger(M, {
|
||
field: t
|
||
}))),
|
||
n
|
||
},
|
||
parent: S,
|
||
wrap: function(t, e, i) {
|
||
var n, r, a, s, o = this, c = te.call(t);
|
||
return null == t || "[object Object]" !== c && "[object Array]" !== c || (a = t instanceof $,
|
||
s = t instanceof p,
|
||
"[object Object]" !== c || s || a ? ("[object Array]" === c || a || s) && (a || s || (t = new $(t)),
|
||
r = U(o, M, e, !1),
|
||
t.bind(M, r),
|
||
o._handlers[e] = {
|
||
change: r
|
||
}) : (t instanceof d || (t = new d(t)),
|
||
n = U(o, Vt, e, !0),
|
||
t.bind(Vt, n),
|
||
r = U(o, M, e, !0),
|
||
t.bind(M, r),
|
||
o._handlers[e] = {
|
||
get: n,
|
||
change: r
|
||
}),
|
||
t.parent = i),
|
||
t
|
||
}
|
||
}),
|
||
bt = {
|
||
number: function(t) {
|
||
return typeof t === N && "null" === t.toLowerCase() ? null : P.parseFloat(t)
|
||
},
|
||
date: function(t) {
|
||
return typeof t === N && "null" === t.toLowerCase() ? null : P.parseDate(t)
|
||
},
|
||
boolean: function(t) {
|
||
return typeof t === N ? "null" === t.toLowerCase() ? null : "true" === t.toLowerCase() : null != t ? !!t : t
|
||
},
|
||
string: function(t) {
|
||
return typeof t === N && "null" === t.toLowerCase() ? null : null != t ? t + "" : t
|
||
},
|
||
default: function(t) {
|
||
return t
|
||
}
|
||
},
|
||
xt = {
|
||
string: "",
|
||
number: 0,
|
||
date: new Date,
|
||
boolean: !1,
|
||
default: ""
|
||
},
|
||
(_ = d.extend({
|
||
init: function(t) {
|
||
var e, i, n = this;
|
||
if ((!t || v.isEmptyObject(t)) && (t = v.extend({}, n.defaults, t),
|
||
n._initializers))
|
||
for (e = 0; e < n._initializers.length; e++)
|
||
i = n._initializers[e],
|
||
t[i] = n.defaults[i]();
|
||
d.fn.init.call(n, t),
|
||
n.dirty = !1,
|
||
n.dirtyFields = {},
|
||
n.idField && (n.id = n.get(n.idField),
|
||
n.id === y && (n.id = n._defaultId))
|
||
},
|
||
shouldSerialize: function(t) {
|
||
return d.fn.shouldSerialize.call(this, t) && "uid" !== t && !("id" !== this.idField && "id" === t) && "dirty" !== t && "dirtyFields" !== t && "_accessors" !== t
|
||
},
|
||
_parse: function(t, e) {
|
||
var i, n = this, r = t, a = n.fields || {};
|
||
return t = a[t],
|
||
t || (t = j(a, r)),
|
||
t && (i = t.parse,
|
||
!i && t.type && (i = bt[t.type.toLowerCase()])),
|
||
i ? i(e) : e
|
||
},
|
||
_notifyChange: function(t) {
|
||
var e = t.action;
|
||
"add" != e && "remove" != e || (this.dirty = !0,
|
||
this.dirtyFields[t.field] = !0)
|
||
},
|
||
editable: function(t) {
|
||
return t = (this.fields || {})[t],
|
||
!t || t.editable !== !1
|
||
},
|
||
set: function(t, e, i) {
|
||
var n = this
|
||
, r = n.dirty;
|
||
n.editable(t) && (e = n._parse(t, e),
|
||
z(e, n.get(t)) ? n.trigger("equalSet", {
|
||
field: t,
|
||
value: e
|
||
}) : (n.dirty = !0,
|
||
n.dirtyFields[t] = !0,
|
||
d.fn.set.call(n, t, e, i) && !r && (n.dirty = r,
|
||
n.dirty || (n.dirtyFields[t] = !1))))
|
||
},
|
||
accept: function(t) {
|
||
var e, i, n = this, r = function() {
|
||
return n
|
||
};
|
||
for (e in t)
|
||
i = t[e],
|
||
"_" != e.charAt(0) && (i = n.wrap(t[e], e, r)),
|
||
n._set(e, i);
|
||
n.idField && (n.id = n.get(n.idField)),
|
||
n.dirty = !1,
|
||
n.dirtyFields = {}
|
||
},
|
||
isNew: function() {
|
||
return this.id === this._defaultId
|
||
}
|
||
})).define = function(t, e) {
|
||
e === y && (e = t,
|
||
t = _);
|
||
var i, n, r, a, s, o, c, l, d = x({
|
||
defaults: {}
|
||
}, e), u = {}, p = d.id, h = [];
|
||
if (p && (d.idField = p),
|
||
d.id && delete d.id,
|
||
p && (d.defaults[p] = d._defaultId = ""),
|
||
"[object Array]" === te.call(d.fields)) {
|
||
for (o = 0,
|
||
c = d.fields.length; o < c; o++)
|
||
r = d.fields[o],
|
||
typeof r === N ? u[r] = {} : r.field && (u[r.field] = r);
|
||
d.fields = u
|
||
}
|
||
for (n in d.fields)
|
||
r = d.fields[n],
|
||
a = r.type || "default",
|
||
s = null,
|
||
l = n,
|
||
n = typeof r.field === N ? r.field : n,
|
||
r.nullable || (s = d.defaults[l !== n ? l : n] = r.defaultValue !== y ? r.defaultValue : xt[a.toLowerCase()],
|
||
"function" == typeof s && h.push(n)),
|
||
e.id === n && (d._defaultId = s),
|
||
d.defaults[l !== n ? l : n] = s,
|
||
r.parse = r.parse || bt[a];
|
||
return h.length > 0 && (d._initializers = h),
|
||
i = t.extend(d),
|
||
i.define = function(t) {
|
||
return _.define(i, t)
|
||
}
|
||
,
|
||
d.fields && (i.fields = d.fields,
|
||
i.idField = d.idField),
|
||
i
|
||
}
|
||
,
|
||
Ct = x({}, wt = {
|
||
selector: function(t) {
|
||
return T(t) ? t : F(t)
|
||
},
|
||
compare: function(t) {
|
||
var i = this.selector(t);
|
||
return function(t, e) {
|
||
return t = i(t),
|
||
e = i(e),
|
||
null == t && null == e ? 0 : null == t ? -1 : null == e ? 1 : t.localeCompare ? t.localeCompare(e) : t > e ? 1 : t < e ? -1 : 0
|
||
}
|
||
},
|
||
create: function(t) {
|
||
var i = t.compare || this.compare(t.field);
|
||
return "desc" == t.dir ? function(t, e) {
|
||
return i(e, t, !0)
|
||
}
|
||
: i
|
||
},
|
||
combine: function(a) {
|
||
return function(t, e) {
|
||
var i, n, r = a[0](t, e);
|
||
for (i = 1,
|
||
n = a.length; i < n; i++)
|
||
r = r || a[i](t, e);
|
||
return r
|
||
}
|
||
}
|
||
}, {
|
||
asc: function(t) {
|
||
var r = this.selector(t);
|
||
return function(t, e) {
|
||
var i = r(t)
|
||
, n = r(e);
|
||
return i && i.getTime && n && n.getTime && (i = i.getTime(),
|
||
n = n.getTime()),
|
||
i === n ? t.__position - e.__position : null == i ? -1 : null == n ? 1 : i.localeCompare ? i.localeCompare(n) : i > n ? 1 : -1
|
||
}
|
||
},
|
||
desc: function(t) {
|
||
var r = this.selector(t);
|
||
return function(t, e) {
|
||
var i = r(t)
|
||
, n = r(e);
|
||
return i && i.getTime && n && n.getTime && (i = i.getTime(),
|
||
n = n.getTime()),
|
||
i === n ? t.__position - e.__position : null == i ? 1 : null == n ? -1 : n.localeCompare ? n.localeCompare(i) : i < n ? 1 : -1
|
||
}
|
||
},
|
||
create: function(t) {
|
||
return this[t.dir](t.field)
|
||
}
|
||
}),
|
||
yt = function(t, e) {
|
||
var i, n = t.length, r = Array(n);
|
||
for (i = 0; i < n; i++)
|
||
r[i] = e(t[i], i, t);
|
||
return r
|
||
}
|
||
,
|
||
kt = function() {
|
||
function a(t) {
|
||
return "string" == typeof t && (t = t.replace(/[\r\n]+/g, "")),
|
||
JSON.stringify(t)
|
||
}
|
||
function t(n) {
|
||
return function(t, e, i) {
|
||
return e += "",
|
||
i && (t = "(" + t + " || '').toString().toLowerCase()",
|
||
e = e.toLowerCase()),
|
||
n(t, a(e), i)
|
||
}
|
||
}
|
||
function n(t, e, i, n) {
|
||
if (null != i) {
|
||
if (typeof i === N) {
|
||
var r = ie.exec(i);
|
||
r ? i = new Date(+r[1]) : n ? (i = a(i.toLowerCase()),
|
||
e = "((" + e + " || '')+'').toLowerCase()") : i = a(i)
|
||
}
|
||
i.getTime && (e = "(" + e + "&&" + e + ".getTime?" + e + ".getTime():" + e + ")",
|
||
i = i.getTime())
|
||
}
|
||
return e + " " + t + " " + i
|
||
}
|
||
function i(t) {
|
||
var e, i, n, r;
|
||
for (e = "/^",
|
||
i = !1,
|
||
n = 0; n < t.length; ++n) {
|
||
if (r = t.charAt(n),
|
||
i)
|
||
e += "\\" + r;
|
||
else {
|
||
if ("~" == r) {
|
||
i = !0;
|
||
continue
|
||
}
|
||
e += "*" == r ? ".*" : "?" == r ? "." : ".+^$()[]{}|\\/\n\r\u2028\u2029 ".indexOf(r) >= 0 ? "\\" + r : r
|
||
}
|
||
i = !1
|
||
}
|
||
return e + "$/"
|
||
}
|
||
return {
|
||
quote: function(t) {
|
||
return t && t.getTime ? "new Date(" + t.getTime() + ")" : a(t)
|
||
},
|
||
eq: function(t, e, i) {
|
||
return n("==", t, e, i)
|
||
},
|
||
neq: function(t, e, i) {
|
||
return n("!=", t, e, i)
|
||
},
|
||
gt: function(t, e, i) {
|
||
return n(">", t, e, i)
|
||
},
|
||
gte: function(t, e, i) {
|
||
return n(">=", t, e, i)
|
||
},
|
||
lt: function(t, e, i) {
|
||
return n("<", t, e, i)
|
||
},
|
||
lte: function(t, e, i) {
|
||
return n("<=", t, e, i)
|
||
},
|
||
startswith: t(function(t, e) {
|
||
return t + ".lastIndexOf(" + e + ", 0) == 0"
|
||
}),
|
||
doesnotstartwith: t(function(t, e) {
|
||
return t + ".lastIndexOf(" + e + ", 0) == -1"
|
||
}),
|
||
endswith: t(function(t, e) {
|
||
var i = e ? e.length - 2 : 0;
|
||
return t + ".indexOf(" + e + ", " + t + ".length - " + i + ") >= 0"
|
||
}),
|
||
doesnotendwith: t(function(t, e) {
|
||
var i = e ? e.length - 2 : 0;
|
||
return t + ".indexOf(" + e + ", " + t + ".length - " + i + ") < 0"
|
||
}),
|
||
contains: t(function(t, e) {
|
||
return t + ".indexOf(" + e + ") >= 0"
|
||
}),
|
||
doesnotcontain: t(function(t, e) {
|
||
return t + ".indexOf(" + e + ") == -1"
|
||
}),
|
||
matches: t(function(t, e) {
|
||
return e = e.substring(1, e.length - 1),
|
||
i(e) + ".test(" + t + ")"
|
||
}),
|
||
doesnotmatch: t(function(t, e) {
|
||
return e = e.substring(1, e.length - 1),
|
||
"!" + i(e) + ".test(" + t + ")"
|
||
}),
|
||
isempty: function(t) {
|
||
return t + " === ''"
|
||
},
|
||
isnotempty: function(t) {
|
||
return t + " !== ''"
|
||
},
|
||
isnull: function(t) {
|
||
return "(" + t + " == null)"
|
||
},
|
||
isnotnull: function(t) {
|
||
return "(" + t + " != null)"
|
||
},
|
||
isnullorempty: function(t) {
|
||
return "(" + t + " === null) || (" + t + " === '')"
|
||
},
|
||
isnotnullorempty: function(t) {
|
||
return "(" + t + " !== null) && (" + t + " !== '')"
|
||
}
|
||
}
|
||
}(),
|
||
g.filterExpr = function(t) {
|
||
var e, i, n, r, a, s, o = [], c = {
|
||
and: " && ",
|
||
or: " || "
|
||
}, l = [], d = [], u = t.filters;
|
||
for (e = 0,
|
||
i = u.length; e < i; e++)
|
||
n = u[e],
|
||
a = n.field,
|
||
s = n.operator,
|
||
n.filters ? (r = g.filterExpr(n),
|
||
n = r.expression.replace(/__o\[(\d+)\]/g, function(t, e) {
|
||
return e = +e,
|
||
"__o[" + (d.length + e) + "]"
|
||
}).replace(/__f\[(\d+)\]/g, function(t, e) {
|
||
return e = +e,
|
||
"__f[" + (l.length + e) + "]"
|
||
}),
|
||
d.push.apply(d, r.operators),
|
||
l.push.apply(l, r.fields)) : (typeof a === $t ? (r = "__f[" + l.length + "](d)",
|
||
l.push(a)) : r = P.expr(a),
|
||
typeof s === $t ? (n = "__o[" + d.length + "](" + r + ", " + kt.quote(n.value) + ")",
|
||
d.push(s)) : n = kt[(s || "eq").toLowerCase()](r, n.value, n.ignoreCase === y || n.ignoreCase)),
|
||
o.push(n);
|
||
return {
|
||
expression: "(" + o.join(c[t.logic]) + ")",
|
||
fields: l,
|
||
operators: d
|
||
}
|
||
}
|
||
,
|
||
St = {
|
||
"==": "eq",
|
||
equals: "eq",
|
||
isequalto: "eq",
|
||
equalto: "eq",
|
||
equal: "eq",
|
||
"!=": "neq",
|
||
ne: "neq",
|
||
notequals: "neq",
|
||
isnotequalto: "neq",
|
||
notequalto: "neq",
|
||
notequal: "neq",
|
||
"<": "lt",
|
||
islessthan: "lt",
|
||
lessthan: "lt",
|
||
less: "lt",
|
||
"<=": "lte",
|
||
le: "lte",
|
||
islessthanorequalto: "lte",
|
||
lessthanequal: "lte",
|
||
">": "gt",
|
||
isgreaterthan: "gt",
|
||
greaterthan: "gt",
|
||
greater: "gt",
|
||
">=": "gte",
|
||
isgreaterthanorequalto: "gte",
|
||
greaterthanequal: "gte",
|
||
ge: "gte",
|
||
notsubstringof: "doesnotcontain",
|
||
isnull: "isnull",
|
||
isempty: "isempty",
|
||
isnotempty: "isnotempty"
|
||
},
|
||
g.normalizeFilter = u,
|
||
g.compareFilters = G,
|
||
g.prototype = {
|
||
toArray: function() {
|
||
return this.data
|
||
},
|
||
range: function(t, e) {
|
||
return new g(this.data.slice(t, t + e))
|
||
},
|
||
skip: function(t) {
|
||
return new g(this.data.slice(t))
|
||
},
|
||
take: function(t) {
|
||
return new g(this.data.slice(0, t))
|
||
},
|
||
select: function(t) {
|
||
return new g(yt(this.data, t))
|
||
},
|
||
order: function(t, e, i) {
|
||
var n = {
|
||
dir: e
|
||
};
|
||
return t && (t.compare ? n.compare = t.compare : n.field = t),
|
||
new g(i ? this.data.sort(wt.create(n)) : this.data.slice(0).sort(wt.create(n)))
|
||
},
|
||
orderBy: function(t, e) {
|
||
return this.order(t, "asc", e)
|
||
},
|
||
orderByDescending: function(t, e) {
|
||
return this.order(t, "desc", e)
|
||
},
|
||
sort: function(t, e, i, n) {
|
||
var r, a, s = b(t, e), o = [];
|
||
if (i = i || wt,
|
||
s.length) {
|
||
for (r = 0,
|
||
a = s.length; r < a; r++)
|
||
o.push(i.create(s[r]));
|
||
return this.orderBy({
|
||
compare: i.combine(o)
|
||
}, n)
|
||
}
|
||
return this
|
||
},
|
||
filter: function(t) {
|
||
var e, i, n, r, a, s, o, c, l = this.data, d = [];
|
||
if (t = u(t),
|
||
!t || 0 === t.filters.length)
|
||
return this;
|
||
for (r = g.filterExpr(t),
|
||
s = r.fields,
|
||
o = r.operators,
|
||
a = c = Function("d, __f, __o", "return " + r.expression),
|
||
(s.length || o.length) && (c = function(t) {
|
||
return a(t, s, o)
|
||
}
|
||
),
|
||
e = 0,
|
||
n = l.length; e < n; e++)
|
||
i = l[e],
|
||
c(i) && d.push(i);
|
||
return new g(d)
|
||
},
|
||
group: function(i, n) {
|
||
i = m(i || []),
|
||
n = n || this.data;
|
||
var r, t = this, e = new g(t.data);
|
||
return i.length > 0 && (r = i[0],
|
||
e = e.groupBy(r).select(function(t) {
|
||
var e = new g(n).filter([{
|
||
field: t.field,
|
||
operator: "eq",
|
||
value: t.value,
|
||
ignoreCase: !1
|
||
}]);
|
||
return {
|
||
field: t.field,
|
||
value: t.value,
|
||
items: i.length > 1 ? new g(t.items).group(i.slice(1), e.toArray()).toArray() : t.items,
|
||
hasSubgroups: i.length > 1,
|
||
aggregates: e.aggregate(r.aggregates)
|
||
}
|
||
})),
|
||
e
|
||
},
|
||
groupBy: function(t) {
|
||
var e, i, n, r, a, s, o, c, l, d, u = this;
|
||
if (f(t) || !this.data.length)
|
||
return new g([]);
|
||
for (e = t.field,
|
||
i = t.skipItemSorting ? this.data : this._sortForGrouping(e, t.dir || "asc"),
|
||
n = P.accessor(e),
|
||
a = n.get(i[0], e),
|
||
s = {
|
||
field: e,
|
||
value: a,
|
||
items: []
|
||
},
|
||
d = [s],
|
||
c = 0,
|
||
l = i.length; c < l; c++)
|
||
r = i[c],
|
||
o = n.get(r, e),
|
||
J(a, o) || (a = o,
|
||
s = {
|
||
field: e,
|
||
value: a,
|
||
items: []
|
||
},
|
||
d.push(s)),
|
||
s.items.push(r);
|
||
return d = u._sortGroups(d, t),
|
||
new g(d)
|
||
},
|
||
_sortForGrouping: function(t, e) {
|
||
var i, n, r = this.data;
|
||
if (!ee) {
|
||
for (i = 0,
|
||
n = r.length; i < n; i++)
|
||
r[i].__position = i;
|
||
for (r = new g(r).sort(t, e, Ct).toArray(),
|
||
i = 0,
|
||
n = r.length; i < n; i++)
|
||
delete r[i].__position;
|
||
return r
|
||
}
|
||
return this.sort(t, e).toArray()
|
||
},
|
||
_sortGroups: function(t, e) {
|
||
var i = t;
|
||
return e && T(e.compare) && (i = new g(i).order({
|
||
compare: e.compare
|
||
}, e.dir || Ut).toArray()),
|
||
i
|
||
},
|
||
aggregate: function(t) {
|
||
var e, i, n = {}, r = {};
|
||
if (t && t.length)
|
||
for (e = 0,
|
||
i = this.data.length; e < i; e++)
|
||
Y(n, t, this.data[e], e, i, r);
|
||
return n
|
||
}
|
||
},
|
||
Pt = {
|
||
sum: function(t, e, i) {
|
||
var n = i.get(e);
|
||
return o(t) ? o(n) && (t += n) : t = n,
|
||
t
|
||
},
|
||
count: function(t) {
|
||
return (t || 0) + 1
|
||
},
|
||
average: function(t, e, i, n, r, a) {
|
||
var s = i.get(e);
|
||
return a.count === y && (a.count = 0),
|
||
o(t) ? o(s) && (t += s) : t = s,
|
||
o(s) && a.count++,
|
||
n == r - 1 && o(t) && (t /= a.count),
|
||
t
|
||
},
|
||
max: function(t, e, i) {
|
||
var n = i.get(e);
|
||
return o(t) || r(t) || (t = n),
|
||
t < n && (o(n) || r(n)) && (t = n),
|
||
t
|
||
},
|
||
min: function(t, e, i) {
|
||
var n = i.get(e);
|
||
return o(t) || r(t) || (t = n),
|
||
t > n && (o(n) || r(n)) && (t = n),
|
||
t
|
||
}
|
||
},
|
||
g.normalizeGroup = m,
|
||
g.normalizeSort = b,
|
||
g.process = function(t, e, i) {
|
||
var n, r, a, s, o, c, l, d, u, p, h, f;
|
||
return e = e || {},
|
||
n = e.group,
|
||
r = Q(m(n || [])),
|
||
a = new g(t),
|
||
s = W(n || []),
|
||
o = b(e.sort || []),
|
||
c = r ? o : s.concat(o),
|
||
u = e.filterCallback,
|
||
p = e.filter,
|
||
h = e.skip,
|
||
f = e.take,
|
||
c && i && (a = a.sort(c, y, y, i)),
|
||
p && (a = a.filter(p),
|
||
u && (a = u(a)),
|
||
d = a.toArray().length),
|
||
c && !i && (a = a.sort(c),
|
||
n && (t = a.toArray())),
|
||
r ? (a = a.group(n, t),
|
||
h !== y && f !== y && (a = new g(rt(a.toArray())).range(h, f),
|
||
l = yt(s, function(t) {
|
||
return x({}, t, {
|
||
skipItemSorting: !0
|
||
})
|
||
}),
|
||
a = a.group(l, t))) : (h !== y && f !== y && (a = a.range(h, f)),
|
||
n && (a = a.group(n, t))),
|
||
{
|
||
total: d,
|
||
data: a.toArray()
|
||
}
|
||
}
|
||
,
|
||
Tt = qt.extend({
|
||
init: function(t) {
|
||
this.data = t.data
|
||
},
|
||
read: function(t) {
|
||
t.success(this.data)
|
||
},
|
||
update: function(t) {
|
||
t.success(t.data)
|
||
},
|
||
create: function(t) {
|
||
t.success(t.data)
|
||
},
|
||
destroy: function(t) {
|
||
t.success(t.data)
|
||
}
|
||
}),
|
||
Dt = qt.extend({
|
||
init: function(i) {
|
||
var n, t = this;
|
||
i = t.options = x({}, t.options, i),
|
||
Rt(Gt, function(t, e) {
|
||
typeof i[e] === N && (i[e] = {
|
||
url: i[e]
|
||
})
|
||
}),
|
||
t.cache = i.cache ? s.create(i.cache) : {
|
||
find: S,
|
||
add: S
|
||
},
|
||
n = i.parameterMap,
|
||
i.submit && (t.submit = i.submit),
|
||
T(i.push) && (t.push = i.push),
|
||
t.push || (t.push = e),
|
||
t.parameterMap = T(n) ? n : function(t) {
|
||
var i = {};
|
||
return Rt(t, function(t, e) {
|
||
t in n && (t = n[t],
|
||
C(t) && (e = t.value(e),
|
||
t = t.key)),
|
||
i[t] = e
|
||
}),
|
||
i
|
||
}
|
||
},
|
||
options: {
|
||
parameterMap: e
|
||
},
|
||
create: function(t) {
|
||
return Ft(this.setup(t, zt))
|
||
},
|
||
read: function(e) {
|
||
var i, t, n, r = this, a = r.cache;
|
||
e = r.setup(e, jt),
|
||
i = e.success || S,
|
||
t = e.error || S,
|
||
n = a.find(e.data),
|
||
n !== y ? i(n) : (e.success = function(t) {
|
||
a.add(e.data, t),
|
||
i(t)
|
||
}
|
||
,
|
||
v.ajax(e))
|
||
},
|
||
update: function(t) {
|
||
return Ft(this.setup(t, Ht))
|
||
},
|
||
destroy: function(t) {
|
||
return Ft(this.setup(t, Bt))
|
||
},
|
||
setup: function(t, e) {
|
||
t = t || {};
|
||
var i, n = this, r = n.options[e], a = T(r.data) ? r.data(t.data) : r.data;
|
||
return t = x(!0, {}, r, t),
|
||
i = x(!0, {}, a, t.data),
|
||
t.data = n.parameterMap(i, e),
|
||
T(t.url) && (t.url = t.url(i)),
|
||
t
|
||
}
|
||
}),
|
||
(s = qt.extend({
|
||
init: function() {
|
||
this._store = {}
|
||
},
|
||
add: function(t, e) {
|
||
t !== y && (this._store[Wt(t)] = e)
|
||
},
|
||
find: function(t) {
|
||
return this._store[Wt(t)]
|
||
},
|
||
clear: function() {
|
||
this._store = {}
|
||
},
|
||
remove: function(t) {
|
||
delete this._store[Wt(t)]
|
||
}
|
||
})).create = function(t) {
|
||
var e = {
|
||
inmemory: function() {
|
||
return new s
|
||
}
|
||
};
|
||
return C(t) && T(t.find) ? t : t === !0 ? new s : e[t]()
|
||
}
|
||
,
|
||
Nt = qt.extend({
|
||
init: function(t) {
|
||
var e, i, n, r, a, s, o, c, l, d, u, p, h, f, g = this;
|
||
t = t || {};
|
||
for (e in t)
|
||
i = t[e],
|
||
g[e] = typeof i === N ? F(i) : i;
|
||
r = t.modelBase || _,
|
||
C(g.model) && (g.model = n = r.define(g.model)),
|
||
a = w(g.data, g),
|
||
g._dataAccessFunction = a,
|
||
g.model && (s = w(g.groups, g),
|
||
o = w(g.serialize, g),
|
||
c = {},
|
||
l = {},
|
||
d = {},
|
||
u = {},
|
||
p = !1,
|
||
n = g.model,
|
||
n.fields && (Rt(n.fields, function(t, e) {
|
||
var i;
|
||
h = t,
|
||
C(e) && e.field ? h = e.field : typeof e === N && (h = e),
|
||
C(e) && e.from && (i = e.from),
|
||
p = p || i && i !== t || h !== t,
|
||
f = i || h,
|
||
l[t] = f.indexOf(".") !== -1 ? F(f, !0) : F(f),
|
||
d[t] = F(t),
|
||
c[i || h] = t,
|
||
u[t] = i || h
|
||
}),
|
||
!t.serialize && p && (g.serialize = tt(o, n, Z, d, c, u))),
|
||
g._dataAccessFunction = a,
|
||
g._wrapDataAccessBase = et(n, K, l, c, u),
|
||
g.data = tt(a, n, K, l, c, u),
|
||
g.groups = tt(s, n, X, l, c, u))
|
||
},
|
||
errors: function(t) {
|
||
return t ? t.errors : null
|
||
},
|
||
parse: e,
|
||
data: e,
|
||
total: function(t) {
|
||
return t.length
|
||
},
|
||
groups: e,
|
||
aggregates: function() {
|
||
return {}
|
||
},
|
||
serialize: function(t) {
|
||
return t
|
||
}
|
||
}),
|
||
p = D.extend({
|
||
init: function(t) {
|
||
var e, i, n, r = this;
|
||
t && (i = t.data),
|
||
t = r.options = x({}, r.options, t),
|
||
r._map = {},
|
||
r._prefetch = {},
|
||
r._data = [],
|
||
r._pristineData = [],
|
||
r._ranges = [],
|
||
r._view = [],
|
||
r._pristineTotal = 0,
|
||
r._destroyed = [],
|
||
r._pageSize = t.pageSize,
|
||
r._page = t.page || (t.pageSize ? 1 : y),
|
||
r._sort = b(t.sort),
|
||
r._filter = u(t.filter),
|
||
r._group = m(t.group),
|
||
r._aggregate = t.aggregate,
|
||
r._total = t.total,
|
||
r._shouldDetachObservableParents = !0,
|
||
D.fn.init.call(r),
|
||
r.transport = Mt.create(t, i, r),
|
||
T(r.transport.push) && r.transport.push({
|
||
pushCreate: w(r._pushCreate, r),
|
||
pushUpdate: w(r._pushUpdate, r),
|
||
pushDestroy: w(r._pushDestroy, r)
|
||
}),
|
||
null != t.offlineStorage && ("string" == typeof t.offlineStorage ? (n = t.offlineStorage,
|
||
r._storage = {
|
||
getItem: function() {
|
||
return JSON.parse(localStorage.getItem(n))
|
||
},
|
||
setItem: function(t) {
|
||
localStorage.setItem(n, Wt(r.reader.serialize(t)))
|
||
}
|
||
}) : r._storage = t.offlineStorage),
|
||
r.reader = new P.data.readers[t.schema.type || "json"](t.schema),
|
||
e = r.reader.model || {},
|
||
r._detachObservableParents(),
|
||
r._data = r._observe(r._data),
|
||
r._online = !0,
|
||
r.bind(["push", A, M, O, Lt, E, I], t)
|
||
},
|
||
options: {
|
||
data: null,
|
||
schema: {
|
||
modelBase: _
|
||
},
|
||
offlineStorage: null,
|
||
serverSorting: !1,
|
||
serverPaging: !1,
|
||
serverFiltering: !1,
|
||
serverGrouping: !1,
|
||
serverAggregates: !1,
|
||
batch: !1,
|
||
inPlaceSort: !1
|
||
},
|
||
clone: function() {
|
||
return this
|
||
},
|
||
online: function(t) {
|
||
return t !== y ? this._online != t && (this._online = t,
|
||
t) ? this.sync() : v.Deferred().resolve().promise() : this._online
|
||
},
|
||
offlineData: function(t) {
|
||
return null == this.options.offlineStorage ? null : t !== y ? this._storage.setItem(t) : this._storage.getItem() || []
|
||
},
|
||
_isServerGrouped: function() {
|
||
var t = this.group() || [];
|
||
return this.options.serverGrouping && t.length
|
||
},
|
||
_pushCreate: function(t) {
|
||
this._push(t, "pushCreate")
|
||
},
|
||
_pushUpdate: function(t) {
|
||
this._push(t, "pushUpdate")
|
||
},
|
||
_pushDestroy: function(t) {
|
||
this._push(t, "pushDestroy")
|
||
},
|
||
_push: function(t, e) {
|
||
var i = this._readData(t);
|
||
i || (i = t),
|
||
this[e](i)
|
||
},
|
||
_flatData: function(t, e) {
|
||
if (t) {
|
||
if (this._isServerGrouped())
|
||
return at(t);
|
||
if (!e)
|
||
for (var i = 0; i < t.length; i++)
|
||
t.at(i)
|
||
}
|
||
return t
|
||
},
|
||
parent: S,
|
||
get: function(t) {
|
||
var e, i, n = this._flatData(this._data, this.options.useRanges);
|
||
for (e = 0,
|
||
i = n.length; e < i; e++)
|
||
if (n[e].id == t)
|
||
return n[e]
|
||
},
|
||
getByUid: function(t) {
|
||
return this._getByUid(t, this._data)
|
||
},
|
||
_getByUid: function(t, e) {
|
||
var i, n, r = this._flatData(e, this.options.useRanges);
|
||
if (r)
|
||
for (i = 0,
|
||
n = r.length; i < n; i++)
|
||
if (r[i].uid == t)
|
||
return r[i]
|
||
},
|
||
indexOf: function(t) {
|
||
return pt(this._data, t)
|
||
},
|
||
at: function(t) {
|
||
return this._data.at(t)
|
||
},
|
||
data: function(t) {
|
||
var e, i = this;
|
||
if (t === y) {
|
||
if (i._data)
|
||
for (e = 0; e < i._data.length; e++)
|
||
i._data.at(e);
|
||
return i._data
|
||
}
|
||
i._detachObservableParents(),
|
||
i._data = this._observe(t),
|
||
i._pristineData = t.slice(0),
|
||
i._storeData(),
|
||
i._ranges = [],
|
||
i.trigger("reset"),
|
||
i._addRange(i._data),
|
||
i._total = i._data.length,
|
||
i._pristineTotal = i._total,
|
||
i._process(i._data)
|
||
},
|
||
view: function(t) {
|
||
return t === y ? this._view : (this._view = this._observeView(t),
|
||
y)
|
||
},
|
||
_observeView: function(t) {
|
||
var e, i = this;
|
||
return lt(t, i._data, i._ranges, i.reader.model || d, i._isServerGrouped()),
|
||
e = new a(t,i.reader.model),
|
||
e.parent = function() {
|
||
return i.parent()
|
||
}
|
||
,
|
||
e
|
||
},
|
||
flatView: function() {
|
||
var t = this.group() || [];
|
||
return t.length ? at(this._view) : this._view
|
||
},
|
||
add: function(t) {
|
||
return this.insert(this._data.length, t)
|
||
},
|
||
_createNewModel: function(t) {
|
||
return this.reader.model ? new this.reader.model(t) : t instanceof d ? t : new d(t)
|
||
},
|
||
insert: function(t, e) {
|
||
return e || (e = t,
|
||
t = 0),
|
||
e instanceof _ || (e = this._createNewModel(e)),
|
||
this._isServerGrouped() ? this._data.splice(t, 0, this._wrapInEmptyGroup(e)) : this._data.splice(t, 0, e),
|
||
this._insertModelInRange(t, e),
|
||
e
|
||
},
|
||
pushInsert: function(t, e) {
|
||
var i, n, r, a, s, o, c = this, l = c._getCurrentRangeSpan();
|
||
e || (e = t,
|
||
t = 0),
|
||
k(e) || (e = [e]),
|
||
i = [],
|
||
n = this.options.autoSync,
|
||
this.options.autoSync = !1;
|
||
try {
|
||
for (r = 0; r < e.length; r++)
|
||
a = e[r],
|
||
s = this.insert(t, a),
|
||
i.push(s),
|
||
o = s.toJSON(),
|
||
this._isServerGrouped() && (o = this._wrapInEmptyGroup(o)),
|
||
this._pristineData.push(o),
|
||
l && l.length && v(l).last()[0].pristineData.push(o),
|
||
t++
|
||
} finally {
|
||
this.options.autoSync = n
|
||
}
|
||
i.length && this.trigger("push", {
|
||
type: "create",
|
||
items: i
|
||
})
|
||
},
|
||
pushCreate: function(t) {
|
||
this.pushInsert(this._data.length, t)
|
||
},
|
||
pushUpdate: function(t) {
|
||
var e, i, n, r, a;
|
||
for (k(t) || (t = [t]),
|
||
e = [],
|
||
i = 0; i < t.length; i++)
|
||
n = t[i],
|
||
r = this._createNewModel(n),
|
||
a = this.get(r.id),
|
||
a ? (e.push(a),
|
||
a.accept(n),
|
||
a.trigger(M),
|
||
this._updatePristineForModel(a, n)) : this.pushCreate(n);
|
||
e.length && this.trigger("push", {
|
||
type: "update",
|
||
items: e
|
||
})
|
||
},
|
||
pushDestroy: function(t) {
|
||
var e = this._removeItems(t);
|
||
e.length && this.trigger("push", {
|
||
type: "destroy",
|
||
items: e
|
||
})
|
||
},
|
||
_removeItems: function(t, e) {
|
||
var i, n, r, a, s, o, c;
|
||
k(t) || (t = [t]),
|
||
i = y === e || e,
|
||
n = [],
|
||
r = this.options.autoSync,
|
||
this.options.autoSync = !1;
|
||
try {
|
||
for (a = 0; a < t.length; a++)
|
||
s = t[a],
|
||
o = this._createNewModel(s),
|
||
c = !1,
|
||
this._eachItem(this._data, function(t) {
|
||
var e, i;
|
||
for (e = 0; e < t.length; e++)
|
||
if (i = t.at(e),
|
||
i.id === o.id) {
|
||
n.push(i),
|
||
t.splice(e, 1),
|
||
c = !0;
|
||
break
|
||
}
|
||
}),
|
||
c && i && (this._removePristineForModel(o),
|
||
this._destroyed.pop())
|
||
} finally {
|
||
this.options.autoSync = r
|
||
}
|
||
return n
|
||
},
|
||
remove: function(e) {
|
||
var i, n = this, r = n._isServerGrouped();
|
||
return this._eachItem(n._data, function(t) {
|
||
if (i = dt(t, e),
|
||
i && r)
|
||
return i.isNew && i.isNew() || n._destroyed.push(i),
|
||
!0
|
||
}),
|
||
this._removeModelFromRanges(e),
|
||
e
|
||
},
|
||
destroyed: function() {
|
||
return this._destroyed
|
||
},
|
||
created: function() {
|
||
var t, e, i = [], n = this._flatData(this._data, this.options.useRanges);
|
||
for (t = 0,
|
||
e = n.length; t < e; t++)
|
||
n[t].isNew && n[t].isNew() && i.push(n[t]);
|
||
return i
|
||
},
|
||
updated: function() {
|
||
var t, e, i = [], n = this._flatData(this._data, this.options.useRanges);
|
||
for (t = 0,
|
||
e = n.length; t < e; t++)
|
||
n[t].isNew && !n[t].isNew() && n[t].dirty && i.push(n[t]);
|
||
return i
|
||
},
|
||
sync: function() {
|
||
var t, i = this, e = [], n = [], r = i._destroyed, a = v.Deferred().resolve().promise();
|
||
if (i.online()) {
|
||
if (!i.reader.model)
|
||
return a;
|
||
e = i.created(),
|
||
n = i.updated(),
|
||
t = [],
|
||
i.options.batch && i.transport.submit ? t = i._sendSubmit(e, n, r) : (t.push.apply(t, i._send("create", e)),
|
||
t.push.apply(t, i._send("update", n)),
|
||
t.push.apply(t, i._send("destroy", r))),
|
||
a = v.when.apply(null, t).then(function() {
|
||
var t, e;
|
||
for (t = 0,
|
||
e = arguments.length; t < e; t++)
|
||
arguments[t] && i._accept(arguments[t]);
|
||
i._storeData(!0),
|
||
i._syncEnd(),
|
||
i._change({
|
||
action: "sync"
|
||
}),
|
||
i.trigger(Lt)
|
||
})
|
||
} else
|
||
i._storeData(!0),
|
||
i._syncEnd(),
|
||
i._change({
|
||
action: "sync"
|
||
});
|
||
return a
|
||
},
|
||
_syncEnd: S,
|
||
cancelChanges: function(t) {
|
||
var e = this;
|
||
t instanceof P.data.Model ? e._cancelModel(t) : (e._destroyed = [],
|
||
e._detachObservableParents(),
|
||
e._data = e._observe(e._pristineData),
|
||
e.options.serverPaging && (e._total = e._pristineTotal),
|
||
e._ranges = [],
|
||
e._addRange(e._data, 0),
|
||
e._changesCanceled(),
|
||
e._change(),
|
||
e._markOfflineUpdatesAsDirty())
|
||
},
|
||
_changesCanceled: S,
|
||
_markOfflineUpdatesAsDirty: function() {
|
||
var t = this;
|
||
null != t.options.offlineStorage && t._eachItem(t._data, function(t) {
|
||
var e, i;
|
||
for (e = 0; e < t.length; e++)
|
||
i = t.at(e),
|
||
"update" != i.__state__ && "create" != i.__state__ || (i.dirty = !0)
|
||
})
|
||
},
|
||
hasChanges: function() {
|
||
var t, e, i = this._flatData(this._data, this.options.useRanges);
|
||
if (this._destroyed.length)
|
||
return !0;
|
||
for (t = 0,
|
||
e = i.length; t < e; t++)
|
||
if (i[t].isNew && i[t].isNew() || i[t].dirty)
|
||
return !0;
|
||
return !1
|
||
},
|
||
_accept: function(t) {
|
||
var e, i = this, n = t.models, r = t.response, a = 0, s = i._isServerGrouped(), o = i._pristineData, c = t.type;
|
||
if (i.trigger(E, {
|
||
response: r,
|
||
type: c
|
||
}),
|
||
r && !f(r)) {
|
||
if (r = i.reader.parse(r),
|
||
i._handleCustomErrors(r))
|
||
return;
|
||
r = i.reader.data(r),
|
||
k(r) || (r = [r])
|
||
} else
|
||
r = v.map(n, function(t) {
|
||
return t.toJSON()
|
||
});
|
||
for ("destroy" === c && (i._destroyed = []),
|
||
a = 0,
|
||
e = n.length; a < e; a++)
|
||
"destroy" !== c ? (n[a].accept(r[a]),
|
||
"create" === c ? o.push(s ? i._wrapInEmptyGroup(n[a].toJSON()) : r[a]) : "update" === c && i._updatePristineForModel(n[a], r[a])) : i._removePristineForModel(n[a])
|
||
},
|
||
_updatePristineForModel: function(t, i) {
|
||
this._executeOnPristineForModel(t, function(t, e) {
|
||
P.deepExtend(e[t], i)
|
||
})
|
||
},
|
||
_executeOnPristineForModel: function(i, n) {
|
||
this._eachPristineItem(function(t) {
|
||
var e = ut(t, i);
|
||
if (e > -1)
|
||
return n(e, t),
|
||
!0
|
||
})
|
||
},
|
||
_removePristineForModel: function(t) {
|
||
this._executeOnPristineForModel(t, function(t, e) {
|
||
e.splice(t, 1)
|
||
})
|
||
},
|
||
_readData: function(t) {
|
||
var e = this._isServerGrouped() ? this.reader.groups : this.reader.data;
|
||
return e.call(this.reader, t)
|
||
},
|
||
_eachPristineItem: function(i) {
|
||
var n = this
|
||
, t = n.options
|
||
, e = n._getCurrentRangeSpan();
|
||
n._eachItem(n._pristineData, i),
|
||
t.serverPaging && t.useRanges && Rt(e, function(t, e) {
|
||
n._eachItem(e.pristineData, i)
|
||
})
|
||
},
|
||
_eachItem: function(t, e) {
|
||
t && t.length && (this._isServerGrouped() ? n(t, e) : e(t))
|
||
},
|
||
_pristineForModel: function(e) {
|
||
var i, n, t = function(t) {
|
||
if (n = ut(t, e),
|
||
n > -1)
|
||
return i = t[n],
|
||
!0
|
||
};
|
||
return this._eachPristineItem(t),
|
||
i
|
||
},
|
||
_cancelModel: function(i) {
|
||
var n = this
|
||
, r = this._pristineForModel(i);
|
||
this._eachItem(this._data, function(t) {
|
||
var e = pt(t, i);
|
||
e >= 0 && (!r || i.isNew() && !r.__state__ ? (n._modelCanceled(i),
|
||
t.splice(e, 1),
|
||
n._removeModelFromRanges(i)) : (t[e].accept(r),
|
||
"update" == r.__state__ && (t[e].dirty = !0)))
|
||
})
|
||
},
|
||
_modelCanceled: S,
|
||
_submit: function(r, t) {
|
||
var a = this;
|
||
a.trigger(O, {
|
||
type: "submit"
|
||
}),
|
||
a.trigger(I),
|
||
a.transport.submit(x({
|
||
success: function(t, e) {
|
||
var i = v.grep(r, function(t) {
|
||
return t.type == e
|
||
})[0];
|
||
i && i.resolve({
|
||
response: t,
|
||
models: i.models,
|
||
type: e
|
||
})
|
||
},
|
||
error: function(t, e, i) {
|
||
for (var n = 0; n < r.length; n++)
|
||
r[n].reject(t);
|
||
a.error(t, e, i)
|
||
}
|
||
}, t))
|
||
},
|
||
_sendSubmit: function(e, i, n) {
|
||
var t = this
|
||
, r = [];
|
||
return t.options.batch && (e.length && r.push(v.Deferred(function(t) {
|
||
t.type = "create",
|
||
t.models = e
|
||
})),
|
||
i.length && r.push(v.Deferred(function(t) {
|
||
t.type = "update",
|
||
t.models = i
|
||
})),
|
||
n.length && r.push(v.Deferred(function(t) {
|
||
t.type = "destroy",
|
||
t.models = n
|
||
})),
|
||
t._submit(r, {
|
||
data: {
|
||
created: t.reader.serialize(c(e)),
|
||
updated: t.reader.serialize(c(i)),
|
||
destroyed: t.reader.serialize(c(n))
|
||
}
|
||
})),
|
||
r
|
||
},
|
||
_promise: function(t, e, i) {
|
||
var r = this;
|
||
return v.Deferred(function(n) {
|
||
r.trigger(O, {
|
||
type: i
|
||
}),
|
||
r.trigger(I),
|
||
r.transport[i].call(r.transport, x({
|
||
success: function(t) {
|
||
n.resolve({
|
||
response: t,
|
||
models: e,
|
||
type: i
|
||
})
|
||
},
|
||
error: function(t, e, i) {
|
||
n.reject(t),
|
||
r.error(t, e, i)
|
||
}
|
||
}, t))
|
||
}).promise()
|
||
},
|
||
_send: function(t, e) {
|
||
var i, n, r = this, a = [], s = r.reader.serialize(c(e));
|
||
if (r.options.batch)
|
||
e.length && a.push(r._promise({
|
||
data: {
|
||
models: s
|
||
}
|
||
}, e, t));
|
||
else
|
||
for (i = 0,
|
||
n = e.length; i < n; i++)
|
||
a.push(r._promise({
|
||
data: s[i]
|
||
}, [e[i]], t));
|
||
return a
|
||
},
|
||
read: function(t) {
|
||
var e = this
|
||
, i = e._params(t)
|
||
, n = v.Deferred();
|
||
return e._queueRequest(i, function() {
|
||
var t = e.trigger(O, {
|
||
type: "read"
|
||
});
|
||
t ? (e._dequeueRequest(),
|
||
n.resolve(t)) : (e.trigger(I),
|
||
e._ranges = [],
|
||
e.trigger("reset"),
|
||
e.online() ? e.transport.read({
|
||
data: i,
|
||
success: function(t) {
|
||
e._ranges = [],
|
||
e.success(t, i),
|
||
n.resolve()
|
||
},
|
||
error: function() {
|
||
var t = q.call(arguments);
|
||
e.error.apply(e, t),
|
||
n.reject.apply(n, t)
|
||
}
|
||
}) : null != e.options.offlineStorage && (e.success(e.offlineData(), i),
|
||
n.resolve()))
|
||
}),
|
||
n.promise()
|
||
},
|
||
_readAggregates: function(t) {
|
||
return this.reader.aggregates(t)
|
||
},
|
||
success: function(t) {
|
||
var e, i, n, r, a, s, o, c, l, d, u, p = this, h = p.options;
|
||
if (p.trigger(E, {
|
||
response: t,
|
||
type: "read"
|
||
}),
|
||
p.online()) {
|
||
if (t = p.reader.parse(t),
|
||
p._handleCustomErrors(t))
|
||
return p._dequeueRequest(),
|
||
y;
|
||
p._total = p.reader.total(t),
|
||
p._pageSize > p._total && (p._pageSize = p._total,
|
||
p.options.pageSize && p.options.pageSize > p._pageSize && (p._pageSize = p.options.pageSize)),
|
||
p._aggregate && h.serverAggregates && (p._aggregateResult = p._readAggregates(t)),
|
||
t = p._readData(t),
|
||
p._destroyed = []
|
||
} else {
|
||
for (t = p._readData(t),
|
||
e = [],
|
||
n = {},
|
||
r = p.reader.model,
|
||
a = r ? r.idField : "id",
|
||
s = 0; s < this._destroyed.length; s++)
|
||
o = this._destroyed[s][a],
|
||
n[o] = o;
|
||
for (s = 0; s < t.length; s++)
|
||
c = t[s],
|
||
l = c.__state__,
|
||
"destroy" == l ? n[c[a]] || this._destroyed.push(this._createNewModel(c)) : e.push(c);
|
||
t = e,
|
||
p._total = t.length
|
||
}
|
||
if (p._pristineTotal = p._total,
|
||
i = p._skip && p._data.length && p._skip < p._data.length,
|
||
p.options.endless)
|
||
for (i && p._pristineData.splice(p._skip, p._pristineData.length),
|
||
e = t.slice(0),
|
||
d = 0; d < e.length; d++)
|
||
p._pristineData.push(e[d]);
|
||
else
|
||
p._pristineData = t.slice(0);
|
||
if (p._detachObservableParents(),
|
||
p.options.endless) {
|
||
for (p._data.unbind(M, p._changeHandler),
|
||
p._isServerGrouped() && p._data[p._data.length - 1].value === t[0].value && (it(p._data[p._data.length - 1], t[0]),
|
||
t.shift()),
|
||
t = p._observe(t),
|
||
i && p._data.splice(p._skip, p._data.length),
|
||
u = 0; u < t.length; u++)
|
||
p._data.push(t[u]);
|
||
p._data.bind(M, p._changeHandler)
|
||
} else
|
||
p._data = p._observe(t);
|
||
p._markOfflineUpdatesAsDirty(),
|
||
p._storeData(),
|
||
p._addRange(p._data),
|
||
p._process(p._data),
|
||
p._dequeueRequest()
|
||
},
|
||
_detachObservableParents: function() {
|
||
if (this._data && this._shouldDetachObservableParents)
|
||
for (var t = 0; t < this._data.length; t++)
|
||
this._data[t].parent && (this._data[t].parent = S)
|
||
},
|
||
_storeData: function(t) {
|
||
function a(t) {
|
||
var e, i, n, r = [];
|
||
for (e = 0; e < t.length; e++)
|
||
i = t.at(e),
|
||
n = i.toJSON(),
|
||
s && i.items ? n.items = a(i.items) : (n.uid = i.uid,
|
||
o && (i.isNew() ? n.__state__ = "create" : i.dirty && (n.__state__ = "update"))),
|
||
r.push(n);
|
||
return r
|
||
}
|
||
var e, i, n, r, s = this._isServerGrouped(), o = this.reader.model;
|
||
if (null != this.options.offlineStorage) {
|
||
for (e = a(this._data),
|
||
i = [],
|
||
n = 0; n < this._destroyed.length; n++)
|
||
r = this._destroyed[n].toJSON(),
|
||
r.__state__ = "destroy",
|
||
i.push(r);
|
||
this.offlineData(e.concat(i)),
|
||
t && (this._pristineData = this.reader.reader ? this.reader.reader._wrapDataAccessBase(e) : this.reader._wrapDataAccessBase(e))
|
||
}
|
||
},
|
||
_addRange: function(t, e) {
|
||
var i = this
|
||
, n = y !== e ? e : i._skip || 0
|
||
, r = n + i._flatData(t, !0).length;
|
||
i._ranges.push({
|
||
start: n,
|
||
end: r,
|
||
data: t,
|
||
pristineData: t.toJSON(),
|
||
timestamp: i._timeStamp()
|
||
}),
|
||
i._sortRanges()
|
||
},
|
||
_sortRanges: function() {
|
||
this._ranges.sort(function(t, e) {
|
||
return t.start - e.start
|
||
})
|
||
},
|
||
error: function(t, e, i) {
|
||
this._dequeueRequest(),
|
||
this.trigger(E, {}),
|
||
this.trigger(A, {
|
||
xhr: t,
|
||
status: e,
|
||
errorThrown: i
|
||
})
|
||
},
|
||
_params: function(t) {
|
||
var e = this
|
||
, i = x({
|
||
take: e.take(),
|
||
skip: e.skip(),
|
||
page: e.page(),
|
||
pageSize: e.pageSize(),
|
||
sort: e._sort,
|
||
filter: e._filter,
|
||
group: e._group,
|
||
aggregate: e._aggregate
|
||
}, t);
|
||
return e.options.serverPaging || (delete i.take,
|
||
delete i.skip,
|
||
delete i.page,
|
||
delete i.pageSize),
|
||
e.options.serverGrouping ? e.reader.model && i.group && (i.group = l(i.group, e.reader.model)) : delete i.group,
|
||
e.options.serverFiltering ? e.reader.model && i.filter && (i.filter = gt(i.filter, e.reader.model)) : delete i.filter,
|
||
e.options.serverSorting ? e.reader.model && i.sort && (i.sort = l(i.sort, e.reader.model)) : delete i.sort,
|
||
e.options.serverAggregates ? e.reader.model && i.aggregate && (i.aggregate = l(i.aggregate, e.reader.model)) : delete i.aggregate,
|
||
i
|
||
},
|
||
_queueRequest: function(t, e) {
|
||
var i = this;
|
||
i._requestInProgress ? i._pending = {
|
||
callback: w(e, i),
|
||
options: t
|
||
} : (i._requestInProgress = !0,
|
||
i._pending = y,
|
||
e())
|
||
},
|
||
_dequeueRequest: function() {
|
||
var t = this;
|
||
t._requestInProgress = !1,
|
||
t._pending && t._queueRequest(t._pending.options, t._pending.callback)
|
||
},
|
||
_handleCustomErrors: function(t) {
|
||
if (this.reader.errors) {
|
||
var e = this.reader.errors(t);
|
||
if (e)
|
||
return this.trigger(A, {
|
||
xhr: null,
|
||
status: "customerror",
|
||
errorThrown: "custom error",
|
||
errors: e
|
||
}),
|
||
!0
|
||
}
|
||
return !1
|
||
},
|
||
_shouldWrap: function(t) {
|
||
var e = this.reader.model;
|
||
return !(!e || !t.length) && !(t[0]instanceof e)
|
||
},
|
||
_observe: function(t) {
|
||
var e, i = this, n = i.reader.model;
|
||
return i._shouldDetachObservableParents = !0,
|
||
t instanceof $ ? (i._shouldDetachObservableParents = !1,
|
||
i._shouldWrap(t) && (t.type = i.reader.model,
|
||
t.wrapAll(t, t))) : (e = i.pageSize() && !i.options.serverPaging ? a : $,
|
||
t = new e(t,i.reader.model),
|
||
t.parent = function() {
|
||
return i.parent()
|
||
}
|
||
),
|
||
i._isServerGrouped() && st(t, n),
|
||
!(i._changeHandler && i._data && i._data instanceof $) || i.options.useRanges && i.options.serverPaging ? i._changeHandler = w(i._change, i) : i._data.unbind(M, i._changeHandler),
|
||
t.bind(M, i._changeHandler)
|
||
},
|
||
_updateTotalForAction: function(t, e) {
|
||
var i = this
|
||
, n = parseInt(i._total, 10);
|
||
o(i._total) || (n = parseInt(i._pristineTotal, 10)),
|
||
"add" === t ? n += e.length : "remove" === t ? n -= e.length : "itemchange" === t || "sync" === t || i.options.serverPaging ? "sync" === t && (n = i._pristineTotal = parseInt(i._total, 10)) : n = i._pristineTotal,
|
||
i._total = n
|
||
},
|
||
_change: function(e) {
|
||
var t, i, n, r = this, a = e ? e.action : "";
|
||
if ("remove" === a)
|
||
for (t = 0,
|
||
i = e.items.length; t < i; t++)
|
||
e.items[t].isNew && e.items[t].isNew() || r._destroyed.push(e.items[t]);
|
||
!r.options.autoSync || "add" !== a && "remove" !== a && "itemchange" !== a ? (r._updateTotalForAction(a, e ? e.items : []),
|
||
r._process(r._data, e)) : (n = function(t) {
|
||
"sync" === t.action && (r.unbind("change", n),
|
||
r._updateTotalForAction(a, e.items))
|
||
}
|
||
,
|
||
r.first("change", n),
|
||
r.sync())
|
||
},
|
||
_calculateAggregates: function(t, e) {
|
||
e = e || {};
|
||
var i = new g(t)
|
||
, n = e.aggregate
|
||
, r = e.filter;
|
||
return r && (i = i.filter(r)),
|
||
i.aggregate(n)
|
||
},
|
||
_process: function(t, e) {
|
||
var i, n = this, r = {};
|
||
n.options.serverPaging !== !0 && (r.skip = n._skip,
|
||
r.take = n._take || n._pageSize,
|
||
r.skip === y && n._page !== y && n._pageSize !== y && (r.skip = (n._page - 1) * n._pageSize),
|
||
n.options.useRanges && (r.skip = n.currentRangeStart())),
|
||
n.options.serverSorting !== !0 && (r.sort = n._sort),
|
||
n.options.serverFiltering !== !0 && (r.filter = n._filter),
|
||
n.options.serverGrouping !== !0 && (r.group = n._group),
|
||
n.options.serverAggregates !== !0 && (r.aggregate = n._aggregate),
|
||
n.options.serverGrouping && n._clearEmptyGroups(t),
|
||
i = n._queryProcess(t, r),
|
||
n.options.serverAggregates !== !0 && (n._aggregateResult = n._calculateAggregates(i.dataToAggregate || t, r)),
|
||
n.view(i.data),
|
||
n._setFilterTotal(i.total, !1),
|
||
e = e || {},
|
||
e.items = e.items || n._view,
|
||
n.trigger(M, e)
|
||
},
|
||
_clearEmptyGroups: function(t) {
|
||
var e, i;
|
||
for (e = t.length - 1; e >= 0; e--)
|
||
i = t[e],
|
||
i.hasSubgroups ? this._clearEmptyGroups(i.items) : i.items && !i.items.length && Zt.apply(i.parent(), [e, 1])
|
||
},
|
||
_queryProcess: function(t, e) {
|
||
return this.options.inPlaceSort ? g.process(t, e, this.options.inPlaceSort) : g.process(t, e)
|
||
},
|
||
_mergeState: function(t) {
|
||
var e = this;
|
||
return t !== y && (e._pageSize = t.pageSize,
|
||
e._page = t.page,
|
||
e._sort = t.sort,
|
||
e._filter = t.filter,
|
||
e._group = t.group,
|
||
e._aggregate = t.aggregate,
|
||
e._skip = e._currentRangeStart = t.skip,
|
||
e._take = t.take,
|
||
e._skip === y && (e._skip = e._currentRangeStart = e.skip(),
|
||
t.skip = e.skip()),
|
||
e._take === y && e._pageSize !== y && (e._take = e._pageSize,
|
||
t.take = e._take),
|
||
t.sort && (e._sort = t.sort = b(t.sort)),
|
||
t.filter && (e._filter = t.filter = u(t.filter)),
|
||
t.group && (e._group = t.group = m(t.group)),
|
||
t.aggregate && (e._aggregate = t.aggregate = i(t.aggregate))),
|
||
t
|
||
},
|
||
query: function(t) {
|
||
var e, i, n, r = this.options.serverSorting || this.options.serverPaging || this.options.serverFiltering || this.options.serverGrouping || this.options.serverAggregates;
|
||
return r || (this._data === y || 0 === this._data.length) && !this._destroyed.length ? (this.options.endless && (i = t.pageSize - this.pageSize(),
|
||
i > 0 ? (i = this.pageSize(),
|
||
t.page = t.pageSize / i,
|
||
t.pageSize = i) : (t.page = 1,
|
||
this.options.endless = !1)),
|
||
this.read(this._mergeState(t))) : (n = this.trigger(O, {
|
||
type: "read"
|
||
}),
|
||
n || (this.trigger(I),
|
||
e = this._queryProcess(this._data, this._mergeState(t)),
|
||
this._setFilterTotal(e.total, !0),
|
||
this._aggregateResult = this._calculateAggregates(e.dataToAggregate || this._data, t),
|
||
this.view(e.data),
|
||
this.trigger(E, {
|
||
type: "read"
|
||
}),
|
||
this.trigger(M, {
|
||
items: e.data
|
||
})),
|
||
v.Deferred().resolve(n).promise())
|
||
},
|
||
_setFilterTotal: function(t, e) {
|
||
var i = this;
|
||
i.options.serverFiltering || (t !== y ? i._total = t : e && (i._total = i._data.length))
|
||
},
|
||
fetch: function(e) {
|
||
var i = this
|
||
, t = function(t) {
|
||
t !== !0 && T(e) && e.call(i)
|
||
};
|
||
return this._query().done(t)
|
||
},
|
||
_query: function(t) {
|
||
var e = this;
|
||
return e.query(x({}, {
|
||
page: e.page(),
|
||
pageSize: e.pageSize(),
|
||
sort: e.sort(),
|
||
filter: e.filter(),
|
||
group: e.group(),
|
||
aggregate: e.aggregate()
|
||
}, t))
|
||
},
|
||
next: function(t) {
|
||
var e = this
|
||
, i = e.page()
|
||
, n = e.total();
|
||
if (t = t || {},
|
||
i && !(n && i + 1 > e.totalPages()))
|
||
return e._skip = e._currentRangeStart = i * e.take(),
|
||
i += 1,
|
||
t.page = i,
|
||
e._query(t),
|
||
i
|
||
},
|
||
prev: function(t) {
|
||
var e = this
|
||
, i = e.page();
|
||
if (t = t || {},
|
||
i && 1 !== i)
|
||
return e._skip = e._currentRangeStart = e._skip - e.take(),
|
||
i -= 1,
|
||
t.page = i,
|
||
e._query(t),
|
||
i
|
||
},
|
||
page: function(t) {
|
||
var e, i = this;
|
||
return t !== y ? (t = R.max(R.min(R.max(t, 1), i.totalPages()), 1),
|
||
i._query(i._pageableQueryOptions({
|
||
page: t
|
||
})),
|
||
y) : (e = i.skip(),
|
||
e !== y ? R.round((e || 0) / (i.take() || 1)) + 1 : y)
|
||
},
|
||
pageSize: function(t) {
|
||
var e = this;
|
||
return t !== y ? (e._query(e._pageableQueryOptions({
|
||
pageSize: t,
|
||
page: 1
|
||
})),
|
||
y) : e.take()
|
||
},
|
||
sort: function(t) {
|
||
var e = this;
|
||
return t !== y ? (e._query({
|
||
sort: t
|
||
}),
|
||
y) : e._sort
|
||
},
|
||
filter: function(t) {
|
||
var e = this;
|
||
return t === y ? e._filter : (e.trigger("reset"),
|
||
e._query({
|
||
filter: t,
|
||
page: 1
|
||
}),
|
||
y)
|
||
},
|
||
group: function(t) {
|
||
var e = this;
|
||
return t !== y ? (e._query({
|
||
group: t
|
||
}),
|
||
y) : e._group
|
||
},
|
||
total: function() {
|
||
return parseInt(this._total || 0, 10)
|
||
},
|
||
aggregate: function(t) {
|
||
var e = this;
|
||
return t !== y ? (e._query({
|
||
aggregate: t
|
||
}),
|
||
y) : e._aggregate
|
||
},
|
||
aggregates: function() {
|
||
var t = this._aggregateResult;
|
||
return f(t) && (t = this._emptyAggregates(this.aggregate())),
|
||
t
|
||
},
|
||
_emptyAggregates: function(t) {
|
||
var e, i, n = {};
|
||
if (!f(t))
|
||
for (e = {},
|
||
k(t) || (t = [t]),
|
||
i = 0; i < t.length; i++)
|
||
e[t[i].aggregate] = 0,
|
||
n[t[i].field] = e;
|
||
return n
|
||
},
|
||
_pageableQueryOptions: function(t) {
|
||
return t
|
||
},
|
||
_wrapInEmptyGroup: function(t) {
|
||
var e, i, n, r, a = this.group();
|
||
for (n = a.length - 1,
|
||
r = 0; n >= r; n--)
|
||
i = a[n],
|
||
e = {
|
||
value: t.get ? t.get(i.field) : t[i.field],
|
||
field: i.field,
|
||
items: e ? [e] : [t],
|
||
hasSubgroups: !!e,
|
||
aggregates: this._emptyAggregates(i.aggregates)
|
||
};
|
||
return e
|
||
},
|
||
totalPages: function() {
|
||
var t = this
|
||
, e = t.pageSize() || t.total();
|
||
return R.ceil((t.total() || 0) / e)
|
||
},
|
||
inRange: function(t, e) {
|
||
var i = this
|
||
, n = R.min(t + e, i.total());
|
||
return !i.options.serverPaging && i._data.length > 0 || i._findRange(t, n).length > 0
|
||
},
|
||
lastRange: function() {
|
||
var t = this._ranges;
|
||
return t[t.length - 1] || {
|
||
start: 0,
|
||
end: 0,
|
||
data: []
|
||
}
|
||
},
|
||
firstItemUid: function() {
|
||
var t = this._ranges;
|
||
return t.length && t[0].data.length && t[0].data[0].uid
|
||
},
|
||
enableRequestsInProgress: function() {
|
||
this._skipRequestsInProgress = !1
|
||
},
|
||
_timeStamp: function() {
|
||
return (new Date).getTime()
|
||
},
|
||
range: function(t, e, i) {
|
||
this._currentRequestTimeStamp = this._timeStamp(),
|
||
this._skipRequestsInProgress = !0,
|
||
t = R.min(t || 0, this.total()),
|
||
i = T(i) ? i : S;
|
||
var n, r = this, a = R.max(R.floor(t / e), 0) * e, s = R.min(a + e, r.total());
|
||
return n = r._findRange(t, R.min(t + e, r.total())),
|
||
n.length || 0 === r.total() ? (r._processRangeData(n, t, e, a, s),
|
||
i(),
|
||
y) : (e !== y && (r._rangeExists(a, s) ? a < t && r.prefetch(s, e, function() {
|
||
r.range(t, e, i)
|
||
}) : r.prefetch(a, e, function() {
|
||
t > a && s < r.total() && !r._rangeExists(s, R.min(s + e, r.total())) ? r.prefetch(s, e, function() {
|
||
r.range(t, e, i)
|
||
}) : r.range(t, e, i)
|
||
})),
|
||
y)
|
||
},
|
||
_findRange: function(t, e) {
|
||
var i, n, r, a, s, o, c, l, d, u, p, h, f = this, g = f._ranges, m = [], v = f.options, _ = v.serverSorting || v.serverPaging || v.serverFiltering || v.serverGrouping || v.serverAggregates;
|
||
for (n = 0,
|
||
p = g.length; n < p; n++)
|
||
if (i = g[n],
|
||
t >= i.start && t <= i.end) {
|
||
for (u = 0,
|
||
r = n; r < p; r++)
|
||
if (i = g[r],
|
||
d = f._flatData(i.data, !0),
|
||
d.length && t + u >= i.start && (o = i.data,
|
||
c = i.end,
|
||
_ || (v.inPlaceSort ? l = f._queryProcess(i.data, {
|
||
filter: f.filter()
|
||
}) : (h = W(f.group() || []).concat(b(f.sort() || [])),
|
||
l = f._queryProcess(i.data, {
|
||
sort: h,
|
||
filter: f.filter()
|
||
})),
|
||
d = o = l.data,
|
||
l.total !== y && (c = l.total)),
|
||
a = 0,
|
||
t + u > i.start && (a = t + u - i.start),
|
||
s = d.length,
|
||
c > e && (s -= c - e),
|
||
u += s - a,
|
||
m = f._mergeGroups(m, o, a, s),
|
||
e <= i.end && u == e - t))
|
||
return m;
|
||
break
|
||
}
|
||
return []
|
||
},
|
||
_mergeGroups: function(t, e, i, n) {
|
||
if (this._isServerGrouped()) {
|
||
var r, a = e.toJSON();
|
||
return t.length && (r = t[t.length - 1]),
|
||
nt(r, a, i, n),
|
||
t.concat(a)
|
||
}
|
||
return t.concat(e.slice(i, n))
|
||
},
|
||
_processRangeData: function(t, e, i, n, r) {
|
||
var a, s, o, c, l = this;
|
||
l._pending = y,
|
||
l._skip = e > l.skip() ? R.min(r, (l.totalPages() - 1) * l.take()) : n,
|
||
l._currentRangeStart = e,
|
||
l._take = i,
|
||
a = l.options.serverPaging,
|
||
s = l.options.serverSorting,
|
||
o = l.options.serverFiltering,
|
||
c = l.options.serverAggregates;
|
||
try {
|
||
l.options.serverPaging = !0,
|
||
l._isServerGrouped() || l.group() && l.group().length || (l.options.serverSorting = !0),
|
||
l.options.serverFiltering = !0,
|
||
l.options.serverPaging = !0,
|
||
l.options.serverAggregates = !0,
|
||
a && (l._detachObservableParents(),
|
||
l._data = t = l._observe(t)),
|
||
l._process(t)
|
||
} finally {
|
||
l.options.serverPaging = a,
|
||
l.options.serverSorting = s,
|
||
l.options.serverFiltering = o,
|
||
l.options.serverAggregates = c
|
||
}
|
||
},
|
||
skip: function() {
|
||
var t = this;
|
||
return t._skip === y ? t._page !== y ? (t._page - 1) * (t.take() || 1) : y : t._skip
|
||
},
|
||
currentRangeStart: function() {
|
||
return this._currentRangeStart || 0
|
||
},
|
||
take: function() {
|
||
return this._take || this._pageSize
|
||
},
|
||
_prefetchSuccessHandler: function(s, o, c, l) {
|
||
var d = this
|
||
, u = d._timeStamp();
|
||
return function(t) {
|
||
var e, i, n, r = !1, a = {
|
||
start: s,
|
||
end: o,
|
||
data: [],
|
||
timestamp: d._timeStamp()
|
||
};
|
||
if (d._dequeueRequest(),
|
||
d.trigger(E, {
|
||
response: t,
|
||
type: "read"
|
||
}),
|
||
t = d.reader.parse(t),
|
||
n = d._readData(t),
|
||
n.length) {
|
||
for (e = 0,
|
||
i = d._ranges.length; e < i; e++)
|
||
if (d._ranges[e].start === s) {
|
||
r = !0,
|
||
a = d._ranges[e],
|
||
a.pristineData = n,
|
||
a.data = d._observe(n),
|
||
a.end = a.start + d._flatData(a.data, !0).length,
|
||
d._sortRanges();
|
||
break
|
||
}
|
||
r || d._addRange(d._observe(n), s)
|
||
}
|
||
d._total = d.reader.total(t),
|
||
(l || u >= d._currentRequestTimeStamp || !d._skipRequestsInProgress) && (c && n.length ? c() : d.trigger(M, {}))
|
||
}
|
||
},
|
||
prefetch: function(t, e, i) {
|
||
var n = this
|
||
, r = R.min(t + e, n.total())
|
||
, a = {
|
||
take: e,
|
||
skip: t,
|
||
page: t / e + 1,
|
||
pageSize: e,
|
||
sort: n._sort,
|
||
filter: n._filter,
|
||
group: n._group,
|
||
aggregate: n._aggregate
|
||
};
|
||
n._rangeExists(t, r) ? i && i() : (clearTimeout(n._timeout),
|
||
n._timeout = setTimeout(function() {
|
||
n._queueRequest(a, function() {
|
||
n.trigger(O, {
|
||
type: "read"
|
||
}) ? n._dequeueRequest() : n.transport.read({
|
||
data: n._params(a),
|
||
success: n._prefetchSuccessHandler(t, r, i),
|
||
error: function() {
|
||
var t = q.call(arguments);
|
||
n.error.apply(n, t)
|
||
}
|
||
})
|
||
})
|
||
}, 100))
|
||
},
|
||
_multiplePrefetch: function(t, e, i) {
|
||
var n = this
|
||
, r = R.min(t + e, n.total())
|
||
, a = {
|
||
take: e,
|
||
skip: t,
|
||
page: t / e + 1,
|
||
pageSize: e,
|
||
sort: n._sort,
|
||
filter: n._filter,
|
||
group: n._group,
|
||
aggregate: n._aggregate
|
||
};
|
||
n._rangeExists(t, r) ? i && i() : n.trigger(O, {
|
||
type: "read"
|
||
}) || n.transport.read({
|
||
data: n._params(a),
|
||
success: n._prefetchSuccessHandler(t, r, i, !0)
|
||
})
|
||
},
|
||
_rangeExists: function(t, e) {
|
||
var i, n, r = this, a = r._ranges;
|
||
for (i = 0,
|
||
n = a.length; i < n; i++)
|
||
if (a[i].start <= t && a[i].end >= e)
|
||
return !0;
|
||
return !1
|
||
},
|
||
_getCurrentRangeSpan: function() {
|
||
var t, e, i = this, n = i._ranges, r = i.currentRangeStart(), a = r + (i.take() || 0), s = [], o = n.length;
|
||
for (e = 0; e < o; e++)
|
||
t = n[e],
|
||
(t.start <= r && t.end >= r || t.start >= r && t.start <= a) && s.push(t);
|
||
return s
|
||
},
|
||
_removeModelFromRanges: function(t) {
|
||
var e, i, n, r = this;
|
||
for (i = 0,
|
||
n = this._ranges.length; i < n; i++)
|
||
e = this._ranges[i],
|
||
r._removeModelFromRange(e, t);
|
||
r._updateRangesLength()
|
||
},
|
||
_removeModelFromRange: function(t, n) {
|
||
this._eachItem(t.data, function(t) {
|
||
var e, i;
|
||
for (e = 0; e < t.length; e++)
|
||
if (i = t[e],
|
||
i.uid && i.uid == n.uid) {
|
||
[].splice.call(t, e, 1);
|
||
break
|
||
}
|
||
})
|
||
},
|
||
_insertModelInRange: function(t, e) {
|
||
var i, n, r = this, a = r._ranges || [], s = a.length;
|
||
for (n = 0; n < s; n++)
|
||
if (i = a[n],
|
||
i.start <= t && i.end >= t) {
|
||
r._getByUid(e.uid, i.data) || (r._isServerGrouped() ? i.data.splice(t, 0, r._wrapInEmptyGroup(e)) : i.data.splice(t, 0, e));
|
||
break
|
||
}
|
||
r._updateRangesLength()
|
||
},
|
||
_updateRangesLength: function() {
|
||
var t, e, i = this, n = i._ranges || [], r = n.length, a = !1, s = 0, o = 0;
|
||
for (e = 0; e < r; e++)
|
||
t = n[e],
|
||
o = i._flatData(t.data, !0).length - R.abs(t.end - t.start),
|
||
a || 0 === o ? a && (t.start += s,
|
||
t.end += s) : (a = !0,
|
||
s = o,
|
||
t.end += s)
|
||
}
|
||
}),
|
||
Mt = {
|
||
create: function(t, e, i) {
|
||
var n, r = t.transport ? v.extend({}, t.transport) : null;
|
||
return r ? (r.read = typeof r.read === N ? {
|
||
url: r.read
|
||
} : r.read,
|
||
"jsdo" === t.type && (r.dataSource = i),
|
||
t.type && (P.data.transports = P.data.transports || {},
|
||
P.data.schemas = P.data.schemas || {},
|
||
P.data.transports[t.type] ? C(P.data.transports[t.type]) ? r = x(!0, {}, P.data.transports[t.type], r) : n = new P.data.transports[t.type](x(r, {
|
||
data: e
|
||
})) : P.logToConsole("Unknown DataSource transport type '" + t.type + "'.\nVerify that registration scripts for this type are included after Kendo UI on the page.", "warn"),
|
||
t.schema = x(!0, {}, P.data.schemas[t.type], t.schema)),
|
||
n || (n = T(r.read) ? r : new Dt(r))) : n = new Tt({
|
||
data: t.data || []
|
||
}),
|
||
n
|
||
}
|
||
},
|
||
p.create = function(t) {
|
||
(k(t) || t instanceof $) && (t = {
|
||
data: t
|
||
});
|
||
var e, i, n, r = t || {}, a = r.data, s = r.fields, o = r.table, c = r.select, l = {};
|
||
if (a || !s || r.transport || (o ? a = vt(o, s) : c && (a = mt(c, s),
|
||
r.group === y && a[0] && a[0].optgroup !== y && (r.group = "optgroup"))),
|
||
P.data.Model && s && (!r.schema || !r.schema.model)) {
|
||
for (e = 0,
|
||
i = s.length; e < i; e++)
|
||
n = s[e],
|
||
n.type && (l[n.field] = n);
|
||
f(l) || (r.schema = x(!0, r.schema, {
|
||
model: {
|
||
fields: l
|
||
}
|
||
}))
|
||
}
|
||
return r.data = a,
|
||
c = null,
|
||
r.select = null,
|
||
o = null,
|
||
r.table = null,
|
||
r instanceof p ? r : new p(r)
|
||
}
|
||
,
|
||
At = _.define({
|
||
idField: "id",
|
||
init: function(t) {
|
||
var e, i = this, n = i.hasChildren || t && t.hasChildren, r = "items", a = {};
|
||
P.data.Model.fn.init.call(i, t),
|
||
typeof i.children === N && (r = i.children),
|
||
a = {
|
||
schema: {
|
||
data: r,
|
||
model: {
|
||
hasChildren: n,
|
||
id: i.idField,
|
||
fields: i.fields
|
||
}
|
||
}
|
||
},
|
||
typeof i.children !== N && x(a, i.children),
|
||
a.data = t,
|
||
n || (n = a.schema.data),
|
||
typeof n === N && (n = P.getter(n)),
|
||
T(n) && (e = n.call(i, i),
|
||
i.hasChildren = (!e || 0 !== e.length) && !!e),
|
||
i._childrenOptions = a,
|
||
i.hasChildren && i._initChildren(),
|
||
i._loaded = !(!t || !t._loaded)
|
||
},
|
||
_initChildren: function() {
|
||
var t, e, i, n = this;
|
||
n.children instanceof h || (t = n.children = new h(n._childrenOptions),
|
||
e = t.transport,
|
||
i = e.parameterMap,
|
||
e.parameterMap = function(t, e) {
|
||
return t[n.idField || "id"] = n.id,
|
||
i && (t = i(t, e)),
|
||
t
|
||
}
|
||
,
|
||
t.parent = function() {
|
||
return n
|
||
}
|
||
,
|
||
t.bind(M, function(t) {
|
||
t.node = t.node || n,
|
||
n.trigger(M, t)
|
||
}),
|
||
t.bind(A, function(t) {
|
||
var e = n.parent();
|
||
e && (t.node = t.node || n,
|
||
e.trigger(A, t))
|
||
}),
|
||
n._updateChildrenField())
|
||
},
|
||
append: function(t) {
|
||
this._initChildren(),
|
||
this.loaded(!0),
|
||
this.children.add(t)
|
||
},
|
||
hasChildren: !1,
|
||
level: function() {
|
||
for (var t = this.parentNode(), e = 0; t && t.parentNode; )
|
||
e++,
|
||
t = t.parentNode ? t.parentNode() : null;
|
||
return e
|
||
},
|
||
_updateChildrenField: function() {
|
||
var t = this._childrenOptions.schema.data;
|
||
this[t || "items"] = this.children.data()
|
||
},
|
||
_childrenLoaded: function() {
|
||
this._loaded = !0,
|
||
this._updateChildrenField()
|
||
},
|
||
load: function() {
|
||
var t, e, i = {}, n = "_query";
|
||
return this.hasChildren ? (this._initChildren(),
|
||
t = this.children,
|
||
i[this.idField || "id"] = this.id,
|
||
this._loaded || (t._data = y,
|
||
n = "read"),
|
||
t.one(M, w(this._childrenLoaded, this)),
|
||
this._matchFilter && (i.filter = {
|
||
field: "_matchFilter",
|
||
operator: "eq",
|
||
value: !0
|
||
}),
|
||
e = t[n](i)) : this.loaded(!0),
|
||
e || v.Deferred().resolve().promise()
|
||
},
|
||
parentNode: function() {
|
||
var t = this.parent();
|
||
return t.parent()
|
||
},
|
||
loaded: function(t) {
|
||
return t === y ? this._loaded : (this._loaded = t,
|
||
y)
|
||
},
|
||
shouldSerialize: function(t) {
|
||
return _.fn.shouldSerialize.call(this, t) && "children" !== t && "_loaded" !== t && "hasChildren" !== t && "_childrenOptions" !== t
|
||
}
|
||
}),
|
||
(h = p.extend({
|
||
init: function(t) {
|
||
var e = At.define({
|
||
children: t
|
||
});
|
||
t.filter && !t.serverFiltering && (this._hierarchicalFilter = t.filter,
|
||
t.filter = null),
|
||
p.fn.init.call(this, x(!0, {}, {
|
||
schema: {
|
||
modelBase: e,
|
||
model: e
|
||
}
|
||
}, t)),
|
||
this._attachBubbleHandlers()
|
||
},
|
||
_attachBubbleHandlers: function() {
|
||
var e = this;
|
||
e._data.bind(A, function(t) {
|
||
e.trigger(A, t)
|
||
})
|
||
},
|
||
read: function(t) {
|
||
var e = p.fn.read.call(this, t);
|
||
return this._hierarchicalFilter && (this._data && this._data.length > 0 ? this.filter(this._hierarchicalFilter) : (this.options.filter = this._hierarchicalFilter,
|
||
this._filter = u(this.options.filter),
|
||
this._hierarchicalFilter = null)),
|
||
e
|
||
},
|
||
remove: function(t) {
|
||
var e, i = t.parentNode(), n = this;
|
||
return i && i._initChildren && (n = i.children),
|
||
e = p.fn.remove.call(n, t),
|
||
i && !n.data().length && (i.hasChildren = !1),
|
||
e
|
||
},
|
||
success: t("success"),
|
||
data: t("data"),
|
||
insert: function(t, e) {
|
||
var i = this.parent();
|
||
return i && i._initChildren && (i.hasChildren = !0,
|
||
i._initChildren()),
|
||
p.fn.insert.call(this, t, e)
|
||
},
|
||
filter: function(t) {
|
||
return t === y ? this._filter : (!this.options.serverFiltering && this._markHierarchicalQuery(t) && (t = {
|
||
logic: "or",
|
||
filters: [t, {
|
||
field: "_matchFilter",
|
||
operator: "equals",
|
||
value: !0
|
||
}]
|
||
}),
|
||
this.trigger("reset"),
|
||
this._query({
|
||
filter: t,
|
||
page: 1
|
||
}),
|
||
y)
|
||
},
|
||
_markHierarchicalQuery: function(t) {
|
||
var e, i, n, r, a;
|
||
return t = u(t),
|
||
t && 0 !== t.filters.length ? (e = g.filterExpr(t),
|
||
n = e.fields,
|
||
r = e.operators,
|
||
i = a = Function("d, __f, __o", "return " + e.expression),
|
||
(n.length || r.length) && (a = function(t) {
|
||
return i(t, n, r)
|
||
}
|
||
),
|
||
this._updateHierarchicalFilter(a),
|
||
!0) : (this._updateHierarchicalFilter(function() {
|
||
return !0
|
||
}),
|
||
!1)
|
||
},
|
||
_updateHierarchicalFilter: function(t) {
|
||
var e, i, n = this._data, r = !1;
|
||
for (i = 0; i < n.length; i++)
|
||
e = n[i],
|
||
e.hasChildren ? (e._matchFilter = e.children._updateHierarchicalFilter(t),
|
||
e._matchFilter || (e._matchFilter = t(e))) : e._matchFilter = t(e),
|
||
e._matchFilter && (r = !0);
|
||
return r
|
||
},
|
||
_find: function(t, e) {
|
||
var i, n, r, a, s = this._data;
|
||
if (s) {
|
||
if (r = p.fn[t].call(this, e))
|
||
return r;
|
||
for (s = this._flatData(this._data),
|
||
i = 0,
|
||
n = s.length; i < n; i++)
|
||
if (a = s[i].children,
|
||
a instanceof h && (r = a[t](e)))
|
||
return r
|
||
}
|
||
},
|
||
get: function(t) {
|
||
return this._find("get", t)
|
||
},
|
||
getByUid: function(t) {
|
||
return this._find("getByUid", t)
|
||
}
|
||
})).create = function(t) {
|
||
t = t && t.push ? {
|
||
data: t
|
||
} : t;
|
||
var e = t || {}
|
||
, i = e.data
|
||
, n = e.fields
|
||
, r = e.list;
|
||
return i && i._dataSource ? i._dataSource : (i || !n || e.transport || r && (i = _t(r, n)),
|
||
e.data = i,
|
||
e instanceof h ? e : new h(e))
|
||
}
|
||
,
|
||
Ot = P.Observable.extend({
|
||
init: function(t, e, i) {
|
||
P.Observable.fn.init.call(this),
|
||
this._prefetching = !1,
|
||
this.dataSource = t,
|
||
this.prefetch = !i;
|
||
var n = this;
|
||
t.bind("change", function() {
|
||
n._change()
|
||
}),
|
||
t.bind("reset", function() {
|
||
n._reset()
|
||
}),
|
||
this._syncWithDataSource(),
|
||
this.setViewSize(e)
|
||
},
|
||
setViewSize: function(t) {
|
||
this.viewSize = t,
|
||
this._recalculate()
|
||
},
|
||
at: function(t) {
|
||
var e = this.pageSize
|
||
, i = !0;
|
||
return t >= this.total() ? (this.trigger("endreached", {
|
||
index: t
|
||
}),
|
||
null) : this.useRanges ? this.useRanges ? ((t < this.dataOffset || t >= this.skip + e) && (i = this.range(Math.floor(t / e) * e)),
|
||
t === this.prefetchThreshold && this._prefetch(),
|
||
t === this.midPageThreshold ? this.range(this.nextMidRange, !0) : t === this.nextPageThreshold ? this.range(this.nextFullRange) : t === this.pullBackThreshold && this.range(this.offset === this.skip ? this.previousMidRange : this.previousFullRange),
|
||
i ? this.dataSource.at(t - this.dataOffset) : (this.trigger("endreached", {
|
||
index: t
|
||
}),
|
||
null)) : y : this.dataSource.view()[t]
|
||
},
|
||
indexOf: function(t) {
|
||
return this.dataSource.data().indexOf(t) + this.dataOffset
|
||
},
|
||
total: function() {
|
||
return parseInt(this.dataSource.total(), 10)
|
||
},
|
||
next: function() {
|
||
var t = this
|
||
, e = t.pageSize
|
||
, i = t.skip - t.viewSize + e
|
||
, n = R.max(R.floor(i / e), 0) * e;
|
||
this.offset = i,
|
||
this.dataSource.prefetch(n, e, function() {
|
||
t._goToRange(i, !0)
|
||
})
|
||
},
|
||
range: function(t, e) {
|
||
if (this.offset === t)
|
||
return !0;
|
||
var i = this
|
||
, n = this.pageSize
|
||
, r = R.max(R.floor(t / n), 0) * n
|
||
, a = this.dataSource;
|
||
return e && (r += n),
|
||
a.inRange(t, n) ? (this.offset = t,
|
||
this._recalculate(),
|
||
this._goToRange(t),
|
||
!0) : !this.prefetch || (a.prefetch(r, n, function() {
|
||
i.offset = t,
|
||
i._recalculate(),
|
||
i._goToRange(t, !0)
|
||
}),
|
||
!1)
|
||
},
|
||
syncDataSource: function() {
|
||
var t = this.offset;
|
||
this.offset = null,
|
||
this.range(t)
|
||
},
|
||
destroy: function() {
|
||
this.unbind()
|
||
},
|
||
_prefetch: function() {
|
||
var t = this
|
||
, e = this.pageSize
|
||
, i = this.skip + e
|
||
, n = this.dataSource;
|
||
n.inRange(i, e) || this._prefetching || !this.prefetch || (this._prefetching = !0,
|
||
this.trigger("prefetching", {
|
||
skip: i,
|
||
take: e
|
||
}),
|
||
n.prefetch(i, e, function() {
|
||
t._prefetching = !1,
|
||
t.trigger("prefetched", {
|
||
skip: i,
|
||
take: e
|
||
})
|
||
}))
|
||
},
|
||
_goToRange: function(t, e) {
|
||
this.offset === t && (this.dataOffset = t,
|
||
this._expanding = e,
|
||
this.dataSource.range(t, this.pageSize),
|
||
this.dataSource.enableRequestsInProgress())
|
||
},
|
||
_reset: function() {
|
||
this._syncPending = !0
|
||
},
|
||
_change: function() {
|
||
var t = this.dataSource;
|
||
this.length = this.useRanges ? t.lastRange().end : t.view().length,
|
||
this._syncPending && (this._syncWithDataSource(),
|
||
this._recalculate(),
|
||
this._syncPending = !1,
|
||
this.trigger("reset", {
|
||
offset: this.offset
|
||
})),
|
||
this.trigger("resize"),
|
||
this._expanding && this.trigger("expand"),
|
||
delete this._expanding
|
||
},
|
||
_syncWithDataSource: function() {
|
||
var t = this.dataSource;
|
||
this._firstItemUid = t.firstItemUid(),
|
||
this.dataOffset = this.offset = t.skip() || 0,
|
||
this.pageSize = t.pageSize(),
|
||
this.useRanges = t.options.serverPaging
|
||
},
|
||
_recalculate: function() {
|
||
var t = this.pageSize
|
||
, e = this.offset
|
||
, i = this.viewSize
|
||
, n = Math.ceil(e / t) * t;
|
||
this.skip = n,
|
||
this.midPageThreshold = n + t - 1,
|
||
this.nextPageThreshold = n + i - 1,
|
||
this.prefetchThreshold = n + Math.floor(t / 3 * 2),
|
||
this.pullBackThreshold = this.offset - 1,
|
||
this.nextMidRange = n + t - i,
|
||
this.nextFullRange = n,
|
||
this.previousMidRange = e - i,
|
||
this.previousFullRange = n - t
|
||
}
|
||
}),
|
||
It = P.Observable.extend({
|
||
init: function(t, e) {
|
||
var i = this;
|
||
P.Observable.fn.init.call(i),
|
||
this.dataSource = t,
|
||
this.batchSize = e,
|
||
this._total = 0,
|
||
this.buffer = new Ot(t,3 * e),
|
||
this.buffer.bind({
|
||
endreached: function(t) {
|
||
i.trigger("endreached", {
|
||
index: t.index
|
||
})
|
||
},
|
||
prefetching: function(t) {
|
||
i.trigger("prefetching", {
|
||
skip: t.skip,
|
||
take: t.take
|
||
})
|
||
},
|
||
prefetched: function(t) {
|
||
i.trigger("prefetched", {
|
||
skip: t.skip,
|
||
take: t.take
|
||
})
|
||
},
|
||
reset: function() {
|
||
i._total = 0,
|
||
i.trigger("reset")
|
||
},
|
||
resize: function() {
|
||
i._total = Math.ceil(this.length / i.batchSize),
|
||
i.trigger("resize", {
|
||
total: i.total(),
|
||
offset: this.offset
|
||
})
|
||
}
|
||
})
|
||
},
|
||
syncDataSource: function() {
|
||
this.buffer.syncDataSource()
|
||
},
|
||
at: function(t) {
|
||
var e, i, n = this.buffer, r = t * this.batchSize, a = this.batchSize, s = [];
|
||
for (n.offset > r && n.at(n.offset - 1),
|
||
i = 0; i < a && (e = n.at(r + i),
|
||
null !== e); i++)
|
||
s.push(e);
|
||
return s
|
||
},
|
||
total: function() {
|
||
return this._total
|
||
},
|
||
destroy: function() {
|
||
this.buffer.destroy(),
|
||
this.unbind()
|
||
}
|
||
}),
|
||
x(!0, P.data, {
|
||
readers: {
|
||
json: Nt
|
||
},
|
||
Query: g,
|
||
DataSource: p,
|
||
HierarchicalDataSource: h,
|
||
Node: At,
|
||
ObservableObject: d,
|
||
ObservableArray: $,
|
||
LazyObservableArray: a,
|
||
LocalTransport: Tt,
|
||
RemoteTransport: Dt,
|
||
Cache: s,
|
||
DataReader: Nt,
|
||
Model: _,
|
||
Buffer: Ot,
|
||
BatchBuffer: It
|
||
}),
|
||
window.kendo
|
||
}),
|
||
("function" == typeof define && define.amd ? define : function(t, e, i) {
|
||
(i || e)()
|
||
}
|
||
)("kendo.treeview.min", ["kendo.data.min", "kendo.treeview.draganddrop.min"], function() {
|
||
var v = window.kendo.jQuery
|
||
, d = void 0;
|
||
function t(i) {
|
||
return function(t) {
|
||
var e = t.children(".k-animation-container");
|
||
return e.length || (e = t),
|
||
e.children(i)
|
||
}
|
||
}
|
||
function n(t) {
|
||
return b.template(t, {
|
||
useWithBlock: !1
|
||
})
|
||
}
|
||
function p(t) {
|
||
return t.find(".k-checkbox-wrapper:first input[type=checkbox]")
|
||
}
|
||
function e(a) {
|
||
return function(t, r) {
|
||
r = r.closest(M);
|
||
var e, i = r.parent();
|
||
return i.parent().is("li") && (e = i.parent()),
|
||
this._dataSourceMove(t, i, e, function(t, e) {
|
||
var i = this.dataItem(r)
|
||
, n = i ? i.parent().indexOf(i) : r.index();
|
||
return this._insert(t.data(), e, n + a)
|
||
})
|
||
}
|
||
}
|
||
function R(t, e) {
|
||
for (var i; t && "ul" != t.nodeName.toLowerCase(); )
|
||
i = t,
|
||
t = t.nextSibling,
|
||
3 == i.nodeType && (i.nodeValue = v.trim(i.nodeValue)),
|
||
a.test(i.className) ? e.insertBefore(i, e.firstChild) : e.appendChild(i)
|
||
}
|
||
function _(t) {
|
||
var e = t.children("div")
|
||
, i = t.children("ul")
|
||
, n = e.children(".k-icon")
|
||
, r = t.children("input[type=checkbox]")
|
||
, a = e.children(".k-in");
|
||
t.hasClass("k-treeview") || (e.length || (e = v("<div />").prependTo(t)),
|
||
!n.length && i.length ? n = v("<span class='k-icon' />").prependTo(e) : i.length && i.children().length || (n.remove(),
|
||
i.remove()),
|
||
r.length && v("<span class='k-checkbox-wrapper' />").appendTo(e).append(r),
|
||
a.length || (a = t.children("a").eq(0).addClass("k-in k-link"),
|
||
a.length || (a = v("<span class='k-in' />")),
|
||
a.appendTo(e),
|
||
e.length && R(e[0].nextSibling, a[0])))
|
||
}
|
||
var i, y, h, r, a, b = window.kendo, f = b.ui, q = b.data, o = v.extend, s = b.template, c = v.isArray, l = f.Widget, u = q.HierarchicalDataSource, g = v.proxy, m = b.keys, x = ".kendoTreeView", $ = ".kendoTreeViewTemp", w = "select", U = "check", C = "navigate", z = "expand", k = "change", j = "error", S = "checked", P = "indeterminate", H = "collapse", B = "dragstart", L = "drag", V = "drop", G = "dragend", W = "dataBound", T = "click", D = "undefined", Q = "k-state-hover", N = "k-treeview", J = ":visible", M = ".k-item", A = "string", O = "aria-checked", I = "aria-selected", Y = "aria-disabled", E = "k-state-disabled", F = {
|
||
text: "dataTextField",
|
||
url: "dataUrlField",
|
||
spriteCssClass: "dataSpriteCssClassField",
|
||
imageUrl: "dataImageUrlField"
|
||
}, Z = function(t) {
|
||
return t instanceof b.jQuery || window.jQuery && t instanceof window.jQuery
|
||
}, K = function(t) {
|
||
return "object" == typeof HTMLElement ? t instanceof HTMLElement : t && "object" == typeof t && 1 === t.nodeType && typeof t.nodeName === A
|
||
};
|
||
return y = t(".k-group"),
|
||
h = t(".k-group,.k-content"),
|
||
r = function(t) {
|
||
return t.children("div").children(".k-icon")
|
||
}
|
||
,
|
||
a = /k-sprite/,
|
||
i = b.ui.DataBoundWidget.extend({
|
||
init: function(t, e) {
|
||
var i, n = this, r = !1, a = e && !!e.dataSource;
|
||
c(e) && (e = {
|
||
dataSource: e
|
||
}),
|
||
e && typeof e.loadOnDemand == D && c(e.dataSource) && (e.loadOnDemand = !1),
|
||
l.prototype.init.call(n, t, e),
|
||
t = n.element,
|
||
e = n.options,
|
||
n._dataSourceUids = {},
|
||
i = t.is("ul") && t || t.hasClass(N) && t.children("ul"),
|
||
r = !a && i.length,
|
||
r && (e.dataSource.list = i),
|
||
n._animation(),
|
||
n._accessors(),
|
||
n._templates(),
|
||
t.hasClass(N) ? (n.wrapper = t,
|
||
n.root = t.children("ul").eq(0)) : (n._wrapper(),
|
||
i && (n.root = t,
|
||
n._group(n.wrapper))),
|
||
n._tabindex(),
|
||
n.wrapper.attr("role", "tree"),
|
||
n._dataSource(r),
|
||
n._attachEvents(),
|
||
n._dragging(),
|
||
r ? n._syncHtmlAndDataSource() : e.autoBind && (n._progress(!0),
|
||
n.dataSource.fetch()),
|
||
e.checkboxes && e.checkboxes.checkChildren && n.updateIndeterminate(),
|
||
n.element[0].id && (n._ariaId = b.format("{0}_tv_active", n.element[0].id)),
|
||
b.notify(n)
|
||
},
|
||
_attachEvents: function() {
|
||
var e = this
|
||
, t = ".k-in:not(.k-state-selected,.k-state-disabled)"
|
||
, i = "mouseenter";
|
||
e.wrapper.on(i + x, ".k-in.k-state-selected", function(t) {
|
||
t.preventDefault()
|
||
}).on(i + x, t, function() {
|
||
v(this).addClass(Q)
|
||
}).on("mouseleave" + x, t, function() {
|
||
v(this).removeClass(Q)
|
||
}).on(T + x, t, g(e._click, e)).on("dblclick" + x, ".k-in:not(.k-state-disabled)", g(e._toggleButtonClick, e)).on(T + x, ".k-i-expand,.k-i-collapse", g(e._toggleButtonClick, e)).on("keydown" + x, g(e._keydown, e)).on("keypress" + x, g(e._keypress, e)).on("focus" + x, g(e._focus, e)).on("blur" + x, g(e._blur, e)).on("mousedown" + x, ".k-in,.k-checkbox-wrapper :checkbox,.k-i-expand,.k-i-collapse", g(e._mousedown, e)).on("change" + x, ".k-checkbox-wrapper :checkbox", g(e._checkboxChange, e)).on("click" + x, ".checkbox-span", g(e._checkboxLabelClick, e)).on("click" + x, ".k-request-retry", g(e._retryRequest, e)).on("click" + x, ".k-link.k-state-disabled", function(t) {
|
||
t.preventDefault()
|
||
}).on("click" + x, function(t) {
|
||
v(t.target).is(":kendoFocusable") || e.focus()
|
||
})
|
||
},
|
||
_checkboxLabelClick: function(t) {
|
||
var e = v(t.target.previousSibling);
|
||
e.is("[disabled]") || (e.prop("checked", !e.prop("checked")),
|
||
e.trigger("change"))
|
||
},
|
||
_syncHtmlAndDataSource: function(t, e) {
|
||
t = t || this.root,
|
||
e = e || this.dataSource;
|
||
var i, n, r, a, s, o = e.view(), c = b.attr("uid"), l = b.attr("expanded"), d = this.options.checkboxes, u = t.children("li");
|
||
for (i = 0; i < u.length; i++)
|
||
r = o[i],
|
||
a = r.uid,
|
||
n = u.eq(i),
|
||
n.attr("role", "treeitem").attr(c, a).attr(I, n.hasClass("k-state-selected")),
|
||
r.expanded = "true" === n.attr(l),
|
||
d && (s = p(n),
|
||
r.checked = s.prop(S),
|
||
s.attr("id", "_" + a),
|
||
s.next(".k-checkbox-label").attr("for", "_" + a)),
|
||
this._syncHtmlAndDataSource(n.children("ul"), r.children)
|
||
},
|
||
_animation: function() {
|
||
var t = this.options
|
||
, e = t.animation
|
||
, i = e.collapse && "effects"in e.collapse
|
||
, n = o({}, e.expand, e.collapse);
|
||
i || (n = o(n, {
|
||
reverse: !0
|
||
})),
|
||
e === !1 && (e = {
|
||
expand: {
|
||
effects: {}
|
||
},
|
||
collapse: {
|
||
hide: !0,
|
||
effects: {}
|
||
}
|
||
}),
|
||
e.collapse = o(n, {
|
||
hide: !0
|
||
}),
|
||
t.animation = e
|
||
},
|
||
_dragging: function() {
|
||
var a, t = this.options.dragAndDrop, e = this.dragging;
|
||
t && !e ? (a = this,
|
||
this.dragging = new f.HierarchicalDragAndDrop(this.element,{
|
||
reorderable: !0,
|
||
$angular: this.options.$angular,
|
||
autoScroll: this.options.autoScroll,
|
||
filter: "div:not(.k-state-disabled) .k-in",
|
||
allowedContainers: ".k-treeview",
|
||
itemSelector: ".k-treeview .k-item",
|
||
hintText: g(this._hintText, this),
|
||
contains: function(t, e) {
|
||
return v.contains(t, e)
|
||
},
|
||
dropHintContainer: function(t) {
|
||
return t
|
||
},
|
||
itemFromTarget: function(t) {
|
||
var e = t.closest(".k-top,.k-mid,.k-bot");
|
||
return {
|
||
item: e,
|
||
content: t.closest(".k-in"),
|
||
first: e.hasClass("k-top"),
|
||
last: e.hasClass("k-bot")
|
||
}
|
||
},
|
||
dropPositionFrom: function(t) {
|
||
return t.prevAll(".k-in").length > 0 ? "after" : "before"
|
||
},
|
||
dragstart: function(t) {
|
||
return a.trigger(B, {
|
||
sourceNode: t[0]
|
||
})
|
||
},
|
||
drag: function(t) {
|
||
a.trigger(L, {
|
||
originalEvent: t.originalEvent,
|
||
sourceNode: t.source[0],
|
||
dropTarget: t.target[0],
|
||
pageY: t.pageY,
|
||
pageX: t.pageX,
|
||
statusClass: t.status,
|
||
setStatusClass: t.setStatus
|
||
})
|
||
},
|
||
drop: function(e) {
|
||
var t = v(e.dropTarget)
|
||
, i = t.closest("a");
|
||
return i && i.attr("href") && a._tempPreventNavigation(i),
|
||
a.trigger(V, {
|
||
originalEvent: e.originalEvent,
|
||
sourceNode: e.source,
|
||
destinationNode: e.destination,
|
||
valid: e.valid,
|
||
setValid: function(t) {
|
||
this.valid = t,
|
||
e.setValid(t)
|
||
},
|
||
dropTarget: e.dropTarget,
|
||
dropPosition: e.position
|
||
})
|
||
},
|
||
dragend: function(e) {
|
||
function t(t) {
|
||
a.options.checkboxes && a.options.checkboxes.checkChildren && a.updateIndeterminate(),
|
||
a.trigger(G, {
|
||
originalEvent: e.originalEvent,
|
||
sourceNode: t && t[0],
|
||
destinationNode: n[0],
|
||
dropPosition: r
|
||
})
|
||
}
|
||
var i = e.source
|
||
, n = e.destination
|
||
, r = e.position;
|
||
"over" == r ? a.append(i, n, t) : ("before" == r ? i = a.insertBefore(i, n) : "after" == r && (i = a.insertAfter(i, n)),
|
||
t(i))
|
||
}
|
||
})) : !t && e && (e.destroy(),
|
||
this.dragging = null)
|
||
},
|
||
_tempPreventNavigation: function(e) {
|
||
e.on(T + x + $, function(t) {
|
||
t.preventDefault(),
|
||
e.off(T + x + $)
|
||
})
|
||
},
|
||
_hintText: function(t) {
|
||
return this.templates.dragClue({
|
||
item: this.dataItem(t),
|
||
treeview: this.options
|
||
})
|
||
},
|
||
_templates: function() {
|
||
var t = this
|
||
, e = t.options
|
||
, i = g(t._fieldAccessor, t);
|
||
e.template && typeof e.template == A ? e.template = s(e.template) : e.template || (e.template = n("# var text = " + i("text") + "(data.item); ## if (typeof data.item.encoded != 'undefined' && data.item.encoded === false) {##= text ## } else { ##: text ## } #")),
|
||
t._checkboxes(),
|
||
t.templates = {
|
||
wrapperCssClass: function(t, e) {
|
||
var i = "k-item"
|
||
, n = e.index;
|
||
return t.firstLevel && 0 === n && (i += " k-first"),
|
||
n == t.length - 1 && (i += " k-last"),
|
||
i
|
||
},
|
||
cssClass: function(t, e) {
|
||
var i = ""
|
||
, n = e.index
|
||
, r = t.length - 1;
|
||
return t.firstLevel && 0 === n && (i += "k-top "),
|
||
i += 0 === n && n != r ? "k-top" : n == r ? "k-bot" : "k-mid"
|
||
},
|
||
textClass: function(t, e) {
|
||
var i = "k-in";
|
||
return e && (i += " k-link"),
|
||
t.enabled === !1 && (i += " k-state-disabled"),
|
||
t.selected === !0 && (i += " k-state-selected"),
|
||
i
|
||
},
|
||
toggleButtonClass: function(t) {
|
||
var e = "k-icon";
|
||
return e += t.expanded !== !0 ? " k-i-expand" : " k-i-collapse"
|
||
},
|
||
groupAttributes: function(t) {
|
||
var e = "";
|
||
return t.firstLevel || (e = "role='group'"),
|
||
e + (t.expanded !== !0 ? " style='display:none'" : "")
|
||
},
|
||
groupCssClass: function(t) {
|
||
var e = "k-group";
|
||
return t.firstLevel && (e += " k-treeview-lines"),
|
||
e
|
||
},
|
||
dragClue: n("#= data.treeview.template(data) #"),
|
||
group: n("<ul class='#= data.r.groupCssClass(data.group) #'#= data.r.groupAttributes(data.group) #>#= data.renderItems(data) #</ul>"),
|
||
itemContent: n("# var imageUrl = " + i("imageUrl") + "(data.item); ## var spriteCssClass = " + i("spriteCssClass") + "(data.item); ## if (imageUrl) { #<img class='k-image' alt='' src='#= imageUrl #'># } ## if (spriteCssClass) { #<span class='k-sprite #= spriteCssClass #'></span># } ##= data.treeview.template(data) #"),
|
||
itemElement: n("# var item = data.item, r = data.r; ## var url = " + i("url") + "(item); #<div class='#= r.cssClass(data.group, item) #'># if (item.hasChildren) { #<span class='#= r.toggleButtonClass(item) #'></span># } ## if (data.treeview.checkboxes) { #<span class='k-checkbox-wrapper' role='presentation'>#= data.treeview.checkboxes.template(data) #</span># } ## var tag = url ? 'a' : 'span'; ## var textAttr = url ? ' href=\\'' + url + '\\'' : ''; #<#=tag# class='#= r.textClass(item, !!url) #'#= textAttr #>#= r.itemContent(data) #</#=tag#></div>"),
|
||
item: n("# var item = data.item, r = data.r; #<li role='treeitem' class='#= r.wrapperCssClass(data.group, item) #'" + b.attr("uid") + '=\'#= item.uid #\' # if (data.treeview.checkboxes) { #aria-checked=\'#= item.checked ? "true" : "false" #\' # } #aria-selected=\'#= item.selected ? "true" : "false" #\' #=item.enabled === false ? "aria-disabled=\'true\'" : \'\'#aria-expanded=\'#= item.expanded ? "true" : "false" #\' data-expanded=\'#= item.expanded ? "true" : "false" #\' >#= r.itemElement(data) #</li>'),
|
||
loading: n("<div class='k-icon k-i-loading'></div> #: data.messages.loading #"),
|
||
retry: n("#: data.messages.requestFailed # <button class='k-button k-request-retry'>#: data.messages.retry #</button>")
|
||
}
|
||
},
|
||
items: function() {
|
||
return this.element.find(".k-item > div:first-child")
|
||
},
|
||
setDataSource: function(t) {
|
||
var e = this.options;
|
||
e.dataSource = t,
|
||
this._dataSourceUids = {},
|
||
this._dataSource(),
|
||
e.checkboxes && e.checkboxes.checkChildren && this.dataSource.one("change", v.proxy(this.updateIndeterminate, this, null)),
|
||
this.options.autoBind && this.dataSource.fetch()
|
||
},
|
||
_bindDataSource: function() {
|
||
this._refreshHandler = g(this.refresh, this),
|
||
this._errorHandler = g(this._error, this),
|
||
this.dataSource.bind(k, this._refreshHandler),
|
||
this.dataSource.bind(j, this._errorHandler)
|
||
},
|
||
_unbindDataSource: function() {
|
||
var t = this.dataSource;
|
||
t && (t.unbind(k, this._refreshHandler),
|
||
t.unbind(j, this._errorHandler))
|
||
},
|
||
_dataSource: function(t) {
|
||
function i(t) {
|
||
for (var e = 0; e < t.length; e++)
|
||
t[e]._initChildren(),
|
||
t[e].children.fetch(),
|
||
i(t[e].children.view())
|
||
}
|
||
var e = this
|
||
, n = e.options
|
||
, r = n.dataSource;
|
||
r = c(r) ? {
|
||
data: r
|
||
} : r,
|
||
e._unbindDataSource(),
|
||
r.fields || (r.fields = [{
|
||
field: "text"
|
||
}, {
|
||
field: "url"
|
||
}, {
|
||
field: "spriteCssClass"
|
||
}, {
|
||
field: "imageUrl"
|
||
}]),
|
||
e.dataSource = r = u.create(r),
|
||
t && (r.fetch(),
|
||
i(r.view())),
|
||
e._bindDataSource()
|
||
},
|
||
events: [B, L, V, G, W, z, H, w, k, C, U],
|
||
options: {
|
||
name: "TreeView",
|
||
dataSource: {},
|
||
animation: {
|
||
expand: {
|
||
effects: "expand:vertical",
|
||
duration: 200
|
||
},
|
||
collapse: {
|
||
duration: 100
|
||
}
|
||
},
|
||
messages: {
|
||
loading: "Loading...",
|
||
requestFailed: "Request failed.",
|
||
retry: "Retry"
|
||
},
|
||
dragAndDrop: !1,
|
||
checkboxes: !1,
|
||
autoBind: !0,
|
||
autoScroll: !1,
|
||
loadOnDemand: !0,
|
||
template: "",
|
||
dataTextField: null
|
||
},
|
||
_accessors: function() {
|
||
var t, e, i, n = this, r = n.options, a = n.element;
|
||
for (t in F)
|
||
e = r[F[t]],
|
||
i = a.attr(b.attr(t + "-field")),
|
||
!e && i && (e = i),
|
||
e || (e = t),
|
||
c(e) || (e = [e]),
|
||
r[F[t]] = e
|
||
},
|
||
_fieldAccessor: function(t) {
|
||
var e = this.options[F[t]]
|
||
, i = e.length
|
||
, n = "(function(item) {";
|
||
return 0 === i ? n += "return item['" + t + "'];" : (n += "var levels = [" + v.map(e, function(t) {
|
||
return "function(d){ return " + b.expr(t) + "}"
|
||
}).join(",") + "];",
|
||
n += "return levels[Math.min(item.level(), " + i + "-1)](item)"),
|
||
n += "})"
|
||
},
|
||
setOptions: function(t) {
|
||
l.fn.setOptions.call(this, t),
|
||
this._animation(),
|
||
this._dragging(),
|
||
this._templates()
|
||
},
|
||
_trigger: function(t, e) {
|
||
return this.trigger(t, {
|
||
node: e.closest(M)[0]
|
||
})
|
||
},
|
||
_setChecked: function(t, e) {
|
||
if (t && v.isFunction(t.view))
|
||
for (var i = 0, n = t.view(); i < n.length; i++)
|
||
n[i].enabled !== !1 && this._setCheckedValue(n[i], e),
|
||
n[i].children && this._setChecked(n[i].children, e)
|
||
},
|
||
_setCheckedValue: function(t, e) {
|
||
t[S] = e
|
||
},
|
||
_setIndeterminate: function(t) {
|
||
var e, i, n, r = y(t), a = !0;
|
||
if (r.length && (e = p(r.children()),
|
||
i = e.length)) {
|
||
if (i > 1) {
|
||
for (n = 1; n < i; n++)
|
||
if (e[n].checked != e[n - 1].checked || e[n].indeterminate || e[n - 1].indeterminate) {
|
||
a = !1;
|
||
break
|
||
}
|
||
} else
|
||
a = !e[0].indeterminate;
|
||
return t.attr(O, a ? e[0].checked : "mixed"),
|
||
p(t).data(P, !a).prop(P, !a).prop(S, a && e[0].checked)
|
||
}
|
||
},
|
||
updateIndeterminate: function(t) {
|
||
var e, i, n, r;
|
||
if (t = t || this.wrapper,
|
||
e = y(t).children(),
|
||
e.length) {
|
||
for (i = 0; i < e.length; i++)
|
||
this.updateIndeterminate(e.eq(i));
|
||
if (t.is(".k-treeview"))
|
||
return;
|
||
n = this._setIndeterminate(t),
|
||
r = this.dataItem(t),
|
||
n && n.prop(S) ? r.checked = !0 : r && delete r.checked
|
||
}
|
||
},
|
||
_bubbleIndeterminate: function(t, e) {
|
||
if (t.length) {
|
||
e || this.updateIndeterminate(t);
|
||
var i, n = this.parent(t);
|
||
n.length && (this._setIndeterminate(n),
|
||
i = n.children("div").find(".k-checkbox-wrapper input[type=checkbox]"),
|
||
this._skip = !0,
|
||
i.prop(P) === !1 ? this.dataItem(n).set(S, i.prop(S)) : this.dataItem(n).set(S, !1),
|
||
this._skip = !1,
|
||
this._bubbleIndeterminate(n, !0))
|
||
}
|
||
},
|
||
_checkboxChange: function(t) {
|
||
var e = v(t.target)
|
||
, i = e.prop(S)
|
||
, n = e.closest(M)
|
||
, r = this.dataItem(n);
|
||
this._preventChange || r.checked != i && (r.set(S, i),
|
||
n.attr(O, i),
|
||
this._trigger(U, n))
|
||
},
|
||
_toggleButtonClick: function(t) {
|
||
var e = v(t.currentTarget).closest(M);
|
||
e.is("[aria-disabled='true']") || this.toggle(e)
|
||
},
|
||
_mousedown: function(t) {
|
||
var e = this
|
||
, i = v(t.currentTarget)
|
||
, n = v(t.currentTarget).closest(M)
|
||
, r = b.support.browser;
|
||
n.is("[aria-disabled='true']") || ((r.msie || r.edge) && i.is(":checkbox") && (i.prop(P) ? (e._preventChange = !1,
|
||
i.prop(S, !i.prop(S)),
|
||
i.trigger(k),
|
||
i.on(T + x, function(t) {
|
||
t.preventDefault()
|
||
}),
|
||
e._preventChange = !0) : (i.off(T + x),
|
||
e._preventChange = !1)),
|
||
e._clickTarget = n,
|
||
e.current(n))
|
||
},
|
||
_focusable: function(t) {
|
||
return t && t.length && t.is(":visible") && !t.find(".k-in:first").hasClass(E)
|
||
},
|
||
_focus: function() {
|
||
var t = this.select()
|
||
, e = this._clickTarget;
|
||
b.support.touch || (e && e.length && (t = e),
|
||
this._focusable(t) || (t = this.current()),
|
||
this._focusable(t) || (t = this._nextVisible(v())),
|
||
this.current(t))
|
||
},
|
||
focus: function() {
|
||
var t, e = this.wrapper, i = e[0], n = [], r = [], a = document.documentElement;
|
||
do {
|
||
i = i.parentNode,
|
||
i.scrollHeight > i.clientHeight && (n.push(i),
|
||
r.push(i.scrollTop))
|
||
} while (i != a);
|
||
for (b.focusElement(e),
|
||
t = 0; t < n.length; t++)
|
||
n[t].scrollTop = r[t]
|
||
},
|
||
_blur: function() {
|
||
this.current().find(".k-in:first").removeClass("k-state-focused")
|
||
},
|
||
_enabled: function(t) {
|
||
return !t.children("div").children(".k-in").hasClass(E)
|
||
},
|
||
parent: function(t) {
|
||
var e, i, n = /\bk-treeview\b/, r = /\bk-item\b/;
|
||
typeof t == A && (t = this.element.find(t)),
|
||
K(t) || (t = t[0]),
|
||
i = r.test(t.className);
|
||
do {
|
||
t = t.parentNode,
|
||
r.test(t.className) && (i ? e = t : i = !0)
|
||
} while (!n.test(t.className) && !e);
|
||
return v(e)
|
||
},
|
||
_nextVisible: function(t) {
|
||
function e(t) {
|
||
for (; t.length && !t.next().length; )
|
||
t = n.parent(t);
|
||
return t.next().length ? t.next() : t
|
||
}
|
||
var i, n = this, r = n._expanded(t);
|
||
return t.length && t.is(":visible") ? r ? (i = y(t).children().first(),
|
||
i.length || (i = e(t))) : i = e(t) : i = n.root.children().eq(0),
|
||
i
|
||
},
|
||
_previousVisible: function(t) {
|
||
var e, i, n = this;
|
||
if (!t.length || t.prev().length)
|
||
for (i = t.length ? t.prev() : n.root.children().last(); n._expanded(i) && (e = y(i).children().last(),
|
||
e.length); )
|
||
i = e;
|
||
else
|
||
i = n.parent(t) || t;
|
||
return i
|
||
},
|
||
_keydown: function(t) {
|
||
var e, i = this, n = t.keyCode, r = i.current(), a = i._expanded(r), s = r.find(".k-checkbox-wrapper:first :checkbox"), o = b.support.isRtl(i.element);
|
||
t.target == t.currentTarget && (!o && n == m.RIGHT || o && n == m.LEFT ? a ? e = i._nextVisible(r) : r.find(".k-in:first").hasClass(E) || i.expand(r) : !o && n == m.LEFT || o && n == m.RIGHT ? a && !r.find(".k-in:first").hasClass(E) ? i.collapse(r) : (e = i.parent(r),
|
||
i._enabled(e) || (e = d)) : n == m.DOWN ? e = i._nextVisible(r) : n == m.UP ? e = i._previousVisible(r) : n == m.HOME ? e = i._nextVisible(v()) : n == m.END ? e = i._previousVisible(v()) : n != m.ENTER || r.find(".k-in:first").hasClass(E) ? n == m.SPACEBAR && s.length && (r.find(".k-in:first").hasClass(E) || (s.prop(S, !s.prop(S)).data(P, !1).prop(P, !1),
|
||
i._checkboxChange({
|
||
target: s
|
||
})),
|
||
e = r) : r.find(".k-in:first").hasClass("k-state-selected") || i._trigger(w, r) || i.select(r),
|
||
e && (t.preventDefault(),
|
||
r[0] != e[0] && (i._trigger(C, e),
|
||
i.current(e))))
|
||
},
|
||
_keypress: function(t) {
|
||
var e, i = this, n = 300, r = i.current().get(0), a = t.key, s = 1 === a.length;
|
||
s && (i._match || (i._match = ""),
|
||
i._match += a,
|
||
clearTimeout(i._matchTimer),
|
||
i._matchTimer = setTimeout(function() {
|
||
i._match = ""
|
||
}, n),
|
||
e = r && i._matchNextByText(Array.prototype.indexOf.call(i.element.find(".k-item"), r), i._match),
|
||
e.length || (e = i._matchNextByText(-1, i._match)),
|
||
e.get(0) && e.get(0) !== r && (i._trigger(C, e),
|
||
i.current(e)))
|
||
},
|
||
_matchNextByText: function(i, n) {
|
||
var t = this.element
|
||
, e = t.find(".k-in").filter(function(t, e) {
|
||
return t > i && v(e).is(":visible") && 0 === v(e).text().toLowerCase().indexOf(n)
|
||
});
|
||
return e.eq(0).closest(M)
|
||
},
|
||
_click: function(t) {
|
||
var e, i = this, n = v(t.currentTarget), r = h(n.closest(M)), a = n.attr("href");
|
||
e = a ? "#" == a || a.indexOf("#" + this.element.id + "-") >= 0 : r.length && !r.children().length,
|
||
e && t.preventDefault(),
|
||
n.hasClass(".k-state-selected") || i._trigger(w, n) || i.select(n)
|
||
},
|
||
_wrapper: function() {
|
||
var t, e, i = this, n = i.element, r = "k-widget k-treeview";
|
||
n.is("ul") ? (t = n.wrap("<div />").parent(),
|
||
e = n) : (t = n,
|
||
e = t.children("ul").eq(0)),
|
||
i.wrapper = t.addClass(r),
|
||
i.root = e
|
||
},
|
||
_getSelectedNode: function() {
|
||
return this.element.find(".k-state-selected").closest(M)
|
||
},
|
||
_group: function(t) {
|
||
var e = this
|
||
, i = t.hasClass(N)
|
||
, n = {
|
||
firstLevel: i,
|
||
expanded: i || e._expanded(t)
|
||
}
|
||
, r = t.children("ul");
|
||
r.addClass(e.templates.groupCssClass(n)).css("display", n.expanded ? "" : "none"),
|
||
e._nodes(r, n)
|
||
},
|
||
_nodes: function(t, i) {
|
||
var n, r = this, e = t.children("li");
|
||
i = o({
|
||
length: e.length
|
||
}, i),
|
||
e.each(function(t, e) {
|
||
e = v(e),
|
||
n = {
|
||
index: t,
|
||
expanded: r._expanded(e)
|
||
},
|
||
_(e),
|
||
r._updateNodeClasses(e, i, n),
|
||
r._group(e)
|
||
})
|
||
},
|
||
_checkboxes: function() {
|
||
var t, e = this.options, i = e.checkboxes;
|
||
i && (t = "<input type='checkbox' tabindex='-1' #= (item.enabled === false) ? 'disabled' : '' # #= item.checked ? 'checked' : '' #",
|
||
i.name && (t += " name='" + i.name + "'"),
|
||
t += " id='_#= item.uid #' class='k-checkbox' /><span class='k-checkbox-label checkbox-span'></span>",
|
||
i = o({
|
||
template: t
|
||
}, e.checkboxes),
|
||
typeof i.template == A && (i.template = s(i.template)),
|
||
e.checkboxes = i)
|
||
},
|
||
_updateNodeClasses: function(t, e, i) {
|
||
var n, r, a = t.children("div"), s = t.children("ul"), o = this.templates;
|
||
t.hasClass("k-treeview") || (i = i || {},
|
||
i.expanded = typeof i.expanded != D ? i.expanded : this._expanded(t),
|
||
i.index = typeof i.index != D ? i.index : t.index(),
|
||
i.enabled = typeof i.enabled != D ? i.enabled : !a.children(".k-in").hasClass("k-state-disabled"),
|
||
e = e || {},
|
||
e.firstLevel = typeof e.firstLevel != D ? e.firstLevel : t.parent().parent().hasClass(N),
|
||
e.length = typeof e.length != D ? e.length : t.parent().children().length,
|
||
t.removeClass("k-first k-last").addClass(o.wrapperCssClass(e, i)),
|
||
a.removeClass("k-top k-mid k-bot").addClass(o.cssClass(e, i)),
|
||
n = a.children(".k-in"),
|
||
r = n[0] && "a" == n[0].nodeName.toLowerCase(),
|
||
n.removeClass("k-in k-link k-state-default k-state-disabled").addClass(o.textClass(i, r)),
|
||
(s.length || "true" == t.attr("data-hasChildren")) && (a.children(".k-icon").removeClass("k-i-expand k-i-collapse").addClass(o.toggleButtonClass(i)),
|
||
s.addClass("k-group")))
|
||
},
|
||
_processNodes: function(t, e) {
|
||
var i, n = this, r = n.element.find(t);
|
||
for (i = 0; i < r.length; i++)
|
||
e.call(n, i, v(r[i]).closest(M))
|
||
},
|
||
dataItem: function(t) {
|
||
var e = v(t).closest(M).attr(b.attr("uid"))
|
||
, i = this.dataSource;
|
||
return i && i.getByUid(e)
|
||
},
|
||
_dataItem: function(t) {
|
||
var e = v(t).closest(M).attr(b.attr("uid"))
|
||
, i = this.dataSource;
|
||
return i && this._dataSourceUids[e]
|
||
},
|
||
_insertNode: function(t, e, i, n, r) {
|
||
var a, s, o, c, l, d, u = this, p = y(i), h = p.children().length + 1, f = {
|
||
firstLevel: i.hasClass(N),
|
||
expanded: !r,
|
||
length: h
|
||
}, g = "", m = function(t, e) {
|
||
t.appendTo(e)
|
||
};
|
||
for (o = 0; o < t.length; o++)
|
||
c = t[o],
|
||
c.index = e + o,
|
||
g += u._renderItem({
|
||
group: f,
|
||
item: c
|
||
});
|
||
if (s = v(g),
|
||
s.length) {
|
||
for (u.angular("compile", function() {
|
||
return {
|
||
elements: s.get(),
|
||
data: t.map(function(t) {
|
||
return {
|
||
dataItem: t
|
||
}
|
||
})
|
||
}
|
||
}),
|
||
p.length || (p = v(u._renderGroup({
|
||
group: f
|
||
})).appendTo(i)),
|
||
n(s, p),
|
||
i.hasClass("k-item") && (_(i),
|
||
u._updateNodeClasses(i, f, {
|
||
expanded: !r
|
||
})),
|
||
l = s.prev().first(),
|
||
d = s.next().last(),
|
||
u._updateNodeClasses(l, {}, {
|
||
expanded: "true" == l.attr(b.attr("expanded"))
|
||
}),
|
||
u._updateNodeClasses(d, {}, {
|
||
expanded: "true" == d.attr(b.attr("expanded"))
|
||
}),
|
||
o = 0; o < t.length; o++)
|
||
c = t[o],
|
||
c.hasChildren && (a = c.children.data(),
|
||
a.length && u._insertNode(a, c.index, s.eq(o), m, !c.expanded));
|
||
return s
|
||
}
|
||
},
|
||
_updateNodes: function(t, e) {
|
||
function i(t, e) {
|
||
t.is(".k-group") && t.find(".k-item:not([aria-disabled])").attr(O, e),
|
||
t.find(".k-checkbox-wrapper input[type=checkbox]:not([disabled])").prop(S, e).data(P, !1).prop(P, !1)
|
||
}
|
||
var n, r, a, s, o, c, l, d = this, u = {
|
||
treeview: d.options,
|
||
item: s
|
||
}, p = "expanded" != e && "checked" != e;
|
||
if ("selected" == e)
|
||
s = t[0],
|
||
r = d.findByUid(s.uid).find(".k-in:first").removeClass("k-state-hover").toggleClass("k-state-selected", s[e]).end(),
|
||
s[e] && d.current(r),
|
||
r.attr(I, !!s[e]);
|
||
else {
|
||
for (l = v.map(t, function(t) {
|
||
return d.findByUid(t.uid).children("div")
|
||
}),
|
||
p && d.angular("cleanup", function() {
|
||
return {
|
||
elements: l
|
||
}
|
||
}),
|
||
n = 0; n < t.length; n++)
|
||
u.item = s = t[n],
|
||
a = l[n],
|
||
r = a.parent(),
|
||
p && a.children(".k-in").html(d.templates.itemContent(u)),
|
||
e == S ? (o = s[e],
|
||
i(a, o),
|
||
r.attr(O, o),
|
||
d.options.checkboxes.checkChildren && (i(r.children(".k-group"), o),
|
||
d._setChecked(s.children, o),
|
||
d._bubbleIndeterminate(r))) : "expanded" == e ? d._toggle(r, s, s[e]) : "enabled" == e && (r.find(".k-checkbox-wrapper input[type=checkbox]").prop("disabled", !s[e]),
|
||
c = !h(r).is(J),
|
||
r.removeAttr(Y),
|
||
s[e] || (s.selected && s.set("selected", !1),
|
||
s.expanded && s.set("expanded", !1),
|
||
c = !0,
|
||
r.attr(I, !1).attr(Y, !0)),
|
||
d._updateNodeClasses(r, {}, {
|
||
enabled: s[e],
|
||
expanded: !c
|
||
})),
|
||
a.length && this.trigger("itemChange", {
|
||
item: a,
|
||
data: s,
|
||
ns: f
|
||
});
|
||
p && d.angular("compile", function() {
|
||
return {
|
||
elements: l,
|
||
data: v.map(t, function(t) {
|
||
return [{
|
||
dataItem: t
|
||
}]
|
||
})
|
||
}
|
||
})
|
||
}
|
||
},
|
||
_appendItems: function(i, t, e) {
|
||
var n, r, a, s = y(e), o = s.children(), c = !this._expanded(e);
|
||
this.element === e ? (n = this.dataSource.data(),
|
||
r = this.dataSource.view(),
|
||
a = r.length < n.length ? r : n,
|
||
i = a.indexOf(t[0])) : t.length && (i = t[0].parent().indexOf(t[0])),
|
||
typeof i == D && (i = o.length),
|
||
this._insertNode(t, i, e, function(t, e) {
|
||
i >= o.length ? t.appendTo(e) : t.insertBefore(o.eq(i))
|
||
}, c),
|
||
c || (this._updateNodeClasses(e, {}, {
|
||
expanded: !c
|
||
}),
|
||
y(e).css("display", "block"))
|
||
},
|
||
_refreshChildren: function(t, e, i) {
|
||
var n, r, a, s = this.options, o = s.loadOnDemand, c = s.checkboxes && s.checkboxes.checkChildren;
|
||
if (y(t).empty(),
|
||
e.length)
|
||
for (this._appendItems(i, e, t),
|
||
r = y(t).children(),
|
||
o && c && this._bubbleIndeterminate(r.last()),
|
||
n = 0; n < r.length; n++)
|
||
a = r.eq(n),
|
||
this.trigger("itemChange", {
|
||
item: a.children("div"),
|
||
data: e[n],
|
||
ns: f
|
||
});
|
||
else
|
||
_(t)
|
||
},
|
||
_refreshRoot: function(t) {
|
||
var e, i, n, r = this._renderGroup({
|
||
items: t,
|
||
group: {
|
||
firstLevel: !0,
|
||
expanded: !0
|
||
}
|
||
});
|
||
for (this.root.length ? (this._angularItems("cleanup"),
|
||
e = v(r),
|
||
this.root.attr("class", e.attr("class")).html(e.html())) : this.root = this.wrapper.html(r).children("ul"),
|
||
i = this.root.children(".k-item"),
|
||
n = 0; n < t.length; n++)
|
||
this.trigger("itemChange", {
|
||
item: i.eq(n),
|
||
data: t[n],
|
||
ns: f
|
||
});
|
||
this._angularItems("compile")
|
||
},
|
||
refresh: function(t) {
|
||
var e, i, n = t.node, r = t.action, a = t.items, s = this.wrapper, o = this.options, c = o.loadOnDemand, l = o.checkboxes && o.checkboxes.checkChildren;
|
||
if (!this._skip) {
|
||
for (e = 0; e < a.length; e++)
|
||
this._dataSourceUids[a[e].uid] = a[e];
|
||
if (t.field) {
|
||
if (!a[0] || !a[0].level)
|
||
return;
|
||
return this._updateNodes(a, t.field)
|
||
}
|
||
if (n && (s = this.findByUid(n.uid),
|
||
this._progress(s, !1)),
|
||
l && "remove" != r) {
|
||
for (i = !1,
|
||
e = 0; e < a.length; e++)
|
||
if ("checked"in a[e]) {
|
||
i = !0;
|
||
break
|
||
}
|
||
if (!i && n && n.checked)
|
||
for (e = 0; e < a.length; e++)
|
||
a[e].checked = !0
|
||
}
|
||
if ("add" == r ? this._appendItems(t.index, a, s) : "remove" == r ? this._remove(this.findByUid(a[0].uid), !1) : "itemchange" == r ? this._updateNodes(a) : "itemloaded" == r ? this._refreshChildren(s, a, t.index) : this._refreshRoot(a),
|
||
"remove" != r)
|
||
for (e = 0; e < a.length; e++)
|
||
(!c || a[e].expanded || a[e]._loaded) && a[e].load();
|
||
this.trigger(W, {
|
||
node: n ? s : d
|
||
}),
|
||
this.dataSource.filter() && this.options.checkboxes.checkChildren && this.updateIndeterminate(s)
|
||
}
|
||
},
|
||
_error: function(t) {
|
||
var e = t.node && this.findByUid(t.node.uid)
|
||
, i = this.templates.retry({
|
||
messages: this.options.messages
|
||
});
|
||
e ? (this._progress(e, !1),
|
||
this._expanded(e, !1),
|
||
r(e).addClass("k-i-reload"),
|
||
t.node.loaded(!1)) : (this._progress(!1),
|
||
this.element.html(i))
|
||
},
|
||
_retryRequest: function(t) {
|
||
t.preventDefault(),
|
||
this.dataSource.fetch()
|
||
},
|
||
expand: function(t) {
|
||
this._processNodes(t, function(t, e) {
|
||
this.toggle(e, !0)
|
||
})
|
||
},
|
||
collapse: function(t) {
|
||
this._processNodes(t, function(t, e) {
|
||
this.toggle(e, !1)
|
||
})
|
||
},
|
||
enable: function(t, i) {
|
||
"boolean" == typeof t ? (i = t,
|
||
t = this.items()) : i = 2 != arguments.length || !!i,
|
||
this._processNodes(t, function(t, e) {
|
||
this.dataItem(e).set("enabled", i)
|
||
})
|
||
},
|
||
current: function(t) {
|
||
var e = this
|
||
, i = e._current
|
||
, n = e.element
|
||
, r = e._ariaId;
|
||
return arguments.length > 0 && t && t.length ? (i && (i[0].id === r && i.removeAttr("id"),
|
||
i.find(".k-in:first").removeClass("k-state-focused")),
|
||
i = e._current = v(t, n).closest(M),
|
||
i.find(".k-in:first").addClass("k-state-focused"),
|
||
r = i[0].id || r,
|
||
r && (e.wrapper.removeAttr("aria-activedescendant"),
|
||
i.attr("id", r),
|
||
e.wrapper.attr("aria-activedescendant", r)),
|
||
d) : (i || (i = e._nextVisible(v())),
|
||
i)
|
||
},
|
||
select: function(t) {
|
||
var e = this
|
||
, i = e.element;
|
||
return arguments.length ? (t = v(t, i).closest(M),
|
||
i.find(".k-state-selected").each(function() {
|
||
var t = e.dataItem(this);
|
||
t ? (t.set("selected", !1),
|
||
delete t.selected) : v(this).removeClass("k-state-selected")
|
||
}),
|
||
t.length && (e.dataItem(t).set("selected", !0),
|
||
e._clickTarget = t),
|
||
e.trigger(k),
|
||
d) : i.find(".k-state-selected").closest(M)
|
||
},
|
||
_toggle: function(t, e, i) {
|
||
var n, r = this.options, a = h(t), s = i ? "expand" : "collapse";
|
||
a.data("animating") || (n = e && e.loaded(),
|
||
i && !n ? (r.loadOnDemand && this._progress(t, !0),
|
||
a.remove(),
|
||
e.load()) : (this._updateNodeClasses(t, {}, {
|
||
expanded: i
|
||
}),
|
||
i || a.css("height", a.height()).css("height"),
|
||
a.kendoStop(!0, !0).kendoAnimate(o({
|
||
reset: !0
|
||
}, r.animation[s], {
|
||
complete: function() {
|
||
i && a.css("height", "")
|
||
}
|
||
}))))
|
||
},
|
||
toggle: function(t, e) {
|
||
t = v(t),
|
||
r(t).is(".k-i-expand, .k-i-collapse") && (1 == arguments.length && (e = !this._expanded(t)),
|
||
this._expanded(t, e))
|
||
},
|
||
destroy: function() {
|
||
var t = this;
|
||
l.fn.destroy.call(t),
|
||
t.wrapper.off(x),
|
||
t.wrapper.find(".k-checkbox-wrapper :checkbox").off(x),
|
||
t._unbindDataSource(),
|
||
t.dragging && t.dragging.destroy(),
|
||
t._dataSourceUids = {},
|
||
b.destroy(t.element),
|
||
t.root = t.wrapper = t.element = null
|
||
},
|
||
_expanded: function(t, e, i) {
|
||
var n, r = b.attr("expanded"), a = e, s = a ? "expand" : "collapse";
|
||
return 1 == arguments.length ? (n = this._dataItem(t),
|
||
"true" === t.attr(r) || n && n.expanded) : (n = this.dataItem(t),
|
||
h(t).data("animating") || !i && this._trigger(s, t) || (a ? (t.attr(r, "true"),
|
||
t.attr("aria-expanded", "true")) : (t.removeAttr(r),
|
||
t.attr("aria-expanded", "false")),
|
||
n && (n.set("expanded", a),
|
||
a = n.expanded)),
|
||
d)
|
||
},
|
||
_progress: function(t, e) {
|
||
var i = this.element
|
||
, n = this.templates.loading({
|
||
messages: this.options.messages
|
||
});
|
||
1 == arguments.length ? (e = t,
|
||
e ? i.html(n) : i.empty()) : r(t).toggleClass("k-i-loading", e).removeClass("k-i-reload")
|
||
},
|
||
text: function(t, e) {
|
||
var i = this.dataItem(t)
|
||
, n = this.options[F.text]
|
||
, r = i.level()
|
||
, a = n.length
|
||
, s = n[Math.min(r, a - 1)];
|
||
return e ? (i.set(s, e),
|
||
d) : i[s]
|
||
},
|
||
_objectOrSelf: function(t) {
|
||
return v(t).closest("[data-role=treeview]").data("kendoTreeView") || this
|
||
},
|
||
_dataSourceMove: function(t, e, i, n) {
|
||
var r, a = this._objectOrSelf(i || e), s = a.dataSource, o = v.Deferred().resolve().promise();
|
||
return i && i[0] != a.element[0] && (r = a.dataItem(i),
|
||
r.loaded() || (a._progress(i, !0),
|
||
o = r.load()),
|
||
i != this.root && (s = r.children,
|
||
s && s instanceof u || (r._initChildren(),
|
||
r.loaded(!0),
|
||
s = r.children))),
|
||
t = this._toObservableData(t),
|
||
n.call(a, s, t, o)
|
||
},
|
||
_toObservableData: function(t) {
|
||
var e, i, n = t;
|
||
return (Z(t) || K(t)) && (e = this._objectOrSelf(t).dataSource,
|
||
i = v(t).attr(b.attr("uid")),
|
||
n = e.getByUid(i),
|
||
n && (n = e.remove(n))),
|
||
n
|
||
},
|
||
_insert: function(t, e, i) {
|
||
e instanceof b.data.ObservableArray ? e = e.toJSON() : c(e) || (e = [e]);
|
||
var n = t.parent();
|
||
return n && n._initChildren && (n.hasChildren = !0,
|
||
n._initChildren()),
|
||
t.splice.apply(t, [i, 0].concat(e)),
|
||
this.findByUid(t[i].uid)
|
||
},
|
||
insertAfter: e(1),
|
||
insertBefore: e(0),
|
||
append: function(t, s, o) {
|
||
var e = this.root;
|
||
if (!(s && t instanceof jQuery && s[0] === t[0]))
|
||
return s = s && s.length ? s : null,
|
||
s && (e = y(s)),
|
||
this._dataSourceMove(t, e, s, function(i, n, t) {
|
||
function e() {
|
||
s && a._expanded(s, !0, !0);
|
||
var t = i.data()
|
||
, e = Math.max(t.length, 0);
|
||
return a._insert(t, n, e)
|
||
}
|
||
var r, a = this;
|
||
return t.done(function() {
|
||
r = e(),
|
||
(o = o || v.noop)(r)
|
||
}),
|
||
r || null
|
||
})
|
||
},
|
||
_remove: function(t, e) {
|
||
var i, n, r, a = this;
|
||
return t = v(t, a.element),
|
||
this.angular("cleanup", function() {
|
||
return {
|
||
elements: t.get()
|
||
}
|
||
}),
|
||
i = t.parent().parent(),
|
||
n = t.prev(),
|
||
r = t.next(),
|
||
t[e ? "detach" : "remove"](),
|
||
i.hasClass("k-item") && (_(i),
|
||
a._updateNodeClasses(i)),
|
||
a._updateNodeClasses(n),
|
||
a._updateNodeClasses(r),
|
||
t
|
||
},
|
||
remove: function(t) {
|
||
var e = this.dataItem(t);
|
||
e && this.dataSource.remove(e)
|
||
},
|
||
detach: function(t) {
|
||
return this._remove(t, !0)
|
||
},
|
||
findByText: function(i) {
|
||
return v(this.element).find(".k-in").filter(function(t, e) {
|
||
return v(e).text() == i
|
||
}).closest(M)
|
||
},
|
||
findByUid: function(t) {
|
||
var e, i, n = this.element.find(".k-item"), r = b.attr("uid");
|
||
for (i = 0; i < n.length; i++)
|
||
if (n[i].getAttribute(r) == t) {
|
||
e = n[i];
|
||
break
|
||
}
|
||
return v(e)
|
||
},
|
||
expandPath: function(t, e) {
|
||
function i() {
|
||
a.shift(),
|
||
a.length ? n(a[0]).then(i) : s.call(r)
|
||
}
|
||
function n(t) {
|
||
var e = v.Deferred()
|
||
, i = r.dataSource.get(t);
|
||
return i ? i.loaded() ? (i.set("expanded", !0),
|
||
e.resolve()) : (r._progress(r.findByUid(i.uid), !0),
|
||
i.load().then(function() {
|
||
i.set("expanded", !0),
|
||
e.resolve()
|
||
})) : e.resolve(),
|
||
e.promise()
|
||
}
|
||
var r = this
|
||
, a = t.slice(0)
|
||
, s = e || v.noop;
|
||
n(a[0]).then(i)
|
||
},
|
||
_parentIds: function(t) {
|
||
for (var e = t && t.parentNode(), i = []; e && e.parentNode; )
|
||
i.unshift(e.id),
|
||
e = e.parentNode();
|
||
return i
|
||
},
|
||
expandTo: function(t) {
|
||
t instanceof b.data.Node || (t = this.dataSource.get(t));
|
||
var e = this._parentIds(t);
|
||
this.expandPath(e)
|
||
},
|
||
_renderItem: function(t) {
|
||
return t.group || (t.group = {}),
|
||
t.treeview = this.options,
|
||
t.r = this.templates,
|
||
this.templates.item(t)
|
||
},
|
||
_renderGroup: function(t) {
|
||
var s = this;
|
||
return t.renderItems = function(t) {
|
||
var e = ""
|
||
, i = 0
|
||
, n = t.items
|
||
, r = n ? n.length : 0
|
||
, a = t.group;
|
||
for (a.length = r; i < r; i++)
|
||
t.group = a,
|
||
t.item = n[i],
|
||
t.item.index = i,
|
||
e += s._renderItem(t);
|
||
return e
|
||
}
|
||
,
|
||
t.r = s.templates,
|
||
s.templates.group(t)
|
||
}
|
||
}),
|
||
f.plugin(i),
|
||
window.kendo
|
||
})
|
||
}(); |