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