diff --git a/nodes/social/27-twitter.html b/nodes/social/27-twitter.html index 08e80786b..98dcd23f8 100644 --- a/nodes/social/27-twitter.html +++ b/nodes/social/27-twitter.html @@ -29,8 +29,8 @@ pathname += "/"; } var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter/"+twitterConfigNodeId+"/auth/callback"); - - $("#node-config-twitter-row").html('Click here to authenticate with Twitter.'); + + $("#node-config-twitter-row").html('Click here to authenticate with Twitter.'); $("#node-config-twitter-start").click(function() { twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000); }); @@ -103,33 +103,36 @@ @@ -140,7 +143,7 @@ defaults: { twitter: {type:"twitter-credentials",required:true}, tags: {value:"",required:true}, - user: {value:false}, + operation: {value:"words",required:true}, name: {value:""}, topic: {value:"tweets"} }, diff --git a/nodes/social/27-twitter.js b/nodes/social/27-twitter.js index 923fec859..ef9b05787 100644 --- a/nodes/social/27-twitter.js +++ b/nodes/social/27-twitter.js @@ -24,11 +24,10 @@ function TwitterNode(n) { } RED.nodes.registerType("twitter-credentials",TwitterNode); - function TwitterInNode(n) { RED.nodes.createNode(this,n); this.active = true; - this.user = n.user; + this.oper = n.operation; this.tags = n.tags.replace(/ /g,''); this.twitter = n.twitter; this.topic = n.topic; @@ -47,11 +46,13 @@ function TwitterInNode(n) { if (this.tags !== "") { try { var thing = 'statuses/filter'; - if (this.user) { thing = 'user'; } + if (this.oper === "user") { thing = 'user'; } + if (this.oper === "site") { thing = 'site'; } function setupStream() { if (node.active) { twit.stream(thing, { track: [node.tags] }, function(stream) { //twit.stream('user', { track: [node.tags] }, function(stream) { + //twit.stream('site', { track: [node.tags] }, function(stream) { //twit.stream('statuses/filter', { track: [node.tags] }, function(stream) { node.stream = stream; stream.on('data', function(tweet) { @@ -101,8 +102,6 @@ TwitterInNode.prototype.close = function() { } } - - function TwitterOutNode(n) { RED.nodes.createNode(this,n); this.topic = n.topic;