-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame.powers.js
executable file
·84 lines (70 loc) · 3.33 KB
/
frame.powers.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
// frame.js specific to foro.powers.cl
function isIE() {
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}
function _setCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function _readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function _eraseCookie(name) {
createCookie(name,"",-1);
}
var svrno;
if (Math.floor(Math.random()*10) > 5) {
svrno = 1;
} else {
svrno = 2;
}
if (_readCookie('chatsrv') == null) {
_setCookie('chatsrv', svrno, 2);
} else {
svrno = _readCookie('chatsrv');
}
if (_readCookie('hidefpchat') != 'true') {
if (isIE()) {
document.write('<div id="chat_frame" style="clear: both; border: 1px dotted; position: fixed; __position: absolute; _top:expression(document.body.scrollTop+document.body.clientHeight-this.clientHeight); bottom: 0; background-color: aliceblue;">');
document.write('<div id="chat_frame_click" style="clear: both;"><a style="color: chocolate; text-decoration: none; font-weight: bold; font-family: verdana; font-size: 1.5em;" onclick="chatClick(this)" href="javascript:void 0;"> Chat! (beta) </a></div>');
document.write('<div style="clear: both; display: none; width: 800px; height: 400px;" id="chat_frame_content"><iframe id="chat_frame_iframe" style="height: 100%; width: 100%;" src="http://svr-' + svrno + '.foro.powers.cl/chat/index.php"></iframe></div>');
document.write('</div>');
} else {
document.write('<div id="chat_frame" style="padding: 8px 8px 2px 8px; border: 2px groove aliceblue; position: fixed; bottom: 0; background-color: aliceblue;">');
document.write('<div id="chat_frame_click"><a style="color: chocolate; text-decoration: none; font-weight: bold; font-family: verdana; font-size: 1.5em;" onclick="chatClick(this)" href="javascript:void 0;"> Chat! </a></div>');
document.write('<div style="border: 0px solid; display: none; height: 100%; width: 100%;" id="chat_frame_content"><iframe id="chat_frame_iframe" style="height: 100%; width: 100%;" src="http://svr-' + svrno + '.foro.powers.cl/chat/index.php"></iframe></div>');
document.write('</div>');
}
}
var chatframe = document.getElementById('chat_frame');
var chatframe_content = document.getElementById('chat_frame_content');
var chatframe_click = document.getElementById('chat_frame_click');
var chatframe_width = chatframe.style.width;
var chatframe_height = chatframe.style.height;
function chatClick(obj) {
if (chatframe_content.style.display == 'block') {
chatframe_content.style.display = 'none';
if (!isIE()) {
chatframe.style.width = chatframe_width;
chatframe.style.height = chatframe_height;
}
} else {
chatframe_content.style.display = 'block';
if (!isIE()) {
chatframe.style.width = window.innerWidth + 'px';
chatframe.style.height = (window.innerHeight / 1.5) + 'px';
}
}
}