ng-inspector icon indicating copy to clipboard operation
ng-inspector copied to clipboard

Change toolbar icon to reflect Angular usage in the page

Open rev087 opened this issue 10 years ago • 9 comments

Add a feature to dynamically update the Toolbar button for the current page, displaying an "enabled" icon if Angular is detected in the page and a "disabled" icon otherwise.

The LiveReload extension can provide an example on dynamically changing the icon.

See this comment on issue 78

rev087 avatar Apr 14 '15 04:04 rev087

For reference:

Chrome http://stackoverflow.com/a/16924274

Firefox http://stackoverflow.com/a/18232989 https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Adding_Toolbars_and_Toolbar_Buttons#Toolbar_button_icons

Safari: http://stackoverflow.com/a/12689172 https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/AddingExtensionMenus/AddingExtensionMenus.html

DrewML avatar Apr 14 '15 05:04 DrewML

So, what are your thoughts on the ng-detector style of checking for Angular? You have much deeper knowledge of the ng-inspector code, so you may know what repercussions could come from us making that change.

I will say, I'm not entirely convinced switching the method of Angular detection would even be necessary. Do you think we'd get any benefit from it? I can't think of a scenario where the lib itself won't expose an angular global.

DrewML avatar Apr 14 '15 05:04 DrewML

The simple detection we're doing in bootstrap.js for the presence of the angular object in the window scope would probably stay even if we add an additional check borrowed from Igor's ng-detector since we're using that object immediately after, and it's good practice to test the existence before referencing it.

rev087 avatar Apr 14 '15 05:04 rev087

I'm not against adding an additional check using his method, but I'm not sure if it would add any benefits either.

rev087 avatar Apr 14 '15 05:04 rev087

Added disabled states for all toolbar button icon sizes, (same filename sufixed with -disabled) as well as the empty state graphic to the repo.

Disabled: Enabled:

rev087 avatar Apr 14 '15 06:04 rev087

A great suggestion was made in #115 to only show the ng-inspector icon on pages where Angular is found.

@rev087 How do you feel about that approach? I think it makes more sense, and will keep the users toolbar free from clutter on non-angular pages.

Having said that, we'll need to determine if we can support that functionality in both Safari and Firefox

DrewML avatar Sep 13 '15 19:09 DrewML

The work for Firefox/Safari still needs to be done, but I now have a branch with the work done in Chrome to only show the ng-inspector icon/button when Angular is present on the page.

DrewML avatar Oct 11 '15 21:10 DrewML

It turns out this is a pita to implement in Safari. Unlike Chrome, which has the concept of page actions that scope the icon to the tab itself, Safari makes you track tab navigation manually, updating the icon each time, by juggling a ton of different events they provide.

DrewML avatar Oct 12 '15 07:10 DrewML

Is there somehwere I can find out what the different icons mean?

wilsmi avatar Apr 20 '16 13:04 wilsmi