-
Notifications
You must be signed in to change notification settings - Fork 2
/
mint.js
143 lines (138 loc) · 5.01 KB
/
mint.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
var Mint = new Object();
Mint.save = function()
{
var now = new Date();
var debug = false; // this is set by php
if (window.location.hash == '#Mint:Debug') { debug = true; };
var path = 'http://fredhq.com/mint/?record&key=546e6830323435584b52396f6762556377655a703230383331';
path = path.replace(/^https?:/, window.location.protocol);
// Loop through the different plug-ins to assemble the query string
for (var developer in this)
{
for (var plugin in this[developer])
{
if (this[developer][plugin] && this[developer][plugin].onsave)
{
path += this[developer][plugin].onsave();
};
};
};
// Slap the current time on there to prevent caching on subsequent page views in a few browsers
path += '&'+now.getTime();
// Redirect to the debug page
if (debug) { window.open(path+'&debug&errors', 'MintLiveDebug'+now.getTime()); return; };
var ie = /*@cc_on!@*/0;
if (!ie && document.getElementsByTagName && (document.createElementNS || document.createElement))
{
var tag = (document.createElementNS) ? document.createElementNS('http://www.w3.org/1999/xhtml', 'script') : document.createElement('script');
tag.type = 'text/javascript';
tag.src = path + '&serve_js';
document.getElementsByTagName('head')[0].appendChild(tag);
}
else if (document.write)
{
document.write('<' + 'script type="text/javascript" src="' + path + '&serve_js"><' + '/script>');
};
};
if (!Mint.SI) { Mint.SI = new Object(); }
Mint.SI.Referrer =
{
onsave : function()
{
var encoded = 0;
if (typeof Mint_SI_DocumentTitle == 'undefined') { Mint_SI_DocumentTitle = document.title; }
else { encoded = 1; };
var referer = (window.decodeURI)?window.decodeURI(document.referrer):document.referrer;
var resource = (window.decodeURI)?window.decodeURI(document.URL):document.URL;
return '&referer=' + escape(referer) + '&resource=' + escape(resource) + '&resource_title=' + escape(Mint_SI_DocumentTitle) + '&resource_title_encoded=' + encoded;
}
};
if (!Mint.SI) { Mint.SI = new Object(); }
Mint.SI.UserAgent007 =
{
versionHigh : 16,
flashVersion : 0,
resolution : '0x0',
detectFlashVersion : function ()
{
var ua = navigator.userAgent.toLowerCase();
if (navigator.plugins && navigator.plugins.length)
{
var p = navigator.plugins['Shockwave Flash'];
if (typeof p == 'object')
{
for (var i=this.versionHigh; i>=3; i--)
{
if (p.description && p.description.indexOf(' ' + i + '.') != -1) { this.flashVersion = i; break; }
}
}
}
else if (ua.indexOf("msie") != -1 && ua.indexOf("win")!=-1 && parseInt(navigator.appVersion) >= 4 && ua.indexOf("16bit")==-1)
{
var vb = '<scr' + 'ipt language="VBScript"\> \nOn Error Resume Next \nDim obFlash \nFor i = ' + this.versionHigh + ' To 3 Step -1 \n Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n If IsObject(obFlash) Then \n Mint.SI.UserAgent007.flashVersion = i \n Exit For \n End If \nNext \n<'+'/scr' + 'ipt\> \n';
document.write(vb);
}
else if (ua.indexOf("webtv/2.5") != -1) this.flashVersion = 3;
else if (ua.indexOf("webtv") != -1) this.flashVersion = 2;
return this.flashVersion;
},
onsave : function()
{
if (this.flashVersion == this.versionHigh) { this.flashVersion = 0; };
this.resolution = screen.width+'x'+screen.height;
return '&resolution=' + this.resolution + '&flash_version=' + this.flashVersion;
}
};
Mint.SI.UserAgent007.detectFlashVersion();
if (!Mint.SI) { Mint.SI = new Object(); }
Mint.SI.RealEstate =
{
onsave : function()
{
var width = -1;
var height = -1;
if (typeof window.innerWidth != "undefined")
{
width = window.innerWidth;
height = window.innerHeight;
}
else if (document.documentElement && typeof document.documentElement.offsetWidth != "undefined" && document.documentElement.offsetWidth != 0)
{
width = document.documentElement.offsetWidth;
height = document.documentElement.offsetHeight;
}
else if (document.body && typeof document.body.offsetWidth != "undefined")
{
width = d.body.offsetWidth;
height = d.body.offsetHeight;
};
return '&window_width=' + width + '&window_height=' + height;
}
};
if (!Mint.TK) {
Mint.TK = new Object();
}
Mint.TK.Durations = {
now : new Date(),
recalc : function() {
var then = new Date();
var img = new Image();
var path = 'http://fredhq.com/mint/pepper/tillkruess/durations/recalc.php?token=372248358&time=';
path += Math.round((then.getTime() - Mint.TK.Durations.now.getTime()) / 1000);
img.src = path.replace(/^https?:/, window.location.protocol);
},
onsave : function() {
return '&token=372248358';
}
};
window.setInterval('Mint.TK.Durations.recalc()', 15 * 1000);
if (window.addEventListener) {
window.addEventListener('unload', Mint.TK.Durations.recalc, false);
} else if (window.attachEvent) {
window['eunload' + Mint.TK.Durations.recalc] = Mint.TK.Durations.recalc;
window['unload' + Mint.TK.Durations.recalc] = function() {
window['eunload' + Mint.TK.Durations.recalc](window.event);
}
window.attachEvent('onunload', window['unload' + Mint.TK.Durations.recalc]);
}
Mint.save();