I want to improve my extension and the best way for me to do that right now is probably to add a badge to show that it's blocking things. I just can't wrap my head around how badges work, here is my extension (https://github.com/Cybo1927/Anti-Click-Tracking) and thanks for the help!
I've tried checking popular extensions like uBlock Origin, AdGuard, and Adblock Plus but I can't seem to figure it out.
I hope for it to show the amount of things blocking (for all the attributes if possible)
You can use browser.browserAction.setBadgeText
Code example:
var clicks = 0;
function increment() {
browser.browserAction.setBadgeText({text: (++clicks).toString()});
}
browser.browserAction.onClicked.addListener(increment);
For more information
You can check this example too
Related
I have a web application written in javascript which uses the google maps api to map certain features. However, I am having some unwanted results when users with touchscreen computers try to use the map.
Specifically, I would like to get rid of the warning that tell users "use two fingers to move the map". Similiar to this picture (https://reyner.id/wp-content/uploads/Embedded%20Google%20Map%20Mobile%20Function.jpg)
The issue is due to the fact that when I take "screenshots" of the map (with html2canvas), the warning displays over the map and blocks the image. I think the easiest thing to do might be to disable that warning, but I can't find any documentation on how to do that.
Please let me know if it would help to include any codes or links.
you could use CSS to hide the message,
.gm-style-pbc{
display: none !important
}
I know the question was answered, but for future visitors, I would like to offer a more complete answer, building on the one provided by #Sudhir_Bastakoti:
$('#map-canvas').click(function() {
setTimeout(function() {stopTwoFingerWarning(); }, 2500);
});
function stopTwoFingerWarning() {
$('.gm-style-pbc').hide();
$('.gm-style-pbc').css('display', 'none!important');
}
The above functions will let the visitor see the warning on the first instance, but hide it after 2.5 seconds. Otherwise, how is a visitor to ever receive the instructions to begin with? They will not know how to use the map, and get frustrated.
I chose 2.5 to allow for the message to sink in, but set as you like.
Apparently my note was removed. This is very similar to other answers already out there. I explained that I have tried them all and nothing has worked for me. There are 7 or 8 possibilities I found here on stackoverflow and had no luck with them. There is something I'm missing and can't figure it out. Please help!
We have a script that creates a vehicle selection tool on our dev website. It works great when a single use is in place. However, if there are two versions they conflict. Each instance has a unique id and no matter how I code it, they will not work together. Its probably something obvious, but I don't have the experience to spot it. I've tried all the solutions I could find to attempt to correct the problem and I keep falling short. Depending on how I do the id selectors I can get one or the other to work, but not both. I'm sure it's something obvious that I just don't have the experience to discover.
Code snippets:
function selectVehicleDialog(showCloseButton) {
jQuery("#select-vehicle,#select-vehicle2").dialog('open');
if(showCloseButton == true){
jQuery('.ui-dialog-titlebar-close').remove();
}
loadVehicleFinder('-header');
}
Extensive code trimmed out here as requested
});
When they are both on the page simultaneously, I can change the selectors and make one or the other work.
I want to buy some product online, but every time more stock is added, it's all gone in 5 minutes or less :/
That's why I'm trying to make a small grease/tampermonkey script to watch that page and alert me when stock is available again...
Just to avoid reinventing the wheel I was wondering if there is any existing script for that purpose (I already googled, but couldnt find anything interesting in my search)
Also i'm not sure if greasemonkey allows scripts to be executed every X minutes (Actually I've never done this before with js/greasemonkey)... If not, any advice on a lead to follow or an alternative way to reach my means would be appreciated
Which browser do you use?
I know two firefox extensions that could do the job
Check4Change and Update Scanner .
The code would be something like this, but you would have to know what elements you are looking for.
if (document.getElementById('')) {
alert("alert");
} else {
setInterval('location.reload();',15000); //page reload every 15s
}
There’re currently three ways I know of, to disable annotations in youtube videos:
You can use the YouTube settings. This will not work for me, as I do not have (nor want) an account.
You can use a specialised extension. That might work, but I’d rather not have a full-fledge extension with a ton of options, just for that.
You can use a (ad)blocking extension, and add ||youtube.com/annotations_ to its filters. That suffers from the same issue as the previous point. In addition, it disables them completely, while I simply want them turned off by default (so I have the option to turn them on).
Is it possible to do it using JavaScript? I have a UserScript that already performs some modifications to YouTube’s website, so ideally I’d like to expand it. That’s really the last thing I’m missing.
I ask that answers be constrained to using JS and not browser extensions recommendations. Both because (as mentioned), I already know about those, and because this is as much about the learning process as it is about the result. It’s practice for more UserScripts.
Since youtube sometimes changes the players’s behaviour, I’ll try to keep the code up to date and as robust as possible.
var settings_button = document.querySelector(".ytp-settings-button");
settings_button.click(); settings_button.click(); // open and close settings, so annotations label is created
var all_labels = document.getElementsByClassName("ytp-menuitem-label");
for (var i = 0; i < all_labels.length; i++) {
if ((all_labels[i].innerHTML == "Annotations") && (all_labels[i].parentNode.getAttribute("aria-checked") == "true")) { // find the correct label and see if it is active
all_labels[i].click(); // and in that case, click it
}
}
User's code is correct, settings need to be click & then:
document.querySelectorAll("div[role='menuitemcheckbox']")[1].click()
I added it to my "turn off autoplay & annotations" script: https://gist.github.com/Sytric/4700ee977f427e22c9b0
Previously working JS:
document.querySelectorAll("div[aria-labelledby=\"ytp-menu-iv\"]")[0].click()
I know you don't want to use an extension for this but it is the most flexible and easy way to solve your problem.
Extension gives us the power to use a background script through which we can inject css and javascript to opened web page.
I made one extension on this
https://chrome.google.com/webstore/detail/hide-labels-and-end-cards/jinenhpepbpkepablpjjchejlabbpken
This also has a stop-start button for which I just inject the opposite code as before.
If you need any further help on this, i will be happy to do so.
iv_load_policy (supported players: AS3, AS2, HTML5)
Values: 1 or 3. Default is 1. Setting to 1 will cause video annotations to be shown by default, whereas setting to 3 will cause video annotations to not be shown by default.
Here is a nice solution, just hide the div with annotations
$("div.video-annotations").css("display", "none");
i've been plagued by a problem that seem to started since Youtube's last
layout change this year.
I have for months put up and tried to ignore the freezing that happens
everytime I open a link within youtube such as an channel, an video, the homepage, etc.
I'm using Chrome version 31.0.1650.63 and I have already tested youtube without any
extensions, cookies, cache, etc but it still affects me to this day and maybe some
of you out there.
I searched every where for the solution and couldn't find any anywhere.
I did a bit of digging and testing to see what is the root of the problem and
while i'm no expertise on code or Java...I did found something.
Every time I reload a page on youtube, with it finishing loading up...this happens:
http://i.imgur.com/K9Z3vJ1.png
See that?
The purple-colored rendering, that's the cause of the lag every time I load
up something on youtube!
I notice that it repeats the same thing over and over again for like 5-15 or so
seconds before it starts loading up the thumbnails of the videos.
If you want a closer inspection of the code, here's the raw data from the timeline (that you can load up in chrome's dev timeline window):
Youtube Lag JSON Timeline file
I don't what to do with this problem and I believe it affects
me in Firefox as well but to an lesser extent then chrome.
Do any of you guys know how to resolve this problem?
Honestly I doubt that the youtube devs will fix this problem since they're the ones who caused it in the first place. (Like not being able to subscribe to some people when i'm not even at my sub limit.)
I'm sorry if you don't want to help but I don't know who else to look to besides
the experts that y'all are when it comes to web coding. If anything, I believe a userscript or something similar could help with this but how...I don't know.
I'm new to this and I apologize if the question i'm asking isn't suited for this site.
Still, thanks for reading and if you can...please reply.
That is all and thanks again.
Well I was fiddling around and looking at the source code
with chromes timeline devtools and well...
I found a temporary solution to the problem which seems to have
fixed and ended the freezing on youtube! yay~
But some things don't work with this solution and i'm at
a fault with this issue after some hours trying to figure out
how to stop the problem.
Anyways I used adblock, an extension that I have on Google Chrome, to deal
with this issue and was able to get everything fixed and working!
What I did was, in the custom filters section (check options in your
adblock extension, you should have it.) and added the following then did
some testing to see if it fixed the problem which it did!
Here are the filters I used to fix it!
||s.ytimg.com/yts/jsbin/www-pageframe-*
*www-pageframe-*.js
^^^
Yeah, that's the temporary solution as it fixes the problems but it causes the following...
You can't open the menu which contains links to your playlists, user settings, channel, etc when you click your username or profile
picture on top right of youtube.
The "..." mini-menu that you usually find on the right of a video section (to hide, subscribe, etc.) doesn't appear anymore.
Youtube's quick menu button doesn't work, however the menu is still open but you won't be able to close it. That or it's close and you
won't be able to open it...I guess.
Those are the problems I found with this temporarily solution to the freezing problem.
Yeah...but I hope this helps anyone who's having this problem somewhat well.
But it would be nice if someone has an better solution then mine hehe!
Thanks for reading and if you have a better solution, don't feel afraid to
tell! ^_^
I'll be awaiting other answers, for now...I hope this helps y'all well
in some ways hehe! =D
This certainly isn't javascript, but substituting the normal EasyList in ABP for EasyList without element hiding will fix the issue. There are downsides to this as well but for now seems to be the better solution.