",
options: {disabled: false, create: null},
_createWidget: function (f, g) {
g = e(g || this.defaultElement || this)[0];
this.element = e(g);
this.uuid = d++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = e.widget.extend({}, this.options, this._getCreateOptions(), f);
this.bindings = e();
this.hoverable = e();
this.focusable = e();
if (g !== this) {
e.data(g, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (h) {
if (h.target === g) {
this.destroy()
}
}
});
this.document = e(g.style ? g.ownerDocument : g.document || g);
this.window = e(this.document[0].defaultView || this.document[0].parentWindow)
}
this._create();
this._trigger("create", null, this._getCreateEventData());
this._init()
},
_getCreateOptions: e.noop,
_getCreateEventData: e.noop,
_create: e.noop,
_init: e.noop,
destroy: function () {
this._destroy();
this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName));
this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName + "-disabled ui-state-disabled");
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus")
},
_destroy: e.noop,
widget: function () {
return this.element
},
option: function (k, g) {
var f = k, h, j, i;
if (arguments.length === 0) {
return e.widget.extend({}, this.options)
}
if (typeof k === "string") {
f = {};
h = k.split(".");
k = h.shift();
if (h.length) {
j = f[k] = e.widget.extend({}, this.options[k]);
for (i = 0; i < h.length - 1; i++) {
j[h[i]] = j[h[i]] || {};
j = j[h[i]]
}
k = h.pop();
if (g === c) {
return j[k] === c ? null : j[k]
}
j[k] = g
} else {
if (g === c) {
return this.options[k] === c ? null : this.options[k]
}
f[k] = g
}
}
this._setOptions(f);
return this
},
_setOptions: function (f) {
var g;
for (g in f) {
this._setOption(g, f[g])
}
return this
},
_setOption: function (f, g) {
this.options[f] = g;
if (f === "disabled") {
this.widget().toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !!g).attr("aria-disabled", g);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus")
}
return this
},
enable: function () {
return this._setOption("disabled", false)
},
disable: function () {
return this._setOption("disabled", true)
},
_on: function (f, j, i) {
var g, h = this;
if (typeof f !== "boolean") {
i = j;
j = f;
f = false
}
if (!i) {
i = j;
j = this.element;
g = this.widget()
} else {
j = g = e(j);
this.bindings = this.bindings.add(j)
}
e.each(i, function (m, l) {
function p() {
if (!f && (h.options.disabled === true || e(this).hasClass("ui-state-disabled"))) {
return
}
return (typeof l === "string" ? h[l] : l).apply(h, arguments)
}
if (typeof l !== "string") {
p.guid = l.guid = l.guid || p.guid || e.guid++
}
var k = m.match(/^(\w+)\s*(.*)$/), o = k[1] + h.eventNamespace, n = k[2];
if (n) {
g.delegate(n, o, p)
} else {
j.bind(o, p)
}
})
},
_off: function (g, f) {
f = (f || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
g.unbind(f).undelegate(f)
},
_delay: function (g, f) {
function i() {
return (typeof g === "string" ? h[g] : g).apply(h, arguments)
}
var h = this;
return setTimeout(i, f || 0)
},
_hoverable: function (f) {
this.hoverable = this.hoverable.add(f);
this._on(f, {
mouseenter: function (g) {
e(g.currentTarget).addClass("ui-state-hover")
}, mouseleave: function (g) {
e(g.currentTarget).removeClass("ui-state-hover")
}
})
},
_focusable: function (f) {
this.focusable = this.focusable.add(f);
this._on(f, {
focusin: function (g) {
e(g.currentTarget).addClass("ui-state-focus")
}, focusout: function (g) {
e(g.currentTarget).removeClass("ui-state-focus")
}
})
},
_trigger: function (h, i, j) {
var g, f, k = this.options[h];
j = j || {};
i = e.Event(i);
i.type = (h === this.widgetEventPrefix ? h : this.widgetEventPrefix + h).toLowerCase();
i.target = this.element[0];
f = i.originalEvent;
if (f) {
for (g in f) {
if (!(g in i)) {
i[g] = f[g]
}
}
}
this.element.trigger(i, j);
return !(e.isFunction(k) && k.apply(this.element[0], [i].concat(j)) === false || i.isDefaultPrevented())
}
};
e.each({show: "fadeIn", hide: "fadeOut"}, function (g, f) {
e.Widget.prototype["_" + g] = function (i, h, l) {
if (typeof h === "string") {
h = {effect: h}
}
var j, k = !h ? g : h === true || typeof h === "number" ? f : h.effect || f;
h = h || {};
if (typeof h === "number") {
h = {duration: h}
}
j = !e.isEmptyObject(h);
h.complete = l;
if (h.delay) {
i.delay(h.delay)
}
if (j && e.effects && e.effects.effect[k]) {
i[g](h)
} else {
if (k !== g && i[k]) {
i[k](h.duration, h.easing, l)
} else {
i.queue(function (m) {
e(this)[g]();
if (l) {
l.call(i[0])
}
m()
})
}
}
}
})
})(jQuery);
(function (h, e) {
h.ui = h.ui || {};
var m, n = Math.max, f = Math.abs, b = Math.round, g = /left|center|right/, k = /top|center|bottom/,
a = /[\+\-]\d+(\.[\d]+)?%?/, o = /^\w+/, d = /%$/, j = h.fn.position;
function c(q, p, r) {
return [parseFloat(q[0]) * (d.test(q[0]) ? p / 100 : 1), parseFloat(q[1]) * (d.test(q[1]) ? r / 100 : 1)]
}
function l(p, q) {
return parseInt(h.css(p, q), 10) || 0
}
function i(q) {
var p = q[0];
if (p.nodeType === 9) {
return {width: q.width(), height: q.height(), offset: {top: 0, left: 0}}
}
if (h.isWindow(p)) {
return {width: q.width(), height: q.height(), offset: {top: q.scrollTop(), left: q.scrollLeft()}}
}
if (p.preventDefault) {
return {width: 0, height: 0, offset: {top: p.pageY, left: p.pageX}}
}
return {width: q.outerWidth(), height: q.outerHeight(), offset: q.offset()}
}
h.position = {
scrollbarWidth: function () {
if (m !== e) {
return m
}
var s, r,
q = h("
"),
p = q.children()[0];
h("body").append(q);
s = p.offsetWidth;
q.css("overflow", "scroll");
r = p.offsetWidth;
if (s === r) {
r = q[0].clientWidth
}
q.remove();
return (m = s - r)
}, getScrollInfo: function (q) {
var p = q.isWindow ? "" : q.element.css("overflow-x"), t = q.isWindow ? "" : q.element.css("overflow-y"),
s = p === "scroll" || (p === "auto" && q.width < q.element[0].scrollWidth),
r = t === "scroll" || (t === "auto" && q.height < q.element[0].scrollHeight);
return {width: r ? h.position.scrollbarWidth() : 0, height: s ? h.position.scrollbarWidth() : 0}
}, getWithinInfo: function (p) {
var q = h(p || window), r = h.isWindow(q[0]);
return {
element: q,
isWindow: r,
offset: q.offset() || {left: 0, top: 0},
scrollLeft: q.scrollLeft(),
scrollTop: q.scrollTop(),
width: r ? q.width() : q.outerWidth(),
height: r ? q.height() : q.outerHeight()
}
}
};
h.fn.position = function (w) {
if (!w || !w.of) {
return j.apply(this, arguments)
}
w = h.extend({}, w);
var x, t, r, v, q, y, s = h(w.of), p = h.position.getWithinInfo(w.within), z = h.position.getScrollInfo(p),
u = (w.collision || "flip").split(" "), A = {};
y = i(s);
if (s[0].preventDefault) {
w.at = "left top"
}
t = y.width;
r = y.height;
v = y.offset;
q = h.extend({}, v);
h.each(["my", "at"], function () {
var B = (w[this] || "").split(" "), D, C;
if (B.length === 1) {
B = g.test(B[0]) ? B.concat(["center"]) : k.test(B[0]) ? ["center"].concat(B) : ["center", "center"]
}
B[0] = g.test(B[0]) ? B[0] : "center";
B[1] = k.test(B[1]) ? B[1] : "center";
D = a.exec(B[0]);
C = a.exec(B[1]);
A[this] = [D ? D[0] : 0, C ? C[0] : 0];
w[this] = [o.exec(B[0])[0], o.exec(B[1])[0]]
});
if (u.length === 1) {
u[1] = u[0]
}
if (w.at[0] === "right") {
q.left += t
} else {
if (w.at[0] === "center") {
q.left += t / 2
}
}
if (w.at[1] === "bottom") {
q.top += r
} else {
if (w.at[1] === "center") {
q.top += r / 2
}
}
x = c(A.at, t, r);
q.left += x[0];
q.top += x[1];
return this.each(function () {
var C, L, E = h(this), G = E.outerWidth(), D = E.outerHeight(), F = l(this, "marginLeft"),
B = l(this, "marginTop"), K = G + F + l(this, "marginRight") + z.width,
J = D + B + l(this, "marginBottom") + z.height, H = h.extend({}, q),
I = c(A.my, E.outerWidth(), E.outerHeight());
if (w.my[0] === "right") {
H.left -= G
} else {
if (w.my[0] === "center") {
H.left -= G / 2
}
}
if (w.my[1] === "bottom") {
H.top -= D
} else {
if (w.my[1] === "center") {
H.top -= D / 2
}
}
H.left += I[0];
H.top += I[1];
if (!h.support.offsetFractions) {
H.left = b(H.left);
H.top = b(H.top)
}
C = {marginLeft: F, marginTop: B};
h.each(["left", "top"], function (N, M) {
if (h.ui.position[u[N]]) {
h.ui.position[u[N]][M](H, {
targetWidth: t,
targetHeight: r,
elemWidth: G,
elemHeight: D,
collisionPosition: C,
collisionWidth: K,
collisionHeight: J,
offset: [x[0] + I[0], x[1] + I[1]],
my: w.my,
at: w.at,
within: p,
elem: E
})
}
});
if (w.using) {
L = function (P) {
var R = v.left - H.left, O = R + t - G, Q = v.top - H.top, N = Q + r - D, M = {
target: {element: s, left: v.left, top: v.top, width: t, height: r},
element: {element: E, left: H.left, top: H.top, width: G, height: D},
horizontal: O < 0 ? "left" : R > 0 ? "right" : "center",
vertical: N < 0 ? "top" : Q > 0 ? "bottom" : "middle"
};
if (t < G && f(R + O) < t) {
M.horizontal = "center"
}
if (r < D && f(Q + N) < r) {
M.vertical = "middle"
}
if (n(f(R), f(O)) > n(f(Q), f(N))) {
M.important = "horizontal"
} else {
M.important = "vertical"
}
w.using.call(this, P, M)
}
}
E.offset(h.extend(H, {using: L}))
})
};
h.ui.position = {
fit: {
left: function (q, p) {
var x = p.within, s = x.isWindow ? x.scrollLeft : x.offset.left, u = x.width,
r = q.left - p.collisionPosition.marginLeft, t = s - r, w = r + p.collisionWidth - u - s, v;
if (p.collisionWidth > u) {
if (t > 0 && w <= 0) {
v = q.left + t + p.collisionWidth - u - s;
q.left += t - v
} else {
if (w > 0 && t <= 0) {
q.left = s
} else {
if (t > w) {
q.left = s + u - p.collisionWidth
} else {
q.left = s
}
}
}
} else {
if (t > 0) {
q.left += t
} else {
if (w > 0) {
q.left -= w
} else {
q.left = n(q.left - r, q.left)
}
}
}
}, top: function (p, x) {
var w = x.within, t = w.isWindow ? w.scrollTop : w.offset.top, u = x.within.height,
r = p.top - x.collisionPosition.marginTop, s = t - r, q = r + x.collisionHeight - u - t, v;
if (x.collisionHeight > u) {
if (s > 0 && q <= 0) {
v = p.top + s + x.collisionHeight - u - t;
p.top += s - v
} else {
if (q > 0 && s <= 0) {
p.top = t
} else {
if (s > q) {
p.top = t + u - x.collisionHeight
} else {
p.top = t
}
}
}
} else {
if (s > 0) {
p.top += s
} else {
if (q > 0) {
p.top -= q
} else {
p.top = n(p.top - r, p.top)
}
}
}
}
}, flip: {
left: function (s, r) {
var q = r.within, w = q.offset.left + q.scrollLeft, A = q.width,
C = q.isWindow ? q.scrollLeft : q.offset.left, t = s.left - r.collisionPosition.marginLeft,
x = t - C, B = t + r.collisionWidth - A - C,
v = r.my[0] === "left" ? -r.elemWidth : r.my[0] === "right" ? r.elemWidth : 0,
y = r.at[0] === "left" ? r.targetWidth : r.at[0] === "right" ? -r.targetWidth : 0,
p = -2 * r.offset[0], z, u;
if (x < 0) {
z = s.left + v + y + p + r.collisionWidth - A - w;
if (z < 0 || z < f(x)) {
s.left += v + y + p
}
} else {
if (B > 0) {
u = s.left - r.collisionPosition.marginLeft + v + y + p - C;
if (u > 0 || f(u) < B) {
s.left += v + y + p
}
}
}
}, top: function (r, q) {
var p = q.within, z = p.offset.top + p.scrollTop, A = p.height,
y = p.isWindow ? p.scrollTop : p.offset.top, t = r.top - q.collisionPosition.marginTop, v = t - y,
s = t + q.collisionHeight - A - y, w = q.my[1] === "top",
u = w ? -q.elemHeight : q.my[1] === "bottom" ? q.elemHeight : 0,
C = q.at[1] === "top" ? q.targetHeight : q.at[1] === "bottom" ? -q.targetHeight : 0,
D = -2 * q.offset[1], x, B;
if (v < 0) {
B = r.top + u + C + D + q.collisionHeight - A - z;
if ((r.top + u + C + D) > v && (B < 0 || B < f(v))) {
r.top += u + C + D
}
} else {
if (s > 0) {
x = r.top - q.collisionPosition.marginTop + u + C + D - y;
if ((r.top + u + C + D) > s && (x > 0 || f(x) < s)) {
r.top += u + C + D
}
}
}
}
}, flipfit: {
left: function () {
h.ui.position.flip.left.apply(this, arguments);
h.ui.position.fit.left.apply(this, arguments)
}, top: function () {
h.ui.position.flip.top.apply(this, arguments);
h.ui.position.fit.top.apply(this, arguments)
}
}
};
(function () {
var v, q, s, u, t, r = document.getElementsByTagName("body")[0], p = document.createElement("div");
v = document.createElement(r ? "div" : "body");
s = {visibility: "hidden", width: 0, height: 0, border: 0, margin: 0, background: "none"};
if (r) {
h.extend(s, {position: "absolute", left: "-1000px", top: "-1000px"})
}
for (t in s) {
v.style[t] = s[t]
}
v.appendChild(p);
q = r || document.documentElement;
q.insertBefore(v, q.firstChild);
p.style.cssText = "position: absolute; left: 10.7432222px;";
u = h(p).offset().left;
h.support.offsetFractions = u > 10 && u < 11;
v.innerHTML = "";
q.removeChild(v)
})()
}(jQuery));
(function (a, b) {
a.widget("ui.menu", {
version: "1.10.3",
defaultElement: "
",
delay: 300,
options: {
icons: {submenu: "ui-icon-carat-1-e"},
menus: "ul",
position: {my: "left top", at: "right top"},
role: "menu",
blur: null,
focus: null,
select: null
},
_create: function () {
this.activeMenu = this.element;
this.mouseHandled = false;
this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons", !!this.element.find(".ui-icon").length).attr({
role: this.options.role,
tabIndex: 0
}).bind("click" + this.eventNamespace, a.proxy(function (c) {
if (this.options.disabled) {
c.preventDefault()
}
}, this));
if (this.options.disabled) {
this.element.addClass("ui-state-disabled").attr("aria-disabled", "true")
}
this._on({
"mousedown .ui-menu-item > a": function (c) {
c.preventDefault()
}, "click .ui-state-disabled > a": function (c) {
c.preventDefault()
}, "click .ui-menu-item:has(a)": function (c) {
var d = a(c.target).closest(".ui-menu-item");
if (!this.mouseHandled && d.not(".ui-state-disabled").length) {
this.mouseHandled = true;
this.select(c);
if (d.has(".ui-menu").length) {
this.expand(c)
} else {
if (!this.element.is(":focus")) {
this.element.trigger("focus", [true]);
if (this.active && this.active.parents(".ui-menu").length === 1) {
clearTimeout(this.timer)
}
}
}
}
}, "mouseenter .ui-menu-item": function (c) {
var d = a(c.currentTarget);
d.siblings().children(".ui-state-active").removeClass("ui-state-active");
this.focus(c, d)
}, mouseleave: "collapseAll", "mouseleave .ui-menu": "collapseAll", focus: function (d, e) {
var c = this.active || this.element.children(".ui-menu-item").eq(0);
if (!e) {
this.focus(d, c)
}
}, blur: function (c) {
this._delay(function () {
if (!a.contains(this.element[0], this.document[0].activeElement)) {
this.collapseAll(c)
}
})
}, keydown: "_keydown"
});
this.refresh();
this._on(this.document, {
click: function (c) {
if (!a(c.target).closest(".ui-menu").length) {
this.collapseAll(c)
}
this.mouseHandled = false
}
})
},
_destroy: function () {
this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();
this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function () {
var c = a(this);
if (c.data("ui-menu-submenu-carat")) {
c.remove()
}
});
this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")
},
_keydown: function (d) {
var i, g, f, e, c, h = true;
function j(k) {
return k.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")
}
switch (d.keyCode) {
case a.ui.keyCode.PAGE_UP:
this.previousPage(d);
break;
case a.ui.keyCode.PAGE_DOWN:
this.nextPage(d);
break;
case a.ui.keyCode.HOME:
this._move("first", "first", d);
break;
case a.ui.keyCode.END:
this._move("last", "last", d);
break;
case a.ui.keyCode.UP:
this.previous(d);
break;
case a.ui.keyCode.DOWN:
this.next(d);
break;
case a.ui.keyCode.LEFT:
this.collapse(d);
break;
case a.ui.keyCode.RIGHT:
if (this.active && !this.active.is(".ui-state-disabled")) {
this.expand(d)
}
break;
case a.ui.keyCode.ENTER:
case a.ui.keyCode.SPACE:
this._activate(d);
break;
case a.ui.keyCode.ESCAPE:
this.collapse(d);
break;
default:
h = false;
g = this.previousFilter || "";
f = String.fromCharCode(d.keyCode);
e = false;
clearTimeout(this.filterTimer);
if (f === g) {
e = true
} else {
f = g + f
}
c = new RegExp("^" + j(f), "i");
i = this.activeMenu.children(".ui-menu-item").filter(function () {
return c.test(a(this).children("a").text())
});
i = e && i.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : i;
if (!i.length) {
f = String.fromCharCode(d.keyCode);
c = new RegExp("^" + j(f), "i");
i = this.activeMenu.children(".ui-menu-item").filter(function () {
return c.test(a(this).children("a").text())
})
}
if (i.length) {
this.focus(d, i);
if (i.length > 1) {
this.previousFilter = f;
this.filterTimer = this._delay(function () {
delete this.previousFilter
}, 1000)
} else {
delete this.previousFilter
}
} else {
delete this.previousFilter
}
}
if (h) {
d.preventDefault()
}
},
_activate: function (c) {
if (!this.active.is(".ui-state-disabled")) {
if (this.active.children("a[aria-haspopup='true']").length) {
this.expand(c)
} else {
this.select(c)
}
}
},
refresh: function () {
var d, c = this.options.icons.submenu, e = this.element.find(this.options.menus);
e.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({
role: this.options.role,
"aria-hidden": "true",
"aria-expanded": "false"
}).each(function () {
var h = a(this), g = h.prev("a"),
f = a("").addClass("ui-menu-icon ui-icon " + c).data("ui-menu-submenu-carat", true);
g.attr("aria-haspopup", "true").prepend(f);
h.attr("aria-labelledby", g.attr("id"))
});
d = e.add(this.element);
d.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role", "presentation").children("a").uniqueId().addClass("ui-corner-all").attr({
tabIndex: -1,
role: this._itemRole()
});
d.children(":not(.ui-menu-item)").each(function () {
var f = a(this);
if (!/[^\-\u2014\u2013\s]/.test(f.text())) {
f.addClass("ui-widget-content ui-menu-divider")
}
});
d.children(".ui-state-disabled").attr("aria-disabled", "true");
if (this.active && !a.contains(this.element[0], this.active[0])) {
this.blur()
}
},
_itemRole: function () {
return {menu: "menuitem", listbox: "option"}[this.options.role]
},
_setOption: function (c, d) {
if (c === "icons") {
this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(d.submenu)
}
this._super(c, d)
},
focus: function (f, e) {
var d, c;
this.blur(f, f && f.type === "focus");
this._scrollIntoView(e);
this.active = e.first();
c = this.active.children("a").addClass("ui-state-focus");
if (this.options.role) {
this.element.attr("aria-activedescendant", c.attr("id"))
}
this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");
if (f && f.type === "keydown") {
this._close()
} else {
this.timer = this._delay(function () {
this._close()
}, this.delay)
}
d = e.children(".ui-menu");
if (d.length && (/^mouse/.test(f.type))) {
this._startOpening(d)
}
this.activeMenu = e.parent();
this._trigger("focus", f, {item: e})
},
_scrollIntoView: function (g) {
var f, e, h, i, d, c;
if (this._hasScroll()) {
f = parseFloat(a.css(this.activeMenu[0], "borderTopWidth")) || 0;
e = parseFloat(a.css(this.activeMenu[0], "paddingTop")) || 0;
h = g.offset().top - this.activeMenu.offset().top - f - e;
i = this.activeMenu.scrollTop();
d = this.activeMenu.height();
c = g.height();
if (h < 0) {
this.activeMenu.scrollTop(i + h)
} else {
if (h + c > d) {
this.activeMenu.scrollTop(i + h - d + c)
}
}
}
},
blur: function (d, c) {
if (!c) {
clearTimeout(this.timer)
}
if (!this.active) {
return
}
this.active.children("a").removeClass("ui-state-focus");
this.active = null;
this._trigger("blur", d, {item: this.active})
},
_startOpening: function (c) {
clearTimeout(this.timer);
if (c.attr("aria-hidden") !== "true") {
return
}
this.timer = this._delay(function () {
this._close();
this._open(c)
}, this.delay)
},
_open: function (d) {
var c = a.extend({of: this.active}, this.options.position);
clearTimeout(this.timer);
this.element.find(".ui-menu").not(d.parents(".ui-menu")).hide().attr("aria-hidden", "true");
d.show().removeAttr("aria-hidden").attr("aria-expanded", "true").position(c)
},
collapseAll: function (d, c) {
clearTimeout(this.timer);
this.timer = this._delay(function () {
var e = c ? this.element : a(d && d.target).closest(this.element.find(".ui-menu"));
if (!e.length) {
e = this.element
}
this._close(e);
this.blur(d);
this.activeMenu = e
}, this.delay)
},
_close: function (c) {
if (!c) {
c = this.active ? this.active.parent() : this.element
}
c.find(".ui-menu").hide().attr("aria-hidden", "true").attr("aria-expanded", "false").end().find("a.ui-state-active").removeClass("ui-state-active")
},
collapse: function (d) {
var c = this.active && this.active.parent().closest(".ui-menu-item", this.element);
if (c && c.length) {
this._close();
this.focus(d, c)
}
},
expand: function (d) {
var c = this.active && this.active.children(".ui-menu ").children(".ui-menu-item").first();
if (c && c.length) {
this._open(c.parent());
this._delay(function () {
this.focus(d, c)
})
}
},
next: function (c) {
this._move("next", "first", c)
},
previous: function (c) {
this._move("prev", "last", c)
},
isFirstItem: function () {
return this.active && !this.active.prevAll(".ui-menu-item").length
},
isLastItem: function () {
return this.active && !this.active.nextAll(".ui-menu-item").length
},
_move: function (d, f, c) {
var e;
if (this.active) {
if (d === "first" || d === "last") {
e = this.active[d === "first" ? "prevAll" : "nextAll"](".ui-menu-item").eq(-1)
} else {
e = this.active[d + "All"](".ui-menu-item").eq(0)
}
}
if (!e || !e.length || !this.active) {
e = this.activeMenu.children(".ui-menu-item")[f]()
}
this.focus(c, e)
},
nextPage: function (c) {
var f, d, e;
if (!this.active) {
this.next(c);
return
}
if (this.isLastItem()) {
return
}
if (this._hasScroll()) {
d = this.active.offset().top;
e = this.element.height();
this.active.nextAll(".ui-menu-item").each(function () {
f = a(this);
return f.offset().top - d - e < 0
});
this.focus(c, f)
} else {
this.focus(c, this.activeMenu.children(".ui-menu-item")[!this.active ? "first" : "last"]())
}
},
previousPage: function (c) {
var f, d, e;
if (!this.active) {
this.next(c);
return
}
if (this.isFirstItem()) {
return
}
if (this._hasScroll()) {
d = this.active.offset().top;
e = this.element.height();
this.active.prevAll(".ui-menu-item").each(function () {
f = a(this);
return f.offset().top - d + e > 0
});
this.focus(c, f)
} else {
this.focus(c, this.activeMenu.children(".ui-menu-item").first())
}
},
_hasScroll: function () {
return this.element.outerHeight() < this.element.prop("scrollHeight")
},
select: function (c) {
this.active = this.active || a(c.target).closest(".ui-menu-item");
var d = {item: this.active};
if (!this.active.has(".ui-menu").length) {
this.collapseAll(c, true)
}
this._trigger("select", c, d)
}
})
}(jQuery));
(function (b, c) {
var a = 0;
b.widget("ui.autocomplete", {
version: "1.10.3",
defaultElement: " ",
options: {
appendTo: null,
autoFocus: false,
delay: 300,
minLength: 1,
position: {my: "left top", at: "left bottom", collision: "none"},
source: null,
change: null,
close: null,
focus: null,
open: null,
response: null,
search: null,
select: null
},
pending: 0,
_create: function () {
var h, f, i, e = this.element[0].nodeName.toLowerCase(), d = e === "textarea", g = e === "input";
this.isMultiLine = d ? true : g ? false : this.element.prop("isContentEditable");
this.valueMethod = this.element[d || g ? "val" : "text"];
this.isNewMenu = true;
this.element.addClass("ui-autocomplete-input").attr("autocomplete", "off");
this._on(this.element, {
keydown: function (j) {
if (this.element.prop("readOnly")) {
h = true;
i = true;
f = true;
return
}
h = false;
i = false;
f = false;
var k = b.ui.keyCode;
switch (j.keyCode) {
case k.PAGE_UP:
h = true;
this._move("previousPage", j);
break;
case k.PAGE_DOWN:
h = true;
this._move("nextPage", j);
break;
case k.UP:
h = true;
this._keyEvent("previous", j);
break;
case k.DOWN:
h = true;
this._keyEvent("next", j);
break;
case k.ENTER:
case k.NUMPAD_ENTER:
if (this.menu.active) {
h = true;
j.preventDefault();
this.menu.select(j)
}
break;
case k.TAB:
if (this.menu.active) {
this.menu.select(j)
}
break;
case k.ESCAPE:
if (this.menu.element.is(":visible")) {
this._value(this.term);
this.close(j);
j.preventDefault()
}
break;
default:
f = true;
this._searchTimeout(j);
break
}
}, keypress: function (j) {
if (h) {
h = false;
if (!this.isMultiLine || this.menu.element.is(":visible")) {
j.preventDefault()
}
return
}
if (f) {
return
}
var k = b.ui.keyCode;
switch (j.keyCode) {
case k.PAGE_UP:
this._move("previousPage", j);
break;
case k.PAGE_DOWN:
this._move("nextPage", j);
break;
case k.UP:
this._keyEvent("previous", j);
break;
case k.DOWN:
this._keyEvent("next", j);
break
}
}, input: function (j) {
if (i) {
i = false;
j.preventDefault();
return
}
this._searchTimeout(j)
}, focus: function () {
this.selectedItem = null;
this.previous = this._value()
}, blur: function (j) {
if (this.cancelBlur) {
delete this.cancelBlur;
return
}
clearTimeout(this.searching);
this.close(j);
this._change(j)
}
});
this._initSource();
this.menu = b("").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role: null}).hide().data("ui-menu");
this._on(this.menu.element, {
mousedown: function (j) {
j.preventDefault();
this.cancelBlur = true;
this._delay(function () {
delete this.cancelBlur
});
var k = this.menu.element[0];
if (!b(j.target).closest(".ui-menu-item").length) {
this._delay(function () {
var l = this;
this.document.one("mousedown", function (m) {
if (m.target !== l.element[0] && m.target !== k && !b.contains(k, m.target)) {
l.close()
}
})
})
}
}, menufocus: function (k, l) {
if (this.isNewMenu) {
this.isNewMenu = false;
if (k.originalEvent && /^mouse/.test(k.originalEvent.type)) {
this.menu.blur();
this.document.one("mousemove", function () {
b(k.target).trigger(k.originalEvent)
});
return
}
}
var j = l.item.data("ui-autocomplete-item");
if (false !== this._trigger("focus", k, {item: j})) {
if (k.originalEvent && /^key/.test(k.originalEvent.type)) {
this._value(j.value)
}
} else {
this.liveRegion.text(j.value)
}
}, menuselect: function (k, l) {
var j = l.item.data("ui-autocomplete-item"), m = this.previous;
if (this.element[0] !== this.document[0].activeElement) {
this.element.focus();
this.previous = m;
this._delay(function () {
this.previous = m;
this.selectedItem = j
})
}
if (false !== this._trigger("select", k, {item: j})) {
this._value(j.value)
}
this.term = this._value();
this.close(k);
this.selectedItem = j
}
});
this.liveRegion = b("", {
role: "status",
"aria-live": "polite"
}).addClass("ui-helper-hidden-accessible").insertBefore(this.element);
this._on(this.window, {
beforeunload: function () {
this.element.removeAttr("autocomplete")
}
})
},
_destroy: function () {
clearTimeout(this.searching);
this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete");
this.menu.element.remove();
this.liveRegion.remove()
},
_setOption: function (d, e) {
this._super(d, e);
if (d === "source") {
this._initSource()
}
if (d === "appendTo") {
this.menu.element.appendTo(this._appendTo())
}
if (d === "disabled" && e && this.xhr) {
this.xhr.abort()
}
},
_appendTo: function () {
var d = this.options.appendTo;
if (d) {
d = d.jquery || d.nodeType ? b(d) : this.document.find(d).eq(0)
}
if (!d) {
d = this.element.closest(".ui-front")
}
if (!d.length) {
d = this.document[0].body
}
return d
},
_initSource: function () {
var e, f, d = this;
if (b.isArray(this.options.source)) {
e = this.options.source;
this.source = function (h, g) {
g(b.ui.autocomplete.filter(e, h.term))
}
} else {
if (typeof this.options.source === "string") {
f = this.options.source;
this.source = function (h, g) {
if (d.xhr) {
d.xhr.abort()
}
d.xhr = b.ajax({
url: f, data: h, dataType: "json", success: function (i) {
g(i)
}, error: function () {
g([])
}
})
}
} else {
this.source = this.options.source
}
}
},
_searchTimeout: function (d) {
clearTimeout(this.searching);
this.searching = this._delay(function () {
if (this.term !== this._value()) {
this.selectedItem = null;
this.search(null, d)
}
}, this.options.delay)
},
search: function (e, d) {
e = e != null ? e : this._value();
this.term = this._value();
if (e.length < this.options.minLength) {
return this.close(d)
}
if (this._trigger("search", d) === false) {
return
}
return this._search(e)
},
_search: function (d) {
this.pending++;
this.element.addClass("ui-autocomplete-loading");
this.cancelSearch = false;
this.source({term: d}, this._response())
},
_response: function () {
var e = this, d = ++a;
return function (f) {
if (d === a) {
e.__response(f)
}
e.pending--;
if (!e.pending) {
e.element.removeClass("ui-autocomplete-loading")
}
}
},
__response: function (d) {
if (d) {
d = this._normalize(d)
}
this._trigger("response", null, {content: d});
if (!this.options.disabled && d && d.length && !this.cancelSearch) {
this._suggest(d);
this._trigger("open")
} else {
this._close()
}
},
close: function (d) {
this.cancelSearch = true;
this._close(d)
},
_close: function (d) {
if (this.menu.element.is(":visible")) {
this.menu.element.hide();
this.menu.blur();
this.isNewMenu = true;
this._trigger("close", d)
}
},
_change: function (d) {
if (this.previous !== this._value()) {
this._trigger("change", d, {item: this.selectedItem})
}
},
_normalize: function (d) {
if (d.length && d[0].label && d[0].value) {
return d
}
return b.map(d, function (e) {
if (typeof e === "string") {
return {label: e, value: e}
}
return b.extend({label: e.label || e.value, value: e.value || e.label}, e)
})
},
_suggest: function (d) {
var e = this.menu.element.empty();
this._renderMenu(e, d);
this.isNewMenu = true;
this.menu.refresh();
e.show();
this._resizeMenu();
e.position(b.extend({of: this.element}, this.options.position));
if (this.options.autoFocus) {
this.menu.next()
}
},
_resizeMenu: function () {
var d = this.menu.element;
d.outerWidth(Math.max(d.width("").outerWidth() + 1, this.element.outerWidth()))
},
_renderMenu: function (d, f) {
var e = this;
b.each(f, function (g, h) {
e._renderItemData(d, h)
})
},
_renderItemData: function (d, e) {
return this._renderItem(d, e).data("ui-autocomplete-item", e)
},
_renderItem: function (d, e) {
return b("").append(b("").text(e.label)).appendTo(d)
},
_move: function (e, d) {
if (!this.menu.element.is(":visible")) {
this.search(null, d);
return
}
if (this.menu.isFirstItem() && /^previous/.test(e) || this.menu.isLastItem() && /^next/.test(e)) {
this._value(this.term);
this.menu.blur();
return
}
this.menu[e](d)
},
widget: function () {
return this.menu.element
},
_value: function () {
return this.valueMethod.apply(this.element, arguments)
},
_keyEvent: function (e, d) {
if (!this.isMultiLine || this.menu.element.is(":visible")) {
this._move(e, d);
d.preventDefault()
}
}
});
b.extend(b.ui.autocomplete, {
escapeRegex: function (d) {
return d.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")
}, filter: function (e, f) {
var d = new RegExp(b.ui.autocomplete.escapeRegex(f), "i");
return b.grep(e, function (g) {
return d.test(g.label || g.value || g)
})
}
});
b.widget("ui.autocomplete", b.ui.autocomplete, {
options: {
messages: {
noResults: "No search results.",
results: function (d) {
return d + (d > 1 ? " results are" : " result is") + " available, use up and down arrow keys to navigate."
}
}
}, __response: function (e) {
var d;
this._superApply(arguments);
if (this.options.disabled || this.cancelSearch) {
return
}
if (e && e.length) {
d = this.options.messages.results(e.length)
} else {
d = this.options.messages.noResults
}
this.liveRegion.text(d)
}
})
}(jQuery));
$.ajaxSetup({
cache: false,
type: "POST",
headers: {
'request-by': 'ajax-request-tag' // 鏍囪瘑ajax璇锋眰
},
beforeSend: function (request, xhr, o) {
try {
var url = this.url;
if (url != null && ((url.indexOf("/eportal/ui")>-1&&url.indexOf("portal.url="))||url.indexOf(".html")==-1||url.indexOf(".js")==-1) > -1) {
request.setRequestHeader("systemToken", getEasysiteToken(this.url));
request.setRequestHeader("aisiteParamKey", getEasysiteParamKey());
var satoken=getPortalCookie("huilan-access-token");
if(satoken!=undefined){
request.setRequestHeader("satoken", satoken);
}
}
} catch (e) {
console.log(e);
}
var dataType = this.dataType
var success = this.success || function () {
},
error = this.error || function () {
};
this.success = function (data, textStatus, jqXHR) {
if (!ajaxFilter(data)) {
return;
}
success(data, textStatus, jqXHR);
},
this.error = function (jqXHR, textStatus, errorThrown) {
if (!ajaxFilter(jqXHR.responseText)) {
return;
}
error(jqXHR, textStatus, errorThrown);
}
}
});
function ajaxFilter(data) {
try {
var res = typeof (data) == 'string' && data.indexOf("{") > 0 ? $.parseJSON(data) : data;
var errorType = res.errorType;
if (errorType) {
if (errorType == 'logout') {
// $.dialog.alert(res.errorMessage,function(){
// window.location.reload();
// });
console.log(res.errorMessage);
} else if (errorType == 'illegalGet') {
// if($("#currentLoginUserLoginName").val()==""){
// console.log(res.fullErrorMessage);
// }else{
// alert(res.fullErrorMessage);
// }
console.log(res.fullErrorMessage);
} else if (errorType == "illegalRequest") {
// if($("#currentLoginUserLoginName").val()==""){
// console.log(res.msg);
// }else{
// alert(res.msg);
// }
console.log(res.msg);
} else if (errorType == 'error') {
var fullErrorMessage = res.fullErrorMessage;
// if($("#currentLoginUserLoginName").val()==""){
// console.log(fullErrorMessage);
// }else{
// alert(fullErrorMessage);
// }
console.log(fullErrorMessage);
} else {
console.log(res.errorMessage);
//alert(res.errorMessage);
}
return false;
}
} catch (e) {
// if( /鐧诲綍瓒呮椂/.test(data)){
// window.location.reload();
// return false;
// }
}
return true;
}
function isOpenEasysiteToken() {
var isOpenEasysiteToken = document.getElementById("isOpenEasysiteToken");
if (typeof (isOpenEasysiteToken) == 'undefined' || isOpenEasysiteToken == null) {
try {
isOpenEasysiteToken = getRootWin().document.getElementById("isOpenEasysiteToken").value;
} catch (e) {
isOpenEasysiteToken = false;
}
} else {
isOpenEasysiteToken = document.getElementById("isOpenEasysiteToken").value;
}
return isOpenEasysiteToken;
}
function getEasysiteToken(url, jq) {
if (isOpenEasysiteToken() != "true") {
return "";
}
if (url.indexOf("/aisite-system/aisiteToken/getToken") > -1) {
return "";
}
var token = "";
var $jquery = $;
if (typeof (jq) != 'undefined') {
$jquery = jq;
}
url = "/aisite-system/aisiteToken/getToken";
$jquery.ajax({
type: "post",
url: url,
dataType: "json",
async: false,
success: function (result) {
token = result.data;
}
});
token = desEncodeString(token);
return token;
}
function getEasysiteParamKey() {
if (isOpenEasysiteToken() != "true") {
return "";
}
var easysiteParamKey = "";
try {
easysiteParamKey = getRootWin().document.getElementById("easysiteParamKey").value;
} catch (e) {
easysiteParamKey = document.getElementById("easysiteParamKey").value;
}
return easysiteParamKey;
}
function desEncodeString(paramString, isGetRootWin) {
if (isOpenEasysiteToken() != "true") {
return "";
}
if (typeof (paramString) == 'undefined') {
paramString = "";
}
paramString = paramString.toString();
var flag = true;
if (isGetRootWin != null && typeof (isGetRootWin) != 'undefined') {
if (isGetRootWin == true || isGetRootWin == false) {
flag = isGetRootWin;
} else {
flag = true;
}
} else {
flag = true;
}
var easysiteParamKey = "";
if (flag) {
try {
easysiteParamKey = getRootWin().document.getElementById("easysiteParamKey").value;
} catch (e) {
easysiteParamKey = document.getElementById("easysiteParamKey").value;
}
} else {
easysiteParamKey = document.getElementById("easysiteParamKey").value;
}
return strEnc(paramString, easysiteParamKey);
}
//ajax鍔ㄦ€佸姞杞絧ortlet妯″潡
function loadAisiteAjaxModule(id, url, jsonString) {
if (jsonString == undefined || jsonString == null || jsonString == "") {
$.ajax({
type: "post",
url: url,
dataType: "html",
success: function (data) {
$("#" + id).html(data);
}
});
} else {
let formdata = JSON.parse(jsonString);
$.ajax({
type: "post",
url: url,
data: formdata,
dataType: "html",
success: function (data) {
$("#" + id).html(data);
}
});
}
}
//婊氬姩鍔犺浇aiste鏂囩珷鍒楄〃
function aisiteScrollLoadArticleHtml(params) {
var __data = $.extend({}, params.data, {
currentPage: params.currentPage != undefined ? params.currentPage : 2,
pageNo: params.pageNo != undefined ? params.pageNo : 1
});
var lsScrollAjaxHandle = function () {
window.loadArticleData = false;
return $.ajax({
type: "POST",
url: params.url,
data: __data,
dataType: params.dataType
// success: function (response) {
// resolve(response)
// }
});
}
var __el = $(params.el);
//鏄惁鍔犺浇鏁版嵁锛岄槻姝㈠娆″姞杞
window.loadArticleData = true;
//鏁版嵁鍔犺浇缁撴潫鏍囪瘑
window.loadArticleDataEndState = false;
__el.bind("scroll", function (e) {
if ((__el[0].clientHeight + __el[0].scrollTop) >= (__el[0].scrollHeight - 10)) {
if (window.loadArticleData && !window.loadArticleDataEndState) {
lsScrollAjaxHandle().then(function (response) {
window.loadArticleData = true;
__data = $.extend({}, __data, {currentPage: __data.currentPage + 1, pageNo: __data.pageNo + 1});
params.success(response);
});
} else {
console.log("澶氫綑涓嬫媺鍔犺浇鏁版嵁璇锋眰宸茶蹇界暐");
}
}
});
if (__data.pageNo == 1 && params.init.load) {
lsScrollAjaxHandle().then(function (response) {
window.loadArticleData = true;
__data = $.extend({}, __data, {pageNo: __data.pageNo + 1});
params.success(response);
});
}
}
$(document)
.ready(
function () {
$("[easysitetabul=true] a").on('mouseover', function () {
var obj = $(this).attr('aria-controls');
var $parent = $(this).parent();
$parent.addClass('active').siblings().removeClass('active');
$('#' + obj).addClass('active').siblings().removeClass('active');
});
$(".eps-portlet-header").hide();
// 澶勭悊涓€у寲闂ㄦ埛妯″潡鐨勬樉绀
// $.each($("[runat='server'][id][type]"),function(){
// var $panelEle=$(this);
// var type=$panelEle.attr("type");
// var panelCode=$panelEle.attr("id");
// // 鍒ゆ柇鐢ㄦ埛鏄惁鐧婚檰
// if(type=="admin"){
// if($("#currentLoginUserLoginName").val().match(/^\s*$/)){
// return;
// }
// }else if(type=="member"){
// if($("#currentLoginMemberName").val().match(/^\s*$/)){
// return;
// }
// }else{
//
// return;
// }
// // 鏄剧ず娣诲姞妯″潡鐨?鍙
// var moduleAddHtml = " ";
// $(this).prepend(moduleAddHtml);
// // 缁檖ortlet绐楀彛鍔犲叆鍒犻櫎鍔熻兘
// //$(".eportal_title_close").show();
// $("a[personality='yes']").click(function() {
// deletePersonNalityPortlet($(this),type);
// });
// $(".personalized").sortable({
// opacity : 0.5,
// // 鎷栧姩鐨勯€忔槑搴
// revert : false,
// // 缂撳啿鏁堟灉
// appendTo : "parent",
// containment : false,
// cursor : 'move',
// // 鎷栧姩鐨勬椂鍊欓紶鏍囨牱寮
// connectWith : '.column',
// // axis: false, // 鍏冪礌浠呰兘妯悜鎴栫旱鍚戞嫋鍔ㄣ€傚彲閫夊€硷細'x', 'y'
// handle : '.eportal_title',
// placeholder : 'ui-state-highlight',
// forcePlaceholderSize : true,
// forceHelperSize : true,
// tolerance : "intersect",
// cancel :"span",
// // 闃绘鎺掑簭鍔ㄤ綔鍦ㄥ尮閰嶇殑鍏冪礌涓婂彂鐢熴€
// tolerance : "pointer",
// dropOnEmpty : true
// }).enableSelection().bind(
// 'sortupdate',
// function(event, ui) {
// // 淇濆瓨涓€у寲妯″潡绉诲姩鎿嶄綔
// savePersonalityPortletLayoutSetting(type);
// }).attr("border", "1px dotted #dcdcdc");
// });
// $('head').append(``)
// 鍒ゆ柇鏄惁涓轰釜鎬у寲椤甸潰
function isPersonalityPage() {
var containers = $('[runat="server"][type="admin"]');
return containers.length > 0;
}
if (isPersonalityPage()) {
$('head').append(' ')
$('head').append('')
}
/** ************澶勭悊鏂囩珷鍜屾爮鐩鏁板姛鑳?*********************************************************** */
$.each($("span[articlehits=yes]"), function () {
var countFlag = $(this);
if (countFlag != null && typeof (countFlag[0]) != "undefined") {
var articleKey = countFlag.attr("articlekey");
if (articleKey != null && articleKey != "undefined" && !articleKey.match(/^\s*$/)) {
var moduleId = $("#eportalappPortletId").val();
var url = "/eportal/ui?pageId=" + $("#eprotalCurrentPageId").val() + "&moduleId=" + moduleId + "&articleKey=" + articleKey + "&portal.url=/portlet/countingFront/saveInfo&getHitsOnly=true";
if (countFlag.attr("scan") == "yes") {
var moduleId = $("#epsPortletId").val();
var url = "/eportal/ui?pageId=" + $("#eprotalCurrentPageId").val() + "&moduleId=" + moduleId + "&articleKey=" + articleKey + "&portal.url=/portlet/articleScan/getCountByArticleKey";
}
$.ajax({
type: "post",
url: url,
dataType: "text",
success: function (msg) {
countFlag.html(msg);
}
});
}
}
});
//pdf棰勮澶勭悊
var pdfViewEle = $("a[aisitepdfview=true]");
if (pdfViewEle && pdfViewEle.length > 0) {//娌℃湁浣跨敤鏂囩珷璁℃暟鍔熻兘
$.each(pdfViewEle, function () {
var $pdfViewA = $(this);
var pdfHref = $pdfViewA.attr("href");
var pdfheight = $pdfViewA.attr("aisitepdfheight");
var pdfjsHtml = "/eportal/uiFramework/js/pdfjs/web/viewer.html";
if ($("#isStaticRequest").val() == "yes") {
pdfjsHtml = "/uiFramework/js/pdfjs/web/viewer.html";
}
var url = pdfjsHtml + "?file=" + pdfHref;
var iframeHtml = String.format("", url, pdfheight);
$pdfViewA.replaceWith(iframeHtml);
});
}
/** ************澶勭悊鍔ㄦ€佸姞杞芥枃绔犳ā鍧?*********************************************************** */
if ($("[aisitearticlemodule=true]")[0]) {
var aisiteLoadArticleDataPageNo = 1;
if ($("[aisitearticlemodule=true]").size() > 1) {
console.log("婊氬姩鍔犺浇椤甸潰澶辫触锛岄〉闈笂鍙戠幇浜嗕袱涓粴鍔ㄥ姞杞界殑鏂囩珷妯″潡锛?);
} else {
$("html,body").css({"height": "100%", "overflow": "auto"});
//鑾峰彇绗竴涓厓绱
var $aisiteArticleModule = $("[aisitearticlemodule=true]:first");
if ($aisiteArticleModule != null && typeof ($aisiteArticleModule[0]) != "undefined") {
var url = $aisiteArticleModule.attr("aisitearticlemoduleurl");
var $form = $aisiteArticleModule.closest("form");
var form;
var params = "";
if (typeof ($form[0]) != "undefined") {
form = $form[0];
} else {
$forms = $aisiteArticleModule.closest(".portlet").find("form");
if (typeof ($forms[0]) != "undefined") {
form = $forms[0];
}
}
if (form) {
params = $(form).serialize();
}
if (params != "") {
url += params;
}
var pageSize = $aisiteArticleModule.attr("pageSize");
var loadMode = $aisiteArticleModule.attr("loadMode");
if (loadMode == "scrollLoad") {
aisiteScrollLoadArticleHtml({
el: "body",
url: url,
data: { //璇锋眰鍙傛暟銆
pageSize: pageSize
},
init: { //鍒濆鍖栦竴浜涢厤缃€
load: false
},
dataType: "html",
success: function (html) {
var pageHtml = $(html).find("[aisitearticlemodule='true']").html();
if (!pageHtml.match(/^\s*$/)) {
$aisiteArticleModule.append(pageHtml);
try {
$aisiteArticleModule.trigger("executeProjectJs")
} catch (e) {
}
} else {
window.loadArticleDataEndState = true;
}
}
});
} else {
$("[aisiteloadarticledatabtn='true']").on("click", function () {
var $aisiteLoadArticleDataBtn = $(this);
$.ajax({
type: "POST",
url: url,
data: {"pageSize": pageSize, "currentPage": ++aisiteLoadArticleDataPageNo},
dataType: "html",
success: function (html) {
var pageHtml = $(html).find("[aisitearticlemodule='true']").html();
if (!pageHtml.match(/^\s*$/)) {
$aisiteArticleModule.append(pageHtml);
try {
$aisiteArticleModule.trigger("executeProjectJs")
} catch (e) {
}
} else {
$aisiteLoadArticleDataBtn.hide();
}
}
});
});
}
}
}
}
$(".eportal_title_close").hide();
$(document).on('click', '.ads_click_cls', function () {
var id;
var pageId = $("#eprotalCurrentPageId").val();
var url = '/eportal/ui?portal.url=/portlet/adsPortlet/addClickNum&moduleId=3&pageId=' + pageId;
var adstype = $(this).attr("adstype");
if ('juxing' == adstype || 'piaofu' == adstype) {
id = $(this).attr("id");
} else {
id = $(this).attr("adsid");
}
$.ajax({
type: "POST",
url: url,
data: {adsId: id},
dataType: "text",
success: function (data) {
}
});
});
});
function dealDefaultPanelBackground($portletPanel) {
// 澶勭悊瀹瑰櫒閲屾ā鍧椾负绌虹殑鎯呭喌
if ($portletPanel.find("[class=portlet]")[0]) {
$portletPanel.removeClass("easysite-section-one-background");
$portletPanel.removeClass("easysite-section-two-background");
$portletPanel.removeClass("easysite-section-three-background");
$portletPanel.removeClass("easysite-section-four-background");
$portletPanel.removeClass("easysite-section-five-background");
} else {
var panelId = $portletPanel.attr("id");
if (panelId == "panel1") {
$portletPanel.addClass("easysite-section-one-background");
} else if (panelId == "panel2") {
$portletPanel.addClass("easysite-section-two-background");
} else if (panelId == "panel3") {
$portletPanel.addClass("easysite-section-three-background");
} else if (panelId == "panel4") {
$portletPanel.addClass("easysite-section-four-background");
} else if (panelId == "contentpanel") {
$portletPanel.addClass("easysite-section-five-background");
}
}
}
/**
* 绯荤粺鑷甫寮瑰嚭灞傛柟娉
*
* @param id
* 寮瑰嚭妗唅d
* @param title
* 寮瑰嚭妗嗘爣棰
* @param url
* 寮瑰嚭妗嗘墦寮€鐨刄RL鍦板潃閾炬帴
* @param width
* 瀹藉害
* @param height
* 楂樺害
* @param zIndex
* 绐楀彛鐨刬ndex灞炴€
* @return
*/
function openDialog(id, title, url, width, height, zIndex, lock) {
if (zIndex != null && typeof (zIndex) != 'undefined') {
zIndex = zIndex;
} else {
zIndex = 9999999999;
}
if (lock != null && typeof (lock) != 'undefined') {
if (lock == true || lock == false) {
lock = lock;
} else {
lock = true;
}
} else {
lock = true;
}
var dialog = $.dialog({
// left: 100,//鑷畾涔夊潗鏍 [left & top]
// top: '60%',
// icon: 'success.gif',//瀹氫箟娑堟伅鍥炬爣 [icon]
padding: 0,
// 鍐呭涓庤竟鐣屽~鍏呰竟璺 [padding]
// drag: false,//涓嶈鎷栨嫿 [drag & resize]
resize: false,
id: id,
// 闃叉閲嶅寮瑰嚭 [id]
title: title,
content: "url:" + url,
// 浣跨敤iframe鏂瑰紡鍔犺浇鍗曠嫭鐨勫唴瀹归〉
width: width,
height: height,
max: false,
min: false,
fixed: true,
// 闈欐瀹氫綅 [fixed]
lock: lock
// zIndex : zIndex
// 閿佸睆 [lock & background & opacity]
});
dialog.DOM.wrap.addClass('eps-portallat-list');
}
function openContentDialog(id, title, content, width, height, max, zIndex, lock) {
if (zIndex != null && typeof (zIndex) != 'undefined') {
zIndex = zIndex;
} else {
zIndex = 9999999999;
}
if (lock != null && typeof (lock) != 'undefined') {
if (lock == true || lock == false) {
lock = lock;
} else {
lock = true;
}
} else {
lock = true;
}
if (max != null && typeof (max) != 'undefined') {
if (max == true || max == false) {
max = max;
} else {
max = true;
}
} else {
max = false;
}
$.dialog({
// left: 100,//鑷畾涔夊潗鏍 [left & top]
// top: '60%',
// icon: 'success.gif',//瀹氫箟娑堟伅鍥炬爣 [icon]
padding: 0,
// 鍐呭涓庤竟鐣屽~鍏呰竟璺 [padding]
// drag: false,//涓嶈鎷栨嫿 [drag & resize]
resize: false,
id: id,
// 闃叉閲嶅寮瑰嚭 [id]
title: title,
content: content,
// 浣跨敤iframe鏂瑰紡鍔犺浇鍗曠嫭鐨勫唴瀹归〉
width: width,
height: height,
max: max,
min: false,
fixed: true,
// 闈欐瀹氫綅 [fixed]
lock: lock
// zIndex : zIndex
// 閿佸睆 [lock & background & opacity]
});
}
/**
* 寮瑰嚭灞傚璇濇鏄剧ず鏂规硶
*
* @param title
* 鏍囬
* @param url
* iframe椤甸潰瀵瑰簲鐨勫湴鍧€
* @param width
* 瀹藉害
* @param height
* 楂樺害
* @param lock
* 鏄惁涓烘ā寮忓璇濇 true涓簓es
* @param maxmin
* 鏄惁涓哄叏灞
* @param type
* 0锛堜俊鎭锛?锛堥〉闈㈠眰锛?锛坕frame灞傦紝榛樿锛?锛堝姞杞藉眰锛?锛坱ips灞傦級
* @param zIndex
* zIndex灞炴€
* @return
*/
function openLayerDialog(title, url, width, height, lock, maxmin, type, zIndex) {
if (type == null || typeof (type) == 'undefined') {
type = 2;
}
if (lock != null && typeof (lock) != 'undefined') {
if (lock != true && lock != false) {
lock = true;
}
} else {
lock = true;
}
if (maxmin == null || typeof (maxmin) == 'undefined') {
maxmin = false;
}
if (zIndex != null && typeof (zIndex) != 'undefined') {
zIndex = zIndex;
} else {
zIndex = 9999999999;
}
layer.open({
type: type,
title: title,
area: [width, height],
shadeClose: !lock,
content: url,
maxmin: maxmin
});
}
/**
* 淇℃伅鎻愮ず鍑芥暟
*
* @param txt
* 娆叉彁绀虹殑淇℃伅锛屾淇℃伅蹇呴€
* @param tp
* 鎻愮ず鐨勭姸鎬侊紝鏈?涓€硷細'okay'锛堟垚鍔燂級锛?warn'锛堣鍛婏級锛?error'锛堥敊璇級锛?load'锛堝姞杞戒腑锛?榛樿涓哄姞杞戒腑锛屽彲鏍规嵁鎯呭喌鐪佺暐
* @param tm
* 鎻愮ず涔嬪悗闅愯棌鐨勬椂闂达紝鍗曚綅涓虹锛岄粯璁や负3绉掞紝鍙渷鐣
* @return
*/
function showTipsDialog(txt, tp, tm) {
var tip = $.fn.Tips({
text: txt,
type: tp,
time: tm
});
return tip;
}
/** 鍙栨秷椤甸潰甯冨眬 */
function cancelSetting() {
$("#noticeArea").hide();
window.location.reload();
}
// 閫夋嫨涓€у寲妯″潡鍒楄〃
function choosePersonNalityModule(panelType,panelCode){
var moduleId="0";
var pageId=$("#eprotalCurrentPageId").val();
var url="/eportal/ui?pageId="+pageId+"&moduleId="+moduleId+"&panelType="+panelType+"&panelCode="+panelCode+"&portal.url=/portlet/portletPersonality/toChooseModuleList";
openDialog("PersonNalityModuleList","璇烽€夋嫨鎰熷叴瓒g殑妯″潡",url,900,600);
}
/** 鍒犻櫎涓€у寲妯″潡portlet */
function deletePersonNalityPortlet($close,panelType) {
if($("#currentLoginUserLoginId").val() == "") {
showTipsDialog("浼氳瘽宸插け鏁堬紝3绉掑悗鍒锋柊椤甸潰锛?, "error");
setTimeout(function(){
window.location.reload();
}, 3000);
return
}
var portletId = $close.closest(".portlet").attr("id");
var panelCode = $close.closest(".column").attr("id");
var pageId=$("#eprotalCurrentPageId").val();
var moduleId="0";
var url="/eportal/ui?pageId="+pageId+"&moduleId="+moduleId+"&panelType="+panelType+"&panelCode="+panelCode+"&portal.url=/portlet/portletPersonality/deletePersonalityModule";
var message = "浣犵‘瀹氳鍒犻櫎杩欎釜妯″潡鍚楋紵";
$.dialog.confirm(message, function() {
$.ajax( {
type : "post",
url : url,
dataType : "json",
data : {
"portletId" : portletId
},
async : false,
// 璁剧疆涓哄悓姝
success : function(data) {
if (data.success) {
showTipsDialog('宸叉垚鍔熷垹闄よ妯″潡锛?, "okay");
$close.closest(".portlet").remove();
// refreshMobileViewIframe();
} else {
$.dialog.alert("鍒犻櫎妯″潡鍑洪敊鍟︼紒閿欒淇℃伅锛?+data.errorMsg);
}
},
error : function() {
$.dialog.alert("璇锋眰澶辫触锛?);
flag = false;
}
});
});
}
/** 鏀瑰彉妯″紡 */
function changeMode(showMode, notice) {
var $pageId = $("#eprotalCurrentPageId").val();
var url = "/eportalsite/portal/portletManage/changeMode?pageId=" + $pageId;
$.ajax({
type: "post",
url: url,
dataType: "text",
data: {
"showMode": showMode
},
success: function (msg) {
if (checkPermission(msg)) {
if (msg == "success") {
$.dialog.tips('姝e湪鍒囨崲鑷? + notice, 2, "loading2.gif");
setTimeout(function () {
window.location.reload();
}, 1000);
} else {
$.dialog.alert("鏀瑰彉璁捐妯″紡鍑洪敊鍟︼紒");
}
}
},
error: function () {
// $.dialog.alert("鍑洪敊鍟︼紒");
flag = false;
}
});
}
/** 鏀瑰彉妯″紡 */
function changeDevice(data) {
// var aisiteDevice = $(element).val();
var aisiteDevice = data.value;
var $pageId = $("#eprotalCurrentPageId").val();
var url = "/eportalsite/portal/portletManage/changeDevice?pageId=" + $pageId;
// var deviceName = $("option[value=" + aisiteDevice + "]:selected").text();
var deviceName = data.text;
$.ajax({
type: "post",
url: url,
dataType: "text",
data: {
"aisiteDevice": aisiteDevice
},
success: function (msg) {
if (checkPermission(msg)) {
if (msg == "success") {
$.dialog.tips('姝e湪鍒囨崲鑷? + deviceName + '璁惧', 2, "loading2.gif");
setTimeout(function () {
var locationUrl = window.location.href;
if (locationUrl.indexOf("aisiteDevice") > -1) {
locationUrl = locationUrl.replace("aisiteDevice=pc", "aisiteDevice=" + aisiteDevice);
locationUrl = locationUrl.replace("aisiteDevice=phone", "aisiteDevice=" + aisiteDevice);
locationUrl = locationUrl.replace("aisiteDevice=pad", "aisiteDevice=" + aisiteDevice);
locationUrl = locationUrl.replace("aisiteDevice=virtual", "aisiteDevice=" + aisiteDevice);
locationUrl = locationUrl.replace("aisiteDevice=smart", "aisiteDevice=" + aisiteDevice);
} else {
if (locationUrl.indexOf("?") > -1) {
locationUrl += "&aisiteDevice=" + aisiteDevice;
} else {
locationUrl += "?aisiteDevice=" + aisiteDevice;
}
}
window.location.replace(locationUrl);
}, 1000);
} else {
$.dialog.alert("鍒囨崲璁惧鍑洪敊鍟︼紒");
}
}
},
error: function () {
flag = false;
}
});
}
/** 妫€鏌ュ苟鎻愮ず鍓嶅彴鎿嶄綔鐩稿叧鏉冮檺 */
function checkPermission(msg) {
try {
var result = msg.split("#");
if (result[0].includes("sessionInvalidate")) {
$.dialog.alert("浼氳瘽宸茬粡澶辨晥锛岃閲嶆柊鐧诲綍锛?, function () {
getRootWin().location.href = result[1];
});
return false;
} else if (result[0].includes("withoutPermission")) {
$.dialog.alert("浣犳病鏈夎闂鍔熻兘鐨勬潈闄愶紒", function () {
getRootWin().location.href = result[1];
});
return false;
}
} catch (e) {
console.log(e);
}
return true;
}
/** 杩斿洖浠绘剰娣卞害鐨刬frame绐椾綋鐨勭埗绐椾綋 */
function getRootWin() {
var win = window;
while (win != win.parent) {
win = win.parent;
}
if (win.HuilanA11y) {
win = win.frames[0];
}
return win;
}
/** 涓巎ava涓璭ndWith鏈夌浉鍚岀殑鍔熻兘 */
function endWith(s1, s2) {
if (s1.length < s2.length)
return false;
if (s1 == s2)
return true;
if (s1.substring(s1.length - s2.length) == s2)
return true;
return false;
}
/** 鏄剧ず鏃堕棿 */
function showTime(clockId) {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth();
var date = now.getDate();
var day = now.getDay();
var hour = now.getHours();
var minu = now.getMinutes();
var sec = now.getSeconds();
var week;
month = month + 1;
if (month < 10)
month = "0" + month;
if (date < 10)
date = "0" + date;
if (hour < 10)
hour = "0" + hour;
if (minu < 10)
minu = "0" + minu;
if (sec < 10)
sec = "0" + sec;
var arr_week = new Array("鏄熸湡鏃?, "鏄熸湡涓€", "鏄熸湡浜?, "鏄熸湡涓?, "鏄熸湡鍥?, "鏄熸湡浜?, "鏄熸湡鍏?);
week = arr_week[day];
var time = "";
time = year + "骞? + month + "鏈? + date + "鏃? + " " + hour + ":" + minu
+ ":" + sec + " " + week;
document.getElementById(clockId).innerHTML = time;
}
/** 璺宠浆鑷虫寚瀹氶〉 */
function jumpToPage(event, input, totalPages, currentPage, requestUrl) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which
: event.charCode;
var requestUrlTemp = requestUrl;
if (keyCode == 13) {
// 姝ゅ澶勭悊鍥炶溅鍔ㄤ綔
var $input = $(input);
if ($input.val().match(/^\s*$/)) {
$input.val(currentPage);
$input.focus();
} else if (!$input.val().match(/^\d*$/)) {
// alert('鍙兘杈撳叆鏁板瓧锛?);
$input.val(currentPage);
$input.focus();
} else if (parseInt($input.val()) > parseInt(totalPages)
|| parseInt($input.val()) <= 0) {
// alert('瀵逛笉璧?鎮ㄨ緭鍏ョ殑椤电爜瓒呭嚭浜嗚寖鍥达紒');
$input.val(currentPage);
$input.focus();
} else {
currentPage = $input.val();
var ajaxModule = false;
if (requestUrl.indexOf("portal.url=") > -1) {
ajaxModule = true;
}
if (ajaxModule) {
requestUrl = String.format(requestUrl, $input
.val());
queryArticleByCondition(btn, requestUrl);
return;
}
var requestUrl = requestUrl.split("||");
var isStaticRequest = $("#isStaticRequest").val();
var isOpenStaticPageList = $("#isOpenStaticPageList").val();
var defaultPublishPage = parseInt($("#defaultPublishPage").val());
var flag = false;
if (isStaticRequest == "yes") {
if (isOpenStaticPageList == "yes") {
if (currentPage > defaultPublishPage) {
requestUrl = requestUrl[0];
flag = true;
} else {
requestUrl = requestUrl[1];
}
} else {
requestUrl = requestUrl[1];
}
} else {
requestUrl = requestUrl[0];
}
if (typeof (requestUrl) == "undefined") {
requestUrl = requestUrlTemp;
}
requestUrl = String.format(requestUrl, $input
.val());
if (flag) {
requestUrl += "&staticRequest=yes";
}
queryArticleByCondition(input, requestUrl);
}
}
return;
}
function jumpTo(btn, totalPages, currentPage, requestUrl) {
var requestUrlTemp = requestUrl;
var $input = $(btn).prev("input");
if ($input.val().match(/^\s*$/)) {
$input.val(currentPage);
$input.focus();
} else if (!$input.val().match(/^\d*$/)) {
$input.val(currentPage);
$input.focus();
} else if (parseInt($input.val()) > parseInt(totalPages)
|| parseInt($input.val()) <= 0) {
// alert('瀵逛笉璧?鎮ㄨ緭鍏ョ殑椤电爜瓒呭嚭浜嗚寖鍥达紒');
$input.val(currentPage);
$input.focus();
} else {
currentPage = $input.val();
var ajaxModule = false;
if (requestUrl.indexOf("portal.url=") > -1) {
ajaxModule = true;
}
if (ajaxModule) {
requestUrl = String.format(requestUrl, $input
.val());
queryArticleByCondition(btn, requestUrl);
return;
}
var requestUrl = requestUrl.split("||");
var isStaticRequest = $("#isStaticRequest").val();
var isOpenStaticPageList = $("#isOpenStaticPageList").val();
var defaultPublishPage = parseInt($("#defaultPublishPage").val());
var flag = false;
if (isStaticRequest == "yes") {
if (isOpenStaticPageList == "yes") {
if (currentPage > defaultPublishPage) {
requestUrl = requestUrl[0];
flag = true;
} else {
requestUrl = requestUrl[1];
}
} else {
requestUrl = requestUrl[1];
}
} else {
requestUrl = requestUrl[0];
}
if (typeof (requestUrl) == "undefined") {
requestUrl = requestUrlTemp;
}
requestUrl = String.format(requestUrl, $input
.val());
if (flag) {
requestUrl += "&staticRequest=yes";
}
queryArticleByCondition(btn, requestUrl);
}
}
/** js format鍑芥暟,渚嬪锛孲tring.format(鈥橖a href=鈥?1鈥猖%2鈥? url, msg); */
String.format = function (str) {
var args = arguments, re = new RegExp("%([1-" + args.length + "])", "g");
return String(str).replace(re, function ($1, $2) {
return args[$2];
});
};
/** 鑾峰彇闅忔満棰滆壊 */
function getRandomColor() {
return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16))
.substr(-6);
}
/**
* 鐢熸垚瀵屾枃鏈紪杈戝櫒
*
* @param id
* @param width
* @param height
* @return
*/
function getCkEditor(id, width, height) {
var $pageId = getRootWin().$("#eprotalCurrentPageId").val();
var uploadUrl = "/eportalapp/portlet/portletAdminFileUpload/uploadFile?moduleId=3&pageId=" + $pageId + "&isCkEditor=true";
var ckeditor = CKEDITOR.replace(id,
{
width: width,
height: height,
autoUpdateElement: true,
skin: 'extGray',
enterMode: CKEDITOR.ENTER_BR,
filebrowserUploadUrl: uploadUrl + "&uploadType=attach",
filebrowserImageUploadUrl: uploadUrl + "&uploadType=image",
filebrowserFlashUploadUrl: uploadUrl + "&uploadType=video",
resize_enabled: false,
ifCheckContent: true,
ignoreEmptyParagraph: false,
extraPlugins: 'iframedialog',
lang: navigator.language === 'zh' ? 'zh-CN' : '',
toolbar: [
{
name: 'document',
items: ['Source', '-', 'DocProps', 'Print', '-']
},
{
name: 'clipboard',
items: ['PasteText', 'PasteFromWord', '-',
'Undo', 'Redo', '-']
},
{
name: 'editing',
items: ['Find', 'Replace', '-', 'SelectAll']
},
{
name: 'insert',
items: ['Image', 'Flash', 'Table',
'HorizontalRule', '-']
},
// '/',
{
name: 'basicstyles',
items: ['Bold', 'Italic', 'Underline', 'Strike',
'-', 'RemoveFormat']
},
{
name: 'paragraph',
items: ['JustifyLeft', 'JustifyCenter',
'JustifyRight', 'JustifyBlock', '-']
}, {
name: 'links',
items: ['Link', 'Unlink', '-']
},
// 'textindent','textoutdent','textIndentAll','delAllFirstSpaces','delEmptyP','changetext'
// '/',
{
name: 'styles',
items: ['Font', 'FontSize', '-']
}, {
name: 'colors',
items: ['TextColor', 'BGColor', '-']
}, {
name: 'tools',
items: ['ShowBlocks','']
},
{
name: 'insertHtml',
items: ['ShowInsertHtml']
}
]
});
return ckeditor;
}
function getMyCkEditor(id, array, hasTabBar, readOnly, ifCheckContent, isSourceMode) {
if (readOnly != null && typeof (readOnly) != 'undefined') {
readOnly = readOnly;
} else {
readOnly = false;
}
if (ifCheckContent != null && typeof (ifCheckContent) != 'undefined') {
ifCheckContent = ifCheckContent;
} else {
ifCheckContent = false;
}
var $pageId = getRootWin().$("#eprotalCurrentPageId").val();
var uploadUrl = "/eportalapp/portlet/portletAdminFileUpload/uploadFile?moduleId=3&pageId=" + $pageId + "&isCkEditor=true";
var isOnlyUseCkeditorSourceMode = $("#isOnlyUseCkeditorSourceMode").val();
var myToolBar = null;
var startupMode = "wysiwyg";
if ("yes" == isOnlyUseCkeditorSourceMode) {
myToolBar = [
{name: 'document', items: ['DocProps', 'Print', '-']},
{name: 'clipboard', items: ['PasteText', '-', 'Undo', 'Redo', '-']},
// { name: 'clipboard', items : [
// 'PasteText','PasteFromWord','-','Undo','Redo','-' ] },
{name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll']},
{name: 'insert', items: ['imageUpload', 'Flash', 'Table', 'HorizontalRule', '-']},
// { name: 'insert', items : [
// 'Image','Flash','Table','HorizontalRule','-'] },
// '/',
{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat']},
{name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-']},
{name: 'links', items: ['Link', 'Unlink', '-']},
// 'textindent','textoutdent','textIndentAll','delAllFirstSpaces','delEmptyP','changetext'
// '/',
{name: 'styles', items: ['Font', 'FontSize', '-']},
{name: 'colors', items: ['TextColor', 'BGColor', '-']},
{name: 'tools', items: ['ShowBlocks','ShowInsertHtml']},
];
startupMode = "source";
} else {
myToolBar = [
{name: 'document', items: ['Source', '-', 'DocProps', 'Print', '-']},
{name: 'clipboard', items: ['PasteText', '-', 'Undo', 'Redo', '-']},
// { name: 'clipboard', items : [
// 'PasteText','PasteFromWord','-','Undo','Redo','-' ] },
{name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll']},
{name: 'insert', items: ['imageUpload', 'Flash', 'Table', 'HorizontalRule', '-']},
// { name: 'insert', items : [
// 'Image','Flash','Table','HorizontalRule','-'] },
// '/',
{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat']},
{name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-']},
{name: 'links', items: ['Link', 'Unlink', '-']},
// 'textindent','textoutdent','textIndentAll','delAllFirstSpaces','delEmptyP','changetext'
// '/',
{name: 'styles', items: ['Font', 'FontSize', '-']},
{name: 'colors', items: ['TextColor', 'BGColor', '-']},
{name: 'tools', items: ['ShowBlocks','ShowInsertHtml']},
];
// 濡傛灉鏄痟tml缂栬緫椤甸潰闇€瑕佹牴鎹郴缁熷弬鏁癷sShowSource鏉ユ帶鍒舵簮鐮佹寜閽殑鏄剧ず
var isShowSourceButton = document.getElementById("isShowSourceButton");
if (typeof (isShowSourceButton) != 'undefined') {
try {
isShowSourceButton = document.getElementById("isShowSourceButton").value;
} catch (e) {
isShowSourceButton = "true";
}
} else {
isShowSourceButton = "true";
}
if (isShowSourceButton != "true") {
myToolBar = [
{name: 'document', items: ['DocProps', 'Print', '-']},
{name: 'clipboard', items: ['PasteText', '-', 'Undo', 'Redo', '-']},
// { name: 'clipboard', items : [
// 'PasteText','PasteFromWord','-','Undo','Redo','-' ]
// },
{name: 'editing', items: ['Find', 'Replace', '-', 'SelectAll']},
{name: 'insert', items: ['imageUpload', 'Flash', 'Table', 'HorizontalRule', '-']},
// { name: 'insert', items : [
// 'Image','Flash','Table','HorizontalRule','-'] },
// '/',
{name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat']},
{name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-']},
{name: 'links', items: ['Link', 'Unlink', '-']},
// 'textindent','textoutdent','textIndentAll','delAllFirstSpaces','delEmptyP','changetext'
// '/',
{name: 'styles', items: ['Font', 'FontSize', '-']},
{name: 'colors', items: ['TextColor', 'BGColor', '-']},
{name: 'tools', items: ['ShowBlocks', 'ShowInsertHtml']},
];
}
}
if (myToolBar) {
var last = myToolBar[myToolBar.length - 1];
if (last.name === 'tools') {
last.items.push('codeMirrorDialog')
}
}
var editor = new myEditor(document.getElementById(id), {
toolbar: myToolBar,
data: array,
hasTabBar: hasTabBar,
readOnly: readOnly,
hasFormatBar: false,
ifCheckContent: ifCheckContent,
startupMode: startupMode,
enterMode: CKEDITOR.ENTER_BR,
ignoreEmptyParagraph: false,
filebrowserImageUploadSuffix: ["gif", "jpg", "jpeg", "bmp", "png", "GIF", "JPG", "JPEG", "BMP", "PNG"],
filebrowserUploadUrl: uploadUrl + "&uploadType=attach",
filebrowserFlashUploadUrl: uploadUrl + "&uploadType=video",
filebrowserImageUploadUrl: uploadUrl + "&uploadType=image",
ImgUploadUrl: uploadUrl + "&imageUpload=true&uploadType=image"
});
return editor;
}
/**
* @param element
* 瑙﹀彂鐨勫厓绱
* @param url
* 鏌ヨ鍦板潃
* @return
*/
function queryArticleByCondition(element, url) {
var ajaxModule = false;
if (url.indexOf("portal.url=") > -1) {
ajaxModule = true;
}
if (ajaxModule) {
var $form = $(element).closest("form");
var form;
var params = "";
if (typeof ($form[0]) != "undefined") {
form = $form[0];
} else {
$forms = $(element).closest(".portlet").find("form");
if (typeof ($forms[0]) != "undefined") {
form = $forms[0];
}
}
if (form) {
params = $(form).serialize();
}
if (params != "") {
url += params;
}
var id = $(element).closest(".portlet").find("div[aisiteajaxmodule=true]").attr("id");
loadAisiteAjaxModule(id, url, "");
} else {
if(url.indexOf(".html")>0||url.indexOf(".shtml")>0){
jumpToUrl(url);
return;
}
var $form = $(element).closest("form");
var params = "";
if (typeof ($form[0]) != "undefined") {
$form[0].action = url;
$form[0].submit();
} else {
$forms = $(element).closest(".portlet").find("form");
if (typeof ($forms[0]) != "undefined") {
$forms[0].action = url;
$forms[0].submit();
} else {
jumpToUrl(url);
}
}
}
}
function jumpToUrl(url) {
getRootWin().location.href = url;
}
/**
* 鍓嶅彴绯荤粺閫€鍑
*
* @param url
* @return
*/
function logoutCms() {
var $pageId = $("#eprotalCurrentPageId").val();
var url = "/eportalsite/aisiteUserLogin/logout?moduleId=0&pageId=" + $pageId;
$.ajax({
type: "post",
url: url,
dataType: "json",
success: function (data) {
if (data.success) {
window.location.reload();
} else {
console.log("logoutCms result=" + data);
}
}
});
}
/** js鏆傚仠鍑芥暟 */
function Pause(obj, iMinSecond) {
if (window.eventList == null)
window.eventList = new Array();
var ind = -1;
for (var i = 0; i < window.eventList.length; i++) {
if (window.eventList[i] == null) {
window.eventList[i] = obj;
ind = i;
break;
}
}
if (ind == -1) {
ind = window.eventList.length;
window.eventList[ind] = obj;
}
setTimeout("GoOn(" + ind + ")", iMinSecond);
}
// js缁х画鍑芥暟
function GoOn(ind) {
var obj = window.eventList[ind];
window.eventList[ind] = null;
if (obj.NextStep)
obj.NextStep();
else
obj();
}
/** 鍦ㄥ墠鍙板垹闄ゆ枃绔 */
function deleteArticleFun(entityId, columnId) {
var pageId = $("#eprotalCurrentPageId").val();
var url = "/eportal/ui?moduleId=3&pageId=" + pageId + "&portal.url=/portlet/articlePortlet/deleteArticle";
$.dialog.confirm("浣犵‘瀹氳鍒犻櫎鍚?", function () {
$.ajax({
type: "post",
url: url,
dataType: "text",
data: {"entityId": entityId, "columnId": columnId},
success: function (msg) {
if (msg == "success") {
showTipsDialog('鍒犻櫎鎴愬姛锛?, 'okay');
window.location.reload();
} else {
$.dialog.alert(msg);
}
},
error: function (response) {
$.dialog.alert("鍒犻櫎澶辫触!" + response);
}
});
});
}
/** 鍔ㄦ€佸紩鍏s鏂囦欢 */
function includeJsFile(jsPath, callback) {
var flag = false;
var scriptTags = document.getElementsByTagName('script');
for (var i = 0; i < scriptTags.length; i++) {
var src = scriptTags[i].getAttribute("src");
if (src == jsPath) {
flag = true;
break;
}
}
if (!flag) {
if (typeof (callback) != "undefined" && !callback.match(/^\s*$/)) {
// 鍒涘缓娴姩灞
$.blockUI({
message: " 鍔犺浇鏁版嵁涓?.....璇风◢鍚庯紒 ",
css: {
border: '3px solid #FFFFFF',
height: '40px'
},
overlayCSS: {
backgroundColor: '#E5ECF9'
}
});
}
var html_doc = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', jsPath);
html_doc.appendChild(script);
if ($.browser.msie) {
script.onreadystatechange = function () {
if (this.readyState == 'loaded' || this.readyState == 'complete') {
if (typeof (callback) != "undefined" && !callback.match(/^\s*$/)) {
// 鍏抽棴娴姩灞
$.unblockUI();
eval(callback + "()");
}
}
}
} else {
script.onload = function () {
if (typeof (callback) != "undefined" && !callback.match(/^\s*$/)) {
// 鍏抽棴娴姩灞
$.unblockUI();
eval(callback + "()");
}
}
}
} else {
if (typeof (callback) != "undefined" && !callback.match(/^\s*$/)) {
eval(callback + "()");
}
}
return false;
}
/** 鍔ㄦ€佸紩鍏s鏂囦欢 */
function includeJsFileAllWaysCreate(jsPath, src) {
var flag = false;
var scriptTags = document.getElementsByTagName('script');
for (var i = 0; i < scriptTags.length; i++) {
var scriptTag = scriptTags[i];
var src = scriptTag.getAttribute("src");
if (src == jsPath) {
scriptTag.parentNode.removeChild(scriptTag);
break;
}
}
var html_doc = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', jsPath);
html_doc.appendChild(script);
return false;
}
/** 鍒锋柊鎵嬫満绔欑偣iframe椤甸潰 */
function refreshMobileViewIframe() {
if ($("iframe[class=eps-phone-view]")[0]) {
var eprotalCurrentPageId = $("#eprotalCurrentPageId").val();
$("iframe[class=eps-phone-view]").attr("src", "/eportal/ui?mobilePreviewMode=true&&pageId=" + eprotalCurrentPageId);
}
}
/** 鍒涘缓cookie */
function setCookie(name, value) {
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
if (expires != null) {
var LargeExpDate = new Date();
LargeExpDate.setTime(LargeExpDate.getTime()
+ (expires * 1000 * 3600 * 24));
}
document.cookie = name
+ "="
+ escape(value)
+ ((expires == null) ? "" : ("; expires=" + LargeExpDate
.toGMTString()));
}
/** 鑾峰彇cookie */
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
} else
return ""
}
}
/** 鍒ゆ柇http璇锋眰鏄惁鏉ヨ嚜PC璁惧 */
function jumpToPhoneSite(phoneUrl, homePageId) {
// 骞冲彴銆佽澶囧拰鎿嶄綔绯荤粺
var system = {
win: false,
mac: false,
xll: false
};
// 妫€娴嬪钩鍙
var p = navigator.platform;
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
var flag = system.win || system.mac || system.xll;
// 濡傛灉涓嶆槸鏉ヨ嚜鐢佃剳鍒欒浆鍚戞墜鏈哄湴鍧€
if (!flag) {
var eprotalCurrentPageId = $("#eprotalCurrentPageId").val();
if (typeof (homePageId) == "undefined" || homePageId == null || homePageId == null) {
window.location.href = phoneUrl;
} else if (eprotalCurrentPageId == homePageId) {
window.location.href = phoneUrl;
}
}
}
// 澶勭悊sns鐢ㄦ埛鐧诲綍
function toSnsUserLogin(loginType) {
var $eportalappPortletId = $("#eportalappPortletId").val();
var $pageId = $("#eprotalCurrentPageId").val();
var toSnsLoginUrl = "/eportal/ui?moduleId=" + $eportalappPortletId + "&pageId=" + $pageId + "&portal.url=/portlet/memberSnsLogin/toSnsLogin";
window.location.href = toSnsLoginUrl + "&loginType=" + loginType;
}
// // 澶勭悊閿欒椤甸潰鎻愮ず
// $(document).keyup(function(e){
// try{
// var eprotalCurrentArticleKey=
// $("input[id='eprotalCurrentArticleKey']").val();
// if(eprotalCurrentArticleKey!=null&&eprotalCurrentArticleKey!=""){
// if(e.ctrlKey && e.which == 13) {
// if (window.getSelection) {
// var errorDescribe = window.getSelection().toString();
// toErrorCorrectViewPopUp(errorDescribe)
// }
// else if (document.getSelection) {
// var errorDescribe = document.getSelection();
// toErrorCorrectViewPopUp(errorDescribe)
// }
// else if (document.selection) {
// var errorDescribe = document.selection.createRange().text;
// toErrorCorrectViewPopUp(errorDescribe)
// }
// }
// }
// }catch(err){
// }
// });
// 璺宠浆鑷崇籂閿欓〉闈
function toErrorCorrectViewPopUp(errorDescribe) {
try {
var moduleId;
var pageId = $("input[id='eprotalCurrentPageId']").val()
var articleKey = $("input[id='eprotalCurrentArticleKey']").val();
var columnId = $("input[id='eprotalCurrentColumnId']").val()
var url = window.location.href;
url = url.replace(/&/g, "^");
var title = document.title;
jQuery.ajax({
type: "POST",
dataType: "json",
url: "/eportal/ui?moduleId=3&portal.url=/portlet/errorCorrectPortlet/getModuleId",
async: false,
error: function (request) {
},
success: function (data) {
if(data.success){
moduleId = data.data;
var popUrl = "/eportal/ui?mode=popup&columnId=" + columnId + "&moduleId=" + moduleId + "&channelId=" + pageId
+ "&articleKey=" + articleKey + "&url=" + url + "&title=" + title + "&errorDescribe=" + errorDescribe
+ "&portal.url=/portlet/errorCorrectPortlet/toView";
openDialog('toErrorCorrectView', '鏂囩珷绾犻敊绠$悊', popUrl, 800, 300);
}else{
console.log(data);
}
}
});
} catch (err) {
}
}
function toErrorCorrectView() {
try {
var id = "";
;
jQuery.ajax({
type: "POST",
dataType: "json",
url: "/eportal/ui?moduleId=3&portal.url=/portlet/errorCorrectPortlet/getPageId&pageId=" + $("#eprotalCurrentPageId").val(),
async: false,
error: function (request) {
},
success: function (data) {
if (data.success) {
id = data.data;
}
}
});
if (id == "") {
alert("璇疯缃绔欑偣榛樿绾犻敊椤甸潰锛?);
return;
}
var pageId = $("input[id='eprotalCurrentPageId']").val();
var articleKey = $("input[id='eprotalCurrentArticleKey']").val();
var columnId = $("input[id='eprotalCurrentColumnId']").val()
var aform = document.createElement('form');
var url = window.location.href;
var title = document.title;
if ($("#eprotalCurrentArticleTitle").val() != "") {
title = $("#eprotalCurrentArticleTitle").val();
}
aform.method = 'post';
aform.target = '_blank';
aform.action = '/eportal/ui?pageId=' + id;
var a = document.createElement('input');
a.type = 'hidden';
a.name = 'channelId';
a.value = pageId;
aform.appendChild(a);
var b = document.createElement('input');
b.type = 'hidden';
b.name = 'articleKey';
b.value = articleKey;
aform.appendChild(b);
// var c = document.createElement('input');
// c.type = 'hidden';
// c.name = 'pageId';
// c.value = id;
// aform.appendChild(c);
var d = document.createElement('input');
d.type = 'hidden';
d.name = 'url';
d.value = url;
aform.appendChild(d);
var e = document.createElement('input');
e.type = 'hidden';
e.name = 'title';
e.value = title;
aform.appendChild(e);
var f = document.createElement('input');
f.type = 'hidden';
f.name = 'mode';
f.value = 'common';
aform.appendChild(f);
var g = document.createElement('input');
g.type = 'hidden';
g.name = 'columnId';
g.value = columnId;
aform.appendChild(g);
document.body.appendChild(aform);
aform.submit();
} catch (err) {
}
}
/**
* 璁板綍澶栭摼鏂囩珷娴忚娆℃暟
*
* @param articleKey
* 鏂囩珷key
* @return
*/
function recordLinkArticleHits(articleKey, columnId, articleTitle, element) {
if (articleKey != null && articleKey != "undefined" && articleKey != "null" && !articleKey.match(/^\s*$/)) {
$("#eprotalCurrentArticleKey").val(articleKey);
$("#eprotalCurrentColumnId").val(columnId);
$("#eprotalCurrentArticleTitle").val(articleTitle);
$("#eprotalCurrentArticleUrl").val($(element).attr("href"));
includeJsFileAllWaysCreate("/eportal/uiFramework/js/counting/ea.js?type=article");
}
}
/**
* 璁剧疆cookie
*
* @param name
* cookie鍚嶇О
* @param value
* cookie鍊
* @param expiresDays
* 杩囨湡澶╂暟锛屼负绌洪粯璁ゅ崄澶
* @return
*/
function setPortalCookie(name, value, expiresDays) {
var expDate = new Date();
if (expiresDays != null) {
expDate.setTime(expDate.getTime()
+ (expiresDays * 1000 * 3600 * 24));
} else {
expDate.setTime(expDate.getTime()
+ (10 * 1000 * 3600 * 24));
}
document.cookie = name
+ "="
+ escape(value)
+ ("; path=/; expires=" + expDate
.toGMTString());
}
/**
* 鏍规嵁cookie鐨勫悕绉拌幏鍙朿ookie
*
* @param Name
* @return
*/
function getPortalCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(offset, end))
} else {
return "";
}
}
return "";
}
/**
* 鍓嶅彴妯″潡璁剧疆椤甸潰杩斿洖璺宠浆鍑芥暟
*
* @param url
* @return
*/
function jumpToEportalPageUrl(url) {
var portalLastRequestUrl = $("#portalLastRequestUrl").val();
if (typeof (portalLastRequestUrl) != "undefined" && portalLastRequestUrl != "") {
url = portalLastRequestUrl;
}
window.location.href = url;
}
// 鑾峰彇浼氬憳淇℃伅
function getMemberLoginInfo() {
var result = "";
var url = "/eportal/ui?moduleId=" + $("#eportalappPortletId").val() + "&pageId=" + $("#eprotalCurrentPageId").val() +
"&portal.url=/portlet/memberPortlet/getLoginInfo&loginType=2";
$.ajax({
type: "post",
url: url,
async: false,// 璁剧疆涓哄悓姝
dataType: "json",
success: function (msg) {
result = msg.data;
}
});
return result;
}
function getManagerLoginInfo() {
var result = "";
var url = "/eportal/ui?moduleId=" + $("#eportalappPortletId").val() + "&pageId=" + $("#eprotalCurrentPageId").val() +
"&portal.url=/portlet/memberPortlet/getLoginInfo&loginType=1";
$.ajax({
type: "post",
url: url,
async: false,// 璁剧疆涓哄悓姝
dataType: "json",
cache: true,
timeout: 15000,
success: function (msg) {
result = msg;
}
});
return result;
}
/** 浼氬憳閫€鍑哄嚱鏁 */
function memberLogoutEasysite() {
var url = "/eportal/ui?moduleId=" + $("#eportalappPortletId").val() + "&pageId=" + $("#eprotalCurrentPageId").val() +
"&portal.url=/portlet/memberPortlet/logout";
$.ajax({
type: "post",
url: url,
dataType: "text",
timeout: 15000,
cache: true,
success: function (msg) {
msg = eval("(" + msg + ")");
if (msg.success) {
showTipsDialog('閫€鍑烘垚鍔燂紒', 'okay');
window.location.reload();
} else {
showTipsDialog('閫€鍑哄嚭閿欙紒', 'error');
}
}
});
}
function strEnc(data, firstKey, secondKey, thirdKey) {
var leng = data.length;
var encData = "";
var firstKeyBt, secondKeyBt, thirdKeyBt, firstLength, secondLength, thirdLength;
if (firstKey != null && firstKey != "") {
firstKeyBt = getKeyBytes(firstKey);
firstLength = firstKeyBt.length
}
if (secondKey != null && secondKey != "") {
secondKeyBt = getKeyBytes(secondKey);
secondLength = secondKeyBt.length
}
if (thirdKey != null && thirdKey != "") {
thirdKeyBt = getKeyBytes(thirdKey);
thirdLength = thirdKeyBt.length
}
if (leng > 0) {
if (leng < 4) {
var bt = strToBt(data);
var encByte;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
var tempBt;
var x, y, z;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, thirdKeyBt[z])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
var tempBt;
var x, y;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "") {
var tempBt;
var x = 0;
tempBt = bt;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
encByte = tempBt
}
}
}
encData = bt64ToHex(encByte)
} else {
var iterator = parseInt(leng / 4);
var remainder = leng % 4;
var i = 0;
for (i = 0; i < iterator; i++) {
var tempData = data.substring(i * 4 + 0, i * 4 + 4);
var tempByte = strToBt(tempData);
var encByte;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
var tempBt;
var x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, thirdKeyBt[z])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
var tempBt;
var x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "") {
var tempBt;
var x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
encByte = tempBt
}
}
}
encData += bt64ToHex(encByte)
}
if (remainder > 0) {
var remainderData = data.substring(iterator * 4 + 0, leng);
var tempByte = strToBt(remainderData);
var encByte;
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
var tempBt;
var x, y, z;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
for (z = 0; z < thirdLength; z++) {
tempBt = enc(tempBt, thirdKeyBt[z])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
var tempBt;
var x, y;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
for (y = 0; y < secondLength; y++) {
tempBt = enc(tempBt, secondKeyBt[y])
}
encByte = tempBt
} else {
if (firstKey != null && firstKey != "") {
var tempBt;
var x;
tempBt = tempByte;
for (x = 0; x < firstLength; x++) {
tempBt = enc(tempBt, firstKeyBt[x])
}
encByte = tempBt
}
}
}
encData += bt64ToHex(encByte)
}
}
}
return encData
}
function getKeyBytes(key) {
var keyBytes = new Array();
var leng = key.length;
var iterator = parseInt(leng / 4);
var remainder = leng % 4;
var i = 0;
for (i = 0; i < iterator; i++) {
keyBytes[i] = strToBt(key.substring(i * 4 + 0, i * 4 + 4))
}
if (remainder > 0) {
keyBytes[i] = strToBt(key.substring(i * 4 + 0, leng))
}
return keyBytes
}
function strToBt(str) {
var leng = str.length;
var bt = new Array(64);
if (leng < 4) {
var i = 0,
j = 0,
p = 0,
q = 0;
for (i = 0; i < leng; i++) {
var k = str.charCodeAt(i);
for (j = 0; j < 16; j++) {
var pow = 1,
m = 0;
for (m = 15; m > j; m--) {
pow *= 2
}
bt[16 * i + j] = parseInt(k / pow) % 2
}
}
for (p = leng; p < 4; p++) {
var k = 0;
for (q = 0; q < 16; q++) {
var pow = 1,
m = 0;
for (m = 15; m > q; m--) {
pow *= 2
}
bt[16 * p + q] = parseInt(k / pow) % 2
}
}
} else {
for (i = 0; i < 4; i++) {
var k = str.charCodeAt(i);
for (j = 0; j < 16; j++) {
var pow = 1;
for (m = 15; m > j; m--) {
pow *= 2
}
bt[16 * i + j] = parseInt(k / pow) % 2
}
}
}
return bt
}
function bt4ToHex(binary) {
var hex;
switch (binary) {
case "0000":
hex = "0";
break;
case "0001":
hex = "1";
break;
case "0010":
hex = "2";
break;
case "0011":
hex = "3";
break;
case "0100":
hex = "4";
break;
case "0101":
hex = "5";
break;
case "0110":
hex = "6";
break;
case "0111":
hex = "7";
break;
case "1000":
hex = "8";
break;
case "1001":
hex = "9";
break;
case "1010":
hex = "A";
break;
case "1011":
hex = "B";
break;
case "1100":
hex = "C";
break;
case "1101":
hex = "D";
break;
case "1110":
hex = "E";
break;
case "1111":
hex = "F";
break
}
return hex
}
function hexToBt4(hex) {
var binary;
switch (hex) {
case "0":
binary = "0000";
break;
case "1":
binary = "0001";
break;
case "2":
binary = "0010";
break;
case "3":
binary = "0011";
break;
case "4":
binary = "0100";
break;
case "5":
binary = "0101";
break;
case "6":
binary = "0110";
break;
case "7":
binary = "0111";
break;
case "8":
binary = "1000";
break;
case "9":
binary = "1001";
break;
case "A":
binary = "1010";
break;
case "B":
binary = "1011";
break;
case "C":
binary = "1100";
break;
case "D":
binary = "1101";
break;
case "E":
binary = "1110";
break;
case "F":
binary = "1111";
break
}
return binary
}
function byteToString(byteData) {
var str = "";
for (i = 0; i < 4; i++) {
var count = 0;
for (j = 0; j < 16; j++) {
var pow = 1;
for (m = 15; m > j; m--) {
pow *= 2
}
count += byteData[16 * i + j] * pow
}
if (count != 0) {
str += String.fromCharCode(count)
}
}
return str
}
function bt64ToHex(byteData) {
var hex = "";
for (i = 0; i < 16; i++) {
var bt = "";
for (j = 0; j < 4; j++) {
bt += byteData[i * 4 + j]
}
hex += bt4ToHex(bt)
}
return hex
}
function hexToBt64(hex) {
var binary = "";
for (i = 0; i < 16; i++) {
binary += hexToBt4(hex.substring(i, i + 1))
}
return binary
}
function enc(dataByte, keyByte) {
var keys = generateKeys(keyByte);
var ipByte = initPermute(dataByte);
var ipLeft = new Array(32);
var ipRight = new Array(32);
var tempLeft = new Array(32);
var i = 0,
j = 0,
k = 0,
m = 0,
n = 0;
for (k = 0; k < 32; k++) {
ipLeft[k] = ipByte[k];
ipRight[k] = ipByte[32 + k]
}
for (i = 0; i < 16; i++) {
for (j = 0; j < 32; j++) {
tempLeft[j] = ipLeft[j];
ipLeft[j] = ipRight[j]
}
var key = new Array(48);
for (m = 0; m < 48; m++) {
key[m] = keys[i][m]
}
var tempRight = xor(pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), tempLeft);
for (n = 0; n < 32; n++) {
ipRight[n] = tempRight[n]
}
}
var finalData = new Array(64);
for (i = 0; i < 32; i++) {
finalData[i] = ipRight[i];
finalData[32 + i] = ipLeft[i]
}
return finallyPermute(finalData)
}
function dec(dataByte, keyByte) {
var keys = generateKeys(keyByte);
var ipByte = initPermute(dataByte);
var ipLeft = new Array(32);
var ipRight = new Array(32);
var tempLeft = new Array(32);
var i = 0,
j = 0,
k = 0,
m = 0,
n = 0;
for (k = 0; k < 32; k++) {
ipLeft[k] = ipByte[k];
ipRight[k] = ipByte[32 + k]
}
for (i = 15; i >= 0; i--) {
for (j = 0; j < 32; j++) {
tempLeft[j] = ipLeft[j];
ipLeft[j] = ipRight[j]
}
var key = new Array(48);
for (m = 0; m < 48; m++) {
key[m] = keys[i][m]
}
var tempRight = xor(pPermute(sBoxPermute(xor(expandPermute(ipRight), key))), tempLeft);
for (n = 0; n < 32; n++) {
ipRight[n] = tempRight[n]
}
}
var finalData = new Array(64);
for (i = 0; i < 32; i++) {
finalData[i] = ipRight[i];
finalData[32 + i] = ipLeft[i]
}
return finallyPermute(finalData)
}
function initPermute(originalData) {
var ipByte = new Array(64);
for (i = 0, m = 1, n = 0; i < 4; i++, m += 2, n += 2) {
for (j = 7, k = 0; j >= 0; j--, k++) {
ipByte[i * 8 + k] = originalData[j * 8 + m];
ipByte[i * 8 + k + 32] = originalData[j * 8 + n]
}
}
return ipByte
}
function expandPermute(rightData) {
var epByte = new Array(48);
for (i = 0; i < 8; i++) {
if (i == 0) {
epByte[i * 6 + 0] = rightData[31]
} else {
epByte[i * 6 + 0] = rightData[i * 4 - 1]
}
epByte[i * 6 + 1] = rightData[i * 4 + 0];
epByte[i * 6 + 2] = rightData[i * 4 + 1];
epByte[i * 6 + 3] = rightData[i * 4 + 2];
epByte[i * 6 + 4] = rightData[i * 4 + 3];
if (i == 7) {
epByte[i * 6 + 5] = rightData[0]
} else {
epByte[i * 6 + 5] = rightData[i * 4 + 4]
}
}
return epByte
}
function xor(byteOne, byteTwo) {
var xorByte = new Array(byteOne.length);
for (i = 0; i < byteOne.length; i++) {
xorByte[i] = byteOne[i] ^ byteTwo[i]
}
return xorByte
}
function sBoxPermute(expandByte) {
var sBoxByte = new Array(32);
var binary = "";
var s1 = [
[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],
[0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],
[4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0],
[15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13]
];
var s2 = [
[15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10],
[3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5],
[0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15],
[13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9]
];
var s3 = [
[10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8],
[13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1],
[13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7],
[1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12]
];
var s4 = [
[7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15],
[13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9],
[10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4],
[3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14]
];
var s5 = [
[2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9],
[14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6],
[4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14],
[11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3]
];
var s6 = [
[12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11],
[10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8],
[9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6],
[4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13]
];
var s7 = [
[4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1],
[13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6],
[1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2],
[6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12]
];
var s8 = [
[13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7],
[1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2],
[7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8],
[2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11]
];
for (m = 0; m < 8; m++) {
var i = 0,
j = 0;
i = expandByte[m * 6 + 0] * 2 + expandByte[m * 6 + 5];
j = expandByte[m * 6 + 1] * 2 * 2 * 2 + expandByte[m * 6 + 2] * 2 * 2 + expandByte[m * 6 + 3] * 2 + expandByte[m * 6 + 4];
switch (m) {
case 0:
binary = getBoxBinary(s1[i][j]);
break;
case 1:
binary = getBoxBinary(s2[i][j]);
break;
case 2:
binary = getBoxBinary(s3[i][j]);
break;
case 3:
binary = getBoxBinary(s4[i][j]);
break;
case 4:
binary = getBoxBinary(s5[i][j]);
break;
case 5:
binary = getBoxBinary(s6[i][j]);
break;
case 6:
binary = getBoxBinary(s7[i][j]);
break;
case 7:
binary = getBoxBinary(s8[i][j]);
break
}
sBoxByte[m * 4 + 0] = parseInt(binary.substring(0, 1));
sBoxByte[m * 4 + 1] = parseInt(binary.substring(1, 2));
sBoxByte[m * 4 + 2] = parseInt(binary.substring(2, 3));
sBoxByte[m * 4 + 3] = parseInt(binary.substring(3, 4))
}
return sBoxByte
}
function pPermute(sBoxByte) {
var pBoxPermute = new Array(32);
pBoxPermute[0] = sBoxByte[15];
pBoxPermute[1] = sBoxByte[6];
pBoxPermute[2] = sBoxByte[19];
pBoxPermute[3] = sBoxByte[20];
pBoxPermute[4] = sBoxByte[28];
pBoxPermute[5] = sBoxByte[11];
pBoxPermute[6] = sBoxByte[27];
pBoxPermute[7] = sBoxByte[16];
pBoxPermute[8] = sBoxByte[0];
pBoxPermute[9] = sBoxByte[14];
pBoxPermute[10] = sBoxByte[22];
pBoxPermute[11] = sBoxByte[25];
pBoxPermute[12] = sBoxByte[4];
pBoxPermute[13] = sBoxByte[17];
pBoxPermute[14] = sBoxByte[30];
pBoxPermute[15] = sBoxByte[9];
pBoxPermute[16] = sBoxByte[1];
pBoxPermute[17] = sBoxByte[7];
pBoxPermute[18] = sBoxByte[23];
pBoxPermute[19] = sBoxByte[13];
pBoxPermute[20] = sBoxByte[31];
pBoxPermute[21] = sBoxByte[26];
pBoxPermute[22] = sBoxByte[2];
pBoxPermute[23] = sBoxByte[8];
pBoxPermute[24] = sBoxByte[18];
pBoxPermute[25] = sBoxByte[12];
pBoxPermute[26] = sBoxByte[29];
pBoxPermute[27] = sBoxByte[5];
pBoxPermute[28] = sBoxByte[21];
pBoxPermute[29] = sBoxByte[10];
pBoxPermute[30] = sBoxByte[3];
pBoxPermute[31] = sBoxByte[24];
return pBoxPermute
}
function finallyPermute(endByte) {
var fpByte = new Array(64);
fpByte[0] = endByte[39];
fpByte[1] = endByte[7];
fpByte[2] = endByte[47];
fpByte[3] = endByte[15];
fpByte[4] = endByte[55];
fpByte[5] = endByte[23];
fpByte[6] = endByte[63];
fpByte[7] = endByte[31];
fpByte[8] = endByte[38];
fpByte[9] = endByte[6];
fpByte[10] = endByte[46];
fpByte[11] = endByte[14];
fpByte[12] = endByte[54];
fpByte[13] = endByte[22];
fpByte[14] = endByte[62];
fpByte[15] = endByte[30];
fpByte[16] = endByte[37];
fpByte[17] = endByte[5];
fpByte[18] = endByte[45];
fpByte[19] = endByte[13];
fpByte[20] = endByte[53];
fpByte[21] = endByte[21];
fpByte[22] = endByte[61];
fpByte[23] = endByte[29];
fpByte[24] = endByte[36];
fpByte[25] = endByte[4];
fpByte[26] = endByte[44];
fpByte[27] = endByte[12];
fpByte[28] = endByte[52];
fpByte[29] = endByte[20];
fpByte[30] = endByte[60];
fpByte[31] = endByte[28];
fpByte[32] = endByte[35];
fpByte[33] = endByte[3];
fpByte[34] = endByte[43];
fpByte[35] = endByte[11];
fpByte[36] = endByte[51];
fpByte[37] = endByte[19];
fpByte[38] = endByte[59];
fpByte[39] = endByte[27];
fpByte[40] = endByte[34];
fpByte[41] = endByte[2];
fpByte[42] = endByte[42];
fpByte[43] = endByte[10];
fpByte[44] = endByte[50];
fpByte[45] = endByte[18];
fpByte[46] = endByte[58];
fpByte[47] = endByte[26];
fpByte[48] = endByte[33];
fpByte[49] = endByte[1];
fpByte[50] = endByte[41];
fpByte[51] = endByte[9];
fpByte[52] = endByte[49];
fpByte[53] = endByte[17];
fpByte[54] = endByte[57];
fpByte[55] = endByte[25];
fpByte[56] = endByte[32];
fpByte[57] = endByte[0];
fpByte[58] = endByte[40];
fpByte[59] = endByte[8];
fpByte[60] = endByte[48];
fpByte[61] = endByte[16];
fpByte[62] = endByte[56];
fpByte[63] = endByte[24];
return fpByte
}
function getBoxBinary(i) {
var binary = "";
switch (i) {
case 0:
binary = "0000";
break;
case 1:
binary = "0001";
break;
case 2:
binary = "0010";
break;
case 3:
binary = "0011";
break;
case 4:
binary = "0100";
break;
case 5:
binary = "0101";
break;
case 6:
binary = "0110";
break;
case 7:
binary = "0111";
break;
case 8:
binary = "1000";
break;
case 9:
binary = "1001";
break;
case 10:
binary = "1010";
break;
case 11:
binary = "1011";
break;
case 12:
binary = "1100";
break;
case 13:
binary = "1101";
break;
case 14:
binary = "1110";
break;
case 15:
binary = "1111";
break
}
return binary
}
function generateKeys(keyByte) {
var key = new Array(56);
var keys = new Array();
keys[0] = new Array();
keys[1] = new Array();
keys[2] = new Array();
keys[3] = new Array();
keys[4] = new Array();
keys[5] = new Array();
keys[6] = new Array();
keys[7] = new Array();
keys[8] = new Array();
keys[9] = new Array();
keys[10] = new Array();
keys[11] = new Array();
keys[12] = new Array();
keys[13] = new Array();
keys[14] = new Array();
keys[15] = new Array();
var loop = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
for (i = 0; i < 7; i++) {
for (j = 0, k = 7; j < 8; j++, k--) {
key[i * 8 + j] = keyByte[8 * k + i]
}
}
var i = 0;
for (i = 0; i < 16; i++) {
var tempLeft = 0;
var tempRight = 0;
for (j = 0; j < loop[i]; j++) {
tempLeft = key[0];
tempRight = key[28];
for (k = 0; k < 27; k++) {
key[k] = key[k + 1];
key[28 + k] = key[29 + k]
}
key[27] = tempLeft;
key[55] = tempRight
}
var tempKey = new Array(48);
tempKey[0] = key[13];
tempKey[1] = key[16];
tempKey[2] = key[10];
tempKey[3] = key[23];
tempKey[4] = key[0];
tempKey[5] = key[4];
tempKey[6] = key[2];
tempKey[7] = key[27];
tempKey[8] = key[14];
tempKey[9] = key[5];
tempKey[10] = key[20];
tempKey[11] = key[9];
tempKey[12] = key[22];
tempKey[13] = key[18];
tempKey[14] = key[11];
tempKey[15] = key[3];
tempKey[16] = key[25];
tempKey[17] = key[7];
tempKey[18] = key[15];
tempKey[19] = key[6];
tempKey[20] = key[26];
tempKey[21] = key[19];
tempKey[22] = key[12];
tempKey[23] = key[1];
tempKey[24] = key[40];
tempKey[25] = key[51];
tempKey[26] = key[30];
tempKey[27] = key[36];
tempKey[28] = key[46];
tempKey[29] = key[54];
tempKey[30] = key[29];
tempKey[31] = key[39];
tempKey[32] = key[50];
tempKey[33] = key[44];
tempKey[34] = key[32];
tempKey[35] = key[47];
tempKey[36] = key[43];
tempKey[37] = key[48];
tempKey[38] = key[38];
tempKey[39] = key[55];
tempKey[40] = key[33];
tempKey[41] = key[52];
tempKey[42] = key[45];
tempKey[43] = key[41];
tempKey[44] = key[49];
tempKey[45] = key[35];
tempKey[46] = key[28];
tempKey[47] = key[31];
switch (i) {
case 0:
for (m = 0; m < 48; m++) {
keys[0][m] = tempKey[m]
}
break;
case 1:
for (m = 0; m < 48; m++) {
keys[1][m] = tempKey[m]
}
break;
case 2:
for (m = 0; m < 48; m++) {
keys[2][m] = tempKey[m]
}
break;
case 3:
for (m = 0; m < 48; m++) {
keys[3][m] = tempKey[m]
}
break;
case 4:
for (m = 0; m < 48; m++) {
keys[4][m] = tempKey[m]
}
break;
case 5:
for (m = 0; m < 48; m++) {
keys[5][m] = tempKey[m]
}
break;
case 6:
for (m = 0; m < 48; m++) {
keys[6][m] = tempKey[m]
}
break;
case 7:
for (m = 0; m < 48; m++) {
keys[7][m] = tempKey[m]
}
break;
case 8:
for (m = 0; m < 48; m++) {
keys[8][m] = tempKey[m]
}
break;
case 9:
for (m = 0; m < 48; m++) {
keys[9][m] = tempKey[m]
}
break;
case 10:
for (m = 0; m < 48; m++) {
keys[10][m] = tempKey[m]
}
break;
case 11:
for (m = 0; m < 48; m++) {
keys[11][m] = tempKey[m]
}
break;
case 12:
for (m = 0; m < 48; m++) {
keys[12][m] = tempKey[m]
}
break;
case 13:
for (m = 0; m < 48; m++) {
keys[13][m] = tempKey[m]
}
break;
case 14:
for (m = 0; m < 48; m++) {
keys[14][m] = tempKey[m]
}
break;
case 15:
for (m = 0; m < 48; m++) {
keys[15][m] = tempKey[m]
}
break
}
}
return keys
}
// 鍐呯綉闄勪欢涓嬭浇鏌ョ湅
function downloadAisiteAttachment(attachmentId) {
// window.open("/eportalapp/portlet/articlePortletFileAttachment/view?attachmentId=" + attachmentId);
// window.open("http://localhost:1888/eportal/uiFramework/js/pdfjs/web/viewer.html?file=" + attachmentId);
// window.location.href = "http://localhost:1888/eportal/uiFramework/js/pdfjs/web/viewer.html?file=" + encodeURIComponent("/eportalapp/portlet/articlePortletFileAttachment/view?attachmentId=" + attachmentId);
var url = "/eportalapp/portlet/articlePortletFileAttachment/checkPower?attachmentId=" + attachmentId;
$.ajax({
type: "post",
url: url,
dataType: "json",
success: function (data) {
if (data.success) {
if(data.data=='viewAndDownload' || data.data=='download'){
window.open("/eportalapp/portlet/articlePortletFileAttachment/download?attachmentId=" + attachmentId);
}else if(data.data=='view'){
window.location.href = "http://localhost:1888/eportal/uiFramework/js/pdfjs/web/viewer.html?file=" + encodeURIComponent("/eportalapp/portlet/articlePortletFileAttachment/view?attachmentId=" + attachmentId);
}
} else {
console.log("logoutCms result=" + data);
showTipsDialog(data.data, 'error');
}
}
});
}