app.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  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() - ($("body > .footer").outerHeight() || 0);
  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']:not(.simple), input[type='radio']:not(.simple)").iCheck({
  118. checkboxClass: 'icheckbox_minimal',
  119. radioClass: 'iradio_minimal'
  120. });
  121. });
  122. function fix_sidebar() {
  123. //Make sure the body tag has the .fixed class
  124. if (!$("body").hasClass("fixed")) {
  125. return;
  126. }
  127. //Add slimscroll
  128. $(".sidebar").slimscroll({
  129. height: ($(window).height() - $(".header").height()) + "px",
  130. color: "rgba(0,0,0,0.2)"
  131. });
  132. }
  133. function change_layout() {
  134. $("body").toggleClass("fixed");
  135. fix_sidebar();
  136. }
  137. function change_skin(cls) {
  138. $("body").removeClass("skin-blue skin-black");
  139. $("body").addClass(cls);
  140. }
  141. /*END DEMO*/
  142. $(window).load(function() {
  143. /*! pace 0.4.17 */
  144. (function() {
  145. 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) {
  146. function c() {
  147. this.constructor = a
  148. }
  149. for (var d in b)
  150. W.call(b, d) && (a[d] = b[d]);
  151. return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a
  152. }, Y = [].indexOf || function(a) {
  153. for (var b = 0, c = this.length; c > b; b++)
  154. if (b in this && this[b] === a)
  155. return b;
  156. return-1
  157. };
  158. 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() {
  159. var a;
  160. return null != (a = "undefined" != typeof performance && null !== performance ? "function" == typeof performance.now ? performance.now() : void 0 : void 0) ? a : +new Date
  161. }, D = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, s = window.cancelAnimationFrame || window.mozCancelAnimationFrame, null == D && (D = function(a) {
  162. return setTimeout(a, 50)
  163. }, s = function(a) {
  164. return clearTimeout(a)
  165. }), F = function(a) {
  166. var b, c;
  167. return b = B(), (c = function() {
  168. var d;
  169. return d = B() - b, d >= 33 ? (b = B(), a(d, function() {
  170. return D(c)
  171. })) : setTimeout(c, 33 - d)
  172. })()
  173. }, E = function() {
  174. var a, b, c;
  175. 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]
  176. }, u = function() {
  177. var a, b, c, d, e, f, g;
  178. for (b = arguments[0], d = 2 <= arguments.length?V.call(arguments, 1):[], f = 0, g = d.length; g > f; f++)
  179. if (c = d[f])
  180. for (a in c)
  181. 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);
  182. return b
  183. }, p = function(a) {
  184. var b, c, d, e, f;
  185. for (c = b = 0, e = 0, f = a.length; f > e; e++)
  186. d = a[e], c += Math.abs(d), b++;
  187. return c / b
  188. }, w = function(a, b) {
  189. var c, d, e;
  190. if (null == a && (a = "options"), null == b && (b = !0), e = document.querySelector("[data-pace-" + a + "]")) {
  191. if (c = e.getAttribute("data-pace-" + a), !b)
  192. return c;
  193. try {
  194. return JSON.parse(c)
  195. } catch (f) {
  196. return d = f, "undefined" != typeof console && null !== console ? console.error("Error parsing inline pace options", d) : void 0
  197. }
  198. }
  199. }, g = function() {
  200. function a() {
  201. }
  202. return a.prototype.on = function(a, b, c, d) {
  203. var e;
  204. 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})
  205. }, a.prototype.once = function(a, b, c) {
  206. return this.on(a, b, c, !0)
  207. }, a.prototype.off = function(a, b) {
  208. var c, d, e;
  209. if (null != (null != (d = this.bindings) ? d[a] : void 0)) {
  210. if (null == b)
  211. return delete this.bindings[a];
  212. for (c = 0, e = []; c < this.bindings[a].length; )
  213. this.bindings[a][c].handler === b ? e.push(this.bindings[a].splice(c, 1)) : e.push(c++);
  214. return e
  215. }
  216. }, a.prototype.trigger = function() {
  217. var a, b, c, d, e, f, g, h, i;
  218. if (c = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], null != (g = this.bindings) ? g[c] : void 0) {
  219. for (e = 0, i = []; e < this.bindings[c].length; )
  220. 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++);
  221. return i
  222. }
  223. }, a
  224. }(), 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++)
  225. I = S[O], C[I] === !0 && (C[I] = t[I]);
  226. i = function(a) {
  227. function b() {
  228. return T = b.__super__.constructor.apply(this, arguments)
  229. }
  230. return X(b, a), b
  231. }(Error), b = function() {
  232. function a() {
  233. this.progress = 0
  234. }
  235. return a.prototype.getElement = function() {
  236. var a;
  237. if (null == this.el) {
  238. if (a = document.querySelector(C.target), !a)
  239. throw new i;
  240. 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)
  241. }
  242. return this.el
  243. }, a.prototype.finish = function() {
  244. var a;
  245. 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"
  246. }, a.prototype.update = function(a) {
  247. return this.progress = a, this.render()
  248. }, a.prototype.destroy = function() {
  249. try {
  250. this.getElement().parentNode.removeChild(this.getElement())
  251. } catch (a) {
  252. i = a
  253. }
  254. return this.el = void 0
  255. }, a.prototype.render = function() {
  256. var a, b;
  257. 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)
  258. }, a.prototype.done = function() {
  259. return this.progress >= 100
  260. }, a
  261. }(), h = function() {
  262. function a() {
  263. this.bindings = {}
  264. }
  265. return a.prototype.trigger = function(a, b) {
  266. var c, d, e, f, g;
  267. if (null != this.bindings[a]) {
  268. for (f = this.bindings[a], g = [], d = 0, e = f.length; e > d; d++)
  269. c = f[d], g.push(c.call(this, b));
  270. return g
  271. }
  272. }, a.prototype.on = function(a, b) {
  273. var c;
  274. return null == (c = this.bindings)[a] && (c[a] = []), this.bindings[a].push(b)
  275. }, a
  276. }(), N = window.XMLHttpRequest, M = window.XDomainRequest, L = window.WebSocket, v = function(a, b) {
  277. var c, d, e, f;
  278. f = [];
  279. for (d in b.prototype)
  280. try {
  281. e = b.prototype[d], null == a[d] && "function" != typeof e ? f.push(a[d] = e) : f.push(void 0)
  282. } catch (g) {
  283. c = g
  284. }
  285. return f
  286. }, z = [], Pace.ignore = function() {
  287. var a, b, c;
  288. return b = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], z.unshift("ignore"), c = b.apply(null, a), z.shift(), c
  289. }, Pace.track = function() {
  290. var a, b, c;
  291. return b = arguments[0], a = 2 <= arguments.length ? V.call(arguments, 1) : [], z.unshift("track"), c = b.apply(null, a), z.shift(), c
  292. }, H = function(a) {
  293. var b;
  294. if (null == a && (a = "GET"), "track" === z[0])
  295. return"force";
  296. if (!z.length && C.ajax) {
  297. if ("socket" === a && C.ajax.trackWebSockets)
  298. return!0;
  299. if (b = a.toUpperCase(), Y.call(C.ajax.trackMethods, b) >= 0)
  300. return!0
  301. }
  302. return!1
  303. }, j = function(a) {
  304. function b() {
  305. var a, c = this;
  306. b.__super__.constructor.apply(this, arguments), a = function(a) {
  307. var b;
  308. return b = a.open, a.open = function(d, e) {
  309. return H(d) && c.trigger("request", {type: d, url: e, request: a}), b.apply(a, arguments)
  310. }
  311. }, window.XMLHttpRequest = function(b) {
  312. var c;
  313. return c = new N(b), a(c), c
  314. }, v(window.XMLHttpRequest, N), null != M && (window.XDomainRequest = function() {
  315. var b;
  316. return b = new M, a(b), b
  317. }, v(window.XDomainRequest, M)), null != L && C.ajax.trackWebSockets && (window.WebSocket = function(a, b) {
  318. var d;
  319. return d = new L(a, b), H("socket") && c.trigger("request", {type: "socket", url: a, protocols: b, request: d}), d
  320. }, v(window.WebSocket, L))
  321. }
  322. return X(b, a), b
  323. }(h), P = null, x = function() {
  324. return null == P && (P = new j), P
  325. }, x().on("request", function(b) {
  326. var c, d, e, f;
  327. 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() {
  328. var b, c, g, h, i, j;
  329. if (b = "socket" === f ? e.readyState < 2 : 0 < (h = e.readyState) && 4 > h) {
  330. for (Pace.restart(), i = Pace.sources, j = [], c = 0, g = i.length; g > c; c++) {
  331. if (I = i[c], I instanceof a) {
  332. I.watch.apply(I, d);
  333. break
  334. }
  335. j.push(void 0)
  336. }
  337. return j
  338. }
  339. }, c))
  340. }), a = function() {
  341. function a() {
  342. var a = this;
  343. this.elements = [], x().on("request", function() {
  344. return a.watch.apply(a, arguments)
  345. })
  346. }
  347. return a.prototype.watch = function(a) {
  348. var b, c, d;
  349. return d = a.type, b = a.request, c = "socket" === d ? new m(b) : new n(b), this.elements.push(c)
  350. }, a
  351. }(), n = function() {
  352. function a(a) {
  353. var b, c, d, e, f, g, h = this;
  354. if (this.progress = 0, null != window.ProgressEvent)
  355. for (c = null, a.addEventListener("progress", function(a) {
  356. return h.progress = a.lengthComputable ? 100 * a.loaded / a.total : h.progress + (100 - h.progress) / 2
  357. }), g = ["load", "abort", "timeout", "error"], d = 0, e = g.length; e > d; d++)
  358. b = g[d], a.addEventListener(b, function() {
  359. return h.progress = 100
  360. });
  361. else
  362. f = a.onreadystatechange, a.onreadystatechange = function() {
  363. var b;
  364. 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
  365. }
  366. }
  367. return a
  368. }(), m = function() {
  369. function a(a) {
  370. var b, c, d, e, f = this;
  371. for (this.progress = 0, e = ["error", "open"], c = 0, d = e.length; d > c; c++)
  372. b = e[c], a.addEventListener(b, function() {
  373. return f.progress = 100
  374. })
  375. }
  376. return a
  377. }(), d = function() {
  378. function a(a) {
  379. var b, c, d, f;
  380. for (null == a && (a = {}), this.elements = [], null == a.selectors && (a.selectors = []), f = a.selectors, c = 0, d = f.length; d > c; c++)
  381. b = f[c], this.elements.push(new e(b))
  382. }
  383. return a
  384. }(), e = function() {
  385. function a(a) {
  386. this.selector = a, this.progress = 0, this.check()
  387. }
  388. return a.prototype.check = function() {
  389. var a = this;
  390. return document.querySelector(this.selector) ? this.done() : setTimeout(function() {
  391. return a.check()
  392. }, C.elements.checkInterval)
  393. }, a.prototype.done = function() {
  394. return this.progress = 100
  395. }, a
  396. }(), c = function() {
  397. function a() {
  398. var a, b, c = this;
  399. this.progress = null != (b = this.states[document.readyState]) ? b : 100, a = document.onreadystatechange, document.onreadystatechange = function() {
  400. return null != c.states[document.readyState] && (c.progress = c.states[document.readyState]), "function" == typeof a ? a.apply(null, arguments) : void 0
  401. }
  402. }
  403. return a.prototype.states = {loading: 0, interactive: 50, complete: 100}, a
  404. }(), f = function() {
  405. function a() {
  406. var a, b, c, d, e, f = this;
  407. this.progress = 0, a = 0, e = [], d = 0, c = B(), b = setInterval(function() {
  408. var g;
  409. 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))
  410. }, 50)
  411. }
  412. return a
  413. }(), l = function() {
  414. function a(a) {
  415. 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"))
  416. }
  417. return a.prototype.tick = function(a, b) {
  418. var c;
  419. 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
  420. }, a
  421. }(), J = null, G = null, q = null, K = null, o = null, r = null, Pace.running = !1, y = function() {
  422. return C.restartOnPushState ? Pace.restart() : void 0
  423. }, null != window.history.pushState && (R = window.history.pushState, window.history.pushState = function() {
  424. return y(), R.apply(window.history, arguments)
  425. }), null != window.history.replaceState && (U = window.history.replaceState, window.history.replaceState = function() {
  426. return y(), U.apply(window.history, arguments)
  427. }), k = {ajax: a, elements: d, document: c, eventLag: f}, (A = function() {
  428. var a, c, d, e, f, g, h, i;
  429. for (Pace.sources = J = [], g = ["ajax", "elements", "document", "eventLag"], c = 0, e = g.length; e > c; c++)
  430. a = g[c], C[a] !== !1 && J.push(new k[a](C[a]));
  431. for (i = null != (h = C.extraSources)?h:[], d = 0, f = i.length; f > d; d++)
  432. I = i[d], J.push(new I(C));
  433. return Pace.bar = q = new b, G = [], K = new l
  434. })(), Pace.stop = function() {
  435. return Pace.trigger("stop"), Pace.running = !1, q.destroy(), r = !0, null != o && ("function" == typeof s && s(o), o = null), A()
  436. }, Pace.restart = function() {
  437. return Pace.trigger("restart"), Pace.stop(), Pace.start()
  438. }, Pace.go = function() {
  439. return Pace.running = !0, q.render(), r = !1, o = F(function(a, b) {
  440. var c, d, e, f, g, h, i, j, k, m, n, o, p, s, t, u, v;
  441. for (j = 100 - q.progress, d = o = 0, e = !0, h = p = 0, t = J.length; t > p; h = ++p)
  442. 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)
  443. f = g[i], k = null != m[i] ? m[i] : m[i] = new l(f), e &= k.done, k.done || (d++, o += k.tick(a));
  444. return c = o / d, q.update(K.tick(a, c)), n = B(), q.done() || e || r ? (q.update(100), Pace.trigger("done"), setTimeout(function() {
  445. return q.finish(), Pace.running = !1, Pace.trigger("hide")
  446. }, Math.max(C.ghostTime, Math.min(C.minTime, B() - n)))) : b()
  447. })
  448. }, Pace.start = function(a) {
  449. u(C, a), Pace.running = !0;
  450. try {
  451. q.render()
  452. } catch (b) {
  453. i = b
  454. }
  455. return document.querySelector(".pace") ? (Pace.trigger("start"), Pace.go()) : setTimeout(Pace.start, 50)
  456. }, "function" == typeof define && define.amd ? define('theme-app', [], function() {
  457. return Pace
  458. }) : "object" == typeof exports ? module.exports = Pace : C.startOnPageLoad && Pace.start()
  459. }).call(this);
  460. });
  461. /*
  462. * BOX REFRESH BUTTON
  463. * ------------------
  464. * This is a custom plugin to use with the compenet BOX. It allows you to add
  465. * a refresh button to the box. It converts the box's state to a loading state.
  466. *
  467. * USAGE:
  468. * $("#box-widget").boxRefresh( options );
  469. * */
  470. (function($) {
  471. "use strict";
  472. $.fn.boxRefresh = function(options) {
  473. // Render options
  474. var settings = $.extend({
  475. //Refressh button selector
  476. trigger: ".refresh-btn",
  477. //File source to be loaded (e.g: ajax/src.php)
  478. source: "",
  479. //Callbacks
  480. onLoadStart: function(box) {
  481. }, //Right after the button has been clicked
  482. onLoadDone: function(box) {
  483. } //When the source has been loaded
  484. }, options);
  485. //The overlay
  486. var overlay = $('<div class="overlay"></div><div class="loading-img"></div>');
  487. return this.each(function() {
  488. //if a source is specified
  489. if (settings.source === "") {
  490. if (console) {
  491. console.log("Please specify a source first - boxRefresh()");
  492. }
  493. return;
  494. }
  495. //the box
  496. var box = $(this);
  497. //the button
  498. var rBtn = box.find(settings.trigger).first();
  499. //On trigger click
  500. rBtn.click(function(e) {
  501. e.preventDefault();
  502. //Add loading overlay
  503. start(box);
  504. //Perform ajax call
  505. box.find(".box-body").load(settings.source, function() {
  506. done(box);
  507. });
  508. });
  509. });
  510. function start(box) {
  511. //Add overlay and loading img
  512. box.append(overlay);
  513. settings.onLoadStart.call(box);
  514. }
  515. function done(box) {
  516. //Remove overlay and loading img
  517. box.find(overlay).remove();
  518. settings.onLoadDone.call(box);
  519. }
  520. };
  521. })(jQuery);
  522. /*
  523. * SIDEBAR MENU
  524. * ------------
  525. * This is a custom plugin for the sidebar menu. It provides a tree view.
  526. *
  527. * Usage:
  528. * $(".sidebar).tree();
  529. *
  530. * Note: This plugin does not accept any options. Instead, it only requires a class
  531. * added to the element that contains a sub-menu.
  532. *
  533. * When used with the sidebar, for example, it would look something like this:
  534. * <ul class='sidebar-menu'>
  535. * <li class="treeview active">
  536. * <a href="#>Menu</a>
  537. * <ul class='treeview-menu'>
  538. * <li class='active'><a href=#>Level 1</a></li>
  539. * </ul>
  540. * </li>
  541. * </ul>
  542. *
  543. * Add .active class to <li> elements if you want the menu to be open automatically
  544. * on page load. See above for an example.
  545. */
  546. (function($) {
  547. "use strict";
  548. $.fn.tree = function() {
  549. return this.each(function() {
  550. var btn = $(this).children("a").first();
  551. var menu = $(this).children(".treeview-menu").first();
  552. var isActive = $(this).hasClass('active');
  553. //initialize already active menus
  554. if (isActive) {
  555. menu.show();
  556. btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
  557. }
  558. //Slide open or close the menu on link click
  559. btn.click(function(e) {
  560. e.preventDefault();
  561. if (isActive) {
  562. //Slide up to close menu
  563. menu.slideUp();
  564. isActive = false;
  565. btn.children(".fa-angle-down").first().removeClass("fa-angle-down").addClass("fa-angle-left");
  566. btn.parent("li").removeClass("active");
  567. } else {
  568. //Slide down to open menu
  569. menu.slideDown();
  570. isActive = true;
  571. btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
  572. btn.parent("li").addClass("active");
  573. }
  574. });
  575. /* Add margins to submenu elements to give it a tree look */
  576. menu.find("li > a").each(function() {
  577. var pad = parseInt($(this).css("margin-left")) + 10;
  578. $(this).css({"margin-left": pad + "px"});
  579. });
  580. });
  581. };
  582. }(jQuery));
  583. /*
  584. * TODO LIST CUSTOM PLUGIN
  585. * -----------------------
  586. * This plugin depends on iCheck plugin for checkbox and radio inputs
  587. */
  588. (function($) {
  589. "use strict";
  590. $.fn.todolist = function(options) {
  591. // Render options
  592. var settings = $.extend({
  593. //When the user checks the input
  594. onCheck: function(ele) {
  595. },
  596. //When the user unchecks the input
  597. onUncheck: function(ele) {
  598. }
  599. }, options);
  600. return this.each(function() {
  601. $('input', this).on('ifChecked', function(event) {
  602. var ele = $(this).parents("li").first();
  603. ele.toggleClass("done");
  604. settings.onCheck.call(ele);
  605. });
  606. $('input', this).on('ifUnchecked', function(event) {
  607. var ele = $(this).parents("li").first();
  608. ele.toggleClass("done");
  609. settings.onUncheck.call(ele);
  610. });
  611. });
  612. };
  613. }(jQuery));
  614. /* CENTER ELEMENTS */
  615. (function($) {
  616. "use strict";
  617. jQuery.fn.center = function(parent) {
  618. if (parent) {
  619. parent = this.parent();
  620. } else {
  621. parent = window;
  622. }
  623. this.css({
  624. "position": "absolute",
  625. "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"),
  626. "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px")
  627. });
  628. return this;
  629. }
  630. }(jQuery));
  631. /*
  632. * jQuery resize event - v1.1 - 3/14/2010
  633. * http://benalman.com/projects/jquery-resize-plugin/
  634. *
  635. * Copyright (c) 2010 "Cowboy" Ben Alman
  636. * Dual licensed under the MIT and GPL licenses.
  637. * http://benalman.com/about/license/
  638. */
  639. (function($, h, c) {
  640. var a = $([]), e = $.resize = $.extend($.resize, {}), i, k = "setTimeout", j = "resize", d = j + "-special-event", b = "delay", f = "throttleWindow";
  641. e[b] = 250;
  642. e[f] = true;
  643. $.event.special[j] = {setup: function() {
  644. if (!e[f] && this[k]) {
  645. return false;
  646. }
  647. var l = $(this);
  648. a = a.add(l);
  649. $.data(this, d, {w: l.width(), h: l.height()});
  650. if (a.length === 1) {
  651. g();
  652. }
  653. }, teardown: function() {
  654. if (!e[f] && this[k]) {
  655. return false
  656. }
  657. var l = $(this);
  658. a = a.not(l);
  659. l.removeData(d);
  660. if (!a.length) {
  661. clearTimeout(i);
  662. }
  663. }, add: function(l) {
  664. if (!e[f] && this[k]) {
  665. return false
  666. }
  667. var n;
  668. function m(s, o, p) {
  669. var q = $(this), r = $.data(this, d);
  670. r.w = o !== c ? o : q.width();
  671. r.h = p !== c ? p : q.height();
  672. n.apply(this, arguments)
  673. }
  674. if ($.isFunction(l)) {
  675. n = l;
  676. return m
  677. } else {
  678. n = l.handler;
  679. l.handler = m
  680. }
  681. }};
  682. function g() {
  683. i = h[k](function() {
  684. a.each(function() {
  685. var n = $(this), m = n.width(), l = n.height(), o = $.data(this, d);
  686. if (m !== o.w || l !== o.h) {
  687. n.trigger(j, [o.w = m, o.h = l])
  688. }
  689. });
  690. g()
  691. }, e[b])
  692. }}
  693. )(jQuery, this);
  694. /*!
  695. * SlimScroll https://github.com/rochal/jQuery-slimScroll
  696. * =======================================================
  697. *
  698. * Copyright (c) 2011 Piotr Rochala (http://rocha.la) Dual licensed under the MIT
  699. */
  700. (function(f) {
  701. jQuery.fn.extend({slimScroll: function(h) {
  702. 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);
  703. this.each(function() {
  704. function r(d) {
  705. if (s) {
  706. d = d ||
  707. window.event;
  708. var c = 0;
  709. d.wheelDelta && (c = -d.wheelDelta / 120);
  710. d.detail && (c = d.detail / 3);
  711. f(d.target || d.srcTarget || d.srcElement).closest("." + a.wrapperClass).is(b.parent()) && m(c, !0);
  712. d.preventDefault && !k && d.preventDefault();
  713. k || (d.returnValue = !1)
  714. }
  715. }
  716. function m(d, f, h) {
  717. k = !1;
  718. var e = d, g = b.outerHeight() - c.outerHeight();
  719. 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"}));
  720. l = parseInt(c.css("top")) / (b.outerHeight() - c.outerHeight());
  721. e = l * (b[0].scrollHeight - b.outerHeight());
  722. h && (e = d, d = e / b[0].scrollHeight * b.outerHeight(), d = Math.min(Math.max(d, 0), g), c.css({top: d + "px"}));
  723. b.scrollTop(e);
  724. b.trigger("slimscrolling", ~~e);
  725. v();
  726. p()
  727. }
  728. function C() {
  729. window.addEventListener ? (this.addEventListener("DOMMouseScroll", r, !1), this.addEventListener("mousewheel", r, !1), this.addEventListener("MozMousePixelScroll", r, !1)) : document.attachEvent("onmousewheel", r)
  730. }
  731. function w() {
  732. u = Math.max(b.outerHeight() / b[0].scrollHeight * b.outerHeight(), D);
  733. c.css({height: u + "px"});
  734. var a = u == b.outerHeight() ? "none" : "block";
  735. c.css({display: a})
  736. }
  737. function v() {
  738. w();
  739. clearTimeout(A);
  740. l == ~~l ? (k = a.allowPageScroll, B != l && b.trigger("slimscroll", 0 == ~~l ? "top" : "bottom")) : k = !1;
  741. B = l;
  742. u >= b.outerHeight() ? k = !0 : (c.stop(!0, !0).fadeIn("fast"), a.railVisible && g.stop(!0, !0).fadeIn("fast"))
  743. }
  744. function p() {
  745. a.alwaysVisible || (A = setTimeout(function() {
  746. a.disableFadeOut && s || (x || y) || (c.fadeOut("slow"), g.fadeOut("slow"))
  747. }, 1E3))
  748. }
  749. var s, x, y, A, z, u, l, B, D = 30, k = !1, b = f(this);
  750. if (b.parent().hasClass(a.wrapperClass)) {
  751. var n = b.scrollTop(),
  752. c = b.parent().find("." + a.barClass), g = b.parent().find("." + a.railClass);
  753. w();
  754. if (f.isPlainObject(h)) {
  755. if ("height"in h && "auto" == h.height) {
  756. b.parent().css("height", "auto");
  757. b.css("height", "auto");
  758. var q = b.parent().parent().height();
  759. b.parent().css("height", q);
  760. b.css("height", q)
  761. }
  762. if ("scrollTo"in h)
  763. n = parseInt(a.scrollTo);
  764. else if ("scrollBy"in h)
  765. n += parseInt(a.scrollBy);
  766. else if ("destroy"in h) {
  767. c.remove();
  768. g.remove();
  769. b.unwrap();
  770. return
  771. }
  772. m(n, !1, !0)
  773. }
  774. } else {
  775. a.height = "auto" == a.height ? b.parent().height() : a.height;
  776. n = f("<div></div>").addClass(a.wrapperClass).css({position: "relative",
  777. overflow: "hidden", width: a.width, height: a.height});
  778. b.css({overflow: "hidden", width: a.width, height: a.height});
  779. 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 ?
  780. "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};
  781. g.css(q);
  782. c.css(q);
  783. b.wrap(n);
  784. b.parent().append(c);
  785. b.parent().append(g);
  786. a.railDraggable && c.bind("mousedown", function(a) {
  787. var b = f(document);
  788. y = !0;
  789. t = parseFloat(c.css("top"));
  790. pageY = a.pageY;
  791. b.bind("mousemove.slimscroll", function(a) {
  792. currTop = t + a.pageY - pageY;
  793. c.css("top", currTop);
  794. m(0, c.position().top, !1)
  795. });
  796. b.bind("mouseup.slimscroll", function(a) {
  797. y = !1;
  798. p();
  799. b.unbind(".slimscroll")
  800. });
  801. return!1
  802. }).bind("selectstart.slimscroll", function(a) {
  803. a.stopPropagation();
  804. a.preventDefault();
  805. return!1
  806. });
  807. g.hover(function() {
  808. v()
  809. }, function() {
  810. p()
  811. });
  812. c.hover(function() {
  813. x = !0
  814. }, function() {
  815. x = !1
  816. });
  817. b.hover(function() {
  818. s = !0;
  819. v();
  820. p()
  821. }, function() {
  822. s = !1;
  823. p()
  824. });
  825. b.bind("touchstart", function(a, b) {
  826. a.originalEvent.touches.length && (z = a.originalEvent.touches[0].pageY)
  827. });
  828. b.bind("touchmove", function(b) {
  829. k || b.originalEvent.preventDefault();
  830. b.originalEvent.touches.length &&
  831. (m((z - b.originalEvent.touches[0].pageY) / a.touchScrollStep, !0), z = b.originalEvent.touches[0].pageY)
  832. });
  833. w();
  834. "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());
  835. C()
  836. }
  837. });
  838. return this
  839. }});
  840. jQuery.fn.extend({slimscroll: jQuery.fn.slimScroll})
  841. })(jQuery);
  842. /*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
  843. (function(h) {
  844. function F(a, b, d) {
  845. 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];
  846. if (/^(ch|di|in)/.test(d) && !f)
  847. D(a, e);
  848. else if (/^(un|en|de)/.test(d) && f)
  849. t(a, e);
  850. else if (d == H)
  851. for (e in f)
  852. f[e] ? D(a, e, !0) : t(a, e, !0);
  853. else if (!b || "toggle" == d) {
  854. if (!b)
  855. a[p]("ifClicked");
  856. f ? c[n] !== u && t(a, e) : D(a, e)
  857. }
  858. }
  859. function D(a, b, d) {
  860. 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]));
  861. if (!0 !== c[b]) {
  862. if (!d &&
  863. b == l && c[n] == u && c.name) {
  864. var C = a.closest("form"), r = 'input[name="' + c.name + '"]', r = C.length ? C.find(r) : h(r);
  865. r.each(function() {
  866. this !== c && h(this).data(q) && t(h(this), b)
  867. })
  868. }
  869. A ? (c[b] = !0, c[l] && t(a, l, "force")) : (d || (c[b] = !0), f && c[m] && t(a, m, !1));
  870. L(a, f, b, d)
  871. }
  872. c[s] && k(a, y, !0) && e.find("." + I).css(y, "default");
  873. e[v](N || k(a, b) || "");
  874. B ? e.attr("aria-disabled", "true") : e.attr("aria-checked", A ? "mixed" : "true");
  875. e[z](p || k(a, K) || "")
  876. }
  877. function t(a, b, d) {
  878. 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])),
  879. u = k(a, b + x(c[n]));
  880. if (!1 !== c[b]) {
  881. if (h || !d || "force" == d)
  882. c[b] = !1;
  883. L(a, f, p, d)
  884. }
  885. !c[s] && k(a, y, !0) && e.find("." + I).css(y, "pointer");
  886. e[z](u || k(a, b) || "");
  887. q ? e.attr("aria-disabled", "false") : e.attr("aria-checked", "false");
  888. e[v](t || k(a, p) || "")
  889. }
  890. function M(a, b) {
  891. if (a.data(q)) {
  892. a.parent().html(a.attr("style", a.data(q).s || ""));
  893. if (b)
  894. a[p](b);
  895. a.off(".i").unwrap();
  896. h(G + '[for="' + a[0].id + '"]').add(a.closest(G)).off(".i")
  897. }
  898. }
  899. function k(a, b, d) {
  900. if (a.data(q))
  901. return a.data(q).o[b + (d ? "" : "Class")]
  902. }
  903. function x(a) {
  904. return a.charAt(0).toUpperCase() +
  905. a.slice(1)
  906. }
  907. function L(a, b, d, c) {
  908. if (!c) {
  909. if (b)
  910. a[p]("ifToggled");
  911. a[p]("ifChanged")[p]("if" + x(d))
  912. }
  913. }
  914. 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);
  915. h.fn[q] = function(a, b) {
  916. var d = 'input[type="checkbox"], input[type="' + u + '"]', c = h(), e = function(a) {
  917. a.each(function() {
  918. var a = h(this);
  919. c = a.is(d) ?
  920. c.add(a) : c.add(a.find(d))
  921. })
  922. };
  923. if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))
  924. return a = a.toLowerCase(), e(this), c.each(function() {
  925. var c = h(this);
  926. "destroy" == a ? M(c, "ifDestroyed") : F(c, !0, a);
  927. h.isFunction(b) && b()
  928. });
  929. if ("object" != typeof a && a)
  930. return this;
  931. 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 ||
  932. "hover", r = ("" + f.increaseArea).replace("%", "") | 0;
  933. if ("checkbox" == k || k == u)
  934. d = 'input[type="' + k + '"]';
  935. -50 > r && (r = -50);
  936. e(this);
  937. return c.each(function() {
  938. var a = h(this);
  939. M(a);
  940. 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)),
  941. A = !!f.aria, E = q + "-" + Math.random().toString(36).replace("0.", ""), g = '<div class="' + k + '" ' + (A ? 'role="' + c[n] + '" ' : "");
  942. m.length && A && m.each(function() {
  943. g += 'aria-labelledby="';
  944. this.id ? g += this.id : (this.id = E, g += E);
  945. g += '"'
  946. });
  947. g = a.wrap(g + "/>")[p]("ifCreated").parent().append(f.insert);
  948. d = h('<ins class="' + I + '"/>').css(d).appendTo(g);
  949. a.data(q, {o: f, s: a.attr("style")}).css(e);
  950. f.inheritClass && g[v](c.className || "");
  951. f.inheritID && b && g.attr("id", q + "-" + b);
  952. "static" == g.css("position") && g.css("position", "relative");
  953. F(a, !0, H);
  954. if (m.length)
  955. m.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i", function(b) {
  956. var d = b[n], e = h(this);
  957. if (!c[s]) {
  958. if ("click" == d) {
  959. if (h(b.target).is("a"))
  960. return;
  961. F(a, !1, !0)
  962. } else
  963. y && (/ut|nd/.test(d) ? (g[z](B), e[z](C)) : (g[v](B), e[v](C)));
  964. if (J)
  965. b.stopPropagation();
  966. else
  967. return!1
  968. }
  969. });
  970. a.on("click.i focus.i blur.i keyup.i keydown.i keypress.i", function(b) {
  971. var d = b[n];
  972. b = b.keyCode;
  973. if ("click" == d)
  974. return!1;
  975. if ("keydown" == d && 32 == b)
  976. return c[n] == u && c[l] || (c[l] ? t(a, l) : D(a, l)), !1;
  977. if ("keyup" == d && c[n] == u)
  978. !c[l] && D(a, l);
  979. else if (/us|ur/.test(d))
  980. g["blur" ==
  981. d ? z : v](x)
  982. });
  983. d.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i", function(b) {
  984. var d = b[n], e = /wn|up/.test(d) ? w : B;
  985. if (!c[s]) {
  986. if ("click" == d)
  987. F(a, !1, !0);
  988. else {
  989. if (/wn|er|in/.test(d))
  990. g[v](e);
  991. else
  992. g[z](e + " " + w);
  993. if (m.length && y && e == B)
  994. m[/ut|nd/.test(d) ? z : v](C)
  995. }
  996. if (J)
  997. b.stopPropagation();
  998. else
  999. return!1
  1000. }
  1001. })
  1002. })
  1003. }
  1004. })(window.jQuery || window.Zepto);