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

Any Skype experts out there?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


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

      Comment


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

        Comment


          #24
          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" />

          Comment


            #25
            Meh, not bad for a beginner

            Comment


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

              Comment

              Working...
              X