Skip to content

Commit

Permalink
Closes issue #1
Browse files Browse the repository at this point in the history
- robot.send can now trigger facebook link sharing
- Update images script
  • Loading branch information
joaomsa committed Oct 7, 2014
1 parent f4dd20e commit 9557cac
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions dist/botman.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// @include https://www.facebook.com/*
// @exclude https://www.facebook.com/ai.php*
// @exclude https://www.facebook.com/xti.php*
// @version 1.1.4
// @version 1.2.0
// @grant GM_xmlhttpRequest
// @run-at document-end
// ==/UserScript==
Expand Down Expand Up @@ -95,6 +95,10 @@ function Message(ev){

that.send = function(body){
that.event.target.value = body;

var ev = Keyfaker.keydown(Keyfaker.SPACE);
ev.botmanGenerated = true;
that.event.target.dispatchEvent(ev);
}

that.sendNow = function(body){
Expand Down Expand Up @@ -286,7 +290,11 @@ function serializeToUrlEncoded(obj){
if (!!images.responseData){
images = images.responseData.results;
if (!!images && images.length > 0){
msg.send(chooseRandom(images).unescapedUrl)
msg.send(chooseRandom(images).unescapedUrl + " ");
// Clear link after facebook share has parsed it
setTimeout(function(){
msg.send("");
}, 1000); //
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// @include https://www.facebook.com/*
// @exclude https://www.facebook.com/ai.php*
// @exclude https://www.facebook.com/xti.php*
// @version 1.1.4
// @version 1.2.0
// @grant GM_xmlhttpRequest
// @run-at document-end
// ==/UserScript==
Expand Down
4 changes: 4 additions & 0 deletions src/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function Message(ev){

that.send = function(body){
that.event.target.value = body;

var ev = Keyfaker.keydown(Keyfaker.SPACE);
ev.botmanGenerated = true;
that.event.target.dispatchEvent(ev);
}

that.sendNow = function(body){
Expand Down
6 changes: 5 additions & 1 deletion src/scripts/google-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
if (!!images.responseData){
images = images.responseData.results;
if (!!images && images.length > 0){
msg.send(chooseRandom(images).unescapedUrl)
msg.send(chooseRandom(images).unescapedUrl + " ");
// Clear link after facebook share has parsed it
setTimeout(function(){
msg.send("");
}, 1000); //
}
}
},
Expand Down

0 comments on commit 9557cac

Please sign in to comment.