2019-04-22 14:50:49 -04:00
|
|
|
module.exports = {};
|
|
|
|
|
|
|
|
module.exports.embedHtml = projectId => {
|
2019-04-22 22:36:26 -04:00
|
|
|
if (projectId) {
|
2019-05-02 17:18:13 -04:00
|
|
|
return `<iframe src="https://scratch.mit.edu/projects/${projectId}/embed" ` +
|
2019-04-22 22:36:26 -04:00
|
|
|
'allowtransparency="true" width="485" height="402" ' +
|
|
|
|
'frameborder="0" scrolling="no" allowfullscreen></iframe>';
|
|
|
|
}
|
|
|
|
return '';
|
2019-04-22 14:50:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.twitterIntentLink = projectId => {
|
|
|
|
const baseUrl = 'https://twitter.com/intent/tweet?';
|
|
|
|
const escapedScratchUrl = `https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F${projectId}`;
|
|
|
|
const escapedTweetText = 'Check%20out%20what%20you%20can%20make%20on%20Scratch%3A';
|
|
|
|
const escapedHashtags = 'creativecode';
|
|
|
|
return `${baseUrl}url=${escapedScratchUrl}&text=${escapedTweetText}&hashtags=${escapedHashtags}`;
|
|
|
|
};
|
|
|
|
|
2019-04-22 22:36:26 -04:00
|
|
|
module.exports.googleClassroomIntentLink = projectId => {
|
|
|
|
const baseUrl = 'https://classroom.google.com/share?';
|
|
|
|
const escapedScratchUrl = `https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F${projectId}`;
|
|
|
|
return (`${baseUrl}url=${escapedScratchUrl}`);
|
|
|
|
};
|
|
|
|
|
2019-04-23 17:11:27 -04:00
|
|
|
module.exports.weChatIntentLink = projectId => {
|
|
|
|
const baseUrl = 'https://wechat.com/?';
|
|
|
|
const escapedScratchUrl = `https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F${projectId}`;
|
|
|
|
return (`${baseUrl}url=${escapedScratchUrl}`);
|
|
|
|
};
|
|
|
|
|
2019-04-22 14:50:49 -04:00
|
|
|
module.exports.facebookIntentLink = projectId => {
|
|
|
|
const baseUrl = 'https://www.facebook.com/sharer.php?';
|
|
|
|
const escapedScratchUrl = `https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F${projectId}`;
|
|
|
|
return `${baseUrl}u=${escapedScratchUrl}`;
|
|
|
|
};
|
|
|
|
|
|
|
|
// needs fb app id
|
|
|
|
module.exports.facebookIntentDialog = (scratchFBAppId, projectId) => {
|
|
|
|
const baseUrl = 'https://www.facebook.com/dialog/share?';
|
|
|
|
const escapedScratchUrl = `https%3A%2F%2Fscratch.mit.edu%2Fprojects%2F${projectId}`;
|
|
|
|
const escapedHashtag = '%23creativecode';
|
|
|
|
return `${baseUrl}app_id=${scratchFBAppId}href=${escapedScratchUrl}&hashtag=${escapedHashtag}`;
|
|
|
|
};
|