The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Full.cshtml 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. @model Teknik.Areas.Paste.ViewModels.PasteViewModel
  2. @Styles.Render("~/Content/paste")
  3. @Scripts.Render("~/bundles/paste")
  4. @{
  5. string syntax = string.Empty;
  6. if (Model.Syntax != "auto-detect")
  7. {
  8. syntax = Model.Syntax;
  9. }
  10. }
  11. <div class="container">
  12. <div class="row text-center">
  13. <div class="col-sm-12 text-center">
  14. <h2><b>@((string.IsNullOrEmpty(Model.Title)) ? "Untitled" : Model.Title)</b> <small>Posted on <time datetime="@Model.DatePosted.ToString("o")">@Model.DatePosted.ToString("dddd, MMMM d, yyyy") at @Model.DatePosted.ToString("h:mm:ss tt")</time> - Format: <b id="syntaxLanguage">@Model.Syntax</b></small></h2>
  15. </div>
  16. </div>
  17. <hr />
  18. <div class="row">
  19. <div class="col-sm-1 col-sm-offset-1 text-center">
  20. <a class="btn btn-default" href="@Url.SubRouteUrl("paste", "Paste.Simple", new { url = Model.Url })">Simple</a>
  21. </div>
  22. <div class="col-sm-1 text-center">
  23. <a class="btn btn-default" href="@Url.SubRouteUrl("paste", "Paste.Raw", new { url = Model.Url })">Raw</a>
  24. </div>
  25. <div class="col-sm-1 text-center">
  26. <a class="btn btn-default" href="@Url.SubRouteUrl("paste", "Paste.Download", new { url = Model.Url })">Download</a>
  27. </div>
  28. </div>
  29. <br />
  30. <div class="row">
  31. <div class="col-sm-10 col-sm-offset-1">
  32. <pre><code class="@syntax" id="code">@Model.Content</code></pre>
  33. </div>
  34. </div>
  35. </div>
  36. <script>
  37. addEventListener('load', function () {
  38. var code = document.querySelector('#code');
  39. var language = document.querySelector('#syntaxLanguage');
  40. var worker = new Worker(GenerateBlobURL('@Scripts.Url("~/bundles/syntaxWorker")'));
  41. worker.onmessage = function (event) {
  42. code.innerHTML = event.data.value;
  43. language.innerText = event.data.language;
  44. }
  45. var scriptBlob = GenerateBlobURL('@Scripts.Url("~/bundles/highlight")');
  46. var obj = {
  47. script: scriptBlob,
  48. code: code.textContent
  49. };
  50. worker.postMessage(obj);
  51. })
  52. </script>