
Loading…
Add a "Block Element" context menu command to the Firefox Network tab #1324
@AlexVallat Nice, but this doesn't block the element per se, but rather the URL of the request, correct?
If so, I think it'd be more appropriate to call it "Block Resource".
Hmm, yes, fair point. I was just reusing the same menu command in a different spot, but it is the URL that it applies to. That would mean a new translatable string, though...
@AlexVallat right.
The thing is, we'd hate for it be to be misleading.
Here's another idea: it could just say "Block [filename]". So for example, "Block transparent-1211.png".
That avoids the translation issue and actually is somewhat clearer (I think).
Yes, that's a possibility, but there's not often such a clean "filename" to use at the end of a URL. We could do some guesswork, use the last part of the path, strip off query string and anchor parts, and so on. Put in a length limit to avoid extra-wide menu text.
In the end, we'd still have the translation issue because we'd need the string "Block %s" translated!
@AlexVallat ah, true.
Well, it's fine to add a translatable string for "Block Resource".
Though, I just thought of this: wasn't there an issue somewhere that talked about something very similar to this in uBlock's own network request logger? (I'll see if I can find it).
I think it would be a generally useful thing to be able to create a filter from the uBlock network request logger, yes. Trickier to do, though, as it's on a different page (so would need either a different UI for adding, or to switch to the tab to show the element picker). Also, the logger contains more than just network requests (inline-script, for example), so you'd have to either support those too, or provide feedback as to why you can't block them. I'm not saying it shouldn't be done, just that it's a different job to this one!
I'll make the change to introduce a new string when I get a chance. Any reason you prefer "Block Resource" to "Block URL", which would have been my first guess?
@AlexVallat Sorry for not replying earlier.
Block URL also works, but I thought "Block Resource" works better with the terminology of the network request logger and would translate well to uBlock's own request logger.
@chrisaljoudi No problem. Are you happy for this to be merged as it is now, then?
@chrisaljoudi: Just want to check, do you specifically not want this to be in 0.9.4.0? I know it's a bit of a change to the element picker code, but I'm pretty sure it doesn't break existing functionality.
@AlexVallat I'm really sorry for having gone inactive over the weekend and such (unexpected medical issues).
My thought was to finish implementing the same feature in the request logger (so one could add rules right from there) and have them both in the same release.
Sorry for not including it in 0.9.4.0. I hope that's alright.
@chrisaljoudi Oh, I'm sorry to hear that, I hope you're feeling better.
No, that's fine, as long as it's not been forgotten!
- +23 −3 platform/firefox/vapi-background.js
- +4 −0 src/_locales/en/messages.json
- +1 −1 src/js/background.js
- +32 −16 src/js/element-picker.js
- +1 −1 src/js/messaging.js
- +2 −2 src/js/ublock.js
- +1 −1 tools/make-firefox-meta.py
What do you think, would this make a good addition? In my view it complements the Block Element command added to the Inspector tab with #1211 well, as when I want to create a new static filter, I usually end up copying and pasting URLs from here anyway.