-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path:inurl Search Results into the textarea
26 lines (26 loc) · 3.73 KB
/
:inurl Search Results into the textarea
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
javascript: (function() {
var t, e, n, o, r, i, a, l, p = 100,
s = document.createDocumentFragment(),
c = document.createElement("style"),
d = document.createElement("div");
document.title = "inurl: Google Search", c.innerHTML = "#form{width:360px;margin:60px auto;padding:10px;border:4px double #ccc;background:#fff;font-size:16px;border-radius:5px}fieldset{border:none}h2{text-align:center;margin:10px 0 25px}button{float:left;width:calc(50% - 20px);margin:0 10px 3px;padding:10px;border:none;border-radius:5px;cursor:pointer;opacity:.9;font-size:1em;background-color:#61bd65;color:#fff}button:hover{opacity:1}button[type=reset]{background-color:#cbcbcb}input[type=text]{margin:0 10px;border:none;border-bottom:3px solid #f1f1f1}input[type=text]:focus{background-color:#f1f1f1;outline:0}.switch{position:relative;display:inline-block;width:60px;height:30px;margin:15px 10px 10px 7px}label{display:block;margin:10px}label b{display:inline-block;width:70px;margin:0 10px}.switch input{height:0}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;border-radius:6px;transition:.4s}.slider:before{position:absolute;content:\"\";height:20px;width:20px;left:10px;bottom:5px;background-color:#fff;transition:.4s;border-radius:50%}input:checked+.slider{background-color:#81a1bf}input:checked+.slider:before{transform:translateX(22px)}", d.innerHTML = "<form id=\"form\" action=\"#\"><fieldset> <h2>Search \"inurl:\" on Google</h2> <label><b>Domain</b><input id=\"d\" placeholder=\"example.com\" type=\"text\"></label><label><b>String *</b><input id=\"q\" name=\"q\" placeholder=\"test sort search etc.\" type=\"text\" required></label> <label><span class=\"switch\"> <input id=\"f\" type=\"checkbox\" checked> <span class=\"slider\"></span></span>Including omitted results</label> <button type=\"submit\"><b>Search</b></button><button type=\"reset\"><b>Reset</b></button> </fieldset></form>", s.appendChild(c), s.appendChild(d), document.body.textContent = "", document.body.appendChild(s), document.forms[0].querySelector("button[type=\"submit\"]").addEventListener("click", function(c) {
c.preventDefault(), i = 0, e = l = "", t = document.getElementById("d").value || "", (e = document.getElementById("q").value) ? (n = 1 - document.getElementById("f").checked, r = "https://www.google.com/search?q=site:" + t + "+inurl:" + encodeURIComponent(e) + "&filter=" + n + "&pws=0", (o = window.open(r)).onload = function() {
var e = o.document, t = e.getElementById("rso"), n = e.createElement("div");
t && (n.innerHTML = "<i style=\"display:block;margin:0 0 20px 0\"><b>Please wait...</b></i>", t.insertBefore(n, t.firstChild), function c(e) {
return fetch(e).then(function(e) {
if (e.ok) return e.text();
throw new Error("Response status:" + e.status + ", " + e.statusText)
}).then(function(e) {
var t = (new DOMParser).parseFromString(e, "text/html"), n = t.querySelectorAll(".g"), r = t.getElementById("pnnext");
if (n.length) return n.forEach(function(e) {
a = e.querySelector("a:first-of-type"), l += a.href + "\n", i++
}), r ? c(r.href) : 1
}).catch(function(e) {
o.alert(":(( " + e + ". Repeat later or try after captcha verification")
})
}(r + "&num=" + p.toString()).then(function() {
n.innerHTML = "<span id=\"total\" style=\"float:left;margin-left:-50px\">" + i.toString() + " =</span><textarea style=\"width:100%;height:120px;margin-bottom:20px\">" + l + "</textarea>"
}))
}) : alert("! Query string is required !")
})
})();