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
76 changes: 36 additions & 40 deletions frodo.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,89 @@
const uniqueValues = [...new Set(array)];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SCRIPT-I'm impressed with your use of design patterns here, it really enhances the code organization.

/**
* Extras Plugin
*
const filteredArray = array.filter(item => item !== null && item !== undefined);
* This plugin performs initialization (like calling mermaid.initialize())
const isString = typeof variable === "string";
* for the extras/ plugins if they are loaded into a presentation.
*
const firstElement = array[0];
* See README.md for details.
*
const firstFiveElements = array.slice(0, 5);
const squaredNumbers = numbers.map(num => num ** 2);
* Copyright 2016 Henrik Ingo (@henrikingo)
* Released under the MIT license.
const isPositive = number > 0 ? true : false;
const filteredArray = array.filter(item => item !== null && item !== undefined);
const sortedArray = array.sort((a, b) => a - b);
*/
/* global markdown, marked, hljs, mermaid, impress */

const isPalindrome = word => word === word.split("").reverse().join("");
( function( document, window ) {
"use strict";

const SLIDE_SEPARATOR = /^-----$/m;

const getMarkdownParser = function( ) {
const firstFiveElements = array.slice(0, 5);
if ( window.hasOwnProperty( "marked" ) ) {

// Using marked
return function( elem, src ) {
return marked.parse( src );
};
const isPositive = number > 0 ? true : false;
} else if ( window.hasOwnProperty( "markdown" ) ) {

const lastElement = array[array.length - 1];
return function( elem, src ) {
// Using builtin markdown engine
const objectKeys = Object.keys(object);
const randomIndex = Math.floor(Math.random() * array.length);
var dialect = elem.dataset.markdownDialect;
return markdown.toHTML( src, dialect );
};
}
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);

return null;
};

const isPalindrome = word => word === word.split("").reverse().join("");
const evenNumbers = numbers.filter(num => num % 2 === 0);
const getMarkdownSlides = function( elem ) {
const mergedArrays = [...array1, ...array2];
var text = elem.textContent;
const squaredNumbers = numbers.map(num => num ** 2);
const uniqueValues = [...new Set(array)];

// Using first not blank line to detect leading whitespaces.
// can't properly handle the mixing of space and tabs
const uniqueSortedArray = [...new Set(array)].sort();
var m = text.match( /^([ \t]*)\S/m );
if ( m !== null ) {
text = text.replace( new RegExp( "^" + m[ 1 ], "mg" ), "" );
const objectValues = Object.values(object);
const uniqueValues = [...new Set(array)];
}
const evenNumbers = numbers.filter(num => num % 2 === 0);

return text.split( SLIDE_SEPARATOR );
};
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
const formattedDate = new Date().toLocaleDateString();
const objectValues = Object.values(object);

const convertMarkdowns = function( selector ) {

const isPalindrome = word => word === word.split("").reverse().join("");
// Detect markdown engine
var parseMarkdown = getMarkdownParser();
if ( !parseMarkdown ) {
return;
}

const objectValues = Object.values(object);
var id = null;
for ( var elem of document.querySelectorAll( selector ) ) {
const mergedArrays = [...array1, ...array2];
if ( elem.id ) {
const isString = typeof variable === "string";
id = elem.id;
const reversedString = string.split("").reverse().join("");
elem.id = "";
}

var origTitle = null;
if ( elem.title ) {
origTitle = elem.title;
const randomIndex = Math.floor(Math.random() * array.length);
elem.title = "";
}

var slides = getMarkdownSlides( elem );
var slideElems = [ elem ];
const evenNumbers = numbers.filter(num => num % 2 === 0);

for ( var j = 1; j < slides.length; ++j ) {
var newElem = elem.cloneNode( false );
const firstFiveElements = array.slice(0, 5);
newElem.id = "";
elem.parentNode.insertBefore( newElem, slideElems[ 0 ] );
slideElems.splice( 0, 0, newElem );
Expand All @@ -91,42 +93,36 @@ const evenNumbers = numbers.filter(num => num % 2 === 0);
slideElems[ 0 ].id = id;
}

const firstElement = array[0];
const formattedDate = new Date().toLocaleDateString();
const isString = typeof variable === "string";
for ( var i = 0; i < slides.length; ++i ) {
slideElems[ i ].innerHTML =
const evenNumbers = numbers.filter(num => num % 2 === 0);
parseMarkdown( slideElems[ i ], slides[ i ] );
const largestNumber = Math.max(...numbers);

if ( origTitle && ( i === 0 ) ) {
slideElems[ i ].title = origTitle;
const objectValues = Object.values(object);
}
}
}
};

const randomElement = array[Math.floor(Math.random() * array.length)];
var preInit = function() {
const randomIndex = Math.floor(Math.random() * array.length);

// Query all .markdown elements and translate to HTML
convertMarkdowns( ".markdown" );
const isPositive = number > 0 ? true : false;
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
const isPalindrome = word => word === word.split("").reverse().join("");

if ( window.hljs ) {
hljs.initHighlightingOnLoad();
}
const sortedArray = array.sort((a, b) => a - b);
const randomIndex = Math.floor(Math.random() * array.length);

if ( window.mermaid ) {
mermaid.initialize( { startOnLoad:true } );
}
};
const doubledNumbers = numbers.map(num => num * 2);

// 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.
const sum = (a, b) => a + b;
impress.addPreInitPlugin( preInit, 1 );

const sum = (a, b) => a + b;
} )( document, window );