【问题标题】:Chrome - Web Skype Extension - Does not highlight phone numbers on web pagesChrome - Web Skype 扩展 - 不在网页上突出显示电话号码
【发布时间】:2016-10-26 00:05:28
【问题描述】:

我使用Skype Web 仅用于点击通话目的。它突出显示了网页/平台上的电话号码,您可以单击并通过 Skype 立即拨打电话。 遗憾的是,他们不再支持这种“数字突出显示”功能,而且要有效地完成我的工作真的很麻烦。许多货运调度员对此也有同样的问题。

我使用this website 查找此扩展程序的旧版本。
8.4+ 版本没有“数字突出显示”复选框选项,但 8.3 及更低版本有。我想出了一个奇怪的解决方法。 (安装最新版本的扩展,删除它,然后安装版本 8.4,删除它,最后安装版本 8.3。版本 8.3 显示“数字突出显示选项”,如果您在其中打勾,它会显示电话号码。直接从最新版本升级到 8.3 版本会出现 chrome 降级错误/问题。)

我目前正在编辑 8.3 版,但运气不佳。请求的主要文件如下:

manifest.json

{
"update_url": "https://clients2.google.com/service/update2/crx",

  "name" : "Skype",
  "version" : "8.3.0.9150",
  "description" : "Quickly access Skype for Web and Share on Skype through your browser",
  "background" : {
    "page": "background.html"
  },
  "options_page": "c2c_options_menu.html",
  "browser_action": {
    "default_icon": {
      "19": "skypelogo_19.png",
      "38": "skypelogo_38.png"
    },
    "default_title": "Skype",
    "default_popup": "browserActionPopup.html"
  },
  "permissions" : [
    "tabs",
    "https://pnrws.skype.com/",
    "https://c2c-directory-dev.trafficmanager.net/",
    "https://c2c-directory-pre.trafficmanager.net/",
    "https://c2c-directory-qa.trafficmanager.net/",
    "https://localhost:26143/"
   ],
  "icons" : {
    "16" : "skypelogo_16.png",
    "19" : "skypelogo_19.png",
    "38" : "skypelogo_38.png",
    "48" : "skypelogo_48.png",
    "128" : "skypelogo_128.png"
  },
  "content_scripts" : [
    {
      "matches" : [ "http://*/*", "https://*/*", "file://*/*" ],
      "js" : [ "jquery-2.1.0.min.js", "mutation-summary.js", "localization.js", "browserSpecificScript.js", "number_highlighting_builder.js", "pnr.js", "fpnr.js", "contentscript.js"],
      "css" : [ "number_highlighting.css", "number_highlighting_chrome.css" ],
      "run_at" : "document_end",
      "all_frames" : true
    }
  ],
  "web_accessible_resources": [
    "call_skype_logo.png", "call_icon.png", "menu_handler.js", "telemetry.js", "specificTelemetry.js"
  ],
  "manifest_version": 2
}

background.js

/* globals SkypeC2CTelemetry */
/**
This is the script run when the browser starts up and is not associated
with any tab. Here we create a add-on icon in the add-on bar to display
the options.
*/
'use strict';
/**
* Returns the product version number
*
* @return Product version number
*/
var getProductVersion = function() {
    return '8.3.0.9150';
};

/**
* Stores configuration information
*/
var Configuration = {
    configReady: '0',
    fingerPrint : '0',
    metricsUrl: 'https://pipe.skype.com/Client/2.0/',
    pushToMobileUrl: 'https://c2c-p2m-secure.skype.com/p2m/v1/push',
    lookupHost: 'pnrws.skype.com',
    uiId : 0
};

/**
* Queries configuration information from PNR service
*/
var queryConfig = function () {
    if (Configuration.configReady === '1') {
        // We already have configuration information
        return;
    }

    var ajaxReq = new XMLHttpRequest();
    ajaxReq.onreadystatechange = function () {
        if (ajaxReq.readyState === 4 && ajaxReq.status === 200) {
            var jsonData = JSON.parse(ajaxReq.responseText);

            if (jsonData.fp) {
                Configuration.fingerPrint = jsonData.fp;
            }
            if (jsonData.metrics_url) {
                Configuration.metricsUrl = jsonData.metrics_url;
            }
            if (jsonData.lookup_host) {
                Configuration.lookupHost = jsonData.lookup_host;
            }
            if (jsonData.pushtomobile_url) {
                Configuration.pushToMobileUrl = jsonData.pushtomobile_url;
            }
            if (jsonData.ui_id) {
                Configuration.uiId = parseInt(jsonData.ui_id);
            }
            Configuration.configReady = '1';

            // Ensure UI id is something we understand
            if (Configuration.uiId !== 0 && Configuration.uiId !== 1) {
                Configuration.uiId = 0;
            }
        }
    };

    ajaxReq.open('GET', 'https://localhost:26143/skypectoc/v1/pnr/config', false);

    // Send the request
    ajaxReq.send();
};

