//调转到全部文件页面 百度网盘
window.location.href = 'https://pan.baidu.com/';
//登录
if (window.location.href.indexOf("pan.baidu") > 0) {
$(".account-title").click();
$('input[name=\'userName\']').val('lins549140386');
$('input[name=\'password\']').val('lins15*****06');
$('input[type=\'submit\']').click();
}
//创建多级目录目录
if (window.location.href.indexOf('disk') > 0) {
$(".icon-newfolder").click();
$(".GadHyA").val("aaa");
$(".jjfwqDpB").click();
}
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.href.match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
function creatCatalog(tagpayh) {
tagpath = '/img/aaa/bb/cc';
nowpath = getUrlParam('path');
if (tagpath.endsWith('/') == false) {
tagpath += '/';
}
if (nowpath == null) {
nowpath = '/';
}
if (nowpath.endsWith('/') == false) {
nowpath += '/';
}
if (tagpath.indexOf(nowpath) > -1) {
topath = tagpath.substr(tagpath.indexOf(nowpath) + nowpath.length);
if (topath.length > 0) {
clickfile = topath.split('/')[0];
var isfind = false;
$(".open-enable ").each(function(key, val) {
if ($(val).children(".file-name").children(".text").text() == clickfile) {
isfind = true;
$(val).dblclick();
}
});
if (isfind == false) {
$(".icon-newfolder").click();
$(".GadHyA").val(clickfile);
$(".jjfwqDpB").click();
}
}
} else {}
}
//移动文件
function into_path(from, tagpath) {
if (tagpath == null) {
return;
}
$(from).children('li').each(function(key, val) {
cupath = $(val).find('.treeview-txt').attr('node-path');
if (tagpath.indexOf(cupath) > -1 && cupath.length < tagpath.length) {
$(val).children("div").click();
setTimeout(function() {
into_path($(val).children("ul"), tagpath);
},
1000);
} else if (tagpath.indexOf(cupath) > -1) {
if (tagpath.endsWith('/') == false) {
tagpath += '/';
}
if (cupath.endsWith('/') == false) {
cupath += '/';
}
if (cupath == tagpath) {
$(val).children("div").click();
$('.g-button.g-button-blue-large').click();
}
}
});
}
tagpath = '/img/aaa/bb/cc';
filename = 'configure';
//返回到二级根目录
function toTopDir() {
if ($('.FuIxtL li a').size() > 2) {
$($('.FuIxtL li a')[0]).click();
setTimeout(function() {
toTopDir();
},1000);
} else {
location.reload();
}
}
toTopDir();
$(".open-enable ").each(function(key, val) {
if ($(val).find('.text a').html() == filename) {
$(val).click();
setTimeout(function() {
$("a[data-button-id='b41']").click();
into_path($('.treeview-root-content'), tagpath);
},
1000);
}
});
$($(".open-enable ")[5]).click().each(function(key, val) {
if ($(val).html() == 'img') {
$(val).click();
}
}
$('.treeview-node-handler').find('span')
$.ajax({
type: "get",
async: false,
url: "http://127.0.0.1/nverguo/shareFile.jhtml",
//实际上访问时产生的地址为: ajax.ashx?callbackfun=jsonpCallback&id=10
data: {
info: data
},
cache: false,
dataType: "jsonp",
jsonp: "callbackfun",
jsonpCallback: "returnval",
success: function(json) {
console.log('success');
console.log(json);
//创建分享
$($($(".module-aside").children("ul")[0]).children()[0]).children().children().click();
if (window.location.href.indexOf('disk') > 0) {
$(".open-enable ").each(function(key, val) {
if ($(val).children(".file-name").children(".text").text() == json.path) {
$(val).dblclick();
} else if ($(val).children(".file-name").children(".text").text().trim() == json.file) {
console.log($(val).children(".file-name").children(".text").text().trim());
$(val).click();
$($(".icon-share")[0]).click() setTimeout(function() {
$(".create").click();
setTimeout(function() {
console.log($(".share-url").val());
console.log($(".share-password").val());
setTimeout(function() {
$(".close").click();
},
1000);
},
3000);
},
1000);
}
});
}
},
error: function(json) {
console.log('error');
console.log(json)
}
});
$.ajax({
type: "get",
async: false,
url: "http://127.0.0.1/nverguo/cancelShareFile.jhtml",
//实际上访问时产生的地址为: ajax.ashx?callbackfun=jsonpCallback&id=10
data: {
info: data
},
cache: false,
dataType: "jsonp",
jsonp: "callbackfun",
jsonpCallback: "returnval",
success: function(json) {
console.log('success');
console.log(json);
//分享相应的文件
//跳转到取消分享页面
$(".icon-my-share").click();
// 取消分享
if (window.location.href.indexOf('share') > 0) {
$(".item").each(function(key, val) {
var str = $($(val).find(".copy-bar a")[0]).attr("href");
var name = $(val).find(".name").attr("title".trim());
if (name == json.file && str.includes(json.key)) { (val).click();
$(".icon-share-cancel").click();
setTimeout(function() {
$(".sbtn.okay").click();
},
1000);
}
});
}
},
error: function(json) {
console.log('error');
console.log(json);
}
});
// 创建文件夹
console