mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tweak Twitter Properties UI to improve flow
This commit is contained in:
parent
362bc9a805
commit
f6da96e7e1
@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter/"+twitterConfigNodeId+"/auth/callback");
|
var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter/"+twitterConfigNodeId+"/auth/callback");
|
||||||
|
|
||||||
$("#node-config-twitter-row").html('Click <a id="node-config-twitter-start" href="/twitter/'+twitterConfigNodeId+'/auth?callback='+callback+'" target="_blank">here</a> to authenticate with Twitter.');
|
$("#node-config-twitter-row").html('Click <a id="node-config-twitter-start" href="/twitter/'+twitterConfigNodeId+'/auth?callback='+callback+'" target="_blank"><b>here</b></a> to authenticate with Twitter.');
|
||||||
$("#node-config-twitter-start").click(function() {
|
$("#node-config-twitter-start").click(function() {
|
||||||
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
|
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
|
||||||
});
|
});
|
||||||
@ -103,33 +103,36 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-template-name="twitter in">
|
<script type="text/x-red" data-template-name="twitter in">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-twitter"><i class="icon-user"></i> Twitter</label>
|
<label for="node-input-twitter"><i class="icon-user"></i> User</label>
|
||||||
<input type="text" id="node-input-twitter">
|
<input type="text" id="node-input-twitter">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-tags"><i class="icon-tag"></i> Tags</label>
|
<label for="node-input-operation"><i class="icon-search"></i> Search</label>
|
||||||
<input type="text" id="node-input-tags" placeholder="comma-separated tags">
|
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
|
||||||
|
<option value="words">Tweets</option>
|
||||||
|
<option value="user">Users</option>
|
||||||
|
<!--<option value="site">Site</option> -->
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label> </label>
|
<label for="node-input-tags"><i class="icon-tags"></i> For</label>
|
||||||
<input type="checkbox" id="node-input-user" placeholder="Name" style="display: inline-block; width: auto; vertical-align: top;">
|
<input type="text" id="node-input-tags" placeholder="comma-separated words, @ids, #tags">
|
||||||
<label for="node-input-user" style="width: 70%;">Tick to use user stream<br/>(rather than status/filter)</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<!-- <div class="form-row">
|
||||||
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
|
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
|
||||||
<input type="text" id="node-input-topic" placeholder="Topic">
|
<input type="text" id="node-input-topic" placeholder="Topic">
|
||||||
</div>
|
</div> -->
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">Tip: the Senders name gets appended to the topic heirarchy
|
<div class="form-tips">Tip: Use commas without spaces between multiple search terms. Comma = OR, Space = AND.</div>
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="twitter in">
|
<script type="text/x-red" data-help-name="twitter in">
|
||||||
<p>Twitter input node. Watches the public stream for tweets containing the configured search term.</p>
|
<p>Twitter input node. Watches the public stream for tweets containing the configured search term.</p>
|
||||||
<p>Sets the <b>msg.topic</b> to the configured topic and then appends the senders screen name.</p>
|
<p>Sets the <b>msg.topic</b> to <i>tweets/</i> and then appends the senders screen name.</p>
|
||||||
<p>Sets <b>msg.location</b> to the tweeters location if known.</p>
|
<p>Sets <b>msg.location</b> to the tweeters location if known.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -140,7 +143,7 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
twitter: {type:"twitter-credentials",required:true},
|
twitter: {type:"twitter-credentials",required:true},
|
||||||
tags: {value:"",required:true},
|
tags: {value:"",required:true},
|
||||||
user: {value:false},
|
operation: {value:"words",required:true},
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
topic: {value:"tweets"}
|
topic: {value:"tweets"}
|
||||||
},
|
},
|
||||||
|
@ -24,11 +24,10 @@ function TwitterNode(n) {
|
|||||||
}
|
}
|
||||||
RED.nodes.registerType("twitter-credentials",TwitterNode);
|
RED.nodes.registerType("twitter-credentials",TwitterNode);
|
||||||
|
|
||||||
|
|
||||||
function TwitterInNode(n) {
|
function TwitterInNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.user = n.user;
|
this.oper = n.operation;
|
||||||
this.tags = n.tags.replace(/ /g,'');
|
this.tags = n.tags.replace(/ /g,'');
|
||||||
this.twitter = n.twitter;
|
this.twitter = n.twitter;
|
||||||
this.topic = n.topic;
|
this.topic = n.topic;
|
||||||
@ -47,11 +46,13 @@ function TwitterInNode(n) {
|
|||||||
if (this.tags !== "") {
|
if (this.tags !== "") {
|
||||||
try {
|
try {
|
||||||
var thing = 'statuses/filter';
|
var thing = 'statuses/filter';
|
||||||
if (this.user) { thing = 'user'; }
|
if (this.oper === "user") { thing = 'user'; }
|
||||||
|
if (this.oper === "site") { thing = 'site'; }
|
||||||
function setupStream() {
|
function setupStream() {
|
||||||
if (node.active) {
|
if (node.active) {
|
||||||
twit.stream(thing, { track: [node.tags] }, function(stream) {
|
twit.stream(thing, { track: [node.tags] }, function(stream) {
|
||||||
//twit.stream('user', { 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) {
|
//twit.stream('statuses/filter', { track: [node.tags] }, function(stream) {
|
||||||
node.stream = stream;
|
node.stream = stream;
|
||||||
stream.on('data', function(tweet) {
|
stream.on('data', function(tweet) {
|
||||||
@ -101,8 +102,6 @@ TwitterInNode.prototype.close = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TwitterOutNode(n) {
|
function TwitterOutNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.topic = n.topic;
|
this.topic = n.topic;
|
||||||
|
Loading…
Reference in New Issue
Block a user