grssam / UIEnhancer

Source code for UI Enhancer addon
https://addons.mozilla.org/en-US/firefox/addon/ui-enhancer/
51 stars 22 forks source link

isSetting and isAnchorTag attributes #23

Closed Quicksaver closed 12 years ago

Quicksaver commented 12 years ago

Currently I can't distinguish through CSS between # anchors and other &some=value settings, they both have the isSetting and isAnchorTag set to true, and if I use the enhanced breadcrums system they both also have the same class.

I'd like to style them differently so I wonder if you could maybe in some way distinguish them.

grssam commented 12 years ago

If you are using the new layout for breadcrumbs, then you have a way to distinguish them, see the template css file, it has all the classes and explanation to the classes also.

Quicksaver commented 12 years ago

I'm sorry but I can't find any way to distinguish between them in the template. Even if I could, there actually is no way to distinguish between them in the DOM structure.

For example on this page: https://github.com/scrapmac/UIEnhancer/issues/23#issuecomment-4585358 the last crum corresponds to "#issuecomment-4585358", it has the following structure:

<hbox id="UIEnhancer_URLBar_Stack"
  class="enhanced-stack"
  isSetting="true"
  isAnchorTag="true"
  lastArrowHidden="true"
  isDomain="false"
  isHiddenArrow="false">

  <label id="UIEnhancer_URLBar_Stack_Text"
    class="enhanced-text-noArrow-anchor enhanced-text-noArrow-anchor-normal"/>

  <label id="UIEnhancer_URLBar_Stack_Arrow"
    class="enhanced-arrow-noArrow-anchor enhanced-arrow-noArrow-anchor-normal"/>
</hbox>

While on a google search, the last crum corresponds to something, doesn't really matter what but in my case it's something like "&fp=bunchofnumbers35903548093", it has the following structure:

<hbox id="UIEnhancer_URLBar_Stack"
  class="enhanced-stack"
  isSetting="true"
  isAnchorTag="true"
  lastArrowHidden="true"
  isDomain="false"
  isHiddenArrow="false">

  <label id="UIEnhancer_URLBar_Stack_Text"
    class="enhanced-text-noArrow-anchor enhanced-text-noArrow-anchor-normal"/>

  <label id="UIEnhancer_URLBar_Stack_Arrow"
    class="enhanced-arrow-noArrow-anchor enhanced-arrow-noArrow-anchor-normal"/>
</hbox>

There is absolutely no difference between the two to allow me to differentiate them in a CSS stylesheet, I'm pretty sure you don't distinguish them either in your template css file as far as I can tell, not only from looking at the comments and the commands in it which I did, but also because if I enable it, both these crums will have the exact same appearance.

grssam commented 12 years ago

No, you must be checking wrongly. The anchors have both isAnchor and isSetting as true, while the settings (queryString or &something=someThing) have only the isSetting property as true.

The second code example you have provided is also of an anchor tag as the classes to the inside labels are also anchor based, thus the color of the crumb should also be of blue color. While a setting has green color.

Think of it this way: if there is no difference, how are they styled differently ? and also remember that I am not styling using JavaScript.

Quicksaver commented 12 years ago

Then I don't agree with this behavior: http://img836.imageshack.us/img836/7756/notanchors.jpg

Those are most definitely not anchors. The whole url of that page is http://www.google.pt/#q=github&hl=en&safe=off&client=firefox-a&hs=AQH&rls=org.mozilla:en-US:official&biw=1366&bih=674&fp=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&cad=b

I think your script is considering not only the "q=github" as an anchor crum but also all other crums after that. I think only the string immediately after "#" should be an anchor.

Quicksaver commented 12 years ago

Actually I'd like to correct myself, in this case, not even "q=github" should be considered an anchor because it contains an "=" sign. I think you should only consider as anchors the string immediately after the "#" sign only if it doesn't have an "=" sign after an "&" sign.

Basically this:

anchor -> is anchor

anchor=something -> is not anchor

anchor&other=something -> first is anchor, second isn't

anchor=something&other=else -> nothing is anchor

anchor&something&other -> only the first is anchor

grssam commented 12 years ago

Actually , that is an Ajax way of loading a new page without actual loading. That is an anchor only. For example, in any page, removing the anchor part should not effect the loaded page, right. But in this case, it does. That's why all of it is anchor in this case. And also according to the syntax of a url, a setting cannot not come after anchor. If it does, the whole is consider as an anchor and the matching anchor is loaded.

Quicksaver commented 12 years ago

I have to admit I didn't know the exact mechanism through which it worked, I figured it was something like that because of how google behaved. You're right of course but the coloring seems a bit counter-intuitive.