~ps-jenkins/unity-webapps-linkedin/latestsnapshot-2.4.16+13.10.20130924.2-0ubuntu1

« back to all changes in this revision

Viewing changes to LinkedIn.user.js

  • Committer: Maxim Ermilov
  • Date: 2013-06-07 15:33:16 UTC
  • Revision ID: maxim.ermilov@canonical.com-20130607153316-sq7y2tnltf1yxyg0
support new design

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
window.Unity = external.getUnityObject(1);
13
13
 
14
 
/**
15
 
 * User script self validation
16
 
 *
17
 
 * Called by the testing framework to make sure that
18
 
 * the page layout seems ok.
19
 
 */
20
 
function selfTest() {
21
 
    if (!getComposeNewMessageClickTargetNode()) {
22
 
        return;
23
 
    }
24
 
 
25
 
    // We are done
26
 
    reportTestState('PASS SELF TEST');
27
 
}
28
 
 
29
 
function getComposeNewMessageClickTargetNode() {
30
 
    return document.evaluate('//li[@id="nav-primary-inbox"]/ul/li[3]/a',
31
 
                             document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
32
 
};
33
 
 
34
14
function isCorrectPage() {
35
15
    var i, ids = ['header'];
36
16
 
60
40
 
61
41
    for (i = 0; i < snapshot.snapshotLength; i++) {
62
42
        var node = snapshot.snapshotItem(i);
63
 
        var text = node.getElementsByTagName('a')[0].getElementsByTagName('span')[0].textContent;
 
43
        var text = trim(node.getElementsByTagName('a')[0].textContent);
64
44
        var link = node.getElementsByTagName('a')[0].href;
65
45
 
66
46
        console.log(text);
84
64
    }
85
65
    var indicatorsController = new Indicators(checkMessagesCount);
86
66
 
87
 
    function composeNewMessage() {
88
 
        var node = getComposeNewMessageClickTargetNode();
89
 
        launchClickEvent(node);
90
 
    }
91
67
    Unity.Launcher.addAction(_("Compose New Message"),
92
 
                             wrapCallback(composeNewMessage));
 
68
                             makeRedirector("http://www.linkedin.com/msgToConns?displayCreate="));
93
69
 
94
70
    doMatrixIntegration();
95
71