-
-
Save Homestar/29732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "xbl", | |
icon: "http://www.xbox.com/xweb/lib/images/xbox/favicon.ico", | |
homepage: "http://insideoutsites.com/ubiquity", | |
author: {name: "Brett Aaron", homepage:"http://insideoutsites.com/"}, | |
license: "GPL", | |
preview: function(pblock) { | |
var styleSheet = "<link href=\"http://insideoutsites.com/ubiquity/xbl/style.css\" rel=\"stylesheet\" type=\"text/css\" />"; | |
pblock.innerHTML = styleSheet + "<table><tr><td><tbody><img src=\"http://insideoutsites.com/ubiquity/xbl/loading.gif\" /><br /><br /><div style=\"font-size:0.6em;\"> LOADING YOUR XBL FRIENDS LIST...</div><br /></tbody></td></tr></table>"; | |
var liveIDLoginURL = "http://login.live.com/login.srf?wa=wsignin1.0&rpsnv=10&ct=1227782465&rver=4.5.2135.0&wp=MBI&wreply=https://live.xbox.com/xweb/live/passport/setCookies.ashx?rru=httpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DUSZ2FdefaultZ2Ehtm&lc=1033&cb=B001033httpZ3AZ2FZ2FwwwZ2ExboxZ2EcomZ2FenZ2DUSZ2FdefaultZ2Ehtm&id=66262"; | |
jQuery.ajax({ | |
url: "http://live.xbox.com/en-US/profile/Friends.aspx", | |
cache: false, | |
error: function() { | |
displayMessage("Error loading XBL Friends List."); | |
}, | |
success: function(html) { | |
var divFLWhole = ""; | |
var divFLStart = 0; | |
var divFLEnd = 0; | |
var temp = ""; | |
var imageFix = "<img src=\"http://live.xbox.com/xweb"; | |
divFLStart = html.indexOf("<div class=\"XbcProfileTableContainer\">"); | |
if (divFLStart<0) { | |
//not logged in to a Windows Live ID | |
pblock.innerHTML = styleSheet + "<table><tr><td><tbody>Please visit the <a href=\"" + liveIDLoginURL + "\">Windows Live ID login page</a> and sign-in to use this command.<br /><br />Remember to choose \"Save my e-mail address and password\". Also, it might be necessary to click the \"Sign In\" link on the page shown after logging in.<br /><br /><img src=\"http://insideoutsites.com/ubiquity/images/signin.png\" /><br /><br /></tbody></td></tr></table>"; | |
displayMessage("You must be logged into your Windows Live ID to use this Ubiquity command."); | |
} else { | |
//show friends list | |
divFLEnd = html.indexOf("</div>",divFLStart)+5; | |
divFLWhole = (html.substring(divFLStart,divFLEnd)).replace(/<img src=\"\/xweb/g, imageFix); | |
pblock.innerHTML = styleSheet + "<div style=\"height:400px;overflow:auto;\">" + divFLWhole + "</div>"; | |
displayMessage("Successfully loaded XBL Friends List."); | |
} | |
} | |
}); | |
}, | |
execute: function() { | |
return 0; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment