收回去(折叠回去) $(".expressServiceTab").tabs('select', 0); }); var GLOBAL_BASE_API_URL = "http://api.interlib.com.cn:6699/interes"; function showAllBookMetaInfoTab(data) { $.each(data, function(i) { var isbn = data[i].isbn; var isCatalogEmpty = data[i].isCatalogEmpty; var isPreviewEmpty = data[i].isPreviewEmpty; var isSummaryEmpty = data[i].isSummaryEmpty; var isAuthorIntroduction = data[i].isAuthorIntroductionEmpty; if(!isCatalogEmpty) { $("#book_catalog_" + isbn).show(); } if(!isPreviewEmpty) { $("#book_preview_" + isbn).show(); } if(!isSummaryEmpty) { $("#book_summary_" + isbn).show(); } if(!isAuthorIntroduction) { $("#book_authorIntroduction_" + isbn).show(); } }); } //图书目录信息,图书试读信息,图书内容简介,图书著者简介 function showBookAllMetaInfo(bookrecno) { if($.cookie("configouternet")!="false"){ getBookAllMetaInfo(bookrecno); } } function getBookAllMetaInfo(bookrecno) { var loaded = $("#express_tab_" + bookrecno).attr("express_bookmeta_loaded"); if(trimToEmpty(loaded) == "1") { return; } $("#express_tab_" + bookrecno).attr("express_bookmeta_loaded", "1"); var isbn = $("#express_tab_" + bookrecno).attr("express_isbn"); //isbn = "9787308090957"; if($.trim(isbn) == "") { return; } var globalLibraryCode = "P2LN0415007"; var strURL = GLOBAL_BASE_API_URL + "/api/book/isbn/"+isbn+"/?glc="+globalLibraryCode+"&returnType=json" + "&callback=insertAllBookMetaInfo&jsoncallback=?"; $.getJSON(strURL, {}); } function insertAllBookMetaInfo(json) { if(json.isbn == undefined || json.isbn == null || json.result == undefined || json.result == null || json.result.length == 0) { //TODO 取豆瓣数据 //showDoubanSubject(); return; } var isbn = json.isbn; var bookCatalog = json.result.catalog; var previewUrl = trimToEmpty(json.result.previewUrl); var previewContent = json.result.previewContent; var summary = trimToEmpty(json.result.summary); var authorIntroduction = trimToEmpty(json.result.authorIntroduction); var bookrecno = $("div[express_isbn='" + isbn + "']").attr("express_bookrecno"); if(trimToEmpty(bookrecno) == "") { return; } var goTopTitleBlock = "

回到顶部

"; //$("#bookCatalog_" + bookrecno).html(bookCatalog); if(bookCatalog != "") { $("#bookCatalog_" + bookrecno).html(bookCatalog + goTopTitleBlock); } if(previewUrl != "") { var previewBlock = "

" + "" + "查看全部试读信息" + "

