PHP.net redirect to english

redirects to English version of the documentation

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

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 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.

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

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!)

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.

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

// ==UserScript==
// @name         PHP.net redirect to english
// @namespace    https://greasyfork.org/en/scripts/40797-php-net-redirect-to-english
// @version      0.3.2
// @description  redirects to English version of the documentation
// @author       adamaru
// @match        http://php.net/manual/*
// @match        https://php.net/manual/*
// @match        http://*.php.net/manual/*
// @match        https://*.php.net/manual/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

/* jshint esversion: 6 */

(function() {
    'use strict';

    const url = window.location.href;
    const regex = /(https?:\/\/(?:[^\.]+\.)?php\.net\/manual\/)([^\/]+)(\/.*)/gm;
    const match = regex.exec(url);

    if(!match){
        return;
    }

    if(match[2] === 'en'){
        return;
    }

    const newUrl = match[1] + 'en' + match[3];
    window.location.replace(newUrl);
})();