diff --git a/dist/404.html b/dist/404.html index ebced14..b045c8f 100644 --- a/dist/404.html +++ b/dist/404.html @@ -22,7 +22,7 @@
diff --git a/dist/418.html b/dist/418.html index 243d093..9c30e6b 100644 --- a/dist/418.html +++ b/dist/418.html @@ -22,7 +22,7 @@
diff --git a/dist/blog/firstPost.html b/dist/blog/firstPost.html index 14d6e11..e2ea1a8 100644 --- a/dist/blog/firstPost.html +++ b/dist/blog/firstPost.html @@ -22,7 +22,7 @@
diff --git a/dist/blog/index.html b/dist/blog/index.html index 13edfed..0384439 100644 --- a/dist/blog/index.html +++ b/dist/blog/index.html @@ -22,7 +22,7 @@
diff --git a/dist/blog/minimalMessaging.html b/dist/blog/minimalMessaging.html index 4657be8..856acd9 100644 --- a/dist/blog/minimalMessaging.html +++ b/dist/blog/minimalMessaging.html @@ -23,7 +23,7 @@ bear.oops.wtf
diff --git a/dist/calc/elastic.html b/dist/calc/elastic.html new file mode 100644 index 0000000..cad32d5 --- /dev/null +++ b/dist/calc/elastic.html @@ -0,0 +1,54 @@ + + + + + + + + + + Blog Index + + + + + + + + + + + +
+ +
+
+

BEAR.OOPS.WTF

+
+
+

Page created: March 15, 2024

+

Page last modified: March 15, 2024

+ +
+ + diff --git a/dist/coolLinks.html b/dist/coolLinks.html index 28d12af..1bfffb7 100644 --- a/dist/coolLinks.html +++ b/dist/coolLinks.html @@ -22,7 +22,7 @@
diff --git a/dist/elastic.js b/dist/elastic.js new file mode 100644 index 0000000..72ae284 --- /dev/null +++ b/dist/elastic.js @@ -0,0 +1 @@ +(()=>{"use strict";var t={672:(t,n,e)=>{e.d(n,{q:()=>a});var r=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}a((r=r.apply(t,n||[])).next())}))},o=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(u=0)),u;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]{var r=e(672);document.addEventListener("DOMContentLoaded",(function(){new r.q(document.getRootNode()).run()}))}},n={};function e(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return t[r](i,i.exports,e),i.exports}e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(108),e(672)})(); \ No newline at end of file diff --git a/dist/git/index.html b/dist/git/index.html index ebaa18c..3fd6d41 100644 --- a/dist/git/index.html +++ b/dist/git/index.html @@ -22,7 +22,7 @@
diff --git a/dist/index.html b/dist/index.html index 5f73329..3c3278f 100644 --- a/dist/index.html +++ b/dist/index.html @@ -22,7 +22,7 @@
@@ -34,7 +34,7 @@

Hello, I’m Bear. I don’t have much to put here. I play some games (Tetris recently),

Cool Links Git Blog Posts

+ href="/git/">Git Blog Posts

diff --git a/dist/sitemap.xml b/dist/sitemap.xml index 45239ee..b636b6e 100644 --- a/dist/sitemap.xml +++ b/dist/sitemap.xml @@ -8,4 +8,5 @@ https://bear.oops.wtf/git/index.html https://bear.oops.wtf/index.html https://bear.oops.wtf/snoop.html +https://bear.oops.wtf/calc/elastic.html diff --git a/dist/snoop.html b/dist/snoop.html index 568711c..dc40831 100644 --- a/dist/snoop.html +++ b/dist/snoop.html @@ -22,7 +22,7 @@
diff --git a/js/Cache.ts b/js/Cache.ts new file mode 100644 index 0000000..0f2a7dc --- /dev/null +++ b/js/Cache.ts @@ -0,0 +1,34 @@ +export class InputFieldCache { + private typingTimer: ReturnType; + private doneTypingInterval: number = 1000; + + constructor() { + this.cacheInputFields(); + } + + private async cacheInputFields() { + const inputFields = document.querySelectorAll('input'); + console.debug(inputFields); + inputFields.forEach((input: HTMLInputElement) => { + input.addEventListener('input', () => { + clearTimeout(this.typingTimer); + this.typingTimer = setTimeout(() => { + console.debug(`${input.id}: ${input.value}`); + localStorage.setItem(input.id, input.value); + }, this.doneTypingInterval); + }); + + const cachedValue = localStorage.getItem(input.id); + if (cachedValue !== null) { + input.value = cachedValue; + } + }); + } + + async clearCache() { + const inputFields = document.querySelectorAll('input'); + inputFields.forEach((input: HTMLInputElement) => { + localStorage.removeItem(input.id); + }); + } +} \ No newline at end of file diff --git a/js/calc/App.ts b/js/calc/App.ts new file mode 100644 index 0000000..30d1417 --- /dev/null +++ b/js/calc/App.ts @@ -0,0 +1,18 @@ +import { InputFieldCache } from "../Cache"; + +export class App { + private state: Node; + private inputFieldCache: InputFieldCache; + + constructor(state: Node) { + this.state = state; + } + + async cache(): Promise { + return new InputFieldCache(); + } + + async run() { + this.inputFieldCache = await this.cache(); + } +} \ No newline at end of file diff --git a/js/calc/elastic.ts b/js/calc/elastic.ts new file mode 100644 index 0000000..767a8a4 --- /dev/null +++ b/js/calc/elastic.ts @@ -0,0 +1,8 @@ +import { App } from "./App"; + +function __run() { + const app = new App(document.getRootNode()); + app.run(); +} + +document.addEventListener("DOMContentLoaded", __run); \ No newline at end of file diff --git a/src/calc/elastic.md b/src/calc/elastic.md new file mode 100644 index 0000000..0b207b9 --- /dev/null +++ b/src/calc/elastic.md @@ -0,0 +1,26 @@ +--- +title: Blog Index +author: BearFM +date: March 15, 2024 +modified: March 15, 2024 +#header: +header: +--- + \ No newline at end of file diff --git a/src/index.md b/src/index.md index 8539b8f..6bad2ee 100644 --- a/src/index.md +++ b/src/index.md @@ -10,5 +10,5 @@ Hello, I'm Bear. I don't have much to put here. I play some games (Tetris recently), [Cool Links](/coolLinks.html) -[Git](/git) -[Blog Posts](/blog) \ No newline at end of file +[Git](/git/) +[Blog Posts](/blog/) \ No newline at end of file diff --git a/src/tmpl.html b/src/tmpl.html index 9c182a0..eb0eaf9 100644 --- a/src/tmpl.html +++ b/src/tmpl.html @@ -22,7 +22,7 @@
diff --git a/webpack.config.js b/webpack.config.js index 70faa54..7bc3e6b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,6 +15,7 @@ const config = { blogIndex: glob.sync("./js/blogIndex/**/*.ts").map(file => path.resolve(file)), css: glob.sync("./js/css/**/*.ts").map(file => path.resolve(file)).concat(["./src/scss/style.scss"]), main: glob.sync("./js/main/**/*.ts").map(file => path.resolve(file)), + elastic: glob.sync("./js/calc/**/*.ts").map(file => path.resolve(file)), }, output: {