chrome-tab-modifier icon indicating copy to clipboard operation
chrome-tab-modifier copied to clipboard

Not able to pick a single {span} out of multiple that I want to rename a tab to.

Open ghost opened this issue 7 years ago • 14 comments

In case of bug report, please fill this template and remove italic lines Otherwise, clear all and type :)

Tab Modifier version

Browser: Chrome or Opera

Extension version: X.Y.Z

Can be found here: chrome://extensions/?id=hcbgadmbdkiilgpifjgcakjehmafcjai

Expected behavior

What do you expect?

Actual behavior

What actually happen?

Steps to reproduce the behavior

Please describe the steps to help me to reproduce the actual behavior

  1. Change title to {span}, only picks the first one which is not the one that I want

ghost avatar Aug 29 '17 15:08 ghost

Hey @nokes,

It's a wanted behavior. You must set a more precise CSS selector, like a class or anything that is supported by Javascript querySelector (see this file).

Otherwise, TM doesn't know what span you want to be used. Hope this is more clearer.

Best

sylouuu avatar Aug 29 '17 15:08 sylouuu

I have tried using the class name but I'm not sure if I'm doing it right. {span.textwhite16b} or {textwhite16b} ?

ghost avatar Aug 29 '17 15:08 ghost

{.textwhite16b} is OK. Can you screen or paste the HTML node that you want to target (open the browser dev tools).

sylouuu avatar Aug 29 '17 15:08 sylouuu

<span class="textwhite16b">Customer Name • HP Laptop</span>

ghost avatar Aug 29 '17 16:08 ghost

It should work if this is the only one node in the page with class="textwhite16b".

sylouuu avatar Aug 29 '17 16:08 sylouuu

There might be a few more, but this is the first one. But it doesn't work.

ghost avatar Aug 29 '17 16:08 ghost

If you set the title to "Test" or "{title}", it works?

sylouuu avatar Aug 29 '17 16:08 sylouuu

Yes, that's no problem. class="textwhite16b" {span.textwhite16b} just puts it back to the default title {.textwhite16b} changes the title to that exactly

ghost avatar Aug 29 '17 16:08 ghost

I have a similar problem.

http://law.go.kr/%EB%B2%95%EB%A0%B9/%EB%AF%BC%EB%B2%95

when I make a rule for this page and set 'Title' to {h2}, {#subtitle h2} or {.b1} to change the tab title to '민법', the title is actually set to what I entered literally.

ataiger avatar Sep 06 '17 00:09 ataiger

I had this problem. Tab Modifier runs as soon as the primary page is loaded, but this can be quite a bit before all of the content on the page is loaded (advertisements, iFrames, and anything loaded by JavaScript on the page after page load). If the element it is looking for isn't found on the page, the code defaults to not replacing anything. In my case the text I was looking for was in a block loaded by JavaScript which ran on page load. Of course, by the time I went looking for it with inspect it was always there (it came in quickly, but not fast enough to beat Tab Modifier).

To attempt to alleviate this problem each rule could have an optional "wait" value before changing the title of the tab, in milliseconds, to wait for the content to load before testing the selectors in the title (make the title replacement asynchronous, where today it is done as soon as a matching rule is found).

42degrees avatar Sep 14 '17 01:09 42degrees

I would LOVE a "wait" timer that I could set. I'm working on a project currently that I believe is running into the same issue that @42degrees described.

AdamPRemick avatar Sep 19 '17 16:09 AdamPRemick

Just to follow up on this, I ended up wrapping all the code in content.js in a setTimeout of 5 seconds, and now all of the selectors that weren't loading are loading properly.

I'd guess that's an inefficient way of doing things, but I don't really know what I'm doing and this worked, so I'll go with it. Would love an officially supported way to either set a time delay or to force the tab name to load after the page is done loading javascript. Thanks for the great extension!

AdamPRemick avatar Oct 06 '17 16:10 AdamPRemick

Yes it's an inefficient way to deal with dynamic loaded content.

Tab Modifier needs a total rework to support complex page behaviors. I won't add nasty workarounds till a new major version. But glad you guys can edit your current copy of TM and make it works!

Best

sylouuu avatar Oct 20 '17 10:10 sylouuu

thats not true. i am trying to add the seller name to the title. the span .class with the name exists in the source code so it should be available but it isnt. This is what i am using {span .a-size-small mbcMerchantName}

this dint work as well {.a-size-small mbcMerchantName}

borisrw avatar Jun 19 '18 08:06 borisrw