Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Twitter feed
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
London iPhone Dev  
View profile  
 More options Nov 3, 9:26 pm
From: London iPhone Dev <he...@urbanviolet.co.uk>
Date: Tue, 3 Nov 2009 02:26:06 -0800 (PST)
Local: Tues, Nov 3 2009 9:26 pm
Subject: Twitter feed
I want to implement twitter on a website, so I can sign in with a
custom user name and password to receive my own tweets.

I found some code on the Appcelerator community, but I have no idea
how to use javascript,

Could anyone help me please?

<html>
        <head>
                <title>Twitter Demo</title>
                <style>
                .section
                {
                        border:1px solid #ccc;
                        -webkit-border-top-right-radius: 5px;
                        -webkit-border-top-left-radius: 5px;
                        -webkit-border-bottom-right-radius: 5px;
                        -webkit-border-bottom-left-radius: 5px;
                        padding:10px;
                        color:#777;
                        margin:10px;
                }
                </style>
        </head>
        <body  style="font-family:'Helvetica Neue'">
                <div class="section" style="height:50px;text-align:center">
                                <img src="twitter.png"></img>
                </div>
                <div style="height:150px;padding-top:30px;" class="section">
                        <div style="height:50px;float:left;margin-right:10px">
                                Username:
                        </div>
                        <div style="float:left">
                                <div id="textfield1" style="height:50px;width:170px"></div>
                        </div>
                        <div style="clear:both;margin;top:10px"></div>
                        <div style="height:50px;float:left;margin-right:10px">
                                Password:
                        </div>
                        <div style="float:left">
                                <div id="textfield2" style="height:50px;width:170px"></div>
                        </div>
                        <div style="clear:both;margin;top:10px"></div>
                        <div style="margin-left:80px;">
                                <div id="button"></div>
                        </div>
                </div>
                <div class="section" style="height:40px;text-align:center">
                        This is a demo that logs you in to twitter and displays your
messages.
                </div>

                <script>
                var height = (Titanium.Platform.name.indexOf('iPhone') != -1) ? 30:
40;
                var tf1 = Titanium.UI.createTextField({
                        id:'textfield1',
                        value:'',
                        keyboardType:Titanium.UI.KEYBOARD_EMAIL,
                        hintText:'enter username',
                        width:170,
                        height:height,
                        clearOnEdit:true,
                        borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
                        clearButtonMode:Titanium.UI.INPUT_BUTTONMODE_ALWAYS,
                });
                var tf2 = Titanium.UI.createTextField({
                        id:'textfield2',
                        value:'',
                        keyboardType:Titanium.UI.KEYBOARD_ASCII,
                        hintText:'enter password',
                        width:170,
                        height:height,
                        clearOnEdit:true,
                        passwordMask:true,
                        borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
                        clearButtonMode:Titanium.UI.INPUT_BUTTONMODE_ALWAYS,
                });
                var button = Titanium.UI.createButton({
                        id:'button',
                        title:'Login',
                        color:'#336699',
                        height:32,
                        width:100,
                        fontSize:12,
                        fontWeight:'bold'
                });
                button.addEventListener('click',function()
                {
                        // hide the keyboards if they're showing
                        tf1.blur();
                        tf2.blur();

                        var un = tf1.value;
                        var pw = tf2.value;
                        var activityIndicator = Titanium.UI.createActivityIndicator();
                        Titanium.UI.currentWindow.setRightNavButton(activityIndicator);
                        var url = "http://"+un+":"+pw+"@twitter.com/statuses/
friends_timeline.json?count=50";
                        var xhr = Titanium.Network.createHTTPClient();
                        xhr.onload = function()
                        {
                                var json = eval('('+this.responseText+')');
                                var data = [];
                                for (var c=0;c<json.length;c++)
                                {
                                        var row = json[c];
                                        var bgcolor = (c % 2) == 0 ? '' : 'background-color:#eee';
                                        var html = "<div style='position:relative;padding:0;height:
80px;"+bgcolor+"'>";
                                        html += "<div style='position:absolute;left:0;top:5px;border:2px
solid #999;'><img src='"+row.user.profile_image_url+"'/></div>";
                                        html+='<div style="position:absolute;top:6px;left:60px;height:
70px;font-size:11px;">'+row.text+'</div>';
                                        html+="</div>";

                                        data[c] = {html:html};
                                }
                                var tableView = Titanium.UI.createTableView({data:data,rowHeight:
80},function(){});
                                Titanium.UI.currentWindow.addView(tableView);
                                Titanium.UI.currentWindow.showView(tableView);

                                var close = Titanium.UI.createButton({title:'Logout'});
                                Titanium.UI.currentWindow.setRightNavButton(close);
                                close.addEventListener('click',function()
                                {
                                        Titanium.UI.currentWindow.close();
                                });
                        };
                        xhr.open("GET",url);
                        xhr.send();
                });

                </script>
        </body>
</html>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google