/**
* Sends metrics data
*/
var postMetrics = function(event, userKVPs) {

    if ( event === 'extension_state' ) {
        SkypeC2CTelemetry.post( Configuration.metricsUrl,
            event,
            false, {
                Fingerprint: Configuration.fingerPrint,
                UiId: Configuration.uiId.toString(),
                ReferrerUrl: userKVPs.url,
                Enabled: userKVPs.chosenFunction
            }
        );
    } else if ( event === 'help_page_click' ) {
        SkypeC2CTelemetry.post( Configuration.metricsUrl,
            event,
            false, {
                Fingerprint: Configuration.fingerPrint,
                UiId: Configuration.uiId.toString(),
                ReferrerUrl: userKVPs.url
            }
        );
    }
};

var openFaqTab = function() {
    chrome.tabs.create({
        url: 'https://go.skype.com/skype.extension.faq'
    });
};

var firstLaunchExperience = function() {
    var previousVersion = localStorage.getItem('skype_version');
    var newVersion = getProductVersion();
    if (!previousVersion){
        openFaqTab();
    } else {
        var newMajorVersion = parseInt(newVersion.split('.')[0], 10);
        var previousMajorVersion = parseInt(previousVersion.split('.')[0], 10);
        if (newMajorVersion && previousMajorVersion && (newMajorVersion > previousMajorVersion)) {
            openFaqTab();
        }
        if (previousVersion != newVersion) {
            switchOffHighlightingNotification();
        }
    }
    localStorage.setItem('skype_version', getProductVersion());
};

var switchOffHighlightingNotification = function(){
    var previousState = JSON.parse(window.localStorage.getItem('switchState'));
    if (previousState === null) {
        window.localStorage.setItem('switchState', false);
    }
    else if (previousState === true) {
        if (JSON.parse(window.localStorage.getItem('displayNotification')) === null) {
            window.localStorage.setItem('switchState', false);
            if (window.navigator.platform.toUpperCase().indexOf('WIN') >= 0) {
                window.localStorage.setItem('displayNotification', true);
                chrome.tabs.create({
                    url: 'c2c_options_menu.html'
                });
            }
        }
    }
};

/**
* Main function where all the action starts
*/
var main = function() {

    firstLaunchExperience();

    // Register listener to receive messages
    chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {

        if ( request.op === 'GET_SETTINGS_REQUEST' ) {
            var message = {};
            message.switchState = JSON.parse(window.localStorage.getItem('switchState'));
            if ( message.switchState === null ) {
                message.switchState = false;
            }

            if ( Configuration.configReady === '0' ) {
                message.switchState = false;
            }

            message.fingerPrint = Configuration.fingerPrint;
            message.metricsUrl = Configuration.metricsUrl;
            message.lookupHost = Configuration.lookupHost;
            message.pushToMobileUrl = Configuration.pushToMobileUrl;
            message.uiId = Configuration.uiId;

            sendResponse(message);
        }
        else if ( request.op === 'SET_SETTINGS_REQUEST' ) {
            // Save the settings
            window.localStorage.setItem('switchState', request.switchState);

            // Inform all tabs about change in settings
            request.fingerPrint = Configuration.fingerPrint;
            request.metricsUrl = Configuration.metricsUrl;
            request.uiId = Configuration.uiId;

            chrome.tabs.query({}, function(tabs) {
                for (var i = 0; i < tabs.length; ++i) {
                    chrome.tabs.sendMessage(tabs[i].id, request);
                }
            });
        }
        else if ( request.op === 'MENU_OPTION_CLICK') {
                var data = {
                    chosenFunction: request.option,
                    url: request.url.split('?')[0].split('#')[0]
                };
                postMetrics('extension_state', data);
        }
    });

    // Query configuration from PNR service
    queryConfig();
};

main();

