|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | + <title>Android FOSS</title> |
| 7 | + <link rel="stylesheet" href=""> |
| 8 | + <link rel="icon" href="android.svg" type="image/svg+xml"> |
| 9 | + <style> |
| 10 | + main |
| 11 | + { |
| 12 | + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; |
| 13 | + font-size: 16px; |
| 14 | + line-height: 1.5; |
| 15 | + width: 960px; |
| 16 | + margin: auto; |
| 17 | + } |
| 18 | + select |
| 19 | + { |
| 20 | + position: fixed; |
| 21 | + bottom: 0; |
| 22 | + right: 0; |
| 23 | + } |
| 24 | + </style> |
| 25 | +</head> |
| 26 | +<body> |
| 27 | + |
| 28 | + <select onchange="changeCSS( this.value )"> |
| 29 | + <option value="darkly">Darkly</option> |
| 30 | + <option value="united">United</option> |
| 31 | + <option value="flatly">Flatly</option> |
| 32 | + <option value="quartz">Quartz</option> |
| 33 | + </select> |
| 34 | + |
| 35 | + <main></main> |
| 36 | + |
| 37 | + <!-- JavaScript Library to Convert Markdown into HTML --> |
| 38 | + <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> |
| 39 | + |
| 40 | + <!-- Marked plugin to add heading ID's --> |
| 41 | + <script src="https://cdn.jsdelivr.net/npm/marked-gfm-heading-id/lib/index.umd.js"></script> |
| 42 | + |
| 43 | + <script> |
| 44 | + // Basic Settings |
| 45 | + const defaultTheme = 'darkly'; |
| 46 | + const bootswatchVersion = '5.3.3'; // Last updated: 7 March, 2024 |
| 47 | + // Update last one only when https://www.jsdelivr.com/package/npm/bootswatch is updated. |
| 48 | + |
| 49 | + // Configure marked.js to use Github heading ID's to allow the Contents list to function |
| 50 | + marked.use( markedGfmHeadingId.gfmHeadingId() ); |
| 51 | + |
| 52 | + // Get the markdown file, convert it to HTML & put it inside the main tag |
| 53 | + fetch( 'https://raw.githubusercontent.com/offa/android-foss/master/README.md' ) |
| 54 | + .then( response => response.text() ) |
| 55 | + .then( data => { |
| 56 | + document.querySelector( 'main' ).innerHTML = marked.parse( data ); |
| 57 | + }) |
| 58 | + .catch( error => console.error( 'Error:', error ) ); |
| 59 | + |
| 60 | + // Change the theme |
| 61 | + function changeCSS( theme ) |
| 62 | + { |
| 63 | + document.querySelector( 'link' ).href |
| 64 | + = `https://cdn.jsdelivr.net/npm/bootswatch@${bootswatchVersion}/dist/${theme}/bootstrap.min.css`; |
| 65 | + } |
| 66 | + |
| 67 | + // Set the default theme |
| 68 | + changeCSS( defaultTheme ); |
| 69 | + </script> |
| 70 | +</body> |
| 71 | +</html> |
0 commit comments