yulan.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>政策解读</title>
  8. <style>
  9. html, body, div, span, applet, object, iframe,
  10. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  11. a, abbr, acronym, address, big, cite, code,
  12. del, dfn, em, img, ins, kbd, q, s, samp,
  13. small, strike, strong, sub, sup, tt, var,
  14. b, u, i, center,
  15. dl, dt, dd, ol, ul, li,
  16. fieldset, form, label, legend,
  17. table, caption, tbody, tfoot, thead, tr, th, td,
  18. article, aside, canvas, details, embed,
  19. figure, figcaption, footer, header, hgroup,
  20. menu, nav, output, ruby, section, summary,
  21. time, mark, audio, video {
  22. margin: 0;
  23. padding: 0;
  24. border: 0;
  25. font-size: 100%;
  26. font: inherit;
  27. vertical-align: baseline;
  28. box-sizing: border-box;
  29. font-family: Source Han Sans CN;
  30. }
  31. .page{
  32. padding: 15px;
  33. font-size: 14px;
  34. line-height: 16px;
  35. color:#333;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40. {$info.title}
  41. {$info.updatetime|date="Y-m-d H:i:s",###}
  42. <?php if(!empty($info['video_file'])){ ?>
  43. <video width="100" height="100" controls><source src="{$info.video_file}" type="video/ogg"></video>
  44. <?php } ?>
  45. <?php if(!empty($info['audio_file'])){ ?>
  46. <audio controls="controls" src="{$info.audio_file}" /></audio>
  47. <?php } ?>
  48. <div class="page">
  49. {$info.content}
  50. </div>
  51. </body>
  52. </html>
  53. <script src="/assets/js/jquery-3.1.1.min.js"></script>
  54. <script>
  55. function replaceDetail(){
  56. var details = $('.page').html();
  57. //newContent仅是details替换后内容;
  58. let newContent = details.replace(/<img[^>]*>/gi, function (match, capture) { //去除三标签
  59. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
  60. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  61. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  62. return match;
  63. });
  64. newContent = newContent.replace(/<br[^>]*\/>/gi, '');
  65. newContent = newContent.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block;margin:0 auto;"');
  66. $('.page').html('');
  67. $('.page').html(newContent);
  68. }
  69. replaceDetail();
  70. </script>