This commit is contained in:
Jai A committed 2020-06-09 21:57:52 -07:00
1 parent 33ee4c36b4
commit 88005c6603
4 files changed
+108 -31

No files matched your search

+16 -6
View File
@@ -93,10 +93,9 @@
.mod-bar {
display: flex;
flex-direction: row;
border-bottom: 1px solid darkgrey;
}
.mod-bar a {
.mod-bar-href {
margin: 5px 10px 0 0;
padding: 5px 10px;
color: gray;
@@ -115,7 +114,7 @@
}
.mod-hide {
display: none;
display: none !important;
}
.mod-show {
@@ -254,7 +253,7 @@
}
.mod-description {
margin-top: 10px;
margin-top: 0px;
width: 100%;
background-color: white;
border-radius: 0 5px 5px 5px;
@@ -273,7 +272,7 @@
}
.files-search {
margin-top: 10px;
margin-top: 0px;
margin-bottom: 25px;
display: flex;
flex-direction: row;
@@ -295,7 +294,7 @@
}
.api {
margin-top: 10px;
margin-top: 0px;
width: 100%;
background-color: white;
border-radius: 0 5px 5px 5px;
@@ -307,3 +306,14 @@
.api-container {
padding: 10px;
}
.api-code-block {
margin-top: 4px !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
border-radius: 0 5px 5px 5px;
}
.extra-top {
margin-top: 5px !important;
}
+1 -1
View File
@@ -3,4 +3,4 @@
License: BSD-3-Clause
Copyright (c) 2006-2020, Ivan Sagalaev
*/
var hljs=function(){"use strict";function e(n){Object.freeze(n);var t="function"==typeof n;return Object.getOwnPropertyNames(n).forEach((function(r){!n.hasOwnProperty(r)||null===n[r]||"object"!=typeof n[r]&&"function"!=typeof n[r]||t&&("caller"===r||"callee"===r||"arguments"===r)||Object.isFrozen(n[r])||e(n[r])})),n}function n(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach((function(e){for(n in e)t[n]=e[n]})),t}function r(e){return e.nodeName.toLowerCase()}var a=Object.freeze({__proto__:null,escapeHTML:n,inherit:t,nodeStream:function(e){var n=[];return function e(t,a){for(var i=t.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=e(i,a),r(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n},mergeStreams:function(e,t,a){var i=0,s="",o=[];function l(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function c(e){s+="<"+r(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+n(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function u(e){s+="</"+r(e)+">"}function d(e){("start"===e.event?c:u)(e.node)}for(;e.length||t.length;){var g=l();if(s+=n(a.substring(i,g[0].offset)),i=g[0].offset,g===e){o.reverse().forEach(u);do{d(g.splice(0,1)[0]),g=l()}while(g===e&&g.length&&g[0].offset===i);o.reverse().forEach(c)}else"start"===g[0].event?o.push(g[0].node):o.pop(),d(g.splice(0,1)[0])}return s+n(a.substr(i))}});const i="</span>",s=e=>!!e.kind;class o{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=n(e)}openNode(e){if(!s(e))return;let n=e.kind;e.sublanguage||(n=`${this.classPrefix}${n}`),this.span(n)}closeNode(e){s(e)&&(this.buffer+=i)}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class l{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n={kind:e,children:[]};this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(n=>this._walk(e,n)),e.closeNode(n)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&l._collapse(e)}))}}class c extends l{constructor(e){super(),this.options=e}addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,n){let t=e.root;t.kind=n,t.sublanguage=!0,this.add(t)}toHTML(){return new o(this,this.options).value()}finalize(){}}function u(e){return e&&e.source||e}const d="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",g={begin:"\\\\[\\s\\S]",relevance:0},h={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[g]},f={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[g]},p={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},m=function(e,n,r){var a=t({className:"comment",begin:e,end:n,contains:[]},r||{});return a.contains.push(p),a.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),a},b=m("//","$"),v=m("/\\*","\\*/"),x=m("#","$");var _=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:d,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BACKSLASH_ESCAPE:g,APOS_STRING_MODE:h,QUOTE_STRING_MODE:f,PHRASAL_WORDS_MODE:p,COMMENT:m,C_LINE_COMMENT_MODE:b,C_BLOCK_COMMENT_MODE:v,HASH_COMMENT_MODE:x,NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},C_NUMBER_MODE:{className:"number",begin:d,relevance:0},BINARY_NUMBER_MODE:{className:"number",begin:"\\b(0b[01]+)",relevance:0},CSS_NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},REGEXP_MODE:{begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[g,{begin:/\[/,end:/\]/,relevance:0,contains:[g]}]}]},TITLE_MODE:{className:"title",begin:"[a-zA-Z]\\w*",relevance:0},UNDERSCORE_TITLE_MODE:{className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0}}),E="of aLine truncated
var hljs=function(){"use strict";function e(n){Object.freeze(n);var t="function"==typeof n;return Object.getOwnPropertyNames(n).forEach((function(r){!n.hasOwnProperty(r)||null===n[r]||"object"!=typeof n[r]&&"function"!=typeof n[r]||t&&("caller"===r||"callee"===r||"arguments"===r)||Object.isFrozen(n[r])||e(n[r])})),n}function n(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach((function(e){for(n in e)t[n]=e[n]})),t}function r(e){return e.nodeName.toLowerCase()}var a=Object.freeze({__proto__:null,escapeHTML:n,inherit:t,nodeStream:function(e){var n=[];return function e(t,a){for(var i=t.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=e(i,a),r(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n},mergeStreams:function(e,t,a){var i=0,s="",o=[];function l(){return e.length&&t.length?e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:"start"===t[0].event?e:t:e.length?e:t}function c(e){s+="<"+r(e)+[].map.call(e.attributes,(function(e){return" "+e.nodeName+'="'+n(e.value).replace(/"/g,"&quot;")+'"'})).join("")+">"}function u(e){s+="</"+r(e)+">"}function d(e){("start"===e.event?c:u)(e.node)}for(;e.length||t.length;){var g=l();if(s+=n(a.substring(i,g[0].offset)),i=g[0].offset,g===e){o.reverse().forEach(u);do{d(g.splice(0,1)[0]),g=l()}while(g===e&&g.length&&g[0].offset===i);o.reverse().forEach(c)}else"start"===g[0].event?o.push(g[0].node):o.pop(),d(g.splice(0,1)[0])}return s+n(a.substr(i))}});const i="</span>",s=e=>!!e.kind;class o{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=n(e)}openNode(e){if(!s(e))return;let n=e.kind;e.sublanguage||(n=`${this.classPrefix}${n}`),this.span(n)}closeNode(e){s(e)&&(this.buffer+=i)}span(e){this.buffer+=`<span class="${e}">`}value(){return this.buffer}}class l{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n={kind:e,children:[]};this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(n=>this._walk(e,n)),e.closeNode(n)),e}static _collapse(e){e.children&&(e.children.every(e=>"string"==typeof e)?(e.text=e.children.join(""),delete e.children):e.children.forEach(e=>{"string"!=typeof e&&l._collapse(e)}))}}class c extends l{constructor(e){super(),this.options=e}addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,n){let t=e.root;t.kind=n,t.sublanguage=!0,this.add(t)}toHTML(){return new o(this,this.options).value()}finalize(){}}function u(e){return e&&e.source||e}const d="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",g={begin:"\\\\[\\s\\S]",relevance:0},h={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[g]},f={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[g]},p={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},m=function(e,n,r){var a=t({className:"comment",begin:e,end:n,contains:[]},r||{});return a.contains.push(p),a.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|XXX):",relevance:0}),a},b=m("//","$"),v=m("/\\*","\\*/"),x=m("#","$");var _=Object.freeze({__proto__:null,IDENT_RE:"[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:d,BINARY_NUMBER_RE:"\\b(0b[01]+)",RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BACKSLASH_ESCAPE:g,APOS_STRING_MODE:h,QUOTE_STRING_MODE:f,PHRASAL_WORDS_MODE:p,COMMENT:m,C_LINE_COMMENT_MODE:b,C_BLOCK_COMMENT_MODE:v,HASH_COMMENT_MODE:x,NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},C_NUMBER_MODE:{className:"number",begin:d,relevance:0},BINARY_NUMBER_MODE:{className:"number",begin:"\\b(0b[01]+)",relevance:0},CSS_NUMBER_MODE:{className:"number",begin:"\\b\\d+(\\.\\d+)?(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},REGEXP_MODE:{begin:/(?=\/[^\/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[g,{begin:/\[/,end:/\]/,relevance:0,contains:[g]}]}]},TITLE_MODE:{className:"title",begin:"[a-zA-Z]\\w*",relevance:0},UNDERSCORE_TITLE_MODE:{className:"title",begin:"[a-zA-Z_]\\w*",relevance:0},METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0}}),E="of aLine truncated
+39 -1
View File
@@ -1,3 +1,5 @@
//TODO Reduce repeated code
let currentlySelected = document.getElementById("description-bar");
let currentlySelectedDiv = document.getElementById("description");
@@ -15,4 +17,40 @@ function toggleSection(element) {
currentlySelectedDiv.classList.add("mod-show");
}
hljs.initHighlightingOnLoad();
let currentlyBuildSelected = document.getElementById("gradle-code-bar");
let currentlyBuildSelectedDiv = document.getElementById("gradle-code");
function toggleBuildSection(element) {
currentlyBuildSelected.classList.remove("mod-bar-active");
currentlyBuildSelected = element;
currentlyBuildSelected.classList.add("mod-bar-active");
currentlyBuildSelectedDiv.classList.remove("mod-show");
currentlyBuildSelectedDiv.classList.add("mod-hide");
currentlyBuildSelectedDiv = document.getElementById(element.id.replace("-bar", ""));
currentlyBuildSelectedDiv.classList.remove("mod-hide");
currentlyBuildSelectedDiv.classList.add("mod-show");
}
let currentlyApiSelected = document.getElementById("curl-code-bar");
let currentlyApiSelectedDiv = document.getElementById("curl-code");
function toggleApiSection(element) {
currentlyApiSelected.classList.remove("mod-bar-active");
currentlyApiSelected = element;
currentlyApiSelected.classList.add("mod-bar-active");
currentlyApiSelectedDiv.classList.remove("mod-show");
currentlyApiSelectedDiv.classList.add("mod-hide");
currentlyApiSelectedDiv = document.getElementById(element.id.replace("-bar", ""));
currentlyApiSelectedDiv.classList.remove("mod-hide");
currentlyApiSelectedDiv.classList.add("mod-show");
}
for (let block of document.getElementsByClassName("api-code-block")) {
hljs.highlightBlock(block);
}
+52 -23
View File
@@ -48,12 +48,12 @@
</div>
<div class="mod-bar">
<a class="mod-bar-active" onclick="toggleSection(this)" id="description-bar">Description</a>
<a onclick="toggleSection(this)" id="files-bar">Files</a>
<a onclick="toggleSection(this)" id="api-bar">API</a>
<a href="https://github.com/Geometrically/fabricate">Source</a>
<a href="https://github.com/Geometrically/fabricate/wiki">Wiki</a>
<a href="https://github.com/Geometrically/fabricate/issues">Issues</a>
<a class="mod-bar-active mod-bar-href" onclick="toggleSection(this)" id="description-bar">Description</a>
<a class="mod-bar-href" onclick="toggleSection(this)" id="files-bar">Files</a>
<a class="mod-bar-href" onclick="toggleSection(this)" id="api-bar">API</a>
<a class="mod-bar-href" href="https://github.com/Geometrically/fabricate">Source</a>
<a class="mod-bar-href" href="https://github.com/Geometrically/fabricate/wiki">Wiki</a>
<a class="mod-bar-href" href="https://github.com/Geometrically/fabricate/issues">Issues</a>
</div>
<div class="mod-description mod-show" id="description">
@@ -78,30 +78,59 @@
<div class="api mod-hide" id="api">
<div class="api-container">
<h2>Maven</h2>
<p>This project has an API accessible from maven. You can add it to your project using the artifact below.</p>
<pre>
<code>
<div class="api-code-ref">
<h2>Maven</h2>
<p>This project has an API accessible from maven. You can add it to your project using the artifact below.</p>
<div class="api-code-blocks">
<div class="code-block-navigation">
<a class="mod-bar-href mod-bar-active" onclick="toggleBuildSection(this)" id="gradle-code-bar">Gradle</a>
<a class="mod-bar-href" onclick="toggleBuildSection(this)" id="maven-code-bar">Maven</a>
</div>
<pre class="api-code-block gradle mod-show" id="gradle-code">
repositories {
jcenter()
maven {
url "https://cdn.sitename.com/maven"
}
}
dependencies {
modApi "me.sargunvohra.mcmods:autoconfig1u:ABC"
modApi "anime.sucks:balls:1.0"
}
</code>
</pre>
</pre>
<pre class="api-code-block mod-hide" id="maven-code">
<h2>Website API</h2>
<p>All projects and project files can be pulled using our REST API. You can pull this project's information using the code snippets below.</p>
<pre>
<code>
var client = new FabricateClient();
var mod = await client.requestMod(123);
&lt;dependency&gt;
&lt;groupId&gt;anime.sucks&lt;/groupId&gt;
&lt;artifactId&gt;balls&lt;/artifactId&gt;
&lt;version&gt;1.0&lt;/version&gt;
&lt;/dependency&gt;
</pre>
</div>
</div>
Console.WriteLine(mod);
</code>
</pre>
<div class="api-code-ref">
<h2>Website API</h2>
<p>All projects and project files can be pulled using our REST API. You can pull this project's information using the code snippets below.</p>
<div class="api-code-blocks">
<div class="code-block-navigation">
<a class="mod-bar-href mod-bar-active" onclick="toggleApiSection(this)" id="curl-code-bar">cURL</a>
<a class="mod-bar-href" onclick="toggleApiSection(this)" id="js-code-bar">JS</a>
</div>
<pre class="api-code-block extra-top mod-show shell" id="curl-code">
$ curl -XGET -H "Content-type: application/json" 'http://api.sitename.com/mod/testmod'
</pre>
<pre class="api-code-block extra-top mod-hide javascript" id="js-code">
let httpClient = TooLazyToMakeWorkingCode();
httpClient.request('http://api.sitename.com/mod/testmod');
</pre>
</div>
</div>
</div>
</div>
</div>