Rayquaza01 / note-taker

A Firefox addon that adds a text box to a toolbar button for taking notes.
MIT License
28 stars 4 forks source link

Code style - element reference #9

Closed yfdyh000 closed 6 years ago

yfdyh000 commented 6 years ago

This is a concept show, it does not include changes to notes.js as same. I think and suggest you use a better way to organize these variables, such as the simple method I showed to collect and identify its role, so as not to mix the these variables (const) with the real variables.

In addition, you can use an array/class and uniform naming to organize meta name, element IDs and variables to handle them with logical looping code. You can also create a helper function like $e() (just like $() in jQuery) instead of a repeated long reference document.getElementById().

I am concerned about this project because it is a good idea and prototype, and I expect it to be i18n. But the existing code style will bring great risks and challenges as it grows. Looking forward to your insights.

Rayquaza01 commented 6 years ago

Ok, I'm merging this PR. I agree that the way I use element variables currently is messy, so organizing them in an object is going to be much better.