Created
February 12, 2015 09:43
-
-
Save Furzel/d74239cff30b898093b0 to your computer and use it in GitHub Desktop.
Front test plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var conversation; | |
function unassign() { | |
Front.unassign(conversation); | |
} | |
function toggleArchive() { | |
Front.toggleArchive(conversation); | |
} | |
function toggleTrashed() { | |
Front.toggleTrashed(conversation); | |
} | |
function reply() { | |
Front.reply({ | |
body: 'Template reply', | |
subject: 'Template subject', | |
}, false, conversation); | |
} | |
function alertDialog() { | |
Front.dialog('alert', { | |
title: 'I\'m an alert dialog', | |
message: 'You are now alerted', | |
}, function () { | |
console.log('Alert closed'); | |
}); | |
} | |
function confirmDialog() { | |
Front.dialog('confirm', { | |
title: 'I\'m a confirm dialog', | |
message: 'Do you confirm', | |
okTitle: 'OK Button', | |
cancelTitle: 'Cancel Button' | |
}, function (confirmed) { | |
if (confirmed) | |
console.log('User confirmed'); | |
else | |
console.log('User cancelled'); | |
}); | |
} | |
function promptDialog() { | |
Front.dialog('prompt', { | |
title: 'I\'m a prompt dialog', | |
message: 'Please enter something' | |
}, function (data) { | |
if (data) | |
console.log('User input :', data); | |
else | |
console.log('User cancelled'); | |
}); | |
} | |
Front.on('conversation', function (data) { | |
console.log('Conversation', data.conversation); | |
console.log('Contact', data.contact); | |
console.log('Message', data.message); | |
console.log('OtherMessages', data.otherMessages); | |
conversation = data.conversation; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="https://dl.frontapp.com/libs/frontjs.min.js"></script> | |
<script type="text/javascript" src="front-test-plugin.js"></script> | |
</head> | |
<body> | |
<button onClick="unassign()">Unassign</button> | |
<button onClick="toggleArchive()">Archive/Unarchive</button> | |
<button onClick="toggleTrashed()">Trash/Untrash</button> | |
<button onClick="reply()">Reply</button> | |
<button onClick="alertDialog()">Pop alert dialog</button> | |
<button onClick="confirmDialog()">Pop confirm dialog</button> | |
<button onClick="promptDialog()">Pop prompt dialog</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment