📄 basic.js
字号:
function geturlhttp() {
var s = document.URL;
s = s.substring(7, s.length);
var i = s.split('/');
var str = "http://" + i[0] + "/";
return str;
}
function nTabs(thisObj, Num) {
if (thisObj.className == "activec-tab") return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for (i = 0; i < tabList.length; i++) {
if (i == Num) {
thisObj.className = "activec-tab";
document.getElementById(tabObj + "_Content" + i).style.display = "block";
} else {
tabList[i].className = "normalc-tab";
document.getElementById(tabObj + "_Content" + i).style.display = "none";
}
}
}
$(document).ready(function() {
var i = 1;
$('#ctl00_ContentPlaceHolder1_Repeater1_ctl00_ImageButton1').click(function(e) {
$.ajaxSetup({ cache: false });
e.preventDefault();
$.get(geturlhttp() + "/ajax/checklogin.aspx", { id: i }, function(data) {
if (data == 0) {
$('#basicModallogin').modal();
}
else {
$('#basicModalContent').modal();
}
});
});
$('#ctl00_ContentPlaceHolder1_Repeater1_ctl00_ImageButton2').click(function(e) {
e.preventDefault();
$.get(geturlhttp() + "ajax/checklogin.aspx", function(data) {
if (data == 0) {
$('#basicModallogin').modal();
}
else {
$('#basicModalContentpcb').modal();
}
});
});
$('#ctl00_ContentPlaceHolder1_Repeater1_ctl00_ImageButton3').click(function(e) {
$.ajaxSetup({ cache: false });
e.preventDefault();
$.get(geturlhttp() + "ajax/checklogin.aspx", function(data) {
if (data == 0) {
$('#basicModallogin').modal();
}
else {
$('#basicModalContentcode').modal();
}
});
});
$('#logintext').click(function(e) {
e.preventDefault();
//alert('as');
$('#basicModallogin').modal();
//$('#basicModalContent').modal();
});
});
function ajaxlogin() {
$.ajaxSetup({ cache: false });
$.get(geturlhttp() + "ajax/login.aspx", { em: $('#ctl00_ContentPlaceHolder1_TextBox3').val(), pwd: $('#ctl00_ContentPlaceHolder1_TextBox4').val(), bc: 1 }, function(data) {
if (data == -1) {
$('#error').html('用户邮箱和密码不能为空!');
$('#ctl00_ContentPlaceHolder1_TextBox4').val('');
$('#error').show('slow');
$('#error').hide('slow');
}
if (data == 1) {
$('#error').html('用户密码错误,请重试!');
$('#ctl00_ContentPlaceHolder1_TextBox4').val('');
$('#error').show('slow');
$('#error').hide('slow');
}
if (data == 2) {
$('#error').html('不存在此用户,请重试!');
$('#ctl00_ContentPlaceHolder1_TextBox3').val('');
$('#ctl00_ContentPlaceHolder1_TextBox4').val('');
$('#error').show(800);
$('#error').hide(800);
}
if (data == 0) {
$.modal.close();
//$('#basicModalContent').modal();
}
});
}
function checkcode() {
}
function checkLength(which, maxChars, span_id) {
if (which.value.length > maxChars)
which.value = which.value.substring(0, maxChars);
var curr = maxChars - which.value.length;
document.getElementById(span_id).innerHTML = curr.toString();
}
function getfile(id) {
$.ajaxSetup({ cache: false });
$.get(geturlhttp() + "ajax/down.aspx", { fjid: id }, function(data) {
if (data == "nologin") {
alert("登录超时请登陆后下载!");
$.modal.close();
$('#basicModallogin').modal();
}
else {
if (data == "0") {
alert("对不起你还没有购买该文件!,请购买后再试?");
}
else {
if (data == "1") {
alert("文件不存在!");
}
else {
//alert(data);
//window.open(geturlhttp() + "down.aspx?fjid=" + id, "查看文件");
window.open(geturlhttp() + 'down.aspx?fjid=' + id, target = '_blank');
window.location.href=geturlhttp() + 'down.aspx?fjid=' + id;
//window.showModelessDialog(geturlhttp() + 'down.aspx?fjid=' + id, '', 'dialogWidth:800px;dialogHeight:300px');
}
}
}
});
}
function buyfile(articleid, typeid) {
if (document.getElementById("price").innerHTML == "0") {
$.ajaxSetup({ cache: false });
$.get(geturlhttp() + "ajax/downall.aspx", { wid: articleid, tid: typeid }, function(data) {
if (data == "-1") {
alert('登陆超时!');
}
if (data == "0") {
alert('你的余额不足!');
}
if (data == "1") {
alert('你已经购买过了不用在购买了');
}
if (data == "2") {
alert('购买成功!现在可以查看了');
}
if (data == "3") {
alert('此电路文章所有权是你的,你可以查看并下载');
}
if (data == "4") {
alert('此电路文章是免费的,不需要购买!');
}
if (data == "5") {
alert('此电路包含的附件不完整,不能购买!');
}
});
}
else {
if (confirm("购买这些文件需要扣除相应的金币(电路图和源码购买任何一样均可下载),重复下载不扣除,你要购买下载吗?")) {
$.ajaxSetup({ cache: false });
$.get(geturlhttp() + "ajax/downall.aspx", { wid: articleid, tid: typeid }, function(data) {
if (data == "-1") {
alert('登陆超时!');
}
if (data == "0") {
alert('你的余额不足!');
}
if (data == "1") {
alert('你已经购买过了不用在购买了');
}
if (data == "2") {
alert('购买成功!现在可以查看了');
}
if (data == "3") {
alert('此电路文章所有权是你的,你可以查看并下载');
}
if (data == "4") {
alert('此电路文章是免费的,不需要购买!');
}
if (data == "5") {
alert('此电路包含的附件不完整,不能购买!');
}
});
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -