hey guys,
I'm new to the whole chrome extension development. I'm trying to create the same extension featured in this youtube video:
http://www.youtube.com/watch?v=e3McMaHvlBY
I've copied the code the guy has provided exactly as how it's shown in the video but my extension is not working (only shows the "My Twit" phrase on the page). Can someone take a look at the html file and tell me what I'm doing wrong? I've used a javascript syntax checker and had no problems.
thanks
manifest.json:
popup.html:Code:{ "name": "My Twit", "version": "1.0", "description": "A Twitter button for your toolbar", "icons": {"128": "icon.png"}, "browser_action": { "default_icon": "browseraction.png", "default_title": "My Twit", "popup": "popup.html" }, "permissions": [ "http://twitter.com/*", "tabs" ] }
Code:<script> function update() { for (var i in tweets) { user = tweets[i].user; url = 'http://twitter.com/' + user.screen_name; //thumbnail link.title = user.name; link.href = openInNewTab(url); image.src = user.profile_image_url; image.alt = user.name; //text author.href = openInNewTab(url); author.innerHTML = user.name; content.innerHTML = linkify(tweets[i].text); //copy node and update item = template.cloneNode(true); timeline.appendChild(item); } } //process new batch of tweets function processTweets() { var res = JSON.parse(req.responseText); tweets = res.concat(tweets); update(); } //fetch timeline from server function getTweets() { document.write("hey guys!"); req = new XMLHttpRequest(); req.open('GET', 'http://twitter.com/statuses/public_timeline.json'); req.onload = processTweets; req.send(); } function init() { timeline = document.getElementbyId('timeline'); document.write("hey guys"); template = xpath('//ol[@id="template"]/li', document); link = xpath('//div[@class="thumbnail"]/a', template); image = xpath('img', link); author = xpath('//div[@class="text"]/a', template); content = xpath('//div[@class="text"]/span', template); getTweets(); } onload = setTimeout(init(), 0); </script> <body> <div id="body"> <div id="title"> <h2>My Twit</h2> </div> <ol id="timeline" /> </div> <ol id="template"> <li> <div class="thumbnail"> <a> <img /> </a> </div> <div class="text"> <a></a> <span></span> </div> <div class="clear"></div> </li> </ol> </body>


LinkBack URL
About LinkBacks



Reply With Quote