捕获时间: 2026-09-05 07:16:00 · 状态: ok
if (!window.matchMedia) { var el = document.createElement('div'); el.style.cssText = "position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: #575757; z-index: 999999;"; el.innerHTML = '您当前使用的浏览器版本过低,建议尽快升级您的浏览器,以获得更好的浏览体验!'; document.documentElement.appendChild(el); } 故宫博物院 var imgs_ico = ""?"":'https://img.dpm.org.cn/static/themes/themes_wap/image/wechat_share1.png'; var title = ""?"":""; if(title != ''){ title = title + ' - ' + "故宫博物院"; }else{ title = "故宫博物院"; } var tContent = ""?"":""; var urls2 = window.location.href; if(typeof imgs_ico === 'undefined' || imgs_ico == ''){ imgs_ico = 'https://img.dpm.org.cn/static/themes/themes_wap/image/wechat_share1.png?v=765'; } if(typeof title === 'undefined' || title == ''){ title = "故宫博物院"; } if(typeof tContent === 'undefined' || tContent == ''){ tContent = "故宫博物院成立于1925年10月10日,是以明清两代皇宫和宫廷旧藏文物为基础建立起来的大型综合性古代艺术博物馆,是世界文化遗产地、全国重点文物保护单位和爱国主义教育示范基地。"; } function isWeiXin() { //判断是否微信 var ua = window.navigator.userAgent.toLowerCase(); // console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1 if (ua.match(/MicroMessenger/i) == 'micromessenger') { return true; } else { return false; } } function isdingding(){ //判断是不是钉钉 var ua = navigator.userAgent.toLowerCase(); return ua.indexOf("dingtalk") >= 0; } if(isWeiXin()){ if(!(urls2.indexOf("?") >= 0) ) { //判断urls2地址中是否包含link字符串 urls2 += '?from=groupmessage'; }else if((urls2.indexOf("?from=groupmessage")) >= 0){ window.location.href = urls2.substr(0,urls2.indexOf("?from=groupmessage")); }else if((urls2.indexOf("?from=singlemessage")) >= 0){ window.location.href = urls2.substr(0,urls2.indexOf("?from=singlemessage")); } if(imgs_ico.indexOf("https://img.dpm.org.cn") >= 0){ }else{ imgs_ico = 'https://img.dpm.org.cn'+imgs_ico; } }else if(isdingding()){ if(!(urls2.indexOf("?") >= 0) ) { //判断urls2地址中是否包含link字符串 window.location.href = urls2 + '?_wap=1'; }else if(!(urls2.indexOf("_wap")>= 0) ){ window.location.href = urls2 + '&_wap=1'; } } window.shareData = { "imgUrl": imgs_ico, //分享图片地址 "timeLineLink": urls2, // 分享朋友圈地址链接 "sendFriendLink": urls2, // 分享好友地址链接 "tTitle": title, //分享标题 "tContent": tContent //分享描述 }; // "timeLineLink": "https://www.dpm.org.cn/index.html?", // 分享朋友圈地址链接 // "sendFriendLink": "https://www.dpm.org.cn/index.html?", // 分享好友地址链接 // "weiboLink": "https://www.dpm.org.cn/index.html?", // 分享微博地址链接 // "tContent": "故宫博物院贺岁迎祥展" //分享描述 document.addEventListener('DOMContentLoaded', function() { // 设置OG标题 var ogTitle = document.querySelector('meta[property="og:title"]'); ogTitle.setAttribute("content", title); // 设置OG类型 var ogType = document.querySelector('meta[property="og:type"]'); ogType.setAttribute("content", "article"); // 设置OG链接 var ogUrl = document.querySelector('meta[property="og:url"]'); ogUrl.setAttribute("content", urls2); // 设置OG图片 var ogImage = document.querySelector('meta[property="og:image"]'); ogImage.setAttribute("content", imgs_ico); // 设置OG描述 var ogDescription = document.querySelector('meta[property="og:description"]'); ogDescription.setAttribute("content", tContent); // 请替换为实际的描述内容 // 设置OG网站名称 var ogSiteName = document.querySelector('meta[property="og:site_name"]'); ogSiteName.setAttribute("content", "故宫博物院"); }); const SHOW_NEW_TIME = "15" * 86400; const FILTER_ID = ["256458"]; function newTag(parentObj, titleObj, timeObj){ const _parent = parentObj||'#datalist .li' const _title = titleObj||'.p' const _time = timeObj||'.y' let today = new Date(); today.setHours(0, 0, 0, 0); // 设置时分秒和毫秒为0 $(_parent).find(_title).each(function(){ var date = new Date($(this).parents(_parent).find(_time).text()) date.setHours(0, 0, 0, 0); var timeDifference = Math.round(Math.abs(today - date) / 1000); var href = $(this).parents(_parent).find('a').attr('href')||''; var mach = href.match(/\/(\w+\/)?(\d+)(?:\.\w+)?$/); var id = (mach && mach.length>=3)? mach[2].toString() : ''; if(SHOW_NEW_TIME - timeDifference > 0 && !$(this).find('em').length && FILTER_ID.indexOf(id) < 0){ $(this).append('新') } }) } function downFile(url, fileName) { const x = new XMLHttpRequest() x.open('GET', url, true) x.responseType = 'blob' x.onload = function() { const url = window.URL.createObjectURL(x.response) const a = document.createElement('a') a.href = url a.download = fileName a.click() } x.send() } $(function(){ newTag() }) // 初始化时检查hash window.onload = function() { checkHash(); }; // 监听popstate事件 window.addEventListener('popstate', function(event) { checkHash(); }); // 自定义函数来检查hash并处理变化 function checkHash() { var hash = window.location.hash; if($(window).width() 0){ __top = 130; } console.log(__top); $("html,body").animate({ scrollTop: $(hash).offset().top - __top },200); } } // 确保变量已经被定义 var topic_name = topic_name || null; // 如果topic_name未定义,则默认为null var topic_id = topic_id || null; // 如果topic_id未定义,则默认为null var sensors = window['sensorsDataAnalytic201505']; var server_url = ''; if(window.location.hostname == 'ticket.dpm.org.cn' || window.location.hostname == 'www.dpm.org.cn'){ server_url = '//gugong-pro.datasink.sensorsdata.cn/sa?project=production&token=d55b8755fac048ef'; }else{ server_url = '//gugong-pro.datasink.sensorsdata.cn/sa?project=default&token=d55b8755fac048ef'; } sensors.init({ server_url: server_url, is_track_single_page:false, // 单页面配置,默认开启,若页面中有锚点设计,需要将该配置删除,否则触发锚点会多触发 $pageview 事件 use_client_time:true, send_type:'beacon', show_log:false, // 是否显示日志 heatmap: { //是否开启点击图,default 表示开启,自动采集 $WebClick 事件,可以设置 'not_collect' 表示关闭。 clickmap:'default', //是否开启触达图,not_collect 表示关闭,不会自动采集 $WebStay 事件,可以设置 'default' 表示开启。 scroll_notice_map:'default' } }); // 初始化 SDK // 注册公共属性 sensors.registerPage({ current_url: location.href, referrer: document.referrer, platform_type:'web端', business_line:'故宫中文网站', language_type:"中文", special_topic_name:topic_name, special_topic_id:topic_id, product_version:"1.0.0", }); sensors.quick('autoTrack'); // sensors.use('pageleave',{ // custom_props:{ // prop1:'value1' // }, // heartbeat_interval_time: 5, // max_duration: 5 * 24 * 60 * 60, // isCollectUrl: function(url){ // // url 为要采集页面浏览时长的页面地址。 // return true; // 采集 // // return false; // 不采集 // } // }); function shence_sensors(type_name, arr){ sensors.track(type_name, arr); } import pageleave from 'https://img.dpm.org.cn/static/jquery/sa-sdk-javascript-1.27.2/dist/web/plugin/pageleave/index.es6.js'; sensors.use(pageleave,{ custom_props:{ page_name:$('title').text(), view_percent:100 }, heartbeat_interval_time: 5, max_duration: 5 * 24 * 60 * 60, isCollectUrl: function(url){ // url 为要采集页面浏览时长的页面地址。 return true; // 采集 // return false; // 不采集 } }); var CONFIG = { UID: -1, UID_STATUS: false, timestamp: function() { return Date.parse(new Date())/1000; }, checkLogin: function(callback) { var c = this; if (c.UID === -1) { $.cookie.path = '/'; c.UID = $.cookie("user_auth"); var check_time = $.cookie("user_check_time"); if ( c.UID && (! check_time || (c.timestamp() - check_time > 60 * 5)) ) { $.post("/member/get_uid.html", function(res) { console.log('get_uid', res); data = res.data if (! data || ! data.uid || data.uid != c.UID) { $.removeCookie("user_auth"); } else if (data && data.uid) { localStorage.setItem("get_sso", data.uid); c.UID = data.uid; } $.cookie("user_check_time", c.timestamp()); c.checkLogin(callback); }); return; } } if (c.UID) { if (typeof(callback) == 'function') { callback(c.UID, c); } c.UID_STATUS = sessionStorage.getItem("user_auth_status") ? true : false; if(c.UID_STATUS === false){ localStorage.setItem("get_sso", c.UID); } sessionStorage.setItem("user_auth_status",1) return true; }else{ c.UID_STATUS = false; sessionStorage.removeItem("user_auth_status"); } return false; }, getSeasonal: function (callback) { //获取季节 $.cookie.path = '/'; // var SEASONAL = localStorage.getItem("seasonal"); // console.log(SEASONAL) // if (!SEASONAL) { $.post("/ajax/get_season.html", function (data) { if (data && data.msg) { localStorage.setItem("seasonal", data.msg); if(typeof callback =