// 地址
// 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 = $('');
$('body').append($tiq);
}
$tiq.stop(true).html('' + 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 = $('');
$('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 = $('');
$('body').append($tiq);
}
$tiq.stop(true).html('
' + 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("
");
$('#bigimg>img').css('margin-top', -$('#bigimg>img').height() / 2);
$('body').css({ "overflow-x": "hidden", "overflow-y": "hidden" });
}
function imgbig1(which) {
console.log('which at line 186:', which);
// 查找 `a` 内部是否有 `div` 并获取其背景图
var targetDiv = $(which).find('div').first(); // 获取 `a` 内的第一个 `div`
if (targetDiv.length === 0) {
console.warn("No div found inside ");
return;
}
var imgsrc = targetDiv.css("background-image"); // 获取 `div` 的背景图片
console.log('imgsrc at line 187:', imgsrc);
if (!imgsrc || imgsrc === "none") {
console.warn("No background-image found on the div");
return;
}
imgsrc = imgsrc.replace(/^url\(["']?/, '').replace(/["']?\)$/, ''); // 处理 URL 去掉多余字符
$("#bigimg").css("display", "block");
$("#bigimg").html("
");
$('#bigimg>img').css('margin-top', -$('#bigimg>img').height() / 2);
$('body').css({ "overflow-x": "hidden", "overflow-y": "hidden" });
}
function truncateTextToHeight(element, maxHeight) {
const originalText = element.innerText.trim();
const words = originalText.split(' ');
let truncatedText = '';
let low = 0;
let high = words.length - 1;
let bestFit = 0;
// 设置元素样式以确保正确计算高度
element.style.whiteSpace = 'normal';
element.style.wordBreak = 'break-word';
element.style.display = 'block';
element.style.overflow = 'hidden';
// 二分查找以确定最佳截断点
while (low <= high) {
const mid = Math.floor((low + high) / 2);
const testText = words.slice(0, mid + 1).join(' ') + '...';
element.innerText = testText;
if (element.scrollHeight > maxHeight) {
high = mid - 1;
} else {
bestFit = mid;
low = mid + 1;
}
}
// 最终截断文本并添加省略号
truncatedText = words.slice(0, bestFit + 1).join(' ') + '...';
element.innerText = truncatedText;
}
// 使用示例
document.addEventListener('DOMContentLoaded', () => {
const traditionElements = document.querySelectorAll('.tradition-text');
traditionElements.forEach(element => {
truncateTextToHeight(element, 240); // 240px 为最大高度
});
});
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;
}