-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbehindthescenes.js
More file actions
executable file
·91 lines (79 loc) · 2.26 KB
/
behindthescenes.js
File metadata and controls
executable file
·91 lines (79 loc) · 2.26 KB
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
var agt = navigator.userAgent.toLowerCase();
var is_ie = (agt.indexOf('msie') != -1);
var is_ie5 = (agt.indexOf('msie 5') != -1);
/**
* send a GET behind the scenes to url
*
*/
function SendRequest(url) {
var xmlhttp = CreateXmlHttpReq(DummyHandler);
++uniqnum_counter;
XmlHttpGET(xmlhttp, url + "&rand=" + uniqnum_counter);
}
function CreateXmlHttpReq(handler) {
var xmlhttp = null;
if (is_ie) {
var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
try {
xmlhttp = new ActiveXObject(control);
xmlhttp.onreadystatechange = handler;
} catch(e) {
alert("You need to enable active scripting and activeX controls");
}
} else {
xmlhttp = new XMLHttpRequest();
xmlhttp.onload = handler;
xmlhttp.onerror = handler;
}
return xmlhttp;
}
var uniqnum_counter = (new Date).getTime();
function DummyHandler() { }
function twitterit(title,url,username,password) {
var tinyurl = SendTINYURLRequest(url);
SendTwitterRequest(title,tinyurl);
}
function SendTINYURLRequest(url) {
var xmlhttp = CreateXmlHttpReq(DummyHandler);
if (!xmlhttp) {
alert('Error creating XMLHttpRequest()');
return false;
}
var tinyurl = TINYURLHttpGET(xmlhttp, 'createtinyurl.php?url=' + url);
return tinyurl;
}
function SendTwitterRequest(title,url) {
var xmlhttp = CreateXmlHttpReq(DummyHandler);
if (!xmlhttp) {
alert('Error creating XMLHttpRequest()');
return false;
}
var tweet = TwitterHttpGET(xmlhttp, 'createtweet.php?title=' + title + '&url=' + url);
return tweet;
}
function TwitterHttpGET(xmlhttp, url) {
xmlhttp.open('GET', url, false);
xmlhttp.send(null);
tinyurl = xmlhttp.responseText;
if (xmlhttp.status == 200) { return tinyurl; }
else return xmlhttp.status;
}
function TINYURLHttpGET(xmlhttp, url) {
xmlhttp.open('GET', url, false);
xmlhttp.send(null);
tinyurl = xmlhttp.responseText;
if (xmlhttp.status == 200) { return tinyurl; }
else return xmlhttp.status;
}
function XmlHttpGET(xmlhttp, url) {
xmlhttp.open('GET', url, true);
xmlhttp.send(null);
}
function pressit(wpsite,title,url) {
var d=document;
var w=window;
var g='http://' + wpsite + '/wp-admin/press-this.php?u='+url+'&t='+title+'&v=2';
if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){d.location.href=g;}
setTimeout(a,0);
void(0);
}