Greasy Fork is available in English.

Enhanced Google Bar

Google Bar Returns

< Commentaires sur Enhanced Google Bar

Question / commentaire

Posté le: 11/05/2019
Édité le: 11/05/2019

What is this script really doing?

So the first thing I notice is after installing/updating, the script for some reason performs an active download of "Hello.txt" that contains "Hello World" from line 1318.

WTF is this script all doing that it needs almost 1500 friggin lines just to create a Google Bar? (Other than unneeded txt file creation/downloading)

Posté le: 12/05/2019
Édité le: 12/05/2019

It doesn't " just create a Google Bar". It creates an enhanced version, hence the name. If you wanted a static bar that you can't be modified then yeah, the "friggin lines" would be a whole lot less.

But I'm not just creating a static bar. I created a bar that you can customize, from imputing your own links, with custom titles, custom colors, and custom fonts while carrying over your search term.

I am not modifying just the google page to load the bar. It runs on over 60 google pages that require custom CSS to ensure the bar even loads correctly on all the various google pages(and greasyfork, personal preference of mine) . That's nearly 10% of the code right there. Then the bar, and settings themselves need CSS and HTML, which is nearly 25% of the code. I could minimize the CSS at the cost of readability, but readability is more important than minimizing the lines to me. The script handles updating all the options right away, saving whatever you changes you make at the same time.

The script has to handle all of these custom options people can give it, so I have to be able to call for that information. About 5% of the code alone is setting default settings when someone first loads the script.

Another feature of this script is carrying over the search term when you type into google. The carry over the search term feature works on about 45 different websites. This is about 8% of the code.

The hello.txt was a mistake that never meant to make it to live versions of the script, so thank you for pointing that out. I have removed that, already. The purpose behind that was to see if I could figure out a way to make my script cross-browser, so your settings would load in firefox, or chrome. However, that approach wasn't viable so that's why I created the import/export options. The import export options take up about 9% of the code. I, ultimately, would like to have a section on the script home page for people to share their bars with other people.

Example: If you copy and paste this code in the ▲▼ tab the bar will auto load, and save, all the imported options. You can even just edit the import edit field's text to edit the bar right away. Editing the imported code has no safety checks, however. So I recommend just copy/pasting unless you know what you're doing. Note:the formatting on this forum removes the prefex # for the color code ff4848

|===============Google Bar===============|


|============Google Bar Links============||Search|Images|YouTube|Maps|Play|News|Gmail|Drive|Calendar|Amazon |==========Google Bar More Links=========||Music|Books|Finance|Translate|Script Home page

The script has to handle all of the options available in the settings. A function was made each option. For example, when you change the color of the bar to White, the text is automatically changed to a black text to prevent someone from having White on White. There's a lot of code on various checks like that alone. This is probably the largest section of the code.

There is unused code right now about random colors for the bar that I do intend on rewriting. I do not intend on removing it, since that code is never even ran to begin with, and I will be updating that bit of code soon.

I created this script for me, not for anyone else. So if you think it's unnecessarily large, then by all means don't use this script. I am self taught in my endeavors in JavaScript, so there's bound to be code that isn't optimized, but the end result is the code works as I intend.

Thanks for your feedback, and I hope I answered your question enough. Also thank you for not just posting a negative review on it, and allowing me to explain it.

Poster une réponse

Connectez-vous pour poster une réponse.