-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): add docs footer customization (#4169)
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
!(function () { | ||
var guideName = document.createElement("meta"); | ||
(guideName.name = "guide-name"), (guideName.content = "API Reference"); | ||
|
||
var serviceName = document.createElement("meta"); | ||
(serviceName.name = "service-name"), (serviceName.content = "AWS SDK for JavaScript v3"); | ||
|
||
document.head.appendChild(guideName); | ||
document.head.appendChild(serviceName); | ||
|
||
var zone = document.createElement("div"); | ||
zone.className += "container"; | ||
zone.id = "awsdocs-legal-zone-copyright"; | ||
zone.style.padding = "2rem"; | ||
|
||
var footer = document.getElementsByTagName("footer"); | ||
if (footer && footer.length >= 1) { | ||
footer[footer.length - 1].appendChild(zone); | ||
} else { | ||
document.body.appendChild(zone); | ||
} | ||
|
||
var boot = document.createElement("script"); | ||
boot.src = "/assets/js/awsdocs-boot.js"; | ||
boot.type = "text/javascript"; | ||
document.head.appendChild(boot); | ||
})(); |
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 @@ | ||
require("./prepend-script"); |
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,20 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
const root = path.join(__dirname, "..", ".."); | ||
const awsFooter = path.join(root, "scripts", "docs-custom-js", "aws-footer.js"); | ||
const docsMainScript = path.join(root, "docs", "assets", "js", "main.js"); | ||
|
||
if (!fs.existsSync(docsMainScript)) { | ||
throw new Error(`docs main script not present at ${docsMainScript}`); | ||
} | ||
|
||
const fileContents = fs.readFileSync(docsMainScript, "utf-8"); | ||
const awsFooterContents = fs.readFileSync(awsFooter, "utf-8"); | ||
|
||
if (fileContents.indexOf(awsFooterContents) === -1) { | ||
fs.writeFileSync(docsMainScript, awsFooterContents + "\n" + fileContents, "utf-8"); | ||
console.log("Modified docs script with AWS footer script."); | ||
} else { | ||
console.log("Docs main script already modified, exiting."); | ||
} |