zishu's blog

zishu's blog

一个热爱生活的博主。https://zishu.me

Reflection after development

Last night, I wrote a Tampermonkey script for a friend. The scenario was a form with many input boxes, mostly for frequently filled strings. After my friend told me about it, I happened to have some free time, so I spent a couple of hours after dinner writing it quickly.

The requirement was to preset multiple templates that could be added to later, and have them displayed at the top of the webpage. Clicking a button would fill the form on the webpage with the pre-set text.

The process was quite simple. I originally planned to use AJAX to call a JSON file and write the templates in the JSON, making it easy to add data later. However, after testing, I found that the target website blocked external files, so I gave up on this approach. Instead, I created an array and each object in the array represented a set of templates. Then it was just a simple loop. I also created a resizable popup window and bound the buttons for interaction. Clicking the corresponding button would fill the website with the template's string.

That's roughly the process. After finishing, I polished it up a bit and wrote some CSS code. Overall, it wasn't difficult, and I finished it in less than two hours.

However, I realized that I've been writing a lot of Vue and Element every day, and I've become a bit rusty in basic JavaScript. For example, I encountered errors when operating and looping through arrays, which shouldn't have happened upon careful inspection.

I deeply reflect on myself. Basic knowledge still needs to be consolidated, and I shouldn't blindly rely on frameworks, even if they make writing easier.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.