Browse Source

Refactor vs.js

pull/625/head
Halil ibrahim Kalkan 8 years ago
parent
commit
1b83e94a22
  1. 2
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
  2. 145
      modules/docs/src/Volo.Docs.Web/Pages/Documents/vs.js

2
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

@ -25,7 +25,6 @@
@section scripts {
<abp-script-bundle name="@typeof(IndexModel).FullName">
<abp-script src="/lib/anchor-js/anchor.js" />
<abp-script src="/Pages/Documents/Project/index.js" />
<abp-script src="/lib/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js" />
<abp-script src="/lib/clipboard/dist/clipboard.js" />
<abp-script src="/lib/prismjs/prism.js" />
@ -37,6 +36,7 @@
<abp-script src="/lib/popper.js/dist/umd/popper.min.js" />
<abp-script src="/lib/bootstrap-toc/bootstrap-toc.js" />
<abp-script src="/Pages/Documents/vs.js" />
<abp-script src="/Pages/Documents/Project/index.js" />
</abp-script-bundle>
}
<div class="docs-page" data-spy="scroll" data-target="#docs-sticky-index">

145
modules/docs/src/Volo.Docs.Web/Pages/Documents/vs.js

@ -1,91 +1,82 @@
$('li:not(.last-link) a.tree-toggle').click(function () {
$(this).parent().children('ul.tree').toggle(100);
$(this).closest("li").toggleClass("selected-tree");
});
$('li:not(.last-link) span.plus-icon i.fa-chevron-right').click(function () {
var $element = $(this).parent();
$element.parent().children('ul.tree').toggle(100);
$element.closest("li").toggleClass("selected-tree");
});
(function ($) {
$(function () {
$('li:not(.last-link) a.tree-toggle').click(function () {
$(this).parent().children('ul.tree').toggle(100);
$(this).closest("li").toggleClass("selected-tree");
});
$('li:not(.last-link) span.plus-icon i.fa-chevron-right').click(function () {
$(document).ready(function () {
var scrollTopBtn = $(".scroll-top-btn");
var enoughHeight = $(".docs-sidebar-wrapper > .docs-top").height() + 60;
var $element = $(this).parent();
$(window).scroll(function () {
var topPos = $(window).scrollTop();
if (topPos > enoughHeight) {
$(scrollTopBtn).addClass("showup");
$("body").addClass("scrolled");
} else {
$(scrollTopBtn).removeClass("showup");
$("body").removeClass("scrolled");
}
});
$(scrollTopBtn).click(function () {
$('html, body').animate({
scrollTop: 0
}, 500);
return false;
});
$element.parent().children('ul.tree').toggle(100);
$element.closest("li").toggleClass("selected-tree");
});
});
var scrollTopBtn = $(".scroll-top-btn");
var enoughHeight = $(".docs-sidebar-wrapper > .docs-top").height() + 60;
$(window).scroll(function () {
var topPos = $(window).scrollTop();
if (topPos > enoughHeight) {
$(scrollTopBtn).addClass("showup");
$("body").addClass("scrolled");
} else {
$(scrollTopBtn).removeClass("showup");
$("body").removeClass("scrolled");
}
});
$(document).ready(function () {
var navSelector = '#docs-sticky-index';
var $myNav = $(navSelector);
Toc.init($myNav);
$('body').scrollspy({
target: $myNav
});
$("#docs-sticky-index a").on('click', function (event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$(scrollTopBtn).click(function () {
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 500, function () {
window.location.hash = hash;
});
}
});
});
$('.btn-toggle').on("click", function () {
$(".toggle-row").slideToggle(400);
$(this).toggleClass("less");
});
scrollTop: 0
}, 500);
return false;
});
$('.close-mmenu').on("click", function () {
$(".navbar-collapse").removeClass("show");
});
var navSelector = '#docs-sticky-index';
var $myNav = $(navSelector);
Toc.init($myNav);
$('body').scrollspy({
target: $myNav
});
$("#docs-sticky-index a").on('click', function (event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 500, function () {
window.location.hash = hash;
});
}
});
$('.open-dmenu').on("click", function () {
$(".docs-tree-list").slideToggle();
});
$('.btn-toggle').on("click", function () {
$(".toggle-row").slideToggle(400);
$(this).toggleClass("less");
});
$('.close-mmenu').on("click", function () {
$(".navbar-collapse").removeClass("show");
});
(function ($) {
$('.open-dmenu').on("click", function () {
$(".docs-tree-list").slideToggle();
});
$(window).on("load", function () {
$("#sidebar-scroll").mCustomScrollbar({
theme: "minimal"
$(window).on("load", function () {
$("#sidebar-scroll").mCustomScrollbar({
theme: "minimal"
});
});
});
$(window).on("load", function () {
$("#scroll-index").mCustomScrollbar({
theme: "minimal-dark"
$(window).on("load", function () {
$("#scroll-index").mCustomScrollbar({
theme: "minimal-dark"
});
});
});
window.Toc.helpers.createNavList = function () {
return $('<ul class="nav nav-pills flex-column"></ul>');
};
@ -104,10 +95,4 @@ $('.open-dmenu').on("click", function () {
$li.append($a);
return $li;
};
})(jQuery);
})(jQuery);
Loading…
Cancel
Save