• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Any Skype experts out there?"

Collapse

  • Gentile
    replied
    Originally posted by Platypus View Post
    Meh, not bad for a beginner


    The version above basically works, but the final version's got some additional tweaks (e.g., when I was testing across multiple browsers last night, I found the version above doesn't work well for IE). I'll maybe write a blog about it and stick the code on codeplex when I'm done, rather than keep bumping this thread.

    Leave a comment:


  • Platypus
    replied
    Meh, not bad for a beginner

    Leave a comment:


  • Gentile
    replied
    This is the tidied script. It contains some dreadful hacks, but at least it works in the context required:

    Code:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
            //Customise these settings to suit:
    
            var skypeName = 'yourSkypeName';
    
            var unavailableImg = 'someURL';
            var onlineImg = 'someURL';
            var donotDisturbImg = 'someURL';
            var imAwayImg = 'someURL';
    
            // End of custom settings
    
            jQuery.ajax = (function (_ajax) {
    
                var protocol = location.protocol, hostname = location.hostname, exRegex = RegExp(protocol + '//' + hostname), YQL = 'http' + (/^https/.test(protocol) ? 's' : '') + '://query.yahooapis.com/v1/public/yql?callback=?', query = 'select * from html where url="{URL}" and xpath="*"';
    
                function isExternal(url) {
                    return !exRegex.test(url) && /:\/\//.test(url);
                }
    
                return function (o) {
    
                    var url = o.url;
    
                    if (/get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url)) {
    
                        // Manipulate options so that JSONP-x request is made to YQL
    
                        o.url = YQL;
                        o.dataType = 'json';
    
                        o.data = {
                            q: query.replace('{URL}', url + (o.data ? (/\?/.test(url) ? '&' : '?') + jQuery.param(o.data) : '')),
                            format: 'xml'
                        };
    
                        // Since it's a JSONP request
                        // complete === success
                        if (!o.success && o.complete) {
                            o.success = o.complete;
                            delete o.complete;
                        }
    
                        o.success = (function (_success) {
                            return function (data) {
    
                                if (_success) {
                                    // Fake XHR callback.
                                    _success.call(this, {
                                        responseText: (data.results[0] || '')
                                        // YQL screws with <script>s
                                        // Get rid of them
    							.replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
                                    }, 'success');
                                }
    
                            };
                        })(o.success);
                    }
                    return _ajax.apply(this, arguments);
                };
    
            })(jQuery.ajax);
    
            var skypeStatusURL = 'http://mystatus.skype.com/' + skypeName + '.txt';
    
            $(document).ready(function () {
    
                jQuery.get(skypeStatusURL, function (data) {
    
                    var match, result = "", regex = /<p>(.*?)<\/p>/ig;
                    while (match = regex.exec(data.responseText)) {
                        result += match[1];
                    }
    
                    var imgURL = unavailableImg
                    var unavailableAction = 'alert("Sorry, I\'m unavailable")';
                    var callAction = 'window.open (\'skype:' + skypeName + '?call\',\'_self\',false)';
                    var buttonOnClick = unavailableAction;
    
                    //Add whatever custom actions you need against each 'case', e.g. absolute positioning of the button
                    switch (result) {
                        case 'Online':
                            imgURL = onlineImg;
                            buttonOnClick = callAction;
                            break;
                        case 'Away':
                            imgURL = imAwayImg;
                            buttonOnClick = callAction;
                            break;
                        case 'Do Not Disturb':
                            imgURL = donotDisturbImg;
                            buttonOnClick = unavailableAction;
                            break;
                        case 'Offline':
                            imgURL = unavailableImg;
                            buttonOnClick = unavailableAction;
                            break;
                    }
                    $("#skypeButtonImage").attr("src", imgURL);
                    $("#skypeButtonImage").attr("onclick", buttonOnClick);
                });
            }); 
    
        </script>
    
        <img id="skypeButtonImage" src="" style="border: none; cursor:pointer;" width="210" height="32" alt="My status" />

    Leave a comment:


  • Gentile
    replied
    Originally posted by Platypus View Post
    Well I still think most of this can all be done iff you have some remote hosting. But it would be a fag. Changing the image of you to the same shot but with an empty chair is a neat idea and can easily be done, for sure. I have some time to kill tomorrow, I might play

    EDIT: you can get the status with this:

    Try it.
    Yes, I know you can do that if you type the URL in by hand. But, as mentioned, you can't access that exact same URL programmatically from clientside script. That's what I was attempting to do in the scripts posted earlier:

    Code:
            jQuery.get('http://mystatus.skype.com/mySkypeName.txt', function (data) {
                alert(data);
            });
    Anyway, at least I've got a workaround in place now using those hacky hacks I mentioned.

    Leave a comment:


  • Platypus
    replied
    Originally posted by Gentile View Post
    changing the photograph to a context-specific image, and changing the actual function of the button contextually. I also had ideas that the button itself could be absolutely placed, depending on the context; e.g., the speech bubble appearing to come from out of frame when the "I'm Away" status is in effect, etc.

    I felt it'd be more appropriate if it just popped up a message saying "Sorry, not available right now" when the status indicates that would be the appropriate course of action.
    Well I still think most of this can all be done iff you have some remote hosting. But it would be a fag. Changing the image of you to the same shot but with an empty chair is a neat idea and can easily be done, for sure. I have some time to kill tomorrow, I might play

    EDIT: you can get the status with this:
    http://mystatus.skype.com/rachel%2Ep.pierson.txt

    Try it.

    Leave a comment:


  • Gentile
    replied
    Originally posted by mudskipper View Post
    Ah, OK. Yep, you'll need the status for that stuff. Good luck with the JSON solution - will look out for the final result.
    Ta. I know it's just me being too bloody fussy and trying to squeeze more in than you get out of the box with Skype.

    Thanks again for your input.

    Leave a comment:


  • mudskipper
    replied
    Originally posted by Gentile View Post
    That's what I'm getting at: unless the clientside script has access to the actual status, there's some stuff that it simply can't know how to do.

    It's not just installing Skype, there's the other stuff mentioned in the OP too: such as changing the photograph to a context-specific image, and changing the actual function of the button contextually. I also had ideas that the button itself could be absolutely placed, depending on the context; e.g., the speech bubble appearing to come from out of frame when the "I'm Away" status is in effect, etc.

    Finally, even the existing Skype script isn't too clever when it comes to simple stuff like showing a message box when you're on "Do Not Disturb". It does actually allow visitors to attempt to initiate a Skype call, even if by virtue of your status that action is destined to fail. I felt it'd be more appropriate if it just popped up a message saying "Sorry, not available right now" when the status indicates that would be the appropriate course of action.
    Ah, OK. Yep, you'll need the status for that stuff. Good luck with the JSON solution - will look out for the final result.

    Leave a comment:


  • mudskipper
    replied
    Originally posted by Platypus View Post
    Yeah, the bit of PHP I posted does that. It check's your skype status and posts the correct image.

    EDIT, ok, see what you mean, the button doesn't just change the image depending on your status, it does other stuff too, is what you're saying. But I think it's the js above the button that offers to install skype etc for you. With IMG= it can only be an image that gets served. The "action" part, the skype:call part is the same regardless of your status.
    +1

    Leave a comment:


  • Gentile
    replied
    Originally posted by Platypus View Post
    Yeah, the bit of PHP I posted does that. It check's your skype status and posts the correct image.

    EDIT, ok, see what you mean, the button doesn't just change the image depending on your status, it does other stuff too, is what you're saying. But I think it's the js above the button that offers to install skype etc for you. With IMG= it can only be an image that gets served. The "action" part, the skype:call part is the same regardless of your status.
    That's what I'm getting at: unless the clientside script has access to the actual status, there's some stuff that it simply can't know how to do.

    It's not just installing Skype, there's the other stuff mentioned in the OP too: such as changing the photograph to a context-specific image, and changing the actual function of the button contextually. I also had ideas that the button itself could be absolutely placed, depending on the context; e.g., the speech bubble appearing to come from out of frame when the "I'm Away" status is in effect, etc.

    Finally, even the existing Skype script isn't too clever when it comes to simple stuff like showing a message box when you're on "Do Not Disturb". It does actually allow visitors to attempt to initiate a Skype call, even if by virtue of your status that action is destined to fail. I felt it'd be more appropriate if it just popped up a message saying "Sorry, not available right now" when the status indicates that would be the appropriate course of action.

    Leave a comment:


  • Platypus
    replied
    Originally posted by Gentile View Post
    It's explained in some detail here. Changing the image associated with the button isn't enough: you also need to be able to contextually-control what the button actually does.
    Yeah, the bit of PHP I posted does that. It check's your skype status and posts the correct image.

    EDIT, ok, see what you mean, the button doesn't just change the image depending on your status, it does other stuff too, is what you're saying. But I think it's the js above the button that offers to install skype etc for you. With IMG= it can only be an image that gets served. The "action" part, the skype:call part is the same regardless of your status.
    Last edited by Platypus; 24 August 2012, 19:41.

    Leave a comment:


  • Gentile
    replied
    Originally posted by mudskipper View Post
    Sorry Gentile - maybe I'm missing the point, but...


    The button code is:

    Code:
    <script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
    <a href="skype:mudskipper?call"><img src="http://mystatus.skype.com/bigclassic/mudskipper" style="border: none;" width="182" height="44" alt="My status" /></a>
    Surely all you need to do is replace the image with an image from a server that you control and job's a good un? What else do you need to do?
    It's explained in some detail here. Changing the image associated with the button isn't enough: you also need to be able to contextually-control what the button actually does.

    Leave a comment:


  • Platypus
    replied
    Originally posted by mudskipper View Post
    OK - I've read the whole thread properly now....

    What is it you need to do that can't be done by serving a different image?
    ya know, upon re-re-reading, I agree.

    The 'client side' issue is solved because the image is fetched by the blog HTML which you must have some control over because you added the
    Skype Status thing already. You make a small change to that HTML to fetch an image from elsewhere. Otherwise, all the guff that checks for Skype being installed is still there (that's the Skype js piece just before the anchor tag, n'est pas?)

    It's the 'elsewhere' that checks the Skype status and returns the correct image. No issue with cross-domain what-not.

    If you have no 'elsewhere' (which would be surprising for a dev like you not to have some hosting somewhere) then fair enough, you're stuck.

    Leave a comment:


  • mudskipper
    replied
    Originally posted by mudskipper View Post
    Sorry Gentile - maybe I'm missing the point, but...


    The button code is:

    Code:
    <script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
    <a href="skype:mudskipper?call"><img src="http://mystatus.skype.com/bigclassic/mudskipper" style="border: none;" width="182" height="44" alt="My status" /></a>
    Surely all you need to do is replace the image with an image from a server that you control and job's a good un? What else do you need to do?
    OK - I've read the whole thread properly now....

    What is it you need to do that can't be done by serving a different image?

    Leave a comment:


  • mudskipper
    replied
    Sorry Gentile - maybe I'm missing the point, but...


    The button code is:

    Code:
    <script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
    <a href="skype:mudskipper?call"><img src="http://mystatus.skype.com/bigclassic/mudskipper" style="border: none;" width="182" height="44" alt="My status" /></a>
    Surely all you need to do is replace the image with an image from a server that you control and job's a good un? What else do you need to do?

    Leave a comment:


  • Platypus
    replied
    Originally posted by mudskipper View Post
    Great minds and all that...
    Quite so

    Leave a comment:

Working...
X