" + "
" + previewContent; $("#bookPreview_" + bookrecno).html(previewBlock + goTopTitleBlock); } else { if(previewContent != "") { $("#bookPreview_" + bookrecno).html(previewContent + goTopTitleBlock); } } if(summary != "") { $("#bookContentSummary_" + bookrecno).html(summary); } if(authorIntroduction != null) { $("#bookAuthorIntroduction_" + bookrecno).html(authorIntroduction); } if(summary == "" || authorIntroduction == "") { //showDoubanSubject(); } } function showHoldingPreview(bookrecno) { //这里需要这么做是因为$(".expressServiceTab").tabs('select', 0);这个动作会在tabs初始化后全部打开 //一次第一个tab,造成所有第一个tab数据同时请求服务器然后加载,所以这里用个标识,在第二次点击选择tab才 //真正请求加载数据然后显示 var initTimes = $("#holdingPreviewDiv_" + bookrecno).attr("inittimes"); if(initTimes == "0") { $("#holdingPreviewDiv_" + bookrecno).attr("inittimes", "1"); return; } else if(initTimes == "1") { var isDone = $.trim($("#holdingPreviewDiv_" + bookrecno).html()); if(isDone == "") { var curLibcodes = getCurlibcodes(); $.ajax({ type: "GET", url: "/opac/book/holdingpreview/"+bookrecno+"", data: { "curLibcodes":curLibcodes }, dataType: "xml",//这里要用xml,如果用html,则在IE下无法解析这个数据 success: function(xml){ insertHoldingPreview(bookrecno, xml); } }); } } } function getCurlibcodes(){ return ""; } function insertHoldingPreview(bookrecno, data) { var glc="P2LN0415007"; var tableHeader = new Array("索书号", "所在馆", "所在馆藏地点", "在馆复本数"); if(glc=="P3JS0519059"){ tableHeader = new Array("架位号", "所在馆藏地点", "索书号", "所在馆", "在馆复本数"); } var tableContent = new Array(); var records = $(data).find("record"); records.each(function(i) { var callno = $(this).find("callno").text(); var curlib = $(this).find("curlib").text(); var curlibName = $(this).find("curlibName").text(); var curlocal = $(this).find("curlocal").text(); var curlocalName = $(this).find("curlocalName").text(); var copycount = $(this).find("copycount").text(); var shelfno = $(this).find("shelfno").text(); var dataArray = new Array(callno, curlibName, curlocalName, copycount); if(glc=="P3JS0519059"){ dataArray = new Array(shelfno, curlocalName, callno, curlibName, copycount); } tableContent.push(dataArray); }); var tableStr = ""; if(records.length == 0) { tableStr = "没有在馆复本记录."; } else { tableStr = createTable("expressTable", tableHeader, tableContent); //是否多于10条 if(records.length>10){ tableStr += "查看更多"; } } $("#holdingPreviewDiv_" + bookrecno).html(tableStr); } function createTable(className, tableHeader, tableContent) { var s = ""; if(className != undefined && className != "") { s = '
'; } for(index in tableHeader) { s += ""; } s += ""; for(index in tableContent) { s += ""; var recordData = tableContent[index]; var glc="P2LN0415007"; for(j in recordData) { var style = ""; if(glc=="P3JS0519059"&&j==0){ style = " style='color:red;'"; } s += "" + recordData[j] + ""; } s += ""; } s += "
" + tableHeader[index] + "
"; return s; } function trimToEmpty(str) { if(str == undefined || str == null) { return ""; } return $.trim(str); } $(function() { var facetFields = new Array("curlibcodeFacet", "subjectFacet", "authorFacet", "pubdateFacet", "booktypeFacet", "langFacet", "class1Facet"); for(index in facetFields) { var facetField = facetFields[index]; var isHide = $("#" + facetField + "UL .hide").length; if(isHide > 0) { $("#" + facetField + "LI").show(); } } }); function moreOrLessFacet(facetField) { var aObj = $("#" + facetField + "A"); var facetUL = $("#" + facetField + "UL .hide"); if(facetUL.length > 0) { facetUL.removeClass("hide").addClass("show"); aObj.html("显示较少.."); } else { $("#" + facetField + "UL .show").removeClass("show").addClass("hide"); aObj.html("显示较多.."); } } function getHoldingPreviews(bookrecnos) { var curLibcodes = getCurlibcodes(); $.ajax({ type: "GET", url: "/opac/book/holdingPreviews", data: { "bookrecnos": bookrecnos.join(","), "curLibcodes":curLibcodes, "return_fmt": "json" }, dataType: "json", success: function(data){ insertHoldingPreviews(bookrecnos,data); } }); } function insertHoldingPreviews(bookrecnos,data){ var showLocal = $.cookie("showLocal");//用于限定显示的馆藏地点 var curLibcodes = getCurlibcodes();//用于限定显示的分馆 var limitFlag = "0"; var recnoArray = new Array();//无馆藏记录的期刊集合 var glc = "P2LN0415007"; for(var i in bookrecnos) { var totalCopeyCount = 0; var totalLoanableCount =0; var bookrecno = bookrecnos[i]; var tableHeader = new Array("索书号", "所在馆", "所在馆藏地点"); tableHeader.push("在馆数/馆藏总数"); var tableContent = new Array(); var records = data.previews[bookrecno]; for(var j in records)收回去(折叠回去) $(".expressServiceTab").tabs('select', 0); }); var GLOBAL_BASE_API_URL = "http://api.interlib.com.cn:6699/interes"; function showAllBookMetaInfoTab(data) { $.each(data, function(i) { var isbn = data[i].isbn; var isCatalogEmpty = data[i].isCatalogEmpty; var isPreviewEmpty = data[i].isPreviewEmpty; var isSummaryEmpty = data[i].isSummaryEmpty; var isAuthorIntroduction = data[i].isAuthorIntroductionEmpty; if(!isCatalogEmpty) { $("#book_catalog_" + isbn).show(); } if(!isPreviewEmpty) { $("#book_preview_" + isbn).show(); } if(!isSummaryEmpty) { $("#book_summary_" + isbn).show(); } if(!isAuthorIntroduction) { $("#book_authorIntroduction_" + isbn).show(); } }); } //图书目录信息,图书试读信息,图书内容简介,图书著者简介 function showBookAllMetaInfo(bookrecno) { if($.cookie("configouternet")!="false"){ getBookAllMetaInfo(bookrecno); } } function getBookAllMetaInfo(bookrecno) { var loaded = $("#express_tab_" + bookrecno).attr("express_bookmeta_loaded"); if(trimToEmpty(loaded) == "1") { return; } $("#express_tab_" + bookrecno).attr("express_bookmeta_loaded", "1"); var isbn = $("#express_tab_" + bookrecno).attr("express_isbn"); //isbn = "9787308090957"; if($.trim(isbn) == "") { return; } var globalLibraryCode = "P2LN0415007"; var strURL = GLOBAL_BASE_API_URL + "/api/book/isbn/"+isbn+"/?glc="+globalLibraryCode+"&returnType=json" + "&callback=insertAllBookMetaInfo&jsoncallback=?"; $.getJSON(strURL, {}); } function insertAllBookMetaInfo(json) { if(json.isbn == undefined || json.isbn == null || json.result == undefined || json.result == null || json.result.length == 0) { //TODO 取豆瓣数据 //showDoubanSubject(); return; } var isbn = json.isbn; var bookCatalog = json.result.catalog; var previewUrl = trimToEmpty(json.result.previewUrl); var previewContent = json.result.previewContent; var summary = trimToEmpty(json.result.summary); var authorIntroduction = trimToEmpty(json.result.authorIntroduction); var bookrecno = $("div[express_isbn='" + isbn + "']").attr("express_bookrecno"); if(trimToEmpty(bookrecno) == "") { return; } var goTopTitleBlock = "

