Remove "use two fingers..." warning on google maps with javascript - javascript

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.

Related

options for implementing a PowerPoint viewer on HTML for a web app (other than embedding with provided i-frame tag)

Here's what I'm trying to accomplish: displaying a PowerPoint presentation on HTML. The user should be able to start and execute the presentation exactly like when you press the "Start Presentation" button in Microsoft PowerPoint: it goes fullscreen, transitions and animations are played, it goes to the next slide if a duration for the slide is set, on click it goes to the next slide, arrow keys are used for navigating slides and so on. Only need to run the presentation, NOT editing.
I've been looking around and came up with these three approaches:
Creating the viewer from scratch and processing/reading the .pptx file using HTML, CSS and JS, btw is this is feasible?
I know it won't be easy, but it seems it would take a lot of time to develop (I'm just one person working in the project).
Also free or paid approaches both are fine, the more options I get to know the better.
WOPI host, the problem with this is I need a paid Office365 membership.
Embedding using a third party such as Office Online, Google Docs, slides.com, the problem I noticed is that the i-frame they provide lacks from functionality and customization.
So my question is, are there other approaches for this? or is this all there is?
Final Edit: I decided to go with iSpring Converter Pro. Seems like the best option overall
Insane amount of work -> not worth it. But you could use a paid library such as Aspose.Slides
MS WOPI is, indeed, a way to do that. WOPI clients such as Office Online and Office Online Server offer an action called present. That's what you're looking for.
What about SlideShare's API and oEmbed?
Another approach:
Convert the PPTX to ODF and use https://viewerjs.org/

How do I make a badge counter similar to Ad-blocker?

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

Greasemonkey script to monitor a website change

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
}

Turn Off Youtube Annotations Using JavaScript

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");

Google Translate BUTTON producing odd results on some pages

UPDATE: even though I've put a bounty here, the answers provided are not even slightly helpful so save yourself the time and move on... sorry.
My URL is: http://colnect.com/en/forum/viewtopic!f%3D46%26t%3D35678
Click the "Translate" button offered by Google. This used to work just fine. Now it translates some of the blocks and for others shows only > instead of translation or keeping the original. I've attached here an "after" screen captures. If you follow the URL and try it for yourself you'll see more parts were being removed. Perhaps Google changed something in the way the button works or there's some Javascript bug there. Would be happy for any ideas here. Thanks
Note: cross-posted on http://productforums.google.com/forum/#!category-topic/webmasters/internationalization/rykImZlToVk
Not quite sure what this has to do w/ programming (if you're a developer for the site, making a browser plugin, etc.), but if I had to purpose a way that translation is being buggy I'd suggest these things:
Check that elements on the website's page are properly identified. No dead links, misroutings, wrongful JavaScript element calls, wrongful CSS element declarations, etc.
Check that the Google Translate API is set up correctly. If everything is working fine on Google Translate itself, everything should be fine w/ the core API.
The solution may be found in one of the suggestions on that topic's fourth page, first post:
I support option 1 ("Translate" icon for each individual post). I think it will be very convenient -
1/ Usually you are interested in a translation of only a few posts out of every page at most anyway. There is no need to translate the whole page.
2/ It will be possible to translate different posts in different languages in the same page.
3/ No need to scroll up the page to click "Translate"
4/ Will be able to see original text
What I'm believing is that, due to the nature of your fora, the translator assumes that an individual post is one language and will try to back-translate it to the user's preferred. What happens is actually evident in the (current) translator for the first post.
I would like to inform you that in the box no longer works the translator.
Let me know if you too have experienced the inconvenience.
thanks
becomes
I would like to Inform You That in the box no longer works the translator.
Let me know if you too have experienced the inconvenience.
thanks
with an appended ,[lang code] at the end of the post.
By the way, you can see the picture's problem here despite the rest being in English and a post in Spanish. I'm assuming the translator is thinking every post is in Spanish (or whatever language it is) and it decides to spit garbage when it doesn't know how to translate to the preferred language.
As much as I love having multiple languages in a single post or even a forum topic, a machine translation cannot tell the difference between "A" language and "A" language despite being the same and being tagged as (in the example) Italian, Spanish, or what have you. This is an error in Google Translate, known as "recursive translation", and may not be fixed for a while.
So, what I recommend is this:
Ask your users to preferably write in one language. This is for the sake of the machine translation so that the poster doesn't confuse it.
Add a dedicated translate button to each post. Not only will this speed up times, it will be way more convenient as outlined by the poster, and avoid any errors not tagged with their respective [lang tag].
Unless this is not implemented (and I believe it is), it would be best to have your own tagging system so Google Translate will know the difference between "A" and "B" languages. In addition to this, you can also mess around with the site's code so that {some foreign language}[lang code] will be wrapped around the text. For example:
{Vorrei comunicare che nella casella posta non funziona più il traduttore.
Fatemi saper se avete anche voi riscontrato l'inconveniente.
Grazie}[it]
{Paulo}[dnt]

Categories

Resources