function launchFullScreen(element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } } function cancelFullScreen() { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } } function isFullScreen() { return document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement || document.webkitFullScreen; } function canFullScreen() { return !!(document.fullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled || document.mozFullScreenEnabled); } $("a.favorite").click(function () { var me = $(this); $.post("/Resource.AddFav.data", { ID: ID, SubjectID: SubjectID }, function () { if (me.is("a.on")) { me.removeClass("on").html("收藏"); } else { me.addClass("on").html("取消收藏"); } }); }); $("a.recovery").click(function () { window.EditIframeWin = dialog({ title: '资源纠错', id: 'EditShare', content: "
", okValue: '保存', cancelValue: '取消', cancel: true, ok: function () { var Iframe = document.getElementById("AutoIframe"); Iframe.contentWindow.Save(); return false; } }).showModal(); window.OnEditResource = function () { top.EditIframeWin.close(); dialog({ title: '提示窗口', content: "资源纠错提交成功,请耐心等待编辑审核。", cancelValue: '关闭', cancel: true }).showModal(); }; }); $("a.StartDown").click(function () { StartDown(); }); function StartDown() { var win = dialog({ title: '下载确认' }).showModal(); var info = {}; info.ID = ID; info.SubjectID = SubjectID; $.post("/Resource.StartDown.data", info, function (html) { win.content(html); }); } $("a.postcrm").click(function () { var html = []; html.push(""); var win = dialog({ title: "申请信息", content: html.join(""), okValue: "提交", ok: function () { var info = {}; info.lxrname = $("input:text[name=lxrname]").val(); info.lxrtel = $("input:text[name=lxrtel]").val(); info.fzrname = $("input:text[name=fzrname]").val(); info.fzrtel = $("input:text[name=fzrtel]").val(); var nameReg = /^[\u4e00-\u9fa5]{2,4}$/; var mobileReg = /^1[3,4,5,8]\d{9}$/; if (info.lxrname == "" || !nameReg.test(info.lxrname)) { showTip("请输入[2-4]位中文联系人名称"); return false; } if (info.lxrtel == "" || !mobileReg.test(info.lxrtel)) { showTip("联系人:" + info.lxrname + "手机号码填写错误"); return false; } if (info.fzrname == "" || !nameReg.test(info.fzrname)) { showTip("请输入[2-4]位中文负责人名称"); return false; } if (info.fzrtel == "" || !mobileReg.test(info.fzrtel)) { showTip("负责人:" + info.fzrname + "手机号码填写错误"); return false; } $.post("/Login.PostCrm.data", info, function () { //location.reload(true); showTip("提交成功,信息正在审核中!"); }); return false; }, cancel: true, cancelValue: "取消", }).showModal(); }); $("span.star b").hover(function () { var valTip = ["很差", "较差", "还行", "推荐", "力荐"]; var span = $(this).parent(); if (span.is("span.do")) return; var index = $(this).index(); span.find("b").removeClass("on"); span.find("b:lt(" + (index + 1) + ")").addClass("on"); span.next().text(valTip[index]); }, function () { var span = $(this).parent(); if (span.is("span.do")) return; span.find("b").removeClass("on"); span.next().text("评星"); }).click(function () { var span = $(this).parent(); if (span.is("span.do")) return; var index = $(this).index(); $.post("/Resource.Star.data", { ID: ID, SubjectID: SubjectID, Star: index + 1 }, function () { span.addClass("do"); span.prev().text("你已评价:"); }); }); $("a.report").click(function () { var html = []; html.push("
"); html.push(" "); html.push(" "); html.push("
"); dialog({ id: 'ReportWin', title: "举报资源", content: html.join(""), statusbar: '', cancelValue: '取消', cancel: true, okValue: '确定', ok: function () { var info = {}; info.ID = ID, info.SubjectID = SubjectID, info.ErrorType = $("ul.issue-sort li.on a").attr("rtid"); info.DescriptionID = $("ul.issue-detail li.on a").attr("rid"); $.post("/Resource.Report.data", info, function () { showTip("举报提交成功,请等待相关人员审核!"); }); } }).showModal(); var errorTypeID = window.ErrorTypeList[0].key; $("ul.issue-detail").append(SetErrorRejection(errorTypeID)); $("ul.issue-sort a").click(function () { $("ul.issue-sort li").removeClass("on"); $(this).parent().addClass("on"); errorTypeID = $(this).attr("rtid"); $("ul.issue-detail li").remove(); $("ul.issue-detail").append(SetErrorRejection(errorTypeID)); }); $("ul.issue-detail").on("click", "a", function () { $("ul.issue-detail li").removeClass("on"); $(this).parent().addClass("on"); }); }); function SetErrorRejection(onErrorType) { var html = []; var first = true; for (var i = 0; i < window.RejectionList.length; i++) { var rejection = window.RejectionList[i]; if (rejection.ReportType != onErrorType) { continue; } if (first) { html.push("
  • "); } else { html.push("
  • "); } html.push(" " + rejection.Descr + ""); html.push("
  • "); first = false; } if (first || !window.IsAdmin) { $("div.issue-action li[name=notEmpty]").hide(); } return html.join(""); } function MakePreView() { $.post("/Resource.MakePreView.data", { ID: ID, SubjectID: SubjectID }, function (html) { if (html == "1") location = location; else { setTimeout(function () { MakePreView(); }, 10000); } }); } $("a[data-view]").click(function () { $("#documentViewer").html(""); $("div.actionTool").show(); }); var timer; $("a.fullScreen").click(function () { if ($("body").is(".full-screen")) { $("html,body").removeClass('full-screen'); $(this).removeClass("cancelFullScreen"); cancelFullScreen(); $("#documentViewer>iframe").height("100%"); clearTimeout(timer); } else { $("html,body").addClass('full-screen'); $(this).addClass("cancelFullScreen"); launchFullScreen(document.documentElement); timer = setTimeout(function () { $("#documentViewer>iframe").height($(document.body).height() - 47); }, 1000); } }); $("a.DelShare").click(function () { showConfirm("您确定删除资源吗?", function () { $.post("/Resource.Delete.data", { id: ID, subjectID: SubjectID }, function () { if (window.opener) window.opener.location = window.opener.location;; alert("删除成功!"); window.open('', '_self', ''); window.opener = null; window.close(); }); }); }); //相关文档脚本 $("#listGoPrev").addClass("disabled"); //var serveMarquee = new Marquee(["ListFrame", "ListCont"], 4, 0.2, 222, 420, 20, 10000, 3000, 222); var serveMarquee = new Marquee(["ListFrame", "ListCont"], 4, 0.2, 222, 387, 20, 10000, 3000, 222); $("#listGoPrev").click(function () { serveMarquee.Run(3); }); //跳过等待时间向左滚动 $("#listGoNext").click(function () { serveMarquee.Run(2); }); //跳过等待时间向右滚动 //将按钮置为不可点击(样式) serveMarquee.OnBound = function () { if (serveMarquee.Bound == 3) { $("#listGoPrev").addClass("disabled"); } else { $("#listGoNext").addClass("disabled"); } }; //滚动至边界做相应处理,切换按钮状态(样式) serveMarquee.UnBound = function () { $("#listGoNext").removeClass("disabled"); $("#listGoPrev").removeClass("disabled"); }; //非边界状态处理 Comment = { SetCount: function (isok, data, rowcount) { $("span.commentNum a").html(rowcount); }, ShowInsert: function (id) { var html = []; html.push("
    "); html.push(" "); html.push("
    "); dialog({ id: 'InsertComment', title: "快速评论", content: html.join(""), okValue: '马上发布', cancelValue: '取消', cancel: true, ok: function () { var text = $("#CommentPanel textarea").val(); CommentAPI.Insert('Comment.Insert', id, id, text); } }).showModal(); }, Insert: function (isok, data) { if (isok) { showTip("评论成功"); CommentAPI.List('Comment.SetCount', data.ToID); } else { showTip(data); } }, };