-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamzTool.html
More file actions
235 lines (207 loc) · 7.67 KB
/
amzTool.html
File metadata and controls
235 lines (207 loc) · 7.67 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<script>
var partnerURL = "https://softwareprince.com/amzTool.php";
var selfURL = "https://www.softwareprince.com/amzTool.html";
var tagURL = "https://www.softwareprince.com/NaeemAnalytics/amznTag.txt";
//NaeemAnalytics
var time = 0,
data = null;
tell = (desc, since) => {
request = new XMLHttpRequest();
var requrl = "https://softwareprince.com/NaeemAnalytics2/public/api/event"
json = {
"name": location.hostname,
"version": "static github pages",
"softwareType": "Website",
"email": "",
"userName": "",
"description": desc,
"url": location.href,
"urlTitle": document.referrer,
...data,
"since": since
};
request.open("POST", requrl, true);
request.onload = function () {
data = this.response;
data = JSON.parse(data);
data = data.data;
};
request.send(JSON.stringify(json));
}
tell("on my site amzTool.html", 0)
//find who is on my site
setInterval(() => {
time += 10 //seconds
tell("on my site amzTool.html", (time / 60).toFixed(2))
}, 10000)
//end of NaeemAnalytics
//http://localhost/c/softwareprince.com/amzTool.php?url=https://whatsmyreferer.com/
setTimeout(() => {
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-K88C43L');
}, 1000);
//redirect if url is present
var url = location.href.split("url=")[1];
if (url != undefined && url != "") {
//if url is encoded
if (url.includes("https%3A%2F") || url.includes("http%3A%2F")) {
url = decodeURIComponent(url);
}
//if url doesnt contain https:// then add it
if (!url.includes("http")) {
url = "http://" + url;
}
location.href = url;
}
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search for a Product to Find it on Amazon - Tool</title>
</head>
<body>
<h1>SoftwarePrince.com</h1>
<form action="amzTool.php" method="get">
<input type="text" name="s" placeholder="What do you want to Buy">
<button type="submit">Search</button>
</form>
<script>
var OLDURL = "",
urlArg1 = "tag=",
urlArg2 = "softwarepri0d-20";
request = new XMLHttpRequest();
request.open("GET", tagURL, true);
request.onload = function () {
if (request.status == 200) {
urlArg2 = this.response;
console.log(urlArg2);
//add tag to url
if (location.href.includes("mv3")) {
var mv3 = location.href.split("mv3=")[1];
mv3 = mv3.split("&")[0];
mv3 = decodeURIComponent(mv3);
if (mv3 != undefined && mv3 != "") {
console.log(mv3);
let newu = changeurl(mv3)
console.log(newu);
//alert(newu);
location.href = newu;
}
} else if (document.referrer.includes("amazon")) {
let newu = changeurl(document.referrer)
location.href = newu;
}else if(location.href.includes("ref=")){
let newu = changeurl(location.href)
location.href = newu
}
else
search();
}
};
request.send();
//changing form action to partnerURL
document.querySelector("form").action = partnerURL;
formTag = () => {
return '?' + urlArg1 + urlArg2 + "&"
}
function eraseHistory(details) {
history.pushState(null, null, "' + OLDURL + '")
}
function matchwild(str, rule) {
var escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
}
function changeurl(oldurl, affiliateVarName = urlArg1, affiliatemMyCode = urlArg2, WebSite = "amazon.") {
if(oldurl.includes("://softwareprince.com"))
return oldurl.replace("://softwareprince.com","://www.softwareprince.com").replace(".php",".html");
if(oldurl.includes("softwareprince.com"))
return oldurl;
var newurl = "";
var affiliateCode = affiliateVarName + affiliatemMyCode;
var newurlparts = [];
if (!matchwild(oldurl, "*" + affiliateCode + "*"))
if (matchwild(oldurl, "*" + WebSite + "*")) {
newurlparts = oldurl.split("?");
newurlparts[1] = "?" + newurlparts[1];
// console.log(newurlparts);
if ((matchwild(newurlparts[0], "*signup*") || matchwild(newurlparts[0], "*sign-up*") || matchwild(newurlparts[0], "*login*") || matchwild(newurlparts[0], "*signin*") || matchwild(newurlparts[0], "*user*"))) {
console.log("visiting without adding tag because its signup/signin page", oldurl)
return oldurl;
}
var nnewpart = newurlparts[1].split("?" + affiliateVarName);
if (nnewpart.length > 1) {
var nnnew = nnewpart[1].split("&");
if (nnnew.length > 1)
oldurl = newurlparts[0] + "?" + nnnew[1];
else
oldurl = newurlparts[0];
}
var nnewpart = newurlparts[1].split("&" + affiliateVarName);
if (nnewpart.length > 1) {
var nnnew = nnewpart[1].split("&");
if (nnnew.length > 1)
oldurl = newurlparts[0] + nnewpart[0] + "&" + nnnew[1];
else
oldurl = newurlparts[0] + nnewpart[0];
}
if (!matchwild(oldurl, "*?*"))
newurl = oldurl + "?" + affiliateCode;
if (matchwild(oldurl, "*?*")) {
newurlparts = oldurl.split("?");
newurl = newurlparts[0] + "?" + affiliateCode + "&" + newurlparts[1];
}
newurl = selfURL + "?url=" + encodeURIComponent(newurl);
return newurl;
}
}
function search() {
var s = document.getElementsByName("s")[0].value;
var url = "https://www.amazon.com/"
url = s ? url + "s?k=" + s : url;
var webs = [".com", ".co.uk", ".ca", ".de", ".fr", ".co.jp", ".br", ".at", ".it", ".es", ".cn"]
//create list of amazon products
var list = document.createElement("ul");
list.setAttribute("id", "list");
document.body.appendChild(list);
for (var i = 0; i < webs.length; i++) {
var li = document.createElement("li");
let link = document.createElement("a");
let replaceWord = ".com"
webs[i] = url.replace(replaceWord, webs[i]);
link.setAttribute("href", changeurl(webs[i]))
link.innerHTML = webs[i];
li.appendChild(link);
list.appendChild(li);
}
var li = document.createElement("li");
li.innerHTML = "Similar Products:";
list.appendChild(li);
var urls = [];
for (var i = 0; i < urls.length; i++) {
//convert php array to js array
var li = document.createElement("li");
let link = document.createElement("a");
link.setAttribute("href", changeurl(urls[i]) ? changeurl(urls[i]) : urls[i]);
link.innerHTML = urls[i].split("?")[0];
li.appendChild(link);
list.appendChild(li);
}
}
</script>
</body>
</html>