Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Add colors to address bar #18

Closed
wants to merge 6 commits into from
Closed

Add colors to address bar #18

wants to merge 6 commits into from

Conversation

SeinopSys
Copy link
Contributor

This completes the following points of #6:

  • Auto truncation of http: protocol from address bar
  • URL highlighting (green for https, black for domain, dark gray for the rest)

Newly added JavaScript code is well-commented, address part colors are specified in browser.css

@jdalton
Copy link
Contributor

jdalton commented Sep 27, 2015

Awesome! ✨

this.colorizeAddress = address => {
let HTML = '';
// Parse URL using an <a> element
let a = document.createElement('a');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For URL parsing you can use the Windows.Foundation.Uri WinRT API.
We have the URI const set here and you can see a usage example here.

@jdalton
Copy link
Contributor

jdalton commented Sep 28, 2015

Instead of displaying the full http: protocol when you select the text box it should remain hidden and only show up if they copy the URL bar.

@SeinopSys
Copy link
Contributor Author

Got rid of !important, utilized the built-in URI parser and made the http:// part invisible in the input. I tried adding it back properly when copying but I'd need to hook into a "copy" event and I'm not sure if there's one.

@jayrenn
Copy link
Contributor

jayrenn commented Sep 29, 2015

Great stuff! Regarding the copy event, have you looked into using the Clipboard.ContentChanged WinRT API?

@SeinopSys
Copy link
Contributor Author

@jayrenn Hooking into a central event tracking all clipboard changes would not be ideal in my opinion since it'd be hard to know when the copied content actually comes from the address bar or just some content being copied from the page. The best would be if there was a way to copy arbitrary text content, then I could hook into the keyup event of #urlInput, check when Ctrl+C is pressed, intercept it, and copy the URL (with http:// added if necessary) to the clipboard. I tried doing this with document.execCommand('copy') but it didn't do anything. This would definitely not work with the Right Click > Copy option, but it'd be something at least.

@jayrenn
Copy link
Contributor

jayrenn commented Sep 29, 2015

The oncopy event should allow you to tell when a user is copying text from the address bar, specifically. Perhaps that event can trigger the clipboard management API?

@SeinopSys
Copy link
Contributor Author

Intercepting an event is not an issue, putting any kind of custom text data on the clipboard itself is. Doesn't matter if I caught keydown or copy, I'd still need to alter the data that gets copied.

@jdalton
Copy link
Contributor

jdalton commented Nov 17, 2015

Hi @DJDavid98!

Sorry for the delay. Can you resubmit the PR?
We have a CLA bot in place now and think it should kick in with a fresh request.

@jdalton
Copy link
Contributor

jdalton commented Nov 17, 2015

Thank you!

@SeinopSys
Copy link
Contributor Author

No problem, I understand that this could've caused legal issues before and that's probably the reason for the delay.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants