Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions examples/sites/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@
window.DEPLOY_URL = ''
window.process = { env: {} }
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add Subresource Integrity (SRI) hash for external CSS

For security, add an integrity hash when loading external resources from CDN.

-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3"/>
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3" 
+      integrity="sha384-[HASH]" 
+      crossorigin="anonymous"/>

Committable suggestion skipped: line range outside the PR's diff.

</head>

<body class="of-hidden">
<div id="header"></div>
<app-root></app-root>
<div id="app" class="wp100 hp100 pt60 of-hidden"></div>
<div class="search-box"></div>
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add SRI hash for external JavaScript

Similarly, add integrity hash for the DocSearch JavaScript file.

-<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
+<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"
+        integrity="sha384-[HASH]"
+        crossorigin="anonymous"></script>

Committable suggestion skipped: line range outside the PR's diff.

<script type="text/javascript">
docsearch({
appId: "AGPA5UXHMH",
apiKey: "5fa09fc20270efa61d68e2c2eb0f56df",
indexName: "opentiny",
container: ".search-box",
debug: false
});
</script>
<!-- prettier-ignore -->
<script id="tinyui-design-common" src="/static/js/design-common.js"></script>
<script type="module" src="./src/main.js"></script>
Expand Down
54 changes: 54 additions & 0 deletions examples/sites/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,57 @@ b, strong {
.tiny-grid td,.tiny-grid th {
vertical-align: middle;
}

/* Algolia 搜索 */

.search-box {
position: absolute;
z-index: 1000;
top: 12px;
left: 360px;
}

.DocSearch-Button {
border-radius: 6px;
transition: 0.4s
}

.DocSearch-Button:hover {
box-shadow: inset 0 0 0 1px #1476ff;
background-color: #f5f5f5;
}

.DocSearch-Button .DocSearch-Search-Icon {
width: 14px;
}

.DocSearch-Button-Placeholder {
color: #969faf;
}

:root {
--docsearch-primary-color: #1476ff;
--docsearch-searchbox-background: #f5f5f5;
}

@media screen and (max-width: 1023px) {
.search-box {
left: 420px;
}
}

@media screen and (max-width: 768px) {
.DocSearch-Modal {
margin-top: 60px;
}

.search-box {
left: 360px;
}
}

@media screen and (max-width: 430px) {
.search-box {
left: 300px;
}
}
1 change: 1 addition & 0 deletions examples/sites/src/views/layout/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:data="menuOptions"
:menu-collapsible="true"
:filter-node-method="searchMenu"
:show-filter="false"
@current-change="clickMenu"
@collapse-change="collapseChange"
>
Expand Down
Loading