提交 www

This commit is contained in:
Cheney
2025-04-29 09:09:06 +08:00
parent 2f5d5e0a3c
commit 62986c4157
2266 changed files with 313631 additions and 0 deletions
+17
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+90
View File
@@ -0,0 +1,90 @@
//关键词sug
var hotList = 0;
$(function() {
//当键盘键被松开时发送Ajax获取数据
$('#search-text').keyup(function() {
var keywords = $(this).val();
if (keywords == '') { $('#word').hide(); return };
$.ajax({
url: 'https://suggestion.baidu.com/su?wd=' + keywords,
dataType: 'jsonp',
jsonp: 'cb', //回调函数的参数名(键值)key
// jsonpCallback: 'fun', //回调函数名(值) value
beforeSend: function() {
// $('#word').append('<li>正在加载。。。</li>');
},
success: function(res) {
$('#word').empty().show();
hotList = res.s.length;
if (hotList) {
$("#word").css("display", "block");
for (var i = 0; i < hotList-1; i++) {
if (i===hotList-1){
$("#word").append('<li id="lastHot"><span>' + (i + 1) + "</span>" + res.s[i] + "</li>");
}
else{
$("#word").append("<li><span>" + (i + 1) + "</span>" + res.s[i] + "</li>");
}
$("#word li").eq(i).click(function() {
$('#search-text').val(this.childNodes[1].nodeValue);
window.open(thisSearch + this.childNodes[1].nodeValue);
$('#word').css('display', 'none')
});
if (i === 0) {
$("#word ul li").eq(i).css({
"border-top": "none"
});
$("#word ul span").eq(i).css({
"color": "#fff",
"background": "#f54545"
})
} else if (i === 1) {
$("#word ul span").eq(i).css({
"color": "#fff",
"background": "#ff8547"
})
} else if (i === 2) {
$("#word ul span").eq(i).css({
"color": "#fff",
"background": "#ffac38"
})
}
}
} else {
$("#word").css("display", "none")
}
/*
if (data.s == '') {
//$('#word').append('<div class="error">Not find "' + keywords + '"</div>');
$('#word').empty();
$('#word').hide();
}
$.each(data.s, function() {
$('#word').append('<li>' + this + '</li>');
})*/
},
error: function() {
$('#word').empty().show();
//$('#word').append('<div class="click_work">Fail "' + keywords + '"</div>');
$('#word').hide();
}
})
})
//点击搜索数据复制给搜索框
$(document).on('click', '#word li', function() {
var word = $(this).text().replace(/^[0-9]/, '');
$('#search-text').val(word);
$('#word').empty();
$('#word').hide();
//$("form").submit();
$('.submit').trigger('click');//触发搜索事件
})
//$(document).on('click', '.container,.banner-video,nav', function() {
$(document).on('click', '.io-grey-mode', function() {
$('#word').empty();
$('#word').hide();
})
})
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
/*
* jQuery UI Touch Punch 0.2.2
*
* Copyright 2011, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
File diff suppressed because one or more lines are too long
+173
View File
@@ -0,0 +1,173 @@
/*! lozad.js - v1.14.0 - 2019-10-19
* https://github.com/ApoorvSaxena/lozad.js
* Copyright (c) 2019 Apoorv Saxena; Licensed MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.lozad = factory());
}(this, function () { 'use strict';
/**
* Detect IE browser
* @const {boolean}
* @private
*/
var isIE = typeof document !== 'undefined' && document.documentMode;
var defaultConfig = {
rootMargin: '0px',
threshold: 0,
load: function load(element) {
if (element.nodeName.toLowerCase() === 'picture') {
var img = document.createElement('img');
if (isIE && element.getAttribute('data-iesrc')) {
img.src = element.getAttribute('data-iesrc');
}
if (element.getAttribute('data-alt')) {
img.alt = element.getAttribute('data-alt');
}
element.append(img);
}
if (element.nodeName.toLowerCase() === 'video' && !element.getAttribute('data-src')) {
if (element.children) {
var childs = element.children;
var childSrc = void 0;
for (var i = 0; i <= childs.length - 1; i++) {
childSrc = childs[i].getAttribute('data-src');
if (childSrc) {
childs[i].src = childSrc;
}
}
element.load();
}
}
if (element.getAttribute('data-src')) {
element.src = element.getAttribute('data-src');
}
if (element.getAttribute('data-srcset')) {
element.setAttribute('srcset', element.getAttribute('data-srcset'));
}
if (element.getAttribute('data-background-image')) {
element.style.backgroundImage = 'url(\'' + element.getAttribute('data-background-image').split(',').join('\'),url(\'') + '\')';
} else if (element.getAttribute('data-background-image-set')) {
var imageSetLinks = element.getAttribute('data-background-image-set').split(',');
var firstUrlLink = imageSetLinks[0].substr(0, imageSetLinks[0].indexOf(' ')) || imageSetLinks[0]; // Substring before ... 1x
firstUrlLink = firstUrlLink.indexOf('url(') === -1 ? 'url(' + firstUrlLink + ')' : firstUrlLink;
if (imageSetLinks.length === 1) {
element.style.backgroundImage = firstUrlLink;
} else {
element.setAttribute('style', (element.getAttribute('style') || '') + ('background-image: ' + firstUrlLink + '; background-image: -webkit-image-set(' + imageSetLinks + '); background-image: image-set(' + imageSetLinks + ')'));
}
}
if (element.getAttribute('data-toggle-class')) {
element.classList.toggle(element.getAttribute('data-toggle-class'));
}
},
loaded: function loaded() {}
};
function markAsLoaded(element) {
element.setAttribute('data-loaded', true);
}
var isLoaded = function isLoaded(element) {
return element.getAttribute('data-loaded') === 'true';
};
var onIntersection = function onIntersection(load, loaded) {
return function (entries, observer) {
entries.forEach(function (entry) {
if (entry.intersectionRatio > 0 || entry.isIntersecting) {
observer.unobserve(entry.target);
if (!isLoaded(entry.target)) {
load(entry.target);
markAsLoaded(entry.target);
loaded(entry.target);
}
}
});
};
};
var getElements = function getElements(selector) {
var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
if (selector instanceof Element) {
return [selector];
}
if (selector instanceof NodeList) {
return selector;
}
return root.querySelectorAll(selector);
};
function lozad () {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.lozad';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _Object$assign = Object.assign({}, defaultConfig, options),
root = _Object$assign.root,
rootMargin = _Object$assign.rootMargin,
threshold = _Object$assign.threshold,
load = _Object$assign.load,
loaded = _Object$assign.loaded;
var observer = void 0;
if (typeof window !== 'undefined' && window.IntersectionObserver) {
observer = new IntersectionObserver(onIntersection(load, loaded), {
root: root,
rootMargin: rootMargin,
threshold: threshold
});
}
return {
observe: function observe() {
var elements = getElements(selector, root);
for (var i = 0; i < elements.length; i++) {
if (isLoaded(elements[i])) {
continue;
}
if (observer) {
observer.observe(elements[i]);
continue;
}
load(elements[i]);
markAsLoaded(elements[i]);
loaded(elements[i]);
}
},
triggerLoad: function triggerLoad(element) {
if (isLoaded(element)) {
return;
}
load(element);
markAsLoaded(element);
loaded(element);
},
observer: observer
};
}
return lozad;
}));
+4
View File
File diff suppressed because one or more lines are too long
+122
View File
@@ -0,0 +1,122 @@
/*
This function will be called in the event when browser breakpoint changes
*/
var public_vars = public_vars || {};
jQuery.extend(public_vars, {
breakpoints: {
largescreen: [991, -1],
tabletscreen: [768, 990],
devicescreen: [420, 767],
sdevicescreen: [0, 419]
},
lastBreakpoint: null
});
/* Main Function that will be called each time when the screen breakpoint changes */
function resizable(breakpoint)
{
var sb_with_animation;
// Large Screen Specific Script
if(is('largescreen'))
{
}
// Tablet or larger screen
if(ismdxl())
{
}
// Tablet Screen Specific Script
if(is('tabletscreen'))
{
}
// Tablet device screen
if(is('tabletscreen'))
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
// Tablet Screen Specific Script
if(isxs())
{
}
// Trigger Event
jQuery(window).trigger('xenon.resize');
}
/* Functions */
// Get current breakpoint
function get_current_breakpoint()
{
var width = jQuery(window).width(),
breakpoints = public_vars.breakpoints;
for(var breakpont_label in breakpoints)
{
var bp_arr = breakpoints[breakpont_label],
min = bp_arr[0],
max = bp_arr[1];
if(max == -1)
max = width;
if(min <= width && max >= width)
{
return breakpont_label;
}
}
return null;
}
// Check current screen breakpoint
function is(screen_label)
{
return get_current_breakpoint() == screen_label;
}
// Is xs device
function isxs()
{
return is('devicescreen') || is('sdevicescreen');
}
// Is md or xl
function ismdxl()
{
return is('tabletscreen') || is('largescreen');
}
// Trigger Resizable Function
function trigger_resizable()
{
if(public_vars.lastBreakpoint != get_current_breakpoint())
{
public_vars.lastBreakpoint = get_current_breakpoint();
resizable(public_vars.lastBreakpoint);
}
// Trigger Event (Repeated)
jQuery(window).trigger('xenon.resized');
}
+354
View File
@@ -0,0 +1,354 @@
/*!
* Theia Sticky Sidebar v1.5.0
* https://github.com/WeCodePixels/theia-sticky-sidebar
*
* Glues your website's sidebars, making them permanently visible while scrolling.
*
* Copyright 2013-2016 WeCodePixels and other contributors
* Released under the MIT license
*/
(function ($) {
$.fn.theiaStickySidebar = function (options) {
var defaults = {
'containerSelector': '',
'additionalMarginTop': 0,
'additionalMarginBottom': 0,
'updateSidebarHeight': true,
'minWidth': 0,
'disableOnResponsiveLayouts': true,
'sidebarBehavior': 'modern'
};
options = $.extend(defaults, options);
// Validate options
options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0;
options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0;
tryInitOrHookIntoEvents(options, this);
// Try doing init, otherwise hook into window.resize and document.scroll and try again then.
function tryInitOrHookIntoEvents(options, $that) {
var success = tryInit(options, $that);
if (!success) {
console.log('TSS: Body width smaller than options.minWidth. Init is delayed.');
$(document).scroll(function (options, $that) {
return function (evt) {
var success = tryInit(options, $that);
if (success) {
$(this).unbind(evt);
}
};
}(options, $that));
$(window).resize(function (options, $that) {
return function (evt) {
var success = tryInit(options, $that);
if (success) {
$(this).unbind(evt);
}
};
}(options, $that))
}
}
// Try doing init if proper conditions are met.
function tryInit(options, $that) {
if (options.initialized === true) {
return true;
}
if ($('body').width() < options.minWidth) {
return false;
}
init(options, $that);
return true;
}
// Init the sticky sidebar(s).
function init(options, $that) {
options.initialized = true;
// Add CSS
$('head').append($('<style>.theiaStickySidebar:after {content: ""; display: table; clear: both;}</style>'));
$that.each(function () {
var o = {};
o.sidebar = $(this);
// Save options
o.options = options || {};
// Get container
o.container = $(o.options.containerSelector);
if (o.container.length == 0) {
o.container = o.sidebar.parent();
}
// Create sticky sidebar
o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574
o.sidebar.css({
'position': 'relative',
'overflow': 'visible',
// The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky sidebar has a fixed position.
'-webkit-box-sizing': 'border-box',
'-moz-box-sizing': 'border-box',
'box-sizing': 'border-box'
});
// Get the sticky sidebar element. If none has been found, then create one.
o.stickySidebar = o.sidebar.find('.theiaStickySidebar');
if (o.stickySidebar.length == 0) {
// Remove <script> tags, otherwise they will be run again when added to the stickySidebar.
var javaScriptMIMETypes = /(?:text|application)\/(?:x-)?(?:javascript|ecmascript)/i;
o.sidebar.find('script').filter(function(index, script) {
return script.type.length === 0 || script.type.match(javaScriptMIMETypes);
}).remove();
o.stickySidebar = $('<div>').addClass('theiaStickySidebar').append(o.sidebar.children());
o.sidebar.append(o.stickySidebar);
}
// Get existing top and bottom margins and paddings
o.marginBottom = parseInt(o.sidebar.css('margin-bottom'));
o.paddingTop = parseInt(o.sidebar.css('padding-top'));
o.paddingBottom = parseInt(o.sidebar.css('padding-bottom'));
// Add a temporary padding rule to check for collapsable margins.
var collapsedTopHeight = o.stickySidebar.offset().top;
var collapsedBottomHeight = o.stickySidebar.outerHeight();
o.stickySidebar.css('padding-top', 1);
o.stickySidebar.css('padding-bottom', 1);
collapsedTopHeight -= o.stickySidebar.offset().top;
collapsedBottomHeight = o.stickySidebar.outerHeight() - collapsedBottomHeight - collapsedTopHeight;
if (collapsedTopHeight == 0) {
o.stickySidebar.css('padding-top', 0);
o.stickySidebarPaddingTop = 0;
}
else {
o.stickySidebarPaddingTop = 1;
}
if (collapsedBottomHeight == 0) {
o.stickySidebar.css('padding-bottom', 0);
o.stickySidebarPaddingBottom = 0;
}
else {
o.stickySidebarPaddingBottom = 1;
}
// We use this to know whether the user is scrolling up or down.
o.previousScrollTop = null;
// Scroll top (value) when the sidebar has fixed position.
o.fixedScrollTop = 0;
// Set sidebar to default values.
resetSidebar();
o.onScroll = function (o) {
// Stop if the sidebar isn't visible.
if (!o.stickySidebar.is(":visible")) {
return;
}
// Stop if the window is too small.
if ($('body').width() < o.options.minWidth) {
resetSidebar();
return;
}
// Stop if the sidebar width is larger than the container width (e.g. the theme is responsive and the sidebar is now below the content)
if (o.options.disableOnResponsiveLayouts) {
var sidebarWidth = o.sidebar.outerWidth(o.sidebar.css('float') == 'none');
if (sidebarWidth + 50 > o.container.width()) {
resetSidebar();
return;
}
}
var scrollTop = $(document).scrollTop();
var position = 'static';
// If the user has scrolled down enough for the sidebar to be clipped at the top, then we can consider changing its position.
if (scrollTop >= o.sidebar.offset().top + (o.paddingTop - o.options.additionalMarginTop)) {
// The top and bottom offsets, used in various calculations.
var offsetTop = o.paddingTop + options.additionalMarginTop;
var offsetBottom = o.paddingBottom + o.marginBottom + options.additionalMarginBottom;
// All top and bottom positions are relative to the window, not to the parent elemnts.
var containerTop = o.sidebar.offset().top;
var containerBottom = o.sidebar.offset().top + getClearedHeight(o.container);
// The top and bottom offsets relative to the window screen top (zero) and bottom (window height).
var windowOffsetTop = 0 + options.additionalMarginTop;
var windowOffsetBottom;
var sidebarSmallerThanWindow = (o.stickySidebar.outerHeight() + offsetTop + offsetBottom) < $(window).height();
if (sidebarSmallerThanWindow) {
windowOffsetBottom = windowOffsetTop + o.stickySidebar.outerHeight();
}
else {
windowOffsetBottom = $(window).height() - o.marginBottom - o.paddingBottom - options.additionalMarginBottom;
}
var staticLimitTop = containerTop - scrollTop + o.paddingTop;
var staticLimitBottom = containerBottom - scrollTop - o.paddingBottom - o.marginBottom;
var top = o.stickySidebar.offset().top - scrollTop;
var scrollTopDiff = o.previousScrollTop - scrollTop;
// If the sidebar position is fixed, then it won't move up or down by itself. So, we manually adjust the top coordinate.
if (o.stickySidebar.css('position') == 'fixed') {
if (o.options.sidebarBehavior == 'modern') {
top += scrollTopDiff;
}
}
if (o.options.sidebarBehavior == 'stick-to-top') {
top = options.additionalMarginTop;
}
if (o.options.sidebarBehavior == 'stick-to-bottom') {
top = windowOffsetBottom - o.stickySidebar.outerHeight();
}
if (scrollTopDiff > 0) { // If the user is scrolling up.
top = Math.min(top, windowOffsetTop);
}
else { // If the user is scrolling down.
top = Math.max(top, windowOffsetBottom - o.stickySidebar.outerHeight());
}
top = Math.max(top, staticLimitTop);
top = Math.min(top, staticLimitBottom - o.stickySidebar.outerHeight());
// If the sidebar is the same height as the container, we won't use fixed positioning.
var sidebarSameHeightAsContainer = o.container.height() == o.stickySidebar.outerHeight();
if (!sidebarSameHeightAsContainer && top == windowOffsetTop) {
position = 'fixed';
}
else if (!sidebarSameHeightAsContainer && top == windowOffsetBottom - o.stickySidebar.outerHeight()) {
position = 'fixed';
}
else if (scrollTop + top - o.sidebar.offset().top - o.paddingTop <= options.additionalMarginTop) {
// Stuck to the top of the page. No special behavior.
position = 'static';
}
else {
// Stuck to the bottom of the page.
position = 'absolute';
}
}
/*
* Performance notice: It's OK to set these CSS values at each resize/scroll, even if they don't change.
* It's way slower to first check if the values have changed.
*/
if (position == 'fixed') {
var scrollLeft = $(document).scrollLeft();
o.stickySidebar.css({
'position': 'fixed',
'width': getWidthForObject(o.stickySidebar) + 'px',
'transform': 'translateY(' + top + 'px)',
'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left')) - scrollLeft) + 'px',
'top': '0px'
});
}
else if (position == 'absolute') {
var css = {};
if (o.stickySidebar.css('position') != 'absolute') {
css.position = 'absolute';
css.transform = 'translateY(' + (scrollTop + top - o.sidebar.offset().top - o.stickySidebarPaddingTop - o.stickySidebarPaddingBottom) + 'px)';
css.top = '0px';
}
css.width = getWidthForObject(o.stickySidebar) + 'px';
css.left = '';
o.stickySidebar.css(css);
}
else if (position == 'static') {
resetSidebar();
}
if (position != 'static') {
if (o.options.updateSidebarHeight == true) {
o.sidebar.css({
'min-height': o.stickySidebar.outerHeight() + o.stickySidebar.offset().top - o.sidebar.offset().top + o.paddingBottom
});
}
}
o.previousScrollTop = scrollTop;
};
// Initialize the sidebar's position.
o.onScroll(o);
// Recalculate the sidebar's position on every scroll and resize.
$(document).scroll(function (o) {
return function () {
o.onScroll(o);
};
}(o));
$(window).resize(function (o) {
return function () {
o.stickySidebar.css({'position': 'static'});
o.onScroll(o);
};
}(o));
// Reset the sidebar to its default state
function resetSidebar() {
o.fixedScrollTop = 0;
o.sidebar.css({
'min-height': '1px'
});
o.stickySidebar.css({
'position': 'static',
'width': '',
'transform': 'none'
});
}
// Get the height of a div as if its floated children were cleared. Note that this function fails if the floats are more than one level deep.
function getClearedHeight(e) {
var height = e.height();
e.children().each(function () {
height = Math.max(height, $(this).height());
});
return height;
}
});
}
function getWidthForObject(object) {
var width;
try {
width = object[0].getBoundingClientRect().width;
}
catch(err) {
}
if (typeof width === "undefined") {
width = object.width();
}
return width;
}
}
})(jQuery);
+767
View File
@@ -0,0 +1,767 @@
/*! Hugo版WebStack主题 - v2.0.0
* https://github.com/iplaycode/webstack-hugo/ */
var public_vars = public_vars || {};
jQuery.extend(public_vars, {
breakpoints: {
largescreen: [991, -1],
tabletscreen: [768, 990],
devicescreen: [420, 767],
sdevicescreen: [0, 419]
},
lastBreakpoint: null
});
/* Main Function that will be called each time when the screen breakpoint changes */
function resizable(breakpoint)
{
var sb_with_animation;
// Large Screen Specific Script
if(is('largescreen'))
{
}
// Tablet or larger screen
if(ismdxl())
{
}
// Tablet Screen Specific Script
if(is('tabletscreen'))
{
}
// Tablet device screen
if(is('tabletscreen'))
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
// Tablet Screen Specific Script
if(isxs())
{
}
// Trigger Event
jQuery(window).trigger('xenon.resize');
}
// Get current breakpoint
function get_current_breakpoint()
{
var width = jQuery(window).width(),
breakpoints = public_vars.breakpoints;
for(var breakpont_label in breakpoints)
{
var bp_arr = breakpoints[breakpont_label],
min = bp_arr[0],
max = bp_arr[1];
if(max == -1)
max = width;
if(min <= width && max >= width)
{
return breakpont_label;
}
}
return null;
}
// Check current screen breakpoint
function is(screen_label)
{
return get_current_breakpoint() == screen_label;
}
// Is xs device
function isxs()
{
return is('devicescreen') || is('sdevicescreen');
}
// Is md or xl
function ismdxl()
{
return is('tabletscreen') || is('largescreen');
}
// Trigger Resizable Function
function trigger_resizable()
{
if(public_vars.lastBreakpoint != get_current_breakpoint())
{
public_vars.lastBreakpoint = get_current_breakpoint();
resizable(public_vars.lastBreakpoint);
}
// Trigger Event (Repeated)
jQuery(window).trigger('xenon.resized');
}
;(function($, window, undefined)
{
"use strict";
$(document).ready(function()
{
// Chat Toggler
$('a[data-toggle="chat"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
public_vars.$body.toggleClass('chat-open');
if($.isFunction($.fn.perfectScrollbar))
{
setTimeout(function()
{
public_vars.$chat.find('.chat_inner').perfectScrollbar('update');
$(window).trigger('xenon.resize');
}, 1);
}
});
});
// Settings Pane Toggler
$('a[data-toggle="settings-pane"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
var use_animation = attrDefault($(el), 'animate', false) && ! isxs();
var scroll = {
top: $(document).scrollTop(),
toTop: 0
};
if(public_vars.$body.hasClass('settings-pane-open'))
{
scroll.toTop = scroll.top;
}
TweenMax.to(scroll, (use_animation ? .1 : 0), {top: scroll.toTop, roundProps: ['top'], ease: scroll.toTop < 10 ? null : Sine.easeOut, onUpdate: function()
{
$(window).scrollTop( scroll.top );
},
onComplete: function()
{
if(use_animation)
{
// With Animation
public_vars.$settingsPaneIn.addClass('with-animation');
// Opening
if( ! public_vars.$settingsPane.is(':visible'))
{
public_vars.$body.addClass('settings-pane-open');
var height = public_vars.$settingsPane.outerHeight(true);
public_vars.$settingsPane.css({
height: 0
});
TweenMax.to(public_vars.$settingsPane, .25, {css: {height: height}, ease: Circ.easeInOut, onComplete: function()
{
public_vars.$settingsPane.css({height: ''});
}});
public_vars.$settingsPaneIn.addClass('visible');
}
// Closing
else
{
public_vars.$settingsPaneIn.addClass('closing');
TweenMax.to(public_vars.$settingsPane, .25, {css: {height: 0}, delay: .15, ease: Power1.easeInOut, onComplete: function()
{
public_vars.$body.removeClass('settings-pane-open');
public_vars.$settingsPane.css({height: ''});
public_vars.$settingsPaneIn.removeClass('closing visible');
}});
}
}
else
{
// Without Animation
public_vars.$body.toggleClass('settings-pane-open');
public_vars.$settingsPaneIn.removeClass('visible');
public_vars.$settingsPaneIn.removeClass('with-animation');
}
}
});
});
});
// Sidebar Toggle
$('a[data-toggle="sidebar"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
if(public_vars.$sidebarMenu.hasClass('collapsed'))
{
public_vars.$sidebarMenu.removeClass('collapsed');
ps_init();
}
else
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
$(window).trigger('xenon.resize');
});
});
// Mobile Menu Trigger
$('a[data-toggle="mobile-menu"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass('mobile-is-visible');
if($("#main-menu").hasClass('mobile-is-visible') === true){
public_vars.$sidebarMenu.removeClass('collapsed');
$(".sidebar-menu-inner").css("max-height",window.innerHeight);
ps_init();
}
else{
ps_destroy();
}
});
// Mobile Menu Trigger for Horizontal Menu
$('a[data-toggle="mobile-menu-horizontal"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$horizontalMenu.toggleClass('mobile-is-visible');
});
// Mobile Menu Trigger for Sidebar & Horizontal Menu
$('a[data-toggle="mobile-menu-both"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$mainMenu.toggleClass('mobile-is-visible both-menus-visible');
public_vars.$horizontalMenu.toggleClass('mobile-is-visible both-menus-visible');
});
// Mobile User Info Menu Trigger
$('a[data-toggle="user-info-menu"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$userInfoMenu.toggleClass('mobile-is-visible');
});
// Mobile User Info Menu Trigger for Horizontal Menu
$('a[data-toggle="user-info-menu-horizontal"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$userInfoMenuHor.find('.nav.nav-userinfo').toggleClass('mobile-is-visible');
});
// Panel Close
$('body').on('click', '.panel a[data-toggle="remove"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel'),
$panel_parent = $panel.parent();
$panel.remove();
if($panel_parent.children().length == 0)
{
$panel_parent.remove();
}
});
// Panel Reload
$('body').on('click', '.panel a[data-toggle="reload"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel');
// This is just a simulation, nothing is going to be reloaded
$panel.append('<div class="panel-disabled"><div class="loader-1"></div></div>');
var $pd = $panel.find('.panel-disabled');
setTimeout(function()
{
$pd.fadeOut('fast', function()
{
$pd.remove();
});
}, 500 + 300 * (Math.random() * 5));
});
// Panel Expand/Collapse Toggle
$('body').on('click', '.panel a[data-toggle="panel"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel');
$panel.toggleClass('collapsed');
});
// Loading Text toggle
$('[data-loading-text]').each(function(i, el) // Temporary for demo purpose only
{
var $this = $(el);
$this.on('click', function(ev)
{
$this.button('loading');
setTimeout(function(){ $this.button('reset'); }, 1800);
});
});
// Popovers and tooltips
$('[data-toggle="popover"]').each(function(i, el)
{
var $this = $(el),
placement = attrDefault($this, 'placement', 'right'),
trigger = attrDefault($this, 'trigger', 'click'),
popover_class = $this.get(0).className.match(/(popover-[a-z0-9]+)/i);
$this.popover({
placement: placement,
trigger: trigger
});
if(popover_class)
{
$this.removeClass(popover_class[1]);
$this.on('show.bs.popover', function(ev)
{
setTimeout(function()
{
var $popover = $this.next();
$popover.addClass(popover_class[1]);
}, 0);
});
}
});
$('[data-toggle="tooltip"]').each(function(i, el)
{
var $this = $(el),
placement = attrDefault($this, 'placement', 'top'),
trigger = attrDefault($this, 'trigger', 'hover'),
tooltip_class = $this.get(0).className.match(/(tooltip-[a-z0-9]+)/i);
$this.tooltip({
placement: placement,
trigger: trigger
});
if(tooltip_class)
{
$this.removeClass(tooltip_class[1]);
$this.on('show.bs.tooltip', function(ev)
{
setTimeout(function()
{
var $tooltip = $this.next();
$tooltip.addClass(tooltip_class[1]);
}, 0);
});
}
});
});
})(jQuery, window);
/**
* Xenon Main
*
**/
var public_vars = public_vars || {};
;(function($, window, undefined){
"use strict";
$(document).ready(function()
{
// Main Vars
public_vars.$body = $("body");
public_vars.$pageContainer = public_vars.$body.find(".page-container");
public_vars.$chat = public_vars.$pageContainer.find("#chat");
public_vars.$sidebarMenu = public_vars.$pageContainer.find('.sidebar-menu');
public_vars.$sidebarProfile = public_vars.$sidebarMenu.find('.sidebar-user-info');
public_vars.$mainMenu = public_vars.$sidebarMenu.find('.main-menu');
public_vars.$horizontalNavbar = public_vars.$body.find('.navbar.horizontal-menu');
public_vars.$horizontalMenu = public_vars.$horizontalNavbar.find('.navbar-nav');
public_vars.$mainContent = public_vars.$pageContainer.find('.main-content');
public_vars.$mainFooter = public_vars.$body.find('footer.main-footer');
public_vars.$userInfoMenuHor = public_vars.$body.find('.navbar.horizontal-menu');
public_vars.$userInfoMenu = public_vars.$body.find('nav.navbar.user-info-navbar');
public_vars.$settingsPane = public_vars.$body.find('.settings-pane');
public_vars.$settingsPaneIn = public_vars.$settingsPane.find('.settings-pane-inner');
public_vars.wheelPropagation = true; // used in Main menu (sidebar)
public_vars.$pageLoadingOverlay = public_vars.$body.find('.page-loading-overlay');
public_vars.defaultColorsPalette = ['#68b828','#7c38bc','#0e62c7','#fcd036','#4fcdfc','#00b19d','#ff6264','#f7aa47'];
// Setup Sidebar Menu
setup_sidebar_menu();
// Setup Horizontal Menu
setup_horizontal_menu();
// Sticky Footer
if(public_vars.$mainFooter.hasClass('sticky'))
{
stickFooterToBottom();
$(window).on('xenon.resized', stickFooterToBottom);
}
// Perfect Scrollbar
if($.isFunction($.fn.perfectScrollbar))
{
if(public_vars.$sidebarMenu.hasClass('fixed'))
ps_init();
$(".ps-scrollbar").each(function(i, el)
{
var $el = $(el);
if($el.hasClass('ps-scroll-down'))
{
$el.scrollTop($el.prop('scrollHeight'));
}
$el.perfectScrollbar({
wheelPropagation: false
});
});
// Chat Scrollbar
var $chat_inner = public_vars.$pageContainer.find('#chat .chat-inner');
if($chat_inner.parent().hasClass('fixed'))
$chat_inner.css({maxHeight: $(window).height()}).perfectScrollbar();
// User info opening dropdown trigger PS update
$(".dropdown:has(.ps-scrollbar)").each(function(i, el)
{
var $scrollbar = $(this).find('.ps-scrollbar');
$(this).on('click', '[data-toggle="dropdown"]', function(ev)
{
ev.preventDefault();
setTimeout(function()
{
$scrollbar.perfectScrollbar('update');
}, 1);
});
});
// Scrollable
$("div.scrollable").each(function(i, el)
{
var $this = $(el),
max_height = parseInt(attrDefault($this, 'max-height', 200), 10);
max_height = max_height < 0 ? 200 : max_height;
$this.css({maxHeight: max_height}).perfectScrollbar({
wheelPropagation: true
});
});
}
// Go to top links
$('body').on('click', 'a[rel="go-top"]', function(ev)
{
ev.preventDefault();
var obj = {pos: $(window).scrollTop()};
TweenLite.to(obj, .3, {pos: 0, ease:Power4.easeOut, onUpdate: function()
{
$(window).scrollTop(obj.pos);
}});
});
// Auto hidden breadcrumbs
$(".breadcrumb.auto-hidden").each(function(i, el)
{
var $bc = $(el),
$as = $bc.find('li a'),
collapsed_width = $as.width(),
expanded_width = 0;
$as.each(function(i, el)
{
var $a = $(el);
expanded_width = $a.outerWidth(true) + 5;
$a.addClass('collapsed').width(expanded_width);
$a.hover(function()
{
$a.removeClass('collapsed');
},
function()
{
$a.addClass('collapsed');
});
});
});
});
// Enable/Disable Resizable Event
var wid = 0;
$(window).resize(function() {
clearTimeout(wid);
wid = setTimeout(trigger_resizable, 200);
});
})(jQuery, window);
// Sideber Menu Setup function
var sm_duration = .2,
sm_transition_delay = 150;
function setup_sidebar_menu()
{
if(public_vars.$sidebarMenu.length)
{
var $items_with_subs = public_vars.$sidebarMenu.find('li:has(> ul)'),
toggle_others = public_vars.$sidebarMenu.hasClass('toggle-others');
$items_with_subs.filter('.active').addClass('expanded');
// On larger screens collapse sidebar when the window is tablet screen
if(is('largescreen') && public_vars.$sidebarMenu.hasClass('collapsed') == false)
{
$(window).on('resize', function()
{
if(is('tabletscreen'))
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
else
if(is('largescreen'))
{
public_vars.$sidebarMenu.removeClass('collapsed');
ps_init();
}
});
}
$items_with_subs.each(function(i, el)
{
var $li = jQuery(el),
$a = $li.children('a'),
$sub = $li.children('ul');
$li.addClass('has-sub');
$a.on('click', function(ev)
{
ev.preventDefault();
if(toggle_others)
{
sidebar_menu_close_items_siblings($li);
}
if($li.hasClass('expanded') || $li.hasClass('opened'))
sidebar_menu_item_collapse($li, $sub);
else
sidebar_menu_item_expand($li, $sub);
});
});
}
}
function sidebar_menu_item_expand($li, $sub)
{
/* 修复左侧栏不展开时点击图标显示异常 - shenweiyan.2022.09.30 - start
if($li.data('is-busy') || ($li.parent('.main-menu').length && public_vars.$sidebarMenu.hasClass('collapsed')))
return;
$li.addClass('expanded').data('is-busy', true);
$sub.show();
var $sub_items = $sub.children(),
sub_height = $sub.outerHeight(),
win_y = jQuery(window).height(),
total_height = $li.outerHeight(),
current_y = public_vars.$sidebarMenu.scrollTop(),
item_max_y = $li.position().top + current_y,
fit_to_viewpport = public_vars.$sidebarMenu.hasClass('fit-in-viewport');
$sub_items.addClass('is-hidden');
$sub.height(0);
TweenMax.to($sub, sm_duration, {css: {height: sub_height}, onUpdate: ps_update, onComplete: function(){
$sub.height('');
}});
var interval_1 = $li.data('sub_i_1'),
interval_2 = $li.data('sub_i_2');
window.clearTimeout(interval_1);
interval_1 = setTimeout(function()
{
$sub_items.each(function(i, el)
{
var $sub_item = jQuery(el);
$sub_item.addClass('is-shown');
});
var finish_on = sm_transition_delay * $sub_items.length,
t_duration = parseFloat($sub_items.eq(0).css('transition-duration')),
t_delay = parseFloat($sub_items.last().css('transition-delay'));
if(t_duration && t_delay)
{
finish_on = (t_duration + t_delay) * 1000;
}
// In the end
window.clearTimeout(interval_2);
interval_2 = setTimeout(function()
{
$sub_items.removeClass('is-hidden is-shown');
}, finish_on);
$li.data('is-busy', false);
}, 0);
$li.data('sub_i_1', interval_1),
$li.data('sub_i_2', interval_2);
// 修复左侧栏不展开时点击图标显示异常 - shenweiyan.2022.09.30 - end
*/
}
function sidebar_menu_item_collapse($li, $sub)
{
if($li.data('is-busy'))
return;
var $sub_items = $sub.children();
$li.removeClass('expanded').data('is-busy', true);
$sub_items.addClass('hidden-item');
TweenMax.to($sub, sm_duration, {css: {height: 0}, onUpdate: ps_update, onComplete: function()
{
$li.data('is-busy', false).removeClass('opened');
$sub.attr('style', '').hide();
$sub_items.removeClass('hidden-item');
$li.find('li.expanded ul').attr('style', '').hide().parent().removeClass('expanded');
ps_update(true);
}});
}
function sidebar_menu_close_items_siblings($li)
{
$li.siblings().not($li).filter('.expanded, .opened').each(function(i, el)
{
var $_li = jQuery(el),
$_sub = $_li.children('ul');
sidebar_menu_item_collapse($_li, $_sub);
});
}
// Horizontal Menu
function setup_horizontal_menu()
{
if(public_vars.$horizontalMenu.length)
{
var $items_with_subs = public_vars.$horizontalMenu.find('li:has(> ul)'),
click_to_expand = public_vars.$horizontalMenu.hasClass('click-to-expand');
if(click_to_expand)
{
public_vars.$mainContent.add( public_vars.$sidebarMenu ).on('click', function(ev)
{
$items_with_subs.removeClass('hover');
});
}
$items_with_subs.each(function(i, el)
{
var $li = jQuery(el),
$a = $li.children('a'),
$sub = $li.children('ul'),
is_root_element = $li.parent().is('.navbar-nav');
$li.addClass('has-sub');
// Mobile Only
$a.on('click', function(ev)
{
if(isxs())
{
ev.preventDefault();
// Automatically will toggle other menu items in mobile view
if(true)
{
sidebar_menu_close_items_siblings($li);
}
if($li.hasClass('expanded') || $li.hasClass('opened'))
sidebar_menu_item_collapse($li, $sub);
else
sidebar_menu_item_expand($li, $sub);
}
});
// Click To Expand
if(click_to_expand)
{
$a.on('click', function(ev)
{
ev.preventDefault();
if(isxs())
return;
// For parents only
if(is_root_element)
{
$items_with_subs.filter(function(i, el){ return jQuery(el).parent().is('.navbar-nav'); }).not($li).removeClass('hover');
$li.toggleClass('hover');
}
// Sub menus
else
{
var sub_height;
// To Expand
if($li.hasClass('expanded') == false)
{
$li.addClass('expanded');
$sub.addClass('is-visible');
sub_height = $sub.outerHeight();
$sub.height(0);
TweenLite.to($sub, .15, {css: {height: sub_height}, ease: Sine.easeInOut, onComplete: function(){ $sub.attr('style', ''); }});
// Hide Existing in the list
$li.siblings().find('> ul.is-visible').not($sub).each(function(i, el)
{
var $el = jQuery(el);
sub_height = $el.outerHeight();
$el.removeClass('is-visible').height(sub_height);
$el.parent().removeClass('expanded');
TweenLite.to($el, .15, {css: {height: 0}, onComplete: function(){ $el.attr('style', ''); }});
});
}
// To Collapse
else
{
sub_height = $sub.outerHeight();
$li.removeClass('expanded');
$sub.removeClass('is-visible').height(sub_height);
TweenLite.to($sub, .15, {css: {height: 0}, onComplete: function(){ $sub.attr('style', ''); }});
}
}
});
}
// Hover To Expand
else
{
$li.hoverIntent({
over: function()
{
if(isxs())
return;
if(is_root_element)
{
$li.addClass('hover');
}
else
{
$sub.addClass('is-visible');
sub_height = $sub.outerHeight();
$sub.height(0);
TweenLite.to($sub, .25, {css: {height: sub_height}, ease: Sine.easeInOut, onComplete: function(){ $sub.attr('style', ''); }});
}
},
out: function()
{
if(isxs())
return;
if(is_root_element)
{
$li.removeClass('hover');
}
else
{
sub_height = $sub.outerHeight();
$li.removeClass('expanded');
$sub.removeClass('is-visible').height(sub_height);
TweenLite.to($sub, .25, {css: {height: 0}, onComplete: function(){ $sub.attr('style', ''); }});
}
},
timeout: 200,
interval: is_root_element ? 10 : 100
});
}
});
}
}
function stickFooterToBottom()
{
public_vars.$mainFooter.add( public_vars.$mainContent ).add( public_vars.$sidebarMenu ).attr('style', '');
if(isxs())
return false;
if(public_vars.$mainFooter.hasClass('sticky'))
{
var win_height = jQuery(window).height(),
footer_height = public_vars.$mainFooter.outerHeight(true),
main_content_height = public_vars.$mainFooter.position().top + footer_height,
main_content_height_only = main_content_height - footer_height,
extra_height = public_vars.$horizontalNavbar.outerHeight();
if(win_height > main_content_height - parseInt(public_vars.$mainFooter.css('marginTop'), 10))
{
public_vars.$mainFooter.css({
marginTop: win_height - main_content_height - extra_height
});
}
}
}
// Perfect scroll bar functions by Arlind Nushi
function ps_update(destroy_init)
{
//if(isxs())
// return;
if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
{
if(public_vars.$sidebarMenu.hasClass('collapsed'))
{
return;
}
public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar('update');
if(destroy_init)
{
ps_destroy();
ps_init();
}
}
}
function ps_init()
{
//if(isxs())
// return;
if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
{
if(public_vars.$sidebarMenu.hasClass('collapsed') || ! public_vars.$sidebarMenu.hasClass('fixed'))
{
return;
}
public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar({
wheelSpeed: 1,
wheelPropagation: public_vars.wheelPropagation
});
}
}
function ps_destroy()
{
if(jQuery.isFunction(jQuery.fn.perfectScrollbar))
{
public_vars.$sidebarMenu.find('.sidebar-menu-inner').perfectScrollbar('destroy');
}
}
// Element Attribute Helper
function attrDefault($el, data_var, default_val)
{
if(typeof $el.data(data_var) != 'undefined')
{
return $el.data(data_var);
}
return default_val;
}
+91
View File
@@ -0,0 +1,91 @@
/**
* Xenon API Functions
*
* Theme by: www.laborator.co
**/
function rtl() // checks whether the content is in RTL mode
{
if(typeof window.isRTL == 'boolean')
return window.isRTL;
window.isRTL = jQuery("html").get(0).dir == 'rtl' ? true : false;
return window.isRTL;
}
// Page Loader
function show_loading_bar(options)
{
var defaults = {
pct: 0,
delay: 1.3,
wait: 0,
before: function(){},
finish: function(){},
resetOnEnd: true
};
if(typeof options == 'object')
defaults = jQuery.extend(defaults, options);
else
if(typeof options == 'number')
defaults.pct = options;
if(defaults.pct > 100)
defaults.pct = 100;
else
if(defaults.pct < 0)
defaults.pct = 0;
var $ = jQuery,
$loading_bar = $(".xenon-loading-bar");
if($loading_bar.length == 0)
{
$loading_bar = $('<div class="xenon-loading-bar progress-is-hidden"><span data-pct="0"></span></div>');
public_vars.$body.append( $loading_bar );
}
var $pct = $loading_bar.find('span'),
current_pct = $pct.data('pct'),
is_regress = current_pct > defaults.pct;
defaults.before(current_pct);
TweenMax.to($pct, defaults.delay, {css: {width: defaults.pct + '%'}, delay: defaults.wait, ease: is_regress ? Expo.easeOut : Expo.easeIn,
onStart: function()
{
$loading_bar.removeClass('progress-is-hidden');
},
onComplete: function()
{
var pct = $pct.data('pct');
if(pct == 100 && defaults.resetOnEnd)
{
hide_loading_bar();
}
defaults.finish(pct);
},
onUpdate: function()
{
$pct.data('pct', parseInt($pct.get(0).style.width, 10));
}});
}
function hide_loading_bar()
{
var $ = jQuery,
$loading_bar = $(".xenon-loading-bar"),
$pct = $loading_bar.find('span');
$loading_bar.addClass('progress-is-hidden');
$pct.width(0).data('pct', 0);
}
File diff suppressed because it is too large Load Diff
+321
View File
@@ -0,0 +1,321 @@
/**
* Toggles
*
* Non-animation
*/
;(function($, window, undefined)
{
"use strict";
$(document).ready(function()
{
// Chat Toggler
$('a[data-toggle="chat"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
public_vars.$body.toggleClass('chat-open');
if($.isFunction($.fn.perfectScrollbar))
{
setTimeout(function()
{
public_vars.$chat.find('.chat_inner').perfectScrollbar('update');
$(window).trigger('xenon.resize');
}, 1);
}
});
});
// Settings Pane Toggler
$('a[data-toggle="settings-pane"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
var use_animation = attrDefault($(el), 'animate', false) && ! isxs();
var scroll = {
top: $(document).scrollTop(),
toTop: 0
};
if(public_vars.$body.hasClass('settings-pane-open'))
{
scroll.toTop = scroll.top;
}
TweenMax.to(scroll, (use_animation ? .1 : 0), {top: scroll.toTop, roundProps: ['top'], ease: scroll.toTop < 10 ? null : Sine.easeOut, onUpdate: function()
{
$(window).scrollTop( scroll.top );
},
onComplete: function()
{
if(use_animation)
{
// With Animation
public_vars.$settingsPaneIn.addClass('with-animation');
// Opening
if( ! public_vars.$settingsPane.is(':visible'))
{
public_vars.$body.addClass('settings-pane-open');
var height = public_vars.$settingsPane.outerHeight(true);
public_vars.$settingsPane.css({
height: 0
});
TweenMax.to(public_vars.$settingsPane, .25, {css: {height: height}, ease: Circ.easeInOut, onComplete: function()
{
public_vars.$settingsPane.css({height: ''});
}});
public_vars.$settingsPaneIn.addClass('visible');
}
// Closing
else
{
public_vars.$settingsPaneIn.addClass('closing');
TweenMax.to(public_vars.$settingsPane, .25, {css: {height: 0}, delay: .15, ease: Power1.easeInOut, onComplete: function()
{
public_vars.$body.removeClass('settings-pane-open');
public_vars.$settingsPane.css({height: ''});
public_vars.$settingsPaneIn.removeClass('closing visible');
}});
}
}
else
{
// Without Animation
public_vars.$body.toggleClass('settings-pane-open');
public_vars.$settingsPaneIn.removeClass('visible');
public_vars.$settingsPaneIn.removeClass('with-animation');
}
}
});
});
});
// Sidebar Toggle
$('a[data-toggle="sidebar"]').each(function(i, el)
{
$(el).on('click', function(ev)
{
ev.preventDefault();
if(public_vars.$sidebarMenu.hasClass('collapsed'))
{
public_vars.$sidebarMenu.removeClass('collapsed');
ps_init();
}
else
{
public_vars.$sidebarMenu.addClass('collapsed');
ps_destroy();
}
$(window).trigger('xenon.resize');
});
});
// Mobile Menu Trigger
$('a[data-toggle="mobile-menu"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass('mobile-is-visible');
ps_destroy();
});
// Mobile Menu Trigger for Horizontal Menu
$('a[data-toggle="mobile-menu-horizontal"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$horizontalMenu.toggleClass('mobile-is-visible');
});
// Mobile Menu Trigger for Sidebar & Horizontal Menu
$('a[data-toggle="mobile-menu-both"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$mainMenu.toggleClass('mobile-is-visible both-menus-visible');
public_vars.$horizontalMenu.toggleClass('mobile-is-visible both-menus-visible');
});
// Mobile User Info Menu Trigger
$('a[data-toggle="user-info-menu"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$userInfoMenu.toggleClass('mobile-is-visible');
});
// Mobile User Info Menu Trigger for Horizontal Menu
$('a[data-toggle="user-info-menu-horizontal"]').on('click', function(ev)
{
ev.preventDefault();
public_vars.$userInfoMenuHor.find('.nav.nav-userinfo').toggleClass('mobile-is-visible');
});
// Panel Close
$('body').on('click', '.panel a[data-toggle="remove"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel'),
$panel_parent = $panel.parent();
$panel.remove();
if($panel_parent.children().length == 0)
{
$panel_parent.remove();
}
});
// Panel Reload
$('body').on('click', '.panel a[data-toggle="reload"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel');
// This is just a simulation, nothing is going to be reloaded
$panel.append('<div class="panel-disabled"><div class="loader-1"></div></div>');
var $pd = $panel.find('.panel-disabled');
setTimeout(function()
{
$pd.fadeOut('fast', function()
{
$pd.remove();
});
}, 500 + 300 * (Math.random() * 5));
});
// Panel Expand/Collapse Toggle
$('body').on('click', '.panel a[data-toggle="panel"]', function(ev)
{
ev.preventDefault();
var $panel = $(this).closest('.panel');
$panel.toggleClass('collapsed');
});
// Loading Text toggle
$('[data-loading-text]').each(function(i, el) // Temporary for demo purpose only
{
var $this = $(el);
$this.on('click', function(ev)
{
$this.button('loading');
setTimeout(function(){ $this.button('reset'); }, 1800);
});
});
// Popovers and tooltips
$('[data-toggle="popover"]').each(function(i, el)
{
var $this = $(el),
placement = attrDefault($this, 'placement', 'right'),
trigger = attrDefault($this, 'trigger', 'click'),
popover_class = $this.get(0).className.match(/(popover-[a-z0-9]+)/i);
$this.popover({
placement: placement,
trigger: trigger
});
if(popover_class)
{
$this.removeClass(popover_class[1]);
$this.on('show.bs.popover', function(ev)
{
setTimeout(function()
{
var $popover = $this.next();
$popover.addClass(popover_class[1]);
}, 0);
});
}
});
$('[data-toggle="tooltip"]').each(function(i, el)
{
var $this = $(el),
placement = attrDefault($this, 'placement', 'top'),
trigger = attrDefault($this, 'trigger', 'hover'),
tooltip_class = $this.get(0).className.match(/(tooltip-[a-z0-9]+)/i);
$this.tooltip({
placement: placement,
trigger: trigger
});
if(tooltip_class)
{
$this.removeClass(tooltip_class[1]);
$this.on('show.bs.tooltip', function(ev)
{
setTimeout(function()
{
var $tooltip = $this.next();
$tooltip.addClass(tooltip_class[1]);
}, 0);
});
}
});
});
})(jQuery, window);