回到顶部

"; //$("#bookCatalog_" + bookrecno).html(bookCatalog); if(bookCatalog != "") { $("#bookCatalog_" + bookrecno).html(bookCatalog + goTopTitleBlock); } if(previewUrl != "") { var previewBlock = "

" + "" + "查看全部试读信息" + "

" + "
" + previewContent; $("#bookPreview_" + bookrecno).html(previewBlock + goTopTitleBlock); } else { if(previewContent != "") { $("#bookPreview_" + bookrecno).html(previewContent + goTopTitleBlock); } } if(summary != "") { $("#bookContentSummary_" + bookrecno).html(summary); } if(authorIntroduction != null) { $("#bookAuthorIntroduction_" + bookrecno).html(authorIntroduction); } if(summary == "" || authorIntroduction == "") { //showDoubanSubject(); } } function showHoldingPreview(bookrecno) { //这里需要这么做是因为$(".expressServiceTab").tabs('select', 0);这个动作会在tabs初始化后全部打开 //一次第一个tab,造成所有第一个tab数据同时请求服务器然后加载,所以这里用个标识,在第二次点击选择tab才 //真正请求加载数据然后显示 var initTimes = $("#holdingPreviewDiv_" + bookrecno).attr("inittimes"); if(initTimes == "0") { $("#holdingPreviewDiv_" + bookrecno).attr("inittimes", "1"); return; } else if(initTimes == "1") { var isDone = $.trim($("#holdingPreviewDiv_" + bookrecno).html()); if(isDone == "") { var curLibcodes = getCurlibcodes(); $.ajax({ type: "GET", url: "/opac/book/holdingpreview/"+bookrecno+"", data: { "curLibcodes":curLibcodes }, dataType: "xml",//这里要用xml,如果用html,则在IE下无法解析这个数据 success: function(xml){ insertHoldingPreview(bookrecno, xml); } }); } } } function getCurlibcodes(){ return ""; } function insertHoldingPreview(bookrecno, data) { var glc="P2LN0415007"; var tableHeader = new Array("索书号", "所在馆", "所在馆藏地点", "在馆复本数"); if(glc=="P3JS0519059"){ tableHeader = new Array("架位号", "所在馆藏地点", "索书号", "所在馆", "在馆复本数"); } var tableContent = new Array(); var records = $(data).find("record"); records.each(function(i) { var callno = $(this).find("callno").text(); var curlib = $(this).find("curlib").text(); var curlibName = $(this).find("curlibName").text(); var curlocal = $(this).find("curlocal").text(); var curlocalName = $(this).find("curlocalName").text(); var copycount = $(this).find("copycount").text(); var shelfno = $(this).find("shelfno").text(); var dataArray = new Array(callno, curlibName, curlocalName, copycount); if(glc=="P3JS0519059"){ dataArray = new Array(shelfno, curlocalName, callno, curlibName, copycount); } tableContent.push(dataArray); }); var tableStr = ""; if(records.length == 0) { tableStr = "没有在馆复本记录."; } else { tableStr = createTable("expressTable", tableHeader, tableContent); //是否多于10条 if(records.length>10){ tableStr += "查看更多"; } } $("#holdingPreviewDiv_" + bookrecno).html(tableStr); } function createTable(className, tableHeader, tableContent) { var s = ""; if(className != undefined && className != "") { s = '
'; } for(index in tableHeader) { s += ""; } s += ""; for(index in tableContent) { s += ""; var recordData = tableContent[index]; var glc="P2LN0415007"; for(j in recordData) { var style = ""; if(glc=="P3JS0519059"&&j==0){ style = " style='color:red;'"; } s += "" + recordData[j] + ""; } s += ""; } s += "
" + tableHeader[index] + "
"; return s; } function trimToEmpty(str) { if(str == undefined || str == null) { return ""; } return $.trim(str); } $(function() { var facetFields = new Array("curlibcodeFacet", "subjectFacet", "authorFacet", "pubdateFacet", "booktypeFacet", "langFacet", "class1Facet"); for(index in facetFields) { var facetField = facetFields[index]; var isHide = $("#" + facetField + "UL .hide").length; if(isHide > 0) { $("#" + facetField + "LI").show(); } } }); function moreOrLessFacet(facetField) { var aObj = $("#" + facetField + "A"); var facetUL = $("#" + facetField + "UL .hide"); if(facetUL.length > 0) { facetUL.removeClass("hide").addClass("show"); aObj.html("显示较少.."); } else { $("#" + facetField + "UL .show").removeClass("show").addClass("hide"); aObj.html("显示较多.."); } } function getHoldingPreviews(bookrecnos) { var curLibcodes = getCurlibcodes(); $.ajax({ type: "GET", url: "/opac/book/holdingPreviews", data: { "bookrecnos": bookrecnos.join(","), "curLibcodes":curLibcodes, "return_fmt": "json" }, dataType: "json", success: function(data){ insertHoldingPreviews(bookrecnos,data); } }); } function insertHoldingPreviews(bookrecnos,data){ var showLocal = $.cookie("showLocal");//用于限定显示的馆藏地点 var curLibcodes = getCurlibcodes();//用于限定显示的分馆 var limitFlag = "0"; var recnoArray = new Array();//无馆藏记录的期刊集合 var glc = "P2LN0415007"; for(var i in bookrecnos) { var totalCopeyCount = 0; var totalLoanableCount =0; var bookrecno = bookrecnos[i]; var tableHeader = new Array("索书号", "所在馆", "所在馆藏地点"); tableHeader.push("在馆数/馆藏总数"); var tableContent = new Array(); var records = data.previews[bookrecno]; for(var j in records){ var callnos = records[j].callno; var curlib = records[j].curlib; var curlibName = records[j].curlibName; var curlocal = records[j].curlocal; var curlocalName = records[j].curlocalName; var copycount = records[j].copycount; var loanableCount = records[j].loanableCount; if(showLocal!=null&&showLocal!=""&&showLocal!=curlocal){ continue; } if(limitFlag=="1"&&curLibcodes&&(curLibcodes+",").indexOf(curlib+",")==-1){ //只累计馆藏总数 totalCopeyCount+=copycount; continue; } var callno = ""; if(callnos){ var callnoArray = callnos.split(","); for(var index in callnoArray){ if(index<=2) { if (callno) { callno += ","; } callno += callnoArray[index]; }else if(index==3){ callno+="..." } } } totalCopeyCount+=copycount; totalLoanableCount+=loanableCount; var dataArray = new Array(callno, curlibName, curlocalName, loanableCount+"/"+copycount); tableContent.push(dataArray); var limits = ""; if(limits==""||(limits+",").indexOf(curlocal+",")!=-1){ if(loanableCount>0){ $("#loanDiv_"+bookrecno).show(); } } } var tableStr = ""; var holding_available = "在馆"; var tabStr = holding_available+"("+totalLoanableCount +")/馆藏("+totalCopeyCount+")"; var flag = false; if(records==undefined||records==null||totalCopeyCount == 0) { tableStr = "没有在馆复本记录."; var divObj = $("div[bookrecno='"+bookrecno+"']"); if(divObj&&divObj.attr("booktype")=="2"){ recnoArray.push(bookrecno); tabStr = '到馆信息'; tableStr = '没有记录!'; flag = true; }else if(divObj&&divObj.attr("booktype")=="6"&&glc=='P2GD020003'){ //隐藏电子资源馆藏标签 $("#holdingPreview_A_"+bookrecno).parent().hide(); } } else { tableStr = createTable("expressTable", tableHeader, tableContent); //是否多于10条 if(records.length>10){ tableStr += "查看更多"; } } $("#holdingPreview_A_"+bookrecno).text(tabStr); if(flag){ $("#holdingPreviewDiv_" + bookrecno).html(""); }else { $("#holdingPreviewDiv_" + bookrecno).html(tableStr); } } } $(function(){ var bookrecnos = getBookrecnos(); getHoldingPreviews(bookrecnos); }); //请求期刊订购数据 function seriesOrders(recnos,curLibcodes){ var data = { "bookrecnos": recnos, "return_fmt": "json" } if(curLibcodes){ data.libcodes=curLibcodes.split(","); } $.ajax({ type: "GET", url: "/opac/series/order", data: data, traditional: true, dataType: "json", success: function(data){ if(data.serOrderList){ var tableHeader = new Array("分馆名称","订购年","订购份数"); var containsArray = new Array(); var yearArray = new Array(); for(var i in data.serOrderList){ var lib = data.libcodeMap[data.serOrderList[i].libcode]; var year = data.serOrderList[i].orderYear; var count = data.serOrderList[i].copies; var bookrecno = data.serOrderList[i].bookrecno; //保存前两个年份 if(yearArray.length==0||yearArray.length<2&&yearArray[0]!=year){ yearArray.push(year); } if($.inArray(bookrecno, containsArray)==-1){ var tableContent = new Array(); var dataArray = new Array(lib,year,count); tableContent.push(dataArray); containsArray.push(bookrecno); $("#holdingPreviewDiv_" + bookrecno).html(""); var tableStr = createTable("expressTable", tableHeader, tableContent); $("#holdingPreviewDiv_" + bookrecno).html(tableStr); }else{ var appendStr = ""+lib+""+year+""+count+""; $("#holdingPreviewDiv_" + bookrecno).find('table').append(appendStr); } } } } }); } $(function(){ //做一个高亮效果 function trim(s){ //去除左右空格 return s.replace(/(^\s*)|(\s*$)/g, ""); } var searchValueUpper ; var reg; function highlighter(items){ if(!items){ return; } items.each(function(){ var innerText=trim($(this).html()); //处理大小写问题 var innerTextUpper=innerText.toUpperCase(); var _index=innerTextUpper.indexOf(searchValueUpper); innerTextVal=innerText.substr(_index,searchValueUpper.length); if(reg.test(innerText)){ console.log(innerTextVal); //匹配成功 var newinner = innerText.replace(reg,''+innerTextVal+'')//处理HTML字符串,为目标文本加上样式,即替换对应的HTML结构 $(this).html(newinner);//把处理后的HTML字符串写回到容器中 } }); } //检索词 function light(searchValue,searchway){ searchValueUpper=searchValue.toUpperCase(); if(searchValue&&searchValue!="*:*"){ reg = new RegExp(searchValue,"gi"); if(searchway==""||searchway=="marc"){ highlighter($(".title-link")); highlighter($(".author-link")); highlighter($(".publisher-link")); }else if(searchway=="title"||searchway=="title200a"){ highlighter($(".title-link")); }else if(searchway=="author"){ highlighter($(".author-link")); }else if(searchway=="publisher"){ highlighter($(".publisher-link")); } } } var searchway = "subject"; if(!searchway){ searchway = "marc"; } light("(英)帕金森",searchway); }); //延迟加载的内容 $(window).load(function(){ setTimeout(function(){ var globalLibraryCode = "P2LN0415007"; //获取封面 loadBookcovers(globalLibraryCode); //自动获取图书元数据信息是否存在的标识  if($.cookie("configouternet")=="false"){ return; } var haveBookMetaResource = "1"; if(haveBookMetaResource != '1') { return; } function getDivISBNs() { var divObjects = $("div[express_isbn]"); var isbns = ""; divObjects.each(function(index){ var isbn = $(this).attr("express_isbn"); isbns += "," + isbn; }); return isbns; } var isbns = getDivISBNs(); if(isbns == "") { return; } var strURL = GLOBAL_BASE_API_URL + "/api/bookmetadatastatus?glc="+globalLibraryCode+"&isbns="+isbns +"&returnType=json&callback=showAllBookMetaInfoTab&jsoncallback=?"; $.getJSON(strURL, {}); //信息推送 $.getScript("http://api.interlib.com.cn:8586/InterlibCommonService/media/centerservice.js").done(function(){ var baseParam = "q=%28%E8%8B%B1%29%E5%B8%95%E9%87%91%E6%A3%AE&searchType=standard&isFacet=true&view=standard&searchWay=author&rows=10&sortWay=score&sortOrder=desc&curlibcode=999&searchWay0=marc&logical0=AND"; baseParam+="&numFound=0"; pushResultData(1,"P2LN0415007",baseParam); showAD(); }); }, 1000); }); //加载"图书馆"分面信息 $(function(){ $("#otherLibs").hide(); $.ajax({ type:"GET", url:"/opac/api/search?q=%28%E8%8B%B1%29%E5%B8%95%E9%87%91%E6%A3%AE&searchType=standard&isFacet=true&view=standard&searchWay=author&rows=10&sortWay=score&sortOrder=desc&searchWay0=marc&logical0=AND&wt=json", dataType: "json", success: function(data){ if(data&&data.facet_counts){ var libcodefacets = data.facet_counts.facet_fields.curlibcode; if(libcodefacets) { var index = 0; var libs = new Array(); var disablelib = ""; //加载检索结果数量 for (var i=0; i < libcodefacets.length; i++){ if((i+1)%2==1){ var libcode = libcodefacets[i]; var count = libcodefacets[i+1]; var li = $("li[code='"+libcode+"']");