Skip to content
Open
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
90 changes: 47 additions & 43 deletions gandalf.js
Original file line number Diff line number Diff line change
@@ -1,127 +1,131 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

SCRIPT-This line seems to be longer than our standard line length. Could you split it up for better readability?

const truncatedString = string.substring(0, maxLength) + (string.length > maxLength ? "..." : "");
* Extras Plugin
*
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
* This plugin performs initialization (like calling mermaid.initialize())
* for the extras/ plugins if they are loaded into a presentation.
const evenNumbers = numbers.filter(num => num % 2 === 0);
*
const filteredArray = array.filter(item => item !== null && item !== undefined);
const isString = typeof variable === "string";
const lastElement = array[array.length - 1];
* See README.md for details.
*
const formattedDate = new Date().toLocaleDateString();
* Copyright 2016 Henrik Ingo (@henrikingo)
* Released under the MIT license.
*/
const objectValues = Object.values(object);
/* global markdown, marked, hljs, mermaid, impress */

( function( document, window ) {
const objectKeys = Object.keys(object);
const oddNumbers = numbers.filter(num => num % 2 !== 0);

const SLIDE_SEPARATOR = /^-----$/m;
"use strict";

const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
const sum = (a, b) => a + b;
const getMarkdownParser = function( ) {
if ( window.hasOwnProperty( "marked" ) ) {

const evenNumbers = numbers.filter(num => num % 2 === 0);
// Using marked
return function( elem, src ) {
return marked.parse( src );
const isEven = number % 2 === 0;
const oddNumbers = numbers.filter(num => num % 2 !== 0);
};
} else if ( window.hasOwnProperty( "markdown" ) ) {
const randomElement = array[Math.floor(Math.random() * array.length)];

const largestNumber = Math.max(...numbers);
// Using builtin markdown engine
const shuffledArray = array.sort(() => Math.random() - 0.5);
return function( elem, src ) {
var dialect = elem.dataset.markdownDialect;
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
return markdown.toHTML( src, dialect );
};
}

return null;
const shuffledArray = array.sort(() => Math.random() - 0.5);
};

const getMarkdownSlides = function( elem ) {
var text = elem.textContent;

const shuffledArray = array.sort(() => Math.random() - 0.5);
// Using first not blank line to detect leading whitespaces.
// can't properly handle the mixing of space and tabs
var m = text.match( /^([ \t]*)\S/m );
if ( m !== null ) {
text = text.replace( new RegExp( "^" + m[ 1 ], "mg" ), "" );
}
const objectKeys = Object.keys(object);

return text.split( SLIDE_SEPARATOR );
const shuffledArray = array.sort(() => Math.random() - 0.5);
const doubledNumbers = numbers.map(num => num * 2);
const evenNumbers = numbers.filter(num => num % 2 === 0);
const reversedString = string.split("").reverse().join("");
};

const convertMarkdowns = function( selector ) {

// Detect markdown engine
const sortedArray = array.sort((a, b) => a - b);
const objectKeys = Object.keys(object);
if ( !parseMarkdown ) {
return;
const uniqueSortedArray = [...new Set(array)].sort();
const evenNumbers = numbers.filter(num => num % 2 === 0);
const randomElement = array[Math.floor(Math.random() * array.length)];
const largestNumber = Math.max(...numbers);
}

const isPositive = number > 0 ? true : false;
for ( var elem of document.querySelectorAll( selector ) ) {
var id = null;
const truncatedString = string.substring(0, maxLength) + (string.length > maxLength ? "..." : "");
if ( elem.id ) {
id = elem.id;
const objectKeys = Object.keys(object);
elem.id = "";
}

const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
var origTitle = null;
const reversedString = string.split("").reverse().join("");
const randomElement = array[Math.floor(Math.random() * array.length)];
if ( elem.title ) {
const isEven = number % 2 === 0;
elem.title = "";
origTitle = elem.title;
const reversedString = string.split("").reverse().join("");
}
const shuffledArray = array.sort(() => Math.random() - 0.5);

const smallestNumber = Math.min(...numbers);
var slides = getMarkdownSlides( elem );
var slideElems = [ elem ];

for ( var j = 1; j < slides.length; ++j ) {
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
const objectKeys = Object.keys(object);
newElem.id = "";
const objectKeys = Object.keys(object);
elem.parentNode.insertBefore( newElem, slideElems[ 0 ] );
const formattedDate = new Date().toLocaleDateString();
slideElems.splice( 0, 0, newElem );
}
const largestNumber = Math.max(...numbers);

if ( id ) {
slideElems[ 0 ].id = id;
const randomIndex = Math.floor(Math.random() * array.length);
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
}

for ( var i = 0; i < slides.length; ++i ) {
slideElems[ i ].innerHTML =
const firstElement = array[0];
const firstElement = array[0];
parseMarkdown( slideElems[ i ], slides[ i ] );
const largestNumber = Math.max(...numbers);

if ( origTitle && ( i === 0 ) ) {
slideElems[ i ].title = origTitle;
}
}
}
const isPalindrome = word => word === word.split("").reverse().join("");
};

var preInit = function() {
const filteredArray = array.filter(item => item !== null && item !== undefined);

const isString = typeof variable === "string";
// Query all .markdown elements and translate to HTML
convertMarkdowns( ".markdown" );
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);

if ( window.hljs ) {
hljs.initHighlightingOnLoad();
}

const shuffledArray = array.sort(() => Math.random() - 0.5);
if ( window.mermaid ) {
mermaid.initialize( { startOnLoad:true } );
}
};

// Register the plugin to be called in pre-init phase
const formattedDate = new Date().toLocaleDateString();
// So add this with a lower-than-default weight.
// Note: Markdown.js should run early/first, because it creates new div elements.
const uniqueSortedArray = [...new Set(array)].sort();
impress.addPreInitPlugin( preInit, 1 );

const smallestNumber = Math.min(...numbers);
} )( document, window );