锘?function () {
//function isMobile() {
// var mobile = {
// Android: function () {
// return navigator.userAgent.match(/Android/i) ? true : false;
// },
// BlackBerry: function () {
// return navigator.userAgent.match(/BlackBerry/i) ? true : false;
// },
// iOS: function () {
// return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false;
// },
// Windows: function () {
// return navigator.userAgent.match(/IEMobile/i) ? true : false;
// },
// any: function () {
// return (this.Android() || this.BlackBerry() || this.iOS() || this.Windows());
// }
// };
// return mobile.any();
//}
//function createVideo(swfPath, src, width, height) {
// return '';
//}
//function createWmvVideo(src, width, height) {
// return '';
//}
//function createIeTooltip(width, height) {
// return '
鎮ㄨ闂殑閾炬帴鍗冲皢绂诲紑鈥? + siteName + '鈥濋棬鎴风綉绔欙紝鏄惁缁х画锛烖/div>',
{
btn: ['缁х画璁块棶', '鏀惧純'],
title: false,
shade: 0.7,
area: [w, h],
shadeClose: true,
end: function () {
if (type == "aLink") {
o.attr('href', href);
}
}
},
function () {
if (type == "aLink") {
o.attr('href', href);
}
layer.close(cf);
window.open(href, target);
},
function () {
if (type == "aLink") {
o.attr('href', href);
}
layer.close(cf);
});
} else if (LeaveSitePrompts == 'OnlyGovNoShow' && IsOnlyGovNoShow(href)) {
if (type == "aLink") {
o.attr('href', href);
} else {
window.open(href, target);
}
} else if (LeaveSitePrompts == 'NoShow') {
if (type == "aLink") {
o.attr('href', href);
} else {
window.open(href, target);
}
}
} else if (type == "select") {
window.open(href, target);
}
}
//鍒ゆ柇閾炬帴鏄笉鏄寘鍚玤ov.cn
function IsOnlyGovNoShow(url) {
if (url.indexOf('gov.cn') > -1) {
return true;
} else {
return false;
}
}
$(document).on('click',
'a:not("[data-power-noExcelLinks] a,[data-power-noExcelLink]")',
function () {
isExcelLink(this, "aLink");
});
$(document).on('change',
'[data-power-select-ExcelLink]',
function () {
isExcelLink(this, "select");
});
$(function () {
// 鏇挎崲鎴愬垎閽熸暟濡傛灉涓?0鍒嗛挓鍒欎负 60 * 60 *1000 銆
var expire = new Date();
expire.setTime(expire.getTime() + (15 * 60 * 1000));
// 鍒ゆ柇澶栭摼鎻愮ずCookie鏄惁瀛樺湪锛屼笉瀛樺湪灏卞幓鑾峰彇锛岄粯璁ゆ椂闂?5鍒嗛挓銆
if ($.cookie("PowerLeaveSitePrompts") == null) {
$.ajax({
url: "/Settings/LeaveSitePrompts/GetLeaveSitePrompts",
type: "POST",
dataType: "json",
success: function (data) {
$.cookie('PowerLeaveSitePrompts',
data.PowerLeaveSitePrompts,
{
path: '/', // cookie鐨勪綔鐢ㄥ煙銆
expires: expire
});
}
});
}
var dt = new Date();
dt = new Date(dt.getFullYear(), dt.getMonth(), dt.getDate(), 23, 59, 50);
// 鍒ゆ柇鐙珛璁垮Cookie鏄惁瀛樺湪锛屼笉瀛樺湪灏卞幓鑾峰彇锛岄粯璁ゆ椂闂?3灏忔椂59鍒嗛挓50绉掋€
if ($.cookie("PowerUniqueVisitor") == null) {
$.ajax({
url: "/SiteManage/SiteUniqueVisitorTraffic/AddSiteUniqueVisitorTraffic",
type: "POST",
dataType: "json",
success: function (data) {
$.cookie('PowerUniqueVisitor',
data.UniqueVisitorCookieKey,
{
path: '/', // cookie鐨勪綔鐢ㄥ煙銆
expires: dt
});
}
});
}
});
$(function () {
//閬嶅巻鎵€鏈塸df绫诲瀷鏍囩
$("[data-uitype ='pdf']")
.each(function () {
var url = $(this).attr("data-powerurl"); //鑾峰彇褰撳墠pdf鏂囦欢璺緞
var ran = Math.floor(Math.random() * 100); //鐢熸垚闅忔満鏁
$(this).removeAttr("src");
$(this)[0].insertAdjacentHTML("afterEnd",
"
");
if (url != null) {
var version = 10.0;
var ua = navigator.userAgent.toLowerCase();
var isiE = ua.indexOf("msie") > -1;
var safariVersion;
if (isiE) {
safariVersion = ua.match(/msie ([\d.]+)/)[1];
if (safariVersion <= version) {
if (confirm("褰撳墠IE娴忚鍣ㄧ増鏈繃浣庯紝鏃犳硶鐩存帴鏌ョ湅PDF璇风偣鍑婚摼鎺ワ紝涓嬭浇鏂囦欢鍒版湰鍦版煡鐪嬨€?)) {
window.location.href = url;
}
};
}
pdfjsLib.workerSrc = '~/Content/_Common/Base/js/pdf.worker.js'; //鍔犺浇js
var pdfDoc = null,
pageNum = 1,
pageRendering = false,
pageNumPending = null,
canvas = document.getElementById('the-canvas' + ran),
ctx = canvas.getContext('2d');
function renderPage(num) {
pageRendering = true;
var scale = 1;
pdfDoc.getPage(num).then(function (page) {
var viewport = page.getViewport(scale);
var widthOld = viewport.width;
canvas.width = $("[data-power-area='content']").width();
scale = canvas.width / viewport.width;
viewport = page.getViewport(scale);
canvas.height = viewport.height;
if (widthOld > $(window).width()) {
scale = 1;
viewport = page.getViewport(scale);
canvas.width = $(window).width();
canvas.height = viewport.height;
scale = canvas.width / viewport.width;
viewport = page.getViewport(scale);
}
var renderContext = {
canvasContext: ctx,
viewport: viewport
};
var renderTask = page.render(renderContext);
renderTask.promise.then(function () {
pageRendering = false;
if (pageNumPending !== null) {
renderPage(pageNumPending);
pageNumPending = null;
}
});
});
document.getElementById('page_num' + ran).textContent = num;
}
function queueRenderPage(num) {
if (pageRendering) {
pageNumPending = num;
} else {
renderPage(num);
}
}
function onPrevPage() {
if (pageNum <= 1) {
return;
}
pageNum--;
queueRenderPage(pageNum);
}
document.getElementById('prev' + ran).addEventListener('click', onPrevPage);
function onNextPage() {
if (pageNum >= pdfDoc.numPages) {
return;
}
pageNum++;
queueRenderPage(pageNum);
}
document.getElementById('next' + ran).addEventListener('click', onNextPage);
pdfjsLib.getDocument({
url: url,
rangeChunkSize: 65536 * 10000,
disableAutoFetch: 0,
cMapUrl: 'https://unpkg.com/pdfjs-dist@2.0.943/cmaps/',
cMapPacked: true
}).then(
function (pdfDoc_) {
pdfDoc = pdfDoc_;
document.getElementById('page_count' + ran).textContent = pdfDoc.numPages;
renderPage(pageNum);
});
}
});
});
}());