Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Frameless Javadocs #3806

Merged
merged 8 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 25 additions & 5 deletions scripts/build/javadoc_modify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,28 @@ modifyStylesheetFrameless () {
mv newstylesheet.css "$1"
}

modifyStylesheetFramelessSPIAPI () {
# Append extra javadoc styling located in the css direcctory to the stylesheet.css located in the javadoc api/spi subdirectories
cat src/main/content/antora_ui/src/css/javadoc-extended-stylesheet-frameless-api_spi.css >> "$1"

# insert extra import to the beginning of the file
sed '1 i\
@import url("https://fonts.googleapis.com/css?family=Asap:300,400,500");
' "$1" > newstylesheet.css

mv newstylesheet.css "$1"
}

modifySearch () {
# add url support to search
cp src/main/content/_assets/js/javadoc-search.js "$1"
}

modifyFramelessSearch () {
# add url support to frameless javadoc search
cp src/main/content/_assets/js/javadoc-search-frameless.js "$1"
}

modifyRedirect () {
a=$1
cp src/main/content/_assets/js/javadoc-redirect.js "${a/script.js/redirect.js}"
Expand All @@ -38,14 +55,17 @@ modifyRedirect () {

export -f modifyStylesheet
export -f modifyStylesheetFrameless
export -f modifyStylesheetFramelessSPIAPI
export -f modifySearch
export -f modifyFramelessSearch
export -f modifyRedirect

find target/jekyll-webapp/docs -path "*microprofile*/stylesheet.css" -exec bash -c 'modifyStylesheet {}' \;
find target/jekyll-webapp/docs -path "*liberty-*/stylesheet.css" -exec bash -c 'modifyStylesheet {}' \;
find target/jekyll-webapp/docs -path "*io.openliberty*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*com.ibm.websphere.appserver*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -name search.js -exec bash -c 'modifySearch {}' \;
find target/jekyll-webapp/docs -path "*liberty-*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*microprofile*/stylesheet.css" -exec bash -c 'modifyStylesheetFrameless {}' \;
find target/jekyll-webapp/docs -path "*io.openliberty*/stylesheet.css" -exec bash -c 'modifyStylesheetFramelessSPIAPI {}' \;
find target/jekyll-webapp/docs -path "*com.ibm.websphere.appserver*/stylesheet.css" -exec bash -c 'modifyStylesheetFramelessSPIAPI {}' \;
find target/jekyll-webapp/docs -path "*microprofile*" -name search.js -exec bash -c 'modifyFramelessSearch {}' \;
find target/jekyll-webapp/docs -path "*liberty-*" -name search.js -exec bash -c 'modifyFramelessSearch {}' \;
find target/jekyll-webapp/docs -name script.js -exec bash -c 'modifyRedirect {}' \;

timer_end=$(date +%s)
Expand Down
29 changes: 21 additions & 8 deletions src/main/content/_assets/js/javadoc-redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,26 @@ function javadocRedirect(api,version,jd) {
}
var pack = jd.substring(0, jd.lastIndexOf('/'));
var port = window.top.location.port !== '' ? ':' + window.top.location.port : '';
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?package='+pack+'/package-frame.html&class=': '-javadoc.html?class=') +
jd;
var mainFrame = $('#javadoc_container');
var isFrameless = mainFrame.contents().find('iframe').length === 0;
if(isFrameless){
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?path='+api+version+'-javadoc/'+jd: '-javadoc.html');
}
else{
window.top.location.href =
'https://' +
window.top.location.hostname +
port +
'/docs/latest/reference/javadoc/'+ api +
version +
(pack ? '-javadoc.html?package='+pack+'/package-frame.html&class=': '-javadoc.html?class=') +
jd;
}
}

Loading
Loading