116 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-01-29 14:01:33 +00:00
.context: 1
.type: masonry
2024-01-29 17:14:51 +00:00
.width: 33
2024-01-29 13:08:55 +00:00
created: 20240129095948486
creator: Octt
2024-01-30 00:47:41 +00:00
modified: 20240129234018781
2024-01-29 13:08:55 +00:00
modifier: Octt
tags: $:/Apps
title: $:/Apps/MagicBox
\define SearchResults(fields)
2024-01-30 00:47:41 +00:00
<$list filter="[!is[system]search:$fields${$:/temp/MagicBox!!.input}sort[title]limit[100]]">
2024-01-29 17:14:51 +00:00
<div class=`MagicBoxApplet result ${[{$:/Apps/MagicBox!!.type}]}$` style=`background-image: url("${[{!!page-cover}]}$");`>
<$button class="tc-btn-invisible">
<$action-sendmessage $message="tm-close-tiddler" $param=<<closeOnChoose>>/>
<$action-navigate $to={{!!title}}/>
<!--<$link to={{!!title}}>-->
<h3>
<$link to={{!!title}} tabindex="-1"/>
</h3>
<$if value={{$:/Apps/MagicBox!!.context}}>
2024-01-30 00:47:41 +00:00
<$context term={{$:/temp/MagicBox!!.input}} tabindex="-1"/>
2024-01-29 17:14:51 +00:00
</$if>
<!--</$link>-->
</$button>
2024-01-29 13:08:55 +00:00
</div>
</$list>
\end
2024-01-29 17:14:51 +00:00
<div class="MagicBoxApplet options">
2024-01-29 14:01:33 +00:00
<$checkbox field=".context" checked="1">Context</$checkbox>
2024-01-30 00:47:41 +00:00
&nbsp;
2024-01-29 14:01:33 +00:00
<!--<$edit-text field=".type" placeholder="Display Type"/>-->
<$checkbox field=".type" checked="grid" unchecked="masonry">Fixed Grid</$checkbox>
2024-01-30 00:47:41 +00:00
&nbsp;
<$range field=".width" min="19" max="49"/>{{!!.width}}
&nbsp;
<$edit-text tiddler="$:/temp/MagicBox" field=".input" class="_input" placeholder="Search..." tabindex="0"/>
2024-01-29 13:08:55 +00:00
</div>
2024-01-29 17:14:51 +00:00
<$action-sendmessage $message="tm-focus-selector" $param=".MagicBoxApplet.options > ._input"/>
<<script script='try {
document.querySelector(".MagicBoxApplet.options > ._input")?.focus();
document.querySelector("div.tc-tiddler-frame.tc-tiddler-view-frame[data-tiddler-title=\"$:/Apps/MagicBox/Overlay\"] .MagicBoxApplet.options > ._input")?.focus();
} catch(e) { $OcttKB.ErrAtLine(e) }'>><<script off>>
2024-01-29 13:08:55 +00:00
<style>
2024-01-30 00:47:41 +00:00
@media (max-width: 500px) {
.MagicBoxApplet.result {
min-width: calc(({{!!.width}}% * 2) - 16px) !important;
max-width: calc(({{!!.width}}% * 3) - 16px) !important;
}
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result {
2024-01-29 13:08:55 +00:00
margin: 8px;
display: inline-block;
background-color: lightgray;
background-size: cover;
2024-01-29 14:01:33 +00:00
background-position: center;
2024-01-29 13:08:55 +00:00
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result.grid {
2024-01-29 14:01:33 +00:00
width: calc({{!!.width}}% - 16px);
aspect-ratio: 16/9;
vertical-align: top;
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result.masonry {
2024-01-29 14:01:33 +00:00
max-width: calc({{!!.width}}% - 16px);
2024-01-29 13:08:55 +00:00
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result h3 {
2024-01-29 13:08:55 +00:00
margin-top: 25%;
padding: 8px;
background-color: rgba(255, 255, 255, 0.75);
text-align: center;
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result pre {
2024-01-29 13:08:55 +00:00
color: initial;
2024-01-29 14:01:33 +00:00
max-height: 7em;
2024-01-29 13:08:55 +00:00
overflow-y: auto;
margin: 0;
top: 1em;
position: relative;
2024-01-29 17:14:51 +00:00
text-align: initial;
}
.MagicBoxApplet.result h3 > a {
pointer-events: none;
2024-01-29 13:08:55 +00:00
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result > a,
.MagicBoxApplet.result > button {
2024-01-29 13:08:55 +00:00
display: inline-block;
width: 100%;
height: 100%;
}
2024-01-29 17:14:51 +00:00
.MagicBoxApplet.result > a:after {
2024-01-29 13:08:55 +00:00
content: "" !important;
}
</style>
<$if value={{{ [{$:/temp/MagicBox!!.input}split[]count[]compare:integer:gteq[3]then[1]] }}}>
2024-01-30 00:47:41 +00:00
<$if value={{{ [!is[system]search:title{$:/temp/MagicBox!!.input}then[]else[1]] }}}>
<$button>
<$action-sendmessage $message="tm-close-tiddler" $param=<<closeOnChoose>>/>
<$action-sendmessage $message="tm-new-tiddler" title={{$:/temp/MagicBox!!.input}} />
Create as New Tiddler
</$button>
</$if>
<div><br/><hr/><br/></div>
2024-01-29 13:08:55 +00:00
Title or Caption matches:
<br/><<SearchResults "title,caption">>
<div><br/><hr/><br/></div>
Tags or Text matches:
<br/><<SearchResults "tags,text">>
</$if>