xssi.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>Mermaid Quick Test Page</title>
  7. <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
  8. <script>
  9. function xss(x){
  10. alert(x + ' cause an xss attack');
  11. }
  12. </script>
  13. <style>
  14. .label text { fill: red}
  15. </style>
  16. </head>
  17. <body>
  18. <div class="mermaid">
  19. info
  20. </div>
  21. <div class="mermaid">
  22. graph LR;
  23. alert`xss`-->B;
  24. click B "javaSc
  25. ript:alert`salt`" "This is a tooltip for a link"
  26. </div>
  27. <div class="mermaid">
  28. graph LR;
  29. alert`xss`-->B;
  30. click B "java
  31. script:alert`xss`" "This is a tooltip for a link"
  32. </div>
  33. <div class="mermaid">
  34. graph LR;
  35. alert`base64`-->B;
  36. click B "data:image/png;base64,HNjcmlwdD5hbGVydCgiSGVsbG8iKTs8L3NjcmlwdD4="
  37. </div>
  38. <img src=xss.png />
  39. <div class="mermaid">
  40. graph TD
  41. A["<strong>If bold then xss</strong>Christmas"] -->|Get <strong>If bold then xss</strong> money| B(Go <strong>If bold then xss</strong> shopping)
  42. B --> C{Let me thinksssss<br/>ssssssssssssssssssssss<br />sssssssssssssssssssssssssss}
  43. C -->|One| D[Laptop]
  44. C -->|Two| E[iPhone]
  45. C -->|Three| F[Car]
  46. </div>
  47. <div class="mermaid">
  48. graph TB
  49. subgraph "<strong>If bold then xss</strong>"
  50. a1-->a2
  51. end
  52. </div>
  53. <div class="mermaid">
  54. graph TD
  55. A[Click on] -->|Get happines| BBBB(Clickable)
  56. BBBB --> C{Let me think}
  57. C -->|One| D[Laptop]
  58. C -->|Two| E[iPhone]
  59. C -->|Three| F[Car]
  60. click A "http://localhost:9000/index.html#link-clicked" "link test"
  61. click BBBB testClick "click test"
  62. click C "javascript:alert" "link test"
  63. classDef someclass fill:#f96;
  64. class A someclass;
  65. </div>
  66. <div class="mermaid">
  67. graph LR;
  68. alert`md5_salt`-->B;
  69. click alert`md5_salt` eval "Tooltip for a callback"
  70. click B "javascript:alert`salt`" "This is a tooltip for a link"
  71. </div>
  72. <div class="mermaid">
  73. gantt
  74. dateFormat YYYY-MM-DD
  75. axisFormat %d/%m
  76. title Adding GANTT diagram to mermaid
  77. excludes weekdays 2014-01-10
  78. section A section
  79. Completed task :done, des1, 2014-01-06,2014-01-08
  80. Active task :active, des2, 2014-01-09, 3d
  81. Future task : des3, after des2, 5d
  82. Future task2 : des4, after des3, 5d
  83. section Critical tasks
  84. Completed task in the critical line :crit, done, 2014-01-06,24h
  85. Implement parser and jison :crit, done, after des1, 2d
  86. Create tests for parser :crit, active, 3d
  87. Future task in critical line :crit, 5d
  88. Create tests for renderer :2d
  89. Add to mermaid :1d
  90. section Documentation
  91. Describe gantt syntax :active, a1, after des1, 3d
  92. Add gantt diagram to demo page :after a1 , 20h
  93. Add another diagram to demo page :doc1, after a1 , 48h
  94. section Clickable
  95. Visit mermaidjs :active, cl1, 2014-01-07,2014-01-10
  96. Calling a Callback (look at the console log) :cl2, after cl1, 3d
  97. click cl1 href "javascript:alert`salt`"
  98. click cl2 call ganttTestClick("test", test, test)
  99. section Last section
  100. Describe gantt syntax :after doc1, 3d
  101. Add gantt diagram to demo page : 20h
  102. Add another diagram to demo page : 48h
  103. </div>
  104. <div class="mermaid">
  105. sequenceDiagram
  106. participant "Alice"
  107. participant Bob
  108. participant John as John<br/>Second Line
  109. Alice ->> Bob: Hello Bob, how are you?
  110. Bob-->>John: How about you <strong>If bold then xss</strong>John?
  111. Bob--x Alice: I am good thanks!
  112. Bob-x John: I am good thanks!
  113. Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.
  114. Bob-->Alice: Checking with John...
  115. alt either this
  116. Alice->>John: Yes
  117. else or this
  118. Alice->>John: No
  119. else or this will happen
  120. Alice->John: Maybe
  121. end
  122. par this happens in parallel
  123. Alice -->> Bob: Parallel message 1
  124. and
  125. Alice -->> John: Parallel message 2
  126. end
  127. </div>
  128. <div class="mermaid">
  129. classDiagram
  130. Class01 <|-- AveryLongClass : Co<strong>If bold then xss</strong>ol
  131. Class03 "0" *-- "0..n" Class04
  132. Class05 "1" o-- "many" Class06
  133. Class07 .. Class08
  134. Class09 "many" --> "1" C2 : Where am i?
  135. Class09 "0" --* "1..n" C3
  136. Class09 --|> Class07
  137. Class07 : equals()
  138. Class07 : Object[] elementData
  139. Class01 : size()
  140. Class01 : int chimp
  141. Class01 : int gorilla
  142. Class08 <--> C2: Cool label
  143. </div>
  144. <div class="mermaid">
  145. graph LR
  146. SavePropertyController --> SavePropertyCommand
  147. SavePropertyCommand --> SavePropertyCommandHandler
  148. SavePropertyCommandHandler --> EventElastica[elastica.postupdate]
  149. SavePropertyCommandHandler --> EventProperty[property.postdisable]
  150. SavePropertyController --> Exceptions
  151. Exceptions --> ExceptionList(SecurityException<br/>EmptyRequestBodyException<br/>Throwable)
  152. classDef Ui fill:#FFFFFF
  153. classDef object fill:#1E98EC
  154. classDef event fill:#ECB11E
  155. class EventElastica,EventProperty event
  156. class SavePropertyCommand,SavePropertyCommandHandler object
  157. class SavePropertyController Ui
  158. </div>
  159. <script src="./mermaid.js"></script>
  160. <!-- <script src="//cdn.jsdelivr.net/npm/mermaid@8.2.1/dist/mermaid.min.js"></script> -->
  161. <script>
  162. mermaid.initialize({
  163. theme: 'forest',
  164. // themeCSS: '.node rect { fill: red; }',
  165. logLevel: 4,
  166. flowchart: { htmlLabels: false, curve: 'linear' },
  167. gantt: { axisFormat: '%m/%d/%Y' },
  168. sequence: { actorMargin: 50 },
  169. // sequenceDiagram: { actorMargin: 300 } // deprecated
  170. securityLevel:'strict',
  171. });
  172. </script>
  173. <script>
  174. function ganttTestClick(a, b, c){
  175. console.log("a:", a)
  176. console.log("b:", b)
  177. console.log("c:", c)
  178. }
  179. function testClick(nodeId) {
  180. console.log("clicked", nodeId)
  181. var originalBgColor = document.querySelector('body').style.backgroundColor
  182. document.querySelector('body').style.backgroundColor = 'yellow'
  183. setTimeout(function() {
  184. document.querySelector('body').style.backgroundColor = originalBgColor
  185. }, 100)
  186. }
  187. </script>
  188. </body>
  189. </html>