123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- var platforms = {
- 'android': 'Android',
- 'ios': 'iOS',
- 'windows': 'Windows',
- 'ubuntu': 'Ubuntu',
- 'blackberry': 'Blackberry',
- 'fireos': 'FireOS',
- 'firefoxos': 'FirefoxOS',
- 'webos': 'webOS',
- 'osx': 'OS X',
- 'browser': 'Browser',
- 'electron': 'Electron'
- };
- $(document).ready(function () {
- var HEADER_OFFSET = 50;
- var TOC_TOP_OFFSET = HEADER_OFFSET + 40;
-
- var thisPageEntry = $(".site-toc-container .this-page");
- if (thisPageEntry.length > 0) {
- $(".site-toc-container").scrollTop(thisPageEntry.first().position().top - TOC_TOP_OFFSET);
- }
- function slugifyLikeGitHub(originalText) {
- var text = originalText;
-
- text = text.toLowerCase();
-
- text = text.replace(/ /g, '-');
-
-
-
-
-
- text = text.replace(/[\[\]\(\)\;\:\=\+\?\!\.\,\{\}\\\/\>\<]/g, '');
-
- text = text.trim();
- return text;
- }
- function getIdForHeading(heading) {
- if (heading.id) {
- return heading.id;
- } else if (heading.name) {
- return heading.name;
- } else {
- return slugifyLikeGitHub(heading.innerText);
- }
- }
- function permalinkTo(id) {
- var anchor = document.createElement("a");
- anchor.className = "header-link";
- anchor.href = "#" + id;
- anchor.innerHTML = "<i class=\"glyphicon glyphicon-link\"></i>";
- return anchor;
- }
- function anchorFor(id) {
- var anchor = document.createElement("a");
- anchor.className = "fragment-anchor";
- anchor.id = id;
- return anchor;
- }
-
- $('#page-toc-source h1, #page-toc-source h2, #page-toc-source h3, #page-toc-source h4, #page-toc-source h5, #page-toc-source h6')
- .each(function (i, heading) {
- headingId = getIdForHeading(heading);
-
-
-
-
-
- $(heading).before(anchorFor(headingId))
-
- if (i > 0) {
- $(heading).append(permalinkTo(headingId));
- }
- });
-
- $('#page-toc').toc({
- 'selectors': 'h1,h2',
- 'container': '#page-toc-source',
- 'prefix': '',
- 'onHighlight': function(el) {},
- 'highlightOnScroll': true,
- 'highlightOffset': 100,
- 'anchorName': function(i, heading, prefix) {
- return getIdForHeading(heading);
- },
- 'headerText': function(i, heading, $heading) {
- return $heading.text();
- },
- 'itemClass': function(i, heading, $heading, prefix) {
-
- return '';
- }
- });
- $('mark').each(function(index, element) {
- var platform = element.innerText.toLowerCase();
- platform = platform.replace(/ /g, '');
- if (platforms[platform]) {
- $(element).addClass('logo');
- $(element).addClass(platform);
- $(element).attr('title', platforms[platform]);
- element.innerText = '';
- }
- });
- });
|