c2c_options_handler_script.js

'use strict';

// This method adds appropriate event handlers for each of the UI elements in the options menu
// Options menu is written in html in c2c_options_menu.html
function addEventHandlers() {
    document.addEventListener('DOMContentLoaded', function () {
        localizer.loadLocalizedResources();
        var switchHighlightElement = document.getElementById('switchHighlight');
        var notification = document.getElementById('notification');
        if (JSON.parse(window.localStorage.getItem('switchState')) === false) {
            if (JSON.parse(window.localStorage.getItem('displayNotification')) === true) {
                document.getElementById('notification').classList.remove('noDisplay');
                window.localStorage.setItem('displayNotification', false);
            }
        }
        switchHighlightElement.addEventListener('click', function() { switchHighlightHandler(switchHighlightElement.checked); });
    });
}

// Handle the switch on/off highlight event from UI
// Send the message to background script to store the settings
function switchHighlightHandler(onOffState) {
    var message = {};
    message.op = 'SET_SETTINGS_REQUEST';
    message.switchState = onOffState;
    chrome.extension.sendMessage(message);
}

// Sets the highlighting on/off check box state
function setSwitchState(message) {
    if ( message.switchState === false ) {
        document.getElementById("switchHighlight").checked = false;
    }
    else {
        document.getElementById("switchHighlight").checked = true;
    }
}

function main() {

    // Add event handlers for UI elements
    addEventHandlers();

    // Update the settings displayed in the panel to match the stored settings
    chrome.extension.sendMessage({op: 'GET_SETTINGS_REQUEST'}, function(message) {
        setSwitchState(message);
    });
}

main();

c2c_options_menu.html

<!DOCTYPE html>
<html>
<head>
    <title>Skype</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="c2c_options_menu.css"/>
    <script src="c2c_options_menu_localization.js"></script>
    <script src="c2c_options_handler_script.js"></script>
</head>
<body>
    <header>
        <div id="notification" class="info noDisplay">
            <img src="info.png" alt="">
            <span class="message">Number highlighting has been turned off. To enable number highlighting, please check the &#39;<strong>Turn number highlighting on</strong>&#39; option below.</span>
        </div>
    </header>
    <div class="body">
        <div class="title">
            <div class="logo">
                <img src="skypelogo_128.png" alt="Skype">
            </div>
            <div class="info">
                <div class="heading">
                    <h1>Skype</h1>
                </div>
                <div class="company-branding">
                    <strong>By Microsoft Corporation</strong>
                </div>
            </div>
        </div>
        <div class="about">
            <div class="description">
                <p>
                    Install the Skype extension for fast access to 'Skype for Web' and 'Share on Skype'  through your browser.
                    <BR/>
                    We'll be adding more features and supporting other browsers in future releases.
                    <BR/><BR/>
                    <B>Share on Skype</B>
                    <BR/>
                    Read a good article? Now you can share the web page directly with your Skype contacts using the Skype extension. Click on 'Share on Skype' to get started.
                    <BR/><BR/>
                    <B>Launch Skype</B>
                    <BR/>
                    Access the full Skype functionality offered by the Skype web client. Click on 'Launch Skype' to get started.
                    <BR/><BR/>
                    Please note that audio and video calling on Skype web client is currently not supported on Chrome OS and Linux.
                </p>
            </div>
            <a href="https://go.skype.com/skype.extension.faq" target="_blank">Learn more</a> <span>about the Skype Extension</p>

            <hr>
            <div class="click-to-call">
                <p>Enhance this extension by installing <a href="https://go.skype.com/ctc.features" target="_blank">Skype Click to Call</a> on Windows</p>
                <label>
                    <input id="switchHighlight" type="checkbox" name="checkbox"  value="On"/>
                    <span id="switchHighlightLabel">Turn number highlighting on</span>
                </label>
                <br/><br/>
                <a href="https://support.skype.com/category/SKYPE_CALLS_FROM_BROWSERS/" target="_blank">Learn more</a> <span>about Skype Click to Call </p>
            </div>
        </div>
    </div>
    <footer></footer>
</body>
</html>

好吧,我完全忘记了微软开发的一款名为 Skype Click to Call 的应用程序,它与 Skype 网络扩展程序紧密配合。他们不再支持了,所以我无法在他们的网站上正式下载它,但在softpedia上找到了该软件。

