/** 组件js ***/ /** 登录状态 */ $(document).ready(function(){ if($("#mag-component-loginStatus").length>0){ mag_ajax_update({ ele_id:'mag-component-loginStatus', url:mag_currentQikanUrl() + '/CN/user/loginStatus.do' }); } var index=0; $("div[mag-component-type='loginStatus']").each(function(){ index++; $(this).attr("mag-loginStatus-id",index); mag_ajax_update({ selector:"div[mag-loginStatus-id='"+index+"']", url:mag_currentQikanUrl() + '/CN/user/loginStatus.do', data:{forward:$(this).attr("forward")} }); }); }); /** 相关文章 */ $(document).ready(function(){ window.magComponentRelatedArticleIndex=0; $("div[mag-component-type='relatedArticle']").each(function(){ $(this).attr("id","mag-component-relatedArticle-"+(window.magComponentRelatedArticleIndex++)); var id=$(this).attr("mag-articleId"); mag_ajax_update({ ele_id:$(this).attr("id"), url:mag_currentQikanUrl() + '/CN/article/relatedArticle.do?id='+id, success:function(){ var relatedArticleCount=$("#mag-component-relatedArticleCount-"+id).val(); $("span[mag-component-type='relatedArticleCount'][mag-articleId='"+id+"']").html(relatedArticleCount); } }); }); }); /** 相关文章视频 */ $(document).ready(function(){ window.magComponentRelatedArticleVideoIndex=0; $("div[mag-component-type='relatedArticleVideo']").each(function(){ $(this).attr("id","mag-component-relatedArticleVideo-"+(window.magComponentRelatedArticleVideoIndex++)); var id=$(this).attr("mag-articleId"); mag_ajax_update({ ele_id:$(this).attr("id"), url:mag_currentQikanUrl() + '/CN/articleVideo/relatedArticleVideo.do?id='+id, success:function(){ var relatedArticleVideoCount=$("#mag-component-relatedArticleVideoCount-"+id).val(); $("span[mag-component-type='relatedArticleVideoCount'][mag-articleId='"+id+"']").html(relatedArticleVideoCount); } }); }); }); /** 组件请求List */ function mag_component(magId){ var componentRequestList=[]; var parentJqueryS = ""; if(magId){ parentJqueryS = "div[mag-id='"+magId + "'] "; } //专题购买按钮组件 $(parentJqueryS + "span[mag-component-type='subjectPurchase'][mag-subjectId]").each(function(){ var request={}; request.componentType='subjectPurchase'; request.subjectId=$(this).attr("mag-subjectId"); componentRequestList[componentRequestList.length]=request; }); //年卡购买 $(parentJqueryS + "span[mag-component-type='nianCardPurchase'][mag-nianNumber]").each(function(){ var request={}; request.componentType='nianCardPurchase'; request.nianNumber=$(this).attr("mag-nianNumber"); componentRequestList[componentRequestList.length]=request; }); //专题视频链接组件 $(parentJqueryS + "span[mag-component-type='showSubjectVideoUrl'][mag-subjectId]").each(function(){ var request={}; request.componentType='showSubjectVideoUrl'; request.subjectId=$(this).attr("mag-subjectId"); componentRequestList[componentRequestList.length]=request; }); //前一篇文章链接组件 $(parentJqueryS + "span[mag-component-type='previousArticle'][mag-articleId]").each(function(){ var request={}; request.componentType='previousArticle'; request.articleId=$(this).attr("mag-articleId"); componentRequestList[componentRequestList.length]=request; }); //下一篇文章链接组件 $(parentJqueryS + "span[mag-component-type='nextArticle'][mag-articleId]").each(function(){ var request={}; request.componentType='nextArticle'; request.articleId=$(this).attr("mag-articleId"); componentRequestList[componentRequestList.length]=request; }); //文章访问数 $(parentJqueryS + "span[mag-component-type='articleAccessesCount'][mag-articleId]").each(function(){ var request={}; request.componentType='articleAccessesCount'; request.articleId=$(this).attr("mag-articleId"); componentRequestList[componentRequestList.length]=request; }); //文章被引数 $(parentJqueryS + "span[mag-component-type='articleCitedCount'][mag-articleId]").each(function(){ var request={}; request.componentType='articleCitedCount'; request.articleId=$(this).attr("mag-articleId"); componentRequestList[componentRequestList.length]=request; }); //某个期刊是否被收录在期刊数据库中 $(parentJqueryS + "span[mag-component-type='isIncludeInDb'][mag-journalId][mag-journalDbId]").each(function(){ var request={}; request.componentType='isIncludeInDb'; request.journalId=$(this).attr("mag-journalId"); request.journalDbId=$(this).attr("mag-journalDbId"); componentRequestList[componentRequestList.length]=request; }); //某个语种的期刊数量 $(parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId][mag-language]").each(function(){ var request={}; request.componentType='journalCount'; request.jqunId=$(this).attr("mag-jqunId"); request.language=$(this).attr("mag-language"); componentRequestList[componentRequestList.length]=request; }); //根据期刊状态获得期刊数量 $(parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId][mag-journalStatus]").each(function(){ var request={}; request.componentType='journalCount'; request.jqunId=$(this).attr("mag-jqunId"); request.journalStatus=$(this).attr("mag-journalStatus"); componentRequestList[componentRequestList.length]=request; }); //前一期 $(parentJqueryS + "span[mag-component-type='previousIssue'][mag-volumnId]").each(function(){ var request={}; request.componentType='previousIssue'; request.volumnId=$(this).attr("mag-volumnId"); componentRequestList[componentRequestList.length]=request; }); //后一期 $(parentJqueryS + "span[mag-component-type='nextIssue'][mag-volumnId]").each(function(){ var request={}; request.componentType='nextIssue'; request.volumnId=$(this).attr("mag-volumnId"); componentRequestList[componentRequestList.length]=request; }); if(componentRequestList.length>0){ mag_ajax_update({ ele_id:'mag-component-store-div', url:mag_currentQikanUrl() + '/CN/component/component.do', data:{componentRequestList:JSON.stringify(componentRequestList)}, success:function(){ //专题购买-更新页面 $(parentJqueryS + "span[mag-component-type='subjectPurchase'][mag-subjectId]").each(function(){ var subjectId=$(this).attr("mag-subjectId"); $(this).html($("#mag-component-subjectPurchase-content[mag-subjectId='"+subjectId+"']").html()); }); //年卡购买-更新页面 $(parentJqueryS + "span[mag-component-type='nianCardPurchase'][mag-nianNumber]").each(function(){ var nianNumber=$(this).attr("mag-nianNumber"); $(this).html($("#mag-component-nianCardPurchase-content[mag-nianNumber='"+nianNumber+"']").html()); }); //专题视频链接组件 $(parentJqueryS + "span[mag-component-type='showSubjectVideoUrl'][mag-subjectId]").each(function(){ var subjectId=$(this).attr("mag-subjectId"); $(this).html($("#mag-component-showSubjectVideoUrl-content[mag-subjectId='"+subjectId+"']").html()); }); //前一篇文章链接组件 $(parentJqueryS + "span[mag-component-type='previousArticle'][mag-articleId]").each(function(){ var articleId=$(this).attr("mag-articleId"); $(this).html($("#mag-component-previousArticle-content[mag-articleId='"+articleId+"']").html()); }); //下一篇文章链接组件 $(parentJqueryS + "span[mag-component-type='nextArticle'][mag-articleId]").each(function(){ var articleId=$(this).attr("mag-articleId"); $(this).html($("#mag-component-nextArticle-content[mag-articleId='"+articleId+"']").html()); }); //文章访问数 $(parentJqueryS + "span[mag-component-type='articleAccessesCount'][mag-articleId]").each(function(){ var articleId=$(this).attr("mag-articleId"); $(this).html($("#mag-component-articleAccessesCount-content[mag-articleId='"+articleId+"']").html()); }); //文章被引数 $(parentJqueryS + "span[mag-component-type='articleCitedCount'][mag-articleId]").each(function(){ var articleId=$(this).attr("mag-articleId"); $(this).html($("#mag-component-articleCitedCount-content[mag-articleId='"+articleId+"']").html()); }); //某个期刊是否被收录在期刊数据库中 $(parentJqueryS + "span[mag-component-type='isIncludeInDb'][mag-journalId][mag-journalDbId]").each(function(){ var journalId=$(this).attr("mag-journalId"); var journalDbId=$(this).attr("mag-journalDbId"); $(this).html($("#mag-component-isIncludeInDb-content[mag-journalId='"+journalId+"'][mag-journalDbId='"+journalDbId+"']").html()); }); //某个语种的期刊数量 $(parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId][mag-language]").each(function(){ var jqunId=$(this).attr("mag-jqunId"); var language=$(this).attr("mag-language"); $(this).html($("#mag-component-journalCount-content[mag-jqunId='"+jqunId+"'][mag-language='"+language+"']").html()); }); //根据期刊状态获得期刊数量 $(parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId][mag-journalStatus]").each(function(){ var jqunId=$(this).attr("mag-jqunId"); var journalStatus=$(this).attr("mag-journalStatus"); $(this).html($("#mag-component-journalCount-content[mag-jqunId='"+jqunId+"'][mag-journalStatus='"+journalStatus+"']").html()); }); //前一期 $(parentJqueryS + "span[mag-component-type='previousIssue'][mag-volumnId]").each(function(){ var volumnId=$(this).attr("mag-volumnId"); $(this).html($("#mag-component-previousIssue-content[mag-volumnId='"+volumnId+"']").html()); }); //后一期 $(parentJqueryS + "span[mag-component-type='nextIssue'][mag-volumnId]").each(function(){ var volumnId=$(this).attr("mag-volumnId"); $(this).html($("#mag-component-nextIssue-content[mag-volumnId='"+volumnId+"']").html()); }); //清除store $("#mag-component-store-div").html(""); } }); } //所属期刊分类下的期刊数 $(parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId][mag-journalSortId]").each(function(){ componentRequestList=[]; var request={}; request.componentType='journalCount'; request.jqunId=$(this).attr("mag-jqunId"); request.journalSortId=$(this).attr("mag-journalSortId"); componentRequestList[componentRequestList.length]=request; mag_ajax_update({ selector:parentJqueryS + "span[mag-component-type='journalCount'][mag-jqunId='"+request.jqunId+"'][mag-journalSortId='"+request.journalSortId+"']", url:mag_currentQikanUrl() + '/CN/component/component.do', data:{componentRequestList:JSON.stringify(componentRequestList)} }); }); /** 文章状态图标 */ if($(parentJqueryS + "span[mag-component-type='articleStatusIcon'][mag-articleId]").length>0){ $(parentJqueryS + "span[mag-component-type='articleStatusIcon'][mag-articleId]").each(function(){ var articleId = $(this).attr("mag-articleId"); mag_ajax_update({ selector:parentJqueryS + "span[mag-component-type='articleStatusIcon'][mag-articleId='"+articleId+"']", url:mag_currentQikanUrl() + '/CN/article/articleStatusIcon.do', data:{articleId:articleId} }); }); } /** 专题文章数 */ if($(parentJqueryS + "span[mag-component-type='subjectArticleCount'][mag-subjectId]").length>0){ $(parentJqueryS + "span[mag-component-type='subjectArticleCount'][mag-subjectId]").each(function(){ var subjectId = $(this).attr("mag-subjectId"); mag_ajax_update({ selector:parentJqueryS + "span[mag-component-type='subjectArticleCount'][mag-subjectId='"+subjectId+"']", url:mag_currentQikanUrl() + '/CN/subject/subjectArticleCount.do', data:{subjectId:subjectId} }); }); } //异步加载页面 var ajaxPageIndex = 1; $(parentJqueryS + "div[mag-component-type='ajaxPage'][mag-page-url]").each(function(){ if(magId){ $(this).attr("mag-id",magId + "_" +(ajaxPageIndex++)); }else{ $(this).attr("mag-id","" + (ajaxPageIndex++)); } if($(this).attr("forwardJsp") != undefined && $(this).attr("forwardJsp")!=null){ var forwardJsp = $(this).attr("forwardJsp"); $(this).load($(this).attr("mag-page-url"),{ajax:true,forwardJsp:forwardJsp},function(response,status,xhr){ if(status=='success'){ mag_component($(this).attr("mag-id")); } }); }else{ $(this).load($(this).attr("mag-page-url"),{ajax:true},function(response,status,xhr){ if(status=='success'){ mag_component($(this).attr("mag-id")); } }); } }); } $(document).ready(function(){mag_component()}); /** 文章评价信息异步加载 */ function mag_showArticleEstimate(){ $("div[mag-component-type='articleEstimate'][mag-articleId]").each(function(){ var articleId = $(this).attr("mag-articleId"); $(this).load(mag_currentQikanUrl()+"/CN/article/showArticleEstimate.do?id="+articleId); }); } $(document).ready(function(){ mag_showArticleEstimate(); }); /** 文章评论信息异步加载 */ function mag_showArticleComment(){ $("div[mag-component-type='articleComment'][mag-articleId]").each(function(){ var articleId = $(this).attr("mag-articleId"); $(this).load(mag_currentQikanUrl()+"/CN/article/showArticleComments.do?id="+articleId); }); } $(document).ready(function(){ mag_showArticleComment(); });