mirror of https://github.com/abpframework/abp
parent
d766d36d6a
commit
2c36e51ff3
@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"useTabs": true
|
||||
}
|
@ -1,311 +1,343 @@
|
||||
(function ($) {
|
||||
|
||||
$(function () {
|
||||
var initNavigationFilter = function (navigationContainerId) {
|
||||
|
||||
var $navigation = $("#" + navigationContainerId);
|
||||
|
||||
var getShownDocumentLinks = function () {
|
||||
return $navigation.find(".mCSB_container > li a:visible").not(".tree-toggle");
|
||||
};
|
||||
|
||||
var gotoFilteredDocumentIfThereIsOnlyOne = function () {
|
||||
var $links = getShownDocumentLinks();
|
||||
if ($links.length === 1) {
|
||||
var url = $links.first().attr("href");
|
||||
if (url === "javascript:;") {
|
||||
return;
|
||||
}
|
||||
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
var filterDocumentItems = function (filterText) {
|
||||
$navigation.find(".mCSB_container .opened").removeClass("opened");
|
||||
$navigation.find(".mCSB_container > li, .mCSB_container > li ul").hide();
|
||||
|
||||
if (!filterText) {
|
||||
$navigation.find(".mCSB_container > li").show();
|
||||
$navigation.find(".mCSB_container .selected-tree > ul").show();
|
||||
return;
|
||||
}
|
||||
|
||||
var filteredItems = $navigation.find("li > a").filter(function () {
|
||||
return $(this).text().toUpperCase().indexOf(filterText.toUpperCase()) > -1;
|
||||
});
|
||||
|
||||
filteredItems.each(function () {
|
||||
|
||||
var $el = $(this);
|
||||
$el.show();
|
||||
var $parent = $el.parent();
|
||||
|
||||
var hasParent = true;
|
||||
while (hasParent) {
|
||||
if ($parent.attr("id") === navigationContainerId) {
|
||||
break;
|
||||
}
|
||||
|
||||
$parent.show();
|
||||
$parent.find("> li > label").not(".last-link").addClass("opened");
|
||||
|
||||
$parent = $parent.parent();
|
||||
hasParent = $parent.length > 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$("#filter").keyup(function (e) {
|
||||
filterDocumentItems(e.target.value);
|
||||
|
||||
if (e.key === "Enter") {
|
||||
gotoFilteredDocumentIfThereIsOnlyOne();
|
||||
}
|
||||
});
|
||||
|
||||
$("#fullsearch").keyup(function (e) {
|
||||
if (e.key === "Enter") {
|
||||
window.open($(this).data("fullsearch-url") + this.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var initAnchorTags = function (container) {
|
||||
anchors.options = {
|
||||
placement: 'left'
|
||||
};
|
||||
|
||||
var anchorTags = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
||||
anchorTags.forEach(function (tag) {
|
||||
anchors.add(container + " " + tag);
|
||||
});
|
||||
};
|
||||
|
||||
var initSocialShareLinks = function () {
|
||||
var pageHeader = $(".docs-body").find("h1, h2").first().text();
|
||||
|
||||
var projectName = $('#ProjectName')[0].innerText;
|
||||
|
||||
$('#TwitterShareLink').attr('href',
|
||||
'https://twitter.com/intent/tweet?text=' + encodeURI(pageHeader + " | " + projectName + " | " + window.location.href)
|
||||
);
|
||||
|
||||
$('#LinkedinShareLink').attr('href',
|
||||
'https://www.linkedin.com/shareArticle?'
|
||||
+ 'url=' + encodeURI(window.location.href) + '&'
|
||||
+ 'mini=true&'
|
||||
+ "summary=" + encodeURI(projectName) + '&'
|
||||
+ "title=" + encodeURI(pageHeader) + '&'
|
||||
+ "source=" + encodeURI($('#GoToMainWebSite').attr('href'))
|
||||
);
|
||||
|
||||
$('#EmailShareLink').attr('href',
|
||||
'mailto:?'
|
||||
+ 'body=' + encodeURI('I want you to look at ' + window.location.href) + '&'
|
||||
+ "subject=" + encodeURI(pageHeader + ' | ' + projectName) + '&'
|
||||
);
|
||||
};
|
||||
|
||||
var initSections = function () {
|
||||
var clearQueryString = function () {
|
||||
var uri = window.location.href.toString();
|
||||
|
||||
if (uri.indexOf("?") > 0) {
|
||||
uri = uri.substring(0, uri.indexOf("?"));
|
||||
}
|
||||
|
||||
window.history.replaceState({}, document.title, uri);
|
||||
};
|
||||
|
||||
var setQueryString = function () {
|
||||
var comboboxes = $(".doc-section-combobox");
|
||||
if (comboboxes.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hash = document.location.hash;
|
||||
|
||||
clearQueryString();
|
||||
|
||||
var uri = window.location.href.toString();
|
||||
|
||||
var new_uri = uri + "?";
|
||||
|
||||
for (var i = 0; i < comboboxes.length; i++) {
|
||||
var key = $(comboboxes[i]).data('key');
|
||||
var value = comboboxes[i].value;
|
||||
|
||||
new_uri += key + "=" + value;
|
||||
|
||||
if (i !== comboboxes.length - 1) {
|
||||
new_uri += "&";
|
||||
}
|
||||
}
|
||||
|
||||
window.history.replaceState({}, document.title, new_uri + hash);
|
||||
};
|
||||
|
||||
var getTenYearsLater = function () {
|
||||
var tenYearsLater = new Date();
|
||||
tenYearsLater.setTime(tenYearsLater.getTime() + (365 * 10 * 24 * 60 * 60 * 1000));
|
||||
return tenYearsLater;
|
||||
};
|
||||
|
||||
var setCookies = function () {
|
||||
var cookie = abp.utils.getCookieValue("AbpDocsPreferences");
|
||||
|
||||
if (!cookie || cookie == null || cookie === null) {
|
||||
cookie = "";
|
||||
}
|
||||
var keyValues = cookie.split("|");
|
||||
|
||||
var comboboxes = $(".doc-section-combobox");
|
||||
|
||||
for (var i = 0; i < comboboxes.length; i++) {
|
||||
var key = $(comboboxes[i]).data('key');
|
||||
var value = comboboxes[i].value;
|
||||
|
||||
var changed = false;
|
||||
var keyValueslength = keyValues.length;
|
||||
for (var k = 0; k < keyValueslength; k++) {
|
||||
var splitted = keyValues[k].split("=");
|
||||
|
||||
if (splitted.length > 0 && splitted[0] === key) {
|
||||
keyValues[k] = key + "=" + value;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed) {
|
||||
keyValues.push(key + "=" + value);
|
||||
}
|
||||
}
|
||||
|
||||
abp.utils.setCookieValue("AbpDocsPreferences", keyValues.join('|'), getTenYearsLater(), '/');
|
||||
};
|
||||
|
||||
$(".doc-section-combobox").change(function () {
|
||||
setCookies();
|
||||
clearQueryString();
|
||||
location.reload();
|
||||
});
|
||||
|
||||
setQueryString();
|
||||
};
|
||||
|
||||
var initCrawlerLinks = function () {
|
||||
|
||||
var isCrawler = function () {
|
||||
var crawlers = [
|
||||
'Google',
|
||||
'Googlebot',
|
||||
'YandexBot',
|
||||
'msnbot',
|
||||
'Rambler',
|
||||
'Yahoo',
|
||||
'AbachoBOT',
|
||||
'accoona',
|
||||
'AcoiRobot',
|
||||
'ASPSeek',
|
||||
'CrocCrawler',
|
||||
'Dumbot',
|
||||
'FAST-WebCrawler',
|
||||
'GeonaBot',
|
||||
'Gigabot',
|
||||
'Lycos',
|
||||
'MSRBOT',
|
||||
'Scooter',
|
||||
'AltaVista',
|
||||
'IDBot',
|
||||
'eStyle',
|
||||
'Scrubby',
|
||||
'Slurp',
|
||||
'DuckDuckBot',
|
||||
'Baiduspider',
|
||||
'VoilaBot',
|
||||
'ExaLead',
|
||||
'Search Dog',
|
||||
'MSN Bot',
|
||||
'BingBot'
|
||||
];
|
||||
|
||||
var agent = navigator.userAgent;
|
||||
|
||||
for (var i = 0; i < crawlers.length; i++) {
|
||||
|
||||
if (agent.indexOf(crawlers[i]) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (!isCrawler()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var comboboxes = $(".doc-section-combobox");
|
||||
|
||||
if (comboboxes.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#crawler_link").show();
|
||||
|
||||
var html = '';
|
||||
|
||||
var currentUrl = window.location.href.toString();
|
||||
|
||||
if (currentUrl.indexOf("?") > 0) {
|
||||
currentUrl = currentUrl.substring(0, currentUrl.indexOf("?"));
|
||||
}
|
||||
|
||||
var getQueryStringsFromComboboxes = function (x) {
|
||||
if (x >= comboboxes.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var key = $(comboboxes[x]).data("key");
|
||||
|
||||
var queryStrings = getQueryStringsFromComboboxes(x + 1);
|
||||
var returnList = [];
|
||||
|
||||
$(comboboxes[x]).find("option").each(function () {
|
||||
|
||||
if (queryStrings.length <= 0) {
|
||||
returnList.push(key + "=" + $(this).val());
|
||||
|
||||
} else {
|
||||
for (var k = 0; k < queryStrings.length; k++) {
|
||||
returnList.push(key + "=" + $(this).val() + "&" + queryStrings[k]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return returnList;
|
||||
};
|
||||
|
||||
var queryStrings = getQueryStringsFromComboboxes(0);
|
||||
|
||||
for (var i = 0; i < queryStrings.length; i++) {
|
||||
html += "<a href=\"" + currentUrl + "?" + queryStrings[i] + "\">" + queryStrings[i] + "</a> "
|
||||
}
|
||||
|
||||
$("#crawler_link").html(html);
|
||||
};
|
||||
|
||||
initNavigationFilter("sidebar-scroll");
|
||||
|
||||
initAnchorTags(".docs-page .docs-body");
|
||||
|
||||
initSocialShareLinks();
|
||||
|
||||
initSections();
|
||||
|
||||
initCrawlerLinks();
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
$(function () {
|
||||
var initNavigationFilter = function (navigationContainerId) {
|
||||
var $navigation = $('#' + navigationContainerId);
|
||||
|
||||
var getShownDocumentLinks = function () {
|
||||
return $navigation
|
||||
.find('.mCSB_container > li a:visible')
|
||||
.not('.tree-toggle');
|
||||
};
|
||||
|
||||
var gotoFilteredDocumentIfThereIsOnlyOne = function () {
|
||||
var $links = getShownDocumentLinks();
|
||||
if ($links.length === 1) {
|
||||
var url = $links.first().attr('href');
|
||||
if (url === 'javascript:;') {
|
||||
return;
|
||||
}
|
||||
|
||||
window.location = url;
|
||||
}
|
||||
};
|
||||
|
||||
var filterDocumentItems = function (filterText) {
|
||||
$navigation.find('.mCSB_container .opened').removeClass('opened');
|
||||
$navigation
|
||||
.find('.mCSB_container > li, .mCSB_container > li ul')
|
||||
.hide();
|
||||
|
||||
if (!filterText) {
|
||||
$navigation.find('.mCSB_container > li').show();
|
||||
$navigation.find('.mCSB_container .selected-tree > ul').show();
|
||||
return;
|
||||
}
|
||||
|
||||
var filteredItems = $navigation.find('li > a').filter(function () {
|
||||
return (
|
||||
$(this).text().toUpperCase().indexOf(filterText.toUpperCase()) > -1
|
||||
);
|
||||
});
|
||||
|
||||
filteredItems.each(function () {
|
||||
var $el = $(this);
|
||||
$el.show();
|
||||
var $parent = $el.parent();
|
||||
|
||||
var hasParent = true;
|
||||
while (hasParent) {
|
||||
if ($parent.attr('id') === navigationContainerId) {
|
||||
break;
|
||||
}
|
||||
|
||||
$parent.show();
|
||||
$parent.find('> li > label').not('.last-link').addClass('opened');
|
||||
|
||||
$parent = $parent.parent();
|
||||
hasParent = $parent.length > 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$('#filter').keyup(function (e) {
|
||||
filterDocumentItems(e.target.value);
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
gotoFilteredDocumentIfThereIsOnlyOne();
|
||||
}
|
||||
});
|
||||
|
||||
$('#fullsearch').keyup(function (e) {
|
||||
if (e.key === 'Enter') {
|
||||
window.open($(this).data('fullsearch-url') + this.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var initAnchorTags = function (container) {
|
||||
anchors.options = {
|
||||
placement: 'left',
|
||||
};
|
||||
|
||||
var anchorTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
||||
anchorTags.forEach(function (tag) {
|
||||
anchors.add(container + ' ' + tag);
|
||||
});
|
||||
};
|
||||
|
||||
var initSocialShareLinks = function () {
|
||||
var pageHeader = $('.docs-body').find('h1, h2').first().text();
|
||||
|
||||
var projectName = $('#ProjectName')[0].innerText;
|
||||
|
||||
$('#TwitterShareLink').attr(
|
||||
'href',
|
||||
'https://twitter.com/intent/tweet?text=' +
|
||||
encodeURI(
|
||||
pageHeader + ' | ' + projectName + ' | ' + window.location.href
|
||||
)
|
||||
);
|
||||
|
||||
$('#LinkedinShareLink').attr(
|
||||
'href',
|
||||
'https://www.linkedin.com/shareArticle?' +
|
||||
'url=' +
|
||||
encodeURI(window.location.href) +
|
||||
'&' +
|
||||
'mini=true&' +
|
||||
'summary=' +
|
||||
encodeURI(projectName) +
|
||||
'&' +
|
||||
'title=' +
|
||||
encodeURI(pageHeader) +
|
||||
'&' +
|
||||
'source=' +
|
||||
encodeURI($('#GoToMainWebSite').attr('href'))
|
||||
);
|
||||
|
||||
$('#EmailShareLink').attr(
|
||||
'href',
|
||||
'mailto:?' +
|
||||
'body=' +
|
||||
encodeURI('I want you to look at ' + window.location.href) +
|
||||
'&' +
|
||||
'subject=' +
|
||||
encodeURI(pageHeader + ' | ' + projectName) +
|
||||
'&'
|
||||
);
|
||||
};
|
||||
|
||||
var initSections = function () {
|
||||
var clearQueryString = function () {
|
||||
var uri = window.location.href.toString();
|
||||
|
||||
if (uri.indexOf('?') > 0) {
|
||||
uri = uri.substring(0, uri.indexOf('?'));
|
||||
}
|
||||
|
||||
window.history.replaceState({}, document.title, uri);
|
||||
};
|
||||
|
||||
var setQueryString = function () {
|
||||
var comboboxes = $('.doc-section-combobox');
|
||||
if (comboboxes.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hash = document.location.hash;
|
||||
|
||||
clearQueryString();
|
||||
|
||||
var uri = window.location.href.toString();
|
||||
|
||||
var new_uri = uri + '?';
|
||||
|
||||
for (var i = 0; i < comboboxes.length; i++) {
|
||||
var key = $(comboboxes[i]).data('key');
|
||||
var value = comboboxes[i].value;
|
||||
|
||||
new_uri += key + '=' + value;
|
||||
|
||||
if (i !== comboboxes.length - 1) {
|
||||
new_uri += '&';
|
||||
}
|
||||
}
|
||||
|
||||
window.history.replaceState({}, document.title, new_uri + hash);
|
||||
};
|
||||
|
||||
var getTenYearsLater = function () {
|
||||
var tenYearsLater = new Date();
|
||||
tenYearsLater.setTime(
|
||||
tenYearsLater.getTime() + 365 * 10 * 24 * 60 * 60 * 1000
|
||||
);
|
||||
return tenYearsLater;
|
||||
};
|
||||
|
||||
var setCookies = function () {
|
||||
var cookie = abp.utils.getCookieValue('AbpDocsPreferences');
|
||||
|
||||
if (!cookie || cookie == null || cookie === null) {
|
||||
cookie = '';
|
||||
}
|
||||
var keyValues = cookie.split('|');
|
||||
|
||||
var comboboxes = $('.doc-section-combobox');
|
||||
|
||||
for (var i = 0; i < comboboxes.length; i++) {
|
||||
var key = $(comboboxes[i]).data('key');
|
||||
var value = comboboxes[i].value;
|
||||
|
||||
var changed = false;
|
||||
var keyValueslength = keyValues.length;
|
||||
for (var k = 0; k < keyValueslength; k++) {
|
||||
var splitted = keyValues[k].split('=');
|
||||
|
||||
if (splitted.length > 0 && splitted[0] === key) {
|
||||
keyValues[k] = key + '=' + value;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed) {
|
||||
keyValues.push(key + '=' + value);
|
||||
}
|
||||
}
|
||||
|
||||
abp.utils.setCookieValue(
|
||||
'AbpDocsPreferences',
|
||||
keyValues.join('|'),
|
||||
getTenYearsLater(),
|
||||
'/'
|
||||
);
|
||||
};
|
||||
|
||||
$('.doc-section-combobox').change(function () {
|
||||
setCookies();
|
||||
clearQueryString();
|
||||
location.reload();
|
||||
});
|
||||
|
||||
setQueryString();
|
||||
};
|
||||
|
||||
var initCrawlerLinks = function () {
|
||||
var isCrawler = function () {
|
||||
var crawlers = [
|
||||
'Google',
|
||||
'Googlebot',
|
||||
'YandexBot',
|
||||
'msnbot',
|
||||
'Rambler',
|
||||
'Yahoo',
|
||||
'AbachoBOT',
|
||||
'accoona',
|
||||
'AcoiRobot',
|
||||
'ASPSeek',
|
||||
'CrocCrawler',
|
||||
'Dumbot',
|
||||
'FAST-WebCrawler',
|
||||
'GeonaBot',
|
||||
'Gigabot',
|
||||
'Lycos',
|
||||
'MSRBOT',
|
||||
'Scooter',
|
||||
'AltaVista',
|
||||
'IDBot',
|
||||
'eStyle',
|
||||
'Scrubby',
|
||||
'Slurp',
|
||||
'DuckDuckBot',
|
||||
'Baiduspider',
|
||||
'VoilaBot',
|
||||
'ExaLead',
|
||||
'Search Dog',
|
||||
'MSN Bot',
|
||||
'BingBot',
|
||||
];
|
||||
|
||||
var agent = navigator.userAgent;
|
||||
|
||||
for (var i = 0; i < crawlers.length; i++) {
|
||||
if (agent.indexOf(crawlers[i]) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (!isCrawler()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var comboboxes = $('.doc-section-combobox');
|
||||
|
||||
if (comboboxes.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#crawler_link').show();
|
||||
|
||||
var html = '';
|
||||
|
||||
var currentUrl = window.location.href.toString();
|
||||
|
||||
if (currentUrl.indexOf('?') > 0) {
|
||||
currentUrl = currentUrl.substring(0, currentUrl.indexOf('?'));
|
||||
}
|
||||
|
||||
var getQueryStringsFromComboboxes = function (x) {
|
||||
if (x >= comboboxes.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var key = $(comboboxes[x]).data('key');
|
||||
|
||||
var queryStrings = getQueryStringsFromComboboxes(x + 1);
|
||||
var returnList = [];
|
||||
|
||||
$(comboboxes[x])
|
||||
.find('option')
|
||||
.each(function () {
|
||||
if (queryStrings.length <= 0) {
|
||||
returnList.push(key + '=' + $(this).val());
|
||||
} else {
|
||||
for (var k = 0; k < queryStrings.length; k++) {
|
||||
returnList.push(
|
||||
key + '=' + $(this).val() + '&' + queryStrings[k]
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return returnList;
|
||||
};
|
||||
|
||||
var queryStrings = getQueryStringsFromComboboxes(0);
|
||||
|
||||
for (var i = 0; i < queryStrings.length; i++) {
|
||||
html +=
|
||||
'<a href="' +
|
||||
currentUrl +
|
||||
'?' +
|
||||
queryStrings[i] +
|
||||
'">' +
|
||||
queryStrings[i] +
|
||||
'</a> ';
|
||||
}
|
||||
|
||||
$('#crawler_link').html(html);
|
||||
};
|
||||
|
||||
initNavigationFilter('sidebar-scroll');
|
||||
|
||||
initAnchorTags('.docs-page .docs-body');
|
||||
|
||||
initSocialShareLinks();
|
||||
|
||||
initSections();
|
||||
|
||||
initCrawlerLinks();
|
||||
});
|
||||
})(jQuery);
|
||||
|
@ -1,152 +1,165 @@
|
||||
(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 () {
|
||||
|
||||
var $element = $(this).parent();
|
||||
|
||||
$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;
|
||||
var enoughHeightPlus = 500;
|
||||
|
||||
$(window).scroll(function () {
|
||||
var topPos = $(window).scrollTop();
|
||||
if (topPos > enoughHeight) {
|
||||
$(scrollTopBtn).addClass("showup");
|
||||
$("body").addClass("scrolled");
|
||||
} else {
|
||||
$(scrollTopBtn).removeClass("showup");
|
||||
$("body").removeClass("scrolled");
|
||||
}
|
||||
if (topPos > enoughHeightPlus) {
|
||||
$("body").addClass("scrolledMore");
|
||||
} else {
|
||||
$("body").removeClass("scrolledMore");
|
||||
}
|
||||
});
|
||||
|
||||
$(scrollTopBtn).click(function () {
|
||||
$('html, body').animate({
|
||||
scrollTop: 0
|
||||
}, 500);
|
||||
return false;
|
||||
});
|
||||
|
||||
var scrollToHashLink = function () {
|
||||
var hash = window.location.hash;
|
||||
|
||||
if (!hash || hash === "#") {
|
||||
return;
|
||||
}
|
||||
|
||||
var $targetElement = $(decodeURIComponent(hash));
|
||||
|
||||
$targetElement = $targetElement.length ? $targetElement : $('[name=' + this.hash.slice(1) + ']');
|
||||
|
||||
if (!$targetElement.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('html,body').stop().animate({
|
||||
scrollTop: $targetElement.offset().top
|
||||
}, 200);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
handleCustomScrolls();
|
||||
|
||||
var $myNav = $("#docs-sticky-index");
|
||||
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: $(decodeURIComponent(hash)).offset().top
|
||||
}, 500, function () {
|
||||
window.location.hash = hash;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".btn-toggle").on("click", function () {
|
||||
$(".toggle-row").slideToggle(400);
|
||||
$(this).toggleClass("less");
|
||||
});
|
||||
|
||||
$(".close-mmenu").on("click", function () {
|
||||
$(".navbar-collapse").removeClass("show");
|
||||
});
|
||||
|
||||
$(".open-dmenu").on("click", function () {
|
||||
$(".docs-tree-list").slideToggle();
|
||||
});
|
||||
|
||||
scrollToHashLink();
|
||||
});
|
||||
|
||||
$(window).resize(function () {
|
||||
handleCustomScrolls();
|
||||
});
|
||||
});
|
||||
|
||||
function handleCustomScrolls() {
|
||||
var wWidth = $(window).width();
|
||||
if (wWidth > 766) {
|
||||
$("#sidebar-scroll").mCustomScrollbar({
|
||||
theme: "minimal",
|
||||
alwaysShowScrollbar: 0,
|
||||
});
|
||||
|
||||
$("#scroll-index").mCustomScrollbar({
|
||||
theme: "minimal-dark",
|
||||
alwaysShowScrollbar: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Toc.helpers.createNavList = function () {
|
||||
return $('<ul class="nav nav-pills flex-column"></ul>');
|
||||
};
|
||||
|
||||
window.Toc.helpers.createChildNavList = function ($parent) {
|
||||
var $childList = this.createNavList();
|
||||
$parent.append($childList);
|
||||
return $childList;
|
||||
};
|
||||
|
||||
window.Toc.helpers.generateNavEl = function (anchor, text) {
|
||||
var $a = $('<a class="nav-link"></a>');
|
||||
$a.attr('href', '#' + anchor);
|
||||
$a.text(text);
|
||||
var $li = $('<li class="nav-item"></li>');
|
||||
$li.append($a);
|
||||
return $li;
|
||||
};
|
||||
|
||||
function docsCriteria() {
|
||||
var docsContentWidth = $(".docs-content").width() - 20;
|
||||
$(".alert-criteria").width(docsContentWidth);
|
||||
}
|
||||
$(document).ready(function () {
|
||||
docsCriteria();
|
||||
});
|
||||
$(window).resize(function () {
|
||||
docsCriteria();
|
||||
});
|
||||
})(jQuery);
|
||||
$(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 () {
|
||||
var $element = $(this).parent();
|
||||
|
||||
$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;
|
||||
var enoughHeightPlus = 500;
|
||||
|
||||
$(window).scroll(function () {
|
||||
var topPos = $(window).scrollTop();
|
||||
if (topPos > enoughHeight) {
|
||||
$(scrollTopBtn).addClass('showup');
|
||||
$('body').addClass('scrolled');
|
||||
} else {
|
||||
$(scrollTopBtn).removeClass('showup');
|
||||
$('body').removeClass('scrolled');
|
||||
}
|
||||
if (topPos > enoughHeightPlus) {
|
||||
$('body').addClass('scrolledMore');
|
||||
} else {
|
||||
$('body').removeClass('scrolledMore');
|
||||
}
|
||||
});
|
||||
|
||||
$(scrollTopBtn).click(function () {
|
||||
$('html, body').animate(
|
||||
{
|
||||
scrollTop: 0,
|
||||
},
|
||||
500
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
var scrollToHashLink = function () {
|
||||
var hash = window.location.hash;
|
||||
|
||||
if (!hash || hash === '#') {
|
||||
return;
|
||||
}
|
||||
|
||||
var $targetElement = $(decodeURIComponent(hash));
|
||||
|
||||
$targetElement = $targetElement.length
|
||||
? $targetElement
|
||||
: $('[name=' + this.hash.slice(1) + ']');
|
||||
|
||||
if (!$targetElement.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('html,body').stop().animate(
|
||||
{
|
||||
scrollTop: $targetElement.offset().top,
|
||||
},
|
||||
200
|
||||
);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
handleCustomScrolls();
|
||||
|
||||
var $myNav = $('#docs-sticky-index');
|
||||
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: $(decodeURIComponent(hash)).offset().top,
|
||||
},
|
||||
500,
|
||||
function () {
|
||||
window.location.hash = hash;
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$('.btn-toggle').on('click', function () {
|
||||
$('.toggle-row').slideToggle(400);
|
||||
$(this).toggleClass('less');
|
||||
});
|
||||
|
||||
$('.close-mmenu').on('click', function () {
|
||||
$('.navbar-collapse').removeClass('show');
|
||||
});
|
||||
|
||||
$('.open-dmenu').on('click', function () {
|
||||
$('.docs-tree-list').slideToggle();
|
||||
});
|
||||
|
||||
scrollToHashLink();
|
||||
});
|
||||
|
||||
$(window).resize(function () {
|
||||
handleCustomScrolls();
|
||||
});
|
||||
});
|
||||
|
||||
function handleCustomScrolls() {
|
||||
var wWidth = $(window).width();
|
||||
if (wWidth > 766) {
|
||||
$('#sidebar-scroll').mCustomScrollbar({
|
||||
theme: 'minimal',
|
||||
alwaysShowScrollbar: 0,
|
||||
});
|
||||
|
||||
$('#scroll-index').mCustomScrollbar({
|
||||
theme: 'minimal-dark',
|
||||
alwaysShowScrollbar: 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Toc.helpers.createNavList = function () {
|
||||
return $('<ul class="nav nav-pills flex-column"></ul>');
|
||||
};
|
||||
|
||||
window.Toc.helpers.createChildNavList = function ($parent) {
|
||||
var $childList = this.createNavList();
|
||||
$parent.append($childList);
|
||||
return $childList;
|
||||
};
|
||||
|
||||
window.Toc.helpers.generateNavEl = function (anchor, text) {
|
||||
var $a = $('<a class="nav-link"></a>');
|
||||
$a.attr('href', '#' + anchor);
|
||||
$a.text(text);
|
||||
var $li = $('<li class="nav-item"></li>');
|
||||
$li.append($a);
|
||||
return $li;
|
||||
};
|
||||
|
||||
function docsCriteria() {
|
||||
var docsContentWidth = $('.docs-content').width() - 20;
|
||||
$('.alert-criteria').width(docsContentWidth);
|
||||
}
|
||||
$(document).ready(function () {
|
||||
docsCriteria();
|
||||
});
|
||||
$(window).resize(function () {
|
||||
docsCriteria();
|
||||
});
|
||||
})(jQuery);
|
||||
|
Loading…
Reference in new issue