app.js 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. /*!
  2. * Author: Abdullah A Almsaeed
  3. * Date: 4 Jan 2014
  4. * Description:
  5. * This file should be included in all pages
  6. !**/
  7. /*
  8. * Global variables. If you change any of these vars, don't forget
  9. * to change the values in the less files!
  10. */
  11. var left_side_width = 220; //Sidebar width in pixels
  12. $(function() {
  13. "use strict";
  14. //Enable sidebar toggle
  15. $("[data-toggle='offcanvas']").click(function(e) {
  16. e.preventDefault();
  17. //If window is small enough, enable sidebar push menu
  18. if ($(window).width() <= 992) {
  19. $('.row-offcanvas').toggleClass('active');
  20. $('.left-side').removeClass("collapse-left");
  21. $(".right-side").removeClass("strech");
  22. $('.row-offcanvas').toggleClass("relative");
  23. } else {
  24. //Else, enable content streching
  25. $('.left-side').toggleClass("collapse-left");
  26. $(".right-side").toggleClass("strech");
  27. }
  28. });
  29. //Add hover support for touch devices
  30. $('.btn').bind('touchstart', function() {
  31. $(this).addClass('hover');
  32. }).bind('touchend', function() {
  33. $(this).removeClass('hover');
  34. });
  35. //Activate tooltips
  36. $("[data-toggle='tooltip']").tooltip();
  37. /*
  38. * Add collapse and remove events to boxes
  39. */
  40. $("[data-widget='collapse']").click(function() {
  41. //Find the box parent
  42. var box = $(this).parents(".box").first();
  43. //Find the body and the footer
  44. var bf = box.find(".box-body, .box-footer");
  45. if (!box.hasClass("collapsed-box")) {
  46. box.addClass("collapsed-box");
  47. bf.slideUp();
  48. } else {
  49. box.removeClass("collapsed-box");
  50. bf.slideDown();
  51. }
  52. });
  53. /*
  54. * ADD SLIMSCROLL TO THE TOP NAV DROPDOWNS
  55. * ---------------------------------------
  56. */
  57. $(".navbar .menu").slimscroll({
  58. height: "200px",
  59. alwaysVisible: false,
  60. size: "3px"
  61. }).css("width", "100%");
  62. /*
  63. * INITIALIZE BUTTON TOGGLE
  64. * ------------------------
  65. */
  66. $('.btn-group[data-toggle="btn-toggle"]').each(function() {
  67. var group = $(this);
  68. $(this).find(".btn").click(function(e) {
  69. group.find(".btn.active").removeClass("active");
  70. $(this).addClass("active");
  71. e.preventDefault();
  72. });
  73. });
  74. $("[data-widget='remove']").click(function() {
  75. //Find the box parent
  76. var box = $(this).parents(".box").first();
  77. box.slideUp();
  78. });
  79. /* Sidebar tree view */
  80. $(".sidebar .treeview").tree();
  81. /*
  82. * Make sure that the sidebar is streched full height
  83. * ---------------------------------------------
  84. * We are gonna assign a min-height value every time the
  85. * wrapper gets resized and upon page load. We will use
  86. * Ben Alman's method for detecting the resize event.
  87. *
  88. **/
  89. function _fix() {
  90. //Get window height and the wrapper height
  91. var height = $(window).height() - $("body > .header").height();
  92. $(".wrapper").css("min-height", height + "px");
  93. var content = $(".wrapper").height();
  94. //If the wrapper height is greater than the window
  95. if (content > height)
  96. //then set sidebar height to the wrapper
  97. $(".left-side, html, body").css("min-height", content + "px");
  98. else {
  99. //Otherwise, set the sidebar to the height of the window
  100. $(".left-side, html, body").css("min-height", height + "px");
  101. }
  102. }
  103. //Fire upon load
  104. _fix();
  105. //Fire when wrapper is resized
  106. $(".wrapper").resize(function() {
  107. _fix();
  108. fix_sidebar();
  109. });
  110. //Fix the fixed layout sidebar scroll bug
  111. fix_sidebar();
  112. /*
  113. * We are gonna initialize all checkbox and radio inputs to
  114. * iCheck plugin in.
  115. * You can find the documentation at http://fronteed.com/iCheck/
  116. */
  117. $("input[type='checkbox'], input[type='radio']").iCheck({
  118. checkboxClass: 'icheckbox_minimal',
  119. radioClass: 'iradio_minimal'
  120. });
  121. /* For demo purposes */
  122. var demo = $("<div />").css({
  123. position: "fixed",
  124. top: "150px",
  125. right: "0",
  126. background: "rgba(0, 0, 0, 0.7)",
  127. "border-radius": "5px 0px 0px 5px",
  128. padding: "10px 15px",
  129. "font-size": "16px",
  130. "z-index": "999999",
  131. cursor: "pointer",
  132. color: "#ddd"
  133. }).html("<i class='fa fa-gear'></i>").addClass("no-print");
  134. var demo_settings = $("<div />").css({
  135. "padding": "10px",
  136. position: "fixed",
  137. top: "130px",
  138. right: "-200px",
  139. background: "#fff",
  140. border: "3px solid rgba(0, 0, 0, 0.7)",
  141. "width": "200px",
  142. "z-index": "999999"
  143. }).addClass("no-print");
  144. demo_settings.append(
  145. "<h4 style='margin: 0 0 5px 0; border-bottom: 1px dashed #ddd; padding-bottom: 3px;'>Layout Options</h4>"
  146. + "<div class='form-group no-margin'>"
  147. + "<div class='.checkbox'>"
  148. + "<label>"
  149. + "<input type='checkbox' onchange='change_layout();'/> "
  150. + "Fixed layout"
  151. + "</label>"
  152. + "</div>"
  153. + "</div>"
  154. );
  155. demo_settings.append(
  156. "<h4 style='margin: 0 0 5px 0; border-bottom: 1px dashed #ddd; padding-bottom: 3px;'>Skins</h4>"
  157. + "<div class='form-group no-margin'>"
  158. + "<div class='.radio'>"
  159. + "<label>"
  160. + "<input name='skins' type='radio' onchange='change_skin(\"skin-black\");' /> "
  161. + "Black"
  162. + "</label>"
  163. + "</div>"
  164. + "</div>"
  165. + "<div class='form-group no-margin'>"
  166. + "<div class='.radio'>"
  167. + "<label>"
  168. + "<input name='skins' type='radio' onchange='change_skin(\"skin-blue\");' checked='checked'/> "
  169. + "Blue"
  170. + "</label>"
  171. + "</div>"
  172. + "</div>"
  173. );
  174. demo.click(function() {
  175. if (!$(this).hasClass("open")) {
  176. $(this).css("right", "200px");
  177. demo_settings.css("right", "0");
  178. $(this).addClass("open");
  179. } else {
  180. $(this).css("right", "0");
  181. demo_settings.css("right", "-200px");
  182. $(this).removeClass("open")
  183. }
  184. });
  185. $("body").append(demo);
  186. $("body").append(demo_settings);
  187. });
  188. function fix_sidebar() {
  189. //Make sure the body tag has the .fixed class
  190. if (!$("body").hasClass("fixed")) {
  191. return;
  192. }
  193. //Add slimscroll
  194. $(".sidebar").slimscroll({
  195. height: ($(window).height() - $(".header").height()) + "px",
  196. color: "rgba(0,0,0,0.2)"
  197. });
  198. }
  199. function change_layout() {
  200. $("body").toggleClass("fixed");
  201. fix_sidebar();
  202. }
  203. function change_skin(cls) {
  204. $("body").removeClass("skin-blue skin-black");
  205. $("body").addClass(cls);
  206. }
  207. /*END DEMO*/
  208. $(window).load(function() {
  209. /*! pace 0.4.17 */
  210. (function() {
  211. var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V = [].slice, W = {}.hasOwnProperty, X = function(a, b) {
  212. function c() {
  213. this.constructor = a
  214. }
  215. for (var d in b)
  216. W.call(b, d) && (a[d] = b[d]);
  217. return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a
  218. }, Y = [].indexOf || function(a) {
  219. for (var b = 0, c = this.length; c > b; b++)
  220. if (b in this && this[b] === a)
  221. return b;
  222. return-1
  223. };
  224. for (t = {catchupTime:500, initialRate:.03, minTime:500, ghostTime:500, maxProgressPerFrame:10, easeFactor:1.25, startOnPageLoad:!0, restartOnPushState:!0, restartOnRequestAfter:500, target:"body", elements:{checkInterval:100, selectors:["body"]}, eventLag:{minSamples:10, sampleCount:3, lagThreshold:3}, ajax:{trackMethods:["GET"], trackWebSockets:!1}}, B = function() {
  225. var a;
  226. return null != (a = "undefined" != typeof performance && null !== performance ? "function" == typeof performance.now ? performance.now() : void 0 : void 0) ? a : +new Date
  227. }, D = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, s = window.cancelAnimationFrame || window.mozCancelAnimationFrame, null == D && (D = function(a) {
  228. return setTimeout(a, 50)
  229. }, s = function(a) {
  230. return clearTimeout(a)
  231. }), F = function(a) {
  232. var b, c;
  233. return b = B(), (c = function() {
  234. var d;
  235. return d = B() - b, d >= 33 ? (b = B(), a(d, function() {
  236. return D(c)
  237. })) : setTimeout(c, 33 - d)
  238. })()
  239. }, E = function() {
  240. var a, b, c;
  241. return c = arguments[0], b = arguments[1], a = 3 <= arguments.length ? V.call(arguments, 2) : [], "function" == typeof c[b] ? c[b].apply(c, a) : c[b]
  242. }, u = function() {
  243. var a, b, c, d, e, f, g;
  244. for (b = arguments[0], d = 2 <= arguments.length?V.call(arguments, 1):[], f = 0, g = d.length; g > f; f++)
  245. if (c = d[f])
  246. for (a in c)
  247. W.call(c, a) && (e = c[a], null != b[a] && "object" == typeof b[a] && null != e && "object" == typeof e ? u(b[a], e) : b[a] = e);
  248. return b
  249. }, p = function(a) {
  250. var b, c, d, e, f;
  251. for (c = b = 0, e = 0, f = a.length; f > e; e++)
  252. d = a[e], c += Math.abs(d), b++;
  253. return c / b
  254. }, w = function(a, b) {
  255. var c, d, e;
  256. if (null == a && (a = "options"), null == b && (b = !0), e = document.querySelector("[data-pace-" + a + "]")) {
  257. if (c = e.getAttribute("data-pace-" + a), !b)
  258. return c;
  259. try {
  260. return JSON.parse(c)
  261. } catch (f) {
  262. return d = f, "undefined" != typeof console && null !== console ? console.error("Error parsing inline pace options", d) : void 0
  263. }
  264. }
  265. }, g = function() {
  266. function a() {
  267. }
  268. return a.prototype.on = function(a, b, c, d) {
  269. var e;
  270. return null == d && (d = !1), null == this.bindings && (this.bindings = {}), null == (e = this.bindings)[a] && (e[a] = []), this.bindings[a].push({handler: b, ctx: c, once: d})
  271. }, a.prototype.once = function(a, b, c) {
  272. return this.on(a, b, c, !0)
  273. }, a.prototype.off = function(a, b) {
  274. var c, d, e;
  275. if (null != (null != (d = this.bindings) ? d[a] : void 0)) {
  276. if (null == b)
  277. return delete this.bindings[a];
  278. for (c = 0, e = []; c < this.bindings[a].length; )
  279. this.bindings[a][c].handler === b ? e.push(this.bindings[a].splice(c, 1)) : e.push(c++);
  280. return e
  281. }
  282. }, a.prototype.trigger = function() {
  283. var a, b, c, d, e, f, g, h, i;
  284. if (c = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], null != (g = this.bindings) ? g[c] : void 0) {
  285. for (e = 0, i = []; e < this.bindings[c].length; )
  286. h = this.bindings[c][e], d = h.handler, b = h.ctx, f = h.once, d.apply(null != b ? b : this, a), f ? i.push(this.bindings[c].splice(e, 1)) : i.push(e++);
  287. return i
  288. }
  289. }, a
  290. }(), null == window.Pace && (window.Pace = {}), u(Pace, g.prototype), C = Pace.options = u({}, t, window.paceOptions, w()), S = ["ajax", "document", "eventLag", "elements"], O = 0, Q = S.length; Q > O; O++)
  291. I = S[O], C[I] === !0 && (C[I] = t[I]);
  292. i = function(a) {
  293. function b() {
  294. return T = b.__super__.constructor.apply(this, arguments)
  295. }
  296. return X(b, a), b
  297. }(Error), b = function() {
  298. function a() {
  299. this.progress = 0
  300. }
  301. return a.prototype.getElement = function() {
  302. var a;
  303. if (null == this.el) {
  304. if (a = document.querySelector(C.target), !a)
  305. throw new i;
  306. this.el = document.createElement("div"), this.el.className = "pace pace-active", document.body.className = document.body.className.replace("pace-done", ""), document.body.className += " pace-running", this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>', null != a.firstChild ? a.insertBefore(this.el, a.firstChild) : a.appendChild(this.el)
  307. }
  308. return this.el
  309. }, a.prototype.finish = function() {
  310. var a;
  311. return a = this.getElement(), a.className = a.className.replace("pace-active", ""), a.className += " pace-inactive", document.body.className = document.body.className.replace("pace-running", ""), document.body.className += " pace-done"
  312. }, a.prototype.update = function(a) {
  313. return this.progress = a, this.render()
  314. }, a.prototype.destroy = function() {
  315. try {
  316. this.getElement().parentNode.removeChild(this.getElement())
  317. } catch (a) {
  318. i = a
  319. }
  320. return this.el = void 0
  321. }, a.prototype.render = function() {
  322. var a, b;
  323. return null == document.querySelector(C.target) ? !1 : (a = this.getElement(), a.children[0].style.width = "" + this.progress + "%", (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) && (a.children[0].setAttribute("data-progress-text", "" + (0 | this.progress) + "%"), this.progress >= 100 ? b = "99" : (b = this.progress < 10 ? "0" : "", b += 0 | this.progress), a.children[0].setAttribute("data-progress", "" + b)), this.lastRenderedProgress = this.progress)
  324. }, a.prototype.done = function() {
  325. return this.progress >= 100
  326. }, a
  327. }(), h = function() {
  328. function a() {
  329. this.bindings = {}
  330. }
  331. return a.prototype.trigger = function(a, b) {
  332. var c, d, e, f, g;
  333. if (null != this.bindings[a]) {
  334. for (f = this.bindings[a], g = [], d = 0, e = f.length; e > d; d++)
  335. c = f[d], g.push(c.call(this, b));
  336. return g
  337. }
  338. }, a.prototype.on = function(a, b) {
  339. var c;
  340. return null == (c = this.bindings)[a] && (c[a] = []), this.bindings[a].push(b)
  341. }, a
  342. }(), N = window.XMLHttpRequest, M = window.XDomainRequest, L = window.WebSocket, v = function(a, b) {
  343. var c, d, e, f;
  344. f = [];
  345. for (d in b.prototype)
  346. try {
  347. e = b.prototype[d], null == a[d] && "function" != typeof e ? f.push(a[d] = e) : f.push(void 0)
  348. } catch (g) {
  349. c = g
  350. }
  351. return f
  352. }, z = [], Pace.ignore = function() {
  353. var a, b, c;
  354. return b = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], z.unshift("ignore"), c = b.apply(null, a), z.shift(), c
  355. }, Pace.track = function() {
  356. var a, b, c;
  357. return b = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], z.unshift("track"), c = b.apply(null, a), z.shift(), c
  358. }, H = function(a) {
  359. var b;
  360. if (null == a && (a = "GET"), "track" === z[0])
  361. return"force";
  362. if (!z.length && C.ajax) {
  363. if ("socket" === a && C.ajax.trackWebSockets)
  364. return!0;
  365. if (b = a.toUpperCase(), Y.call(C.ajax.trackMethods, b) >= 0)
  366. return!0
  367. }
  368. return!1
  369. }, j = function(a) {
  370. function b() {
  371. var a, c = this;
  372. b.__super__.constructor.apply(this, arguments), a = function(a) {
  373. var b;
  374. return b = a.open, a.open = function(d, e) {
  375. return H(d) && c.trigger("request", {type: d, url: e, request: a}), b.apply(a, arguments)
  376. }
  377. }, window.XMLHttpRequest = function(b) {
  378. var c;
  379. return c = new N(b), a(c), c
  380. }, v(window.XMLHttpRequest, N), null != M && (window.XDomainRequest = function() {
  381. var b;
  382. return b = new M, a(b), b
  383. }, v(window.XDomainRequest, M)), null != L && C.ajax.trackWebSockets && (window.WebSocket = function(a, b) {
  384. var d;
  385. return d = new L(a, b), H("socket") && c.trigger("request", {type: "socket", url: a, protocols: b, request: d}), d
  386. }, v(window.WebSocket, L))
  387. }
  388. return X(b, a), b
  389. }(h), P = null, x = function() {
  390. return null == P && (P = new j), P
  391. }, x().on("request", function(b) {
  392. var c, d, e, f;
  393. return f = b.type, e = b.request, Pace.running || C.restartOnRequestAfter === !1 && "force" !== H(f) ? void 0 : (d = arguments, c = C.restartOnRequestAfter || 0, "boolean" == typeof c && (c = 0), setTimeout(function() {
  394. var b, c, g, h, i, j;
  395. if (b = "socket" === f ? e.readyState < 2 : 0 < (h = e.readyState) && 4 > h) {
  396. for (Pace.restart(), i = Pace.sources, j = [], c = 0, g = i.length; g > c; c++) {
  397. if (I = i[c], I instanceof a) {
  398. I.watch.apply(I, d);
  399. break
  400. }
  401. j.push(void 0)
  402. }
  403. return j
  404. }
  405. }, c))
  406. }), a = function() {
  407. function a() {
  408. var a = this;
  409. this.elements = [], x().on("request", function() {
  410. return a.watch.apply(a, arguments)
  411. })
  412. }
  413. return a.prototype.watch = function(a) {
  414. var b, c, d;
  415. return d = a.type, b = a.request, c = "socket" === d ? new m(b) : new n(b), this.elements.push(c)
  416. }, a
  417. }(), n = function() {
  418. function a(a) {
  419. var b, c, d, e, f, g, h = this;
  420. if (this.progress = 0, null != window.ProgressEvent)
  421. for (c = null, a.addEventListener("progress", function(a) {
  422. return h.progress = a.lengthComputable ? 100 * a.loaded / a.total : h.progress + (100 - h.progress) / 2
  423. }), g = ["load", "abort", "timeout", "error"], d = 0, e = g.length; e > d; d++)
  424. b = g[d], a.addEventListener(b, function() {
  425. return h.progress = 100
  426. });
  427. else
  428. f = a.onreadystatechange, a.onreadystatechange = function() {
  429. var b;
  430. return 0 === (b = a.readyState) || 4 === b ? h.progress = 100 : 3 === a.readyState && (h.progress = 50), "function" == typeof f ? f.apply(null, arguments) : void 0
  431. }
  432. }
  433. return a
  434. }(), m = function() {
  435. function a(a) {
  436. var b, c, d, e, f = this;
  437. for (this.progress = 0, e = ["error", "open"], c = 0, d = e.length; d > c; c++)
  438. b = e[c], a.addEventListener(b, function() {
  439. return f.progress = 100
  440. })
  441. }
  442. return a
  443. }(), d = function() {
  444. function a(a) {
  445. var b, c, d, f;
  446. for (null == a && (a = {}), this.elements = [], null == a.selectors && (a.selectors = []), f = a.selectors, c = 0, d = f.length; d > c; c++)
  447. b = f[c], this.elements.push(new e(b))
  448. }
  449. return a
  450. }(), e = function() {
  451. function a(a) {
  452. this.selector = a, this.progress = 0, this.check()
  453. }
  454. return a.prototype.check = function() {
  455. var a = this;
  456. return document.querySelector(this.selector) ? this.done() : setTimeout(function() {
  457. return a.check()
  458. }, C.elements.checkInterval)
  459. }, a.prototype.done = function() {
  460. return this.progress = 100
  461. }, a
  462. }(), c = function() {
  463. function a() {
  464. var a, b, c = this;
  465. this.progress = null != (b = this.states[document.readyState]) ? b : 100, a = document.onreadystatechange, document.onreadystatechange = function() {
  466. return null != c.states[document.readyState] && (c.progress = c.states[document.readyState]), "function" == typeof a ? a.apply(null, arguments) : void 0
  467. }
  468. }
  469. return a.prototype.states = {loading: 0, interactive: 50, complete: 100}, a
  470. }(), f = function() {
  471. function a() {
  472. var a, b, c, d, e, f = this;
  473. this.progress = 0, a = 0, e = [], d = 0, c = B(), b = setInterval(function() {
  474. var g;
  475. return g = B() - c - 50, c = B(), e.push(g), e.length > C.eventLag.sampleCount && e.shift(), a = p(e), ++d >= C.eventLag.minSamples && a < C.eventLag.lagThreshold ? (f.progress = 100, clearInterval(b)) : f.progress = 100 * (3 / (a + 3))
  476. }, 50)
  477. }
  478. return a
  479. }(), l = function() {
  480. function a(a) {
  481. this.source = a, this.last = this.sinceLastUpdate = 0, this.rate = C.initialRate, this.catchup = 0, this.progress = this.lastProgress = 0, null != this.source && (this.progress = E(this.source, "progress"))
  482. }
  483. return a.prototype.tick = function(a, b) {
  484. var c;
  485. return null == b && (b = E(this.source, "progress")), b >= 100 && (this.done = !0), b === this.last ? this.sinceLastUpdate += a : (this.sinceLastUpdate && (this.rate = (b - this.last) / this.sinceLastUpdate), this.catchup = (b - this.progress) / C.catchupTime, this.sinceLastUpdate = 0, this.last = b), b > this.progress && (this.progress += this.catchup * a), c = 1 - Math.pow(this.progress / 100, C.easeFactor), this.progress += c * this.rate * a, this.progress = Math.min(this.lastProgress + C.maxProgressPerFrame, this.progress), this.progress = Math.max(0, this.progress), this.progress = Math.min(100, this.progress), this.lastProgress = this.progress, this.progress
  486. }, a
  487. }(), J = null, G = null, q = null, K = null, o = null, r = null, Pace.running = !1, y = function() {
  488. return C.restartOnPushState ? Pace.restart() : void 0
  489. }, null != window.history.pushState && (R = window.history.pushState, window.history.pushState = function() {
  490. return y(), R.apply(window.history, arguments)
  491. }), null != window.history.replaceState && (U = window.history.replaceState, window.history.replaceState = function() {
  492. return y(), U.apply(window.history, arguments)
  493. }), k = {ajax: a, elements: d, document: c, eventLag: f}, (A = function() {
  494. var a, c, d, e, f, g, h, i;
  495. for (Pace.sources = J = [], g = ["ajax", "elements", "document", "eventLag"], c = 0, e = g.length; e > c; c++)
  496. a = g[c], C[a] !== !1 && J.push(new k[a](C[a]));
  497. for (i = null != (h = C.extraSources)?h:[], d = 0, f = i.length; f > d; d++)
  498. I = i[d], J.push(new I(C));
  499. return Pace.bar = q = new b, G = [], K = new l
  500. })(), Pace.stop = function() {
  501. return Pace.trigger("stop"), Pace.running = !1, q.destroy(), r = !0, null != o && ("function" == typeof s && s(o), o = null), A()
  502. }, Pace.restart = function() {
  503. return Pace.trigger("restart"), Pace.stop(), Pace.start()
  504. }, Pace.go = function() {
  505. return Pace.running = !0, q.render(), r = !1, o = F(function(a, b) {
  506. var c, d, e, f, g, h, i, j, k, m, n, o, p, s, t, u, v;
  507. for (j = 100 - q.progress, d = o = 0, e = !0, h = p = 0, t = J.length; t > p; h = ++p)
  508. for (I = J[h], m = null != G[h]?G[h]:G[h] = [], g = null != (v = I.elements)?v:[I], i = s = 0, u = g.length; u > s; i = ++s)
  509. f = g[i], k = null != m[i] ? m[i] : m[i] = new l(f), e &= k.done, k.done || (d++, o += k.tick(a));
  510. return c = o / d, q.update(K.tick(a, c)), n = B(), q.done() || e || r ? (q.update(100), Pace.trigger("done"), setTimeout(function() {
  511. return q.finish(), Pace.running = !1, Pace.trigger("hide")
  512. }, Math.max(C.ghostTime, Math.min(C.minTime, B() - n)))) : b()
  513. })
  514. }, Pace.start = function(a) {
  515. u(C, a), Pace.running = !0;
  516. try {
  517. q.render()
  518. } catch (b) {
  519. i = b
  520. }
  521. return document.querySelector(".pace") ? (Pace.trigger("start"), Pace.go()) : setTimeout(Pace.start, 50)
  522. }, "function" == typeof define && define.amd ? define('theme-app', [], function() {
  523. return Pace
  524. }) : "object" == typeof exports ? module.exports = Pace : C.startOnPageLoad && Pace.start()
  525. }).call(this);
  526. });
  527. /*
  528. * BOX REFRESH BUTTON
  529. * ------------------
  530. * This is a custom plugin to use with the compenet BOX. It allows you to add
  531. * a refresh button to the box. It converts the box's state to a loading state.
  532. *
  533. * USAGE:
  534. * $("#box-widget").boxRefresh( options );
  535. * */
  536. (function($) {
  537. "use strict";
  538. $.fn.boxRefresh = function(options) {
  539. // Render options
  540. var settings = $.extend({
  541. //Refressh button selector
  542. trigger: ".refresh-btn",
  543. //File source to be loaded (e.g: ajax/src.php)
  544. source: "",
  545. //Callbacks
  546. onLoadStart: function(box) {
  547. }, //Right after the button has been clicked
  548. onLoadDone: function(box) {
  549. } //When the source has been loaded
  550. }, options);
  551. //The overlay
  552. var overlay = $('<div class="overlay"></div><div class="loading-img"></div>');
  553. return this.each(function() {
  554. //if a source is specified
  555. if (settings.source === "") {
  556. if (console) {
  557. console.log("Please specify a source first - boxRefresh()");
  558. }
  559. return;
  560. }
  561. //the box
  562. var box = $(this);
  563. //the button
  564. var rBtn = box.find(settings.trigger).first();
  565. //On trigger click
  566. rBtn.click(function(e) {
  567. e.preventDefault();
  568. //Add loading overlay
  569. start(box);
  570. //Perform ajax call
  571. box.find(".box-body").load(settings.source, function() {
  572. done(box);
  573. });
  574. });
  575. });
  576. function start(box) {
  577. //Add overlay and loading img
  578. box.append(overlay);
  579. settings.onLoadStart.call(box);
  580. }
  581. function done(box) {
  582. //Remove overlay and loading img
  583. box.find(overlay).remove();
  584. settings.onLoadDone.call(box);
  585. }
  586. };
  587. })(jQuery);
  588. /*
  589. * SIDEBAR MENU
  590. * ------------
  591. * This is a custom plugin for the sidebar menu. It provides a tree view.
  592. *
  593. * Usage:
  594. * $(".sidebar).tree();
  595. *
  596. * Note: This plugin does not accept any options. Instead, it only requires a class
  597. * added to the element that contains a sub-menu.
  598. *
  599. * When used with the sidebar, for example, it would look something like this:
  600. * <ul class='sidebar-menu'>
  601. * <li class="treeview active">
  602. * <a href="#>Menu</a>
  603. * <ul class='treeview-menu'>
  604. * <li class='active'><a href=#>Level 1</a></li>
  605. * </ul>
  606. * </li>
  607. * </ul>
  608. *
  609. * Add .active class to <li> elements if you want the menu to be open automatically
  610. * on page load. See above for an example.
  611. */
  612. (function($) {
  613. "use strict";
  614. $.fn.tree = function() {
  615. return this.each(function() {
  616. var btn = $(this).children("a").first();
  617. var menu = $(this).children(".treeview-menu").first();
  618. var isActive = $(this).hasClass('active');
  619. //initialize already active menus
  620. if (isActive) {
  621. menu.show();
  622. btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
  623. }
  624. //Slide open or close the menu on link click
  625. btn.click(function(e) {
  626. e.preventDefault();
  627. if (isActive) {
  628. //Slide up to close menu
  629. menu.slideUp();
  630. isActive = false;
  631. btn.children(".fa-angle-down").first().removeClass("fa-angle-down").addClass("fa-angle-left");
  632. btn.parent("li").removeClass("active");
  633. } else {
  634. //Slide down to open menu
  635. menu.slideDown();
  636. isActive = true;
  637. btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
  638. btn.parent("li").addClass("active");
  639. }
  640. });
  641. /* Add margins to submenu elements to give it a tree look */
  642. menu.find("li > a").each(function() {
  643. var pad = parseInt($(this).css("margin-left")) + 10;
  644. $(this).css({"margin-left": pad + "px"});
  645. });
  646. });
  647. };
  648. }(jQuery));
  649. /*
  650. * TODO LIST CUSTOM PLUGIN
  651. * -----------------------
  652. * This plugin depends on iCheck plugin for checkbox and radio inputs
  653. */
  654. (function($) {
  655. "use strict";
  656. $.fn.todolist = function(options) {
  657. // Render options
  658. var settings = $.extend({
  659. //When the user checks the input
  660. onCheck: function(ele) {
  661. },
  662. //When the user unchecks the input
  663. onUncheck: function(ele) {
  664. }
  665. }, options);
  666. return this.each(function() {
  667. $('input', this).on('ifChecked', function(event) {
  668. var ele = $(this).parents("li").first();
  669. ele.toggleClass("done");
  670. settings.onCheck.call(ele);
  671. });
  672. $('input', this).on('ifUnchecked', function(event) {
  673. var ele = $(this).parents("li").first();
  674. ele.toggleClass("done");
  675. settings.onUncheck.call(ele);
  676. });
  677. });
  678. };
  679. }(jQuery));
  680. /* CENTER ELEMENTS */
  681. (function($) {
  682. "use strict";
  683. jQuery.fn.center = function(parent) {
  684. if (parent) {
  685. parent = this.parent();
  686. } else {
  687. parent = window;
  688. }
  689. this.css({
  690. "position": "absolute",
  691. "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"),
  692. "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px")
  693. });
  694. return this;
  695. }
  696. }(jQuery));
  697. /*
  698. * jQuery resize event - v1.1 - 3/14/2010
  699. * http://benalman.com/projects/jquery-resize-plugin/
  700. *
  701. * Copyright (c) 2010 "Cowboy" Ben Alman
  702. * Dual licensed under the MIT and GPL licenses.
  703. * http://benalman.com/about/license/
  704. */
  705. (function($, h, c) {
  706. var a = $([]), e = $.resize = $.extend($.resize, {}), i, k = "setTimeout", j = "resize", d = j + "-special-event", b = "delay", f = "throttleWindow";
  707. e[b] = 250;
  708. e[f] = true;
  709. $.event.special[j] = {setup: function() {
  710. if (!e[f] && this[k]) {
  711. return false;
  712. }
  713. var l = $(this);
  714. a = a.add(l);
  715. $.data(this, d, {w: l.width(), h: l.height()});
  716. if (a.length === 1) {
  717. g();
  718. }
  719. }, teardown: function() {
  720. if (!e[f] && this[k]) {
  721. return false
  722. }
  723. var l = $(this);
  724. a = a.not(l);
  725. l.removeData(d);
  726. if (!a.length) {
  727. clearTimeout(i);
  728. }
  729. }, add: function(l) {
  730. if (!e[f] && this[k]) {
  731. return false
  732. }
  733. var n;
  734. function m(s, o, p) {
  735. var q = $(this), r = $.data(this, d);
  736. r.w = o !== c ? o : q.width();
  737. r.h = p !== c ? p : q.height();
  738. n.apply(this, arguments)
  739. }
  740. if ($.isFunction(l)) {
  741. n = l;
  742. return m
  743. } else {
  744. n = l.handler;
  745. l.handler = m
  746. }
  747. }};
  748. function g() {
  749. i = h[k](function() {
  750. a.each(function() {
  751. var n = $(this), m = n.width(), l = n.height(), o = $.data(this, d);
  752. if (m !== o.w || l !== o.h) {
  753. n.trigger(j, [o.w = m, o.h = l])
  754. }
  755. });
  756. g()
  757. }, e[b])
  758. }}
  759. )(jQuery, this);
  760. /*!
  761. * SlimScroll https://github.com/rochal/jQuery-slimScroll
  762. * =======================================================
  763. *
  764. * Copyright (c) 2011 Piotr Rochala (http://rocha.la) Dual licensed under the MIT
  765. */
  766. (function(f) {
  767. jQuery.fn.extend({slimScroll: function(h) {
  768. var a = f.extend({width: "auto", height: "250px", size: "7px", color: "#000", position: "right", distance: "1px", start: "top", opacity: 0.4, alwaysVisible: !1, disableFadeOut: !1, railVisible: !1, railColor: "#333", railOpacity: 0.2, railDraggable: !0, railClass: "slimScrollRail", barClass: "slimScrollBar", wrapperClass: "slimScrollDiv", allowPageScroll: !1, wheelStep: 20, touchScrollStep: 200, borderRadius: "0px", railBorderRadius: "0px"}, h);
  769. this.each(function() {
  770. function r(d) {
  771. if (s) {
  772. d = d ||
  773. window.event;
  774. var c = 0;
  775. d.wheelDelta && (c = -d.wheelDelta / 120);
  776. d.detail && (c = d.detail / 3);
  777. f(d.target || d.srcTarget || d.srcElement).closest("." + a.wrapperClass).is(b.parent()) && m(c, !0);
  778. d.preventDefault && !k && d.preventDefault();
  779. k || (d.returnValue = !1)
  780. }
  781. }
  782. function m(d, f, h) {
  783. k = !1;
  784. var e = d, g = b.outerHeight() - c.outerHeight();
  785. f && (e = parseInt(c.css("top")) + d * parseInt(a.wheelStep) / 100 * c.outerHeight(), e = Math.min(Math.max(e, 0), g), e = 0 < d ? Math.ceil(e) : Math.floor(e), c.css({top: e + "px"}));
  786. l = parseInt(c.css("top")) / (b.outerHeight() - c.outerHeight());
  787. e = l * (b[0].scrollHeight - b.outerHeight());
  788. h && (e = d, d = e / b[0].scrollHeight * b.outerHeight(), d = Math.min(Math.max(d, 0), g), c.css({top: d + "px"}));
  789. b.scrollTop(e);
  790. b.trigger("slimscrolling", ~~e);
  791. v();
  792. p()
  793. }
  794. function C() {
  795. window.addEventListener ? (this.addEventListener("DOMMouseScroll", r, !1), this.addEventListener("mousewheel", r, !1), this.addEventListener("MozMousePixelScroll", r, !1)) : document.attachEvent("onmousewheel", r)
  796. }
  797. function w() {
  798. u = Math.max(b.outerHeight() / b[0].scrollHeight * b.outerHeight(), D);
  799. c.css({height: u + "px"});
  800. var a = u == b.outerHeight() ? "none" : "block";
  801. c.css({display: a})
  802. }
  803. function v() {
  804. w();
  805. clearTimeout(A);
  806. l == ~~l ? (k = a.allowPageScroll, B != l && b.trigger("slimscroll", 0 == ~~l ? "top" : "bottom")) : k = !1;
  807. B = l;
  808. u >= b.outerHeight() ? k = !0 : (c.stop(!0, !0).fadeIn("fast"), a.railVisible && g.stop(!0, !0).fadeIn("fast"))
  809. }
  810. function p() {
  811. a.alwaysVisible || (A = setTimeout(function() {
  812. a.disableFadeOut && s || (x || y) || (c.fadeOut("slow"), g.fadeOut("slow"))
  813. }, 1E3))
  814. }
  815. var s, x, y, A, z, u, l, B, D = 30, k = !1, b = f(this);
  816. if (b.parent().hasClass(a.wrapperClass)) {
  817. var n = b.scrollTop(),
  818. c = b.parent().find("." + a.barClass), g = b.parent().find("." + a.railClass);
  819. w();
  820. if (f.isPlainObject(h)) {
  821. if ("height"in h && "auto" == h.height) {
  822. b.parent().css("height", "auto");
  823. b.css("height", "auto");
  824. var q = b.parent().parent().height();
  825. b.parent().css("height", q);
  826. b.css("height", q)
  827. }
  828. if ("scrollTo"in h)
  829. n = parseInt(a.scrollTo);
  830. else if ("scrollBy"in h)
  831. n += parseInt(a.scrollBy);
  832. else if ("destroy"in h) {
  833. c.remove();
  834. g.remove();
  835. b.unwrap();
  836. return
  837. }
  838. m(n, !1, !0)
  839. }
  840. } else {
  841. a.height = "auto" == a.height ? b.parent().height() : a.height;
  842. n = f("<div></div>").addClass(a.wrapperClass).css({position: "relative",
  843. overflow: "hidden", width: a.width, height: a.height});
  844. b.css({overflow: "hidden", width: a.width, height: a.height});
  845. var g = f("<div></div>").addClass(a.railClass).css({width: a.size, height: "100%", position: "absolute", top: 0, display: a.alwaysVisible && a.railVisible ? "block" : "none", "border-radius": a.railBorderRadius, background: a.railColor, opacity: a.railOpacity, zIndex: 90}), c = f("<div></div>").addClass(a.barClass).css({background: a.color, width: a.size, position: "absolute", top: 0, opacity: a.opacity, display: a.alwaysVisible ?
  846. "block" : "none", "border-radius": a.borderRadius, BorderRadius: a.borderRadius, MozBorderRadius: a.borderRadius, WebkitBorderRadius: a.borderRadius, zIndex: 99}), q = "right" == a.position ? {right: a.distance} : {left: a.distance};
  847. g.css(q);
  848. c.css(q);
  849. b.wrap(n);
  850. b.parent().append(c);
  851. b.parent().append(g);
  852. a.railDraggable && c.bind("mousedown", function(a) {
  853. var b = f(document);
  854. y = !0;
  855. t = parseFloat(c.css("top"));
  856. pageY = a.pageY;
  857. b.bind("mousemove.slimscroll", function(a) {
  858. currTop = t + a.pageY - pageY;
  859. c.css("top", currTop);
  860. m(0, c.position().top, !1)
  861. });
  862. b.bind("mouseup.slimscroll", function(a) {
  863. y = !1;
  864. p();
  865. b.unbind(".slimscroll")
  866. });
  867. return!1
  868. }).bind("selectstart.slimscroll", function(a) {
  869. a.stopPropagation();
  870. a.preventDefault();
  871. return!1
  872. });
  873. g.hover(function() {
  874. v()
  875. }, function() {
  876. p()
  877. });
  878. c.hover(function() {
  879. x = !0
  880. }, function() {
  881. x = !1
  882. });
  883. b.hover(function() {
  884. s = !0;
  885. v();
  886. p()
  887. }, function() {
  888. s = !1;
  889. p()
  890. });
  891. b.bind("touchstart", function(a, b) {
  892. a.originalEvent.touches.length && (z = a.originalEvent.touches[0].pageY)
  893. });
  894. b.bind("touchmove", function(b) {
  895. k || b.originalEvent.preventDefault();
  896. b.originalEvent.touches.length &&
  897. (m((z - b.originalEvent.touches[0].pageY) / a.touchScrollStep, !0), z = b.originalEvent.touches[0].pageY)
  898. });
  899. w();
  900. "bottom" === a.start ? (c.css({top: b.outerHeight() - c.outerHeight()}), m(0, !0)) : "top" !== a.start && (m(f(a.start).position().top, null, !0), a.alwaysVisible || c.hide());
  901. C()
  902. }
  903. });
  904. return this
  905. }});
  906. jQuery.fn.extend({slimscroll: jQuery.fn.slimScroll})
  907. })(jQuery);
  908. /*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
  909. (function(h) {
  910. function F(a, b, d) {
  911. var c = a[0], e = /er/.test(d) ? m : /bl/.test(d) ? s : l, f = d == H ? {checked: c[l], disabled: c[s], indeterminate: "true" == a.attr(m) || "false" == a.attr(w)} : c[e];
  912. if (/^(ch|di|in)/.test(d) && !f)
  913. D(a, e);
  914. else if (/^(un|en|de)/.test(d) && f)
  915. t(a, e);
  916. else if (d == H)
  917. for (e in f)
  918. f[e] ? D(a, e, !0) : t(a, e, !0);
  919. else if (!b || "toggle" == d) {
  920. if (!b)
  921. a[p]("ifClicked");
  922. f ? c[n] !== u && t(a, e) : D(a, e)
  923. }
  924. }
  925. function D(a, b, d) {
  926. var c = a[0], e = a.parent(), f = b == l, A = b == m, B = b == s, K = A ? w : f ? E : "enabled", p = k(a, K + x(c[n])), N = k(a, b + x(c[n]));
  927. if (!0 !== c[b]) {
  928. if (!d &&
  929. b == l && c[n] == u && c.name) {
  930. var C = a.closest("form"), r = 'input[name="' + c.name + '"]', r = C.length ? C.find(r) : h(r);
  931. r.each(function() {
  932. this !== c && h(this).data(q) && t(h(this), b)
  933. })
  934. }
  935. A ? (c[b] = !0, c[l] && t(a, l, "force")) : (d || (c[b] = !0), f && c[m] && t(a, m, !1));
  936. L(a, f, b, d)
  937. }
  938. c[s] && k(a, y, !0) && e.find("." + I).css(y, "default");
  939. e[v](N || k(a, b) || "");
  940. B ? e.attr("aria-disabled", "true") : e.attr("aria-checked", A ? "mixed" : "true");
  941. e[z](p || k(a, K) || "")
  942. }
  943. function t(a, b, d) {
  944. var c = a[0], e = a.parent(), f = b == l, h = b == m, q = b == s, p = h ? w : f ? E : "enabled", t = k(a, p + x(c[n])),
  945. u = k(a, b + x(c[n]));
  946. if (!1 !== c[b]) {
  947. if (h || !d || "force" == d)
  948. c[b] = !1;
  949. L(a, f, p, d)
  950. }
  951. !c[s] && k(a, y, !0) && e.find("." + I).css(y, "pointer");
  952. e[z](u || k(a, b) || "");
  953. q ? e.attr("aria-disabled", "false") : e.attr("aria-checked", "false");
  954. e[v](t || k(a, p) || "")
  955. }
  956. function M(a, b) {
  957. if (a.data(q)) {
  958. a.parent().html(a.attr("style", a.data(q).s || ""));
  959. if (b)
  960. a[p](b);
  961. a.off(".i").unwrap();
  962. h(G + '[for="' + a[0].id + '"]').add(a.closest(G)).off(".i")
  963. }
  964. }
  965. function k(a, b, d) {
  966. if (a.data(q))
  967. return a.data(q).o[b + (d ? "" : "Class")]
  968. }
  969. function x(a) {
  970. return a.charAt(0).toUpperCase() +
  971. a.slice(1)
  972. }
  973. function L(a, b, d, c) {
  974. if (!c) {
  975. if (b)
  976. a[p]("ifToggled");
  977. a[p]("ifChanged")[p]("if" + x(d))
  978. }
  979. }
  980. var q = "iCheck", I = q + "-helper", u = "radio", l = "checked", E = "un" + l, s = "disabled", w = "determinate", m = "in" + w, H = "update", n = "type", v = "addClass", z = "removeClass", p = "trigger", G = "label", y = "cursor", J = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);
  981. h.fn[q] = function(a, b) {
  982. var d = 'input[type="checkbox"], input[type="' + u + '"]', c = h(), e = function(a) {
  983. a.each(function() {
  984. var a = h(this);
  985. c = a.is(d) ?
  986. c.add(a) : c.add(a.find(d))
  987. })
  988. };
  989. if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))
  990. return a = a.toLowerCase(), e(this), c.each(function() {
  991. var c = h(this);
  992. "destroy" == a ? M(c, "ifDestroyed") : F(c, !0, a);
  993. h.isFunction(b) && b()
  994. });
  995. if ("object" != typeof a && a)
  996. return this;
  997. var f = h.extend({checkedClass: l, disabledClass: s, indeterminateClass: m, labelHover: !0, aria: !1}, a), k = f.handle, B = f.hoverClass || "hover", x = f.focusClass || "focus", w = f.activeClass || "active", y = !!f.labelHover, C = f.labelHoverClass ||
  998. "hover", r = ("" + f.increaseArea).replace("%", "") | 0;
  999. if ("checkbox" == k || k == u)
  1000. d = 'input[type="' + k + '"]';
  1001. -50 > r && (r = -50);
  1002. e(this);
  1003. return c.each(function() {
  1004. var a = h(this);
  1005. M(a);
  1006. var c = this, b = c.id, e = -r + "%", d = 100 + 2 * r + "%", d = {position: "absolute", top: e, left: e, display: "block", width: d, height: d, margin: 0, padding: 0, background: "#fff", border: 0, opacity: 0}, e = J ? {position: "absolute", visibility: "hidden"} : r ? d : {position: "absolute", opacity: 0}, k = "checkbox" == c[n] ? f.checkboxClass || "icheckbox" : f.radioClass || "i" + u, m = h(G + '[for="' + b + '"]').add(a.closest(G)),
  1007. A = !!f.aria, E = q + "-" + Math.random().toString(36).replace("0.", ""), g = '<div class="' + k + '" ' + (A ? 'role="' + c[n] + '" ' : "");
  1008. m.length && A && m.each(function() {
  1009. g += 'aria-labelledby="';
  1010. this.id ? g += this.id : (this.id = E, g += E);
  1011. g += '"'
  1012. });
  1013. g = a.wrap(g + "/>")[p]("ifCreated").parent().append(f.insert);
  1014. d = h('<ins class="' + I + '"/>').css(d).appendTo(g);
  1015. a.data(q, {o: f, s: a.attr("style")}).css(e);
  1016. f.inheritClass && g[v](c.className || "");
  1017. f.inheritID && b && g.attr("id", q + "-" + b);
  1018. "static" == g.css("position") && g.css("position", "relative");
  1019. F(a, !0, H);
  1020. if (m.length)
  1021. m.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i", function(b) {
  1022. var d = b[n], e = h(this);
  1023. if (!c[s]) {
  1024. if ("click" == d) {
  1025. if (h(b.target).is("a"))
  1026. return;
  1027. F(a, !1, !0)
  1028. } else
  1029. y && (/ut|nd/.test(d) ? (g[z](B), e[z](C)) : (g[v](B), e[v](C)));
  1030. if (J)
  1031. b.stopPropagation();
  1032. else
  1033. return!1
  1034. }
  1035. });
  1036. a.on("click.i focus.i blur.i keyup.i keydown.i keypress.i", function(b) {
  1037. var d = b[n];
  1038. b = b.keyCode;
  1039. if ("click" == d)
  1040. return!1;
  1041. if ("keydown" == d && 32 == b)
  1042. return c[n] == u && c[l] || (c[l] ? t(a, l) : D(a, l)), !1;
  1043. if ("keyup" == d && c[n] == u)
  1044. !c[l] && D(a, l);
  1045. else if (/us|ur/.test(d))
  1046. g["blur" ==
  1047. d ? z : v](x)
  1048. });
  1049. d.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i", function(b) {
  1050. var d = b[n], e = /wn|up/.test(d) ? w : B;
  1051. if (!c[s]) {
  1052. if ("click" == d)
  1053. F(a, !1, !0);
  1054. else {
  1055. if (/wn|er|in/.test(d))
  1056. g[v](e);
  1057. else
  1058. g[z](e + " " + w);
  1059. if (m.length && y && e == B)
  1060. m[/ut|nd/.test(d) ? z : v](C)
  1061. }
  1062. if (J)
  1063. b.stopPropagation();
  1064. else
  1065. return!1
  1066. }
  1067. })
  1068. })
  1069. }
  1070. })(window.jQuery || window.Zepto);