function ShowLoginChecked(position, way) {
if (!SearchIsCheckedMobileToLogin(position, way)) {
Show_Login(languageid, position, way);
}
}
//查看大图
function showBigPic(temp) {
var url = $(temp).attr('src').replace('/small/', '/');
var a = $("Apple").get(0);
var e = document.createEvent('MouseEvents');
e.initEvent('click', true, true);
a.dispatchEvent(e);
}
/************************* pview 页面 start **********************/
function ShowHideInfo() {
$('#div_div').toggle();
}
//显示隐藏内容
function ShowContent(temp) {
var src = $(temp).find('img').attr('src');
if (src.toLowerCase().indexOf('openicon.png') >= 0) {
$(temp).find('img').attr('src', '/images/icon/CloseIcon.png');
} else {
$(temp).find('img').attr('src', '/images/icon/OpenIcon.png');
}
$(temp).next().toggle();
}
function Submit() {
var ids = "";
$("input[name='s4']:checked").each(function (index, data) {
if (index > 0) {
ids += ",";
}
ids += $(data).val();
});
if (ids == '') {
layer.msg('Choose at least one!');
return;
}
var ii = layer.load(2, { shade: [0.1, '#000'] });
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '?action=SubmitInfo',
type: 'post',
data: {
ids: encodeURIComponent(ids),
wzid: $.getUrlVar('wzid')
},
dataType: 'json',
success: function (res) {
layer.close(ii);
if (res.Result) {
location.href = '/mp.aspx?id=' + CurrUserId + '&t=' + $.getUrlVar('t');
} else {
layer.msg("Submission Failed!");
}
}, error: function () {
layer.msg('error');
}
});
}
function GetPeviewInit() {
ShowCommentText();
}
/************************* pview 页面 end **********************/
/************************* Review 页面 start **********************/
//初始化
function GetRViewInit() {
var lg = $.getUrlVar('login') != undefined ? 'login=' + $.getUrlVar('login') : '';
var d = $.getUrlVar('d') != undefined ? 'd=' + $.getUrlVar('d') : '';
var locationsearch = lg || d ? '?' : '';
if (lg) {
locationsearch = locationsearch + lg;
if (d) {
locationsearch = locationsearch + '&' + d;
}
} else {
if (d) {
locationsearch = locationsearch + d;
}
}
var pathname = location.pathname.toLowerCase();
if (pathname.indexOf('review.aspx') > 0) {
location.href = location.origin + '/prep' + reviewWzid + locationsearch;
}
var length = $.trim($('.zzb_div1-2_dv2').html()).length;
var filesLength = $.trim($('.zzb_div1-2_dv3 ul').html()).length;
if (length == 0 && filesLength == 0) {
ShowHideInfo();
}
//分享复制
var clipboard = new ClipboardJS('#btnShareCopy', {
text: function () {
return location.origin + '/prep' + reviewWzid + locationsearch;
}
});
clipboard.on('success', function (e) {
//复制链接 日志
AddCaoZuo(410, reviewWzid, 0, 0, '0');
layer.alert('Copy successful. You can paste it anywhere to share it with others.', { title: 'Prompt', btn: ' OK ' });
});
GetQuestionList(0, 1);
$('.zzb_div1-2_dv2').find('img').each(function (index, data) {
$(data).attr('onclick', 'showBigPic(this)');
});
GetProtocolOfSameArticle();
//$('.ptsnum').each(function (index, data) {
// if (index == 0) {
// var snumber = $(data).data('snumber');
// var elifeid = $(data).data('elifeid');
// $('#a_RequestNow').attr('href', '/eLIFErap' + elifeid + '?item=' + snumber);
// }
//});
//定时
CheckIsLogin();
CheckTime = setInterval(function () {
CheckIsLogin();
}, 500);
ShowCommentText();
//复制通讯作者邮箱
$('.TXemail').each(function (index, data) {
var pemail = $(data).data('pemail');
var cpb = new ClipboardJS(data, {
text: function () {
return pemail;
}
});
cpb.on('success', function (e) {
layer.msg('Copy successful. You can paste it anywhere to contact this author.', { skin: 'layui-layer-hui margin-left' });
});
});
}
//way=1, 初次加载, else 重新调用
function GetQuestionList(id, way) {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=GetQuestionList',
type: 'post',
data: {
wzid: reviewWzid,
OnlySubmit: $.trim($('.hidOnlySubmit').val())
},
dataType: 'json',
success: function (res) {
if (res.Result) {
var count = res.Data.length;
if (count > 0) {
$('#rightQACount').html('Q&A: ' + count);
}
//if (count == 1) {
// $('#spanQuestionCount').html('1 Comment');
//} else if (count > 1) {
// $('#spanQuestionCount').html(count + ' Comments');
//}
var html = '';
$(res.Data).each(function (index, data) {
html += '
';
html += ' ';
var href = data.UserId == 0 ? '' : ' href="/userhome.aspx?id=' + data.UserId + '" ';
html += '
' + data.UserName + ' ';
if (data.author > 0) {
html += '
' + getLangStr('Author', '作者') + '';
}
html += '
' + data.CreateDate + '';
html += '
' + data.body + '
';
html += '
';
$(data.ReplyList).each(function (i, item) {
if (i == 1) {
html += '';
}
html += '
';
html += '
';
html += '
';
if (item.ToReply != '') {
html += ' Reply to ' + item.ToReply + ': ';
}
html += ' ' + item.body;
html += '
';
html += '
';
html += ' ' + getLangStr('Reply', '回复') + '';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += ' ';
html += '
';
html += '
';
html += '
';
if (i > 0 && i == $(data.ReplyList).length - 1) {
html += '
';
var disCount = parseInt($(data.ReplyList).length) - 1;
var showmore = disCount > 1 ? 'discussions' : 'discussion';
html += '';
}
});
html += '';
html += '';
html += '
';
html += '
';
html += '
';
html += ' ';
html += '
';
html += '
';
html += '
';
});
$('#questionMain').html(html);
if (id) {
ShowMore(id);
}
if (way == 1) {
var dw = $.getUrlVar('d');
if (dw) {
var ids = $.trim(dw).split('-');
var qid = ids[0];
var rid = ids.length == 1 ? 0 : parseInt(ids[1]);
if (rid == 0) {
$('html,body').animate({ scrollTop: $("#dq" + qid).offset().top - 80 }, 100);
} else {
ShowMore(qid);
$('html,body').animate({ scrollTop: $("#dry" + rid).offset().top - 80 }, 100);
}
}
}
}
}, error: function () {
}
});
}
//改变高度
function HeightToBig(temp) {
if (Onlinezt == 0) {
//判断是否是移动端 跳转登录
if (!SearchIsCheckedMobileToLogin(8, 13)) {
Show_Login(languageid, 8, 13);
return;
}
}
$(temp).css('height', '150px');
}
//默认展开
function ShowCommentText() {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/smlog/userstatus.aspx?action=checklogin',
type: 'post',
dataType: 'json',
success: function (r) {
if (r.Online) {
Onlinezt = 1;
$('#btnPost').show();
$('#btnPostLogin').hide();
} else {
Onlinezt = 0;
$('#btnPostLogin').show();
$('#btnPost').hide();
}
$('#divPost').show();
$('#divQuestonMain').addClass('bg-graybbs');
$('#bbsuser').show();
var photo = $('.currPhoto').val();
var job = $('.currJob').val();
if (Onlinezt == 0) {
$('#divbbsname').css('padding-bottom', '8px');
job = getLangStr('You must be logged in to add a comment or ask a question.', '请登录并在线提交您的问题或评论');
photo = _ImgSrcURI + '/imagesUP/usersphoto/noavatar.jpg';
} else {
$('#a_bbsname').html($('.currUserName').val()).attr('href', '/userhome.aspx?id=' + CurrUserId);
}
$('#bbsimg').attr('src', photo);
$('#bbsjob').html(job);
},
error: function () { }
});
}
//高度变小
function HeightToSmall(temp) {
if ($.trim($(temp).val()) == '') {
$(temp).css('height', '60px');
}
}
function ShowMoreArticle(temp) {
$('#ul_li2').toggle();
var display = $('#ul_li2').css('display');
if (display == 'none') {
$(temp).html('+ Show more');
} else {
$(temp).html('- Show less');
}
}
//显示隐藏
function ShowHideReplyText(num, name) {
if (Onlinezt == 0) {
if (!SearchIsCheckedMobileToLogin(8, 13)) {
Show_Login(languageid, 8, 13);
return;
}
}
$('#DivReply' + num).toggle();
$('#DivReply' + num).find('.bbsText').attr('placeholder', 'Reply to ' + decodeURIComponent(name) + ': ');
$('#bbsuser' + num).toggle();
$('#bbsimg' + num).attr('src', $('.currPhoto').val());
$('#a_bbsname' + num).html($('.currUserName').val()).attr('href', '/userhome.aspx?id=' + CurrUserId);
$('#bbsjob' + num).html($('.currJob').val());
}
//显示 隐藏 回答问题输入框
function ShowHideAnswerQuestionTxt(id) {
if (Onlinezt == 0) {
if (!SearchIsCheckedMobileToLogin(8, 13)) {
Show_Login(languageid, 8, 13);
return;
}
}
$('#DivQuestion' + id).toggle();
//$('#DivQuestion' + id).find('.bbsText').attr('placeholder', 'Reply to ' + decodeURIComponent(name) + ': ');
$('#bbsuser' + id).toggle();
$('#bbsimg' + id).attr('src', $('.currPhoto').val());
$('#a_bbsname' + id).html($('.currUserName').val()).attr('href', '/userhome.aspx?id=' + CurrUserId);
$('#bbsjob' + id).html($('.currJob').val());
}
//提问
function PostQuestion() {
if (Onlinezt == 0) {
if (!SearchIsCheckedMobileToLogin(8, 13)) {
Show_Login(languageid, 8, 13);//js/jsdoc/shologin.js
return;
}
} else {
var body = $.trim($('#txtQuestion').val());
if (body == '') {
layer.msg(getLangStr("Please input content.", '请输入内容'), { skin: 'layui-layer-hui' });
$('#txtQuestion').focus();
return;
}
var ii = layer.load(2, { shade: [0.1, '#000'] });
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=PostQuestion',
type: 'post',
data: {
body: encodeURIComponent(body),
wzid: reviewWzid,
OnlySubmit: $('.hidOnlySubmit').val()
},
dataType: 'json',
success: function (res) {
layer.close(ii);
if (res.Result) {
if (res.NoEmail == 1) {
//没有邮箱,绑定
var win_w = $(window).width();
var area_w = win_w > 600 ? '520px' : '100%';
layer.open({
type: 2,
title: false,
scrollbar: false,
closeBtn: false,
shadeClose: true,
skin: 'demo-skin-radius',
area: [area_w, '540px'],
content: '/ifrchangeacount.aspx?w=1'
});
} else {
layer.msg(getLangStr("Post successfully!", '提交成功'), { skin: 'layui-layer-hui' });
//情况数据
$('#txtQuestion').val('');
HeightToSmall();
GetQuestionList();//重新加载
}
} else {
if (res.offline == 1) {
if (!SearchIsCheckedMobileToLogin(8, 13)) {
Show_Login(languageid, 8, 13);//js/jsdoc/shologin.js
}
layer.msg(getLangStr("You are offline, please login again!", '您已离线,请重新登录!'), { skin: 'layui-layer-hui' });
} else {
layer.msg(getLangStr('Submission Failed!', '提交失败'));
}
}
}, error: function () {
layer.close(ii);
layer.msg("error", { skin: 'layui-layer-hui' });
}
});
}
}
//回复答案
function PostReply(ReplyId, QuesiontId) {
if (Onlinezt == 0) {
if (!SearchIsCheckedMobileToLogin(10, 13)) {
Show_Login(languageid, 10, 13);//js/jsdoc/shologin.js
return;
}
} else {
var body = $.trim($('#txtReply' + ReplyId).val());
if (body == '') {
layer.msg(getLangStr("Please input content.", '请输入内容'), { skin: 'layui-layer-hui' });
$('#txtReply' + ReplyId).focus();
return;
}
var ii = layer.load(2, { shade: [0.1, '#000'] });
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=PostReply',
type: 'post',
data: {
body: encodeURIComponent(body),
wzid: reviewWzid,
OnlySubmit: $('.hidOnlySubmit').val(),
ReplyId: ReplyId,
QuesiontId: QuesiontId
},
dataType: 'json',
success: function (res) {
layer.close(ii);
if (res.Result) {
if (res.NoEmail == 1) {
//没有邮箱,绑定
var win_w = $(window).width();
var area_w = win_w > 600 ? '520px' : '100%';
layer.open({
type: 2,
title: false,
scrollbar: false,
closeBtn: false,
shadeClose: true,
skin: 'demo-skin-radius',
area: [area_w, '540px'],
content: '/ifrchangeacount.aspx?w=1'
});
} else {
layer.msg(getLangStr("Post successfully!", '提交成功'), { skin: 'layui-layer-hui' });
//情况数据
$('#txtReply' + ReplyId).val('');
$('#DivReply' + ReplyId).hide();
GetQuestionList(QuesiontId);//重新加载
SendEmailToReply(QuesiontId, ReplyId, res.data);
}
} else {
if (res.offline == 1) {
if (!SearchIsCheckedMobileToLogin(10, 13)) {
Show_Login(languageid, 10, 13);//js/jsdoc/shologin.js
}
layer.msg(getLangStr("You are offline, please login again!", '您已离线,请重新登录!'), { skin: 'layui-layer-hui' });
} else {
layer.msg(getLangStr('Submission Failed!', '提交失败'), { icon: 5, shift: 6 });
}
}
}, error: function () {
layer.msg('error', { skin: 'layui-layer-hui' });
}
});
}
}
//回答问题
function PostAnswer(id) {
if (Onlinezt == 0) {
if (!SearchIsCheckedMobileToLogin(9, 13)) {
Show_Login(languageid, 9, 13);//js/jsdoc/shologin.js
}
} else {
var body = $.trim($('#txtAnswer' + id).val());
if (body == '') {
layer.msg(getLangStr("Please input content.", '请输入内容'), { skin: 'layui-layer-hui' });
$('#txtAnswer' + id).focus();
return;
}
var ii = layer.load(2, { shade: [0.1, '#000'] });
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=PostAnswer',
type: 'post',
data: {
body: encodeURIComponent(body),
wzid: reviewWzid,
OnlySubmit: $('.hidOnlySubmit').val(),
id: id
},
dataType: 'json',
success: function (res) {
layer.close(ii);
if (res.Result) {
if (res.NoEmail == 1) {
//没有邮箱,绑定
var win_w = $(window).width();
var area_w = win_w > 600 ? '520px' : '100%';
layer.open({
type: 2,
title: false,
scrollbar: false,
closeBtn: false,
shadeClose: true,
skin: 'demo-skin-radius',
area: [area_w, '540px'],
content: '/ifrchangeacount.aspx?w=1'
});
} else {
layer.msg(getLangStr("Post successfully!", '提交成功'), { skin: 'layui-layer-hui' });
//情况数据
$('#txtAnswer' + id).val('');
$('#DivQuestion' + id).hide();
GetQuestionList(id);//重新加载
SendEmailToReply(id, id, res.data);
}
} else {
if (res.offline == 1) {
if (!SearchIsCheckedMobileToLogin(9, 13)) {
Show_Login(languageid, 9, 13);//js/jsdoc/shologin.js
return;
}
layer.msg(getLangStr("You are offline, please login again!", '您已离线,请重新登录!'), { skin: 'layui-layer-hui' });
} else {
layer.msg(getLangStr('Submission Failed!', '提交失败'), { icon: 5, shift: 6 });
}
}
}, error: function () {
layer.msg('error', { skin: 'layui-layer-hui' });
}
});
}
}
//显示更多回复
function ShowMore(id) {
$('#showMoreView' + id).toggle();
$('#showMoreHide' + id).toggle();
$('#hidReplyDiv' + id).toggle();
}
//相同article的protocol title
function GetProtocolOfSameArticle() {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=GetProtocolOfSameArticle',
type: 'post',
data: {
wzid: reviewWzid
},
dataType: 'json',
success: function (res) {
if (res.Result) {
if ($(res.Data).length > 0) {
$('.ArticleList').show();
}
var html1 = '';
var html2 = '';
$(res.Data).each(function (index, data) {
var html = '' + data.title + '';
if (index < 3) {
html1 += html;
} else {
html2 += html;
}
});
$('#ul_li1').html(html1);
$('#ul_li2').html(html2);
if (html2) {
$('#showmoreArticle').show();
}
}
}, error: function () {
}
});
}
//获取PDF
function GetPdf() {
if (Onlinezt == 0) {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '?action=CheckFactor',
type: 'post',
data: {},
dataType: 'json',
success: function (res) {
if (res.Result) {
GetDownloadPDF();
} else {
if (!SearchIsCheckedMobileToLogin(7, 204)) {
Show_Login(languageid, 7, 204);
}
}
}
});
} else {
GetDownloadPDF();
}
}
function GetDownloadPDF() {
var ii = layer.load(2, { shade: false });
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=GetPDF',
type: 'post',
data: {
wzid: reviewWzid,
title: encodeURIComponent($.trim($('.hidTitle').val()))
},
dataType: 'json',
success: function (res) {
layer.close(ii);
if (res.Result) {
PDFDownLoad(reviewWzid);
} else {
if (res.offline == 1) {
if (!SearchIsCheckedMobileToLogin(7, 204)) {
Show_Login(languageid, 7, 204);
}
}
}
},
error: function () {
layer.close(ii);
}
});
}
function PDFDownLoad(wzid) {
//下载pdf 日志
AddCaoZuo(409, wzid, 0, 0, '0');
document.getElementById("ifrLoad").setAttribute("src", "/bio101/downloadfiles.aspx?wzid=" + wzid + "&tp=pdf");
}
//发送邮件
function SendEmailToReply(questionid, replyid, newid) {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '/bio101/review.aspx?action=SendEmailToReply',
type: 'post',
data: {
replyid: replyid,
wzid: reviewWzid,
newid: newid,
questionid: questionid
},
dataType: 'json',
success: function (res) {
}, error: function () { }
});
}
function how2cite() {
var html = '';
html += '';
html += '
';
html += 'How to cite';
html += '
';
html += '
';
html += '';
html += '
';
html += ' ' + $("#htcOne").html() + "
";
html += ' ' + $("#htcTwo").html() + "
";
html += ' ' + $("#htcThree").html() + "
";
html += '
';
html += '
';
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
content: html,
skin: 'demo-skin-radius',
closeBtn: 0,
area: ['520px', '540px']
});
}
//定位到Q&A
function DWQA() {
$('html,body').animate({ scrollTop: $("#spanQuestionCount").offset().top }, 300);
}
var TiShiNum;
function showtishi(body, temp) {
var html = '' + body + '
';
TiShiNum = layer.tips(html, temp, {
tips: [3, '#50E5D7'],
time: 999999999
});
}
function hidetishi() {
layer.close(TiShiNum);
}
function GetVersionProtocols() {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '?action=GetVersionProtocols',
type: 'post',
data: {
_wzid: reviewWzid
},
dataType: 'json',
success: function (res) {
if (res.Result) {
var html = '';
html += '';
html += ' ';
html += ' ';
html += '
';
$('#div_title_protocol').append(html);
}
},
error: function () { }
});
}
function GetYMID() {
var ym = location.hostname;
var id = 0;
switch (ym) {
case 'bio-protocol.org':
id = 25138;
break;
case 'cndev.bio-protocol.org':
id = 25137;
break;
case 'dev.bio-protocol.org':
id = 25104;
break;
case 'en.bio-protocol.org':
id = 25103;
break;
}
return id;
}
//返回英文域名
function GetEn_YuMing(ym) {
var en_ym = ym;
switch (ym) {
case "cndev.bio-protocol.org":
case "dev.bio-protocol.org":
en_ym = "dev.bio-protocol.org";
break;
case "bio-protocol.org":
case "cn.bio-protocol.org":
case "www.bio-protocol.org":
case "en.bio-protocol.org":
en_ym = "en.bio-protocol.org";
break;
}
return en_ym;
}
function ViewThisFile(filename, fileurl, hzm, temp) {
//var Suffix = GetIconBySuffix(hzm);
//$('.divflie_select .dropdown-toggle').html(Suffix + filename + ' ');
//$('.topdrop-menu li').each(function (index, data) {
// $(data).removeClass('active');
//});
//$(temp).addClass('active');
//$('.divfiles').click();
//$.ajax({
// url: "?action=" + GetAPIBySuffix(hzm),
// data: {
// fileUrl: encodeURIComponent(fileurl)
// },
// type: "POST",
// async: false,
// dataType: "json",
// success: function (res) {
// //获得窗口的垂直位置
// //var iWidth = 1400;
// //var iHeight = 800;
// //var iTop = (window.screen.availHeight - 30 - iHeight) / 2;
// ////获得窗口的水平位置
// //var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
// //window.open(data.str, '_blank', 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no');
// $('.download_file').attr('href', location.protocol + '//' + GetEn_YuMing(location.hostname) + '/bio101/review.aspx?action=FileDownLoad&fileUrl=' + encodeURIComponent(fileurl));
// $('#ifr_file_view').attr('src', res.path);
// }
//});
var Suffix = GetIconBySuffix(hzm);
$('.divflie_select .dropdown-toggle').html(Suffix + filename + ' ');
$('.topdrop-menu li').each(function (index, data) {
$(data).removeClass('active');
});
$(temp).addClass('active');
$('.divfiles').click();
$('.download_file').attr('href', location.protocol + '//' + GetEn_YuMing(location.hostname) + '/bio101/review.aspx?action=FileDownLoad&fileUrl=' + encodeURIComponent(fileurl));
var _hzm = hzm.toLowerCase();
if (_hzm == '.mp4' || _hzm == '.flv' || _hzm == '.jpg' || _hzm == '.png' || _hzm == '.jpeg' || _hzm == '.gif' || _hzm == '.bmp') {
var v_p = _hzm == '.mp4' || _hzm == '.flv' ? 2 : 1;//1图片, 2视频
$('#ifr_file_view').attr('src', '/bio101/review_view.aspx?type=' + v_p + '&uri=' + encodeURIComponent(fileurl));
} else if (_hzm == '.pdf') {
$('#ifr_file_view').attr('src', fileurl);
} else {
var ssl = location.protocol == 'https:' ? '&ssl=1' : '';
$('#ifr_file_view').attr('src', '//ow365.cn/?i=' + GetYMID() + ssl + '&furl=' + location.protocol + "//" + GetEn_YuMing(location.hostname) + fileurl);
}
/* $('#ifr_file_view').attr('src', 'https://api.idocv.com/view/url?url=' + encodeURIComponent(location.protocol + "//" + GetEn_YuMing(location.hostname) + fileurl));*/
}
//根据后缀名获取图标
function GetIconBySuffix(Suffix) {
var icon = '';
switch (Suffix.toLowerCase()) {
case '.txt':
icon = 'file_icon_txt.png';
break;
case '.doc':
case '.docx':
icon = 'file_icon_word.png';
break;
case '.xls':
case '.xlsx':
icon = 'file_icon_excel.png';
break;
case '.pptx':
case '.ppt':
icon = 'file_icon_ppt.png';
break;
case '.pdf':
icon = 'file_icon_pdf.png';
break;
case '.zip':
case '.rar':
case '.7z':
icon = 'file_icon_rar.png';
break;
case '.jpg':
case '.png':
case '.jpeg':
case '.gif':
case '.bmp':
icon = 'file_icon_pic.png';
break;
case '.mp4':
case '.flv':
icon = 'file_icon_video.png';
break;
default:
icon = 'file_icon_unknown.png';
break;
}
return '';
}
//根据后缀名获取接口
function GetAPIBySuffix(Suffix) {
var api = '';
switch (Suffix.toLowerCase()) {
case '.txt':
break;
case '.doc':
case '.docx':
api = 'WordToHtml';
break;
case '.xls':
case '.xlsx':
api = 'ExcelToHtml';
break;
case '.pptx':
case '.ppt':
break;
case '.pdf':
break;
case '.zip':
case '.rar':
case '.7z':
break;
case '.jpg':
case '.png':
case '.jpeg':
case '.gif':
case '.bmp':
break;
case '.mp4':
case '.flv':
break;
default:
break;
}
return api;
}
//预览或下载文件 type=1 预览, 2下载
function Downloadfile(type, fileid) {
var header_userid = 0;
try { header_userid = header_uid; } catch (err) { }
$.ajax({
headers: {
'user-id': header_userid
},
url: '?action=CheckFactor',
type: 'post',
data: {},
dataType: 'json',
success: function (res) {
if (res.Result) {
var url = '';
if (type == 1) {
url = $.trim($('#hidView' + fileid).val());
} else if (type == 2) {
url = $.trim($('#hidDownload' + fileid).val());
}
var shebei = GetSheBei().toLowerCase();
if (url != '') {
if (shebei == 'pc') {
var a = $("Apple").get(0);
var e = document.createEvent('MouseEvents');
e.initEvent('click', true, true);
a.dispatchEvent(e);
} else {
location.href = url;
}
}
} else {
Show_Login(languageid, 49, 209);
}
}
});
}
function CopyAlert() {
AddCaoZuo(425, reviewWzid, 0, 0, '复制');
}
/************************* Review 页面 end **********************/
//iframe自动适配高度
function dyniframesize(down) {
var pTar = null;
if (document.getElementById) {
pTar = document.getElementById(down);
}
else {
eval('pTar = ' + down + ';');
}
if (pTar && !window.opera) {
//begin resizing iframe
pTar.style.display = "block"
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
//ns6 syntax
pTar.height = pTar.contentDocument.body.offsetHeight + 20;
pTar.width = pTar.contentDocument.body.scrollWidth + 20;
}
else if (pTar.Document && pTar.Document.body.scrollHeight) {
//ie5+ syntax
pTar.height = pTar.Document.body.scrollHeight;
pTar.width = pTar.Document.body.scrollWidth;
}
}
}