app.js 46 KB

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