SoraLink Crowd Bypass - content_script

This commit is contained in:
ikancupang 2019-11-25 18:56:39 +07:00 committed by GitHub
parent 3b04fe009e
commit 2926171162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1042,6 +1042,149 @@ if(document instanceof HTMLDocument)
{
document.querySelector("form#show > [type='submit']").click()
}
if(document.querySelector("body > form#landing"))
{
let f=document.querySelector("body > form#landing")
f.action+="#"+location.search.split("?id=")[1]
f.submit()
}
if(document.querySelector("form#landing > div#landing")&&document.querySelector(".soractrl"))
{
let f=document.querySelector("form#landing")
f.action+=location.hash
f.submit()
}
if(document.querySelector("img.spoint#showlink")&&document.querySelector(".soractrl"))
{
crowdPath(location.hash.substr(1))
crowdBypass()
let t=document.createElement("div")
t.id="temp"
t.style.display="none"
t.textContent=location.hash.substr(1)
document.body.appendChild(t)
// Redefine jquery.redirect
window.onload=()=>{
(function($){
let defaults={
url:null,
values:null,
method:"POST",
target:null,
traditional:false,
redirectTop:false
}
$.redirect=function(url,values,method,target,traditional,redirectTop){
let opts=url
if(typeof url!=="object"){
opts={
url:url+"&soralinkbypass="+document.querySelector("div#temp").textContent,
values:values,
method:method,
target:"_self",
traditional:traditional,
redirectTop:redirectTop
}
}
let config=$.extend({},defaults,opts)
let generatedForm=$.redirect.getForm(config.url,config.values,config.method,config.target,config.traditional)
$('body',config.redirectTop? window.top.document:undefined).append(generatedForm.form)
generatedForm.submit()
generatedForm.form.remove()
}
$.redirect.getForm=function(url,values,method,target,traditional){
method =(method&&["GET","POST","PUT","DELETE"].indexOf(method.toUpperCase())!==-1)? method.toUpperCase():'POST'
url=url.split("#")
let hash=url[1]?("#"+url[1]):""
url=url[0]
if(!values){
let obj=$.parseUrl(url)
url=obj.url
values=obj.params
}
values=removeNulls(values)
let form=$('<form>')
.attr("method",method)
.attr("action",url+hash)
if(target){
form.attr("target",target)
}
let submit=form[0].submit
iterateValues(values,[],form,null,traditional)
return{ form:form,submit:function(){ submit.call(form[0]); } }
}
$.parseUrl=function(url){
if(url.indexOf('?')===-1){
return{
url:url,
params:{}
}
}
let parts=url.split('?'),
query_string=parts[1],
elems=query_string.split('&')
url=parts[0]
let i,pair,obj={}
for(i=0;i<elems.length;i+=1){
pair=elems[i].split('=')
obj[pair[0]]=pair[1]
}
return{
url:url,
params:obj
}
}
let getInput=function(name,value,parent,array,traditional){
let parentString
if(parent.length>0){
parentString=parent[0]
let i
for(i=1;i<parent.length;i+=1){
parentString+="["+parent[i]+"]"
}
if(array){
if(traditional)
name=parentString
else
name=parentString+"["+name+"]"
} else{
name=parentString+"["+name+"]"
}
}
return $("<input>").attr("type","hidden")
.attr("name",name)
.attr("value",value)
}
let iterateValues=function(values,parent,form,isArray,traditional){
let i,iterateParent=[]
Object.keys(values).forEach(function(i){
if(typeof values[i]==="object"){
iterateParent=parent.slice()
iterateParent.push(i)
iterateValues(values[i],iterateParent,form,Array.isArray(values[i]),traditional)
} else{
form.append(getInput(i,values[i],parent,isArray,traditional))
}
})
}
let removeNulls=function(values){
let propNames=Object.getOwnPropertyNames(values)
for(let i=0;i<propNames.length;i++){
let propName=propNames[i]
if(values[propName]===null||values[propName]===undefined){
delete values[propName]
} else if(typeof values[propName]==='object'){
values[propName]=removeNulls(values[propName])
} else if(values[propName].length<1){
delete values[propName]
}
}
return values
}
}(window.jQuery||window.Zepto||window.jqlite))
}
}
//Safelink Wordpress Plugin
ifElement(".wpsafe-bottom > [id^='wpsafe-lin'] > a[href]",a=>{
safelyNavigate(a.href)