OcttKB/Wiki-OcttKB/tiddlers/System/$__Styles_View_9-99-Hacks.tid

32 lines
1.3 KiB
Plaintext

created: 20230124112022156
creator: Octt
modified: 20230413085126714
modifier: Octt
tags: $:/tags/ViewTemplate
title: $:/Styles/View/9-99-Hacks
\define AiLinks(Enabled:1)
\whitespace trim
<<script script="
if ('$(Enabled)$' == 1) {
var Query = decodeURIComponent('Please summarize the following article into concise key bullet points: ${URL}. Write the points as objective, generalized declarations that stand by themselves. Do not write them as to explain what the author thinks subjectively. Do not leave any point as unclear: each point must not lead the reader to asking any %22why%22; questions. Avoid boilerplate and repetitions.');
var Title = `$(currentTiddler)$`.replaceAll(`'`, '&apos;');
var Select = `.tc-tiddler-frame[data-tiddler-title='${Title}']`;
var Tiddlers = document.querySelectorAll(Select);
Tiddlers.forEach(function(El){
El.querySelectorAll('a.tc-tiddlylink-external').forEach(function(Link){
var AiLink = document.createElement('span');
AiLink.className = 'AiLink';
AiLink.innerHTML = `<sup>[<a rel='noopener noreferrer' target='_blank' href='https://www.bing.com/search?q=${encodeURIComponent(Query.replace('${URL}', Link.href))}'>AI</a>]</sup>`;
Link.after(AiLink);
});
});
};
">>
\end
<$set name=Enabled value={{$:/OcttKB/Config/AiLinks.ui!!Enabled}}>
<<AiLinks>>
</$set>