Files
journal_com/js/js.js
2023-10-13 13:19:22 +08:00

248 lines
7.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 地址
// var apiUrl = "http://journal.com/";
// var apiUrlTG = "http://www.tougao.com/";
// var apiUrlImg = "http://journal.com/";
var apiUrl = "/";
var apiUrlTG = "/";
var apiUrlImg = "/public/";
var apiSubmission = "https://submission.tmrjournals.com/";
// var apiUrlImg = "http://journalapi.tmrjournals.com/public/";
var imgjourUrl = apiUrlImg + "journalicon/";
var imgtopicUrl = apiUrlImg + "journaltopic/";
var imgbaseUrl = apiUrlImg + "baseTopic/";
var imgarticleUrl = apiUrlImg + "articleicon/";
var imgsystemUrl = apiUrlImg + "system/";
var imglineUrl = apiUrlImg + "journalline/";
var imgcfpUrl = apiUrlImg + "journalCfp/";
var imgFileUrl = apiUrlImg + "";
// 资源
// IMGdoURL = 'http://journalapi.tmrjournals.com/public/'
// IMGupURL = 'http://journal.com/'
// 获取地址栏信息
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
localStorage.setItem("Journals_num",getQueryString('J_num'));
// localStorage.setItem("Journals_num",'1');
// 获取缓存期刊id
var Jour_num = localStorage.Journals_num;
// tab选项卡
$(document).ready(function() {
$("#tablist li").each(function(index) {
$(this).click(function() {
$(".contentin").removeClass("contentin");
$(".tabin").removeClass("tabin");
$(".content-box>div").eq(index).addClass("contentin");
$(this).addClass("tabin")
});
})
})
//返回顶部
$.goup({
trigger: 100,
bottomOffset: 150,
locationOffset: 60,
titleAsText: true
});
// 成功失败弹出层
function ShowSuccess(tiq) {
var $tiq = $('#tiq');
if ($tiq.length == 0) {
// 设置样式也可以定义在css文件中
$tiq = $('<span id="tiq" style="border-radius:3px;position:fixed;top:40%;left: 50%;' +
'z-index:9999;height: 65px;padding: 0 30px;line-height: 65px;' +
';border: 1px solid #ddd;"></span>');
$('body').append($tiq);
}
$tiq.stop(true).html('<i class="fa fa-check-circle-o" style="margin-right: 10px;color: #009f95;font-size: 20px"></i>'+tiq).css({'margin-left': -$tiq.outerWidth() / 2,'color':'#444','background-color':'#fff'}).fadeIn(500).delay(1500).fadeOut(500);
}
function ShowDanger(tip) {
var $tip = $('#tip');
if ($tip.length == 0) {
// 设置样式也可以定义在css文件中
$tip = $('<span id="tip" style="border-radius:3px;position:fixed;top:50px;left: 50%;' +
'z-index:9999;height: 35px;padding: 0 15px;line-height: 35px;' +
';border: 1px solid #a94442;"><i class="fa fa-times-circle-o"></i></span>');
$('body').append($tip);
}
$tip.stop(true).text(tip).css({'margin-left': -$tip.outerWidth() / 2,'color':'#a94442','background-color':'#fff'}).fadeIn(500).delay(1000).fadeOut(500);
}
function ShowSubmit(tiq) {
var $tiq = $('#tir');
if ($tiq.length == 0) {
// 设置样式也可以定义在css文件中
$tiq = $('<span id="tir" style="border-radius:3px;position:fixed;top:40%;left: 50%;' +
'z-index:9999;height: 65px;padding: 0 30px;line-height: 65px;' +
';border: 1px solid #ddd;"></span>');
$('body').append($tiq);
}
$tiq.stop(true).html('<img src="img/loading.gif" style="margin-top: -7px;margin-right: 15px;vertical-align: middle;"/>'+tiq).css({'margin-left': -$tiq.outerWidth() / 2,'color':'#444','background-color':'#fff'}).fadeIn(500);
}
// 点击复制内容
// $('.copyAddr').click(function(){
// var text = $(this).parents("li").children(".authorList").text();
// var input = $(this).parents("li").children(".copy_text");
// input.value = text; // 修改文本框的内容
// console.log(text);
// console.log(input.value);
// input.select(); // 选中文本
// document.execCommand("Copy"); // 执行浏览器复制命令
// })
//时间
var formatTimeToDate1 = function(time){
return new Date(time).format("yyyy");
};
var formatTimeToDate2 = function(time){
return new Date(time).format("dd/MM/yyyy");
};
var formatTimeToDate3 = function(time){
return new Date(time).format("yyyy-MM-dd hh:mm:ss");
};
var formatTimeToDate4 = function(time){
return new Date(time).format("yyyy-MM-dd");
};
Date.prototype.format = function(format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S+": this.getMilliseconds()
};
if (/(y+)/i.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
}
for (var k in date) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1
? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
}
}
return format;
};
// 头部
$('#top_bar').load('header.html')
$('#index_top').load('header_in.html')
// 高度一致
function whit_color() {
// if($(".art_side").height() > $(".art_main").height()){
// $(".art_main").css("height",$(".art_side").height());
// }else{
// $(".art_side").css("height",$(".art_main").height());
// }
}
// 图片放大
function imgbig(which){
var imgsrc = $(which).find('img').attr('src');
$("#bigimg").css("display","block");
$("#bigimg").html("<img src="+imgsrc+" onmousewheel='return rollImg(this)'/>");
$('#bigimg>img').css('margin-top',-$('#bigimg>img').height()/2);
$('body').css({"overflow-x":"hidden","overflow-y":"hidden"});
}
function closeimg() {
$("#bigimg").css("display","none");
$('html,body').removeClass('ovfHiden');
$('body').css({"overflow-x":"auto","overflow-y":"auto"});
}
function rollImg(o){
/* 获取当前页面的缩放比
若未设置zoom缩放比则为默认100%即1原图大小
*/
var zoom=parseInt(o.style.zoom)||100;
/* event.wheelDelta 获取滚轮滚动值并将滚动值叠加给缩放比zoom
wheelDelta统一为±120其中正数表示为向上滚动负数表示向下滚动
*/
zoom+=event.wheelDelta/12;
/* 如果缩放比大于0则将缩放比加载到页面元素 */
if (zoom>0) o.style.zoom=zoom+'%';
/* 如果缩放比不大于0则返回false不执行操作 */
return false;
}
var pan_type =function pan_type(e) {
if (e == 'A') {
var typ_tet = 'ARTICLE'
} else if (e == 'B') {
var typ_tet = 'REVIEW'
} else if (e == 'C') {
var typ_tet = 'CASE REPORT'
} else if (e == 'P') {
var typ_tet = 'RESEARCH PROPOSAL'
} else if (e == 'N') {
var typ_tet = 'NEWS'
} else if (e == 'T') {
var typ_tet = 'COMMENT'
} else if (e == 'CT') {
var typ_tet = 'CORRECTION';
} else if (e == 'HT') {
var typ_tet = 'HYPOTHESIS';
} else if (e == 'PF') {
var typ_tet = 'PREFACE';
} else if (e == 'ET') {
var typ_tet = 'EDITORIAL';
} else if (e == 'RP') {
var typ_tet = 'REPORT';
} else if (e == 'EF') {
var typ_tet = 'EMPIRICAL FORMULA';
} else if (e == 'EM') {
var typ_tet = 'EVIDENCE-BASED MEDICINE';
} else if (e == 'EC') {
var typ_tet = 'EXPERT CONSENSUS';
} else if (e == 'LTE') {
var typ_tet = 'LETTER TO EDITOR';
} else if (e == 'QI') {
var typ_tet = 'QUESTIONNAIRE INVESTIGATION';
} else if (e == 'PT') {
var typ_tet = 'PROTOCOL';
} else if (e == 'CS') {
var typ_tet = 'CASE SERIES';
}else{
var typ_tet = 'OTHER';
}
return typ_tet;
}