mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 07:15:51 +01:00
add translation for doc notes
This commit is contained in:
34
src/public/app/doc_notes/en/launchbar_widget_launcher.html
Normal file
34
src/public/app/doc_notes/en/launchbar_widget_launcher.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<p>Please define the target widget note in the promoted attributes. The widget will be used to render the launchbar icon.</p>
|
||||
|
||||
<h4>Example launchbar widget</h4>
|
||||
|
||||
<pre>
|
||||
const TPL = `<div style="height: 53px; width: 53px;"></div>`;
|
||||
|
||||
class ExampleLaunchbarWidget extends api.NoteContextAwareWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
this.$widget.css("background-color", this.stringToColor(note.title));
|
||||
}
|
||||
|
||||
stringToColor(str) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
||||
}
|
||||
|
||||
let color = '#';
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const value = (hash >> (i * 8)) & 0xFF;
|
||||
color += ('00' + value.toString(16)).substr(-2);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new ExampleLaunchbarWidget();
|
||||
</pre>
|
||||
Reference in New Issue
Block a user