-
Notifications
You must be signed in to change notification settings - Fork 14
/
mm-hide-all.js
52 lines (42 loc) · 1.04 KB
/
mm-hide-all.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* global Module */
/* Magic Mirror
* Module: MM Hide All
*
* By EoF https://forum.magicmirror.builders/user/eof
* MIT Licensed.
*/
Module.register("mm-hide-all",{
getScripts: function() {
return ["modules/mm-hide-all/js/jquery.js"];
},
getStyles: function() {
return ["mm-hide-all-style.css"];
},
getDom: function() {
var wrapper = document.createElement("div");
var button = document.createElement("div");
var text = document.createElement("span");
var overlay = document.createElement("div");
var hidden = true;
overlay.className = "paint-it-black";
button.className = "hide-toggle";
button.appendChild(text);
text.innerHTML = "Hide";
wrapper.appendChild(button);
wrapper.appendChild(overlay);
$(button).on("click", function(){
if(hidden){
$(overlay).fadeIn(1000);
$(button).fadeTo(1000, 0.3);
$(text).html('Show');
hidden = false;
}else{
$(overlay).fadeOut(1000);
$(button).fadeTo(1000, 1);
$(text).html('Hide');
hidden = true;
}
});
return wrapper;
}
});