Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look up any user <Feature Request> #41

Open
BenTheHokie opened this issue Nov 3, 2012 · 0 comments
Open

Look up any user <Feature Request> #41

BenTheHokie opened this issue Nov 3, 2012 · 0 comments

Comments

@BenTheHokie
Copy link

The ability to pull up any user's profile by simply typing their name in. I have some javascript code that you might be able to use to incorporate into your extension.

Get the "room":

for (var a in turntable) {
    var b = turntable[a];
    if (typeof b !== "object" || b === null) {
        continue
    }
    if (typeof b.setupRoom !== "undefined") {
        room = b;
    }
}

Get the room manager:

for (var a in room) {
    var b = room[a];
    if (typeof b !== "object" || b === null) {
        continue
    }
    if (typeof b.blackswan !== "undefined") {
        var manager = b;
    }
}

Get the websocket for the API. You may be able to use your TTPAPI for this part:

var a = / Preparing message /i;
for (var b in turntable) {
    var c = turntable[b];
    if (typeof c !== "function") {
        continue
    }
    c.toString = Function.prototype.toString;
    if (a.test(c.toString())) {
        ttApi = c;
    }
}

Pull up the profile:

javascript: var userName = prompt('User to search for:');
if (userName != null) {
    ttApi({
        api: 'user.get_id',
        name: userName
    }, function (m) {
        if (m.err) {
            turntable.showAlert('Error: ' + m.err);
        } else {
            manager.callback('profile', m.userid);
        }
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant