Skip to content

Commit 5929509

Browse files
committed
changes for dash app
1 parent c39b231 commit 5929509

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

tw5/senddelayed.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
function send(action,text,aux,extra) {
2+
3+
4+
var message = document.createElement("div") ,messageBox = document.getElementById("tiddlyclip-message-box");
5+
if(messageBox) {
6+
message.setAttribute("data-action",action);
7+
message.setAttribute("data-text",text||"");
8+
message.setAttribute("data-aux",aux||"");
9+
message.setAttribute("data-extra",extra||"");
10+
messageBox.appendChild(message);
11+
12+
// Create and dispatch the custom event to the extension
13+
var event = document.createEvent("Events");
14+
event.initEvent("tc-send-event",true,false);
15+
message.dispatchEvent(event);
16+
return "sent";
17+
} else {
18+
return "error no extension found";
19+
}
20+
};
21+
22+
23+
24+
25+
exports.name ="senddelayed";
26+
exports.run = function(delay,action,text,aux,extra) {
27+
thisDelay = parseInt(delay,10);
28+
if (!action) return "nothing to do!";
29+
//if docking, set the config to this table for mapping returned clips
30+
if (action === "dock") {
31+
var ob = JSON.parse(text),opts = JSON.parse(aux);
32+
tiddlyclip.modules.tPaste.setconfig(ob.text,ob.title);
33+
tiddlyclip.modules.tPaste.setopts(opts.text,opts.title);
34+
extra = extra || document.title;
35+
}
36+
setTimeout(function(){ send(action,text,aux,extra);}, thisDelay);
37+
return 'delayed'
38+
};

0 commit comments

Comments
 (0)