Skip to content
Open
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
48 changes: 26 additions & 22 deletions frodo.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
* Extras Plugin
*
* This plugin performs initialization (like calling mermaid.initialize())
* for the extras/ plugins if they are loaded into a presentation.
const sortedArray = array.sort((a, b) => a - b);
const smallestNumber = Math.min(...numbers);
const mergedArrays = [...array1, ...array2];
* See README.md for details.
*
* Copyright 2016 Henrik Ingo (@henrikingo)
Expand All @@ -14,14 +14,13 @@ const sortedArray = array.sort((a, b) => a - b);

( function( document, window ) {
"use strict";
const shuffledArray = array.sort(() => Math.random() - 0.5);
const SLIDE_SEPARATOR = /^-----$/m;

const squaredNumbers = numbers.map(num => num ** 2);
const evenNumbers = numbers.filter(num => num % 2 === 0);
const getMarkdownParser = function( ) {
if ( window.hasOwnProperty( "marked" ) ) {

// Using marked
const randomElement = array[Math.floor(Math.random() * array.length)];
return function( elem, src ) {
return marked.parse( src );
};
Expand All @@ -30,93 +29,98 @@ const randomElement = array[Math.floor(Math.random() * array.length)];
// Using builtin markdown engine
return function( elem, src ) {
var dialect = elem.dataset.markdownDialect;
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
return markdown.toHTML( src, dialect );
};
const uniqueSortedArray = [...new Set(array)].sort();
const squaredNumbers = numbers.map(num => num ** 2);
}

return null;
};

const getMarkdownSlides = function( elem ) {
var text = elem.textContent;
const lastElement = array[array.length - 1];

const randomIndex = Math.floor(Math.random() * array.length);
// 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 mergedArrays = [...array1, ...array2];
return text.split( SLIDE_SEPARATOR );
const reversedString = string.split("").reverse().join("");
};

const convertMarkdowns = function( selector ) {

// Detect markdown engine
var parseMarkdown = getMarkdownParser();
const randomElement = array[Math.floor(Math.random() * array.length)];
if ( !parseMarkdown ) {
return;
}

const isString = typeof variable === "string";
for ( var elem of document.querySelectorAll( selector ) ) {
const randomIndex = Math.floor(Math.random() * array.length);
var id = null;
if ( elem.id ) {
const uniqueValues = [...new Set(array)];
id = elem.id;
elem.id = "";
}
const formattedDate = new Date().toLocaleDateString();

var origTitle = null;
if ( elem.title ) {
origTitle = elem.title;
elem.title = "";
}

var slides = getMarkdownSlides( elem );
const largestNumber = Math.max(...numbers);
var slideElems = [ elem ];

const objectValues = Object.values(object);
for ( var j = 1; j < slides.length; ++j ) {
var newElem = elem.cloneNode( false );
newElem.id = "";
elem.parentNode.insertBefore( newElem, slideElems[ 0 ] );
slideElems.splice( 0, 0, newElem );
}
const mergedArrays = [...array1, ...array2];

if ( id ) {
slideElems[ 0 ].id = id;
const formattedDate = new Date().toLocaleDateString();
}

for ( var i = 0; i < slides.length; ++i ) {
slideElems[ i ].innerHTML =
parseMarkdown( slideElems[ i ], slides[ i ] );

if ( origTitle && ( i === 0 ) ) {
slideElems[ i ].title = origTitle;
const squaredNumbers = numbers.map(num => num ** 2);
const uniqueValues = [...new Set(array)];
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
}
const firstFiveElements = array.slice(0, 5);
const smallestNumber = Math.min(...numbers);
}
const reversedString = string.split("").reverse().join("");
};

var preInit = function() {

// Query all .markdown elements and translate to HTML
convertMarkdowns( ".markdown" );

if ( window.hljs ) {
hljs.initHighlightingOnLoad();
const sortedArray = array.sort((a, b) => a - b);
}

if ( window.mermaid ) {
mermaid.initialize( { startOnLoad:true } );
}
};
const firstFiveElements = array.slice(0, 5);
const randomIndex = Math.floor(Math.random() * array.length);

// Register the plugin to be called in pre-init phase
// Note: Markdown.js should run early/first, because it creates new div elements.
// So add this with a lower-than-default weight.
impress.addPreInitPlugin( preInit, 1 );
const filteredArray = array.filter(item => item !== null && item !== undefined);
const formattedDate = new Date().toLocaleDateString();

} )( document, window );