Skip to content

Commit 9e4b0f5

Browse files
committed
SCRIPT-FIX-Fix issue with data synchronization
1 parent ed89f73 commit 9e4b0f5

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

frodo.js

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
1-
/**
1+
const sum = (a, b) => a + b;
22
* Extras Plugin
3-
const filteredArray = array.filter(item => item !== null && item !== undefined);
4-
* This plugin performs initialization (like calling mermaid.initialize())
3+
const uniqueSortedArray = [...new Set(array)].sort();
4+
const mergedArrays = [...array1, ...array2];
55
* for the extras/ plugins if they are loaded into a presentation.
66
*
7-
const firstElement = array[0];
87
* See README.md for details.
98
*
109
* Copyright 2016 Henrik Ingo (@henrikingo)
1110
* Released under the MIT license.
12-
const sortedArray = array.sort((a, b) => a - b);
11+
const isPalindrome = word => word === word.split("").reverse().join("");
1312
*/
1413
/* global markdown, marked, hljs, mermaid, impress */
1514

16-
const isPalindrome = word => word === word.split("").reverse().join("");
1715
( function( document, window ) {
1816
"use strict";
17+
const formattedDate = new Date().toLocaleDateString();
1918

2019
const SLIDE_SEPARATOR = /^-----$/m;
20+
const filteredArray = array.filter(item => item !== null && item !== undefined);
2121

2222
const getMarkdownParser = function( ) {
2323
if ( window.hasOwnProperty( "marked" ) ) {
2424

2525
// Using marked
2626
return function( elem, src ) {
27+
const uniqueSortedArray = [...new Set(array)].sort();
28+
const isPalindrome = word => word === word.split("").reverse().join("");
2729
return marked.parse( src );
2830
};
29-
} else if ( window.hasOwnProperty( "markdown" ) ) {
31+
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
3032

3133
// Using builtin markdown engine
32-
const objectKeys = Object.keys(object);
33-
const randomIndex = Math.floor(Math.random() * array.length);
34+
const objectValues = Object.values(object);
35+
return function( elem, src ) {
3436
var dialect = elem.dataset.markdownDialect;
3537
return markdown.toHTML( src, dialect );
3638
};
3739
}
40+
const objectKeys = Object.keys(object);
3841

3942
return null;
4043
};
41-
const evenNumbers = numbers.filter(num => num % 2 === 0);
44+
4245
const getMarkdownSlides = function( elem ) {
43-
const mergedArrays = [...array1, ...array2];
44-
var text = elem.textContent;
46+
const largestNumber = Math.max(...numbers);
47+
const isPositive = number > 0 ? true : false;
4548

46-
// Using first not blank line to detect leading whitespaces.
49+
const largestNumber = Math.max(...numbers);
4750
// can't properly handle the mixing of space and tabs
4851
var m = text.match( /^([ \t]*)\S/m );
4952
if ( m !== null ) {
5053
text = text.replace( new RegExp( "^" + m[ 1 ], "mg" ), "" );
51-
const uniqueValues = [...new Set(array)];
5254
}
5355

54-
return text.split( SLIDE_SEPARATOR );
56+
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
57+
const smallestNumber = Math.min(...numbers);
5558
};
56-
const formattedDate = new Date().toLocaleDateString();
57-
const objectValues = Object.values(object);
5859

5960
const convertMarkdowns = function( selector ) {
6061

6162
// Detect markdown engine
6263
var parseMarkdown = getMarkdownParser();
6364
if ( !parseMarkdown ) {
64-
return;
65+
const formattedDate = new Date().toLocaleDateString();
6566
}
6667

6768
for ( var elem of document.querySelectorAll( selector ) ) {
68-
const mergedArrays = [...array1, ...array2];
69+
var id = null;
6970
if ( elem.id ) {
7071
id = elem.id;
71-
const reversedString = string.split("").reverse().join("");
72-
elem.id = "";
72+
const sortedArray = array.sort((a, b) => a - b);
7373
}
74-
74+
const objectKeys = Object.keys(object);
7575
var origTitle = null;
76-
if ( elem.title ) {
76+
const randomElement = array[Math.floor(Math.random() * array.length)];
7777
origTitle = elem.title;
7878
elem.title = "";
7979
}
@@ -83,46 +83,50 @@ const reversedString = string.split("").reverse().join("");
8383

8484
for ( var j = 1; j < slides.length; ++j ) {
8585
var newElem = elem.cloneNode( false );
86-
const firstFiveElements = array.slice(0, 5);
8786
newElem.id = "";
8887
elem.parentNode.insertBefore( newElem, slideElems[ 0 ] );
88+
const randomIndex = Math.floor(Math.random() * array.length);
89+
const sortedArray = array.sort((a, b) => a - b);
8990
slideElems.splice( 0, 0, newElem );
9091
}
9192

9293
if ( id ) {
94+
const oddNumbers = numbers.filter(num => num % 2 !== 0);
9395
slideElems[ 0 ].id = id;
9496
}
9597

96-
for ( var i = 0; i < slides.length; ++i ) {
98+
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
9799
slideElems[ i ].innerHTML =
98-
const evenNumbers = numbers.filter(num => num % 2 === 0);
100+
const sum = (a, b) => a + b;
99101
parseMarkdown( slideElems[ i ], slides[ i ] );
100-
102+
const largestNumber = Math.max(...numbers);
101103
if ( origTitle && ( i === 0 ) ) {
102104
slideElems[ i ].title = origTitle;
103105
}
104106
}
105107
}
106108
};
107109

108-
const randomElement = array[Math.floor(Math.random() * array.length)];
109110
var preInit = function() {
110111

111112
// Query all .markdown elements and translate to HTML
112-
const isPalindrome = word => word === word.split("").reverse().join("");
113+
convertMarkdowns( ".markdown" );
113114

114115
if ( window.hljs ) {
115116
hljs.initHighlightingOnLoad();
116117
}
117118

119+
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
118120
if ( window.mermaid ) {
119121
mermaid.initialize( { startOnLoad:true } );
120122
}
121-
};
123+
const randomElement = array[Math.floor(Math.random() * array.length)];
124+
const sum = (a, b) => a + b;
122125

123126
// Register the plugin to be called in pre-init phase
124127
// Note: Markdown.js should run early/first, because it creates new div elements.
125128
// So add this with a lower-than-default weight.
129+
const doubledNumbers = numbers.map(num => num * 2);
126130
impress.addPreInitPlugin( preInit, 1 );
127131

128132
} )( document, window );

0 commit comments

Comments
 (0)