四零语境前端代码仓库
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.

53 lines
1.4 KiB

  1. <html>
  2. <head>
  3. <meta
  4. name="viewport"
  5. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
  6. />
  7. <title>富文本展示</title>
  8. <style type="text/css">
  9. html,body {
  10. margin: 0;
  11. padding: 0;
  12. width: 100%;
  13. height: 100%;
  14. overflow: hidden;
  15. box-sizing: border-box;
  16. }
  17. .yingbing-content {
  18. color: #333;
  19. width: 100%;
  20. height: 100%;
  21. }
  22. .yingbing-img {
  23. max-width: 100%!important;
  24. max-height: 100%!important;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="yingbing-content"></div>
  30. </body>
  31. <script type="text/javascript">
  32. window.onload = function () {
  33. var search = window.location.search.slice(1);
  34. var arr = search.split('&');
  35. for ( var i = 0; i < arr.length; i++ ) {
  36. var strs = arr[i].split('=');
  37. if ( strs[0] == 'content' ) {
  38. document.querySelector('.yingbing-content').innerHTML = decodeURIComponent(strs[1])
  39. }
  40. }
  41. }
  42. function setFontFace (fontList) {
  43. let code = fontList.reduce((accumulator, currentValue) => {
  44. return accumulator + `@font-face { font-family: ${currentValue.fontFamily};src: url('${currentValue.src}'); }`;
  45. }, "");
  46. var style = document.createElement("style");
  47. style.type = "text/css";
  48. style.rel = "stylesheet";
  49. style.appendChild(document.createTextNode(code));
  50. var head = document.getElementsByTagName("head")[0];
  51. head.appendChild(style);
  52. }
  53. </script>
  54. </html>