var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-data'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'set-data'
postMsg.message = {'data':'my block data'};
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-page-css'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-inner-width'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-inner-height'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-pathname'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'hold-loading-frame'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'clear-loading-frame'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'allow-same-origin'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'is-admin-user'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'is-dialog'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'show-dialog'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'close-dialog'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'save-and-close-dialog'
postMsg.message = { 'data' : 'data1data2data3data4data5' };
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'set-full-width'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'set-height'
postMsg.message = { 'height' : '200'};
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'set-overlay';
postMsg.message = { 'top' : '30', 'bottom' : '20' };
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'clear-overlay';
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'read-shared';
postMsg.message = { 'id' : 'data-id'};
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'get-shared-list'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'write-shared'
postMsg.message = { 'id' : 'data-id', 'data' : 'data1data2data3data4data5' };
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'delete-shared';
postMsg.message = { 'id' : 'data-id'} ;
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'get-team-resources-availability';
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-file'
postMsg.message = { 'id' : 'data-id' };
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'get-file-list'
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'write-file'
postMsg.message = { 'id' : 'data-id' , 'blob' : blob};
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0"
postMsg.service = 'delete-file'
postMsg.message = { 'id' : 'data-id'};
parent.postMessage( fileMsg, "https://www.nitoku.com" );
var postMsg = {};
postMsg.channel = '@nitoku.public/blockApi';
postMsg.version = "1.0";
postMsg.service = 'open-link';
postMsg.message = { 'href' : from.href , 'target' : from.target};
window.parent.postMessage(postMsg,"https://www.nitoku.com");
Note : If the target is not provided the link will open on same window for nitoku.com links and in a new window for external links.
if (e.origin !== ("https://www.nitoku.com")){
console.warn("error on frame origin");
return;
}
if(e.data != null) {
var jdata = JSON.parse(e.data);
if(jdata.service !== "@nitoku.public/blockApi"){
return;
}
if(jdata.response.id === "get-data" ){
console.log(jdata.response.data);
}
}
if(jdata.response.id === "data-update" ){
console.log(jdata.response.data);
}
This event is received when the user clicks on the close bottom of the block dialog menu. You can capture this event with:
if(jdata.response.id === "close-dialog-event" ){
console.log(jdata.response.data);
}