Skip to content

Commit a34ab8d

Browse files
authored
Create utilities.js
1 parent bc804de commit a34ab8d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/utilities.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function loadGoogleSheet(link) {
2+
return new Promise((resolve, reject) => {
3+
Tabletop.init({
4+
key: link,
5+
callback: data => {
6+
results = data.Sheet1.elements;
7+
resolve(results);
8+
}
9+
});
10+
});
11+
}
12+
13+
$.fn.shuffleChildren = function() {
14+
$.each(this.get(), function(index, el) {
15+
var $el = $(el);
16+
var $find = $el.children();
17+
$find.sort(function() {
18+
return 0.5 - Math.random();
19+
});
20+
$el.empty();
21+
$find.appendTo($el);
22+
});
23+
};

0 commit comments

Comments
 (0)