Açıklama Yok

source_html.go 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2014 Google Inc. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package report
  15. import (
  16. "html/template"
  17. )
  18. // AddSourceTemplates adds templates used by PrintWebList to t.
  19. func AddSourceTemplates(t *template.Template) {
  20. template.Must(t.Parse(`{{define "weblistcss"}}` + weblistPageCSS + `{{end}}`))
  21. template.Must(t.Parse(`{{define "weblistjs"}}` + weblistPageScript + `{{end}}`))
  22. }
  23. const weblistPageCSS = `<style type="text/css">
  24. body {
  25. font-family: sans-serif;
  26. }
  27. h1 {
  28. font-size: 1.5em;
  29. margin-bottom: 4px;
  30. }
  31. .legend {
  32. font-size: 1.25em;
  33. }
  34. .line, .nop, .unimportant {
  35. color: #aaaaaa;
  36. }
  37. .inlinesrc {
  38. color: #000066;
  39. }
  40. .deadsrc {
  41. cursor: pointer;
  42. }
  43. .deadsrc:hover {
  44. background-color: #eeeeee;
  45. }
  46. .livesrc {
  47. color: #0000ff;
  48. cursor: pointer;
  49. }
  50. .livesrc:hover {
  51. background-color: #eeeeee;
  52. }
  53. .asm {
  54. color: #008800;
  55. display: none;
  56. }
  57. </style>`
  58. const weblistPageScript = `<script type="text/javascript">
  59. function pprof_toggle_asm(e) {
  60. var target;
  61. if (!e) e = window.event;
  62. if (e.target) target = e.target;
  63. else if (e.srcElement) target = e.srcElement;
  64. if (target) {
  65. var asm = target.nextSibling;
  66. if (asm && asm.className == "asm") {
  67. asm.style.display = (asm.style.display == "block" ? "" : "block");
  68. e.preventDefault();
  69. return false;
  70. }
  71. }
  72. }
  73. </script>`
  74. const weblistPageClosing = `
  75. </body>
  76. </html>
  77. `