mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-06-06 00:29:12 +02:00
OcttKB Cross-Repo Sync (HTML to Raw)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Enabled: 0
|
||||
created: 20230413083119554
|
||||
creator: Octt
|
||||
modified: 20230429202841556
|
||||
modified: 20231105185906145
|
||||
modifier: Octt
|
||||
tags: $:/GlobalOption
|
||||
title: $:/OcttKB/Config/AiLinks.ui
|
||||
|
@@ -1,11 +1,11 @@
|
||||
created: 20230124112022156
|
||||
creator: Octt
|
||||
modified: 20231103220122034
|
||||
modified: 20231105185849353
|
||||
modifier: Octt
|
||||
tags: $:/tags/ViewTemplate
|
||||
title: $:/Styles/View/9-99-Hacks
|
||||
|
||||
\define AiLinks(Enabled:1)
|
||||
\define AiLinks()
|
||||
\whitespace trim
|
||||
<<script script="
|
||||
try {
|
||||
@@ -26,7 +26,7 @@ if ('$(Enabled)$' == 1) {
|
||||
};
|
||||
|
||||
} catch(e) { ErrAtLine(e); };
|
||||
">>
|
||||
">><<script off>>
|
||||
\end
|
||||
|
||||
<$set name=Enabled value={{$:/OcttKB/Config/AiLinks.ui!!Enabled}}>
|
||||
|
65
Wiki-OcttKB/tiddlers/System/Styles/View/_i18n.tid
Normal file
65
Wiki-OcttKB/tiddlers/System/Styles/View/_i18n.tid
Normal file
@@ -0,0 +1,65 @@
|
||||
created: 20231105210128175
|
||||
creator: Octt
|
||||
list-after: $:/core/ui/ViewTemplate/tags
|
||||
modified: 20231105232834847
|
||||
modifier: Octt
|
||||
tags: $:/tags/ViewTemplate
|
||||
title: $:/Styles/View/i18n
|
||||
|
||||
\define OcttKB-i18n()
|
||||
<<script script="try{
|
||||
var BodySplitter = '</p>>';
|
||||
var TidTitle = this.variables.thisTiddler.value;
|
||||
var TidFrame = this.parentDomNode.parentElement;
|
||||
/* var [TidTitleEl, TidBodyEl] = this.parentDomNode.parentElement.querySelectorAll('.tc-tiddler-title, .tc-tiddler-body'); */
|
||||
var TidLangKnown = $tw.wiki.getTiddler(TidTitle).fields['i18n-main'];
|
||||
this.parentDomNode.innerHTML += '[' + (TidLangKnown ? TidLangKnown : '?') + '] ';
|
||||
var input = document.createElement('input');
|
||||
input.type = 'text';
|
||||
input.value = (window['OcttKB-i18n-current'] ? window['OcttKB-i18n-current'] : 'it');
|
||||
input.onchange = function(){ window['OcttKB-i18n-current'] = input.value };
|
||||
this.parentDomNode.appendChild(input);
|
||||
var btn = document.createElement('button');
|
||||
btn.innerHTML = 'Translate [Beta]';
|
||||
btn.onclick = function(){
|
||||
/* var TidLangGuessed; */
|
||||
var TidBodyEl = TidFrame.querySelector('.tc-tiddler-body');
|
||||
var TidBody = TidBodyEl.innerHTML;
|
||||
var TidBodyParags = TidBody.trim().replaceAll('>', '>>').split(BodySplitter);
|
||||
var TidBodyTranslated = '';
|
||||
/* TODO: should probably fix the splitting to make it do longer segments, otherwise translations are more likely broken, and also find a good way to avoid the occasional translating of HTML elements; we should ideally do like the GTranslate embeddable script and parse the doctree to translate only the innerHTML strings */
|
||||
for (var i=0; i<TidBodyParags.length; i++) {
|
||||
if (TidBodyParags[i].trim()) {
|
||||
/* TODO: make this not lock up the main thread */
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', `https://lingva.garudalinux.org/api/v1/${TidLangKnown ? TidLangKnown : 'auto'}/${window['OcttKB-i18n-current']}/${encodeURIComponent(TidBodyParags[i].trim())}`, false);
|
||||
req.send();
|
||||
var jsonResponse = JSON.parse(req.responseText);
|
||||
TidBodyTranslated += jsonResponse.translation + BodySplitter;
|
||||
/* TidLangGuessed = jsonResponse.info.detectedSource; */
|
||||
}
|
||||
}
|
||||
var TransBodyEl = document.createElement('div');
|
||||
TransBodyEl.innerHTML += TidBodyTranslated.replaceAll('>>', '>');
|
||||
TidFrame.appendChild(TransBodyEl);
|
||||
TidBodyEl.style.display = 'none';
|
||||
btn.style.display = 'none';
|
||||
|
||||
var close = document.createElement('button');
|
||||
close.innerHTML = '❌ Close';
|
||||
close.onclick = function(){
|
||||
TidFrame.removeChild(TransBodyEl);
|
||||
TidBodyEl.style.display = 'revert';
|
||||
btn.style.display = 'revert';
|
||||
this.parentElement.removeChild(close);
|
||||
};
|
||||
this.parentElement.appendChild(close);
|
||||
};
|
||||
this.parentDomNode.appendChild(btn);
|
||||
} catch(e) { ErrAtLine(e); };
|
||||
">><<script off>>
|
||||
\end
|
||||
|
||||
<div class="OcttKB-i18n">
|
||||
<<OcttKB-i18n>>
|
||||
</div>
|
@@ -1,5 +1,5 @@
|
||||
created: 20231105154350579
|
||||
created: 20231105232914777
|
||||
current-tiddler: GettingStarted
|
||||
modified: 20231105154350579
|
||||
modified: 20231105232914777
|
||||
title: $:/HistoryList
|
||||
type: application/json
|
@@ -1,6 +1,6 @@
|
||||
created: 20231105114939903
|
||||
created: 20231105231431599
|
||||
creator: Octt
|
||||
list:
|
||||
modified: 20231105154203230
|
||||
modified: 20231105232654357
|
||||
modifier: Octt
|
||||
title: $:/StoryList
|
@@ -1,7 +1,7 @@
|
||||
created: 20220920140732083
|
||||
creator: Octt
|
||||
modified: 20231105151132314
|
||||
modified: 20231105210451811
|
||||
modifier: Octt
|
||||
title: $:/state/showeditpreview
|
||||
|
||||
yes
|
||||
no
|
@@ -1,7 +1,7 @@
|
||||
created: 20230109143853256
|
||||
creator: Octt
|
||||
modified: 20231105151648391
|
||||
modified: 20231104195014618
|
||||
modifier: Octt
|
||||
title: $:/state/tab--1498284803
|
||||
|
||||
$:/core/ui/AdvancedSearch/System
|
||||
$:/core/ui/AdvancedSearch/Standard
|
@@ -1,7 +1,7 @@
|
||||
created: 20230109143853256
|
||||
creator: Octt
|
||||
modified: 20231105151648391
|
||||
modified: 20231104195014617
|
||||
modifier: Octt
|
||||
title: $:/state/advancedsearch/currentTab
|
||||
|
||||
$:/core/ui/AdvancedSearch/System
|
||||
$:/core/ui/AdvancedSearch/Standard
|
@@ -0,0 +1,7 @@
|
||||
created: 20231105231235764
|
||||
creator: Octt
|
||||
modified: 20231105232534359
|
||||
modifier: Octt
|
||||
title: $:/state/folded/$:/Styles/View/i18n
|
||||
|
||||
hide
|
7
Wiki-OcttKB/tiddlers/System/state/folded/_Language.tid
Normal file
7
Wiki-OcttKB/tiddlers/System/state/folded/_Language.tid
Normal file
@@ -0,0 +1,7 @@
|
||||
created: 20231105202356015
|
||||
creator: Octt
|
||||
modified: 20231105202357290
|
||||
modifier: Octt
|
||||
title: $:/state/folded/Language
|
||||
|
||||
show
|
@@ -1,6 +1,6 @@
|
||||
created: 20220920092307479
|
||||
creator: Octt
|
||||
modified: 20231105154128796
|
||||
modified: 20231105232842380
|
||||
modifier: Octt
|
||||
title: $:/state/tab/sidebar--595412856
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
created: 20221108155618185
|
||||
creator: Octt
|
||||
modified: 20231105151711128
|
||||
modified: 20231105183045128
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/Macros/
|
||||
|
||||
show
|
||||
hide
|
@@ -1,7 +1,7 @@
|
||||
created: 20230225225512618
|
||||
creator: Octt
|
||||
modified: 20231105104713926
|
||||
modified: 20231105214436728
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/OcttKB/Config/
|
||||
|
||||
show
|
||||
hide
|
@@ -0,0 +1,7 @@
|
||||
created: 20231105214440145
|
||||
creator: Octt
|
||||
modified: 20231105214441095
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/OcttKB/Utils/
|
||||
|
||||
hide
|
@@ -1,7 +1,7 @@
|
||||
created: 20230111084703963
|
||||
creator: Octt
|
||||
modified: 20231105151708695
|
||||
modified: 20231105185204090
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/OcttKB/
|
||||
|
||||
hide
|
||||
show
|
@@ -1,7 +1,7 @@
|
||||
created: 20230108193801573
|
||||
creator: Octt
|
||||
modified: 20231105151710124
|
||||
modified: 20231105214443871
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/Styles/
|
||||
|
||||
hide
|
||||
show
|
@@ -1,6 +1,6 @@
|
||||
created: 20221109224641397
|
||||
creator: Octt
|
||||
modified: 20230219190410251
|
||||
modified: 20231105184234925
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/core/
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
created: 20221107223237374
|
||||
creator: Octt
|
||||
modified: 20231104225246445
|
||||
modified: 20231105181810264
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/state/
|
||||
|
||||
|
Reference in New Issue
Block a user