fix broken links and better dark mode

This commit is contained in:
janis
2023-03-06 14:29:44 +01:00
parent 91d71c6dc7
commit fec7ff974f
7 changed files with 36 additions and 19 deletions

View File

@@ -32,7 +32,7 @@ html, body {
'menu footer footer footer footer';
}
.docs-link {
#doc-container a {
color: blue;
}
@@ -73,3 +73,6 @@ html, body {
grid-area: header;
}
code {
font-size: 85%;
}

View File

@@ -22,7 +22,7 @@
<h2>USAGE</h2>
<p>You first have to enable the plugin by setting a global <code>data-autoplay</code> value on the impress-div. Then you can change individual <code>data-autoplay</code> values on each <em>step</em> by adding <code>data-autoplay</code> to it. If this value is set to <code>0</code>, there will be no more auto-advancing on this <em>step</em>. The value you enter is time in seconds to switch to the next slide.</p>
<h2>EXAMPLE</h2>
<p>Note: This only shows part of the HTML. If you want to know how to set up a presentation, I highly recommend you read our <a href="https://github.com/impress/impress.js/GettingStarted.md">Getting Started Guide</a></p>
<p>Note: This only shows part of the HTML. If you want to know how to set up a presentation, I highly recommend you read our <a href="https://github.com/impress/impress.js/blob/master/GettingStarted.md">Getting Started Guide</a></p>
<pre><code>&lt;div id=impress data-autoplay=&quot;5&quot;&gt;
&lt;div class=&quot;step&quot; data-autoplay=&quot;0&quot;&gt;
This slide will not auto-advance

View File

@@ -19,7 +19,7 @@
<div id="doc-container">
<h1>Extras Plugin</h1>
<p>The Extras plugin will initialize the optional addon plugins from
<a href="https://github.com/impress/impress.js/src/plugins/extras/">extras/</a> directory, if they were loaded.</p>
<a href="https://github.com/impress/impress.js/tree/master/src/plugins/extras/">extras/</a> directory, if they were loaded.</p>
<p>Generally, for an extras plugin to have been loaded, 2 things must have happened:</p>
<ol>
<li>The extras plugins must be present in extras/ directory, for example after

View File

@@ -99,7 +99,7 @@ cannot or don't want to add the explicit 0 values where needed, your last resort
remove the <code>rel.js</code> plugin completely. You can either:</p>
<ul>
<li>
<p>Remove <code>rel.js</code> from <a href="https://github.com/impress/impress.js/src/plugins/build.js">/build.js</a> and recompile <code>impress.js</code> with: <code>npm build</code></p>
<p>Remove <code>rel.js</code> from <a href="https://github.com/impress/impress.js/blob/master/src/plugins/build.js">/build.js</a> and recompile <code>impress.js</code> with: <code>npm build</code></p>
</li>
<li>
<p>Just open [/js/impress.js] in an editor and delete the <code>rel.js</code> code.</p>

View File

@@ -44,7 +44,7 @@ the toolbar from sight, and only make it visible when mouse is moved.</p>
}
</code></pre>
<p>If you're writing a plugin and would like to add a widget to the toolbar, see
<a href="https://github.com/impress/impress.jstoolbar.js">the top of the source file for further instructions</a>.</p>
<a href="https://github.com/impress/impress.js/blob/master/src/plugins/toolbar/toolbar.js">the top of the source file for further instructions</a>.</p>
<h2>Author</h2>
<p>Henrik Ingo (@henrikingo), 2016</p>
</div>

View File

