-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
122 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/** | ||
* 绘制图区 | ||
* @returns element | ||
*/ | ||
export const viewElement = (pageUrl: string) => { | ||
// 包裹图层 | ||
const divElement = document.createElement("div") | ||
divElement.id = "blog-container" | ||
|
||
// 创建 <style> 元素 | ||
const style = document.createElement("style") | ||
style.innerHTML = ` | ||
iframe { | ||
width: 100%; | ||
height: 100%; | ||
border: none; | ||
} | ||
` | ||
|
||
// 创建 <iframe> 元素 | ||
const iframe = document.createElement("iframe") | ||
iframe.src = pageUrl | ||
iframe.width = "100%" | ||
|
||
// 将 <style> 和 <iframe> 元素添加到父级容器中 | ||
divElement.appendChild(style) | ||
divElement.appendChild(iframe) | ||
|
||
return divElement | ||
} | ||
|
||
export const contentHtml = (pageUrl: string) => `<style> | ||
iframe { | ||
width: 100%; | ||
height: 100%; | ||
border: none; | ||
} | ||
</style> | ||
<iframe src="${pageUrl}" width="100%"></iframe>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,8 @@ | |
width 12px | ||
height 12px | ||
margin-right 10px | ||
margin-top 2px | ||
margin-top 2px | ||
|
||
#blog-container | ||
width 750px | ||
height 550px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters