Youtube-Geofind button for google maps

add a button to open Youtube-Geofind at the actual google maps coordinates

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Youtube-Geofind button for google maps
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  add a button to open Youtube-Geofind at the actual google maps coordinates
// @author       Guile93 (twitch.tv/Guile)
// @license MIT 
// @match        https://www.google.com/maps/*
// @match        https://www.google.fr/maps/*
// @icon         https://mattw.io/youtube-geofind/img/icon.png
// @grant        none
// ==/UserScript==
(function() {
    var css = `
      .btn{
            background-color: #CC0000;
            border: 1px solid brown;
            height:30px;
            margin-right:5px;
            border-radius: 6px;
            box-shadow: rgba(27, 31, 35, .1) 0 1px 0;
            box-sizing: border-box;
            color: #fff;
            cursor: pointer;
            display: inline-block;
            font-family: -apple-system,system-ui,"Segoe UI\",Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji";
            font-size: 12px;
            font-weight: 600;
            line-height: 20px;
            padding: 0px 16px;
            position: relative;
            float: right;
            text-align: center;
            touch-action: manipulation;
            vertical-align: middle;
          }
          .btn:hover {
            background-color: #FF0000;
          }
          `
    var head = document.getElementsByTagName('head')[0];
    var s = document.createElement('style');
    s.setAttribute('type', 'text/css');
    s.appendChild(document.createTextNode(css));
    head.appendChild(s);
    let btn = document.createElement("button");
    btn.innerHTML = "YG";
    btn.name="goGeofind";
    btn.className="btn";
    btn.addEventListener("click", function () {
        let regexp = /(-?\d+\.\d+),(-?\d+\.\d+)/gi;
        let txt=window.location.href;
        let coords = txt.match(regexp)
        if(coords){
            window.open('https://mattw.io/youtube-geofind/location?location='+coords+'&radius=5&doSearch=true');
        }else{alert('erreur de coordonnées veuillez vous déplacer ou rafraichir');}
    });
    var target=document.getElementById("downgrade");
    target.appendChild(btn);
})();