mirror of
https://github.com/LyLme/lylme_spage.git
synced 2024-11-17 14:34:08 +08:00
增加主题 DashLite
This commit is contained in:
parent
b9bcc00a21
commit
32f783db00
10922
template/dashlite/css/dashlite.css
Normal file
10922
template/dashlite/css/dashlite.css
Normal file
File diff suppressed because it is too large
Load Diff
145
template/dashlite/css/style.css
Normal file
145
template/dashlite/css/style.css
Normal file
@ -0,0 +1,145 @@
|
||||
body,.btn,h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
|
||||
font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Arial,sans-serif;
|
||||
}
|
||||
.nk-header {
|
||||
border-bottom:0px solid #e5e9f2;
|
||||
box-shadow:0 0 #0000,0 0 #0000,0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -2px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.nk-ibx-action { position: relative; padding: 1rem 1.5rem; border-bottom: 1px solid #e5e9f2; }
|
||||
.nk-ibx-action-list { display: flex; justify-content: space-between; align-items: center; }
|
||||
.nk-ibx-action-item a { display: flex; align-items: center; }
|
||||
.nk-ibx-action-item .icon { font-size: 1.5rem; }
|
||||
.nk-ibx-action-item .icon + span { margin-left: 0.5rem; }
|
||||
|
||||
.dark-switch.active .ni-moon {
|
||||
display:none;
|
||||
}
|
||||
.dark-switch.active .ni-sun {
|
||||
display:inline !important;
|
||||
}
|
||||
.dark-switch:after {
|
||||
height:0rem;
|
||||
width:0rem;
|
||||
right:0;
|
||||
background-color:#dbdfea00;
|
||||
}
|
||||
.dark-switch:before {
|
||||
right:0;
|
||||
width:0rem;
|
||||
height:0rem;
|
||||
background-color:rgba(255,255,255,0);
|
||||
border:#dbdfea solid 0px;
|
||||
}
|
||||
.card-preview {
|
||||
box-shadow:6px 5px 40px rgba(30,48,75,.08);
|
||||
}
|
||||
.form-control-lx {
|
||||
height:calc(3.625rem + 2px);
|
||||
padding:0.6875rem 2rem;
|
||||
font-size:0.9375rem;
|
||||
line-height:1.25rem;
|
||||
border-radius:5px;
|
||||
}
|
||||
.form-clip-lx,.form-text-hint-lx {
|
||||
position:absolute;
|
||||
right:22px;
|
||||
top:6px;
|
||||
height:calc(3.125rem - 2px);
|
||||
display:flex;
|
||||
align-items:center;
|
||||
color:#6576ff;
|
||||
padding-left:1rem;
|
||||
padding-right:.75rem;
|
||||
background:#fff;
|
||||
border-radius:4px;
|
||||
}
|
||||
.dark-mode .form-text-hint-lx {
|
||||
background:#141c26;
|
||||
}
|
||||
.dark-mode .bannerbg { opacity: 0.4; }
|
||||
.form-text-hint-lx .overline-title {
|
||||
font-size:24px;
|
||||
}
|
||||
.form-control-lx.btn-round {
|
||||
border-radius:2.125rem;
|
||||
}
|
||||
.breadcrumb-item.active:not(:only-child) {
|
||||
font-weight:700;
|
||||
}
|
||||
.breadcrumb-item.active a {
|
||||
color:#086cf0 !important;
|
||||
}
|
||||
.nya-title {
|
||||
position:absolute;
|
||||
top:-15px;
|
||||
background-color:#6576ff;
|
||||
color:#fff;
|
||||
padding:5px 18px;
|
||||
border-radius:8px;
|
||||
font-size:1.0rem;
|
||||
box-shadow: 0 0.5rem 0.625rem #6576ff57;
|
||||
}
|
||||
.dark-mode .nya-title{background-color: #313c93;}
|
||||
.search-placeholder {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
width: 100%;
|
||||
color: #aaa;
|
||||
}
|
||||
.card + .card {
|
||||
margin-top:40px;
|
||||
}
|
||||
.btn-block {
|
||||
white-space:nowrap;
|
||||
text-overflow:ellipsis;
|
||||
overflow:hidden;
|
||||
box-shadow:0 3px 12px 1px rgba(43,55,72,0.15) !important;
|
||||
}
|
||||
.logo-link {
|
||||
font-weight:700;
|
||||
font-size:21px;
|
||||
position:inherit;
|
||||
}
|
||||
.logo-link img {
|
||||
height: 35px;
|
||||
margin: -3px 8px 0 5px;
|
||||
}
|
||||
.center-block {margin: 0 auto; float: none; padding: 0;}
|
||||
.nk-footer-wrap {display: block;}
|
||||
.nk-footer-copyright {text-align: center;}
|
||||
#link_content {margin-top: 40px;}
|
||||
.nk-ibx-action-item .fa { font-size: 1.2rem; }
|
||||
.nk-ibx-action-item .fa + span { margin-left: 0.5rem; }
|
||||
* ::-webkit-scrollbar {
|
||||
width: .375rem;
|
||||
height: .5rem
|
||||
}
|
||||
* ::-webkit-scrollbar-thumb {
|
||||
background-color: #6576ff;
|
||||
border-radius: 6249.9375rem
|
||||
}
|
||||
img.loginbtn{width: 66px;margin: 16px;}
|
||||
.nk-reply-item{padding:0}
|
||||
.nk-reply-item + .nk-reply-item{margin-top:10px;padding-top:12px;border-top:1px solid #e5e9f2;}
|
||||
.custom-control-input{width: 2.4rem;}
|
||||
.custom-control-sm>.custom-control-input{width: 1.6rem;}
|
||||
|
||||
.query-title {
|
||||
background-color:#f5fafe;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.query-result{
|
||||
word-break: break-all;
|
||||
}
|
||||
.table-title {
|
||||
background-color:#f5fafe;
|
||||
}
|
||||
.dark-mode .query-title{background-color:#273b5f;}
|
||||
.dark-mode .table-title{background-color:#273b5f;}
|
||||
.nya-title>svg,.nya-title>img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
BIN
template/dashlite/fonts/Nioicon.eot
Normal file
BIN
template/dashlite/fonts/Nioicon.eot
Normal file
Binary file not shown.
BIN
template/dashlite/fonts/Nioicon.ttf
Normal file
BIN
template/dashlite/fonts/Nioicon.ttf
Normal file
Binary file not shown.
BIN
template/dashlite/fonts/Nioicon.woff
Normal file
BIN
template/dashlite/fonts/Nioicon.woff
Normal file
Binary file not shown.
296
template/dashlite/index.php
Normal file
296
template/dashlite/index.php
Normal file
@ -0,0 +1,296 @@
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title><?php echo $conf['title']?></title>
|
||||
<meta name="keywords" content="<?php echo $conf['keywords']?>" />
|
||||
<meta name="description" content="<?php echo $conf['description']?>" />
|
||||
<link rel="stylesheet" href="<?php echo $templatepath;?>/css/dashlite.css">
|
||||
<link rel="stylesheet" href="<?php echo $templatepath;?>/css/style.css?v=1002">
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/layer/3.5.1/theme/default/layer.css?v=3.5.1" id="layuicss-layer">
|
||||
</head>
|
||||
<body class="nk-body npc-invest bg-lighter no-touch nk-nio-theme">
|
||||
<!-- wrap @s -->
|
||||
<div class="nk-wrap ">
|
||||
<!-- main header @s -->
|
||||
<div class="nk-header nk-header-fluid nk-header-fixed is-light">
|
||||
<div class="container-xl">
|
||||
<div class="nk-header-wrap link-between">
|
||||
<div class="nk-menu-trigger mr-sm-2 d-lg-none">
|
||||
<a href="#" class="nk-nav-toggle nk-quick-nav-icon" data-target="headerNav"><em class="icon ni ni-menu"></em></a>
|
||||
</div>
|
||||
<div class="nk-header-brand">
|
||||
<a href="/" class="logo-link text-base"><img src="<?php echo $conf['logo']?>" class="hide-mb-sm"><?php echo explode("-", $conf['title'])[0]; ?></a>
|
||||
</div>
|
||||
<!-- .nk-header-brand -->
|
||||
<div class="nk-header-tools nk-header-menu mobile-menu" data-content="headerNav">
|
||||
<div class="nk-header-mobile">
|
||||
<div class="nk-header-brand">
|
||||
<a href="/" class="logo-link text-base">
|
||||
<span class="nio-version" style="font-size: 21px;position: inherit;"><?php echo explode("-", $conf['title'])[0]; ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="nk-menu-trigger mr-n2">
|
||||
<a href="#" class="nk-nav-toggle nk-quick-nav-icon" data-target="headerNav"><em class="icon ni ni-arrow-left"></em></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Menu -->
|
||||
<ul class="nk-menu nk-menu-main">
|
||||
<li class="nk-menu-item active">
|
||||
<a href="/" class="nk-menu-link nk-ibx-action-item" data-original-title="" title="">
|
||||
<!-- <em class="icon ni ni-home"></em> -->
|
||||
<span class="nk-menu-text">首页</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
//输出导航菜单
|
||||
$tagslists = $site->getTags();
|
||||
while ($taglists = $DB->fetch($tagslists)) {
|
||||
|
||||
echo '
|
||||
<li class="nk-menu-item">
|
||||
<a href="' . $taglists["tag_link"] . '" class="nk-menu-link nk-ibx-action-item" data-original-title="" title=""';
|
||||
if ($taglists["tag_target"] == 1) {
|
||||
echo ' target="_blank"';
|
||||
}
|
||||
echo '>
|
||||
<!-- <em class="icon ni ni-home"></em>-->
|
||||
<span class="nk-menu-text">' . $taglists["tag_name"] . '</span>
|
||||
</a>
|
||||
</li>';
|
||||
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- .nk-header-menu -->
|
||||
<div class="no-gutters">
|
||||
<ul class="nk-quick-nav">
|
||||
<li class="dropdown">
|
||||
<a href="javascript:;" class="progress-rating dark-switch">
|
||||
<span class="nk-menu-icon">
|
||||
<em class="icon ni ni-moon"></em>
|
||||
<em class="icon ni ni-sun d-none"></em>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- .dropdown -->
|
||||
</ul>
|
||||
<!-- .nk-quick-nav -->
|
||||
</div>
|
||||
<!-- .nk-header-tools -->
|
||||
</div>
|
||||
<!-- .nk-header-wrap -->
|
||||
</div>
|
||||
<!-- .container-fliud -->
|
||||
</div>
|
||||
<!-- main header @e -->
|
||||
<!-- content @s -->
|
||||
|
||||
<div class="nk-content nk-content-lg nk-content-fluid pt-5 pb-5 bannerbg">
|
||||
<div class="container-xl">
|
||||
<div class="form-control-wrap circle">
|
||||
<div class="form-text-hint-lx">
|
||||
<span class="overline-title"><em class="icon ni ni-search"></em></span>
|
||||
</div>
|
||||
<form action="https://www.baidu.com/s?wd=" method="get" target="_blank">
|
||||
<input type="text" class="form-control form-control-lx btn-round" name="word" id="searchkw" placeholder="搜索" autocomplete="off">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @s -->
|
||||
<div class="nk-content nk-content-fluid p-0">
|
||||
<div class="nk-block">
|
||||
<div class="card">
|
||||
<div class="card-inner p-2">
|
||||
<div class="container-xl">
|
||||
<nav>
|
||||
<ul class="breadcrumb breadcrumb-pipe">
|
||||
<li class="breadcrumb-item fs-16px category-all active"><a href="javascript:show_tool_list(0)">全部</a></li>
|
||||
<?php
|
||||
$groups = $site->getGroups(); // 获取分类
|
||||
while ($group = $DB->fetch($groups)) { //循环所有分组
|
||||
echo ' <li class="breadcrumb-item fs-16px category-item" data-id="' . $group["group_id"] . '"><a href="javascript:show_tool_list(' . $group["group_id"] . ')">' . $group["group_name"] . '</a></li>
|
||||
' . "\n";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content @s -->
|
||||
<div class="nk-content nk-content-lg nk-content-fluid">
|
||||
<div class="container-xl">
|
||||
<div class="nk-content-body">
|
||||
<div id="toollist">
|
||||
<?php require_once("list.php");?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- content @d -->
|
||||
<div class="nk-footer nk-footer-fluid bg-lighter">
|
||||
<div class="container-xl">
|
||||
<div class="nk-footer-wrap">
|
||||
<?php if(!empty($conf['wztj'])) {
|
||||
echo '<p>' . $conf["wztj"] . '</p>';
|
||||
}
|
||||
?>
|
||||
<div class="nk-footer-copyright">
|
||||
<?php if(!empty($conf['icp'])) {
|
||||
echo '<p><img src="./assets/img/icp.png" width="16px" height="16px" /><a href="http://beian.miit.gov.cn/" rel="nofollow" class="icp nav-link" target="_blank" _mstmutation="1" _istranslated="1">' . $conf['icp'] . '</a></p>';
|
||||
}
|
||||
?>
|
||||
<?php echo $conf['copyright']?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- footer @e -->
|
||||
</div>
|
||||
<!-- wrap @e -->
|
||||
<script src="http://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="http://cdn.staticfile.org/bootstrap/4.6.1/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="http://cdn.staticfile.org/layer/3.5.1/layer.js"></script>
|
||||
<script src="<?php echo $templatepath;?>/js/nioapp.min.js"></script>
|
||||
<script src="<?php echo $templatepath;?>/js/script.js?v=1001"></script>
|
||||
<script src="<?php echo $templatepath;?>/js/common.js?v=1002"></script>
|
||||
<script src="<?php echo $cdnpublic ?>/assets/js/svg.js"></script>
|
||||
|
||||
<script>
|
||||
var tool_list = <?php echo(json_encode(listjson()))?>;
|
||||
var tools = [];
|
||||
var searchkw = '';
|
||||
function show_category_btn(catid){
|
||||
if(catid == 0){
|
||||
$("#link_content").show();
|
||||
$(".category-all").addClass("active");
|
||||
$(".category-item").removeClass("active");
|
||||
}else{
|
||||
$("#link_content").hide();
|
||||
$(".category-all").removeClass("active");
|
||||
$(".category-item").removeClass("active");
|
||||
$.each($(".category-item"), function(index,value){
|
||||
if($(value).attr('data-id') == catid){
|
||||
$(value).addClass("active");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function show_tool_list(catid){
|
||||
searchkw = '';$("#searchkw").val('');
|
||||
show_category_btn(catid);
|
||||
tools = [];
|
||||
var html = '';
|
||||
$.each(tool_list, function(index, value){
|
||||
if(catid!=0 && value.id!=catid) return;
|
||||
html += `
|
||||
<div class="card card-preview category-card" data-category-id="${value.id}">
|
||||
<div class="card-inner mt-3">
|
||||
<div class="nya-title nk-ibx-action-item progress-rating">
|
||||
<!-- ${value.icon} -->
|
||||
<span class="nk-menu-text font-weight-bold">${value.title}</span>
|
||||
</div>
|
||||
<div class="row g-2">`;
|
||||
$.each(value.items, function(index, value){
|
||||
tools.push(value);
|
||||
html += `
|
||||
<div class="col-lg-3 col-md-4 col-6">
|
||||
<a href="${value.url}" data-id="${value.id}" class="btn btn-wider btn-block btn-xl btn-outline-light tool-link" ${value.out?'target="_blank"':''}>${value.title}</a>
|
||||
</div>`
|
||||
})
|
||||
html += `
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
$("#toollist").html(html);
|
||||
bind_statistics();
|
||||
}
|
||||
function show_search_list(){
|
||||
var list = tools.filter(v => {
|
||||
return v.title.indexOf(searchkw) !== -1 || v.keyword!=null && v.keyword.indexOf(searchkw) !== -1
|
||||
})
|
||||
var html = '';
|
||||
html += `
|
||||
<div class="card card-preview category-card">
|
||||
<div class="card-inner mt-3">
|
||||
<div class="nya-title nk-ibx-action-item progress-rating">
|
||||
<em class="icon ni ni-search"></em>
|
||||
<span class="nk-menu-text font-weight-bold">搜索结果</span>
|
||||
</div>
|
||||
<div class="row g-2">`;
|
||||
if(list.length>0){
|
||||
$.each(list, function(index, value){
|
||||
html += `
|
||||
<div class="col-lg-3 col-md-4 col-6">
|
||||
<a href="${value.url}" data-id="${value.id}" class="btn btn-wider btn-block btn-xl btn-outline-light tool-link" ${value.out?'target="_blank"':''}>${value.title}</a>
|
||||
</div>`
|
||||
})
|
||||
}else{
|
||||
html += `<p class="search-placeholder">暂无搜索结果</p>`
|
||||
}
|
||||
html += `
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$("#toollist").html(html);
|
||||
bind_statistics();
|
||||
$("#link_content").hide();
|
||||
$(".category-all").removeClass("active");
|
||||
$(".category-item").removeClass("active");
|
||||
}
|
||||
function watch_searchkw(kw){
|
||||
if(kw != searchkw){
|
||||
searchkw = kw;
|
||||
if(searchkw == ''){
|
||||
show_tool_list(0)
|
||||
}else{
|
||||
show_search_list()
|
||||
}
|
||||
}
|
||||
}
|
||||
function bind_statistics(){
|
||||
$(".tool-link").click(function(){
|
||||
var id = $(this).attr('data-id');
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "/clitool",
|
||||
data : {id: id},
|
||||
dataType : 'json',
|
||||
async: true,
|
||||
success : function(data) {
|
||||
console.log('statistics ok '+id)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
show_tool_list(0);
|
||||
$("#searchkw").on('input', function(){
|
||||
watch_searchkw($(this).val().trim().toLowerCase())
|
||||
});
|
||||
$("#searchkw").change(function(){
|
||||
watch_searchkw($(this).val().trim().toLowerCase())
|
||||
});
|
||||
$(document).keydown(function(event){
|
||||
if(event.ctrlKey && event.keyCode==70){
|
||||
$("#searchkw").focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
97
template/dashlite/js/common.js
Normal file
97
template/dashlite/js/common.js
Normal file
@ -0,0 +1,97 @@
|
||||
const request = (url, data, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: params && params.type || 'post',
|
||||
dataType: params && params.dataType || 'json',
|
||||
data: data,
|
||||
cache: params && params.cache || false,
|
||||
success: function (res) {
|
||||
resolve(res)
|
||||
},
|
||||
error: function () {
|
||||
reject()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const httpGet = (url, callback, back) => {
|
||||
var ii = layer.load();
|
||||
return request(url, {}, {
|
||||
type: 'GET',
|
||||
}).then(res => {
|
||||
layer.close(ii);
|
||||
if(back){
|
||||
callback(res);
|
||||
}else{
|
||||
if(res.status == 'ok'){
|
||||
callback(res.data)
|
||||
}else{
|
||||
layer.alert(res.message, {icon: 7});
|
||||
}
|
||||
}
|
||||
},() => {
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误', {icon: 5});
|
||||
})
|
||||
}
|
||||
|
||||
const httpPost = (url, data, callback, back) => {
|
||||
var ii = layer.load();
|
||||
return request(url, data, {
|
||||
type: 'POST',
|
||||
}).then(res => {
|
||||
layer.close(ii);
|
||||
if(back){
|
||||
callback(res);
|
||||
}else{
|
||||
if(res.status == 'ok'){
|
||||
callback(res.data)
|
||||
}else{
|
||||
layer.alert(res.message, {icon: 7});
|
||||
}
|
||||
}
|
||||
},() => {
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误', {icon: 5});
|
||||
})
|
||||
}
|
||||
|
||||
function star_plugin(){
|
||||
var op = plugin_is_star?'del':'add';
|
||||
httpPost("/stars", {do: op, id: plugin_id}, function(data){
|
||||
if(data.status == 'ok'){
|
||||
plugin_is_star = !plugin_is_star;
|
||||
$("#star-btn-text").text(plugin_is_star?'取消收藏':'添加收藏');
|
||||
layer.msg(data.message, {icon:1, time:600});
|
||||
}else{
|
||||
layer.msg(data.message, {icon:7});
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
const copy = (text) => {
|
||||
let oInput = document.createElement('textarea');
|
||||
oInput.value = text;
|
||||
document.body.appendChild(oInput);
|
||||
oInput.select();
|
||||
document.execCommand("Copy");
|
||||
oInput.className = 'oInput';
|
||||
oInput.style.display = 'none';
|
||||
oInput.remove();
|
||||
}
|
||||
|
||||
const getQueryString = (name) => {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]); return null;
|
||||
}
|
||||
|
||||
window.appendChildOrg = Element.prototype.appendChild;
|
||||
Element.prototype.appendChild = function() {
|
||||
if(arguments[0].tagName == 'SCRIPT'){
|
||||
arguments[0].setAttribute('referrerpolicy', 'no-referrer');
|
||||
}
|
||||
return window.appendChildOrg.apply(this, arguments);
|
||||
};
|
1
template/dashlite/js/nioapp.min.js
vendored
Normal file
1
template/dashlite/js/nioapp.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
916
template/dashlite/js/script.js
Normal file
916
template/dashlite/js/script.js
Normal file
@ -0,0 +1,916 @@
|
||||
"use strict";
|
||||
|
||||
!function (NioApp, $) {
|
||||
"use strict";
|
||||
|
||||
NioApp.Package.name = "DashLite";
|
||||
NioApp.Package.version = "2.3";
|
||||
var $win = $(window),
|
||||
$body = $('body'),
|
||||
$doc = $(document),
|
||||
//class names
|
||||
_body_theme = 'nio-theme',
|
||||
_menu = 'nk-menu',
|
||||
_mobile_nav = 'mobile-menu',
|
||||
_header = 'nk-header',
|
||||
_header_menu = 'nk-header-menu',
|
||||
//breakpoints
|
||||
_break = NioApp.Break;
|
||||
|
||||
function extend(obj, ext) {
|
||||
Object.keys(ext).forEach(function (key) {
|
||||
obj[key] = ext[key];
|
||||
});
|
||||
return obj;
|
||||
} // ClassInit @v1.0
|
||||
|
||||
|
||||
NioApp.ClassNavMenu = function () {
|
||||
NioApp.BreakClass('.' + _header_menu, _break.lg, {
|
||||
timeOut: 0
|
||||
});
|
||||
$win.on('resize', function () {
|
||||
NioApp.BreakClass('.' + _header_menu, _break.lg);
|
||||
});
|
||||
}; // Code Prettify @v1.0
|
||||
|
||||
|
||||
NioApp.Prettify = function () {
|
||||
window.prettyPrint && prettyPrint();
|
||||
}; // Copied @v1.0
|
||||
|
||||
|
||||
NioApp.Copied = function () {
|
||||
var clip = '.clipboard-init',
|
||||
target = '.clipboard-text',
|
||||
sclass = 'clipboard-success',
|
||||
eclass = 'clipboard-error'; // Feedback
|
||||
|
||||
function feedback(el, state) {
|
||||
var $elm = $(el),
|
||||
$elp = $elm.parent(),
|
||||
copy = {
|
||||
text: 'Copy',
|
||||
done: 'Copied',
|
||||
fail: 'Failed'
|
||||
},
|
||||
data = {
|
||||
text: $elm.data('clip-text'),
|
||||
done: $elm.data('clip-success'),
|
||||
fail: $elm.data('clip-error')
|
||||
};
|
||||
copy.text = data.text ? data.text : copy.text;
|
||||
copy.done = data.done ? data.done : copy.done;
|
||||
copy.fail = data.fail ? data.fail : copy.fail;
|
||||
var copytext = state === 'success' ? copy.done : copy.fail,
|
||||
addclass = state === 'success' ? sclass : eclass;
|
||||
$elp.addClass(addclass).find(target).html(copytext);
|
||||
setTimeout(function () {
|
||||
$elp.removeClass(sclass + ' ' + eclass).find(target).html(copy.text).blur();
|
||||
$elp.find('input').blur();
|
||||
}, 2000);
|
||||
} // Init ClipboardJS
|
||||
|
||||
|
||||
if (ClipboardJS.isSupported()) {
|
||||
var clipboard = new ClipboardJS(clip);
|
||||
clipboard.on('success', function (e) {
|
||||
feedback(e.trigger, 'success');
|
||||
e.clearSelection();
|
||||
}).on('error', function (e) {
|
||||
feedback(e.trigger, 'error');
|
||||
});
|
||||
} else {
|
||||
$(clip).css('display', 'none');
|
||||
}
|
||||
|
||||
;
|
||||
}; // CurrentLink Detect @v1.0
|
||||
|
||||
|
||||
NioApp.CurrentLink = function () {
|
||||
var _link = '.nk-menu-link, .menu-link, .nav-link',
|
||||
_currentURL = window.location.href,
|
||||
fileName = _currentURL.substring(0, _currentURL.indexOf("#") == -1 ? _currentURL.length : _currentURL.indexOf("#")),
|
||||
fileName = fileName.substring(0, fileName.indexOf("?") == -1 ? fileName.length : fileName.indexOf("?"));
|
||||
|
||||
$(_link).each(function () {
|
||||
var self = $(this),
|
||||
_self_link = self.attr('href');
|
||||
|
||||
if (fileName.match(_self_link)) {
|
||||
self.closest("li").addClass('active current-page').parents().closest("li").addClass("active current-page");
|
||||
self.closest("li").children('.nk-menu-sub').css('display', 'block');
|
||||
self.parents().closest("li").children('.nk-menu-sub').css('display', 'block');
|
||||
} else {
|
||||
self.closest("li").removeClass('active current-page').parents().closest("li:not(.current-page)").removeClass("active");
|
||||
}
|
||||
});
|
||||
}; // PasswordSwitch @v1.0
|
||||
|
||||
|
||||
NioApp.PassSwitch = function () {
|
||||
NioApp.Passcode('.passcode-switch');
|
||||
}; // Toastr Message @v1.0
|
||||
|
||||
|
||||
NioApp.Toast = function (msg, ttype, opt) {
|
||||
var ttype = ttype ? ttype : 'info',
|
||||
msi = '',
|
||||
ticon = ttype === 'info' ? 'ni ni-info-fill' : ttype === 'success' ? 'ni ni-check-circle-fill' : ttype === 'error' ? 'ni ni-cross-circle-fill' : ttype === 'warning' ? 'ni ni-alert-fill' : '',
|
||||
def = {
|
||||
position: 'bottom-right',
|
||||
ui: '',
|
||||
icon: 'auto',
|
||||
clear: false
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
attr.position = attr.position ? 'toast-' + attr.position : 'toast-bottom-right';
|
||||
attr.icon = attr.icon === 'auto' ? ticon : attr.icon ? attr.icon : '';
|
||||
attr.ui = attr.ui ? ' ' + attr.ui : '';
|
||||
msi = attr.icon !== '' ? '<span class="toastr-icon"><em class="icon ' + attr.icon + '"></em></span>' : '', msg = msg !== '' ? msi + '<div class="toastr-text">' + msg + '</div>' : '';
|
||||
|
||||
if (msg !== "") {
|
||||
if (attr.clear === true) {
|
||||
toastr.clear();
|
||||
}
|
||||
|
||||
var option = {
|
||||
"closeButton": true,
|
||||
"debug": false,
|
||||
"newestOnTop": false,
|
||||
"progressBar": false,
|
||||
"positionClass": attr.position + attr.ui,
|
||||
"closeHtml": '<span class="btn-trigger">Close</span>',
|
||||
"preventDuplicates": true,
|
||||
"showDuration": "1500",
|
||||
"hideDuration": "1500",
|
||||
"timeOut": "2000",
|
||||
"toastClass": "toastr",
|
||||
"extendedTimeOut": "3000"
|
||||
};
|
||||
toastr.options = extend(option, attr);
|
||||
toastr[ttype](msg);
|
||||
}
|
||||
}; // Toggle Screen @v1.0
|
||||
|
||||
|
||||
NioApp.TGL.screen = function (elm) {
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var ssize = $(this).data('toggle-screen');
|
||||
|
||||
if (ssize) {
|
||||
$(this).addClass('toggle-screen-' + ssize);
|
||||
}
|
||||
});
|
||||
}
|
||||
}; // Toggle Content @v1.0
|
||||
|
||||
|
||||
NioApp.TGL.content = function (elm, opt) {
|
||||
var toggle = elm ? elm : '.toggle',
|
||||
$toggle = $(toggle),
|
||||
$contentD = $('[data-content]'),
|
||||
toggleBreak = true,
|
||||
toggleCurrent = false,
|
||||
def = {
|
||||
active: 'active',
|
||||
content: 'content-active',
|
||||
"break": toggleBreak
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
NioApp.TGL.screen($contentD);
|
||||
$toggle.on('click', function (e) {
|
||||
toggleCurrent = this;
|
||||
NioApp.Toggle.trigger($(this).data('target'), attr);
|
||||
e.preventDefault();
|
||||
});
|
||||
$doc.on('mouseup', function (e) {
|
||||
if (toggleCurrent) {
|
||||
var $toggleCurrent = $(toggleCurrent),
|
||||
$s2c = $('.select2-container'),
|
||||
$dpd = $('.datepicker-dropdown'),
|
||||
$tpc = $('.ui-timepicker-container');
|
||||
|
||||
if (!$toggleCurrent.is(e.target) && $toggleCurrent.has(e.target).length === 0 && !$contentD.is(e.target) && $contentD.has(e.target).length === 0 && !$s2c.is(e.target) && $s2c.has(e.target).length === 0 && !$dpd.is(e.target) && $dpd.has(e.target).length === 0 && !$tpc.is(e.target) && $tpc.has(e.target).length === 0) {
|
||||
NioApp.Toggle.removed($toggleCurrent.data('target'), attr);
|
||||
toggleCurrent = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
$win.on('resize', function () {
|
||||
$contentD.each(function () {
|
||||
var content = $(this).data('content'),
|
||||
ssize = $(this).data('toggle-screen'),
|
||||
toggleBreak = _break[ssize];
|
||||
|
||||
if (NioApp.Win.width > toggleBreak) {
|
||||
NioApp.Toggle.removed(content, attr);
|
||||
}
|
||||
});
|
||||
});
|
||||
}; // ToggleExpand @v1.0
|
||||
|
||||
|
||||
NioApp.TGL.expand = function (elm, opt) {
|
||||
var toggle = elm ? elm : '.expand',
|
||||
def = {
|
||||
toggle: true
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(toggle).on('click', function (e) {
|
||||
NioApp.Toggle.trigger($(this).data('target'), attr);
|
||||
e.preventDefault();
|
||||
});
|
||||
}; // Dropdown Menu @v1.0
|
||||
|
||||
|
||||
NioApp.TGL.ddmenu = function (elm, opt) {
|
||||
var imenu = elm ? elm : '.nk-menu-toggle',
|
||||
def = {
|
||||
active: 'active',
|
||||
self: 'nk-menu-toggle',
|
||||
child: 'nk-menu-sub'
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(imenu).on('click', function (e) {
|
||||
if (NioApp.Win.width < _break.lg) {
|
||||
NioApp.Toggle.dropMenu($(this), attr);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
}; // Show Menu @v1.0
|
||||
|
||||
|
||||
NioApp.TGL.showmenu = function (elm, opt) {
|
||||
var toggle = elm ? elm : '.nk-nav-toggle',
|
||||
$toggle = $(toggle),
|
||||
$contentD = $('[data-content]'),
|
||||
toggleBreak = $contentD.hasClass(_header_menu) ? _break.lg : _break.xl,
|
||||
toggleOlay = _header + '-overlay',
|
||||
toggleClose = {
|
||||
profile: true,
|
||||
menu: false
|
||||
},
|
||||
def = {
|
||||
active: 'toggle-active',
|
||||
content: _header + '-active',
|
||||
body: 'nav-shown',
|
||||
overlay: toggleOlay,
|
||||
"break": toggleBreak,
|
||||
close: toggleClose
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$toggle.on('click', function (e) {
|
||||
NioApp.Toggle.trigger($(this).data('target'), attr);
|
||||
e.preventDefault();
|
||||
});
|
||||
$doc.on('mouseup', function (e) {
|
||||
if (!$toggle.is(e.target) && $toggle.has(e.target).length === 0 && !$contentD.is(e.target) && $contentD.has(e.target).length === 0 && NioApp.Win.width < toggleBreak) {
|
||||
NioApp.Toggle.removed($toggle.data('target'), attr);
|
||||
}
|
||||
});
|
||||
$win.on('resize', function () {
|
||||
if (NioApp.Win.width < _break.xl || NioApp.Win.width < toggleBreak) {
|
||||
NioApp.Toggle.removed($toggle.data('target'), attr);
|
||||
}
|
||||
});
|
||||
}; // Animate FormSearch @v1.0
|
||||
|
||||
|
||||
NioApp.Ani.formSearch = function (elm, opt) {
|
||||
var def = {
|
||||
active: 'active',
|
||||
timeout: 400,
|
||||
target: '[data-search]'
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
var $elem = $(elm),
|
||||
$target = $(attr.target);
|
||||
|
||||
if ($elem.exists()) {
|
||||
$elem.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $self = $(this),
|
||||
the_target = $self.data('target'),
|
||||
$self_st = $('[data-search=' + the_target + ']'),
|
||||
$self_tg = $('[data-target=' + the_target + ']');
|
||||
|
||||
if (!$self_st.hasClass(attr.active)) {
|
||||
$self_tg.add($self_st).addClass(attr.active);
|
||||
$self_st.find('input').focus();
|
||||
} else {
|
||||
$self_tg.add($self_st).removeClass(attr.active);
|
||||
setTimeout(function () {
|
||||
$self_st.find('input').val('');
|
||||
}, attr.timeout);
|
||||
}
|
||||
});
|
||||
$doc.on({
|
||||
keyup: function keyup(e) {
|
||||
if (e.key === "Escape") {
|
||||
$elem.add($target).removeClass(attr.active);
|
||||
}
|
||||
},
|
||||
mouseup: function mouseup(e) {
|
||||
if (!$target.find('input').val() && !$target.is(e.target) && $target.has(e.target).length === 0 && !$elem.is(e.target) && $elem.has(e.target).length === 0) {
|
||||
$elem.add($target).removeClass(attr.active);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}; // Animate FormElement @v1.0
|
||||
|
||||
|
||||
NioApp.Ani.formElm = function (elm, opt) {
|
||||
var def = {
|
||||
focus: 'focused'
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var $self = $(this);
|
||||
|
||||
if ($self.val()) {
|
||||
$self.parent().addClass(attr.focus);
|
||||
}
|
||||
|
||||
$self.on({
|
||||
focus: function focus() {
|
||||
$self.parent().addClass(attr.focus);
|
||||
},
|
||||
blur: function blur() {
|
||||
if (!$self.val()) {
|
||||
$self.parent().removeClass(attr.focus);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}; // Form Validate @v1.0
|
||||
|
||||
|
||||
NioApp.Validate = function (elm, opt) {
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var def = {
|
||||
errorElement: "span"
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(this).validate(attr);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
NioApp.Validate.init = function () {
|
||||
NioApp.Validate('.form-validate', {
|
||||
errorElement: "span",
|
||||
errorClass: "invalid",
|
||||
errorPlacement: function errorPlacement(error, element) {
|
||||
if (element.parents().hasClass('input-group')) {
|
||||
error.appendTo(element.parent().parent());
|
||||
} else {
|
||||
error.appendTo(element.parent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}; // Dropzone @v1.1
|
||||
|
||||
|
||||
NioApp.Dropzone = function (elm, opt) {
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var maxFiles = $(elm).data('max-files'),
|
||||
maxFiles = maxFiles ? maxFiles : null;
|
||||
var maxFileSize = $(elm).data('max-file-size'),
|
||||
maxFileSize = maxFileSize ? maxFileSize : 256;
|
||||
var acceptedFiles = $(elm).data('accepted-files'),
|
||||
acceptedFiles = acceptedFiles ? acceptedFiles : null;
|
||||
var def = {
|
||||
autoDiscover: false,
|
||||
maxFiles: maxFiles,
|
||||
maxFilesize: maxFileSize,
|
||||
acceptedFiles: acceptedFiles
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(this).addClass('dropzone').dropzone(attr);
|
||||
});
|
||||
}
|
||||
}; // Dropzone Init @v1.0
|
||||
|
||||
|
||||
NioApp.Dropzone.init = function () {
|
||||
NioApp.Dropzone('.upload-zone', {
|
||||
url: "/images"
|
||||
});
|
||||
}; // Wizard @v1.0
|
||||
|
||||
|
||||
NioApp.Wizard = function () {
|
||||
var $wizard = $(".nk-wizard");
|
||||
|
||||
if ($wizard.exists()) {
|
||||
$wizard.each(function () {
|
||||
var $self = $(this),
|
||||
_self_id = $self.attr('id'),
|
||||
$self_id = $('#' + _self_id).show();
|
||||
|
||||
$self_id.steps({
|
||||
headerTag: ".nk-wizard-head",
|
||||
bodyTag: ".nk-wizard-content",
|
||||
labels: {
|
||||
finish: "Submit",
|
||||
next: "Next",
|
||||
previous: "Prev",
|
||||
loading: "Loading ..."
|
||||
},
|
||||
titleTemplate: '<span class="number">0#index#</span> #title#',
|
||||
onStepChanging: function onStepChanging(event, currentIndex, newIndex) {
|
||||
// Allways allow previous action even if the current form is not valid!
|
||||
if (currentIndex > newIndex) {
|
||||
return true;
|
||||
} // Needed in some cases if the user went back (clean up)
|
||||
|
||||
|
||||
if (currentIndex < newIndex) {
|
||||
// To remove error styles
|
||||
$self_id.find(".body:eq(" + newIndex + ") label.error").remove();
|
||||
$self_id.find(".body:eq(" + newIndex + ") .error").removeClass("error");
|
||||
}
|
||||
|
||||
$self_id.validate().settings.ignore = ":disabled,:hidden";
|
||||
return $self_id.valid();
|
||||
},
|
||||
onFinishing: function onFinishing(event, currentIndex) {
|
||||
$self_id.validate().settings.ignore = ":disabled";
|
||||
return $self_id.valid();
|
||||
},
|
||||
onFinished: function onFinished(event, currentIndex) {
|
||||
window.location.href = "#";
|
||||
}
|
||||
}).validate({
|
||||
errorElement: "span",
|
||||
errorClass: "invalid",
|
||||
errorPlacement: function errorPlacement(error, element) {
|
||||
error.appendTo(element.parent());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}; // DataTable @1.1
|
||||
|
||||
|
||||
NioApp.DataTable = function (elm, opt) {
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var auto_responsive = $(this).data('auto-responsive'),
|
||||
has_export = typeof opt.buttons !== 'undefined' && opt.buttons ? true : false;
|
||||
var export_title = $(this).data('export-title') ? $(this).data('export-title') : 'Export';
|
||||
var btn = has_export ? '<"dt-export-buttons d-flex align-center"<"dt-export-title d-none d-md-inline-block">B>' : '',
|
||||
btn_cls = has_export ? ' with-export' : '';
|
||||
var dom_normal = '<"row justify-between g-2' + btn_cls + '"<"col-7 col-sm-4 text-left"f><"col-5 col-sm-8 text-right"<"datatable-filter"<"d-flex justify-content-end g-2"' + btn + 'l>>>><"datatable-wrap my-3"t><"row align-items-center"<"col-7 col-sm-12 col-md-9"p><"col-5 col-sm-12 col-md-3 text-left text-md-right"i>>';
|
||||
var dom_separate = '<"row justify-between g-2' + btn_cls + '"<"col-7 col-sm-4 text-left"f><"col-5 col-sm-8 text-right"<"datatable-filter"<"d-flex justify-content-end g-2"' + btn + 'l>>>><"my-3"t><"row align-items-center"<"col-7 col-sm-12 col-md-9"p><"col-5 col-sm-12 col-md-3 text-left text-md-right"i>>';
|
||||
var dom = $(this).hasClass('is-separate') ? dom_separate : dom_normal;
|
||||
var def = {
|
||||
responsive: true,
|
||||
autoWidth: false,
|
||||
dom: dom,
|
||||
language: {
|
||||
search: "",
|
||||
searchPlaceholder: "Type in to Search",
|
||||
lengthMenu: "<span class='d-none d-sm-inline-block'>Show</span><div class='form-control-select'> _MENU_ </div>",
|
||||
info: "_START_ -_END_ of _TOTAL_",
|
||||
infoEmpty: "No records found",
|
||||
infoFiltered: "( Total _MAX_ )",
|
||||
paginate: {
|
||||
"first": "First",
|
||||
"last": "Last",
|
||||
"next": "Next",
|
||||
"previous": "Prev"
|
||||
}
|
||||
}
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
attr = auto_responsive === false ? extend(attr, {
|
||||
responsive: false
|
||||
}) : attr;
|
||||
$(this).DataTable(attr);
|
||||
$('.dt-export-title').text(export_title);
|
||||
});
|
||||
}
|
||||
}; // DataTable Init @v1.0
|
||||
|
||||
|
||||
NioApp.DataTable.init = function () {
|
||||
NioApp.DataTable('.datatable-init', {
|
||||
responsive: {
|
||||
details: true
|
||||
}
|
||||
});
|
||||
NioApp.DataTable('.datatable-init-export', {
|
||||
responsive: {
|
||||
details: true
|
||||
},
|
||||
buttons: ['copy', 'excel', 'csv', 'pdf']
|
||||
});
|
||||
$.fn.DataTable.ext.pager.numbers_length = 7;
|
||||
}; // BootStrap Extended
|
||||
|
||||
|
||||
NioApp.BS.ddfix = function (elm, exc) {
|
||||
var dd = elm ? elm : '.dropdown-menu',
|
||||
ex = exc ? exc : 'a:not(.clickable), button:not(.clickable), a:not(.clickable) *, button:not(.clickable) *';
|
||||
$(dd).on('click', function (e) {
|
||||
if (!$(e.target).is(ex)) {
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
if (NioApp.State.isRTL) {
|
||||
var $dMenu = $('.dropdown-menu');
|
||||
$dMenu.each(function () {
|
||||
var $self = $(this);
|
||||
|
||||
if ($self.hasClass('dropdown-menu-right') && !$self.hasClass('dropdown-menu-center')) {
|
||||
$self.prev('[data-toggle="dropdown"]').dropdown({
|
||||
popperConfig: {
|
||||
placement: 'bottom-start'
|
||||
}
|
||||
});
|
||||
} else if (!$self.hasClass('dropdown-menu-right') && !$self.hasClass('dropdown-menu-center')) {
|
||||
$self.prev('[data-toggle="dropdown"]').dropdown({
|
||||
popperConfig: {
|
||||
placement: 'bottom-end'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}; // BootStrap Specific Tab Open
|
||||
|
||||
|
||||
NioApp.BS.tabfix = function (elm) {
|
||||
var tab = elm ? elm : '[data-toggle="modal"]';
|
||||
$(tab).on('click', function () {
|
||||
var _this = $(this),
|
||||
target = _this.data('target'),
|
||||
target_href = _this.attr('href'),
|
||||
tg_tab = _this.data('tab-target');
|
||||
|
||||
var modal = target ? $body.find(target) : $body.find(target_href);
|
||||
|
||||
if (tg_tab && tg_tab !== '#' && modal) {
|
||||
modal.find('[href="' + tg_tab + '"]').tab('show');
|
||||
} else if (modal) {
|
||||
var tabdef = modal.find('.nk-nav.nav-tabs');
|
||||
var link = $(tabdef[0]).find('[data-toggle="tab"]');
|
||||
$(link[0]).tab('show');
|
||||
}
|
||||
});
|
||||
}; // Dark Mode Switch @since v2.0
|
||||
|
||||
|
||||
NioApp.ModeSwitch = function () {
|
||||
var toggle = $('.dark-switch');
|
||||
|
||||
if ($body.hasClass('dark-mode')) {
|
||||
toggle.addClass('active');
|
||||
} else {
|
||||
toggle.removeClass('active');
|
||||
}
|
||||
|
||||
toggle.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).toggleClass('active');
|
||||
$body.toggleClass('dark-mode');
|
||||
if($(this).hasClass('active')) {
|
||||
document.cookie='darkmode=1';
|
||||
}else{
|
||||
document.cookie='darkmode=0';
|
||||
}
|
||||
});
|
||||
}; // Knob @v1.0
|
||||
|
||||
|
||||
NioApp.Knob = function (elm, opt) {
|
||||
if ($(elm).exists() && typeof $.fn.knob === 'function') {
|
||||
var def = {
|
||||
min: 0
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(elm).each(function () {
|
||||
$(this).knob(attr);
|
||||
});
|
||||
}
|
||||
}; // Knob Init @v1.0
|
||||
|
||||
|
||||
NioApp.Knob.init = function () {
|
||||
var knob = {
|
||||
"default": {
|
||||
readOnly: true,
|
||||
lineCap: "round"
|
||||
},
|
||||
half: {
|
||||
angleOffset: -90,
|
||||
angleArc: 180,
|
||||
readOnly: true,
|
||||
lineCap: "round"
|
||||
}
|
||||
};
|
||||
NioApp.Knob('.knob', knob["default"]);
|
||||
NioApp.Knob('.knob-half', knob.half);
|
||||
}; // Range @v1.0.1
|
||||
|
||||
|
||||
NioApp.Range = function (elm, opt) {
|
||||
if ($(elm).exists() && typeof noUiSlider !== 'undefined') {
|
||||
$(elm).each(function () {
|
||||
var $self = $(this),
|
||||
self_id = $self.attr('id');
|
||||
|
||||
var _start = $self.data('start'),
|
||||
_start = /\s/g.test(_start) ? _start.split(' ') : _start,
|
||||
_start = _start ? _start : 0,
|
||||
_connect = $self.data('connect'),
|
||||
_connect = /\s/g.test(_connect) ? _connect.split(' ') : _connect,
|
||||
_connect = typeof _connect == 'undefined' ? 'lower' : _connect,
|
||||
_min = $self.data('min'),
|
||||
_min = _min ? _min : 0,
|
||||
_max = $self.data('max'),
|
||||
_max = _max ? _max : 100,
|
||||
_min_distance = $self.data('min-distance'),
|
||||
_min_distance = _min_distance ? _min_distance : null,
|
||||
_max_distance = $self.data('max-distance'),
|
||||
_max_distance = _max_distance ? _max_distance : null,
|
||||
_step = $self.data('step'),
|
||||
_step = _step ? _step : 1,
|
||||
_orientation = $self.data('orientation'),
|
||||
_orientation = _orientation ? _orientation : 'horizontal',
|
||||
_tooltip = $self.data('tooltip'),
|
||||
_tooltip = _tooltip ? _tooltip : false;
|
||||
|
||||
console.log(_tooltip);
|
||||
var target = document.getElementById(self_id);
|
||||
var def = {
|
||||
start: _start,
|
||||
connect: _connect,
|
||||
direction: NioApp.State.isRTL ? "rtl" : "ltr",
|
||||
range: {
|
||||
'min': _min,
|
||||
'max': _max
|
||||
},
|
||||
margin: _min_distance,
|
||||
limit: _max_distance,
|
||||
step: _step,
|
||||
orientation: _orientation,
|
||||
tooltips: _tooltip
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
noUiSlider.create(target, attr);
|
||||
});
|
||||
}
|
||||
}; // Range Init @v1.0
|
||||
|
||||
|
||||
NioApp.Range.init = function () {
|
||||
NioApp.Range('.form-control-slider');
|
||||
NioApp.Range('.form-range-slider');
|
||||
};
|
||||
|
||||
NioApp.Select2.init = function () {
|
||||
// NioApp.Select2('.select');
|
||||
NioApp.Select2('.form-select');
|
||||
}; // Slick Slider @v1.0.1
|
||||
|
||||
|
||||
NioApp.Slick = function (elm, opt) {
|
||||
if ($(elm).exists() && typeof $.fn.slick === 'function') {
|
||||
$(elm).each(function () {
|
||||
var def = {
|
||||
'prevArrow': '<div class="slick-arrow-prev"><a href="javascript:void(0);" class="slick-prev"><em class="icon ni ni-chevron-left"></em></a></div>',
|
||||
'nextArrow': '<div class="slick-arrow-next"><a href="javascript:void(0);" class="slick-next"><em class="icon ni ni-chevron-right"></em></a></div>',
|
||||
rtl: NioApp.State.isRTL
|
||||
},
|
||||
attr = opt ? extend(def, opt) : def;
|
||||
$(this).slick(attr);
|
||||
});
|
||||
}
|
||||
}; // Slick Init @v1.0
|
||||
|
||||
|
||||
NioApp.Slider.init = function () {
|
||||
NioApp.Slick('.slider-init');
|
||||
}; // Magnific Popup @v1.0.0
|
||||
|
||||
|
||||
NioApp.Lightbox = function (elm, type, opt) {
|
||||
if ($(elm).exists()) {
|
||||
$(elm).each(function () {
|
||||
var def = {};
|
||||
|
||||
if (type == 'video' || type == 'iframe') {
|
||||
def = {
|
||||
type: 'iframe',
|
||||
removalDelay: 160,
|
||||
preloader: true,
|
||||
fixedContentPos: false,
|
||||
callbacks: {
|
||||
beforeOpen: function beforeOpen() {
|
||||
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
|
||||
this.st.mainClass = this.st.el.attr('data-effect');
|
||||
}
|
||||
}
|
||||
};
|
||||
} else if (type == 'content') {
|
||||
def = {
|
||||
type: 'inline',
|
||||
preloader: true,
|
||||
removalDelay: 400,
|
||||
mainClass: 'mfp-fade content-popup'
|
||||
};
|
||||
} else {
|
||||
def = {
|
||||
type: 'image',
|
||||
mainClass: 'mfp-fade image-popup'
|
||||
};
|
||||
}
|
||||
|
||||
var attr = opt ? extend(def, opt) : def;
|
||||
$(this).magnificPopup(attr);
|
||||
});
|
||||
}
|
||||
}; // Controls @v1.0.0
|
||||
|
||||
|
||||
NioApp.Control = function (elm) {
|
||||
var control = document.querySelectorAll(elm);
|
||||
control.forEach(function (item, index, arr) {
|
||||
item.checked ? item.parentNode.classList.add('checked') : null;
|
||||
item.addEventListener("change", function () {
|
||||
if (item.type == "checkbox") {
|
||||
item.checked ? item.parentNode.classList.add('checked') : item.parentNode.classList.remove('checked');
|
||||
}
|
||||
|
||||
if (item.type == "radio") {
|
||||
document.querySelectorAll('input[name="' + item.name + '"]').forEach(function (item, index, arr) {
|
||||
item.parentNode.classList.remove('checked');
|
||||
});
|
||||
item.checked ? item.parentNode.classList.add('checked') : null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}; // Number Spinner @v1.0
|
||||
|
||||
|
||||
NioApp.NumberSpinner = function (elm, opt) {
|
||||
var plus = document.querySelectorAll("[data-number='plus']");
|
||||
var minus = document.querySelectorAll("[data-number='minus']");
|
||||
plus.forEach(function (item, index, arr) {
|
||||
var parent = plus[index].parentNode;
|
||||
plus[index].addEventListener("click", function () {
|
||||
var child = plus[index].parentNode.childNodes;
|
||||
child.forEach(function (item, index, arr) {
|
||||
if (child[index].classList && child[index].classList.contains("number-spinner")) {
|
||||
var value = !child[index].value == "" ? parseInt(child[index].value) : 0;
|
||||
var step = !child[index].step == "" ? parseInt(child[index].step) : 1;
|
||||
var max = !child[index].max == "" ? parseInt(child[index].max) : Infinity;
|
||||
|
||||
if (max + 1 > value + step) {
|
||||
child[index].value = value + step;
|
||||
} else {
|
||||
child[index].value = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
minus.forEach(function (item, index, arr) {
|
||||
var parent = minus[index].parentNode;
|
||||
minus[index].addEventListener("click", function () {
|
||||
var child = minus[index].parentNode.childNodes;
|
||||
child.forEach(function (item, index, arr) {
|
||||
if (child[index].classList && child[index].classList.contains("number-spinner")) {
|
||||
var value = !child[index].value == "" ? parseInt(child[index].value) : 0;
|
||||
var step = !child[index].step == "" ? parseInt(child[index].step) : 1;
|
||||
var min = !child[index].min == "" ? parseInt(child[index].min) : 0;
|
||||
|
||||
if (min - 1 < value - step) {
|
||||
child[index].value = value - step;
|
||||
} else {
|
||||
child[index].value = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}; // Extra @v1.1
|
||||
|
||||
|
||||
NioApp.OtherInit = function () {
|
||||
NioApp.PassSwitch();
|
||||
//NioApp.CurrentLink();
|
||||
NioApp.LinkOff('.is-disable');
|
||||
NioApp.ClassNavMenu();
|
||||
NioApp.SetHW('[data-height]', 'height');
|
||||
NioApp.SetHW('[data-width]', 'width');
|
||||
NioApp.NumberSpinner();
|
||||
NioApp.Lightbox('.popup-video', 'video');
|
||||
NioApp.Lightbox('.popup-iframe', 'iframe');
|
||||
NioApp.Lightbox('.popup-image', 'image');
|
||||
NioApp.Lightbox('.popup-content', 'content');
|
||||
NioApp.Control('.custom-control-input');
|
||||
}; // Animate Init @v1.0
|
||||
|
||||
|
||||
NioApp.Ani.init = function () {
|
||||
NioApp.Ani.formElm('.form-control-outlined');
|
||||
NioApp.Ani.formSearch('.toggle-search');
|
||||
}; // BootstrapExtend Init @v1.0
|
||||
|
||||
|
||||
NioApp.BS.init = function () {
|
||||
NioApp.BS.menutip('a.nk-menu-link');
|
||||
NioApp.BS.tooltip('.nk-tooltip');
|
||||
NioApp.BS.tooltip('.btn-tooltip', {
|
||||
placement: 'top'
|
||||
});
|
||||
NioApp.BS.tooltip('[data-toggle="tooltip"]');
|
||||
NioApp.BS.tooltip('.tipinfo,.nk-menu-tooltip', {
|
||||
placement: 'right'
|
||||
});
|
||||
NioApp.BS.popover('[data-toggle="popover"]');
|
||||
NioApp.BS.progress('[data-progress]');
|
||||
NioApp.BS.fileinput('.custom-file-input');
|
||||
NioApp.BS.modalfix();
|
||||
NioApp.BS.ddfix();
|
||||
NioApp.BS.tabfix();
|
||||
}; // Picker Init @v1.0
|
||||
|
||||
|
||||
NioApp.Picker.init = function () {
|
||||
NioApp.Picker.date('.date-picker');
|
||||
NioApp.Picker.dob('.date-picker-alt');
|
||||
NioApp.Picker.time('.time-picker');
|
||||
NioApp.Picker.date('.date-picker-range', {
|
||||
todayHighlight: false,
|
||||
autoclose: false
|
||||
});
|
||||
}; // Addons @v1
|
||||
|
||||
|
||||
NioApp.Addons.Init = function () {
|
||||
//NioApp.Knob.init();
|
||||
//NioApp.Range.init();
|
||||
//NioApp.Select2.init();
|
||||
//NioApp.Dropzone.init();
|
||||
//NioApp.Slider.init();
|
||||
//NioApp.DataTable.init();
|
||||
}; // Toggler @v1
|
||||
|
||||
|
||||
NioApp.TGL.init = function () {
|
||||
NioApp.TGL.content('.toggle');
|
||||
NioApp.TGL.expand('.toggle-expand');
|
||||
NioApp.TGL.expand('.toggle-opt', {
|
||||
toggle: false
|
||||
});
|
||||
NioApp.TGL.showmenu('.nk-nav-toggle');
|
||||
NioApp.TGL.ddmenu('.' + _menu + '-toggle', {
|
||||
self: _menu + '-toggle',
|
||||
child: _menu + '-sub'
|
||||
});
|
||||
};
|
||||
|
||||
NioApp.BS.modalOnInit = function () {
|
||||
$('.modal').on('shown.bs.modal', function () {
|
||||
NioApp.Select2.init();
|
||||
NioApp.Validate.init();
|
||||
});
|
||||
}; // Initial by default
|
||||
/////////////////////////////
|
||||
|
||||
|
||||
NioApp.init = function () {
|
||||
NioApp.coms.docReady.push(NioApp.OtherInit);
|
||||
NioApp.coms.docReady.push(NioApp.Prettify);
|
||||
NioApp.coms.docReady.push(NioApp.ColorBG);
|
||||
NioApp.coms.docReady.push(NioApp.ColorTXT);
|
||||
//NioApp.coms.docReady.push(NioApp.Copied);
|
||||
NioApp.coms.docReady.push(NioApp.Ani.init);
|
||||
NioApp.coms.docReady.push(NioApp.TGL.init);
|
||||
NioApp.coms.docReady.push(NioApp.BS.init);
|
||||
NioApp.coms.docReady.push(NioApp.Validate.init);
|
||||
NioApp.coms.docReady.push(NioApp.Picker.init);
|
||||
NioApp.coms.docReady.push(NioApp.Addons.Init);
|
||||
NioApp.coms.docReady.push(NioApp.Wizard);
|
||||
NioApp.coms.winLoad.push(NioApp.ModeSwitch);
|
||||
};
|
||||
|
||||
NioApp.init();
|
||||
return NioApp;
|
||||
}(NioApp, jQuery);
|
13
template/dashlite/list.php
Normal file
13
template/dashlite/list.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
// 主题开发文档:https://doc.lylme.com/dev/theme
|
||||
$html = array(
|
||||
'g1' => '<div class="card card-preview category-card" data-category-id="{group_id}">', //分组开始标签
|
||||
'g2' => '<div class="card-inner mt-3"><div class="nya-title nk-ibx-action-item progress-rating"><em class="icon ni ni-setting"></em><span class="nk-menu-text font-weight-bold">{group_name}</span></div><div class="row g-2">', //分组内容
|
||||
'g3' => '</div></div></div>', //分组结束标签
|
||||
|
||||
'l1' => '<div class="col-lg-3 col-md-4 col-6">', //链接开始标签
|
||||
'l2' => '<a rel="nofollow" href="{link_url}" target="_blank" data-id="73" class="btn btn-wider btn-block btn-xl btn-outline-light tool-link">{link_name}</a>', //链接内容
|
||||
'l3' => '</div>', //链接结束标签
|
||||
);
|
||||
lists($html);
|
8
template/dashlite/theme.ini
Normal file
8
template/dashlite/theme.ini
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"author_name": "六零二开",
|
||||
"author_link": "https://gitee.com/lylme",
|
||||
"theme_name": "DashLite",
|
||||
"theme_version": "1.0",
|
||||
"theme_explain": "基于彩虹工具网修改",
|
||||
"theme_demo": "https://spage.lylme.com/theme/DashdashliteLite"
|
||||
}
|
Loading…
Reference in New Issue
Block a user