🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

yealink-caller

try to take over the world!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

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.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         yealink-caller
// @namespace    https://greasyfork.org/de/scripts/24688-yealink-caller/
// @version      0.2
// @description  try to take over the world!
// @author       Bernhard Kaszt
// @match        *://*/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_log
// @connect *
// ==/UserScript==

(function()
{
    'use strict';

    function getNumber()
    {
        var number = null;
        var window = unsafeWindow;
        var document = window.document;

        if (window.getSelection) {
            number = window.getSelection().toString();
        } else if (document.getSelection) {
            number = document.getSelection().toString();
        } else {
            number = document.selection.createRange().text;
        }

        if (!number || number.trim().length <= 2) {
            number = window.prompt("Bitte enter a phone number:");
        }

        if (!number || number.trim().length <= 2) {
            return null;
        }

        number = number.toString().replace(/\(0\)/g, '');
        number = number.toString().replace(/\+/g, '00');
        number = number.replace(/\D/g,'');

        return number;
    }

    unsafeWindow.yealink_call = function(caller, ipAddress, password)
    {
        var number = getNumber();
        if (number) {
            var url = "http://admin:" + password + "@" + ipAddress + "/servlet?number=" + number + "&outgoing_uri=" + caller;
            GM_log("Calling number \"" + number + "\" @ " + ipAddress);
            GM_xmlhttpRequest({ method: "GET", url: url });
        }
    };
})();