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 = ""; if(!searchway){ searchway = ""; } light("长篇小说",searchway); 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=%E9%95%BF%E7%AF%87%E5%B0%8F%E8%AF%B4&searchType=standard&isFacet=true&view=standard&searchWay=subject&rows=10&sortWay=score&sortOrder=desc&curlibcode=001&f_subject=%E6%B1%89%E8%AF%AD&f_author=%E4%BC%AF%E5%86%85%E7%89%B9&f_author=%E4%B8%81%E5%9B%BD%E6%97%97&f_author=%5B%E7%BE%8E%5Dnicolas+forster%E6%94%B9%E7%BC%96&f_author=%28%E7%BE%8E%29%E5%BC%97%E6%9C%97%E8%A5%BF%E6%96%AF%C2%B7%E9%9C%8D%E5%A5%87%E6%A3%AE%C2%B7%E7%8F%AD%E7%BA%B3%E7%89%B9%28frances+hodgson+burnett%29%E5%8E%9F%E8%91%97&f_author=%E6%AF%9B%E8%8D%A3%E8%B4%B5&f_lang=eng&searchWay0=marc&logical0=AND"; baseParam+="&numFound=1"; pushResultData(1,"P2LN0415007",baseParam); showAD(); }); }, 1000); }); //加载"图书馆"分面信息 $(function(){ $("#otherLibs").hide(); $.ajax({ type:"GET", url:"/opac/api/search?q=%E9%95%BF%E7%AF%87%E5%B0%8F%E8%AF%B4&searchType=standard&isFacet=true&view=standard&searchWay=subject&rows=10&sortWay=score&sortOrder=desc&f_subject=%E6%B1%89%E8%AF%AD&f_author=%E4%BC%AF%E5%86%85%E7%89%B9&f_author=%E4%B8%81%E5%9B%BD%E6%97%97&f_author=%5B%E7%BE%8E%5Dnicolas+forster%E6%94%B9%E7%BC%96&f_author=%28%E7%BE%8E%29%E5%BC%97%E6%9C%97%E8%A5%BF%E6%96%AF%C2%B7%E9%9C%8D%E5%A5%87%E6%A3%AE%C2%B7%E7%8F%AD%E7%BA%B3%E7%89%B9%28frances+hodgson+burnett%29%E5%8E%9F%E8%91%97&f_author=%E6%AF%9B%E8%8D%A3%E8%B4%B5&f_lang=eng&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+"']"); var div = $("div[code='"+libcode+"']"); if(libcode!=disablelib){ if(div.length==1){ index++; div.find("span").html("("+count+"个结果)"); libs.push(libcode); }else if(li.length==1){ index++; li.find(".facetCount").html("("+count+")"); if(index<=10){ li.removeClass("hide") }else{ if(!li.hasClass("hide")){ li.addClass("hide"); } } libs.push(libcode); } } } } //隐藏无结果分馆 $("#otherLibs>div, #curlibcodeFacetUL>li").each(function(){ var libcode = $(this).attr("code"); if(libcode && $.inArray(libcode, libs)==-1){ 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 = ""; if(!searchway){ searchway = ""; } light("长篇小说",searchway); 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=%E9%95%BF%E7%AF%87%E5%B0%8F%E8%AF%B4&searchType=standard&isFacet=true&view=standard&searchWay=subject&rows=10&sortWay=score&sortOrder=desc&curlibcode=001&f_subject=%E6%B1%89%E8%AF%AD&f_author=%E4%BC%AF%E5%86%85%E7%89%B9&f_author=%E4%B8%81%E5%9B%BD%E6%97%97&f_author=%5B%E7%BE%8E%5Dnicolas+forster%E6%94%B9%E7%BC%96&f_author=%28%E7%BE%8E%29%E5%BC%97%E6%9C%97%E8%A5%BF%E6%96%AF%C2%B7%E9%9C%8D%E5%A5%87%E6%A3%AE%C2%B7%E7%8F%AD%E7%BA%B3%E7%89%B9%28frances+hodgson+burnett%29%E5%8E%9F%E8%91%97&f_author=%E6%AF%9B%E8%8D%A3%E8%B4%B5&f_lang=eng&searchWay0=marc&logical0=AND"; baseParam+="&numFound=1"; pushResultData(1,"P2LN0415007",baseParam); showAD(); }); }, 1000); }); //加载"图书馆"分面信息 $(function(){ $("#otherLibs").hide(); $.ajax({ type:"GET", url:"/opac/api/search?q=%E9%95%BF%E7%AF%87%E5%B0%8F%E8%AF%B4&searchType=standard&isFacet=true&view=standard&searchWay=subject&rows=10&sortWay=score&sortOrder=desc&f_subject=%E6%B1%89%E8%AF%AD&f_author=%E4%BC%AF%E5%86%85%E7%89%B9&f_author=%E4%B8%81%E5%9B%BD%E6%97%97&f_author=%5B%E7%BE%8E%5Dnicolas+forster%E6%94%B9%E7%BC%96&f_author=%28%E7%BE%8E%29%E5%BC%97%E6%9C%97%E8%A5%BF%E6%96%AF%C2%B7%E9%9C%8D%E5%A5%87%E6%A3%AE%C2%B7%E7%8F%AD%E7%BA%B3%E7%89%B9%28frances+hodgson+burnett%29%E5%8E%9F%E8%91%97&f_author=%E6%AF%9B%E8%8D%A3%E8%B4%B5&f_lang=eng&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+"']"); var div = $("div[code='"+libcode+"']"); if(libcode!=disablelib){ if(div.length==1){ index++; div.find("span").html("("+count+"个结果)"); libs.push(libcode); }else if(li.length==1){ index++; li.find(".facetCount").html("("+count+")"); if(index<=10){ li.removeClass("hide") }else{ if(!li.hasClass("hide")){ li.addClass("hide"); } } libs.push(libcode); } } } } //隐藏无结果分馆 $("#otherLibs>div, #curlibcodeFacetUL>li").each(function(){ var libcode = $(this).attr("code"); if(libcode && $.inArray(libcode, libs)==-1){ $(this).remove(); } }); //"更多"按钮的显示处理 if(index>10){ $("#curlibcodeFacetLI").show(); }else{ $("#curlibcodeFacetLI").hide(); } if(index>0){ $("#otherLibs").show(); }else{ $("#otherLibs").hide(); } } } } }); }); $(function(){ $.cookie("searcher_libcode", "004-03", {expires:365, path:'/opac'}); });