make stuff configurable

This commit is contained in:
Pim Snel 2024-04-26 19:46:13 +02:00
parent c05bda03b7
commit 96340352f8
17 changed files with 91 additions and 59 deletions

View File

@ -12,15 +12,6 @@ jobs:
- uses: actions/checkout@v4
# - name: Setup Hugo
# uses: peaceiris/actions-hugo@v2
# with:
# hugo-version: '0.81.0'
# extended: true
#
# - name: Build
# run: hugo --minify
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

4
.gitignore vendored
View File

@ -2,6 +2,6 @@
.nix-gems
.bundle
result
data/hm-options-release-23.11.json
data/hm-options-master.json
data/options-release-23.11.json
data/options-master.json
.hugo_build.lock

View File

@ -2,6 +2,7 @@
## Next version
- hugofication
- keyboard (tab) navigation (thanks to github.com/hallundbaek)
- better result sorting (thanks to github.com/hallundbaek)
- style improvements

View File

@ -8,7 +8,7 @@ The new location is <a href="https://home-manager-options.extranix.com/">HOME-MA
Find [home manager](https://github.com/nix-community/home-manager) options quickly.
![](images/homemanageroptionsearch.gif)
![](static/images/homemanageroptionsearch.gif)
## Contribute

View File

@ -2,3 +2,40 @@ baseURL: https://home-manager-options.extranix.com/
languageCode: en-us
title: Home Manager - Option Search
theme: extranix-options-search
params:
custom_head_scripts: |
<script async src="https://umami.pimsnel.com/script.js" data-website-id="8e970d59-b517-4ba6-9b92-207e7dbdb4b1"></script>
<script async src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
custom_header_tags: <div id="eadiv" data-ea-publisher="extranixcom" data-ea-type="text"></div>
footer_credits_line: |
Powered by the <a href="https://nix-community.org/">Nix Community</a> |
<a href="https://github.com/mipmip/home-manager-option-search#credits">Credits</a> |
<a href="https://nix-community.github.io/home-manager/">Home Manager Documentation</a>
footer_copyright_line: |
Made with ❤️ by <a href="https://github.com/mipmip">Pim Snel</a> - © 2022-2024
logo: images/home-manager-option-search2.png
github:
repo: home-manager-option-search
user: mipmip
show_count: true
main_menu:
- name: HM&nbsp;Documentation
url: https://nix-community.github.io/home-manager/
icon_class: fa fa-book
- name: Source
url: https://github.com/mipmip/home-manager-option-search
icon_class: fa fa-github
markup:
goldmark:
renderer:
unsafe: true

View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
# Copyright 2024 Pim Snel <post@pimsnel.com
# Copyright 2024 Pim Snel <post@pimsnel.com>
# License: MIT
if [ -z $HM_RELEASE ]; then
@ -11,5 +11,5 @@ echo "building Home Manager options from ${HM_RELEASE}"
rm -Rf result
nix build github:nix-community/home-manager/${HM_RELEASE}#docs-json --no-write-lock-file
rm -f ./data/hm-options-${HM_RELEASE}.json
rm -f ./data/options-${HM_RELEASE}.json
ruby ./scripts/parse_options-json.rb

View File

@ -1,4 +1,4 @@
# Copyright 2024 Pim Snel <post@pimsnel.com
# Copyright 2024 Pim Snel <post@pimsnel.com>
# License: MIT
require 'json'
@ -54,7 +54,7 @@ time = Time.new
outobj["last_update"] = time.utc.strftime("%B %d, %Y at %k:%M UTC")
outobj["options"] = options_arr
filename = "static/data/hm-options-#{ENV['HM_RELEASE']}.json"
filename = "static/data/options-#{ENV['HM_RELEASE']}.json"
File.open(filename,"w") do |f|
f.write(outobj.to_json)

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 796 KiB

After

Width:  |  Height:  |  Size: 796 KiB

View File

@ -2,46 +2,53 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Manager - Option Search</title>
<title>{{ .Site.Title }}</title>
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link rel="search" type="application/opensearchdescription+xml" title="Home Manager - Option Search" href="opensearch.xml" />
<meta name="description" content="{{ with .Params.Description }}{{ . }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}">
<meta name="keywords" content="{{ with .Params.keywords }}{{ . }}{{ end }}">
<link rel="search" type="application/opensearchdescription+xml" title="{{ .Site.Title}}" href="opensearch.xml" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script async src="https://umami.pimsnel.com/script.js" data-website-id="8e970d59-b517-4ba6-9b92-207e7dbdb4b1"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="css/nucleus.css" rel="stylesheet">
<link href="css/style-nix.css" rel="stylesheet">
<link rel="stylesheet" href="css/style-q2.css">
<script async src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
{{ with .Site.Params.custom_head_scripts }}{{ . | safeHTML }}{{ end }}
</head>
<body>
<div id="eadiv" data-ea-publisher="extranixcom" data-ea-type="text"></div>
{{ with .Site.Params.custom_header_tags }}{{ . | safeHTML }}{{ end }}
<header>
<div id="lastUpdateElement" style="position:absolute; line-height: 11px; right: 37px;top:59px;"></div>
<div class="logo">
<a class="baselink" href="./"> <img src="images/home-manager-option-search2.png"></a>
<a class="baselink" href="./">
{{with .Site.Params.logo}}<img src="{{.}}">{{else}}{{.Site.Title}} {{end}}</a>
</div>
<nav class="shortcuts">
<li style="padding-top:10px;">
<a href="https://nix-community.github.io/home-manager/" rel="noopener">
<i class="fa fa-book"></i>&nbsp;<label>HM&nbsp;Documentation</label>
</a>
</li>
<li style="padding-top:10px;">
<a href="https://github.com/mipmip/home-manager-option-search" rel="noopener">
<i class="fa fa-github"></i> <label>Source</label>
</a>
</li>
{{ range .Site.Params.main_menu }}
<li style="padding-top:10px;"><a href="{{ .url }}" ><i class="{{ .icon_class }}"></i> <label>{{ .name | safeHTML }}</label></a></li>
{{ end }}
{{with .Site.Params.github }}
<li style="margin-left:9px;padding-top:14px;">
<iframe style="width:51px;" src="https://ghbtns.com/github-btn.html?user=mipmip&repo=home-manager-option-search&type=star&count=false&text=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
<iframe
src="https://ghbtns.com/github-btn.html?user={{ .user}}&repo={{.repo}}&type=star&count={{.show_count}}&text=true"
style="width:101px;"
frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
</li>
{{end}}
</nav>
</header>
@ -156,18 +163,14 @@
<footer class=" navbar-fixed-bottom" >
<div >
<p>
Powered by the <a href="https://nix-community.org/">Nix Community</a> |
<a href="https://github.com/mipmip/home-manager-option-search#credits">Credits</a> |
<a href="https://nix-community.github.io/home-manager/">Home Manager Documentation</a>
{{ with .Site.Params.footer_credits_line }}{{ . | safeHTML }}{{ end }}
</p>
<p>
Made with ❤️ by <a href="https://github.com/mipmip">Pim Snel</a>
{{ with .Site.Params.footer_copyright_line }}{{ . | safeHTML }}{{ end }}
</p>
</div>
</footer>
<!--<script type="text/javascript" src="https://rawgit.com/kristopolous/Porter-Stemmer/master/PorterStemmer1980.min.js"></script>-->
<!--<script type="text/javascript" src="https://unpkg.com/js-search@1.3.7/dist/umd/js-search.min.js"></script>-->
<script type="text/javascript" src="https://unpkg.com/js-search@2.0.1/dist/umd/js-search.min.js"></script>
<script type="text/javascript" src="js/script.js?version=2024-03-23"></script>
</body>

View File

@ -56,9 +56,18 @@ header {
text-decoration: none; }
header .logo {
min-width: 295px;
font-size: 100%; }
font-size: 100%;
}
header .logo a,
header .logo a:visited {
color:white;
font-size: 120%;
font-weight: bold;
}
header .logo * {
vertical-align: middle; }
vertical-align: middle;
}
header .logo img {
height: 32px;
margin-right: 0.5rem; }
@ -192,7 +201,7 @@ article > aside {
html,
body {
height: 100%;
height: 100%;
}
html {
@ -770,7 +779,7 @@ table.nur-stats tr td{
table {
text-align: left;
position: relative;
border-collapse: collapse;
border-collapse: collapse;
}
th {
background: white;

View File

@ -21,7 +21,6 @@ var docOnload = function(){
searchOptions(query);
$("#advcheck").prop("checked", false);
// $("#advcheck").removeAttr("checked");
}
indexOnDescriptionCheckbox.onchange = rebuildAndRerunSearch;
@ -193,8 +192,8 @@ var searchOptions = function(query) {
// No reason to index beyond result of lastIndex +aIndex + term.length,
// as a would come first in that case.
const bIndex = bConcat
.slice(lastIndex, lastIndex + aIndex + term.length)
.indexOf(term);
.slice(lastIndex, lastIndex + aIndex + term.length)
.indexOf(term);
// Not found in b, a must come first
if (bIndex == -1) return -1;
@ -237,20 +236,12 @@ searchInput.oninput = function() {
releaseSelect.onchange = function(){
const query = searchInput.value;
const release = releaseSelect.selectedOptions[0].value;
const query = searchInput.value;
const release = releaseSelect.selectedOptions[0].value;
setSearchQueryToUrlParam(query, release);
setSearchQueryToUrlParam(query, release);
//window.location.reload(false);
window.location.replace(newUrl);
//newSearch();
//var release = releaseSelect.selectedOptions[0].value;
//xmlhttp.open('GET', 'data/hm-options-'+release+'.json', true);
//xmlhttp.send();
window.location.replace(newUrl);
}
var updateOptionCount = function(numOptions) {
@ -291,5 +282,5 @@ const urlParams = new URLSearchParams(window.location.search);
const release = urlParams.get('release') ?? 'master';
document.getElementById('releaseSelect').value = release;
xmlhttp.open('GET', 'data/hm-options-'+release+'.json', true);
xmlhttp.open('GET', 'data/options-'+release+'.json', true);
xmlhttp.send();