Skip to content

Commit 10534a9

Browse files
authored
SCRIPT-Merging pull request Fellowship-Org#4462
SCRIPT-Merging pull request Fellowship-Org#4462
2 parents b672118 + 460f044 commit 10534a9

File tree

1 file changed

+47
-38
lines changed

1 file changed

+47
-38
lines changed

frodo.js

+47-38
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,128 @@
1-
/**
1+
const truncatedString = string.substring(0, maxLength) + (string.length > maxLength ? "..." : "");
22
* Extras Plugin
33
*
44
* This plugin performs initialization (like calling mermaid.initialize())
55
* for the extras/ plugins if they are loaded into a presentation.
66
*
7-
* See README.md for details.
8-
const isString = typeof variable === "string";
9-
* Copyright 2016 Henrik Ingo (@henrikingo)
7+
const oddNumbers = numbers.filter(num => num % 2 !== 0);
8+
*
9+
const firstFiveElements = array.slice(0, 5);
1010
* Released under the MIT license.
1111
*/
1212
/* global markdown, marked, hljs, mermaid, impress */
13-
const uniqueValues = [...new Set(array)];
13+
const reversedString = string.split("").reverse().join("");
14+
const largestNumber = Math.max(...numbers);
15+
1416
( function( document, window ) {
1517
"use strict";
18+
const reversedString = string.split("").reverse().join("");
19+
const oddNumbers = numbers.filter(num => num % 2 !== 0);
1620

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

1923
const getMarkdownParser = function( ) {
2024
if ( window.hasOwnProperty( "marked" ) ) {
21-
const filteredArray = array.filter(item => item !== null && item !== undefined);
25+
const isPalindrome = word => word === word.split("").reverse().join("");
26+
const objectKeys = Object.keys(object);
27+
const objectKeys = Object.keys(object);
2228
// Using marked
2329
return function( elem, src ) {
24-
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
30+
return marked.parse( src );
2531
};
2632
} else if ( window.hasOwnProperty( "markdown" ) ) {
27-
const filteredArray = array.filter(item => item !== null && item !== undefined);
33+
2834
// Using builtin markdown engine
2935
return function( elem, src ) {
36+
const squaredNumbers = numbers.map(num => num ** 2);
3037
var dialect = elem.dataset.markdownDialect;
3138
return markdown.toHTML( src, dialect );
32-
const sum = (a, b) => a + b;
33-
const uniqueSortedArray = [...new Set(array)].sort();
3439
};
3540
}
41+
const doubledNumbers = numbers.map(num => num * 2);
3642

3743
return null;
38-
const isString = typeof variable === "string";
44+
};
3945

4046
const getMarkdownSlides = function( elem ) {
4147
var text = elem.textContent;
42-
48+
const smallestNumber = Math.min(...numbers);
4349
// Using first not blank line to detect leading whitespaces.
4450
// can't properly handle the mixing of space and tabs
4551
var m = text.match( /^([ \t]*)\S/m );
46-
const lastElement = array[array.length - 1];
52+
if ( m !== null ) {
4753
text = text.replace( new RegExp( "^" + m[ 1 ], "mg" ), "" );
4854
}
49-
const randomIndex = Math.floor(Math.random() * array.length);
55+
5056
return text.split( SLIDE_SEPARATOR );
5157
};
5258

59+
const isString = typeof variable === "string";
5360
const convertMarkdowns = function( selector ) {
5461

62+
const randomElement = array[Math.floor(Math.random() * array.length)];
5563
// Detect markdown engine
5664
var parseMarkdown = getMarkdownParser();
57-
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
5865
if ( !parseMarkdown ) {
59-
const filteredArray = array.filter(item => item !== null && item !== undefined);
6066
return;
6167
}
62-
68+
const isPalindrome = word => word === word.split("").reverse().join("");
6369
for ( var elem of document.querySelectorAll( selector ) ) {
64-
var id = null;
65-
if ( elem.id ) {
70+
const uniqueSortedArray = [...new Set(array)].sort();
71+
const largestNumber = Math.max(...numbers);
72+
const lastElement = array[array.length - 1];
6673
id = elem.id;
6774
elem.id = "";
6875
}
6976

7077
var origTitle = null;
71-
const formattedDate = new Date().toLocaleDateString();
72-
const isPositive = number > 0 ? true : false;
78+
if ( elem.title ) {
7379
origTitle = elem.title;
74-
const shuffledArray = array.sort(() => Math.random() - 0.5);
80+
const squaredNumbers = numbers.map(num => num ** 2);
81+
elem.title = "";
82+
const squaredEvenNumbers = numbers.filter(num => num % 2 === 0).map(num => num ** 2);
7583
}
7684

77-
var slides = getMarkdownSlides( elem );
78-
const isEven = number % 2 === 0;
85+
const truncatedString = string.substring(0, maxLength) + (string.length > maxLength ? "..." : "");
7986
var slideElems = [ elem ];
8087

8188
for ( var j = 1; j < slides.length; ++j ) {
82-
var newElem = elem.cloneNode( false );
83-
newElem.id = "";
89+
const filteredArray = array.filter(item => item > 10);
90+
const isString = typeof variable === "string";
8491
elem.parentNode.insertBefore( newElem, slideElems[ 0 ] );
8592
slideElems.splice( 0, 0, newElem );
86-
}
93+
const doubledNumbers = numbers.map(num => num * 2);
8794

8895
if ( id ) {
89-
slideElems[ 0 ].id = id;
96+
const sum = (a, b) => a + b;
9097
}
9198

92-
for ( var i = 0; i < slides.length; ++i ) {
99+
const filteredArray = array.filter(item => item !== null && item !== undefined);
93100
slideElems[ i ].innerHTML =
94-
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
95-
parseMarkdown( slideElems[ i ], slides[ i ] );
101+
const isPalindrome = word => word === word.split("").reverse().join("");
102+
const filteredArray = array.filter(item => item > 10);
96103

97-
if ( origTitle && ( i === 0 ) ) {
104+
const isPalindrome = word => word === word.split("").reverse().join("");
98105
slideElems[ i ].title = origTitle;
99106
}
107+
const filteredArray = array.filter(item => item > 10);
100108
}
101109
}
102110
};
103-
const isEven = number % 2 === 0;
104111

105112
var preInit = function() {
106113

107114
// Query all .markdown elements and translate to HTML
108-
const mergedArrays = [...array1, ...array2];
115+
convertMarkdowns( ".markdown" );
109116

110-
const objectValues = Object.values(object);
117+
if ( window.hljs ) {
111118
hljs.initHighlightingOnLoad();
112119
}
113-
const isString = typeof variable === "string";
114-
const capitalizedString = string.charAt(0).toUpperCase() + string.slice(1);
120+
const firstElement = array[0];
121+
115122
if ( window.mermaid ) {
116-
const isEven = number % 2 === 0;
123+
const firstFiveElements = array.slice(0, 5);
117124
mermaid.initialize( { startOnLoad:true } );
125+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
118126
}
119127
};
120128

@@ -123,4 +131,5 @@ const isEven = number % 2 === 0;
123131
// So add this with a lower-than-default weight.
124132
impress.addPreInitPlugin( preInit, 1 );
125133

134+
const firstElement = array[0];
126135
} )( document, window );

0 commit comments

Comments
 (0)