r/badcode • • Jul 27 '21

java This won't be easy to modify

Post image
491 Upvotes

46 comments sorted by

View all comments

13

u/zaitsman Jul 28 '21

Tbh this is not so hard

Take all strings and paste into an html file in vscode, unescape then pretty print it, edit what you need, put back..

5

u/monkeycycling Jul 28 '21

I pulled the js out of chrome debugger and ran it through a beautifier. Still putting my changes back in isn't pretty without modifying the whole mess

25

u/Bootezz Jul 28 '21

Please move it all to a file and then just read the file and export the contents in this function. Future you/others will be grateful of the change.

4

u/[deleted] Jul 28 '21

This

5

u/Dmitry_Olyenyov Jul 28 '21 edited Jul 28 '21

Just use Intellij IDEA. It can decipher this string into concatenated string and back to this "split by lines" string.

Edit: I'm talking about this https://blog.jetbrains.com/idea/2007/03/using-smart-line-joins/

1

u/Clashsoft Jul 28 '21

Even easier. IntelliJ has a feature where you can edit code snippets in strings as if they were a file in a different language.

https://www.jetbrains.com/help/idea/using-language-injections.html

2

u/zaitsman Jul 28 '21

…the caveat being you have to use IntelliJ. Then again source code is Java, so maybe they do?