Backlinks

A backlink for a given web resource is a link from some other website (the referrer) to that web resource (the referent).

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name            Backlinks
// @name:de         Rückverweise
// @name:fr         Backlinks
// @name:es         Backlinks
// @name:it         Backlink
// @name:pt         Backlinks
// @name:ru         Обратные ссылки
// @name:zh         反向链接
// @name:ja         バックリンク
// @description     A backlink for a given web resource is a link from some other website (the referrer) to that web resource (the referent).
// @description:de  Ein Rückverweis oder Backlink bezeichnet einen Link, der von einer anderen Webseite ausgehend zu einer bestimmten Webseite führt.
// @description:fr  Un backlink pour une ressource web donnée est un lien provenant d'un autre site web (le référent) vers cette ressource web (le référent).
// @description:es  Un backlink para un recurso web dado es un enlace de algún otro sitio web (el referente) a ese recurso web (el referente).
// @description:it  Un backlink per una data risorsa web è un link da un altro sito web (il referente) a quella risorsa web (il referente).
// @description:pt  Um backlink para um determinado recurso da web é um link de algum outro site (o referenciador) para esse recurso da web (o referente).
// @description:ru  Обратная ссылка для данного веб-ресурса — это ссылка с какого-либо другого веб-сайта (референта) на этот веб-ресурс (референт).
// @description:zh  给定 Web 资源的反向链接是从某些其他网站(引用者)到该 Web 资源(被引用者)的链接。
// @description:ja  特定の Web リソースのバックリンクは、他の Web サイト (リファラー) からその Web リソース (リファレント) へのリンクです。
// @version         1.0.2
// @author          Wack.3gp (https://greasyfork.org/users/4792)
// @copyright       2021+, Wack.3gp
// @namespace       https://greasyfork.org/users/4792
// @license         CC BY-NC-ND 4.0; http://creativecommons.org/licenses/by-nc-nd/4.0/
//
// @match           *://*/*
// @noframes
//
// @grant           GM_registerMenuCommand
// @grant           GM_notification
// @grant           GM_xmlhttpRequest
//
// @compatible      Chrome tested with Tampermonkey
// @supportURL      https://greasyfork.org/scripts/423644/feedback
// @contributionURL https://www.paypal.com/donate/?hosted_button_id=BYW9D395KJWZ2
// @contributionAmount €1.00
// ==/UserScript==

/* jshint esversion: 11 */

(function() {
    'use strict';

    const _vault = "4792";
    const _isOriginal = GM_info.script.namespace.includes(_vault);
    const _originalURL = GM_info.script.supportURL.replace("feedback", "");

    const checkProtection = () => {
        if (!_isOriginal) {
            alert("Please install the Original Version");
            window.location.href = _originalURL;
            return false;
        }
        return true;
    };

    GM_registerMenuCommand("🔎 Check Backlinks", function () {
        
        if (!checkProtection()) return;

        var website = prompt("Please enter your Website:", document.URL);
        if (website == null) {
            alert("User cancelled the prompt.");
            return;
        }
        
        if (website == "") {
            alert("Input field must not be empty.");
            return;
        }

        var urlPattern = /^(http.?:\/\/|)\w*\.*[A-Z]*(\.\w*($|\/.*|\?)|\?.*|\d*|$)($|\:\d*($|\/|\?))/gim;
        if (!website.match(urlPattern)) {
            alert("Invalid URL");
            return;
        }
        
        var websitereplace = website.replace(/.*(\/\/|www.)/gim, '').split(/\/$/gim)[0];

        GM_xmlhttpRequest({
            method: "GET",
            url: 'https://www.google.com/search?q="' + websitereplace + '" -site:' + websitereplace,
            onload: function (response) {
                if (response.responseText.includes('id="result-stats"')) {
                    var popularity = response.responseText.split('<div id="result-stats">').pop().split('<nobr>')[0];
                    alert(popularity);
                    
                    console.log(`%c ${GM_info.script.name} %c (Verified Original)`, 
                                "background: #4285F4; color: white; font-weight: bold; padding: 2px 5px;", "color: #4285F4;");
                } else {
                    alert("Google might be showing a Captcha. Please try again later or visit Google search manually.");
                }
            }
        });
    });

        GM_registerMenuCommand("☕ Buy Me a Coffee :)", function () {
alert("Hello, I'm " + GM_info.script.author + "\nand I wrote this script as a hobby.\nIf you find it useful, buy me a coffee :)");
    window.open(GM_info.script.header.match(/@contributionURL\s+(.+)/)[1], "_blank");
        });

    if (_isOriginal) {
        console.log(`%c ${GM_info.script.name} v${GM_info.script.version} %c (Verified Original)`, 
                    "background: #f44336; color: white; font-weight: bold; padding: 2px 5px;", "color: #f44336;");
    }

})();