Cleanup Javascript #2185
No reviewers
Labels
No Label
🔍🤖 Search Engines
approved
dependencies
duplicate
feedback wanted
high priority
I2P
iOS
low priority
OS
Self-contained networks
Social media
stale
streaming
todo
Tor
WIP
wontfix
XMPP
[m]
₿ cryptocurrency
ℹ️ help wanted
↔️ file sharing
⚙️ web extensions
✨ enhancement
❌ software removal
💬 discussion
🤖 Android
🐛 bug
💢 conflicting
📝 correction
🆘 critical
📧 email
🔒 file encryption
📁 file storage
🦊 Firefox
💻 hardware
🌐 hosting
🏠 housekeeping
🔐 password managers
🧰 productivity tools
🔎 research required
🌐 Social News Aggregators
🆕 software suggestion
👥 team chat
🔒 VPN
🌐 website issue
🚫 Windows
👁️ browsers
🖊️ digital notebooks
🗄️ DNS
🗨️ instant messaging (im)
🇦🇶 translations
No Milestone
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: privacyguides/privacytools.io#2185
Loading…
Reference in New Issue
No description provided.
Delete Branch "Javascript-Cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
=== true/false
.Description
Resolves: none
For someone who spends a lot of time in Javascript, the javascript at privacytools.io was something to not prefer not look at it. So I've made some changes that should have none to little impact in the end result, It's just some code quality and code inconsistency fixed. You can refer to the Summary what exactly has been done. As the code was already targeting ECMA6 I updated some code that was readable in ECMA6 to make it more consistency. Thereby removed some useless
=== true/false
as JavaScript will automatic evaluate if the return result is true/false. I saw thesortable.js
and saw already a security flaw(A variable was reinterpreted as HTML without escaping meta-characters), however fiddling around I saw it has no use-case and not used in production and thereby removed and fixed a little issue withtempSrc
to define its aconst
. Looking atredirect.js
, was giving this whole idea to clean it up and moving it to a object and do thewindow.location
just once gives it a better 'maintainability status' to add/modify extra redirects. I've replaced some functions that were passed into events intoconst x = () =>
so it will be used as declaration rather then a new function, so in the further if e.g. the removing of this event is needed it will use the declaration and not pass off a new function and gives you some good hours debugging(talking from experience). I didn't really saw a discussion/issue open for this, but I think everyone agrees to have better quality in the code.Summary:
main.js
ECMA6 ready.=== true/false
.Check List
I understand that by not opening an issue about a software/service/similar addition/removal, this pull request will be closed without merging.
I have read and understand the contributing guidelines.
The project is Free Libre and/or Open Source Software
Didn't look at the other changes, but FYI sortable.js is definitely used in production. https://www.privacytools.io/providers/dns/ for example. (I don't think there is any unused code in general but I may be wrong)
I thought so too, but the problem with this was when I checked at the network request,
sortable.js
was never requested and doing a quick search in the code doesn't mention any reference. Well the netlify preview on dns provider doesn't show anything wrong with it.