数字ARE现在被突出显示,但它没有任何功能。它不会调用任何东西,它只是突出显示。似乎我无法添加指向 Skype 点击通话软件的链接。

该软件也不断被自己随机卸载。

【问题讨论】:

  • 另外一次,请edit 你的问题而不是deleting it 并再次询问。如果你做后者的次数足够多,你最终可能会被禁止提问(特别是如果问题的投票数为负数)。
  • edit 成为主题的问题:包括一个完整 minimal reproducible example 重复该问题。通常,包括一个manifest.json、一些后台内容脚本。寻求调试帮助的问题(“为什么这段代码不工作?”)必须包括:►期望的行为,►特定问题或错误►必要的最短代码重现它在问题本身。没有明确问题陈述的问题对其他读者没有用处。请参阅:“如何创建 minimal reproducible example”、What topics can I ask about here?How to Ask
  • manifest.json 是 Chrome 扩展程序中非常重要的一部分。它定义了所有内容如何组合在一起以及扩展允许执行的操作等。您在上一个问题中被问到这个问题。请在此处包含您的 manifest.json
  • @Makyen,对此感到抱歉。我将清单包含在原始帖子中。为了更清楚,Skype 网络扩展的最新版本是 8.5。 8.4+ 版本没有启用/禁用数字突出显示的选项。但是 8.3 和更低版本......确实如此。在新版本出来之前,我想出了一个解决方法来让它全部工作,但现在它不起作用了。所以我非常努力地让旧版本工作。
  • 顺便说一句,我的解决方法是奇怪:我从 chrome 商店安装了最新版本,然后我立即将其删除。我拖着安装了8.4版,然后就删了,最后拖着安装了8.3版。然后我进入选项并启用“打开突出显示号码”,网页上的每个电话号码都被突出显示,我可以点击使用 Skype 通话。这不再起作用了。

标签: javascript java google-chrome-extension skype skypedeveloper


【解决方案1】:

如果您将下面的代码添加到 background.js 的末尾,它将模拟用户在加载扩展程序几秒钟后从选项页面选择启用数字突出显示。

function turnOnNumberHighlighting(){
    let request = {
        op:'SET_SETTINGS_REQUEST',
        switchState: true
    };
    // Save the settings
    window.localStorage.setItem('switchState', request.switchState);
    // Inform all tabs about change in settings
    request.fingerPrint = Configuration.fingerPrint;
    request.metricsUrl = Configuration.metricsUrl;
    request.uiId = Configuration.uiId;

    chrome.tabs.query({}, function(tabs) {
        for (var i = 0; i < tabs.length; ++i) {
            chrome.tabs.sendMessage(tabs[i].id, request);
        }
    });
}
//Simulate the user making the change on the options page 5 seconds after done loading.
setTimeout(turnOnNumberHighlighting,5000);

【讨论】:

  • 我添加了一个示例,说明我如何中断代码以使其在 OP 中看起来像。这是正确的还是错误的?顺便说一句......谢谢你的所有帮助,认真的。我作为调度员使用卡车运输平台,点击通话让我的工作更有效率。
  • 不,上面的代码应该放在main();之后的background.js的末尾。撤消您所做的其他更改,使其恢复到发布代码时的状态,然后将此答案中的代码添加到文件末尾 main(); 之后
  • 好的,我将代码添加到我的原始帖子中,因为当我尝试编辑您的答案时,编辑被拒绝了。我确保撤消所有以前的更改。 @Makyen
  • 您仍然缺少一些original code
  • 啊,对不起。我修复了它,尝试了它,但遗憾的是它仍然无法正常工作:/。我将扩展作为解压扩展加载到 chrome 扩展中。进入我使用的平台,电话号码没有突出显示。
【解决方案2】:

我发现并解决了这个问题。最新版本的 Skype (7.28/29) 停止支持并完全删除 Skype Click-to-call,它在 Skype 安装时默认安装。

我将 Skype 降级到 7.16 版,禁用 Skype 更新,以及禁用/停止 Skype 点击通话更新程序和 Skype 更新程序的服务。

Skype Web 扩展 8.3 和 Skype 版本 7.16 可以完美运行。 (突出显示网页上的电话号码,并让用户通过 Skype 点击通话。)

【讨论】:

    猜你喜欢
    • 2014-04-15
    • 1970-01-01
    • 2011-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-24
    • 1970-01-01
    相关资源
    最近更新 更多