-2

I used Skype Web solely for its click-to-call purpose. It highlighted phone numbers on web pages/platforms which you can click and instantly call via Skype. Sadly they stopped supporting this 'number highlighting' feature and it's a real hassle to do my job efficiently. Many trucking dispatchers have the same issue with this.

I used this website to find older versions of this extension.
Versions 8.4+ don't have the 'number highlighting' checkbox option, but versions 8.3 and lower do. I figured out a work-around that weirdly worked. (Installed the latest version of the extension, deleted it, then installed version 8.4, deleted it, and finally installed version 8.3. Version 8.3 showed the 'number highlighting option' and if you put a check mark in it, it displayed phone numbers. Going straight from latest to version 8.3 had chrome downgrading errors/issues.)

I'm currently editing version 8.3, but I haven't had much luck. The main files that were requested were these:

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>

Okay so I completely forgot that there was an application made by Microsoft called Skype Click to Call which works closely with the skype web extension. They don't support it anymore so I couldn't download it of their website officially, but found the software off of softpedia.

Numbers ARE being highlighted now, but there is no function to it. It won't call anything, it just highlights. Doesn't seem like I can add a link to the Skype click to call software.

The software also keeps getting uninstalled randomly all by itself.

sinoraj
  • 33
  • 6
  • Another time, please [edit] your question rather than [deleting it](http://webcache.googleusercontent.com/search?q=cache:stackoverflow.com/questions/40246588/skype-web-extension-editing-help-need-this-extension-to-highlight-numbers-for) and asking again. If you do the latter enough times you can end up being banned from asking questions (particularly if the questions have a negative vote count). – Makyen Oct 26 '16 at 00:43
  • Please [edit] the question to be on-topic: include a **complete** [mcve] that duplicates the problem. Usually, including a *manifest.json*, some of the background *and* content scripts. Questions seeking debugging help ("**why isn't this code working?**") must include: ►the desired behavior, ►a specific problem or error *and* ►the shortest code necessary to reproduce it **in the question itself**. Questions without a clear problem statement are not useful to other readers. See: "**How to create a [mcve]**", [What topics can I ask about here?](http://stackoverflow.com/help/on-topic), and [ask]. – Makyen Oct 26 '16 at 00:44
  • A *manifest.json* is a very important part of a Chrome extension. It defines how everything goes together and what is permitted for the extension to do, etc. You were asked for this on your last question. Please include your *manifest.json* here. – Makyen Oct 26 '16 at 00:46
  • @Makyen, sorry about that. I included the manifest to the original post. To make it more clear, the newest version of skype web extension is 8.5. Versions 8.4+ don't have the option to enable/disable the highlighting of numbers. BUT 8.3 and lower... does. Before the new version came out I figured out a work-around to make it all work, but now it just doesn't work. So I'm pretty much trying to make the older versions work. – sinoraj Oct 26 '16 at 00:51
  • By the way my work-around was **weirdly** this: I installed the newest version from the chrome store which I then deleted right after. I dragged and installed version 8.4, deleted it right after, and finally dragged and installed version 8.3. I then went into options and enabled "Turn highlighting numbers on" and every phone number on web pages became highlighted and I could click to call with skype. This doesn't work anymore. – sinoraj Oct 26 '16 at 00:55
  • What is the file name for what you have labeled as "options handler script"? – Makyen Oct 26 '16 at 00:58
  • c2c_options_handler_script.js – sinoraj Oct 26 '16 at 01:01
  • Please include *c2c_options_menu.html*. – Makyen Oct 26 '16 at 01:03
  • @Makyen Added to the original post. – sinoraj Oct 26 '16 at 01:06
  • At a *guess*, you could probably add `window.localStorage.setItem('switchState', true);` either after, maybe before, `firstLaunchExperience();` within the `main` function in *background.js*. We may need to see how `queryConfig()` is defined. – Makyen Oct 26 '16 at 01:09
  • @Makyen Okay. I tried it both before and after, and it didn't seem like it worked. How do I figure out how queryconfig is defined? By the way, the "Turn number highlighting on" doesn't seem save. Every time I refresh that page the check mark disappears. – sinoraj Oct 26 '16 at 01:19
  • @Makyen I added the upper portion of background.js that's above the one I posted previously. I forgot I didn't add it because there were too many lines. Sorry :/ – sinoraj Oct 26 '16 at 01:26
  • Please edit your original question instead of adding comments, so that everything is in one place. Make it easy for others to help you. – Robert Oct 26 '16 at 03:35
  • @Robert Re-did everything. Hopefully this will be more clear. – sinoraj Oct 26 '16 at 03:53
  • @Makyen I added more info to the OP. With that "simulate" code it now highlights the code with the software I downloaded. The 'check' mark gets saved, but there is no function when I click on a number. Doesn't call. (Without the code you provided it doesn't highlight anything.) – sinoraj Oct 26 '16 at 15:02
  • Smh, why is this getting negative votes. I completely re-did my question for it to be more clear. I'm trying to be as clear as I can about my issue. – sinoraj Oct 27 '16 at 03:15

2 Answers2

0

If you add the code below to the end of background.js it will simulate the user selecting to enable number highlighting from the options page a few seconds after the extension is loaded.

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);
Makyen
  • 31,849
  • 12
  • 86
  • 121
  • I added an example of how I'm interrupting the code to look like in the OP. Is that correct or no? By the way... thank you for all your help, seriously. I work with trucking platforms as a dispatcher and click to call made my job much MUCH more efficient. – sinoraj Oct 26 '16 at 02:47
  • No, the above code should go at the end of *background.js* following `main();`. Undo the other changes you made such that it is back to the way that it was when you posted the code, then add the code in this answer to the end of the file, after `main();` – Makyen Oct 26 '16 at 02:59
  • Okay I added the code to my original post because the edits were rejected when I tried editing your answer. I made sure to undo all my previous changes. @Makyen – sinoraj Oct 26 '16 at 03:12
  • You were still missing some of the [original code](http://stackoverflow.com/posts/40251651/revisions). – Makyen Oct 26 '16 at 03:25
  • Ah, sorry about that. I fixed it, tried it, and it sadly still doesn't work :/. I'm loading the extension as an unpacked extension into chrome extensions. Going on the platform I use, and the phone numbers don't get highlighted. – sinoraj Oct 26 '16 at 03:31
  • Ok. Just to check something: Does the extension, without modification, do what you want (i.e. highlight phone numbers) when you change that option normally/manually on the extension's option page? – Makyen Oct 26 '16 at 03:43
  • It does not. It used to highlight numbers(back when the latest version was 8.4, and I was trying to figure out how to make it all work) but there was no function to it. It simply wouldn't call. With the latest version being 8.5, older versions don't even highlight the numbers anymore. I even tried older chrome versions. Nothing. Not sure what's going on. I edited my OP to make everything more clear of what is happening. – sinoraj Oct 26 '16 at 03:56
  • I believe once you put a check mark in the box to enable the number highlighting function it doesn't get saved. Once you refresh the page, you have to put a check mark in the box again. It never used to do that. It used to save and once you enabled it, you didn't have to enable it again. The whole function just seems unresponsive completely. @Makyen – sinoraj Oct 26 '16 at 04:05
  • OK. You can get the unmodified code to highlight, sometimes. Is the following *exactly* what happens (with unmodified code)?: You refresh a page. No number highlighting (regardless of the prior state of highlighting). You go to options, click checkbox to enable highlighting. You see highlighting until you refresh the page. Once the page refreshes, the highlighting is gone. – Makyen Oct 26 '16 at 04:14
  • The unmodified code will not highlight no matter how many times I refresh/restart the browser/etc. I've used version 8.3 (The code we're currently editing) before and it used to highlight phone numbers. I seriously don't know how to explain it... it's just bizarre to me why it suddenly doesn't even highlight anything. I provided the website of the older versions of this extension. You can try it yourself and see how everything works. You might have to download the latest one from the store, delete it, and drag and drop version 8.3. (Chrome downgrade issues) – sinoraj Oct 26 '16 at 04:33
0

I figured out and fixed the issue. The latest version of Skype (7.28/29) stopped supporting and completely removed Skype Click-to-call which gets installed by default on Skype installation.

I downgraded Skype to version 7.16, disabled Skype updates, as well as disabled/stopped the services for Skype click-to-call updater and Skype Updater.

Skype Web extension 8.3 and Skype version 7.16 is working flawlessly. (Highlights phone numbers on web pages and lets the user click-to-call via skype.)

sinoraj
  • 33
  • 6