-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OcttKB Cross-Repo Sync (HTML to Raw)
- Loading branch information
octospacc
committed
Nov 5, 2023
1 parent
3d736a0
commit dfc37bc
Showing
24 changed files
with
133 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
created: 20231105154350579 | ||
created: 20231105232914777 | ||
current-tiddler: GettingStarted | ||
modified: 20231105154350579 | ||
modified: 20231105232914777 | ||
title: $:/HistoryList | ||
type: application/json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
created: 20231105114939903 | ||
created: 20231105231431599 | ||
creator: Octt | ||
list: | ||
modified: 20231105154203230 | ||
modified: 20231105232654357 | ||
modifier: Octt | ||
title: $:/StoryList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
created: 20220920140732083 | ||
creator: Octt | ||
modified: 20231105151132314 | ||
modified: 20231105210451811 | ||
modifier: Octt | ||
title: $:/state/showeditpreview | ||
|
||
yes | ||
no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
4 changes: 2 additions & 2 deletions
4
Wiki-OcttKB/tiddlers/System/state/advancedsearch/_currentTab.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
7 changes: 7 additions & 0 deletions
7
Wiki-OcttKB/tiddlers/System/state/folded/$/Styles/View/_i18n.tid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
created: 20231105231235764 | ||
creator: Octt | ||
modified: 20231105232534359 | ||
modifier: Octt | ||
title: $:/state/folded/$:/Styles/View/i18n | ||
|
||
hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
created: 20231105202356015 | ||
creator: Octt | ||
modified: 20231105202357290 | ||
modifier: Octt | ||
title: $:/state/folded/Language | ||
|
||
show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
created: 20221108155618185 | ||
creator: Octt | ||
modified: 20231105151711128 | ||
modified: 20231105183045128 | ||
modifier: Octt | ||
title: $:/state/tree/$:/Macros/ | ||
|
||
show | ||
hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
created: 20230225225512618 | ||
creator: Octt | ||
modified: 20231105104713926 | ||
modified: 20231105214436728 | ||
modifier: Octt | ||
title: $:/state/tree/$:/OcttKB/Config/ | ||
|
||
show | ||
hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
created: 20231105214440145 | ||
creator: Octt | ||
modified: 20231105214441095 | ||
modifier: Octt | ||
title: $:/state/tree/$:/OcttKB/Utils/ | ||
|
||
hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
created: 20230111084703963 | ||
creator: Octt | ||
modified: 20231105151708695 | ||
modified: 20231105185204090 | ||
modifier: Octt | ||
title: $:/state/tree/$:/OcttKB/ | ||
|
||
hide | ||
show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
created: 20230108193801573 | ||
creator: Octt | ||
modified: 20231105151710124 | ||
modified: 20231105214443871 | ||
modifier: Octt | ||
title: $:/state/tree/$:/Styles/ | ||
|
||
hide | ||
show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters