7 lines
65 KiB
JavaScript
7 lines
65 KiB
JavaScript
|
var suggestions=document.getElementById('suggestions');var userinput=document.getElementById('userinput');document.addEventListener('keydown',inputFocus);function inputFocus(e){if(e.keyCode===191){e.preventDefault();userinput.focus();}
|
||
|
if(e.keyCode===27){userinput.blur();suggestions.classList.add('d-none');}}
|
||
|
document.addEventListener('click',function(event){var isClickInsideElement=suggestions.contains(event.target);if(!isClickInsideElement){suggestions.classList.add('d-none');}});document.addEventListener('keydown',suggestionFocus);function suggestionFocus(e){const focusableSuggestions=suggestions.querySelectorAll('a');const focusable=[...focusableSuggestions];const index=focusable.indexOf(document.activeElement);let nextIndex=0;if(e.keyCode===38){e.preventDefault();nextIndex=index>0?index-1:0;focusableSuggestions[nextIndex].focus();}
|
||
|
else if(e.keyCode===40){e.preventDefault();nextIndex=index+1<focusable.length?index+1:index;focusableSuggestions[nextIndex].focus();}}
|
||
|
(function(){var index=new FlexSearch({preset:'score',cache:true,doc:{id:'id',field:['title','description','content',],store:['href','title','description',],},});var docs=[{id:0,href:"/docs/advmake/",title:"AdvMake Docs",description:"Documentation for the AdvMake build system",content:""},{id:1,href:"/docs/advmake/build-files/",title:"Build Files",description:"Understanding AdvMake Build Files",content:"\u003cp\u003e\u003ca class=\"btn\" style=\"color: white; background-color: green;\" href=\"https://gitea.arsenm.dev/Arsen6331/advmake\"\u003e\n \u003cspan class=\"iconify\" data-icon=\"cib:gitea\"\u003e\u003c/span\u003e \n \u0026nbsp;AdvMake\n\u003c/a\u003e\n\n\u003ca class=\"btn\" style=\"color: white; background-color: OrangeRed;\" href=\"https://www.gitlab.com/moussaelianarsen/advmake\"\u003e\n \u003cspan class=\"iconify\" data-icon=\"fa-brands:gitlab\"\u003e\u003c/span\u003e\n \u0026nbsp;AdvMake\n\u003c/a\u003e\n\u003c/p\u003e\n\u003ch2 id=\"format\"\u003eFormat\u003c/h2\u003e\n\u003cp\u003eAdvMake uses \u003ca href=\"https://github.com/bazelbuild/starlark\"\u003eStarlark\u003c/a\u003e as the format for its build files.\nModules are also defined for both convenience and extra functionality.\u003c/p\u003e\n\u003cp\u003eStarlark is a Python-like language meant for configuration files.\u003c/p\u003e\n\u003ch2 id=\"configuration\"\u003eConfiguration\u003c/h2\u003e\n\u003cp\u003eBuild files are by default called \u003ccode\u003eAdvMakefile\u003c/code\u003e, but that can be set via \u003ccode\u003e-f\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eAn AdvMakefile example can be found at AdvMake\u0026rsquo;s repo as it uses AdvMake itself.\u003c/p\u003e\n\u003cp\u003eAdvMake runs functions exposed by starlark in the format \u003ccode\u003e\u0026lt;name\u0026gt;_\u0026lt;target\u0026gt;\u003c/code\u003e.\nTo set the default name and target, the global variables \u003ccode\u003edefaultName\u003c/code\u003e, and \u003ccode\u003edefaultTarget\u003c/code\u003e must be set.\nHere is an example from AdvMake\u0026rsquo;s AdvMakefile:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre class=\"chroma\"\u003e\u003ccode class=\"language-python\" data-lang=\"python\"\u003e\u003cspan class=\"n\"\u003edefaultName\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;advmake\u0026#34;\u003c/span\u003e\n\u003cspan class=\"n\"\u003edefaultTarget\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;build\u0026#34;\u003c/span\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis will tell AdvMake to run the function \u003ccode\u003eadvmake_build()\u003c/code\u003e when run with no arguments.\u003c/p\u003e\n\u003cp\u003eIf AdvMake is run with one argument (such as \u003ccode\u003eadvmake install\u003c/code\u003e), it will use the default name with the specified target,\nso in that case, it would run \u003ccode\u003eadvmake_install()\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIf run with two arguments, AdvMake will use the first argument as the name and the second as the target.\nSo, running \u003ccode\u003eadvmake hello world\u003c/code\u003e would run the function \u003ccode\u003ehello_world()\u003c/code\u003e.\u003c/p\u003e\n\u003ch2 id=\"modules\"\u003eModules\u003c/h2\u003e\n\u003cp\u003eAs previously mentioned, AdvMake comes with modules. Those are as follows:\u003c/p\u003e\n\u003ch3 id=\"runtime\"\u003e\u003ccode\u003eruntime\u003c/code\u003e\u003c/h3\u003e\n\u003cp\u003eThe runtime module exposes some of golang\u0026rsquo;s runtime methods and variables.\u003c/p\u003e\n\u003chr\u003e\n\u003ch4 id=\"runtimegoos\"\u003e\u003ccode\u003eruntime.GOOS\u003c/code\u003e\u003c/h4\u003e\n\u003cp\u003eStores a string denoting the operating system being used.\u003c/p\u003e\n\u003ca class=\"btn\" style=\"color: white; background-color: #00ACD7;\" href=\"https://pkg.go.dev/runtime#GOOS\"\u003e\n \n \u003cspan class=\"iconify icon:cib:go\"\u003e\u003c/span\u003e\u0026nbsp;\n \n Godoc\n\u003c/a\u003e\n\n\u003chr\u003e\n\u
|
||
|
function accept_suggestion(){while(suggestions.lastChild){suggestions.removeChild(suggestions.lastChild);}
|
||
|
return false;}}());
|