[PrivacyBadger] Need help to retrieve element

Cooper Quintin cooperq at eff.org
Mon Nov 16 11:57:05 PST 2015


Hi Aditi,
I think what you are saying here is that you are trying to implement a
feature to cookieblock domains by default and you want to be able to do
this by calling updateOrigin, which is a problem since updateOrigin()
requires an event which is triggered by the user moving the slider.

I don't think that popup.js is the right place to implement this logic,
since that is essentially the view/controller part of the code.
I would instead implement it in the checkAction function in
webrequest.js. If the 'cookieblock by default' option is enabled then
privacy badger can instead return 'cookieblock' any time it would have
returned 'noaction'.

- Cooper

On 11/13/2015 11:18 PM, Aditi Bhatnagar wrote:
> Hi !
> 
> I need to do updateOrigin without actually moving the slider, as in , I
> am identifying what all origins are green (noaction) presently and then
> setting cookieblock for them that is turning them yellow.Since no event
> is externally  caused, I need to pick up the right element which is done
> like *var $elm= $('label[for="' + event.currentTarget.id
> <http://event.currentTarget.id> + '"]'); *in updateOrigin.
> What would be a good way to retrieve this element in this case? Given
> that I have list of the all the allowed origins that need to be turned
> yellow.
> 
> I tried code like the one below, so as to get the right element from
> which corresponding switchContainer and clicker can be retrieved, but it
> does not seems  to work.
> 
> / var elms = document.getElementsByClassName("clicker tooltip noaction");
>  console.log(elms[0].getAttribute("data-origin"))
>  var on= elms[0].getAttribute("data-origin").replace(".","-")
>  var $elm = $('label[for=" noaction-' + on + '"]');/
> 
> 
> Any suggestions?
> 
> Thanks
> Aditi
> 
> 
> _______________________________________________
> PrivacyBadger mailing list
> PrivacyBadger at eff.org
> https://lists.eff.org/mailman/listinfo/privacybadger
> 


More information about the PrivacyBadger mailing list