VRAPI Enhancements

Add map links with pushpin above map in VRAPI dashboard.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         VRAPI Enhancements
// @version      0.33
// @description  Add map links with pushpin above map in VRAPI dashboard.
// @author       Shoshi
// @include      https://safe.hostcompliance.com/*
// @include      https://safe-ca.hostcompliance.com/*
// @include      https://secure.hostcompliance.com/*
// @include      https://www.homeaway.com/vacation-rental/*
// @namespace    https://greasyfork.org/users/438196
// ==/UserScript==

const google = `https://www.google.com/maps/search/?api=1&query=`;
const bing = `https://www.bing.com/maps?where1=`;
const style = "font-weight: bold; width: 100%; text-align: center;";


if (window.location.hostname === "www.homeaway.com") {
window.onload = (e) => {
    const src = document.querySelector('.pdp-map-thumbnail').firstChild.src;
    let params = new URLSearchParams(src);
    let haCoord = params.get("center");
    let haMap = document.querySelector('.listing-overview__map');


haMap.insertAdjacentHTML('beforebegin', `

<a href=${google}${haCoord} style="${style} white-space: normal;" class="label label-default" target="_blank">Google</a><br>
<a href="${bing}${haCoord}&style=h&lvl=18" style="${style} white-space: normal;" class="label label-default" target="_blank">Bing</a>

`);
   document.querySelector('.listing-overview__col').style.cssText = "white-space: normal"
};


}


if(window.location.hostname === "safe-ca.hostcompliance.com" || window.location.hostname === "safe.hostcompliance.com" || window.location.hostname === "secure.hostcompliance.com") {
setTimeout(() => {
    const coord = document.querySelector("#circle").getAttribute("center");
    const map = document.querySelector(".map-container");
    const title = document.querySelectorAll(".md-headline")[2];
    const searchTerm = encodeURIComponent(title.innerText);
    const list = document.querySelectorAll('[ng-if="vm.listing.duplicate_listings.length"]')[0];
    const dupes = (list === undefined) ? 0 : list.getElementsByTagName('A');


    for(let i = 0; i < dupes.length; i++) {
        if(dupes != 0){
            map.insertAdjacentHTML("beforebegin", `
<a class="md-no-style md-button md-ink-ripple" style="${style} font-size: 12px" href=${dupes[i].innerText} target="_blank">${dupes[i].innerText}</a>

`);
        }

}
    map.insertAdjacentHTML("beforebegin", `

<hr>

<a class="md-no-style md-button md-ink-ripple" style="${style}" href=${google}${coord} target="_blank">Google</a><br>
<a class="md-no-style md-button md-ink-ripple" style="${style}" href="${bing}${coord}&style=h&lvl=18" target="_blank">Bing</a>
`);

   title.insertAdjacentHTML("beforeend", `

<a class="md-icon-button md-button md-ink-ripple" target="_blank" href='http://googl.com/#q="${searchTerm}"'>
<md-icon md-font-icon="fa fa-search" class="ng-scope md-font FontAwesome fa fa-search" role="img" aria-label="fa fa-search"></md-icon>

`);

}, 1500);

}