Add slides for Hermes the translator

This commit is contained in:
iacore
2026-05-23 16:00:27 +08:00
parent ef6a9f5cd9
commit d131f231bd
46 changed files with 28724 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import { HLJSApi } from 'highlight.js';
import { RevealPlugin } from 'reveal.js';
export interface HighlightLine {
start?: number;
end?: number;
}
export interface HighlightLineNumbersOptions {
singleLine?: boolean;
startFrom?: number;
}
export interface HighlightJsApi extends HLJSApi {
initLineNumbersOnLoad(options?: HighlightLineNumbersOptions): void;
lineNumbersBlock(element: HTMLElement, options?: HighlightLineNumbersOptions): void;
lineNumbersValue(code: string, options?: HighlightLineNumbersOptions): string | undefined;
}
export interface HighlightScrollState {
currentBlock?: HTMLElement;
animationFrameID?: number;
}
export interface HighlightLineBounds {
top: number;
bottom: number;
}
export type HighlightLineStep = HighlightLine[];
export interface HighlightPlugin extends RevealPlugin {
id: 'highlight';
HIGHLIGHT_STEP_DELIMITER: '|';
HIGHLIGHT_LINE_DELIMITER: ',';
HIGHLIGHT_LINE_RANGE_DELIMITER: '-';
hljs: HighlightJsApi;
highlightBlock(block: HTMLElement): void;
scrollHighlightedLineIntoView(block: HTMLElement, scrollState: HighlightScrollState, skipAnimation?: boolean): void;
easeInOutQuart(t: number): number;
getHighlightedLineBounds(block: HTMLElement): HighlightLineBounds;
highlightLines(block: HTMLElement, linesToHighlight?: string): void;
deserializeHighlightSteps(highlightSteps: string): HighlightLineStep[];
serializeHighlightSteps(highlightSteps: HighlightLineStep[]): string;
}
declare const Highlight: () => HighlightPlugin;
export default Highlight;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+71
View File
@@ -0,0 +1,71 @@
/*
Monokai style - ported by Luigi Maselli - http://grigio.org
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #272822;
color: #ddd;
}
.hljs-tag,
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-strong,
.hljs-name {
color: #f92672;
}
.hljs-code {
color: #66d9ef;
}
.hljs-class .hljs-title {
color: white;
}
.hljs-attribute,
.hljs-symbol,
.hljs-regexp,
.hljs-link {
color: #bf79db;
}
.hljs-string,
.hljs-bullet,
.hljs-subst,
.hljs-title,
.hljs-section,
.hljs-emphasis,
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #a6e22e;
}
.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
color: #75715e;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag,
.hljs-title,
.hljs-section,
.hljs-type,
.hljs-selector-id {
font-weight: bold;
}
+79
View File
@@ -0,0 +1,79 @@
/*
Zenburn style from voldmar.ru (c) Vladimir Epifanov <voldmar@voldmar.ru>
based on dark.css by Ivan Sagalaev
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #3f3f3f;
color: #dcdcdc;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-tag {
color: #e3ceab;
}
.hljs-template-tag {
color: #dcdcdc;
}
.hljs-number {
color: #8cd0d3;
}
.hljs-variable,
.hljs-template-variable,
.hljs-attribute {
color: #efdcbc;
}
.hljs-literal {
color: #efefaf;
}
.hljs-subst {
color: #8f8f8f;
}
.hljs-title,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-section,
.hljs-type {
color: #efef8f;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link {
color: #dca3a3;
}
.hljs-deletion,
.hljs-string,
.hljs-built_in,
.hljs-builtin-name {
color: #cc9393;
}
.hljs-addition,
.hljs-comment,
.hljs-quote,
.hljs-meta {
color: #7f9f7f;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
+21
View File
@@ -0,0 +1,21 @@
import { MarkdownConfig, RevealPlugin } from 'reveal.js';
import { Marked } from 'marked';
export interface MarkdownSlidifyOptions {
separator?: string | null;
verticalSeparator?: string | null;
notesSeparator?: string;
attributes?: string;
}
export interface MarkdownOptions extends MarkdownConfig {
animateLists?: boolean;
}
export interface MarkdownPlugin extends RevealPlugin {
id: 'markdown';
processSlides(scope: ParentNode): Promise<void[]>;
convertSlides(): Promise<void>;
slidify(markdown: string, options?: MarkdownSlidifyOptions): string;
readonly marked: Marked | null;
readonly markdownOptions: MarkdownOptions;
}
declare const Markdown: () => MarkdownPlugin;
export default Markdown;
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
import { RevealPlugin } from 'reveal.js';
export interface KaTeXPlugin extends RevealPlugin {
id: 'katex';
}
export interface MathJax2Plugin extends RevealPlugin {
id: 'mathjax2';
}
export interface MathJax3Plugin extends RevealPlugin {
id: 'mathjax3';
}
export interface MathJax4Plugin extends RevealPlugin {
id: 'mathjax4';
}
export interface MathPlugin extends MathJax2Plugin {
KaTeX: () => KaTeXPlugin;
MathJax2: () => MathJax2Plugin;
MathJax3: () => MathJax3Plugin;
MathJax4: () => MathJax4Plugin;
}
declare const Math: MathPlugin;
export default Math;
+1
View File
@@ -0,0 +1 @@
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.RevealMath=t())})(this,function(){var e=()=>{let e,t={version:`latest`,delimiters:[{left:`$$`,right:`$$`,display:!0},{left:`$`,right:`$`,display:!1},{left:`\\(`,right:`\\)`,display:!1},{left:`\\[`,right:`\\]`,display:!0}],ignoredTags:[`script`,`noscript`,`style`,`textarea`,`pre`,`code`]},n=e=>{let t=document.createElement(`link`);t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)},r=e=>new Promise((t,n)=>{let r=document.createElement(`script`);r.type=`text/javascript`,r.onload=t,r.onerror=n,r.src=e,document.head.append(r)});async function i(e){for(let t of e)await r(t)}return{id:`katex`,init:function(r){e=r;let a=e.getConfig().katex||{},o={...t,...a},{local:s,version:c,extensions:l,...u}=o,d=o.local||`https://cdn.jsdelivr.net/npm/katex`,f=o.local?``:`@`+o.version,p=d+f+`/dist/katex.min.css`,m=d+f+`/dist/katex.min.js`,h=d+f+`/dist/contrib/mhchem.min.js`,g=d+f+`/dist/contrib/auto-render.min.js`,_=[m];o.extensions&&o.extensions.includes(`mhchem`)&&_.push(h),_.push(g);let v=()=>{renderMathInElement(r.getSlidesElement(),u),e.layout()};n(p),i(_).then(()=>{e.isReady()?v():e.on(`ready`,v.bind(this))})}}},t=()=>{let e,t={messageStyle:`none`,tex2jax:{inlineMath:[[`$`,`$`],[`\\(`,`\\)`]],skipTags:[`script`,`noscript`,`style`,`textarea`,`pre`,`code`]},skipStartupTypeset:!0};function n(e,t){let n=document.querySelector(`head`),r=document.createElement(`script`);r.type=`text/javascript`,r.src=e;let i=()=>{typeof t==`function`&&(t.call(),t=null)};r.onload=i,r.onreadystatechange=()=>{this.readyState===`loaded`&&i()},n.appendChild(r)}return{id:`mathjax2`,init:function(r){e=r;let i=e.getConfig().mathjax2||e.getConfig().math||{},a={...t,...i},o=a.mathjax||`https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js`,s=a.config||`TeX-AMS_HTML-full`,c=o+`?config=`+s;a.tex2jax={...t.tex2jax,...i.tex2jax},a.mathjax=a.config=null,n(c,function(){MathJax.Hub.Config(a),MathJax.Hub.Queue([`Typeset`,MathJax.Hub,e.getRevealElement()]),MathJax.Hub.Queue(e.layout),e.on(`slidechanged`,function(e){MathJax.Hub.Queue([`Typeset`,MathJax.Hub,e.currentSlide])})})}}};return Plugin=Object.assign(t(),{KaTeX:e,MathJax2:t,MathJax3:()=>{let e,t={tex:{inlineMath:[[`$`,`$`],[`\\(`,`\\)`]]},options:{skipHtmlTags:[`script`,`noscript`,`style`,`textarea`,`pre`,`code`]},startup:{ready:()=>{MathJax.startup.defaultReady(),MathJax.startup.promise.then(()=>{e.layout()})}}};function n(e,t){let n=document.createElement(`script`);n.type=`text/javascript`,n.id=`MathJax-script`,n.src=e,n.async=!0,n.onload=()=>{typeof t==`function`&&(t.call(),t=null)},document.head.appendChild(n)}return{id:`mathjax3`,init:function(r){e=r;let i=e.getConfig().mathjax3||{},a={...t,...i};a.tex={...t.tex,...i.tex},a.options={...t.options,...i.options},a.startup={...t.startup,...i.startup};let o=a.mathjax||`https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js`;a.mathjax=null,window.MathJax=a,n(o,function(){e.addEventListener(`slidechanged`,function(e){MathJax.typeset()})})}}},MathJax4:()=>{let e,t={tex:{inlineMath:[[`$`,`$`],[`\\(`,`\\)`]]},options:{skipHtmlTags:[`script`,`noscript`,`style`,`textarea`,`pre`,`code`]},startup:{ready:()=>{MathJax.startup.defaultReady(),MathJax.startup.promise.then(()=>{e.layout()})}}};function n(e,t){let n=document.createElement(`script`);n.type=`text/javascript`,n.id=`MathJax-script`,n.src=e,n.async=!0,n.onload=()=>{typeof t==`function`&&(t.call(),t=null)},document.head.appendChild(n)}return{id:`mathjax4`,init:function(r){e=r;let i=e.getConfig().mathjax4||{},a={...t,...i};a.tex={...t.tex,...i.tex},a.options={...t.options,...i.options},a.startup={...t.startup,...i.startup};let o=a.mathjax||`https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js`;a.mathjax=null,window.MathJax=a,n(o,function(){MathJax.startup.promise.then(()=>{MathJax.typeset(),e.addEventListener(`slidechanged`,function(e){MathJax.typeset()})})})}}}})});
+221
View File
@@ -0,0 +1,221 @@
//#region plugin/math/katex.js
var e = () => {
let e, t = {
version: "latest",
delimiters: [
{
left: "$$",
right: "$$",
display: !0
},
{
left: "$",
right: "$",
display: !1
},
{
left: "\\(",
right: "\\)",
display: !1
},
{
left: "\\[",
right: "\\]",
display: !0
}
],
ignoredTags: [
"script",
"noscript",
"style",
"textarea",
"pre",
"code"
]
}, n = (e) => {
let t = document.createElement("link");
t.rel = "stylesheet", t.href = e, document.head.appendChild(t);
}, r = (e) => new Promise((t, n) => {
let r = document.createElement("script");
r.type = "text/javascript", r.onload = t, r.onerror = n, r.src = e, document.head.append(r);
});
async function i(e) {
for (let t of e) await r(t);
}
return {
id: "katex",
init: function(r) {
e = r;
let a = e.getConfig().katex || {}, o = {
...t,
...a
}, { local: s, version: c, extensions: l, ...u } = o, d = o.local || "https://cdn.jsdelivr.net/npm/katex", f = o.local ? "" : "@" + o.version, p = d + f + "/dist/katex.min.css", m = d + f + "/dist/katex.min.js", h = d + f + "/dist/contrib/mhchem.min.js", g = d + f + "/dist/contrib/auto-render.min.js", _ = [m];
o.extensions && o.extensions.includes("mhchem") && _.push(h), _.push(g);
let v = () => {
renderMathInElement(r.getSlidesElement(), u), e.layout();
};
n(p), i(_).then(() => {
e.isReady() ? v() : e.on("ready", v.bind(this));
});
}
};
}, t = () => {
let e, t = {
messageStyle: "none",
tex2jax: {
inlineMath: [["$", "$"], ["\\(", "\\)"]],
skipTags: [
"script",
"noscript",
"style",
"textarea",
"pre",
"code"
]
},
skipStartupTypeset: !0
};
function n(e, t) {
let n = document.querySelector("head"), r = document.createElement("script");
r.type = "text/javascript", r.src = e;
let i = () => {
typeof t == "function" && (t.call(), t = null);
};
r.onload = i, r.onreadystatechange = () => {
this.readyState === "loaded" && i();
}, n.appendChild(r);
}
return {
id: "mathjax2",
init: function(r) {
e = r;
let i = e.getConfig().mathjax2 || e.getConfig().math || {}, a = {
...t,
...i
}, o = a.mathjax || "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js", s = a.config || "TeX-AMS_HTML-full", c = o + "?config=" + s;
a.tex2jax = {
...t.tex2jax,
...i.tex2jax
}, a.mathjax = a.config = null, n(c, function() {
MathJax.Hub.Config(a), MathJax.Hub.Queue([
"Typeset",
MathJax.Hub,
e.getRevealElement()
]), MathJax.Hub.Queue(e.layout), e.on("slidechanged", function(e) {
MathJax.Hub.Queue([
"Typeset",
MathJax.Hub,
e.currentSlide
]);
});
});
}
};
}, n = Plugin = Object.assign(t(), {
KaTeX: e,
MathJax2: t,
MathJax3: () => {
let e, t = {
tex: { inlineMath: [["$", "$"], ["\\(", "\\)"]] },
options: { skipHtmlTags: [
"script",
"noscript",
"style",
"textarea",
"pre",
"code"
] },
startup: { ready: () => {
MathJax.startup.defaultReady(), MathJax.startup.promise.then(() => {
e.layout();
});
} }
};
function n(e, t) {
let n = document.createElement("script");
n.type = "text/javascript", n.id = "MathJax-script", n.src = e, n.async = !0, n.onload = () => {
typeof t == "function" && (t.call(), t = null);
}, document.head.appendChild(n);
}
return {
id: "mathjax3",
init: function(r) {
e = r;
let i = e.getConfig().mathjax3 || {}, a = {
...t,
...i
};
a.tex = {
...t.tex,
...i.tex
}, a.options = {
...t.options,
...i.options
}, a.startup = {
...t.startup,
...i.startup
};
let o = a.mathjax || "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
a.mathjax = null, window.MathJax = a, n(o, function() {
e.addEventListener("slidechanged", function(e) {
MathJax.typeset();
});
});
}
};
},
MathJax4: () => {
let e, t = {
tex: { inlineMath: [["$", "$"], ["\\(", "\\)"]] },
options: { skipHtmlTags: [
"script",
"noscript",
"style",
"textarea",
"pre",
"code"
] },
startup: { ready: () => {
MathJax.startup.defaultReady(), MathJax.startup.promise.then(() => {
e.layout();
});
} }
};
function n(e, t) {
let n = document.createElement("script");
n.type = "text/javascript", n.id = "MathJax-script", n.src = e, n.async = !0, n.onload = () => {
typeof t == "function" && (t.call(), t = null);
}, document.head.appendChild(n);
}
return {
id: "mathjax4",
init: function(r) {
e = r;
let i = e.getConfig().mathjax4 || {}, a = {
...t,
...i
};
a.tex = {
...t.tex,
...i.tex
}, a.options = {
...t.options,
...i.options
}, a.startup = {
...t.startup,
...i.startup
};
let o = a.mathjax || "https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js";
a.mathjax = null, window.MathJax = a, n(o, function() {
MathJax.startup.promise.then(() => {
MathJax.typeset(), e.addEventListener("slidechanged", function(e) {
MathJax.typeset();
});
});
});
}
};
}
});
//#endregion
export { n as default };
+7
View File
@@ -0,0 +1,7 @@
import { RevealPlugin } from 'reveal.js';
export interface NotesPlugin extends RevealPlugin {
id: 'notes';
open(): void;
}
declare const Notes: () => NotesPlugin;
export default Notes;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
import { RevealPlugin } from 'reveal.js';
export interface SearchPlugin extends RevealPlugin {
id: 'search';
open(): void;
close(): void;
toggle(): void;
}
declare const Search: () => SearchPlugin;
export default Search;
+2
View File
@@ -0,0 +1,2 @@
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.RevealSearch=t())})(this,function(){return()=>{let e,t,n,r,i,a,o;function s(){t=document.createElement(`div`),t.classList.add(`searchbox`),t.style.position=`absolute`,t.style.top=`10px`,t.style.right=`10px`,t.style.zIndex=10,t.innerHTML=`<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>
</span>`,n=t.querySelector(`.searchinput`),n.style.width=`240px`,n.style.fontSize=`14px`,n.style.padding=`4px 6px`,n.style.color=`#000`,n.style.background=`#fff`,n.style.borderRadius=`2px`,n.style.border=`0`,n.style.outline=`0`,n.style.boxShadow=`0 2px 18px rgba(0, 0, 0, 0.2)`,n.style[`-webkit-appearance`]=`none`,e.getRevealElement().appendChild(t),n.addEventListener(`keyup`,function(e){switch(e.keyCode){case 13:e.preventDefault(),d(),a=!1;break;default:a=!0}},!1),l()}function c(){t||s(),t.style.display=`inline`,n.focus(),n.select()}function l(){t||s(),t.style.display=`none`,o&&o.remove()}function u(){t||s(),t.style.display===`inline`?l():c()}function d(){if(a){var t=n.value;t===``?(o&&o.remove(),r=null):(o=new f(`slidecontent`),r=o.apply(t),i=0)}r&&(r.length&&r.length<=i&&(i=0),r.length>i&&(e.slide(r[i].h,r[i].v),i++))}function f(t,n){var r=document.getElementById(t)||document.body,i=n||`EM`,a=RegExp(`^(?:`+i+`|SCRIPT|FORM)$`),o=[`#ff6`,`#a0ffff`,`#9f9`,`#f99`,`#f6f`],s=[],c=0,l=``,u=[];this.setRegex=function(e){e=e.trim(),l=RegExp(`(`+e+`)`,`i`)},this.getRegex=function(){return l.toString().replace(/^\/\\b\(|\)\\b\/i$/g,``).replace(/\|/g,` `)},this.hiliteWords=function(t){if(!(t==null||!t)&&l&&!a.test(t.nodeName)){if(t.hasChildNodes())for(var n=0;n<t.childNodes.length;n++)this.hiliteWords(t.childNodes[n]);if(t.nodeType==3){var r,d;if((r=t.nodeValue)&&(d=l.exec(r))){for(var f=t;f!=null&&f.nodeName!=`SECTION`;)f=f.parentNode;for(var p=e.getIndices(f),m=u.length,h=!1,n=0;n<m;n++)u[n].h===p.h&&u[n].v===p.v&&(h=!0);h||u.push(p),s[d[0].toLowerCase()]||(s[d[0].toLowerCase()]=o[c++%o.length]);var g=document.createElement(i);g.appendChild(document.createTextNode(d[0])),g.style.backgroundColor=s[d[0].toLowerCase()],g.style.fontStyle=`inherit`,g.style.color=`#000`;var _=t.splitText(d.index);_.nodeValue=_.nodeValue.substring(d[0].length),t.parentNode.insertBefore(g,_)}}}},this.remove=function(){for(var e=document.getElementsByTagName(i),t;e.length&&(t=e[0]);)t.parentNode.replaceChild(t.firstChild,t)},this.apply=function(e){if(!(e==null||!e))return this.remove(),this.setRegex(e),this.hiliteWords(r),u}}return{id:`search`,init:t=>{e=t,e.registerKeyboardShortcut(`CTRL + Shift + F`,`Search`),document.addEventListener(`keydown`,function(e){e.key==`F`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),u())},!1)},open:c,close:l,toggle:u}}});
+78
View File
@@ -0,0 +1,78 @@
//#endregion
//#region plugin/search/index.ts
var e = () => {
let e, t, n, r, i, a, o;
function s() {
t = document.createElement("div"), t.classList.add("searchbox"), t.style.position = "absolute", t.style.top = "10px", t.style.right = "10px", t.style.zIndex = 10, t.innerHTML = "<input type=\"search\" class=\"searchinput\" placeholder=\"Search...\" style=\"vertical-align: top;\"/>\n </span>", n = t.querySelector(".searchinput"), n.style.width = "240px", n.style.fontSize = "14px", n.style.padding = "4px 6px", n.style.color = "#000", n.style.background = "#fff", n.style.borderRadius = "2px", n.style.border = "0", n.style.outline = "0", n.style.boxShadow = "0 2px 18px rgba(0, 0, 0, 0.2)", n.style["-webkit-appearance"] = "none", e.getRevealElement().appendChild(t), n.addEventListener("keyup", function(e) {
switch (e.keyCode) {
case 13:
e.preventDefault(), d(), a = !1;
break;
default: a = !0;
}
}, !1), l();
}
function c() {
t || s(), t.style.display = "inline", n.focus(), n.select();
}
function l() {
t || s(), t.style.display = "none", o && o.remove();
}
function u() {
t || s(), t.style.display === "inline" ? l() : c();
}
function d() {
if (a) {
var t = n.value;
t === "" ? (o && o.remove(), r = null) : (o = new f("slidecontent"), r = o.apply(t), i = 0);
}
r && (r.length && r.length <= i && (i = 0), r.length > i && (e.slide(r[i].h, r[i].v), i++));
}
function f(t, n) {
var r = document.getElementById(t) || document.body, i = n || "EM", a = RegExp("^(?:" + i + "|SCRIPT|FORM)$"), o = [
"#ff6",
"#a0ffff",
"#9f9",
"#f99",
"#f6f"
], s = [], c = 0, l = "", u = [];
this.setRegex = function(e) {
e = e.trim(), l = RegExp("(" + e + ")", "i");
}, this.getRegex = function() {
return l.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " ");
}, this.hiliteWords = function(t) {
if (!(t == null || !t) && l && !a.test(t.nodeName)) {
if (t.hasChildNodes()) for (var n = 0; n < t.childNodes.length; n++) this.hiliteWords(t.childNodes[n]);
if (t.nodeType == 3) {
var r, d;
if ((r = t.nodeValue) && (d = l.exec(r))) {
for (var f = t; f != null && f.nodeName != "SECTION";) f = f.parentNode;
for (var p = e.getIndices(f), m = u.length, h = !1, n = 0; n < m; n++) u[n].h === p.h && u[n].v === p.v && (h = !0);
h || u.push(p), s[d[0].toLowerCase()] || (s[d[0].toLowerCase()] = o[c++ % o.length]);
var g = document.createElement(i);
g.appendChild(document.createTextNode(d[0])), g.style.backgroundColor = s[d[0].toLowerCase()], g.style.fontStyle = "inherit", g.style.color = "#000";
var _ = t.splitText(d.index);
_.nodeValue = _.nodeValue.substring(d[0].length), t.parentNode.insertBefore(g, _);
}
}
}
}, this.remove = function() {
for (var e = document.getElementsByTagName(i), t; e.length && (t = e[0]);) t.parentNode.replaceChild(t.firstChild, t);
}, this.apply = function(e) {
if (!(e == null || !e)) return this.remove(), this.setRegex(e), this.hiliteWords(r), u;
};
}
return {
id: "search",
init: (t) => {
e = t, e.registerKeyboardShortcut("CTRL + Shift + F", "Search"), document.addEventListener("keydown", function(e) {
e.key == "F" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), u());
}, !1);
},
open: c,
close: l,
toggle: u
};
};
//#endregion
export { e as default };
+6
View File
@@ -0,0 +1,6 @@
import { RevealPlugin } from 'reveal.js';
export interface ZoomPlugin extends RevealPlugin {
id: 'zoom';
}
declare const Zoom: () => ZoomPlugin;
export default Zoom;
+1
View File
@@ -0,0 +1 @@
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.RevealZoom=t())})(this,function(){var e={id:`zoom`,init:function(e){e.getRevealElement().addEventListener(`mousedown`,function(t){var r=/Linux/.test(window.navigator.platform)?`ctrl`:`alt`,i=(e.getConfig().zoomKey?e.getConfig().zoomKey:r)+`Key`,a=e.getConfig().zoomLevel?e.getConfig().zoomLevel:2;t[i]&&!e.isOverview()&&(t.preventDefault(),n.to({x:t.clientX,y:t.clientY,scale:a,pan:!1}))})},destroy:()=>{n.reset()}},t=()=>e,n=(function(){var e=1,t=0,r=0,i=-1,a=-1,o=`transform`in document.body.style;o&&(document.body.style.transition=`transform 0.8s ease`),document.addEventListener(`keyup`,function(t){e!==1&&t.keyCode===27&&n.out()}),document.addEventListener(`mousemove`,function(n){e!==1&&(t=n.clientX,r=n.clientY)});function s(t,n){var r=l();if(t.width=t.width||1,t.height=t.height||1,t.x-=(window.innerWidth-t.width*n)/2,t.y-=(window.innerHeight-t.height*n)/2,o)if(n===1)document.body.style.transform=``;else{var i=r.x+`px `+r.y+`px`,a=`translate(`+-t.x+`px,`+-t.y+`px) scale(`+n+`)`;document.body.style.transformOrigin=i,document.body.style.transform=a}else n===1?(document.body.style.position=``,document.body.style.left=``,document.body.style.top=``,document.body.style.width=``,document.body.style.height=``,document.body.style.zoom=``):(document.body.style.position=`relative`,document.body.style.left=-(r.x+t.x)/n+`px`,document.body.style.top=-(r.y+t.y)/n+`px`,document.body.style.width=n*100+`%`,document.body.style.height=n*100+`%`,document.body.style.zoom=n);e=n,document.documentElement.classList&&(e===1?document.documentElement.classList.remove(`zoomed`):document.documentElement.classList.add(`zoomed`))}function c(){var n=.12,i=window.innerWidth*n,a=window.innerHeight*n,o=l();r<a?window.scroll(o.x,o.y-(1-r/a)*(14/e)):r>window.innerHeight-a&&window.scroll(o.x,o.y+(1-(window.innerHeight-r)/a)*(14/e)),t<i?window.scroll(o.x-(1-t/i)*(14/e),o.y):t>window.innerWidth-i&&window.scroll(o.x+(1-(window.innerWidth-t)/i)*(14/e),o.y)}function l(){return{x:window.scrollX===void 0?window.pageXOffset:window.scrollX,y:window.scrollY===void 0?window.pageYOffset:window.scrollY}}return{to:function(t){if(e!==1)n.out();else{if(t.x=t.x||0,t.y=t.y||0,t.element){var r=20,o=t.element.getBoundingClientRect();t.x=o.left-r,t.y=o.top-r,t.width=o.width+r*2,t.height=o.height+r*2}t.width!==void 0&&t.height!==void 0&&(t.scale=Math.max(Math.min(window.innerWidth/t.width,window.innerHeight/t.height),1)),t.scale>1&&(t.x*=t.scale,t.y*=t.scale,s(t,t.scale),t.pan!==!1&&(i=setTimeout(function(){a=setInterval(c,1e3/60)},800)))}},out:function(){clearTimeout(i),clearInterval(a),s({x:0,y:0},1),e=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return e}}})();return t});
+76
View File
@@ -0,0 +1,76 @@
//#region plugin/zoom/plugin.js
var e = {
id: "zoom",
init: function(e) {
e.getRevealElement().addEventListener("mousedown", function(t) {
var r = /Linux/.test(window.navigator.platform) ? "ctrl" : "alt", i = (e.getConfig().zoomKey ? e.getConfig().zoomKey : r) + "Key", a = e.getConfig().zoomLevel ? e.getConfig().zoomLevel : 2;
t[i] && !e.isOverview() && (t.preventDefault(), n.to({
x: t.clientX,
y: t.clientY,
scale: a,
pan: !1
}));
});
},
destroy: () => {
n.reset();
}
}, t = () => e, n = (function() {
var e = 1, t = 0, r = 0, i = -1, a = -1, o = "transform" in document.body.style;
o && (document.body.style.transition = "transform 0.8s ease"), document.addEventListener("keyup", function(t) {
e !== 1 && t.keyCode === 27 && n.out();
}), document.addEventListener("mousemove", function(n) {
e !== 1 && (t = n.clientX, r = n.clientY);
});
function s(t, n) {
var r = l();
if (t.width = t.width || 1, t.height = t.height || 1, t.x -= (window.innerWidth - t.width * n) / 2, t.y -= (window.innerHeight - t.height * n) / 2, o) if (n === 1) document.body.style.transform = "";
else {
var i = r.x + "px " + r.y + "px", a = "translate(" + -t.x + "px," + -t.y + "px) scale(" + n + ")";
document.body.style.transformOrigin = i, document.body.style.transform = a;
}
else n === 1 ? (document.body.style.position = "", document.body.style.left = "", document.body.style.top = "", document.body.style.width = "", document.body.style.height = "", document.body.style.zoom = "") : (document.body.style.position = "relative", document.body.style.left = -(r.x + t.x) / n + "px", document.body.style.top = -(r.y + t.y) / n + "px", document.body.style.width = n * 100 + "%", document.body.style.height = n * 100 + "%", document.body.style.zoom = n);
e = n, document.documentElement.classList && (e === 1 ? document.documentElement.classList.remove("zoomed") : document.documentElement.classList.add("zoomed"));
}
function c() {
var n = .12, i = window.innerWidth * n, a = window.innerHeight * n, o = l();
r < a ? window.scroll(o.x, o.y - (1 - r / a) * (14 / e)) : r > window.innerHeight - a && window.scroll(o.x, o.y + (1 - (window.innerHeight - r) / a) * (14 / e)), t < i ? window.scroll(o.x - (1 - t / i) * (14 / e), o.y) : t > window.innerWidth - i && window.scroll(o.x + (1 - (window.innerWidth - t) / i) * (14 / e), o.y);
}
function l() {
return {
x: window.scrollX === void 0 ? window.pageXOffset : window.scrollX,
y: window.scrollY === void 0 ? window.pageYOffset : window.scrollY
};
}
return {
to: function(t) {
if (e !== 1) n.out();
else {
if (t.x = t.x || 0, t.y = t.y || 0, t.element) {
var r = 20, o = t.element.getBoundingClientRect();
t.x = o.left - r, t.y = o.top - r, t.width = o.width + r * 2, t.height = o.height + r * 2;
}
t.width !== void 0 && t.height !== void 0 && (t.scale = Math.max(Math.min(window.innerWidth / t.width, window.innerHeight / t.height), 1)), t.scale > 1 && (t.x *= t.scale, t.y *= t.scale, s(t, t.scale), t.pan !== !1 && (i = setTimeout(function() {
a = setInterval(c, 1e3 / 60);
}, 800)));
}
},
out: function() {
clearTimeout(i), clearInterval(a), s({
x: 0,
y: 0
}, 1), e = 1;
},
magnify: function(e) {
this.to(e);
},
reset: function() {
this.out();
},
zoomLevel: function() {
return e;
}
};
})(), r = t;
//#endregion
export { r as default };