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

35 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-02-28 12:07:24 +01:00
created: 20230124112022156
creator: Octt
2023-04-29 22:45:36 +00:00
modified: 20230429202157475
2023-02-28 12:07:24 +01:00
modifier: Octt
2023-03-07 22:19:44 +00:00
tags: $:/tags/ViewTemplate
2023-02-28 12:07:24 +01:00
title: $:/Styles/View/9-99-Hacks
2023-04-13 09:40:39 +00:00
\define AiLinks(Enabled:1)
2023-03-07 22:19:44 +00:00
\whitespace trim
2023-03-07 19:42:11 +00:00
<<script script="
2023-04-29 22:45:36 +00:00
try {
2023-03-07 22:19:44 +00:00
2023-04-13 09:40:39 +00:00
if ('$(Enabled)$' == 1) {
2023-03-07 22:19:44 +00:00
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);
});
});
};
2023-04-29 22:45:36 +00:00
} catch(e) { ErrAtLine(e); };
2023-03-07 19:42:11 +00:00
">>
\end
2023-04-13 09:40:39 +00:00
<$set name=Enabled value={{$:/OcttKB/Config/AiLinks.ui!!Enabled}}>
<<AiLinks>>
</$set>