Cleanup Javascript #2185
Closed
Gusted wants to merge 4 commits from
Javascript-Cleanup
into master
pull from: Javascript-Cleanup
merge into: privacyguides:master
privacyguides:master
privacyguides:dependabot/bundler/nokogiri-1.13.6
privacyguides:dependabot/bundler/addressable-2.8.0
privacyguides:freddy-m-patch-3
privacyguides:pr-add_RemoveMyPhone_sponsor
privacyguides:pr-browser_cleanup_1257_1328_1430
privacyguides:freddy-m-patch-2
privacyguides:freddy-m-patch-1
privacyguides:pr-vpn_hated_one_video
privacyguides:cdn
privacyguides:update-nitrohorse-image
privacyguides:promote-metager-to-card
privacyguides:hardware
privacyguides:pr-add_azirevpn
privacyguides:pr-add_mailfence
privacyguides:shop
privacyguides:1673
privacyguides:pr/1658
privacyguides:i18n-simple
privacyguides:sponsorship-edits-nov2019
privacyguides:i18n
privacyguides:ipfs
privacyguides:blacklight447-ptio-patch-3
privacyguides:blog
privacyguides:remove-windows-icons
privacyguides:pr/1147
privacyguides:i18n-testing
privacyguides:add-beautify
No Reviewers
Labels
Clear labels
🔍🤖 Search Engines
approved
approved, waiting for a PR
dependencies
Pull requests that update a dependency file
duplicate
feedback wanted
high priority
I2P
The Invisible Internet Project (I2P)
iOS
low priority
OS
Operating Systems
Self-contained networks
Social media
stale
A label for stalebot if it gets added
streaming
Anything related to media streaming.
todo
Tor
Anything covering the Tor network
WIP
active work in progress, do not merge or PR (yet)!
wontfix
Issues or bugs that will not be fixed and/or do not have significant impact on the project.
XMPP
Extensible Messaging and Presence Protocol
[m]
Matrix protocol
₿ cryptocurrency
ℹ️ help wanted
↔️ file sharing
⚙️ web extensions
Browser Extension related issues
✨ enhancement
❌ software removal
💬 discussion
🤖 Android
🐛 bug
💢 conflicting
📝 correction
Correction of content on the website
🆘 critical
📧 email
🔒 file encryption
📁 file storage
🦊 Firefox
Firefox & forks, about:config etc.
💻 hardware
🌐 hosting
🏠 housekeeping
Anything primarily related to site cleanup.
🔐 password managers
🧰 productivity tools
🔎 research required
🌐 Social News Aggregators
🆕 software suggestion
👥 team chat
🔒 VPN
Virtual Private Network
🌐 website issue
*Technical* issues with the website.
🚫 Windows
👁️ browsers
🖊️ digital notebooks
🗄️ DNS
Domain Name System
🗨️ instant messaging (im)
🇦🇶 translations
Anything covering a translated version of the site
No Label
Milestone
No items
No Milestone
No due date set.
Dependencies
No dependencies set.
Reference: privacyguides/privacytools.io#2185
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.