|
@ -0,0 +1,32 @@
|
||||||
|
using MD.PersianDateTime.Standard;
|
||||||
|
|
||||||
|
namespace NetinaShop.Api.Controller;
|
||||||
|
|
||||||
|
public class HealthController : ICarterModule
|
||||||
|
{
|
||||||
|
public void AddRoutes(IEndpointRouteBuilder app)
|
||||||
|
{
|
||||||
|
var group = app.NewVersionedApi("Health")
|
||||||
|
.MapGroup("health");
|
||||||
|
group.MapGet("", GetHealth)
|
||||||
|
.WithDisplayName("GetHealth")
|
||||||
|
.HasApiVersion(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IResult GetHealth()
|
||||||
|
{
|
||||||
|
var version = typeof(Program)?.Assembly.GetName()?.Version?.ToString();
|
||||||
|
var check = new HealthCheck
|
||||||
|
{
|
||||||
|
Health = true,
|
||||||
|
Version = version ?? string.Empty,
|
||||||
|
StartAt = System.Diagnostics.Process.GetCurrentProcess().StartTime.ToString("F"),
|
||||||
|
StartAtPersian = new PersianDateTime(System.Diagnostics.Process.GetCurrentProcess().StartTime).ToLongDateTimeString(),
|
||||||
|
MachineName = Environment.MachineName
|
||||||
|
};
|
||||||
|
var process = Process.GetCurrentProcess();
|
||||||
|
check.TotalMemory = process.PrivateMemorySize64.ToString();
|
||||||
|
|
||||||
|
return TypedResults.Ok(check);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using NetinaShop.Api.Views.Home;
|
||||||
|
|
||||||
|
namespace NetinaShop.Api.Controller;
|
||||||
|
|
||||||
|
[Route("")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public class HomeController : Microsoft.AspNetCore.Mvc.Controller
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View("Index", new IndexModel());
|
||||||
|
}
|
||||||
|
}
|
|
@ -128,4 +128,8 @@
|
||||||
<ProjectReference Include="..\NetinaShop.Infrastructure\NetinaShop.Infrastructure.csproj" />
|
<ProjectReference Include="..\NetinaShop.Infrastructure\NetinaShop.Infrastructure.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="wwwroot\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -21,6 +21,7 @@ builder.Services.Configure<ShopSettings>(configuration.GetSection(nameof(ShopSet
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
builder.Services.AddCustomCores();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddCustomSwagger(siteSetting!.BaseUrl);
|
builder.Services.AddCustomSwagger(siteSetting!.BaseUrl);
|
||||||
|
@ -87,17 +88,13 @@ if (app.Environment.IsDevelopment())
|
||||||
//app.UseSwagger();
|
//app.UseSwagger();
|
||||||
//app.UseSwaggerUI();
|
//app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
app.UseCors("CorsPolicy");
|
||||||
|
|
||||||
//app.UseCustomSwagger(siteSetting.BaseUrl);
|
//app.UseCustomSwagger(siteSetting.BaseUrl);
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|
||||||
app.UseCors(x => x
|
|
||||||
.SetIsOriginAllowed(origin => true)
|
|
||||||
.AllowAnyMethod()
|
|
||||||
.AllowAnyHeader()
|
|
||||||
.AllowCredentials());
|
|
||||||
|
|
||||||
app.UseExceptionHandlerMiddleware();
|
app.UseExceptionHandlerMiddleware();
|
||||||
|
|
||||||
app.MapCarter();
|
app.MapCarter();
|
||||||
|
|
|
@ -0,0 +1,274 @@
|
||||||
|
@model NetinaShop.Api.Views.Home.IndexModel
|
||||||
|
@{
|
||||||
|
}
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||||
|
|
||||||
|
<title>NetinaShop API</title>
|
||||||
|
<meta content="" name="description">
|
||||||
|
<meta content="" name="keywords">
|
||||||
|
|
||||||
|
<!-- Favicons -->
|
||||||
|
<link href="assets/img/favicon.png" rel="icon">
|
||||||
|
<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
|
||||||
|
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Jost:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="//fdn.fontcdn.ir">
|
||||||
|
<link rel="preconnect" href="//v1.fontapi.ir">
|
||||||
|
<link href="https://v1.fontapi.ir/css/Shabnam" rel="stylesheet">
|
||||||
|
<!-- Vendor CSS Files -->
|
||||||
|
|
||||||
|
<link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
|
||||||
|
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Template Main CSS File -->
|
||||||
|
<link href="assets/css/style.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- ======= Header ======= -->
|
||||||
|
<header id="header" class="fixed-top ">
|
||||||
|
<div class="container d-flex align-items-center">
|
||||||
|
|
||||||
|
<h1 class="logo me-auto"><a href="index.html">NetinaShop API</a></h1>
|
||||||
|
<!-- Uncomment below if you prefer to use an image logo -->
|
||||||
|
<!-- <a href="index.html" class="logo me-auto"><img src="assets/img/logo.png" alt="" class="img-fluid"></a>-->
|
||||||
|
|
||||||
|
<nav id="navbar" class="navbar">
|
||||||
|
<ul>
|
||||||
|
<li><a class="nav-link scrollto active" href="#hero">Home</a></li>
|
||||||
|
<li><a class="nav-link scrollto" href="#why-us">Features</a></li>
|
||||||
|
<li><a class="nav-link scrollto" href="#skills">Framworks</a></li>
|
||||||
|
<li><a class="getstarted scrollto" target="_blank" href="/swagger/index.html">Go To Swagger</a></li>
|
||||||
|
</ul>
|
||||||
|
<i class="bi bi-list mobile-nav-toggle"></i>
|
||||||
|
</nav><!-- .navbar -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</header><!-- End Header -->
|
||||||
|
<!-- ======= Hero Section ======= -->
|
||||||
|
<section id="hero" dir="ltr" class="d-flex min-vh-100 flex-column justify-content-center">
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 d-flex flex-column justify-content-center pt-4 pt-lg-0 order-2 order-lg-1" data-aos="fade-up" data-aos-delay="200">
|
||||||
|
<h1>New API for use </h1>
|
||||||
|
<h2 style="font-family: SF Pro Display, sans-serif; text-align: justify ;">
|
||||||
|
This API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
|
||||||
|
</h2>
|
||||||
|
<h2 style="font-family: SF Pro Display, sans-serif; text-align: justify ;">
|
||||||
|
Version : @Model?.Version
|
||||||
|
</h2>
|
||||||
|
<div class="d-flex justify-content-center justify-content-lg-start">
|
||||||
|
<a href="/swagger/index.html" target="_blank" class="btn-get-started scrollto"><i class="bi bi-chevron-right" style="font-family: SF Pro Display, sans-serif; margin-right:10px ;"></i><span>Go to Swagger</span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 order-1 order-lg-2 hero-img" data-aos="zoom-in" data-aos-delay="200">
|
||||||
|
<img src="assets/img/hero-img.png" class="img-fluid animated" alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section><!-- End Hero -->
|
||||||
|
|
||||||
|
<main id="main">
|
||||||
|
<!-- ======= Why Us Section ======= -->
|
||||||
|
<section id="why-us" class="why-us section-bg d-flex min-vh-100 flex-column justify-content-center">
|
||||||
|
<div class="container-fluid" data-aos="fade-up">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-7 d-flex flex-column justify-content-center align-items-stretch order-2 order-lg-1">
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<h3>Features of using this API</h3>
|
||||||
|
<p>
|
||||||
|
We have brought you lots of different features in this API for you
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="accordion-list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a data-bs-toggle="collapse" class="collapse" data-bs-target="#accordion-list-1"><span>01</span> Use JSON <i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a>
|
||||||
|
<div id="accordion-list-1" class="collapse show" data-bs-parent=".accordion-list">
|
||||||
|
<p>
|
||||||
|
All responses and data convert to JSON , and you get json compresed response in all request
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a data-bs-toggle="collapse" data-bs-target="#accordion-list-2" class="collapsed"><span>02</span> User Authentication <i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a>
|
||||||
|
<div id="accordion-list-2" class="collapse" data-bs-parent=".accordion-list">
|
||||||
|
<p>
|
||||||
|
The authentication of API is based on USERNAME & PASSWORD , in this case you user your test user for testing API and methods
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a data-bs-toggle="collapse" data-bs-target="#accordion-list-3" class="collapsed"><span>03</span> Api Versionening <i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a>
|
||||||
|
<div id="accordion-list-3" class="collapse" data-bs-parent=".accordion-list">
|
||||||
|
<p>
|
||||||
|
We create several version of APIs and update it , so you can use all version of APIs , old one and new one . you have to be care about use versions
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-5 align-items-stretch order-1 order-lg-2 img" style='background-image: url("assets/img/features.svg");' data-aos="zoom-in" data-aos-delay="150"> </div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section><!-- End Why Us Section -->
|
||||||
|
<!-- ======= Cta Section ======= -->
|
||||||
|
<section id="cta" class="cta ">
|
||||||
|
<div class="container" data-aos="zoom-in">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-9 text-center text-lg-start">
|
||||||
|
<h3>SWAGGER</h3>
|
||||||
|
<p>Swagger is one of the best API document generator , You can use swagger to read API document and test API , for using swagger you need to login and use you username and password</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 cta-btn-container text-center">
|
||||||
|
<a class="cta-btn align-middle" target="_blank" href="/swagger/index.html">Go to swagger</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section><!-- End Cta Section -->
|
||||||
|
<!-- ======= Skills Section ======= -->
|
||||||
|
<section id="skills" class="skills d-flex min-vh-100 flex-column justify-content-center">
|
||||||
|
<div class="container" data-aos="fade-up">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 d-flex align-items-center" data-aos="fade-right" data-aos-delay="100">
|
||||||
|
<img src="assets/img/skills.png" class="img-fluid" alt="">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 pt-4 pt-lg-0 content" data-aos="fade-left" data-aos-delay="100">
|
||||||
|
<h3>Framworks that we used in this project</h3>
|
||||||
|
<p class="fst-italic">
|
||||||
|
We use several frameworks to develope our projects , is this project we use hight teck and most popular frameworks and programming languages
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="skills-content">
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">.NET <i class="val">100%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">MicroServices <i class="val">100%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">Netina-Architecture <i class="val">100%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">DDD <i class="val">90%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">MediatR <i class="val">90%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="90" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="progress">
|
||||||
|
<span class="skill">Redis <i class="val">90%</i></span>
|
||||||
|
<div class="progress-bar-wrap">
|
||||||
|
<div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section><!-- End Skills Section -->
|
||||||
|
|
||||||
|
|
||||||
|
</main><!-- End #main -->
|
||||||
|
<!-- ======= Footer ======= -->
|
||||||
|
<footer id="footer">
|
||||||
|
|
||||||
|
<div class="footer-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-9 content align-items-center justify-content-center">
|
||||||
|
<h1 class="display-1">BrizCo API</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-3 col-md-6 footer-links">
|
||||||
|
<h4>Our Social Networks</h4>
|
||||||
|
<p>Cras fermentum odio eu feugiat lide par naso tierra videa magna derita valies</p>
|
||||||
|
<div class="social-links mt-3">
|
||||||
|
<a href="#" class="twitter"><i class="bx bxl-twitter"></i></a>
|
||||||
|
<a href="#" class="facebook"><i class="bx bxl-facebook"></i></a>
|
||||||
|
<a href="#" class="instagram"><i class="bx bxl-instagram"></i></a>
|
||||||
|
<a href="#" class="google-plus"><i class="bx bxl-skype"></i></a>
|
||||||
|
<a href="#" class="linkedin"><i class="bx bxl-linkedin"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container footer-bottom clearfix">
|
||||||
|
<div class="copyright">
|
||||||
|
© Copyright <strong><span>NetinaShop</span></strong>. All Rights Reserved
|
||||||
|
</div>
|
||||||
|
<div class="credits">
|
||||||
|
<!-- All the links in the footer should remain intact. -->
|
||||||
|
<!-- You can delete the links only if you purchased the pro version. -->
|
||||||
|
<!-- Licensing information: https://bootstrapmade.com/license/ -->
|
||||||
|
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/arsha-free-bootstrap-html-template-corporate/ -->
|
||||||
|
Designed by <a href="https://mr-mohande3.ir/" style="color:white;">Amir Hossein Khademi (MR.MOHANDE3)</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer><!-- End Footer -->
|
||||||
|
|
||||||
|
<div id="preloader"></div>
|
||||||
|
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
|
||||||
|
|
||||||
|
<!-- Vendor JS Files -->
|
||||||
|
<script src="assets/vendor/aos/aos.js"></script>
|
||||||
|
<script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
|
||||||
|
<script src="assets/vendor/waypoints/noframework.waypoints.js"></script>
|
||||||
|
|
||||||
|
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Template Main JS File -->
|
||||||
|
<script src="assets/js/main.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace NetinaShop.Api.Views.Home
|
||||||
|
{
|
||||||
|
public class IndexModel : PageModel
|
||||||
|
{
|
||||||
|
public string Version = typeof(Program).Assembly.GetName().Version.ToString();
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 1002 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 85 KiB |
|
@ -0,0 +1,257 @@
|
||||||
|
/**
|
||||||
|
* Template Name: Arsha - v4.9.1
|
||||||
|
* Template URL: https://bootstrapmade.com/arsha-free-bootstrap-html-template-corporate/
|
||||||
|
* Author: BootstrapMade.com
|
||||||
|
* License: https://bootstrapmade.com/license/
|
||||||
|
*/
|
||||||
|
(function() {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Easy selector helper function
|
||||||
|
*/
|
||||||
|
const select = (el, all = false) => {
|
||||||
|
el = el.trim()
|
||||||
|
if (all) {
|
||||||
|
return [...document.querySelectorAll(el)]
|
||||||
|
} else {
|
||||||
|
return document.querySelector(el)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Easy event listener function
|
||||||
|
*/
|
||||||
|
const on = (type, el, listener, all = false) => {
|
||||||
|
let selectEl = select(el, all)
|
||||||
|
if (selectEl) {
|
||||||
|
if (all) {
|
||||||
|
selectEl.forEach(e => e.addEventListener(type, listener))
|
||||||
|
} else {
|
||||||
|
selectEl.addEventListener(type, listener)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Easy on scroll event listener
|
||||||
|
*/
|
||||||
|
const onscroll = (el, listener) => {
|
||||||
|
el.addEventListener('scroll', listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navbar links active state on scroll
|
||||||
|
*/
|
||||||
|
let navbarlinks = select('#navbar .scrollto', true)
|
||||||
|
const navbarlinksActive = () => {
|
||||||
|
let position = window.scrollY + 200
|
||||||
|
navbarlinks.forEach(navbarlink => {
|
||||||
|
if (!navbarlink.hash) return
|
||||||
|
let section = select(navbarlink.hash)
|
||||||
|
if (!section) return
|
||||||
|
if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) {
|
||||||
|
navbarlink.classList.add('active')
|
||||||
|
} else {
|
||||||
|
navbarlink.classList.remove('active')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
window.addEventListener('load', navbarlinksActive)
|
||||||
|
onscroll(document, navbarlinksActive)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrolls to an element with header offset
|
||||||
|
*/
|
||||||
|
const scrollto = (el) => {
|
||||||
|
let header = select('#header')
|
||||||
|
let offset = header.offsetHeight
|
||||||
|
|
||||||
|
let elementPos = select(el).offsetTop
|
||||||
|
window.scrollTo({
|
||||||
|
top: elementPos - offset,
|
||||||
|
behavior: 'smooth'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle .header-scrolled class to #header when page is scrolled
|
||||||
|
*/
|
||||||
|
let selectHeader = select('#header')
|
||||||
|
if (selectHeader) {
|
||||||
|
const headerScrolled = () => {
|
||||||
|
if (window.scrollY > 100) {
|
||||||
|
selectHeader.classList.add('header-scrolled')
|
||||||
|
} else {
|
||||||
|
selectHeader.classList.remove('header-scrolled')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener('load', headerScrolled)
|
||||||
|
onscroll(document, headerScrolled)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Back to top button
|
||||||
|
*/
|
||||||
|
let backtotop = select('.back-to-top')
|
||||||
|
if (backtotop) {
|
||||||
|
const toggleBacktotop = () => {
|
||||||
|
if (window.scrollY > 100) {
|
||||||
|
backtotop.classList.add('active')
|
||||||
|
} else {
|
||||||
|
backtotop.classList.remove('active')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener('load', toggleBacktotop)
|
||||||
|
onscroll(document, toggleBacktotop)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mobile nav toggle
|
||||||
|
*/
|
||||||
|
on('click', '.mobile-nav-toggle', function(e) {
|
||||||
|
select('#navbar').classList.toggle('navbar-mobile')
|
||||||
|
this.classList.toggle('bi-list')
|
||||||
|
this.classList.toggle('bi-x')
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mobile nav dropdowns activate
|
||||||
|
*/
|
||||||
|
on('click', '.navbar .dropdown > a', function(e) {
|
||||||
|
if (select('#navbar').classList.contains('navbar-mobile')) {
|
||||||
|
e.preventDefault()
|
||||||
|
this.nextElementSibling.classList.toggle('dropdown-active')
|
||||||
|
}
|
||||||
|
}, true)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrool with ofset on links with a class name .scrollto
|
||||||
|
*/
|
||||||
|
on('click', '.scrollto', function(e) {
|
||||||
|
if (select(this.hash)) {
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
let navbar = select('#navbar')
|
||||||
|
if (navbar.classList.contains('navbar-mobile')) {
|
||||||
|
navbar.classList.remove('navbar-mobile')
|
||||||
|
let navbarToggle = select('.mobile-nav-toggle')
|
||||||
|
navbarToggle.classList.toggle('bi-list')
|
||||||
|
navbarToggle.classList.toggle('bi-x')
|
||||||
|
}
|
||||||
|
scrollto(this.hash)
|
||||||
|
}
|
||||||
|
}, true)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll with ofset on page load with hash links in the url
|
||||||
|
*/
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
if (window.location.hash) {
|
||||||
|
if (select(window.location.hash)) {
|
||||||
|
scrollto(window.location.hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preloader
|
||||||
|
*/
|
||||||
|
let preloader = select('#preloader');
|
||||||
|
if (preloader) {
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
preloader.remove()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiate glightbox
|
||||||
|
*/
|
||||||
|
const glightbox = GLightbox({
|
||||||
|
selector: '.glightbox'
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skills animation
|
||||||
|
*/
|
||||||
|
let skilsContent = select('.skills-content');
|
||||||
|
if (skilsContent) {
|
||||||
|
new Waypoint({
|
||||||
|
element: skilsContent,
|
||||||
|
offset: '80%',
|
||||||
|
handler: function(direction) {
|
||||||
|
let progress = select('.progress .progress-bar', true);
|
||||||
|
progress.forEach((el) => {
|
||||||
|
el.style.width = el.getAttribute('aria-valuenow') + '%'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Porfolio isotope and filter
|
||||||
|
*/
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
let portfolioContainer = select('.portfolio-container');
|
||||||
|
if (portfolioContainer) {
|
||||||
|
let portfolioIsotope = new Isotope(portfolioContainer, {
|
||||||
|
itemSelector: '.portfolio-item'
|
||||||
|
});
|
||||||
|
|
||||||
|
let portfolioFilters = select('#portfolio-flters li', true);
|
||||||
|
|
||||||
|
on('click', '#portfolio-flters li', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
portfolioFilters.forEach(function(el) {
|
||||||
|
el.classList.remove('filter-active');
|
||||||
|
});
|
||||||
|
this.classList.add('filter-active');
|
||||||
|
|
||||||
|
portfolioIsotope.arrange({
|
||||||
|
filter: this.getAttribute('data-filter')
|
||||||
|
});
|
||||||
|
portfolioIsotope.on('arrangeComplete', function() {
|
||||||
|
AOS.refresh()
|
||||||
|
});
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiate portfolio lightbox
|
||||||
|
*/
|
||||||
|
const portfolioLightbox = GLightbox({
|
||||||
|
selector: '.portfolio-lightbox'
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Portfolio details slider
|
||||||
|
*/
|
||||||
|
new Swiper('.portfolio-details-slider', {
|
||||||
|
speed: 400,
|
||||||
|
loop: true,
|
||||||
|
autoplay: {
|
||||||
|
delay: 5000,
|
||||||
|
disableOnInteraction: false
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
el: '.swiper-pagination',
|
||||||
|
type: 'bullets',
|
||||||
|
clickable: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation on scroll
|
||||||
|
*/
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
AOS.init({
|
||||||
|
duration: 1000,
|
||||||
|
easing: "ease-in-out",
|
||||||
|
once: true,
|
||||||
|
mirror: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})()
|
|
@ -0,0 +1 @@
|
||||||
|
The .scss (Sass) files are only avilable in the pro version. You can buy it from: https://bootstrapmade.com/arsha-free-bootstrap-html-template-corporate/
|
|
@ -0,0 +1,7 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="active" href="#home">Home</a>
|
||||||
|
<a href="#news">News</a>
|
||||||
|
<a href="#contact">Contact</a>
|
||||||
|
<a href="#about">About</a>
|
||||||
|
</div>
|
After Width: | Height: | Size: 1.2 MiB |
|
@ -0,0 +1,758 @@
|
||||||
|
/*!
|
||||||
|
Waypoints - 4.0.1
|
||||||
|
Copyright © 2011-2016 Caleb Troughton
|
||||||
|
Licensed under the MIT license.
|
||||||
|
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
|
||||||
|
*/
|
||||||
|
(function() {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
var keyCounter = 0
|
||||||
|
var allWaypoints = {}
|
||||||
|
|
||||||
|
/* http://imakewebthings.com/waypoints/api/waypoint */
|
||||||
|
function Waypoint(options) {
|
||||||
|
if (!options) {
|
||||||
|
throw new Error('No options passed to Waypoint constructor')
|
||||||
|
}
|
||||||
|
if (!options.element) {
|
||||||
|
throw new Error('No element option passed to Waypoint constructor')
|
||||||
|
}
|
||||||
|
if (!options.handler) {
|
||||||
|
throw new Error('No handler option passed to Waypoint constructor')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.key = 'waypoint-' + keyCounter
|
||||||
|
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
|
||||||
|
this.element = this.options.element
|
||||||
|
this.adapter = new Waypoint.Adapter(this.element)
|
||||||
|
this.callback = options.handler
|
||||||
|
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
|
||||||
|
this.enabled = this.options.enabled
|
||||||
|
this.triggerPoint = null
|
||||||
|
this.group = Waypoint.Group.findOrCreate({
|
||||||
|
name: this.options.group,
|
||||||
|
axis: this.axis
|
||||||
|
})
|
||||||
|
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
|
||||||
|
|
||||||
|
if (Waypoint.offsetAliases[this.options.offset]) {
|
||||||
|
this.options.offset = Waypoint.offsetAliases[this.options.offset]
|
||||||
|
}
|
||||||
|
this.group.add(this)
|
||||||
|
this.context.add(this)
|
||||||
|
allWaypoints[this.key] = this
|
||||||
|
keyCounter += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Waypoint.prototype.queueTrigger = function(direction) {
|
||||||
|
this.group.queueTrigger(this, direction)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Waypoint.prototype.trigger = function(args) {
|
||||||
|
if (!this.enabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.callback) {
|
||||||
|
this.callback.apply(this, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/destroy */
|
||||||
|
Waypoint.prototype.destroy = function() {
|
||||||
|
this.context.remove(this)
|
||||||
|
this.group.remove(this)
|
||||||
|
delete allWaypoints[this.key]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/disable */
|
||||||
|
Waypoint.prototype.disable = function() {
|
||||||
|
this.enabled = false
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/enable */
|
||||||
|
Waypoint.prototype.enable = function() {
|
||||||
|
this.context.refresh()
|
||||||
|
this.enabled = true
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/next */
|
||||||
|
Waypoint.prototype.next = function() {
|
||||||
|
return this.group.next(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/previous */
|
||||||
|
Waypoint.prototype.previous = function() {
|
||||||
|
return this.group.previous(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Waypoint.invokeAll = function(method) {
|
||||||
|
var allWaypointsArray = []
|
||||||
|
for (var waypointKey in allWaypoints) {
|
||||||
|
allWaypointsArray.push(allWaypoints[waypointKey])
|
||||||
|
}
|
||||||
|
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
|
||||||
|
allWaypointsArray[i][method]()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/destroy-all */
|
||||||
|
Waypoint.destroyAll = function() {
|
||||||
|
Waypoint.invokeAll('destroy')
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/disable-all */
|
||||||
|
Waypoint.disableAll = function() {
|
||||||
|
Waypoint.invokeAll('disable')
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/enable-all */
|
||||||
|
Waypoint.enableAll = function() {
|
||||||
|
Waypoint.Context.refreshAll()
|
||||||
|
for (var waypointKey in allWaypoints) {
|
||||||
|
allWaypoints[waypointKey].enabled = true
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/refresh-all */
|
||||||
|
Waypoint.refreshAll = function() {
|
||||||
|
Waypoint.Context.refreshAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/viewport-height */
|
||||||
|
Waypoint.viewportHeight = function() {
|
||||||
|
return window.innerHeight || document.documentElement.clientHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/viewport-width */
|
||||||
|
Waypoint.viewportWidth = function() {
|
||||||
|
return document.documentElement.clientWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
Waypoint.adapters = []
|
||||||
|
|
||||||
|
Waypoint.defaults = {
|
||||||
|
context: window,
|
||||||
|
continuous: true,
|
||||||
|
enabled: true,
|
||||||
|
group: 'default',
|
||||||
|
horizontal: false,
|
||||||
|
offset: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Waypoint.offsetAliases = {
|
||||||
|
'bottom-in-view': function() {
|
||||||
|
return this.context.innerHeight() - this.adapter.outerHeight()
|
||||||
|
},
|
||||||
|
'right-in-view': function() {
|
||||||
|
return this.context.innerWidth() - this.adapter.outerWidth()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.Waypoint = Waypoint
|
||||||
|
}())
|
||||||
|
;(function() {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
function requestAnimationFrameShim(callback) {
|
||||||
|
window.setTimeout(callback, 1000 / 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyCounter = 0
|
||||||
|
var contexts = {}
|
||||||
|
var Waypoint = window.Waypoint
|
||||||
|
var oldWindowLoad = window.onload
|
||||||
|
|
||||||
|
/* http://imakewebthings.com/waypoints/api/context */
|
||||||
|
function Context(element) {
|
||||||
|
this.element = element
|
||||||
|
this.Adapter = Waypoint.Adapter
|
||||||
|
this.adapter = new this.Adapter(element)
|
||||||
|
this.key = 'waypoint-context-' + keyCounter
|
||||||
|
this.didScroll = false
|
||||||
|
this.didResize = false
|
||||||
|
this.oldScroll = {
|
||||||
|
x: this.adapter.scrollLeft(),
|
||||||
|
y: this.adapter.scrollTop()
|
||||||
|
}
|
||||||
|
this.waypoints = {
|
||||||
|
vertical: {},
|
||||||
|
horizontal: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
element.waypointContextKey = this.key
|
||||||
|
contexts[element.waypointContextKey] = this
|
||||||
|
keyCounter += 1
|
||||||
|
if (!Waypoint.windowContext) {
|
||||||
|
Waypoint.windowContext = true
|
||||||
|
Waypoint.windowContext = new Context(window)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createThrottledScrollHandler()
|
||||||
|
this.createThrottledResizeHandler()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.add = function(waypoint) {
|
||||||
|
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
|
||||||
|
this.waypoints[axis][waypoint.key] = waypoint
|
||||||
|
this.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.checkEmpty = function() {
|
||||||
|
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
|
||||||
|
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
|
||||||
|
var isWindow = this.element == this.element.window
|
||||||
|
if (horizontalEmpty && verticalEmpty && !isWindow) {
|
||||||
|
this.adapter.off('.waypoints')
|
||||||
|
delete contexts[this.key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.createThrottledResizeHandler = function() {
|
||||||
|
var self = this
|
||||||
|
|
||||||
|
function resizeHandler() {
|
||||||
|
self.handleResize()
|
||||||
|
self.didResize = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.adapter.on('resize.waypoints', function() {
|
||||||
|
if (!self.didResize) {
|
||||||
|
self.didResize = true
|
||||||
|
Waypoint.requestAnimationFrame(resizeHandler)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.createThrottledScrollHandler = function() {
|
||||||
|
var self = this
|
||||||
|
function scrollHandler() {
|
||||||
|
self.handleScroll()
|
||||||
|
self.didScroll = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.adapter.on('scroll.waypoints', function() {
|
||||||
|
if (!self.didScroll || Waypoint.isTouch) {
|
||||||
|
self.didScroll = true
|
||||||
|
Waypoint.requestAnimationFrame(scrollHandler)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.handleResize = function() {
|
||||||
|
Waypoint.Context.refreshAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.handleScroll = function() {
|
||||||
|
var triggeredGroups = {}
|
||||||
|
var axes = {
|
||||||
|
horizontal: {
|
||||||
|
newScroll: this.adapter.scrollLeft(),
|
||||||
|
oldScroll: this.oldScroll.x,
|
||||||
|
forward: 'right',
|
||||||
|
backward: 'left'
|
||||||
|
},
|
||||||
|
vertical: {
|
||||||
|
newScroll: this.adapter.scrollTop(),
|
||||||
|
oldScroll: this.oldScroll.y,
|
||||||
|
forward: 'down',
|
||||||
|
backward: 'up'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var axisKey in axes) {
|
||||||
|
var axis = axes[axisKey]
|
||||||
|
var isForward = axis.newScroll > axis.oldScroll
|
||||||
|
var direction = isForward ? axis.forward : axis.backward
|
||||||
|
|
||||||
|
for (var waypointKey in this.waypoints[axisKey]) {
|
||||||
|
var waypoint = this.waypoints[axisKey][waypointKey]
|
||||||
|
if (waypoint.triggerPoint === null) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
|
||||||
|
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
|
||||||
|
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
|
||||||
|
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
|
||||||
|
if (crossedForward || crossedBackward) {
|
||||||
|
waypoint.queueTrigger(direction)
|
||||||
|
triggeredGroups[waypoint.group.id] = waypoint.group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var groupKey in triggeredGroups) {
|
||||||
|
triggeredGroups[groupKey].flushTriggers()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.oldScroll = {
|
||||||
|
x: axes.horizontal.newScroll,
|
||||||
|
y: axes.vertical.newScroll
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.innerHeight = function() {
|
||||||
|
/*eslint-disable eqeqeq */
|
||||||
|
if (this.element == this.element.window) {
|
||||||
|
return Waypoint.viewportHeight()
|
||||||
|
}
|
||||||
|
/*eslint-enable eqeqeq */
|
||||||
|
return this.adapter.innerHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.remove = function(waypoint) {
|
||||||
|
delete this.waypoints[waypoint.axis][waypoint.key]
|
||||||
|
this.checkEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.prototype.innerWidth = function() {
|
||||||
|
/*eslint-disable eqeqeq */
|
||||||
|
if (this.element == this.element.window) {
|
||||||
|
return Waypoint.viewportWidth()
|
||||||
|
}
|
||||||
|
/*eslint-enable eqeqeq */
|
||||||
|
return this.adapter.innerWidth()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/context-destroy */
|
||||||
|
Context.prototype.destroy = function() {
|
||||||
|
var allWaypoints = []
|
||||||
|
for (var axis in this.waypoints) {
|
||||||
|
for (var waypointKey in this.waypoints[axis]) {
|
||||||
|
allWaypoints.push(this.waypoints[axis][waypointKey])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0, end = allWaypoints.length; i < end; i++) {
|
||||||
|
allWaypoints[i].destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/context-refresh */
|
||||||
|
Context.prototype.refresh = function() {
|
||||||
|
/*eslint-disable eqeqeq */
|
||||||
|
var isWindow = this.element == this.element.window
|
||||||
|
/*eslint-enable eqeqeq */
|
||||||
|
var contextOffset = isWindow ? undefined : this.adapter.offset()
|
||||||
|
var triggeredGroups = {}
|
||||||
|
var axes
|
||||||
|
|
||||||
|
this.handleScroll()
|
||||||
|
axes = {
|
||||||
|
horizontal: {
|
||||||
|
contextOffset: isWindow ? 0 : contextOffset.left,
|
||||||
|
contextScroll: isWindow ? 0 : this.oldScroll.x,
|
||||||
|
contextDimension: this.innerWidth(),
|
||||||
|
oldScroll: this.oldScroll.x,
|
||||||
|
forward: 'right',
|
||||||
|
backward: 'left',
|
||||||
|
offsetProp: 'left'
|
||||||
|
},
|
||||||
|
vertical: {
|
||||||
|
contextOffset: isWindow ? 0 : contextOffset.top,
|
||||||
|
contextScroll: isWindow ? 0 : this.oldScroll.y,
|
||||||
|
contextDimension: this.innerHeight(),
|
||||||
|
oldScroll: this.oldScroll.y,
|
||||||
|
forward: 'down',
|
||||||
|
backward: 'up',
|
||||||
|
offsetProp: 'top'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var axisKey in axes) {
|
||||||
|
var axis = axes[axisKey]
|
||||||
|
for (var waypointKey in this.waypoints[axisKey]) {
|
||||||
|
var waypoint = this.waypoints[axisKey][waypointKey]
|
||||||
|
var adjustment = waypoint.options.offset
|
||||||
|
var oldTriggerPoint = waypoint.triggerPoint
|
||||||
|
var elementOffset = 0
|
||||||
|
var freshWaypoint = oldTriggerPoint == null
|
||||||
|
var contextModifier, wasBeforeScroll, nowAfterScroll
|
||||||
|
var triggeredBackward, triggeredForward
|
||||||
|
|
||||||
|
if (waypoint.element !== waypoint.element.window) {
|
||||||
|
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof adjustment === 'function') {
|
||||||
|
adjustment = adjustment.apply(waypoint)
|
||||||
|
}
|
||||||
|
else if (typeof adjustment === 'string') {
|
||||||
|
adjustment = parseFloat(adjustment)
|
||||||
|
if (waypoint.options.offset.indexOf('%') > - 1) {
|
||||||
|
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contextModifier = axis.contextScroll - axis.contextOffset
|
||||||
|
waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment)
|
||||||
|
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
|
||||||
|
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
|
||||||
|
triggeredBackward = wasBeforeScroll && nowAfterScroll
|
||||||
|
triggeredForward = !wasBeforeScroll && !nowAfterScroll
|
||||||
|
|
||||||
|
if (!freshWaypoint && triggeredBackward) {
|
||||||
|
waypoint.queueTrigger(axis.backward)
|
||||||
|
triggeredGroups[waypoint.group.id] = waypoint.group
|
||||||
|
}
|
||||||
|
else if (!freshWaypoint && triggeredForward) {
|
||||||
|
waypoint.queueTrigger(axis.forward)
|
||||||
|
triggeredGroups[waypoint.group.id] = waypoint.group
|
||||||
|
}
|
||||||
|
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
|
||||||
|
waypoint.queueTrigger(axis.forward)
|
||||||
|
triggeredGroups[waypoint.group.id] = waypoint.group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Waypoint.requestAnimationFrame(function() {
|
||||||
|
for (var groupKey in triggeredGroups) {
|
||||||
|
triggeredGroups[groupKey].flushTriggers()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.findOrCreateByElement = function(element) {
|
||||||
|
return Context.findByElement(element) || new Context(element)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Context.refreshAll = function() {
|
||||||
|
for (var contextId in contexts) {
|
||||||
|
contexts[contextId].refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
|
||||||
|
Context.findByElement = function(element) {
|
||||||
|
return contexts[element.waypointContextKey]
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (oldWindowLoad) {
|
||||||
|
oldWindowLoad()
|
||||||
|
}
|
||||||
|
Context.refreshAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Waypoint.requestAnimationFrame = function(callback) {
|
||||||
|
var requestFn = window.requestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
window.webkitRequestAnimationFrame ||
|
||||||
|
requestAnimationFrameShim
|
||||||
|
requestFn.call(window, callback)
|
||||||
|
}
|
||||||
|
Waypoint.Context = Context
|
||||||
|
}())
|
||||||
|
;(function() {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
function byTriggerPoint(a, b) {
|
||||||
|
return a.triggerPoint - b.triggerPoint
|
||||||
|
}
|
||||||
|
|
||||||
|
function byReverseTriggerPoint(a, b) {
|
||||||
|
return b.triggerPoint - a.triggerPoint
|
||||||
|
}
|
||||||
|
|
||||||
|
var groups = {
|
||||||
|
vertical: {},
|
||||||
|
horizontal: {}
|
||||||
|
}
|
||||||
|
var Waypoint = window.Waypoint
|
||||||
|
|
||||||
|
/* http://imakewebthings.com/waypoints/api/group */
|
||||||
|
function Group(options) {
|
||||||
|
this.name = options.name
|
||||||
|
this.axis = options.axis
|
||||||
|
this.id = this.name + '-' + this.axis
|
||||||
|
this.waypoints = []
|
||||||
|
this.clearTriggerQueues()
|
||||||
|
groups[this.axis][this.name] = this
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.add = function(waypoint) {
|
||||||
|
this.waypoints.push(waypoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.clearTriggerQueues = function() {
|
||||||
|
this.triggerQueues = {
|
||||||
|
up: [],
|
||||||
|
down: [],
|
||||||
|
left: [],
|
||||||
|
right: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.flushTriggers = function() {
|
||||||
|
for (var direction in this.triggerQueues) {
|
||||||
|
var waypoints = this.triggerQueues[direction]
|
||||||
|
var reverse = direction === 'up' || direction === 'left'
|
||||||
|
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
|
||||||
|
for (var i = 0, end = waypoints.length; i < end; i += 1) {
|
||||||
|
var waypoint = waypoints[i]
|
||||||
|
if (waypoint.options.continuous || i === waypoints.length - 1) {
|
||||||
|
waypoint.trigger([direction])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.clearTriggerQueues()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.next = function(waypoint) {
|
||||||
|
this.waypoints.sort(byTriggerPoint)
|
||||||
|
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
||||||
|
var isLast = index === this.waypoints.length - 1
|
||||||
|
return isLast ? null : this.waypoints[index + 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.previous = function(waypoint) {
|
||||||
|
this.waypoints.sort(byTriggerPoint)
|
||||||
|
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
||||||
|
return index ? this.waypoints[index - 1] : null
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.queueTrigger = function(waypoint, direction) {
|
||||||
|
this.triggerQueues[direction].push(waypoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.prototype.remove = function(waypoint) {
|
||||||
|
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
|
||||||
|
if (index > -1) {
|
||||||
|
this.waypoints.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/first */
|
||||||
|
Group.prototype.first = function() {
|
||||||
|
return this.waypoints[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Public */
|
||||||
|
/* http://imakewebthings.com/waypoints/api/last */
|
||||||
|
Group.prototype.last = function() {
|
||||||
|
return this.waypoints[this.waypoints.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private */
|
||||||
|
Group.findOrCreate = function(options) {
|
||||||
|
return groups[options.axis][options.name] || new Group(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
Waypoint.Group = Group
|
||||||
|
}())
|
||||||
|
;(function() {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
var Waypoint = window.Waypoint
|
||||||
|
|
||||||
|
function isWindow(element) {
|
||||||
|
return element === element.window
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWindow(element) {
|
||||||
|
if (isWindow(element)) {
|
||||||
|
return element
|
||||||
|
}
|
||||||
|
return element.defaultView
|
||||||
|
}
|
||||||
|
|
||||||
|
function NoFrameworkAdapter(element) {
|
||||||
|
this.element = element
|
||||||
|
this.handlers = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.innerHeight = function() {
|
||||||
|
var isWin = isWindow(this.element)
|
||||||
|
return isWin ? this.element.innerHeight : this.element.clientHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.innerWidth = function() {
|
||||||
|
var isWin = isWindow(this.element)
|
||||||
|
return isWin ? this.element.innerWidth : this.element.clientWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.off = function(event, handler) {
|
||||||
|
function removeListeners(element, listeners, handler) {
|
||||||
|
for (var i = 0, end = listeners.length - 1; i < end; i++) {
|
||||||
|
var listener = listeners[i]
|
||||||
|
if (!handler || handler === listener) {
|
||||||
|
element.removeEventListener(listener)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var eventParts = event.split('.')
|
||||||
|
var eventType = eventParts[0]
|
||||||
|
var namespace = eventParts[1]
|
||||||
|
var element = this.element
|
||||||
|
|
||||||
|
if (namespace && this.handlers[namespace] && eventType) {
|
||||||
|
removeListeners(element, this.handlers[namespace][eventType], handler)
|
||||||
|
this.handlers[namespace][eventType] = []
|
||||||
|
}
|
||||||
|
else if (eventType) {
|
||||||
|
for (var ns in this.handlers) {
|
||||||
|
removeListeners(element, this.handlers[ns][eventType] || [], handler)
|
||||||
|
this.handlers[ns][eventType] = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (namespace && this.handlers[namespace]) {
|
||||||
|
for (var type in this.handlers[namespace]) {
|
||||||
|
removeListeners(element, this.handlers[namespace][type], handler)
|
||||||
|
}
|
||||||
|
this.handlers[namespace] = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Adapted from jQuery 1.x offset() */
|
||||||
|
NoFrameworkAdapter.prototype.offset = function() {
|
||||||
|
if (!this.element.ownerDocument) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
var documentElement = this.element.ownerDocument.documentElement
|
||||||
|
var win = getWindow(this.element.ownerDocument)
|
||||||
|
var rect = {
|
||||||
|
top: 0,
|
||||||
|
left: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.element.getBoundingClientRect) {
|
||||||
|
rect = this.element.getBoundingClientRect()
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
top: rect.top + win.pageYOffset - documentElement.clientTop,
|
||||||
|
left: rect.left + win.pageXOffset - documentElement.clientLeft
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.on = function(event, handler) {
|
||||||
|
var eventParts = event.split('.')
|
||||||
|
var eventType = eventParts[0]
|
||||||
|
var namespace = eventParts[1] || '__default'
|
||||||
|
var nsHandlers = this.handlers[namespace] = this.handlers[namespace] || {}
|
||||||
|
var nsTypeList = nsHandlers[eventType] = nsHandlers[eventType] || []
|
||||||
|
|
||||||
|
nsTypeList.push(handler)
|
||||||
|
this.element.addEventListener(eventType, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.outerHeight = function(includeMargin) {
|
||||||
|
var height = this.innerHeight()
|
||||||
|
var computedStyle
|
||||||
|
|
||||||
|
if (includeMargin && !isWindow(this.element)) {
|
||||||
|
computedStyle = window.getComputedStyle(this.element)
|
||||||
|
height += parseInt(computedStyle.marginTop, 10)
|
||||||
|
height += parseInt(computedStyle.marginBottom, 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
return height
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.outerWidth = function(includeMargin) {
|
||||||
|
var width = this.innerWidth()
|
||||||
|
var computedStyle
|
||||||
|
|
||||||
|
if (includeMargin && !isWindow(this.element)) {
|
||||||
|
computedStyle = window.getComputedStyle(this.element)
|
||||||
|
width += parseInt(computedStyle.marginLeft, 10)
|
||||||
|
width += parseInt(computedStyle.marginRight, 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
return width
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.scrollLeft = function() {
|
||||||
|
var win = getWindow(this.element)
|
||||||
|
return win ? win.pageXOffset : this.element.scrollLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.prototype.scrollTop = function() {
|
||||||
|
var win = getWindow(this.element)
|
||||||
|
return win ? win.pageYOffset : this.element.scrollTop
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.extend = function() {
|
||||||
|
var args = Array.prototype.slice.call(arguments)
|
||||||
|
|
||||||
|
function merge(target, obj) {
|
||||||
|
if (typeof target === 'object' && typeof obj === 'object') {
|
||||||
|
for (var key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
target[key] = obj[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return target
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 1, end = args.length; i < end; i++) {
|
||||||
|
merge(args[0], args[i])
|
||||||
|
}
|
||||||
|
return args[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.inArray = function(element, array, i) {
|
||||||
|
return array == null ? -1 : array.indexOf(element, i)
|
||||||
|
}
|
||||||
|
|
||||||
|
NoFrameworkAdapter.isEmptyObject = function(obj) {
|
||||||
|
/* eslint no-unused-vars: 0 */
|
||||||
|
for (var name in obj) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
Waypoint.adapters.push({
|
||||||
|
name: 'noframework',
|
||||||
|
Adapter: NoFrameworkAdapter
|
||||||
|
})
|
||||||
|
Waypoint.Adapter = NoFrameworkAdapter
|
||||||
|
}())
|
||||||
|
;
|
|
@ -101,6 +101,11 @@ public static class ApplicationClaims
|
||||||
Type = CustomClaimType.Permission,
|
Type = CustomClaimType.Permission,
|
||||||
Value = ApplicationPermission.AddReview,
|
Value = ApplicationPermission.AddReview,
|
||||||
};
|
};
|
||||||
|
public static ClaimDto ConfirmReview { get; } = new ClaimDto
|
||||||
|
{
|
||||||
|
Type = CustomClaimType.Permission,
|
||||||
|
Value = ApplicationPermission.ConfirmReview,
|
||||||
|
};
|
||||||
|
|
||||||
public static ClaimDto ViewWarehouses { get; } = new ClaimDto
|
public static ClaimDto ViewWarehouses { get; } = new ClaimDto
|
||||||
{
|
{
|
||||||
|
@ -164,6 +169,7 @@ public static class ApplicationClaims
|
||||||
ViewProducts,
|
ViewProducts,
|
||||||
ManageReview,
|
ManageReview,
|
||||||
AddReview,
|
AddReview,
|
||||||
|
ConfirmReview,
|
||||||
ViewAllReviews,
|
ViewAllReviews,
|
||||||
ViewMineReviews,
|
ViewMineReviews,
|
||||||
ManageWarehouses,
|
ManageWarehouses,
|
||||||
|
@ -194,6 +200,7 @@ public static class ApplicationClaims
|
||||||
ViewProducts.GetClaim,
|
ViewProducts.GetClaim,
|
||||||
ManageReview.GetClaim,
|
ManageReview.GetClaim,
|
||||||
AddReview.GetClaim,
|
AddReview.GetClaim,
|
||||||
|
ConfirmReview.GetClaim,
|
||||||
ViewAllReviews.GetClaim,
|
ViewAllReviews.GetClaim,
|
||||||
ViewMineReviews.GetClaim,
|
ViewMineReviews.GetClaim,
|
||||||
ManageWarehouses.GetClaim,
|
ManageWarehouses.GetClaim,
|
||||||
|
|
|
@ -24,6 +24,7 @@ public static class ApplicationPermission
|
||||||
|
|
||||||
public const string ManageReview = nameof(AddReview);
|
public const string ManageReview = nameof(AddReview);
|
||||||
public const string AddReview = nameof(AddReview);
|
public const string AddReview = nameof(AddReview);
|
||||||
|
public const string ConfirmReview = nameof(ConfirmReview);
|
||||||
public const string ViewAllReviews = nameof(ViewAllReviews);
|
public const string ViewAllReviews = nameof(ViewAllReviews);
|
||||||
public const string ViewMineReviews = nameof(ViewMineReviews);
|
public const string ViewMineReviews = nameof(ViewMineReviews);
|
||||||
|
|
||||||
|
|