|
@@ -0,0 +1,63 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ html, body, div, span, applet, object, iframe,
|
|
|
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
|
+ a, abbr, acronym, address, big, cite, code,
|
|
|
+ del, dfn, em, img, ins, kbd, q, s, samp,
|
|
|
+ small, strike, strong, sub, sup, tt, var,
|
|
|
+ b, u, i, center,
|
|
|
+ dl, dt, dd, ol, ul, li,
|
|
|
+ fieldset, form, label, legend,
|
|
|
+ table, caption, tbody, tfoot, thead, tr, th, td,
|
|
|
+ article, aside, canvas, details, embed,
|
|
|
+ figure, figcaption, footer, header, hgroup,
|
|
|
+ menu, nav, output, ruby, section, summary,
|
|
|
+ time, mark, audio, video {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ border: 0;
|
|
|
+ font-size: 100%;
|
|
|
+ font: inherit;
|
|
|
+ vertical-align: baseline;
|
|
|
+ box-sizing: border-box;
|
|
|
+ font-family: Source Han Sans CN;
|
|
|
+ }
|
|
|
+ .page{
|
|
|
+ padding: 15px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 16px;
|
|
|
+ color:#333;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="page">
|
|
|
+ {$content}
|
|
|
+ </div>
|
|
|
+</body>
|
|
|
+</html>
|
|
|
+<script src="/assets/js/jquery-3.1.1.min.js"></script>
|
|
|
+<script>
|
|
|
+
|
|
|
+ function replaceDetail(){
|
|
|
+ var details = $('.page').html();
|
|
|
+ //newContent仅是details替换后内容;
|
|
|
+ let newContent = details.replace(/<img[^>]*>/gi, function (match, capture) { //去除三标签
|
|
|
+ match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
|
|
|
+ match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
|
|
|
+ match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
|
|
|
+ return match;
|
|
|
+ });
|
|
|
+ newContent = newContent.replace(/<br[^>]*\/>/gi, '');
|
|
|
+ newContent = newContent.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block;margin:0 auto;"');
|
|
|
+ $('.page').html('');
|
|
|
+ $('.page').html(newContent);
|
|
|
+ }
|
|
|
+ replaceDetail();
|
|
|
+</script>
|