This repository has been archived by the owner on May 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
skin.js
102 lines (82 loc) · 2.84 KB
/
skin.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
Scratch Wiki Skin script
*/
//get the element from an id, with functions to write, add, show, hide, addclass, delclass
function el(id) {
var h = document.getElementById(id);
//if no element exists with that id, return null
if(!h){
return h;
}
h.write = function(o) {this.innerHTML = o;};
h.add = function(o) {this.innerHTML += o;};
h.show = function(o) {this.style.display = 'block';};
h.hide = function(o) {this.style.display = 'none';};
h.addclass = function(c) {this.className+=' '+c;this.className=this.className.trim();};
h.delclass = function(c) {this.className=this.className.replace(c,'').replace(' ',' ').trim();};
return h;
}
window.onload = function() {
//when pencil icon clicked, display dropdown
el('pagefctbtn').onclick = function() {
if (el('pagefctdropdown').style.display!='block') {
el('pagefctbtn').addclass('open');
el('pagefctdropdown').show();
} else {
el('pagefctbtn').delclass('open');
el('pagefctdropdown').hide();
}
}
//when mouse moved away, hide dropdown
el('pagefctdropdown').onmouseout = function(e) {
if (!e) var e = window.event;
if (!e.toElement) e.toElement = e.relatedTarget;
if (' ul li img a'.indexOf(e.toElement.tagName.toLowerCase())<0) {
el('pagefctbtn').delclass('open');
el('pagefctdropdown').hide();
}
}
//if user is logged in and toggle is showing, add dropdown functions
if(el('userfcttoggle')){
//if username toggle clicked, display dropdown
el('userfcttoggle').onclick = function() {
if (el('userfctdropdown').style.display!='block') {
el('userfcttoggle').addclass('open');
el('userfctdropdown').show();
} else {
el('userfcttoggle').delclass('open');
el('userfctdropdown').hide();
}
}
//when mouse moved away, hide dropdown
el('userfctdropdown').onmouseout = function(e) {
if (!e) var e = window.event;
if (!e.toElement) e.toElement = e.relatedTarget;
if (' ul li img a'.indexOf(e.toElement.tagName.toLowerCase())<0) {
el('userfcttoggle').delclass('open');
el('userfctdropdown').hide();
}
};
}
}
/*
function showpersonallinks() {
document.getElementById('scratchpersonallinks').style.visibility = 'visible';
document.getElementById('scratchpersonallinks').style.display = 'block';
}
function hidepersonallinks() {
document.getElementById('scratchpersonallinks').style.visibility = 'hidden';
document.getElementById('scratchpersonallinks').style.display = 'none';
}
*/
/*
//google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3792496-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
*/