@@ -96,8 +96,10 @@ if ( prompt( 'Do you want to regenerate the plugins documentation? (y/n) ' ).toL
if ( error ) {
console.log( 'NO README found for ' + path.join( pluginsPath + '/' + plugins[item] ) + ' PLEASE MAKE SURE YOU HAVE CREATED A README!' );
} else {
let html = md2html.render( '' + data );
storeHTML( findLinks( html, path.join( pluginsPath + '/' + plugins[item] ) ), plugins[item], 'plugins' );
( async () => {
let html = md2html.render( '' + data );
storeHTML( await findLinks( html, path.join( pluginsPath + '/' + plugins[item] ) ), plugins[item], 'plugins' );
} );
};
} );
};
@@ -116,7 +118,7 @@ buildExamplesPage();
/*
This function finds links. The reason for this is possible incompatibilities with links on the website
*/
function findLinks ( html, path ) {
async function findLinks ( html, path ) {
let returnHTML = html;
for ( let letter in html ) {
if ( html[letter] === '<' ) {
@@ -125,7 +127,7 @@ function findLinks ( html, path ) {
while ( html.slice( parseInt( letter ) + i, parseInt( letter ) + i + 1 ) !== '"' ) {
i += 1;
};
returnHTML = html.slice( 0, parseInt( letter ) ) + checkLinks( html.slice( parseInt( letter ) + 9, parseInt( letter ) + i ), path ) + html.slice( parseInt( letter ) + i + 2, parseInt( html.length ) );
returnHTML = html.slice( 0, parseInt( letter ) ) + await checkLinks( html.slice( parseInt( letter ) + 9, parseInt( letter ) + i ), path ) + html.slice( parseInt( letter ) + i + 2, parseInt( html.length ) );
};
};
};
@@ -136,7 +138,7 @@ function findLinks ( html, path ) {
This function takes care of checking links. This is necessary, as documentation may contain links that will
not work on the website, as it has relative paths.
*/
function checkLinks ( link, fpath ) {
async function checkLinks ( link, fpath ) {
let filepath = fpath;
let pos = 0;
if ( link.slice( parseInt( link.length ) - 9, parseInt( link.length ) ) === 'README.md' ) {
@@ -160,22 +162,34 @@ function checkLinks ( link, fpath ) {
while ( filepath.slice( parseInt( filepath.length ) - fsPos - 10, parseInt( filepath.length ) - fsPos ) !== 'impress.js' ) {
fsPos += 1;
};
let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos, parseInt( filepath.length ) );
let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos + 1, parseInt( filepath.length ) );
let linkSlice = link.slice( pos, link.length );
// now let's assemble a link and add it back into the html
return '<a href="https://github.com/impress/impress.js' + fpSlice + linkSlice + '">';
if ( link.slice( link.length - 3, link.length ).includes( '.' ) ) {
return '<a href="https://github.com/impress/impress.js/blob/master/' + fpSlice + linkSlice + '">';
} else {
return '<a href="https://github.com/impress/impress.js/tree/master/' + fpSlice + linkSlice + '">';
};
} else if ( link.slice( 0, 1 ) !== '.' && link.slice( 0, 1 ) !== '/' ) {
let fsPos = 0;
while ( filepath.slice( parseInt( filepath.length ) - fsPos - 10, parseInt( filepath.length ) - fsPos ) !== 'impress.js' ) {
fsPos += 1;
};
let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos, parseInt( filepath.length ) );
return '<a href="https://github.com/impress/impress.js' + link + '">';
let fpSlice = filepath.slice( parseInt( filepath.length ) - fsPos + 1, parseInt( filepath.length ) ) + '/';
if ( link.slice( link.length - 3, link.length ).includes( '.' ) ) {
return '<a href="https://github.com/impress/impress.js/blob/master/' + fpSlice + link + '">';
} else {
return '<a href="https://github.com/impress/impress.js/tree/master/' + fpSlice + link + '">';
};
} else if ( link.slice( 0, 7 ) === 'http://' || link.slice( 0, 8 ) === 'https://' ) {
return '<a href="' + link + '">';
} else if ( link.slice( 0, 1 ) === '/' ) {
return '<a href="https://github.com/impress/impress.js' + link + '">';
} else if ( link.slice( 0, 1 ) === '/' && link.slice( 1, 2 ) !== '.' ) {
if ( link.slice( link.length - 3, link.length ).includes( '.' ) ) {
return '<a href="https://github.com/impress/impress.js/blob/master' + link + '">';
} else {
return '<a href="https://github.com/impress/impress.js/tree/master' + link + '">';
};
} else {
throw Error( 'Invalid link found! Link is: "' + link + '" in file: ' + filepath + '/README.md' );
};

View File

@@ -19,7 +19,7 @@ function setTheme () {
$( '.nav-subitem' ).css( 'background-color', 'rgb(18, 18, 99)' );
$( '.navitem' ).css( 'background-color', 'rgb(12, 12, 60)' );
$( '.nav-container' ).css( 'background-color', 'rgb(0, 0, 100)' );
$( '.docs-link' ).css( 'color', 'white' );
$( '#doc-container a' ).css( 'color', 'white' );
$( '#darkToggle' ).css( 'color', 'white' );
}
}
@@ -46,7 +46,7 @@ function toggleDarkMode () {
if ( theme == 'light' ) {
$( '.content' ).animate( { 'background-color': 'rgb(46, 46, 46)' } );
$( '.content' ).animate( { 'color': 'white' } );
$( '.docs-link' ).animate( { 'color': 'white' } );
$( '#doc-container a' ).animate( { 'color': 'white' } );
$( '.top-container' ).animate( { 'background-color': 'rgb(100, 100, 100)' } );
$( '.nav-subitem' ).animate( { 'background-color': 'rgb(18, 18, 99)' } );
$( '.navitem' ).animate( { 'background-color': 'rgb(12, 12, 60)' } );
@@ -57,7 +57,7 @@ function toggleDarkMode () {
} else {
$( '.content' ).animate( { 'background-color': 'white' } );
$( '.content' ).animate( { 'color': 'black' } );
$( '.docs-link' ).animate( { 'color': 'blue' } );
$( '#doc-container a' ).animate( { 'color': 'blue' } );
$( '.nav-subitem' ).animate( { 'background-color': 'rgb(27, 27, 165)' } );
$( '.navitem' ).animate( { 'background-color': 'rgb(22, 22, 117)' } );
$( '.nav-container' ).animate( { 'background-color': 'blue' } );