UNPKG

pxt-core

Version:

Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors

197 lines (177 loc) 8.76 kB
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <meta charset="UTF-8"> <title>@name@</title> <!-- @include meta.html --> <!-- @include scripthead.html --> <!-- @include targetconfig.html --> <!-- @include tickevent.html --> <link rel="alternate" type="application/json+oembed" href="@oembedurl@&format=json" /> <link rel="alternate" type="text/xml+oembed" href="@oembedurl@&format=xml" /> </head> <body id='root' class='root expandIt share-page'> <div class="showDesktop page-header"> <div class="ui container"> <div id="page-header-wrapper"> <div class="page-header-item no-grow"> <a href="https://makecode.com/" title="Go to Microsoft MakeCode" aria-label="Microsoft MakeCode Logo" role="menuitem" target="blank" rel="noopener" class="ui item logo organization"> <img class="ui logo" src="./static/Microsoft-logo_rgb_c-gray.png" alt="Microsoft MakeCode Logo"> </a> <div class="page-header-product">MakeCode</div> </div> <div class="page-header-item page-header-spacer"></div> <div class="page-header-item page-header-content no-grow"> <h2 class="ui item header">@title@</h2> <a id="eval-button" href="/--eval#project=@id@" class="ui tiny button">Evaluate</a> <a href="/@versionsuff@#pub:@id@" class="ui tiny button">Edit Code</a> </div> </div> </div> </div> <!-- @include macros.html --> <aside id=main-container class=box> @BODY@ </aside> <div class="ui main container mainbody script-content"> <iframe id="embed-frame" class="script-embed" src="/@versionsuff@#sandbox:@id@" sandbox="allow-popups allow-forms allow-scripts allow-same-origin allow-downloads" frameborder="0"></iframe> <div class="script-bookend"> <div id="abuse-message" class="ui tiny blue message"> <div class="ui grid padded"> <div class="abuse content"> <p> The content above is provided by a user, and is not endorsed by Microsoft. <a style='text-decoration:underline' id="abuse" href="#">Report abuse</a> if you think it's not appropriate. </p> </div> </div> </div> <div class="ui small modal" id='abusemodal'> <div class="header">Report abuse</div> <div class="content"> <div class="ui form"> <div class="field"> <label>Why do you find it offensive?</label> <textarea id='abusetext' rows="2" maxlength="1000"></textarea> </div> </div> </div> <div class="actions"> <div class="ui ok button violet"> <i class='ui flag icon'></i> Submit </div> <div class="ui cancel button"> <i class='ui cancel icon'></i> Cancel </div> </div> </div> <div class="ui small modal" id='abusedone'> <div class="header">Report sent</div> <div class="content"> <p> Thank you for helping keep Microsoft MakeCode a friendly place! </p> </div> <div class="actions"> <div class="ui ok green button"> <i class='ui trophy icon'></i> OK </div> </div> </div> <script> $(function () { var id = "@id@"; var now = Math.round(Date.now() / 1000); $(".humantime").each(function () { $(this).text( describetime(now, parseInt($(this).data("time"))) ) }) $("#abuse").click(function () { $("#abusemodal") .modal({ onApprove: function () { $.ajax({ type: 'POST', url: '/api/@id@/abusereports', data: JSON.stringify({ text: $('#abusetext').val() }), success: function () { $("#abusedone").modal("show"); }, contentType: "application/json", dataType: 'json' }); } }) .modal("show"); }) }) var shareLinkIsApproved = false; window.pxtTargetConfigPromise .then(function(targetConfig) { var approvedShareLinks = targetConfig && targetConfig.shareLinks && targetConfig.shareLinks.approved; if (approvedShareLinks && approvedShareLinks.indexOf("@id@") >= 0) { // This share link has been allow listed; remove cookie banner and allow sending of tick events shareLinkIsApproved = true; var abuseMessage = document.querySelector("#abuse-message"); if (abuseMessage) abuseMessage.remove(); window.pxtTickEvent( 'approved.shareurl.loaded', { shareurl: "@id@" }, ); } var evalEnabled = targetConfig && targetConfig.teachertool.showSharePageEvalButton; if (!evalEnabled) { var evalButton = document.querySelector("#eval-button"); if (evalButton) { evalButton.remove(); } } }); window.addEventListener('message', function (ev) { if (!shareLinkIsApproved) return; var d = ev.data; if (d.type == "messagepacket" && d.channel == "tick-event" && d.data) { var unpackedData = ""; for (var i = 0; i < d.data.length; ++i) unpackedData += String.fromCharCode(d.data[i]); try { const data = JSON.parse(unpackedData); data["shareurl"] = "@id@"; window.pxtTickEvent( 'simulator.user.tick', data, ); } catch (e) { /** failed to parse tick from game **/ } } }); </script> </div> <div class="script-bookend"> <div style="text-align: center;"> <div class="ui container horizontal mini link list"> <!-- <a class="ui item " href="https://makecode.com/contact " target="_blank " rel="noopener ">Contact Us</a> --> <a class="ui item " href="https://makecode.com/privacy " target="_blank " rel="noopener ">Privacy &amp; Cookies</a> <a class="ui item " href="https://makecode.com/termsofuse " target="_blank " rel="noopener "> Terms Of Use</a> <a class="ui item " href="https://makecode.com/trademarks " target="_blank " rel="noopener ">Trademarks</a> <div class="ui item ">© 2022 Microsoft</div> </div> </div> </div> @body@ </div> <!-- @include tracking.html --> </body> </html>