From db34b114e5c2c6f26c7357013912af3f0dd21e1b Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Thu, 20 May 2021 10:03:07 +0545 Subject: [PATCH] v2 --- .gitignore | 2 + .npmignore | 4 +- .prettierrc | 5 + README.md | 14 +- package.json | 20 +- publish.js | 1208 +++++++++++++-------------- static/scripts/linenumber.js | 38 +- static/scripts/nav.js | 166 ++-- static/scripts/prettify/lang-css.js | 23 +- static/scripts/prettify/prettify.js | 441 +++++++++- static/styles/prettify.css | 125 +-- static/styles/skyceil.css | 785 ++++++++--------- 12 files changed, 1633 insertions(+), 1198 deletions(-) create mode 100644 .gitignore create mode 100644 .prettierrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..167ab9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +yarn.lock \ No newline at end of file diff --git a/.npmignore b/.npmignore index 699211d..ab649a1 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,3 @@ -changelogs.md \ No newline at end of file +changelogs.md +.prettierrc +.github/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..1ddcdd0 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": true, + "singleQuote": false, + "printWidth": 400 +} \ No newline at end of file diff --git a/README.md b/README.md index 5e3059a..f531acd 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ A clean and minimalistic JSDoc theme -![Preview](https://skyceil.zyrouge.gq/images/main.png) +![Preview](https://jsdoc.snowflakedev.xyz/images/main.png) -# [Documentation](https://skyceil.zyrouge.gq) +# [Documentation](https://jsdoc.snowflakedev.xyz) ## Install ```bash @@ -18,12 +18,12 @@ $ jsdoc ./ -t /path/to/skyceil ## Clone ```bash -$ git clone https://github.com/zyrouge/jsdoc-skyceil +$ git clone https://github.com/DevSnowflake/jsdoc-skyceil ``` ## Helpful Links -* [Website/Docs](https://skyceil.zyrouge.gq/) -* [Source](https://github.com/zyrouge/jsdoc-skyceil) -* [Changelogs](https://github.com/zyrouge/jsdoc-skyceil/blob/master/changelogs.md) -* [Discord](https://zyrouge.gq/discord) +* [Website/Docs](https://jsdoc.snowflakedev.xyz) +* [Source](https://github.com/DevSnowflake/jsdoc-skyceil) +* [Changelogs](https://github.com/DevSnowflake/jsdoc-skyceil/blob/master/changelogs.md) +* [Discord](https://snowflakedev.xyz/discord) diff --git a/package.json b/package.json index 86e1dfa..85a142d 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,31 @@ { "name": "jsdoc-skyceil", - "version": "1.0.6", - "description": "A clean and minimalistic JSDoc theme", + "version": "2.0.0", + "description": "A clean and minimalistic JSDoc theme for everyone", "main": "publish.js", "scripts": { + "format": "prettier --write **/*.{js,css}", "test": "jsdoc -R ../jsdoc-skyceil-docs/example/readme.md -d ../jsdoc-skyceil-docs/example -t . --verbose ../jsdoc-skyceil-docs/example/thecode.js" }, "repository": { "type": "git", - "url": "git+https://github.com/zyrouge/jsdoc-skyceil.git" + "url": "git+https://github.com/DevSnowflake/jsdoc-skyceil.git" }, "keywords": [ "jsdoc", - "theme" + "theme", + "docs", + "docgen", + "jsdoc-theme" ], "author": "ZYROUGE", "license": "ISC", "bugs": { - "url": "https://github.com/zyrouge/jsdoc-skyceil/issues" + "url": "https://github.com/DevSnowflake/jsdoc-skyceil/issues" }, - "homepage": "https://skyceil.zyrouge.gq" + "homepage": "https://jsdoc.snowflakedev.xyz", + "devDependencies": { + "jsdoc": "^3.6.7", + "prettier": "^2.3.0" + } } diff --git a/publish.js b/publish.js index bea7401..f531134 100644 --- a/publish.js +++ b/publish.js @@ -1,12 +1,12 @@ -const doop = require('jsdoc/util/doop'); -const env = require('jsdoc/env'); -const fs = require('jsdoc/fs'); -const helper = require('jsdoc/util/templateHelper'); -const logger = require('jsdoc/util/logger'); -const path = require('jsdoc/path'); -const taffy = require('taffydb').taffy; -const template = require('jsdoc/template'); -const util = require('util'); +const doop = require("jsdoc/util/doop"); +const env = require("jsdoc/env"); +const fs = require("jsdoc/fs"); +const helper = require("jsdoc/util/templateHelper"); +const logger = require("jsdoc/util/logger"); +const path = require("jsdoc/path"); +const taffy = require("taffydb").taffy; +const template = require("jsdoc/template"); +const util = require("util"); const htmlsafe = helper.htmlsafe; const linkto = helper.linkto; @@ -19,245 +19,238 @@ let view; let outdir = path.normalize(env.opts.destination); function find(spec) { - return helper.find(data, spec); + return helper.find(data, spec); } function tutoriallink(tutorial) { - return helper.toTutorial(tutorial, null, { - tag: 'em', - classname: 'disabled', - prefix: 'Tutorial: ' - }); + return helper.toTutorial(tutorial, null, { + tag: "em", + classname: "disabled", + prefix: "Tutorial: ", + }); } function getAncestorLinks(doclet) { - return helper.getAncestorLinks(data, doclet); + return helper.getAncestorLinks(data, doclet); } function hashToLink(doclet, hash) { - let url; + let url; - if ( !/^(#.+)/.test(hash) ) { - return hash; - } + if (!/^(#.+)/.test(hash)) { + return hash; + } - url = helper.createLink(doclet); - url = url.replace(/(#.+|$)/, hash); + url = helper.createLink(doclet); + url = url.replace(/(#.+|$)/, hash); - return `${hash}`; + return `${hash}`; } -function needsSignature({kind, type, meta}) { - let needsSig = false; - - // function and class definitions always get a signature - if (kind === 'function' || kind === 'class') { - needsSig = true; - } - // typedefs that contain functions get a signature, too - else if (kind === 'typedef' && type && type.names && - type.names.length) { - for (let i = 0, l = type.names.length; i < l; i++) { - if (type.names[i].toLowerCase() === 'function') { - needsSig = true; - break; - } - } - } - // and namespaces that are functions get a signature (but finding them is a - // bit messy) - else if (kind === 'namespace' && meta && meta.code && - meta.code.type && meta.code.type.match(/[Ff]unction/)) { +function needsSignature({ kind, type, meta }) { + let needsSig = false; + + // function and class definitions always get a signature + if (kind === "function" || kind === "class") { + needsSig = true; + } + // typedefs that contain functions get a signature, too + else if (kind === "typedef" && type && type.names && type.names.length) { + for (let i = 0, l = type.names.length; i < l; i++) { + if (type.names[i].toLowerCase() === "function") { needsSig = true; + break; + } } - - return needsSig; + } + // and namespaces that are functions get a signature (but finding them is a + // bit messy) + else if (kind === "namespace" && meta && meta.code && meta.code.type && meta.code.type.match(/[Ff]unction/)) { + needsSig = true; + } + + return needsSig; } -function getSignatureAttributes({optional, nullable}) { - const attributes = []; +function getSignatureAttributes({ optional, nullable }) { + const attributes = []; - if (optional) { - attributes.push('opt'); - } + if (optional) { + attributes.push("opt"); + } - if (nullable === true) { - attributes.push('nullable'); - } - else if (nullable === false) { - attributes.push('non-null'); - } + if (nullable === true) { + attributes.push("nullable"); + } else if (nullable === false) { + attributes.push("non-null"); + } - return attributes; + return attributes; } function updateItemName(item) { - const attributes = getSignatureAttributes(item); - let itemName = item.name || ''; + const attributes = getSignatureAttributes(item); + let itemName = item.name || ""; - if (item.variable) { - itemName = `…${itemName}`; - } + if (item.variable) { + itemName = `…${itemName}`; + } - if (attributes && attributes.length) { - itemName = util.format( '%s%s', itemName, - attributes.join(', ') ); - } + if (attributes && attributes.length) { + itemName = util.format('%s%s', itemName, attributes.join(", ")); + } - return itemName; + return itemName; } function addParamAttributes(params) { - return params.filter(({name}) => name && !name.includes('.')).map(updateItemName); + return params.filter(({ name }) => name && !name.includes(".")).map(updateItemName); } function buildItemTypeStrings(item) { - const types = []; + const types = []; - if (item && item.type && item.type.names) { - item.type.names.forEach(name => { - types.push( linkto(name, htmlsafe(name)) ); - }); - } + if (item && item.type && item.type.names) { + item.type.names.forEach((name) => { + types.push(linkto(name, htmlsafe(name))); + }); + } - return types; + return types; } function buildAttribsString(attribs) { - let attribsString = ''; + let attribsString = ""; - if (attribs && attribs.length) { - attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) ); - } + if (attribs && attribs.length) { + attribsString = htmlsafe(util.format("(%s) ", attribs.join(", "))); + } - return attribsString; + return attribsString; } function addNonParamAttributes(items) { - let types = []; + let types = []; - items.forEach(item => { - types = types.concat( buildItemTypeStrings(item) ); - }); + items.forEach((item) => { + types = types.concat(buildItemTypeStrings(item)); + }); - return types; + return types; } function addSignatureParams(f) { - const params = f.params ? addParamAttributes(f.params) : []; + const params = f.params ? addParamAttributes(f.params) : []; - f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') ); + f.signature = util.format("%s(%s)", f.signature || "", params.join(", ")); } function addSignatureReturns(f) { - const attribs = []; - let attribsString = ''; - let returnTypes = []; - let returnTypesString = ''; - const source = f.yields || f.returns; - - // jam all the return-type attributes into an array. this could create odd results (for example, - // if there are both nullable and non-nullable return types), but let's assume that most people - // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa. - if (source) { - source.forEach(item => { - helper.getAttribs(item).forEach(attrib => { - if (!attribs.includes(attrib)) { - attribs.push(attrib); - } - }); - }); + const attribs = []; + let attribsString = ""; + let returnTypes = []; + let returnTypesString = ""; + const source = f.yields || f.returns; + + // jam all the return-type attributes into an array. this could create odd results (for example, + // if there are both nullable and non-nullable return types), but let's assume that most people + // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa. + if (source) { + source.forEach((item) => { + helper.getAttribs(item).forEach((attrib) => { + if (!attribs.includes(attrib)) { + attribs.push(attrib); + } + }); + }); - attribsString = buildAttribsString(attribs); - } + attribsString = buildAttribsString(attribs); + } - if (source) { - returnTypes = addNonParamAttributes(source); - } - if (returnTypes.length) { - returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') ); - } + if (source) { + returnTypes = addNonParamAttributes(source); + } + if (returnTypes.length) { + returnTypesString = util.format(" → %s{%s}", attribsString, returnTypes.join("|")); + } - f.signature = `${f.signature || ''}${returnTypesString}`; + f.signature = `${f.signature || ""}${returnTypesString}`; } function addSignatureTypes(f) { - const types = f.type ? buildItemTypeStrings(f) : []; + const types = f.type ? buildItemTypeStrings(f) : []; - f.signature = `${f.signature || ''}${types.length ? ` :${types.join('|')}` : ''}`; + f.signature = `${f.signature || ""}${types.length ? ` :${types.join("|")}` : ""}`; } function addAttribs(f) { - const attribs = helper.getAttribs(f); - const attribsString = buildAttribsString(attribs); + const attribs = helper.getAttribs(f); + const attribsString = buildAttribsString(attribs); - f.attribs = util.format('%s', attribsString); + f.attribs = util.format('%s', attribsString); } function shortenPaths(files, commonPrefix) { - Object.keys(files).forEach(file => { - files[file].shortened = files[file].resolved.replace(commonPrefix, '') - // always use forward slashes - .replace(/\\/g, '/'); - }); - - return files; + Object.keys(files).forEach((file) => { + files[file].shortened = files[file].resolved + .replace(commonPrefix, "") + // always use forward slashes + .replace(/\\/g, "/"); + }); + + return files; } -function getPathFromDoclet({meta}) { - if (!meta) { - return null; - } +function getPathFromDoclet({ meta }) { + if (!meta) { + return null; + } - return meta.path && meta.path !== 'null' ? - path.join(meta.path, meta.filename) : - meta.filename; + return meta.path && meta.path !== "null" ? path.join(meta.path, meta.filename) : meta.filename; } function generate(title, docs, filename, resolveLinks) { - let docData; - let html; - let outpath; + let docData; + let html; + let outpath; - resolveLinks = resolveLinks !== false; + resolveLinks = resolveLinks !== false; - docData = { - env: env, - title: title, - docs: docs - }; + docData = { + env: env, + title: title, + docs: docs, + }; - outpath = path.join(outdir, filename); - html = view.render('container.tmpl', docData); + outpath = path.join(outdir, filename); + html = view.render("container.tmpl", docData); - if (resolveLinks) { - html = helper.resolveLinks(html); // turn {@link foo} into foo - } + if (resolveLinks) { + html = helper.resolveLinks(html); // turn {@link foo} into foo + } - fs.writeFileSync(outpath, html, 'utf8'); + fs.writeFileSync(outpath, html, "utf8"); } -function generateSourceFiles(sourceFiles, encoding = 'utf8') { - Object.keys(sourceFiles).forEach(file => { - let source; - // links are keyed to the shortened path in each doclet's `meta.shortpath` property - const sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); - - helper.registerLink(sourceFiles[file].shortened, sourceOutfile); - - try { - source = { - kind: 'source', - code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) ) - }; - } - catch (e) { - logger.error('Error while generating source file %s: %s', file, e.message); - } +function generateSourceFiles(sourceFiles, encoding = "utf8") { + Object.keys(sourceFiles).forEach((file) => { + let source; + // links are keyed to the shortened path in each doclet's `meta.shortpath` property + const sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); + + helper.registerLink(sourceFiles[file].shortened, sourceOutfile); + + try { + source = { + kind: "source", + code: helper.htmlsafe(fs.readFileSync(sourceFiles[file].resolved, encoding)), + }; + } catch (e) { + logger.error("Error while generating source file %s: %s", file, e.message); + } - generate(`Source: ${sourceFiles[file].shortened}`, [source], sourceOutfile, - false); - }); + generate(`Source: ${sourceFiles[file].shortened}`, [source], sourceOutfile, false); + }); } /** @@ -272,90 +265,83 @@ function generateSourceFiles(sourceFiles, encoding = 'utf8') { * @param {Array.} modules - The array of module doclets to search. */ function attachModuleSymbols(doclets, modules) { - const symbols = {}; - - // build a lookup table - doclets.forEach(symbol => { - symbols[symbol.longname] = symbols[symbol.longname] || []; - symbols[symbol.longname].push(symbol); - }); - - modules.forEach(module => { - if (symbols[module.longname]) { - module.modules = symbols[module.longname] - // Only show symbols that have a description. Make an exception for classes, because - // we want to show the constructor-signature heading no matter what. - .filter(({description, kind}) => description || kind === 'class') - .map(symbol => { - symbol = doop(symbol); - - if (symbol.kind === 'class' || symbol.kind === 'function') { - symbol.name = `${symbol.name.replace('module:', '(require("')}"))`; - } - - return symbol; - }); - } - }); + const symbols = {}; + + // build a lookup table + doclets.forEach((symbol) => { + symbols[symbol.longname] = symbols[symbol.longname] || []; + symbols[symbol.longname].push(symbol); + }); + + modules.forEach((module) => { + if (symbols[module.longname]) { + module.modules = symbols[module.longname] + // Only show symbols that have a description. Make an exception for classes, because + // we want to show the constructor-signature heading no matter what. + .filter(({ description, kind }) => description || kind === "class") + .map((symbol) => { + symbol = doop(symbol); + + if (symbol.kind === "class" || symbol.kind === "function") { + symbol.name = `${symbol.name.replace("module:", '(require("')}"))`; + } + + return symbol; + }); + } + }); } function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) { - let nav = ''; - - if (items.length) { - let itemsNav = ''; - - items.forEach(item => { - var methods = find({ kind: "function", memberof: item.longname }) - var members = find({ kind: "member", memberof: item.longname }) - var hasMethods = !!(methods.length || members.length); - let displayName; - - if ( !hasOwnProp.call(item, 'longname') ) { - itemsNav += `
  • ${getIcon(itemHeading)}${linktoFn('', item.name)}
  • `; - } - else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { - if (env.conf.templates.default.useLongnameInNav) { - displayName = item.longname; - } else { - displayName = item.name; - } - itemsNav += [ - `
  • `, - `${getIcon(itemHeading)}${hasMethods ? "" : ""}${linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ''))}${hasMethods ? "" : ""}`, - hasMethods ? - [ - `
      `, - methods.map(meth => `
    • ${getIcon(meth.kind)}${linktoFn(meth.longname, meth.name)}
    • `).join(""), - members.map(meth => `
    • ${getIcon(meth.kind)}${linktoFn(meth.longname, meth.name)}
    • `).join(""), - `
    ` - ].join("") : "", - `
  • ` - ].join(""); - - itemsSeen[item.longname] = true; - } - }); - - if (itemsNav !== '') { - nav += `
    ${itemHeading}
    `; + let nav = ""; + + if (items.length) { + let itemsNav = ""; + + items.forEach((item) => { + var methods = find({ kind: "function", memberof: item.longname }); + var members = find({ kind: "member", memberof: item.longname }); + var hasMethods = !!(methods.length || members.length); + let displayName; + + if (!hasOwnProp.call(item, "longname")) { + itemsNav += `
  • ${getIcon(itemHeading)}${linktoFn("", item.name)}
  • `; + } else if (!hasOwnProp.call(itemsSeen, item.longname)) { + if (env.conf.templates.default.useLongnameInNav) { + displayName = item.longname; + } else { + displayName = item.name; } + itemsNav += [ + `
  • `, + `${getIcon(itemHeading)}${hasMethods ? "" : ""}${linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ""))}${hasMethods ? "" : ""}`, + hasMethods ? [`
      `, methods.map((meth) => `
    • ${getIcon(meth.kind)}${linktoFn(meth.longname, meth.name)}
    • `).join(""), members.map((meth) => `
    • ${getIcon(meth.kind)}${linktoFn(meth.longname, meth.name)}
    • `).join(""), `
    `].join("") : "", + `
  • `, + ].join(""); + + itemsSeen[item.longname] = true; + } + }); + + if (itemsNav !== "") { + nav += `
    ${itemHeading}
    `; } + } - return nav; + return nav; } -function getIcon (name) { - const icon = name.charAt(0).toUpperCase(); - return `${icon}`; +function getIcon(name) { + const icon = name.charAt(0).toUpperCase(); + return `${icon}`; } function linktoTutorial(longName, name) { - return tutoriallink(name); + return tutoriallink(name); } function linktoExternal(longName, name) { - return linkto(longName, name.replace(/(^"|"$)/g, '')); + return linkto(longName, name.replace(/(^"|"$)/g, "")); } /** @@ -373,92 +359,90 @@ function linktoExternal(longName, name) { * @return {string} The HTML for the navigation sidebar. */ function buildNav(members) { - let globalNav; - let nav = '

    Home

    '; - const seen = {}; - const seenTutorials = {}; - - nav += buildMemberNav(members.modules, 'Modules', {}, linkto); - nav += buildMemberNav(members.externals, 'Externals', seen, linktoExternal); - nav += buildMemberNav(members.namespaces, 'Namespaces', seen, linkto); - nav += buildMemberNav(members.classes, 'Classes', seen, linkto); - nav += buildMemberNav(members.interfaces, 'Interfaces', seen, linkto); - nav += buildMemberNav(members.events, 'Events', seen, linkto); - nav += buildMemberNav(members.mixins, 'Mixins', seen, linkto); - nav += buildMemberNav(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial); - - if (members.globals.length) { - globalNav = ''; - - members.globals.forEach(({kind, longname, name}) => { - if ( kind !== 'typedef' && !hasOwnProp.call(seen, longname) ) { - globalNav += `
  • ${linkto(longname, name)}
  • `; - } - seen[longname] = true; - }); + let globalNav; + let nav = '

    Home

    '; + const seen = {}; + const seenTutorials = {}; + + nav += buildMemberNav(members.modules, "Modules", {}, linkto); + nav += buildMemberNav(members.externals, "Externals", seen, linktoExternal); + nav += buildMemberNav(members.namespaces, "Namespaces", seen, linkto); + nav += buildMemberNav(members.classes, "Classes", seen, linkto); + nav += buildMemberNav(members.interfaces, "Interfaces", seen, linkto); + nav += buildMemberNav(members.events, "Events", seen, linkto); + nav += buildMemberNav(members.mixins, "Mixins", seen, linkto); + nav += buildMemberNav(members.tutorials, "Tutorials", seenTutorials, linktoTutorial); + + if (members.globals.length) { + globalNav = ""; + + members.globals.forEach(({ kind, longname, name }) => { + if (kind !== "typedef" && !hasOwnProp.call(seen, longname)) { + globalNav += `
  • ${linkto(longname, name)}
  • `; + } + seen[longname] = true; + }); - if (!globalNav) { - // turn the heading into a link so you can actually get to the global page - nav += `

    ${linkto('global', 'Global')}

    `; - } - else { - nav += `

    Global

    `; - } + if (!globalNav) { + // turn the heading into a link so you can actually get to the global page + nav += `

    ${linkto("global", "Global")}

    `; + } else { + nav += `

    Global

    `; } + } - return nav; + return nav; } function buildMemberSearch(items, itemHeading, itemsSeen, linktoFn) { - let search = []; - - if (items.length) { - let itemsSearch = []; - - items.forEach(item => { - var methods = find({ kind: "function", memberof: item.longname }) - var members = find({ kind: "member", memberof: item.longname }) - var hasMethods = !!(methods.length || members.length); - let displayName; - - if ( !hasOwnProp.call(item, 'longname') ) { - itemsSearch.push({ name: item.name, url: linktoFn('', item.name) }); - } - else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { - if (env.conf.templates.default.useLongnameInNav) { - displayName = item.longname; - } else { - displayName = item.name; - } - - itemsSearch.push({ - name: displayName, - url: linktoFn(item.longname, displayName.replace(/\b(module|event):/g, '')) - }); - - if(hasMethods) { - methods.forEach(meth => { - itemsSearch.push({ - name: meth.longname, - url: linktoFn(meth.longname, meth.name) - }); - }); - members.forEach(meth => { - itemsSearch.push({ - name: meth.longname, - url: linktoFn(meth.longname, meth.name) - }); - }); - } - } + let search = []; + + if (items.length) { + let itemsSearch = []; + + items.forEach((item) => { + var methods = find({ kind: "function", memberof: item.longname }); + var members = find({ kind: "member", memberof: item.longname }); + var hasMethods = !!(methods.length || members.length); + let displayName; + + if (!hasOwnProp.call(item, "longname")) { + itemsSearch.push({ name: item.name, url: linktoFn("", item.name) }); + } else if (!hasOwnProp.call(itemsSeen, item.longname)) { + if (env.conf.templates.default.useLongnameInNav) { + displayName = item.longname; + } else { + displayName = item.name; + } + + itemsSearch.push({ + name: displayName, + url: linktoFn(item.longname, displayName.replace(/\b(module|event):/g, "")), }); - if (itemsSearch.length) { - search.push(...itemsSearch); + if (hasMethods) { + methods.forEach((meth) => { + itemsSearch.push({ + name: meth.longname, + url: linktoFn(meth.longname, meth.name), + }); + }); + members.forEach((meth) => { + itemsSearch.push({ + name: meth.longname, + url: linktoFn(meth.longname, meth.name), + }); + }); } + } + }); + + if (itemsSearch.length) { + search.push(...itemsSearch); } + } - return search; + return search; } /** @@ -476,44 +460,43 @@ function buildMemberSearch(items, itemHeading, itemsSeen, linktoFn) { * @return {string} The HTML for the navigation sidebar. */ function buildSearch(members) { - let globalNav; - let search = [{ name: "Home", url: 'Home' }]; - const seen = {}; - const seenTutorials = {}; - - search.push(...buildMemberSearch(members.modules, 'Modules', {}, linkto)); - search.push(...buildMemberSearch(members.externals, 'Externals', seen, linktoExternal)); - search.push(...buildMemberSearch(members.namespaces, 'Namespaces', seen, linkto)); - search.push(...buildMemberSearch(members.classes, 'Classes', seen, linkto)); - search.push(...buildMemberSearch(members.interfaces, 'Interfaces', seen, linkto)); - search.push(...buildMemberSearch(members.events, 'Events', seen, linkto)); - search.push(...buildMemberSearch(members.mixins, 'Mixins', seen, linkto)); - search.push(...buildMemberSearch(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial)); - - if (members.globals.length) { - globalNav = []; - - members.globals.forEach(({kind, longname, name}) => { - if ( kind !== 'typedef' && !hasOwnProp.call(seen, longname) ) { - globalNav.push({ name: name, url: linkto(longname, name) }); - } - }); + let globalNav; + let search = [{ name: "Home", url: 'Home' }]; + const seen = {}; + const seenTutorials = {}; + + search.push(...buildMemberSearch(members.modules, "Modules", {}, linkto)); + search.push(...buildMemberSearch(members.externals, "Externals", seen, linktoExternal)); + search.push(...buildMemberSearch(members.namespaces, "Namespaces", seen, linkto)); + search.push(...buildMemberSearch(members.classes, "Classes", seen, linkto)); + search.push(...buildMemberSearch(members.interfaces, "Interfaces", seen, linkto)); + search.push(...buildMemberSearch(members.events, "Events", seen, linkto)); + search.push(...buildMemberSearch(members.mixins, "Mixins", seen, linkto)); + search.push(...buildMemberSearch(members.tutorials, "Tutorials", seenTutorials, linktoTutorial)); + + if (members.globals.length) { + globalNav = []; + + members.globals.forEach(({ kind, longname, name }) => { + if (kind !== "typedef" && !hasOwnProp.call(seen, longname)) { + globalNav.push({ name: name, url: linkto(longname, name) }); + } + }); - if (!globalNav.length) { - search.push({ name: "Global", url: linkto('global', 'Global') }); - } - else { - search.push(...globalNav); - } + if (!globalNav.length) { + search.push({ name: "Global", url: linkto("global", "Global") }); + } else { + search.push(...globalNav); } + } - return search; + return search; } -function prettifyReadme (readme) { - let prettifiedReadme = readme; - prettifiedReadme = prettifiedReadme.replace(/class="prettyprint/g, "class=\"prettyprint linenums"); - return prettifiedReadme; +function prettifyReadme(readme) { + let prettifiedReadme = readme; + prettifiedReadme = prettifiedReadme.replace(/class="prettyprint/g, 'class="prettyprint linenums'); + return prettifiedReadme; } /** @@ -522,299 +505,300 @@ function prettifyReadme (readme) { @param {Tutorial} tutorials */ exports.publish = (taffyData, opts, tutorials) => { - let classes; - let conf; - let externals; - let files; - let fromDir; - let globalUrl; - let indexUrl; - let interfaces; - let members; - let mixins; - let modules; - let namespaces; - let outputSourceFiles; - let packageInfo; - let packages; - const sourceFilePaths = []; - let sourceFiles = {}; - let staticFileFilter; - let staticFilePaths; - let staticFiles; - let staticFileScanner; - let templatePath; - - data = taffyData; - - conf = env.conf.templates || {}; - conf.default = conf.default || {}; - - templatePath = path.normalize(opts.template); - view = new template.Template( path.join(templatePath, 'tmpl') ); - - // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness - // doesn't try to hand them out later - indexUrl = helper.getUniqueFilename('index'); - // don't call registerLink() on this one! 'index' is also a valid longname - - globalUrl = helper.getUniqueFilename('global'); - helper.registerLink('global', globalUrl); - - // set up templating - view.layout = conf.default.layoutFile ? - path.getResourcePath(path.dirname(conf.default.layoutFile), - path.basename(conf.default.layoutFile) ) : - 'layout.tmpl'; - - // set up tutorials for helper - helper.setTutorials(tutorials); - - data = helper.prune(data); - data.sort('longname, version, since'); - helper.addEventListeners(data); - - data().each(doclet => { - let sourcePath; - - doclet.attribs = ''; - - if (doclet.examples) { - doclet.examples = doclet.examples.map(example => { - let caption; - let code; - - if (example.match(/^\s*([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) { - caption = RegExp.$1; - code = RegExp.$3; - } - - return { - caption: caption || '', - code: code || example - }; - }); - } - if (doclet.see) { - doclet.see.forEach((seeItem, i) => { - doclet.see[i] = hashToLink(doclet, seeItem); - }); + let classes; + let conf; + let externals; + let files; + let fromDir; + let globalUrl; + let indexUrl; + let interfaces; + let members; + let mixins; + let modules; + let namespaces; + let outputSourceFiles; + let packageInfo; + let packages; + const sourceFilePaths = []; + let sourceFiles = {}; + let staticFileFilter; + let staticFilePaths; + let staticFiles; + let staticFileScanner; + let templatePath; + + data = taffyData; + + conf = env.conf.templates || {}; + conf.default = conf.default || {}; + + templatePath = path.normalize(opts.template); + view = new template.Template(path.join(templatePath, "tmpl")); + + // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness + // doesn't try to hand them out later + indexUrl = helper.getUniqueFilename("index"); + // don't call registerLink() on this one! 'index' is also a valid longname + + globalUrl = helper.getUniqueFilename("global"); + helper.registerLink("global", globalUrl); + + // set up templating + view.layout = conf.default.layoutFile ? path.getResourcePath(path.dirname(conf.default.layoutFile), path.basename(conf.default.layoutFile)) : "layout.tmpl"; + + // set up tutorials for helper + helper.setTutorials(tutorials); + + data = helper.prune(data); + data.sort("longname, version, since"); + helper.addEventListeners(data); + + data().each((doclet) => { + let sourcePath; + + doclet.attribs = ""; + + if (doclet.examples) { + doclet.examples = doclet.examples.map((example) => { + let caption; + let code; + + if (example.match(/^\s*([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) { + caption = RegExp.$1; + code = RegExp.$3; } - // build a list of source files - if (doclet.meta) { - sourcePath = getPathFromDoclet(doclet); - sourceFiles[sourcePath] = { - resolved: sourcePath, - shortened: null - }; - if (!sourceFilePaths.includes(sourcePath)) { - sourceFilePaths.push(sourcePath); - } - } - }); + return { + caption: caption || "", + code: code || example, + }; + }); + } + if (doclet.see) { + doclet.see.forEach((seeItem, i) => { + doclet.see[i] = hashToLink(doclet, seeItem); + }); + } - // update outdir if necessary, then create outdir - packageInfo = ( find({kind: 'package'}) || [] )[0]; - if (packageInfo && packageInfo.name) { - outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') ); + // build a list of source files + if (doclet.meta) { + sourcePath = getPathFromDoclet(doclet); + sourceFiles[sourcePath] = { + resolved: sourcePath, + shortened: null, + }; + if (!sourceFilePaths.includes(sourcePath)) { + sourceFilePaths.push(sourcePath); + } } - fs.mkPath(outdir); + }); - // copy the template's static files to outdir - fromDir = path.join(templatePath, 'static'); - staticFiles = fs.ls(fromDir, 3); + // update outdir if necessary, then create outdir + packageInfo = (find({ kind: "package" }) || [])[0]; + if (packageInfo && packageInfo.name) { + outdir = path.join(outdir, packageInfo.name, packageInfo.version || ""); + } + fs.mkPath(outdir); - staticFiles.forEach(fileName => { - const toDir = fs.toDir( fileName.replace(fromDir, outdir) ); + // copy the template's static files to outdir + fromDir = path.join(templatePath, "static"); + staticFiles = fs.ls(fromDir, 3); - fs.mkPath(toDir); - fs.copyFileSync(fileName, toDir); - }); + staticFiles.forEach((fileName) => { + const toDir = fs.toDir(fileName.replace(fromDir, outdir)); - // copy user-specified static files to outdir - if (conf.default.staticFiles) { - // The canonical property name is `include`. We accept `paths` for backwards compatibility - // with a bug in JSDoc 3.2.x. - staticFilePaths = conf.default.staticFiles.include || - conf.default.staticFiles.paths || - []; - staticFileFilter = new (require('jsdoc/src/filter').Filter)(conf.default.staticFiles); - staticFileScanner = new (require('jsdoc/src/scanner').Scanner)(); + fs.mkPath(toDir); + fs.copyFileSync(fileName, toDir); + }); - staticFilePaths.forEach(filePath => { - let extraStaticFiles; + // copy user-specified static files to outdir + if (conf.default.staticFiles) { + // The canonical property name is `include`. We accept `paths` for backwards compatibility + // with a bug in JSDoc 3.2.x. + staticFilePaths = conf.default.staticFiles.include || conf.default.staticFiles.paths || []; + staticFileFilter = new (require("jsdoc/src/filter").Filter)(conf.default.staticFiles); + staticFileScanner = new (require("jsdoc/src/scanner").Scanner)(); - filePath = path.resolve(env.pwd, filePath); - extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); + staticFilePaths.forEach((filePath) => { + let extraStaticFiles; - extraStaticFiles.forEach(fileName => { - const sourcePath = fs.toDir(filePath); - const toDir = fs.toDir( fileName.replace(sourcePath, outdir) ); + filePath = path.resolve(env.pwd, filePath); + extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); - fs.mkPath(toDir); - fs.copyFileSync(fileName, toDir); - }); - }); - } + extraStaticFiles.forEach((fileName) => { + const sourcePath = fs.toDir(filePath); + const toDir = fs.toDir(fileName.replace(sourcePath, outdir)); - if (sourceFilePaths.length) { - sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) ); - } - data().each(doclet => { - let docletPath; - const url = helper.createLink(doclet); - - helper.registerLink(doclet.longname, url); - - // add a shortened version of the full path - if (doclet.meta) { - docletPath = getPathFromDoclet(doclet); - docletPath = sourceFiles[docletPath].shortened; - if (docletPath) { - doclet.meta.shortpath = docletPath; - } - } + fs.mkPath(toDir); + fs.copyFileSync(fileName, toDir); + }); }); + } + + if (sourceFilePaths.length) { + sourceFiles = shortenPaths(sourceFiles, path.commonPrefix(sourceFilePaths)); + } + data().each((doclet) => { + let docletPath; + const url = helper.createLink(doclet); + + helper.registerLink(doclet.longname, url); + + // add a shortened version of the full path + if (doclet.meta) { + docletPath = getPathFromDoclet(doclet); + docletPath = sourceFiles[docletPath].shortened; + if (docletPath) { + doclet.meta.shortpath = docletPath; + } + } + }); - data().each(doclet => { - const url = helper.longnameToUrl[doclet.longname]; - - if (url.includes('#')) { - doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop(); - } - else { - doclet.id = doclet.name; - } - - if ( needsSignature(doclet) ) { - addSignatureParams(doclet); - addSignatureReturns(doclet); - addAttribs(doclet); - } - }); + data().each((doclet) => { + const url = helper.longnameToUrl[doclet.longname]; - // do this after the urls have all been generated - data().each(doclet => { - doclet.ancestors = getAncestorLinks(doclet); + if (url.includes("#")) { + doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop(); + } else { + doclet.id = doclet.name; + } - if (doclet.kind === 'member') { - addSignatureTypes(doclet); - addAttribs(doclet); - } + if (needsSignature(doclet)) { + addSignatureParams(doclet); + addSignatureReturns(doclet); + addAttribs(doclet); + } + }); - if (doclet.kind === 'constant') { - addSignatureTypes(doclet); - addAttribs(doclet); - doclet.kind = 'member'; - } - }); + // do this after the urls have all been generated + data().each((doclet) => { + doclet.ancestors = getAncestorLinks(doclet); - members = helper.getMembers(data); - members.tutorials = tutorials.children; - - // output pretty-printed source files by default - outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false; - - // add template helpers - view.find = find; - view.linkto = linkto; - view.resolveAuthorLinks = resolveAuthorLinks; - view.tutoriallink = tutoriallink; - view.htmlsafe = htmlsafe; - view.outputSourceFiles = outputSourceFiles; - - // once for all - view.nav = buildNav(members); - attachModuleSymbols( find({ longname: { left: 'module:'} }), members.modules ); - view.search = buildSearch(members); - fs.writeFileSync(path.join(outdir, "search.json"), JSON.stringify(view.search)); - - // generate the pretty-printed source files first so other pages can link to them - if (outputSourceFiles) { - generateSourceFiles(sourceFiles, opts.encoding); + if (doclet.kind === "member") { + addSignatureTypes(doclet); + addAttribs(doclet); } - if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); } - - // index page displays information from package.json and lists files - files = find({kind: 'file'}); - packages = find({kind: 'package'}); - - generate('Home', - packages.concat( - [{ - kind: 'mainpage', - readme: opts.readme ? prettifyReadme(opts.readme) : undefined, - longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page' - }] - ).concat(files), indexUrl); - - // set up the lists that we'll use to generate pages - classes = taffy(members.classes); - modules = taffy(members.modules); - namespaces = taffy(members.namespaces); - mixins = taffy(members.mixins); - externals = taffy(members.externals); - interfaces = taffy(members.interfaces); - - Object.keys(helper.longnameToUrl).forEach(longname => { - const myClasses = helper.find(classes, {longname: longname}); - const myExternals = helper.find(externals, {longname: longname}); - const myInterfaces = helper.find(interfaces, {longname: longname}); - const myMixins = helper.find(mixins, {longname: longname}); - const myModules = helper.find(modules, {longname: longname}); - const myNamespaces = helper.find(namespaces, {longname: longname}); - - if (myModules.length) { - generate(`Module: ${myModules[0].name}`, myModules, helper.longnameToUrl[longname]); - } - - if (myClasses.length) { - generate(`Class: ${myClasses[0].name}`, myClasses, helper.longnameToUrl[longname]); - } + if (doclet.kind === "constant") { + addSignatureTypes(doclet); + addAttribs(doclet); + doclet.kind = "member"; + } + }); + + members = helper.getMembers(data); + members.tutorials = tutorials.children; + + // output pretty-printed source files by default + outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false; + + // add template helpers + view.find = find; + view.linkto = linkto; + view.resolveAuthorLinks = resolveAuthorLinks; + view.tutoriallink = tutoriallink; + view.htmlsafe = htmlsafe; + view.outputSourceFiles = outputSourceFiles; + + // once for all + view.nav = buildNav(members); + attachModuleSymbols(find({ longname: { left: "module:" } }), members.modules); + view.search = buildSearch(members); + fs.writeFileSync(path.join(outdir, "search.json"), JSON.stringify(view.search)); + + // generate the pretty-printed source files first so other pages can link to them + if (outputSourceFiles) { + generateSourceFiles(sourceFiles, opts.encoding); + } + + if (members.globals.length) { + generate("Global", [{ kind: "globalobj" }], globalUrl); + } + + // index page displays information from package.json and lists files + files = find({ kind: "file" }); + packages = find({ kind: "package" }); + + generate( + "Home", + packages + .concat([ + { + kind: "mainpage", + readme: opts.readme ? prettifyReadme(opts.readme) : undefined, + longname: opts.mainpagetitle ? opts.mainpagetitle : "Main Page", + }, + ]) + .concat(files), + indexUrl + ); + + // set up the lists that we'll use to generate pages + classes = taffy(members.classes); + modules = taffy(members.modules); + namespaces = taffy(members.namespaces); + mixins = taffy(members.mixins); + externals = taffy(members.externals); + interfaces = taffy(members.interfaces); + + Object.keys(helper.longnameToUrl).forEach((longname) => { + const myClasses = helper.find(classes, { longname: longname }); + const myExternals = helper.find(externals, { longname: longname }); + const myInterfaces = helper.find(interfaces, { longname: longname }); + const myMixins = helper.find(mixins, { longname: longname }); + const myModules = helper.find(modules, { longname: longname }); + const myNamespaces = helper.find(namespaces, { longname: longname }); + + if (myModules.length) { + generate(`Module: ${myModules[0].name}`, myModules, helper.longnameToUrl[longname]); + } - if (myNamespaces.length) { - generate(`Namespace: ${myNamespaces[0].name}`, myNamespaces, helper.longnameToUrl[longname]); - } + if (myClasses.length) { + generate(`Class: ${myClasses[0].name}`, myClasses, helper.longnameToUrl[longname]); + } - if (myMixins.length) { - generate(`Mixin: ${myMixins[0].name}`, myMixins, helper.longnameToUrl[longname]); - } + if (myNamespaces.length) { + generate(`Namespace: ${myNamespaces[0].name}`, myNamespaces, helper.longnameToUrl[longname]); + } - if (myExternals.length) { - generate(`External: ${myExternals[0].name}`, myExternals, helper.longnameToUrl[longname]); - } + if (myMixins.length) { + generate(`Mixin: ${myMixins[0].name}`, myMixins, helper.longnameToUrl[longname]); + } - if (myInterfaces.length) { - generate(`Interface: ${myInterfaces[0].name}`, myInterfaces, helper.longnameToUrl[longname]); - } - }); + if (myExternals.length) { + generate(`External: ${myExternals[0].name}`, myExternals, helper.longnameToUrl[longname]); + } - // TODO: move the tutorial functions to templateHelper.js - function generateTutorial(title, tutorial, filename) { - const tutorialData = { - title: title, - header: tutorial.title, - content: tutorial.parse(), - children: tutorial.children - }; - const tutorialPath = path.join(outdir, filename); - let html = view.render('tutorial.tmpl', tutorialData); + if (myInterfaces.length) { + generate(`Interface: ${myInterfaces[0].name}`, myInterfaces, helper.longnameToUrl[longname]); + } + }); + + // TODO: move the tutorial functions to templateHelper.js + function generateTutorial(title, tutorial, filename) { + const tutorialData = { + title: title, + header: tutorial.title, + content: tutorial.parse(), + children: tutorial.children, + }; + const tutorialPath = path.join(outdir, filename); + let html = view.render("tutorial.tmpl", tutorialData); - // yes, you can use {@link} in tutorials too! - html = helper.resolveLinks(html); // turn {@link foo} into foo + // yes, you can use {@link} in tutorials too! + html = helper.resolveLinks(html); // turn {@link foo} into foo - fs.writeFileSync(tutorialPath, html, 'utf8'); - } + fs.writeFileSync(tutorialPath, html, "utf8"); + } - // tutorials can have only one parent so there is no risk for loops - function saveChildren({children}) { - children.forEach(child => { - generateTutorial(`Tutorial: ${child.title}`, child, helper.tutorialToUrl(child.name)); - saveChildren(child); - }); - } + // tutorials can have only one parent so there is no risk for loops + function saveChildren({ children }) { + children.forEach((child) => { + generateTutorial(`Tutorial: ${child.title}`, child, helper.tutorialToUrl(child.name)); + saveChildren(child); + }); + } - saveChildren(tutorials); -}; \ No newline at end of file + saveChildren(tutorials); +}; diff --git a/static/scripts/linenumber.js b/static/scripts/linenumber.js index 4354785..e1b852f 100644 --- a/static/scripts/linenumber.js +++ b/static/scripts/linenumber.js @@ -1,25 +1,25 @@ /*global document */ (() => { - const source = document.getElementsByClassName('prettyprint source linenums'); - let i = 0; - let lineNumber = 0; - let lineId; - let lines; - let totalLines; - let anchorHash; + const source = document.getElementsByClassName("prettyprint source linenums"); + let i = 0; + let lineNumber = 0; + let lineId; + let lines; + let totalLines; + let anchorHash; - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName("li"); + totalLines = lines.length; - for (; i < totalLines; i++) { - lineNumber++; - lineId = `line${lineNumber}`; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } + for (; i < totalLines; i++) { + lineNumber++; + lineId = `line${lineNumber}`; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += " selected"; + } } + } })(); diff --git a/static/scripts/nav.js b/static/scripts/nav.js index 518e4fb..d811ff3 100644 --- a/static/scripts/nav.js +++ b/static/scripts/nav.js @@ -1,97 +1,99 @@ const init = async () => { - document.addEventListener("DOMContentLoaded", function () { - const body = document.querySelector("body"); + document.addEventListener("DOMContentLoaded", function () { + const body = document.querySelector("body"); - // Burger - const burger = document.querySelector(".burger"), - nav = document.querySelector(".navbar"), - navLinks = nav.querySelectorAll("a"); - - burger.addEventListener("click", function () { - toggleClass(burger, "is-active"); - toggleClass(nav, "is-active"); - }); + // Burger + const burger = document.querySelector(".burger"), + nav = document.querySelector(".navbar"), + navLinks = nav.querySelectorAll("a"); - navLinks.forEach(link => { - link.addEventListener("click", function () { - if (burger.classList.contains("is-active")) { - toggleClass(burger, "is-active"); - toggleClass(nav, "is-active"); - } - }); - }); + burger.addEventListener("click", function () { + toggleClass(burger, "is-active"); + toggleClass(nav, "is-active"); + }); - // Utilities - const utilitiesDiv = document.querySelector(".utilities"); + navLinks.forEach((link) => { + link.addEventListener("click", function () { + if (burger.classList.contains("is-active")) { + toggleClass(burger, "is-active"); + toggleClass(nav, "is-active"); + } + }); + }); - // Theme - const themeBtn = utilitiesDiv.querySelector(".theme"); - updateTheme(); + // Utilities + const utilitiesDiv = document.querySelector(".utilities"); - themeBtn.addEventListener("click", function () { - const DBTheme = localStorage.getItem("theme") || "light"; - if (DBTheme === "light") localStorage.setItem("theme", "dark"); - else localStorage.setItem("theme", "light"); - updateTheme(); - }); + // Theme + const themeBtn = utilitiesDiv.querySelector(".theme"); + updateTheme(); - function updateTheme () { - const bodyTheme = body.getAttribute("data-theme") || "light"; - const DBTheme = localStorage.getItem("theme") || "light"; + themeBtn.addEventListener("click", function () { + const DBTheme = localStorage.getItem("theme") || "light"; + if (DBTheme === "light") localStorage.setItem("theme", "dark"); + else localStorage.setItem("theme", "light"); + updateTheme(); + }); - if (DBTheme === "dark" && bodyTheme !== "dark") { - body.setAttribute("data-theme", "dark"); - themeBtn.innerHTML = ""; - } else if (DBTheme === "light" && bodyTheme !== "light") { - body.setAttribute("data-theme", "light"); - themeBtn.innerHTML = ""; - } - } + function updateTheme() { + const bodyTheme = body.getAttribute("data-theme") || "light"; + const DBTheme = localStorage.getItem("theme") || "light"; - makeSearch(); - }); + if (DBTheme === "dark" && bodyTheme !== "dark") { + body.setAttribute("data-theme", "dark"); + themeBtn.innerHTML = ''; + } else if (DBTheme === "light" && bodyTheme !== "light") { + body.setAttribute("data-theme", "light"); + themeBtn.innerHTML = ''; + } + } - function toggleClass(element, className) { - if (element.classList.contains(className)) { - element.classList.remove(className); - } else { - element.classList.add(className); - } + makeSearch(); + }); + + function toggleClass(element, className) { + if (element.classList.contains(className)) { + element.classList.remove(className); + } else { + element.classList.add(className); } + } - async function makeSearch() { - const searchData = await fetch("search.json"); - const data = await searchData.json(); - const textbox = document.getElementById("search-box"); - const results = document.getElementById("search-results"); - const fuse = new Fuse(data, { - includeScore: true, - keys: ['name'] - }); - textbox.addEventListener("change", textboxhandle); - textbox.addEventListener("keydown", textboxhandle); - textbox.addEventListener("keyup", textboxhandle); - textbox.addEventListener("keypress", textboxhandle); - function textboxhandle() { - const val = textbox.value.trim(); - if(val.length) { - const items = fuse.search(val); - let resHtml = ""; - if(items.length) { - items.sort((a, b) => b.score - a.score).forEach(({ item }) => { - resHtml += `

    ${item.name}${item.url}

    `; - }); - } else { - resHtml += "

    No result

    " - } - results.innerHTML = resHtml; - results.style.display = "block"; - } else { - results.innerHTML = ""; - results.style.display = "none"; - } + async function makeSearch() { + const searchData = await fetch("search.json"); + const data = await searchData.json(); + const textbox = document.getElementById("search-box"); + const results = document.getElementById("search-results"); + const fuse = new Fuse(data, { + includeScore: true, + keys: ["name"], + }); + textbox.addEventListener("change", textboxhandle); + textbox.addEventListener("keydown", textboxhandle); + textbox.addEventListener("keyup", textboxhandle); + textbox.addEventListener("keypress", textboxhandle); + function textboxhandle() { + const val = textbox.value.trim(); + if (val.length) { + const items = fuse.search(val); + let resHtml = ""; + if (items.length) { + items + .sort((a, b) => b.score - a.score) + .forEach(({ item }) => { + resHtml += `

    ${item.name}${item.url}

    `; + }); + } else { + resHtml += "

    No result

    "; } + results.innerHTML = resHtml; + results.style.display = "block"; + } else { + results.innerHTML = ""; + results.style.display = "none"; + } } -} + } +}; -init(); \ No newline at end of file +init(); diff --git a/static/scripts/prettify/lang-css.js b/static/scripts/prettify/lang-css.js index 041e1f5..2d8df51 100644 --- a/static/scripts/prettify/lang-css.js +++ b/static/scripts/prettify/lang-css.js @@ -1,2 +1,21 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); +PR.registerLangHandler( + PR.createSimpleLexer( + [["pln", /^[\t\n\f\r ]+/, null, " \t\r\n "]], + [ + ["str", /^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/, null], + ["str", /^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/, null], + ["lang-css-str", /^url\(([^"')]*)\)/i], + ["kwd", /^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i, null], + ["lang-css-kw", /^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i], + ["com", /^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//], + ["com", /^(?:<\!--|--\>)/], + ["lit", /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], + ["lit", /^#[\da-f]{3,6}/i], + ["pln", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i], + ["pun", /^[^\s\w"']+/], + ] + ), + ["css"] +); +PR.registerLangHandler(PR.createSimpleLexer([], [["kwd", /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]), ["css-kw"]); +PR.registerLangHandler(PR.createSimpleLexer([], [["str", /^[^"')]+/]]), ["css-str"]); diff --git a/static/scripts/prettify/prettify.js b/static/scripts/prettify/prettify.js index eef5ad7..cb35c58 100644 --- a/static/scripts/prettify/prettify.js +++ b/static/scripts/prettify/prettify.js @@ -1,28 +1,413 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p 122 || (d < 65 || j > 90 || b.push([Math.max(65, j) | 32, Math.min(d, 90) | 32]), d < 97 || j > 122 || b.push([Math.max(97, j) & -33, Math.min(d, 122) & -33])); + } + } + b.sort(function (a, f) { + return a[0] - f[0] || f[1] - a[1]; + }); + f = []; + j = [NaN, NaN]; + for (c = 0; c < b.length; ++c) (i = b[c]), i[0] <= j[1] + 1 ? (j[1] = Math.max(j[1], i[1])) : f.push((j = i)); + b = ["["]; + o && b.push("^"); + b.push.apply(b, a); + for (c = 0; c < f.length; ++c) (i = f[c]), b.push(e(i[0])), i[1] > i[0] && (i[1] + 1 > i[0] && b.push("-"), b.push(e(i[1]))); + b.push("]"); + return b.join(""); + } + function y(a) { + for (var f = a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g), b = f.length, d = [], c = 0, i = 0; c < b; ++c) { + var j = f[c]; + j === "(" ? ++i : "\\" === j.charAt(0) && (j = +j.substring(1)) && j <= i && (d[j] = -1); + } + for (c = 1; c < d.length; ++c) -1 === d[c] && (d[c] = ++t); + for (i = c = 0; c < b; ++c) (j = f[c]), j === "(" ? (++i, d[i] === void 0 && (f[c] = "(?:")) : "\\" === j.charAt(0) && (j = +j.substring(1)) && j <= i && (f[c] = "\\" + d[i]); + for (i = c = 0; c < b; ++c) "^" === f[c] && "^" !== f[c + 1] && (f[c] = ""); + if (a.ignoreCase && s) + for (c = 0; c < b; ++c) + (j = f[c]), + (a = j.charAt(0)), + j.length >= 2 && a === "[" + ? (f[c] = h(j)) + : a !== "\\" && + (f[c] = j.replace(/[A-Za-z]/g, function (a) { + a = a.charCodeAt(0); + return "[" + String.fromCharCode(a & -33, a | 32) + "]"; + })); + return f.join(""); + } + for (var t = 0, s = !1, l = !1, p = 0, d = a.length; p < d; ++p) { + var g = a[p]; + if (g.ignoreCase) l = !0; + else if (/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi, ""))) { + s = !0; + l = !1; + break; + } + } + for (var r = { b: 8, t: 9, n: 10, v: 11, f: 12, r: 13 }, n = [], p = 0, d = a.length; p < d; ++p) { + g = a[p]; + if (g.global || g.multiline) throw Error("" + g); + n.push("(?:" + y(g) + ")"); + } + return RegExp(n.join("|"), l ? "gi" : "g"); + } + function M(a) { + function m(a) { + switch (a.nodeType) { + case 1: + if (e.test(a.className)) break; + for (var g = a.firstChild; g; g = g.nextSibling) m(g); + g = a.nodeName; + if ("BR" === g || "LI" === g) (h[s] = "\n"), (t[s << 1] = y++), (t[(s++ << 1) | 1] = a); + break; + case 3: + case 4: + (g = a.nodeValue), g.length && ((g = p ? g.replace(/\r\n?/g, "\n") : g.replace(/[\t\n\r ]+/g, " ")), (h[s] = g), (t[s << 1] = y), (y += g.length), (t[(s++ << 1) | 1] = a)); + } + } + var e = /(?:^|\s)nocode(?:\s|$)/, + h = [], + y = 0, + t = [], + s = 0, + l; + a.currentStyle ? (l = a.currentStyle.whiteSpace) : window.getComputedStyle && (l = document.defaultView.getComputedStyle(a, q).getPropertyValue("white-space")); + var p = l && "pre" === l.substring(0, 3); + m(a); + return { a: h.join("").replace(/\n$/, ""), c: t }; + } + function B(a, m, e, h) { + m && ((a = { a: m, d: a }), e(a), h.push.apply(h, a.e)); + } + function x(a, m) { + function e(a) { + for (var l = a.d, p = [l, "pln"], d = 0, g = a.a.match(y) || [], r = {}, n = 0, z = g.length; n < z; ++n) { + var f = g[n], + b = r[f], + o = void 0, + c; + if (typeof b === "string") c = !1; + else { + var i = h[f.charAt(0)]; + if (i) (o = f.match(i[1])), (b = i[0]); + else { + for (c = 0; c < t; ++c) + if (((i = m[c]), (o = f.match(i[1])))) { + b = i[0]; + break; + } + o || (b = "pln"); + } + if ((c = b.length >= 5 && "lang-" === b.substring(0, 5)) && !(o && typeof o[1] === "string")) (c = !1), (b = "src"); + c || (r[f] = b); + } + i = d; + d += f.length; + if (c) { + c = o[1]; + var j = f.indexOf(c), + k = j + c.length; + o[2] && ((k = f.length - o[2].length), (j = k - c.length)); + b = b.substring(5); + B(l + i, f.substring(0, j), e, p); + B(l + i + j, c, C(b, c), p); + B(l + i + k, f.substring(k), e, p); + } else p.push(l + i, b); + } + a.e = p; + } + var h = {}, + y; + (function () { + for (var e = a.concat(m), l = [], p = {}, d = 0, g = e.length; d < g; ++d) { + var r = e[d], + n = r[3]; + if (n) for (var k = n.length; --k >= 0; ) h[n.charAt(k)] = r; + r = r[1]; + n = "" + r; + p.hasOwnProperty(n) || (l.push(r), (p[n] = q)); + } + l.push(/[\S\s]/); + y = L(l); + })(); + var t = m.length; + return e; + } + function u(a) { + var m = [], + e = []; + a.tripleQuotedStrings + ? m.push(["str", /^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/, q, "'\""]) + : a.multiLineStrings + ? m.push(["str", /^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, q, "'\"`"]) + : m.push(["str", /^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/, q, "\"'"]); + a.verbatimStrings && e.push(["str", /^@"(?:[^"]|"")*(?:"|$)/, q]); + var h = a.hashComments; + h && (a.cStyleComments ? (h > 1 ? m.push(["com", /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, q, "#"]) : m.push(["com", /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/, q, "#"]), e.push(["str", /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, q])) : m.push(["com", /^#[^\n\r]*/, q, "#"])); + a.cStyleComments && (e.push(["com", /^\/\/[^\n\r]*/, q]), e.push(["com", /^\/\*[\S\s]*?(?:\*\/|$)/, q])); + a.regexLiterals && e.push(["lang-regex", /^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]); + (h = a.types) && e.push(["typ", h]); + a = ("" + a.keywords).replace(/^ | $/g, ""); + a.length && e.push(["kwd", RegExp("^(?:" + a.replace(/[\s,]+/g, "|") + ")\\b"), q]); + m.push(["pln", /^\s+/, q, " \r\n\t\xa0"]); + e.push(["lit", /^@[$_a-z][\w$@]*/i, q], ["typ", /^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/, q], ["pln", /^[$_a-z][\w$@]*/i, q], ["lit", /^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i, q, "0123456789"], ["pln", /^\\[\S\s]?/, q], ["pun", /^.[^\s\w"-$'./@\\`]*/, q]); + return x(m, e); + } + function D(a, m) { + function e(a) { + switch (a.nodeType) { + case 1: + if (k.test(a.className)) break; + if ("BR" === a.nodeName) h(a), a.parentNode && a.parentNode.removeChild(a); + else for (a = a.firstChild; a; a = a.nextSibling) e(a); + break; + case 3: + case 4: + if (p) { + var b = a.nodeValue, + d = b.match(t); + if (d) { + var c = b.substring(0, d.index); + a.nodeValue = c; + (b = b.substring(d.index + d[0].length)) && a.parentNode.insertBefore(s.createTextNode(b), a.nextSibling); + h(a); + c || a.parentNode.removeChild(a); + } + } + } + } + function h(a) { + function b(a, d) { + var e = d ? a.cloneNode(!1) : a, + f = a.parentNode; + if (f) { + var f = b(f, 1), + g = a.nextSibling; + f.appendChild(e); + for (var h = g; h; h = g) (g = h.nextSibling), f.appendChild(h); + } + return e; + } + for (; !a.nextSibling; ) if (((a = a.parentNode), !a)) return; + for (var a = b(a.nextSibling, 0), e; (e = a.parentNode) && e.nodeType === 1; ) a = e; + d.push(a); + } + var k = /(?:^|\s)nocode(?:\s|$)/, + t = /\r\n?|\n/, + s = a.ownerDocument, + l; + a.currentStyle ? (l = a.currentStyle.whiteSpace) : window.getComputedStyle && (l = s.defaultView.getComputedStyle(a, q).getPropertyValue("white-space")); + var p = l && "pre" === l.substring(0, 3); + for (l = s.createElement("LI"); a.firstChild; ) l.appendChild(a.firstChild); + for (var d = [l], g = 0; g < d.length; ++g) e(d[g]); + m === (m | 0) && d[0].setAttribute("value", m); + var r = s.createElement("OL"); + r.className = "linenums"; + for (var n = Math.max(0, (m - 1) | 0) || 0, g = 0, z = d.length; g < z; ++g) (l = d[g]), (l.className = "L" + ((g + n) % 10)), l.firstChild || l.appendChild(s.createTextNode("\xa0")), r.appendChild(l); + a.appendChild(r); + } + function k(a, m) { + for (var e = m.length; --e >= 0; ) { + var h = m[e]; + A.hasOwnProperty(h) ? window.console && console.warn("cannot override language handler %s", h) : (A[h] = a); + } + } + function C(a, m) { + if (!a || !A.hasOwnProperty(a)) a = /^\s*= o && (h += 2); + e >= c && (a += 2); + } + } catch (w) { + "console" in window && console.log(w && w.stack ? w.stack : w); + } + } + var v = ["break,continue,do,else,for,if,return,while"], + w = [[v, "auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"], + F = [w, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"], + G = [w, "abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], + H = [G, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"], + w = [w, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"], + I = [v, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], + J = [v, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"], + v = [v, "case,done,elif,esac,eval,fi,function,in,local,set,then,until"], + K = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/, + N = /\S/, + O = u({ keywords: [F, H, w, "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END" + I, J, v], hashComments: !0, cStyleComments: !0, multiLineStrings: !0, regexLiterals: !0 }), + A = {}; + k(O, ["default-code"]); + k( + x( + [], + [ + ["pln", /^[^]*(?:>|$)/], + ["com", /^<\!--[\S\s]*?(?:--\>|$)/], + ["lang-", /^<\?([\S\s]+?)(?:\?>|$)/], + ["lang-", /^<%([\S\s]+?)(?:%>|$)/], + ["pun", /^(?:<[%?]|[%?]>)/], + ["lang-", /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i], + ["lang-js", /^]*>([\S\s]*?)(<\/script\b[^>]*>)/i], + ["lang-css", /^]*>([\S\s]*?)(<\/style\b[^>]*>)/i], + ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i], + ] + ), + ["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"] + ); + k( + x( + [ + ["pln", /^\s+/, q, " \t\r\n"], + ["atv", /^(?:"[^"]*"?|'[^']*'?)/, q, "\"'"], + ], + [ + ["tag", /^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i], + ["atn", /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], + ["lang-uq.val", /^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/], + ["pun", /^[/<->]+/], + ["lang-js", /^on\w+\s*=\s*"([^"]+)"/i], + ["lang-js", /^on\w+\s*=\s*'([^']+)'/i], + ["lang-js", /^on\w+\s*=\s*([^\s"'>]+)/i], + ["lang-css", /^style\s*=\s*"([^"]+)"/i], + ["lang-css", /^style\s*=\s*'([^']+)'/i], + ["lang-css", /^style\s*=\s*([^\s"'>]+)/i], + ] + ), + ["in.tag"] + ); + k(x([], [["atv", /^[\S\s]+/]]), ["uq.val"]); + k(u({ keywords: F, hashComments: !0, cStyleComments: !0, types: K }), ["c", "cc", "cpp", "cxx", "cyc", "m"]); + k(u({ keywords: "null,true,false" }), ["json"]); + k(u({ keywords: H, hashComments: !0, cStyleComments: !0, verbatimStrings: !0, types: K }), ["cs"]); + k(u({ keywords: G, cStyleComments: !0 }), ["java"]); + k(u({ keywords: v, hashComments: !0, multiLineStrings: !0 }), ["bsh", "csh", "sh"]); + k(u({ keywords: I, hashComments: !0, multiLineStrings: !0, tripleQuotedStrings: !0 }), ["cv", "py"]); + k(u({ keywords: "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END", hashComments: !0, multiLineStrings: !0, regexLiterals: !0 }), ["perl", "pl", "pm"]); + k(u({ keywords: J, hashComments: !0, multiLineStrings: !0, regexLiterals: !0 }), ["rb"]); + k(u({ keywords: w, cStyleComments: !0, regexLiterals: !0 }), ["js"]); + k(u({ keywords: "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", hashComments: 3, cStyleComments: !0, multilineStrings: !0, tripleQuotedStrings: !0, regexLiterals: !0 }), ["coffee"]); + k(x([], [["str", /^[\S\s]+/]]), ["regex"]); + window.prettyPrintOne = function (a, m, e) { + var h = document.createElement("PRE"); + h.innerHTML = a; + e && D(h, e); + E({ g: m, i: e, h: h }); + return h.innerHTML; + }; + window.prettyPrint = function (a) { + function m() { + for (var e = window.PR_SHOULD_USE_CONTINUATION ? l.now() + 250 : Infinity; p < h.length && l.now() < e; p++) { + var n = h[p], + k = n.className; + if (k.indexOf("prettyprint") >= 0) { + var k = k.match(g), + f, + b; + if ((b = !k)) { + b = n; + for (var o = void 0, c = b.firstChild; c; c = c.nextSibling) var i = c.nodeType, o = i === 1 ? (o ? b : c) : i === 3 ? (N.test(c.nodeValue) ? b : o) : o; + b = (f = o === b ? void 0 : o) && "CODE" === f.tagName; + } + b && (k = f.className.match(g)); + k && (k = k[1]); + b = !1; + for (o = n.parentNode; o; o = o.parentNode) + if ((o.tagName === "pre" || o.tagName === "code" || o.tagName === "xmp") && o.className && o.className.indexOf("prettyprint") >= 0) { + b = !0; + break; + } + b || ((b = (b = n.className.match(/\blinenums\b(?::(\d+))?/)) ? (b[1] && b[1].length ? +b[1] : !0) : !1) && D(n, b), (d = { g: k, h: n, i: b }), E(d)); + } + } + p < h.length ? setTimeout(m, 250) : a && a(); + } + for (var e = [document.getElementsByTagName("pre"), document.getElementsByTagName("code"), document.getElementsByTagName("xmp")], h = [], k = 0; k < e.length; ++k) for (var t = 0, s = e[k].length; t < s; ++t) h.push(e[k][t]); + var e = q, + l = Date; + l.now || + (l = { + now: function () { + return +new Date(); + }, + }); + var p = 0, + d, + g = /\blang(?:uage)?-([\w.]+)(?!\S)/; + m(); + }; + window.PR = { createSimpleLexer: x, registerLangHandler: k, sourceDecorator: u, PR_ATTRIB_NAME: "atn", PR_ATTRIB_VALUE: "atv", PR_COMMENT: "com", PR_DECLARATION: "dec", PR_KEYWORD: "kwd", PR_LITERAL: "lit", PR_NOCODE: "nocode", PR_PLAIN: "pln", PR_PUNCTUATION: "pun", PR_SOURCE: "src", PR_STRING: "str", PR_TAG: "tag", PR_TYPE: "typ" }; +})(); diff --git a/static/styles/prettify.css b/static/styles/prettify.css index 68095ba..514a520 100644 --- a/static/styles/prettify.css +++ b/static/styles/prettify.css @@ -32,7 +32,6 @@ li.L9 { } @media screen { - /* string content */ .str { @@ -118,66 +117,74 @@ li.L9 { } } - body[data-theme="dark"] .prettyprint { - background: #1d1f21; - font-family: Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace; - border: 0 !important; +body[data-theme="dark"] .prettyprint { + background: #1d1f21; + font-family: Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace; + border: 0 !important; } - body[data-theme="dark"] .pln { - color: #c5c8c6; +body[data-theme="dark"] .pln { + color: #c5c8c6; } - body[data-theme="dark"] ol.linenums { - margin-top: 0; - margin-bottom: 0; - color: #969896; +body[data-theme="dark"] ol.linenums { + margin-top: 0; + margin-bottom: 0; + color: #969896; } - body[data-theme="dark"] li.L0, body[data-theme="dark"] li.L1, body[data-theme="dark"] li.L2, body[data-theme="dark"] li.L3, body[data-theme="dark"] li.L4, body[data-theme="dark"] li.L5, body[data-theme="dark"] li.L6, body[data-theme="dark"] li.L7, body[data-theme="dark"] li.L8, body[data-theme="dark"] li.L9 { - padding-left: 1em; - background-color: #1d1f21; - list-style-type: decimal; +body[data-theme="dark"] li.L0, +body[data-theme="dark"] li.L1, +body[data-theme="dark"] li.L2, +body[data-theme="dark"] li.L3, +body[data-theme="dark"] li.L4, +body[data-theme="dark"] li.L5, +body[data-theme="dark"] li.L6, +body[data-theme="dark"] li.L7, +body[data-theme="dark"] li.L8, +body[data-theme="dark"] li.L9 { + padding-left: 1em; + background-color: #1d1f21; + list-style-type: decimal; } - @media screen { - body[data-theme="dark"] .str { - color: #b5bd68; - } - body[data-theme="dark"] .kwd { - color: #b294bb; - } - body[data-theme="dark"] .com { - color: #969896; - } - body[data-theme="dark"] .typ { - color: #81a2be; - } - body[data-theme="dark"] .lit { - color: #de935f; - } - body[data-theme="dark"] .pun { - color: #c5c8c6; - } - body[data-theme="dark"] .opn { - color: #c5c8c6; - } - body[data-theme="dark"] .clo { - color: #c5c8c6; - } - body[data-theme="dark"] .tag { - color: #c66; - } - body[data-theme="dark"] .atn { - color: #de935f; - } - body[data-theme="dark"] .atv { - color: #8abeb7; - } - body[data-theme="dark"] .dec { - color: #de935f; - } - body[data-theme="dark"] .var { - color: #c66; - } - body[data-theme="dark"] .fun { - color: #81a2be; - } +@media screen { + body[data-theme="dark"] .str { + color: #b5bd68; + } + body[data-theme="dark"] .kwd { + color: #b294bb; + } + body[data-theme="dark"] .com { + color: #969896; + } + body[data-theme="dark"] .typ { + color: #81a2be; + } + body[data-theme="dark"] .lit { + color: #de935f; + } + body[data-theme="dark"] .pun { + color: #c5c8c6; + } + body[data-theme="dark"] .opn { + color: #c5c8c6; + } + body[data-theme="dark"] .clo { + color: #c5c8c6; + } + body[data-theme="dark"] .tag { + color: #c66; + } + body[data-theme="dark"] .atn { + color: #de935f; + } + body[data-theme="dark"] .atv { + color: #8abeb7; + } + body[data-theme="dark"] .dec { + color: #de935f; + } + body[data-theme="dark"] .var { + color: #c66; + } + body[data-theme="dark"] .fun { + color: #81a2be; + } } - \ No newline at end of file diff --git a/static/styles/skyceil.css b/static/styles/skyceil.css index 81a25f6..ca98f0e 100644 --- a/static/styles/skyceil.css +++ b/static/styles/skyceil.css @@ -1,456 +1,480 @@ @font-face { - font-family: 'Montserrat'; - font-weight: normal; - font-style: normal; - src: url('../fonts/Poppins-Regular.ttf') format('truetype'); + font-family: "Montserrat"; + font-weight: normal; + font-style: normal; + src: url("../fonts/Poppins-Regular.ttf") format("truetype"); } @font-face { - font-family: 'Montserrat Light'; - font-weight: normal; - font-style: normal; - src: url('../fonts/Poppins-Light.ttf') format('truetype'); + font-family: "Montserrat Light"; + font-weight: normal; + font-style: normal; + src: url("../fonts/Poppins-Light.ttf") format("truetype"); } :root { - --font: #4d4e53; - --second-font: #aaa; - --theme-font: #aaa; + --font: #4d4e53; + --second-font: #aaa; + --theme-font: #aaa; - --background: #fff; + --background: #fff; - --link: #0095dd; - --attr-link: #999; + --link: #0095dd; + --attr-link: #999; - --border: #ddd; - --second-border: #eee; + --border: #ddd; + --second-border: #eee; - --code-bg: #e2e2e2; - --simple-code: #f5f5f5; + --code-bg: #e2e2e2; + --simple-code: #f5f5f5; - --disabled: #454545; - --important-red: #950B02; - - --alpha-dark: #2f3136; - --dark-lite: #24292e; + --disabled: #454545; + --important-red: #950b02; + + --alpha-dark: #2f3136; + --dark-lite: #24292e; } body[data-theme="dark"] { - --font: #ccc; - --second-font: #e1e1ff; - --theme-font: #4b4b4b; + --font: #ccc; + --second-font: #e1e1ff; + --theme-font: #4b4b4b; - --background: #161616; + --background: #161616; - --link: #00a2f3; - --attr-link: #d8d8e7; + --link: #00a2f3; + --attr-link: #d8d8e7; - --border: #272727; - --second-border: #252525; + --border: #272727; + --second-border: #252525; - --code-bg: #3d3d3d; - --simple-code: #1d1d1d; + --code-bg: #3d3d3d; + --simple-code: #1d1d1d; - --disabled: #454545; - --important-red: #950B02; + --disabled: #454545; + --important-red: #950b02; } .theme { - padding: 10px 15px; - color: var(--font); - border: none; - border-radius: 10px; - outline: none; - background: transparent !important; - font-size: 1.2rem; - cursor: pointer; + padding: 10px 15px; + color: var(--font); + border: none; + border-radius: 10px; + outline: none; + background: transparent !important; + font-size: 1.2rem; + cursor: pointer; } .utilities { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; } #search-box { - outline: none; - border: 2px solid var(--simple-code); - padding: 5px; - border-radius: 2px; - font-family: 'Montserrat', sans-serif; - background-color: var(--background); - color: var(--font); + outline: none; + border: 2px solid var(--simple-code); + padding: 5px; + border-radius: 2px; + font-family: "Montserrat", sans-serif; + background-color: var(--background); + color: var(--font); } #search-results { - position: absolute; - border: 2px solid var(--simple-code); - background-color: var(--background); - width: 75%; - margin-top: 6px; - max-height: 70%; - overflow-y: auto; + position: absolute; + border: 2px solid var(--simple-code); + background-color: var(--background); + width: 75%; + margin-top: 6px; + max-height: 70%; + overflow-y: auto; } #search-results p { - display: block; - cursor: pointer; - padding: 5px; - font-size: 1.2rem; - color: var(--font); - text-decoration: none; - margin: 0; + display: block; + cursor: pointer; + padding: 5px; + font-size: 1.2rem; + color: var(--font); + text-decoration: none; + margin: 0; } #search-results p a { - font-size: 14px; - display: block; + font-size: 14px; + display: block; } #search-results p:hover { - background-color: var(--simple-code); + background-color: var(--simple-code); } -html -{ - overflow-x: hidden; - font-size: 14px; +html { + overflow-x: hidden; + font-size: 14px; } -body -{ - font-family: 'Montserrat', sans-serif; - line-height: 1.5; - color: var(--font); - background-color: var(--background); - margin: 0; - padding: 0; - width: 100%; - height: 100%; +body { + font-family: "Montserrat", sans-serif; + line-height: 1.5; + color: var(--font); + background-color: var(--background); + margin: 0; + padding: 0; + width: 100%; + height: 100%; } -a, a:visited, a:active { - color: var(--link); - text-decoration: none; +a, +a:visited, +a:active { + color: var(--link); + text-decoration: none; } a:hover { - text-decoration: underline; + text-decoration: underline; } -header -{ - display: block; - padding-right: 4px; +header { + display: block; + padding-right: 4px; } -tt, code, kbd, samp { - font-family: Consolas, Monaco, 'Andale Mono', monospace; +tt, +code, +kbd, +samp { + font-family: Consolas, Monaco, "Andale Mono", monospace; } .class-description { - font-size: 130%; - line-height: 140%; - margin-bottom: 1em; - margin-top: 1em; + font-size: 130%; + line-height: 140%; + margin-bottom: 1em; + margin-top: 1em; } .class-description:empty { - margin: 0; + margin: 0; } #main { - float: right; - width: 80%; + float: right; + width: 80%; } .page-title { - padding-top: 1rem; - padding-left: 30px; + padding-top: 1rem; + padding-left: 30px; } article dl { - margin-bottom: 40px; + margin-bottom: 40px; } article img { max-width: 100%; } -section -{ - display: block; - background-color: var(--background); - padding: 0 24px 12px 30px; - margin-right: 30px; +section { + display: block; + background-color: var(--background); + padding: 0 24px 12px 30px; + margin-right: 30px; } .variation { - display: none; + display: none; } .signature-attributes { - font-size: 60%; - color: var(--second-font); - font-style: italic; - font-weight: lighter; -} - -nav -{ - display: block; - float: left; - width: 20%; - box-sizing: border-box; - padding: 1rem; - position: fixed; - overflow-x: auto; - overflow-y: scroll; - height: 100%; - left: 0; - transition: cubic-bezier(0.76, 0.01, 0.3, 0.99) 0.75s; + font-size: 60%; + color: var(--second-font); + font-style: italic; + font-weight: lighter; +} + +nav { + display: block; + float: left; + width: 20%; + box-sizing: border-box; + padding: 1rem; + position: fixed; + overflow-x: auto; + overflow-y: scroll; + height: 100%; + left: 0; + transition: cubic-bezier(0.76, 0.01, 0.3, 0.99) 0.75s; } nav ul { - font-size: 100%; - line-height: 17px; - padding: 0; - margin: 0; - margin-bottom: 12px; - list-style-type: none; + font-size: 100%; + line-height: 17px; + padding: 0; + margin: 0; + margin-bottom: 12px; + list-style-type: none; } nav .no-bottom { - margin-bottom: 0 !important; + margin-bottom: 0 !important; } -nav ul a, nav ul a:visited, nav ul a:active { - line-height: 18px; - color: var(--font); +nav ul a, +nav ul a:visited, +nav ul a:active { + line-height: 18px; + color: var(--font); } nav ul a:active { - text-decoration: underline; + text-decoration: underline; } nav h3 { - margin-top: 12px; + margin-top: 12px; } nav li { - margin-top: 6px; + margin-top: 6px; } .burger { - display: none; - width: 40px; - position: fixed; - top: 10px; - right: 10px; - z-index: 1; - padding: 3px; - transition: 0.5s; -} - -.burger-line-1, .burger-line-2, .burger-line-3 { - margin: 4px; - padding: 3px; - background: var(--font); - border-radius: 1px; - opacity: 1; - transition: 0.5s; + display: none; + width: 40px; + position: fixed; + top: 10px; + right: 10px; + z-index: 1; + padding: 3px; + transition: 0.5s; +} + +.burger-line-1, +.burger-line-2, +.burger-line-3 { + margin: 4px; + padding: 3px; + background: var(--font); + border-radius: 1px; + opacity: 1; + transition: 0.5s; } .burger.is-active .burger-line-1 { - transform: translateY(10px) rotate(45deg); + transform: translateY(10px) rotate(45deg); } .burger.is-active .burger-line-2 { - opacity: 0; + opacity: 0; } .burger.is-active .burger-line-3 { - transform: translateY(-10px) rotate(-45deg); + transform: translateY(-10px) rotate(-45deg); } footer { - display: block; - padding: 6px; - font-style: italic; - font-size: 90%; - text-align: center; - opacity: 0.7; - padding-left: 20%; - margin-bottom: 1rem; + display: block; + padding: 6px; + font-style: italic; + font-size: 90%; + text-align: center; + opacity: 0.7; + padding-left: 20%; + margin-bottom: 1rem; } -h1, h2, h3, h4 { - margin: 0; +h1, +h2, +h3, +h4 { + margin: 0; } -h1 -{ - font-family: 'Montserrat Light', sans-serif; - font-size: 48px; - letter-spacing: -2px; - margin: 12px 24px 20px 0px; +h1 { + font-family: "Montserrat Light", sans-serif; + font-size: 48px; + letter-spacing: -2px; + margin: 12px 24px 20px 0px; } -h2, h3.subsection-title -{ - font-size: 30px; - font-weight: 700; - letter-spacing: -1px; - margin-bottom: 12px; +h2, +h3.subsection-title { + font-size: 30px; + font-weight: 700; + letter-spacing: -1px; + margin-bottom: 12px; } h3.subsection-title { - text-decoration: underline; + text-decoration: underline; } -h3 -{ - font-size: 24px; - letter-spacing: -0.5px; - margin-bottom: 12px; +h3 { + font-size: 24px; + letter-spacing: -0.5px; + margin-bottom: 12px; } -h4 -{ - font-size: 18px; - letter-spacing: -0.33px; - margin-bottom: 12px; - color: var(--font); +h4 { + font-size: 18px; + letter-spacing: -0.33px; + margin-bottom: 12px; + color: var(--font); } -h5, .container-overview .subsection-title -{ - font-size: 120%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 8px 0 3px 0; +h5, +.container-overview .subsection-title { + font-size: 120%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 8px 0 3px 0; } -h6 -{ - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; +h6 { + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; } -table -{ - border-spacing: 0; - border: 0; - border-collapse: collapse; +table { + border-spacing: 0; + border: 0; + border-collapse: collapse; } -td, th -{ - border: 1px solid var(--border); - margin: 0px; - text-align: left; - vertical-align: top; - padding: 4px 6px; - display: table-cell; +td, +th { + border: 1px solid var(--border); + margin: 0px; + text-align: left; + vertical-align: top; + padding: 4px 6px; + display: table-cell; } -thead tr -{ - background-color: var(--border); - font-weight: bold; +thead tr { + background-color: var(--border); + font-weight: bold; } -th { border-right: 1px solid var(--second-font); } -tr > th:last-child { border-right: 1px solid var(--border); } +th { + border-right: 1px solid var(--second-font); +} +tr > th:last-child { + border-right: 1px solid var(--border); +} -.ancestors, .attribs { color: var(--attr-link); } -.ancestors a, .attribs a -{ - color: var(--attr-link) !important; - text-decoration: none; +.ancestors, +.attribs { + color: var(--attr-link); +} +.ancestors a, +.attribs a { + color: var(--attr-link) !important; + text-decoration: none; } -.clear -{ - clear: both; +.clear { + clear: both; } -.important -{ - font-weight: bold; - color: var(--important-red); +.important { + font-weight: bold; + color: var(--important-red); } .yes-def { - text-indent: -1000px; + text-indent: -1000px; } .type-signature { - color: var(--theme-font); + color: var(--theme-font); } .name { - background-color: var(--second-border); - padding: 1rem 1.5rem; - font-weight: bold; + background-color: var(--second-border); + padding: 1rem 1.5rem; + font-weight: bold; } -.name, .signature { - font-family: Consolas, Monaco, 'Andale Mono', monospace; +.name, +.signature { + font-family: Consolas, Monaco, "Andale Mono", monospace; } -.details { margin-top: 14px; padding-bottom: 6px; border-left: 2px solid var(--border); } -.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 70px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details .object-value { padding-top: 0; } -.details pre.prettyprint { margin: 0 } +.details { + margin-top: 14px; + padding-bottom: 6px; + border-left: 2px solid var(--border); +} +.details dt { + width: 120px; + float: left; + padding-left: 10px; + padding-top: 6px; +} +.details dd { + margin-left: 70px; +} +.details ul { + margin: 0; +} +.details ul { + list-style-type: none; +} +.details li { + margin-left: 30px; + padding-top: 6px; +} +.details .object-value { + padding-top: 0; +} +.details pre.prettyprint { + margin: 0; +} .description { - margin-bottom: 1em; - margin-top: 1em; + margin-bottom: 1em; + margin-top: 1em; } -.code-caption -{ - font-style: italic; - font-size: 107%; - margin: 0; +.code-caption { + font-style: italic; + font-size: 107%; + margin: 0; } -.source -{ - border: 1px solid var(--border); - width: 80%; - overflow: auto; +.source { + border: 1px solid var(--border); + width: 80%; + overflow: auto; } .prettyprint.source { - width: inherit; + width: inherit; } -.source code -{ - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - color: var(--font); +.source code { + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + color: var(--font); } -.prettyprint code span.line -{ +.prettyprint code span.line { display: inline-block; } -.prettyprint.linenums -{ +.prettyprint.linenums { padding: 10px 10px 10px 70px; -webkit-user-select: none; -moz-user-select: none; @@ -458,25 +482,21 @@ tr > th:last-child { border-right: 1px solid var(--border); } user-select: none; } -.prettyprint.linenums ol -{ +.prettyprint.linenums ol { padding-left: 0; } .prettyprint.linenums li.selected, -.prettyprint.linenums li.selected * -{ +.prettyprint.linenums li.selected * { background-color: var(--code-bg); } body[data-theme="dark"] .prettyprint.linenums li.selected, -body[data-theme="dark"] .prettyprint.linenums li.selected * -{ +body[data-theme="dark"] .prettyprint.linenums li.selected * { background-color: var(--code-bg); } -.prettyprint.linenums li * -{ +.prettyprint.linenums li * { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; @@ -484,170 +504,171 @@ body[data-theme="dark"] .prettyprint.linenums li.selected * } .prettyprint.example { - padding: 10px 20px; + padding: 10px 20px; } .prettyprint.example li { - margin-left: 25px; + margin-left: 25px; } -.params .name, .props .name, .name code { - color: var(--font); - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 100%; - margin: 3px 6px !important; - vertical-align: middle; - padding: 0 !important; - background-color: transparent; - font-weight: normal; +.params .name, +.props .name, +.name code { + color: var(--font); + font-family: Consolas, Monaco, "Andale Mono", monospace; + font-size: 100%; + margin: 3px 6px !important; + vertical-align: middle; + padding: 0 !important; + background-color: transparent; + font-weight: normal; } -.name code, .simple-code { - background-color: var(--simple-code); - border-radius: 3px; - padding: 2px 4px !important; +.name code, +.simple-code { + background-color: var(--simple-code); + border-radius: 3px; + padding: 2px 4px !important; } .params td.description > p:first-child, -.props td.description > p:first-child -{ - margin-top: 0; - padding-top: 0; +.props td.description > p:first-child { + margin-top: 0; + padding-top: 0; } .params td.description > p:last-child, -.props td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; +.props td.description > p:last-child { + margin-bottom: 0; + padding-bottom: 0; } .disabled { - color: var(--disabled); + color: var(--disabled); } hr { - height: 2px; - background-color: var(--simple-code); - border: none; - margin: 1.5rem 0; - display: block; + height: 2px; + background-color: var(--simple-code); + border: none; + margin: 1.5rem 0; + display: block; } .small-icon { - background-color: #ffb8f9; - color: #ff00e9; - font-size: 12px; - display: inline-block; - width: 18px; - height: 18px; - margin-right: 3px; - text-align: center; - border-radius: 4px; - font-weight: bold; - vertical-align: middle; + background-color: #ffb8f9; + color: #ff00e9; + font-size: 12px; + display: inline-block; + width: 18px; + height: 18px; + margin-right: 3px; + text-align: center; + border-radius: 4px; + font-weight: bold; + vertical-align: middle; } /* Scrollbar */ ::-webkit-scrollbar { - width: 5px; + width: 5px; } ::-webkit-scrollbar-track { - background: var(--font); + background: var(--font); } - + ::-webkit-scrollbar-thumb { - background: var(--alpha-dark); + background: var(--alpha-dark); } ::-webkit-scrollbar-thumb:hover { - background: var(--dark-lite); + background: var(--dark-lite); } body[data-theme="dark"] .small-icon { - background-color: #720068; + background-color: #720068; } .small-icon.C { - background-color: #fadad8; - color: #fd392b; + background-color: #fadad8; + color: #fd392b; } body[data-theme="dark"] .small-icon.C { - background-color: #801e17; + background-color: #801e17; } .small-icon.F { - background-color: #b8daff; - color: #007bff; + background-color: #b8daff; + color: #007bff; } body[data-theme="dark"] .small-icon.F { - background-color: #003772; + background-color: #003772; } .small-icon.M { - background-color: #f8e3ae; - color: #fcb603; + background-color: #f8e3ae; + color: #fcb603; } body[data-theme="dark"] .small-icon.M { - background-color: #855f00; + background-color: #855f00; } .small-icon.E { - background-color: #c1ffb8; - color: #20fc03; + background-color: #c1ffb8; + color: #20fc03; } body[data-theme="dark"] .small-icon.E { - background-color: #0e7c00; + background-color: #0e7c00; } nav .has-class-methods { - margin-left: 0.5em; - border-left: 1px solid var(--second-border); - padding-left: 0.5em; - margin-bottom: 1.33em; + margin-left: 0.5em; + border-left: 1px solid var(--second-border); + padding-left: 0.5em; + margin-bottom: 1.33em; } .must-underline { - text-decoration: underline; + text-decoration: underline; } .table-box { - overflow-x: auto; + overflow-x: auto; } @media screen and (max-width: 768px) { - nav { - z-index: 5; - left: -75%; - } - - #main { - float: right; - width: 100%; - } - - section { - margin: 0; - padding: 0 30px 12px 30px; - } - - .burger { - display: block; - } - - nav.is-active { - display: block; - background: var(--background); - width: 75%; - left: 0; - } - - footer { - padding: 10px; - } + nav { + z-index: 5; + left: -75%; + } + + #main { + float: right; + width: 100%; + } + + section { + margin: 0; + padding: 0 30px 12px 30px; + } + + .burger { + display: block; + } + + nav.is-active { + display: block; + background: var(--background); + width: 75%; + left: 0; + } + + footer { + padding: 10px; + } }