Epub阅读器0.0.1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
var generator = {};
|
||||
|
||||
generator.generateHtml = function (content, js, css) {
|
||||
var result = content;
|
||||
result = result.replace("<!--headTrap<body></body><head></head><html></html>-->", "");
|
||||
result = result.replace("<!--tailTrap<body></body><head></head><html></html>-->", "");
|
||||
var match = result.match(/window\.__nonce_str = "(\d+)"/);
|
||||
var nonce = "";
|
||||
if (match && match.length > 1) {
|
||||
nonce = "nonce='" + match[1] + "'";
|
||||
}
|
||||
var insertJs = "<script " + (nonce.length > 1 ? nonce : "") + " type='text/javascript'>" + js + "</script></body>";
|
||||
var insertStyle = "<style type='text/css'>" + css + "</style></head>";
|
||||
result = result.replace("</head>", insertStyle);
|
||||
result = result.replace("</body>", insertJs);
|
||||
return result;
|
||||
}
|
||||
|
||||
generator.generateHtmlForMPReview = function (content,js, css) {
|
||||
var result = generator.generateHtml(content,js,css)
|
||||
var modifiedCopyRight = " <span id = 'copyright_logo' stype = 'display:none' > ";
|
||||
var reg = /<span id="copyright_logo".*>?/;
|
||||
result = result.replace(reg,modifiedCopyRight);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user