var date = new Date();
var dayArray = ['鏃?, '涓€', '浜?, '涓?, '鍥?, '浜?, '鍏?];
var date_today = date.getFullYear() + '骞? + (date.getMonth() + 1) + '鏈? + date.getDate() + '鏃 鏄熸湡' + dayArray[date.getDay()];
var isReady = false;
function doSaveAs () {
if (document.execCommand) {
if (isReady) { document.execCommand("SaveAs"); }
} else {
alert('Feature available only in Internet Exlorer 4.0 and later.');
}
}
function iFrameHeight () {
var ifm = document.getElementById("new");
var subWeb = document.frames ? document.frames["new"].document : ifm.contentDocument;
if (ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
}
}
$(document).ready(function () {
var isarchiveSuport = $('#archiveSuport').val();
if (isarchiveSuport == 1) { $('body').append('
'); }
var siteCode = $('#siteCode').val();
var seacherUrl = '/u/search/' + siteCode;
$('#pageform').attr('action', seacherUrl);
$('.date_today').text(date_today);
var liLength = $('.date_list ul li').length;
if (liLength == 8) {
$('.date_list ul').append('鏂囦欢鐘舵€侊細鏈夋晥')
}
var SiteName = $('meta[name="SiteName"]').attr('content');
var channelName = $('#CHANNELCODE').val();
if (liLength == 0) {
if (!$('.issource').text()) {
if (channelName == 'hzzgzdt' || channelName == 'hzzzcfg') {
$('.issource').text('涓変簹甯傛渤闀垮埗鍔炲叕瀹?);
}
else {
$('.issource').text(SiteName);
}
}
$('.showsource').css('display', 'inline');
} else {
$('.issource').css('display', 'none');
}
var timestamp = (new Date()).valueOf();
$.ajax({
type: 'GET',
url: '/api/weather.json?time=' + timestamp,
dataType: "json",
success: function (data) {
var weather = data.value[0].city + ' ' + data.value[0].weathers[0].weather + ' ' + data.value[0].weathers[0].temp_night_c + '鈩 - ' + data.value[0].weathers[0].temp_day_c + '鈩?;
$('.weather_today').html(weather).attr('title', data.value[0].indexes[1].content);
}
});
$('#inpt-tit').keyup(function (e) {
if (e.keyCode == 13) {
//妯℃嫙鐐瑰嚮鐧婚檰鎸夐挳锛岃Е鍙戜笂闈㈢殑 Click 浜嬩欢
$("#submit input[type='submit']").click();
}
});
if (siteCode == 'sanyasite') {
$('.siteName_box h1').html('甯傛斂搴滃姙鍏');
}
//棣栧厛灏?back-to-top闅愯棌
$("#back-to-top").hide();
//褰撴粴鍔ㄦ潯鐨勪綅缃浜庤窛椤堕儴600鍍忕礌浠ヤ笅鏃讹紝璺宠浆閾炬帴鍑虹幇锛屽惁鍒欐秷澶
$(window).scroll(function () {
if ($(window).scrollTop() > 600) {
$("#back-to-top").fadeIn(500);
} else {
$("#back-to-top").fadeOut(500);
}
});
//褰撶偣鍑昏烦杞摼鎺ュ悗锛屽洖鍒伴〉闈㈤《閮ㄤ綅缃
$("#back-to-top").click(function () {
$('body,html').animate({ scrollTop: 0 }, 500);
return false;
});
var pathName = window.location.pathname;
var ArticleTitle = $('meta[name="ArticleTitle"]').attr('content');
var pathHtmlUrl = pathName.split('/')[4];
if (pathHtmlUrl) {
var pathId = pathHtmlUrl.split('.')[0];
// $('.pages_content img').each(function () {
// var hasicon = $(this).attr('src').indexOf('/app-editor/ewebeditor/sysimage/icon16');
// if (hasicon < 0) {
// var imgstyle = $(this).parents().css('text-indent');
// if (imgstyle == '32px') {
// $(this).css('margin-left', "-2em");
// }
// }
// })
$.ajax({
type: 'POST',
url: '/u/sy/manuscriptHistory/saveHistory',
data: {
id: pathId,
path: pathName,
title: ArticleTitle
},
dataType: "json",
success: function (data) { }
});
}
// title鏍囩鍙栫函鏂囨湰
var titleTag = $("head title").text();
var regex = /<\/?.+?\/?>/gm;
var subst = '';
var result = titleTag.replace(regex, subst);
$("head title").text(result);
// 涓婚璇嶃€佹晥鍔涜鏄
var xxgkys = ['涓烩€傞鈥傝瘝锛?,'鏁堝姏璇存槑锛?],
xxgkys_li = $('.date_list ul li');
xxgkys_li.each(function(i){
var Text = $(this).text().trim();
if (xxgkys.indexOf(Text) != -1) {
$(this).hide();
} else {
$(this).show();
}
})
});
/*
娣诲姞鍦ㄧ嚎棰勮鍔熻兘
*/
/*$(document).ready(function(){
$("[href$='.doc'],[href$='.docx'],[href$='.xls'],[href$='.xlsx'],[href$='.ppt'],[href$='.pptx'],[href$='.pdf'],[href$='.txt']" ).each(function(){
var href = $(this).attr('href');
var path = window.location.href;
path = path.substring(0,path.lastIndexOf("/")+1);
path = path+href;
var url = " [鐐瑰嚮棰勮]";
$(this).after(url);
});
var xggjLength = $('.xggj ul li').length;
if(!xggjLength) $('.xggj').hide();
});*/
$(document).ready(function () {
function getAbsUrl (locationHref, attachmentPath) {
// var attachmentPath = $(this).attr('href');
// var locationHref = window.location.href;
var SanYaUrl = "";
var isAbsoluteUrl = attachmentPath.substring(0, 1) == "/";
var isHttpUrl = attachmentPath.indexOf('http') > -1;
var isOutSanyaSite = isHttpUrl && attachmentPath.indexOf('sanya.gov.cn') == -1;
if (isOutSanyaSite) return null;
if (!isHttpUrl) {
if (isAbsoluteUrl) {
locationHref = SanYaUrl + attachmentPath;
}
else {
locationHref = locationHref.substring(0, locationHref.lastIndexOf("/") + 1) + attachmentPath;
}
}
else {
locationHref = attachmentPath;
}
var result = SanYaUrl + locationHref.replace(/^http:\/\/[^/]+/, "");
return result;
}
/*$("[href$='.doc'],[href$='.docx'],[href$='.xls'],[href$='.xlsx'],[href$='.ppt'],[href$='.pptx'],[href$='.pdf'],[href$='.txt'],[href$='.zip'],[href$='.rar']" ).each(function(){
var path = getAbsUrl(window.location.href, $(this).attr('href'));
if(!!path){
var url = " [鐐瑰嚮棰勮]";
$(this).after(url);
}
});*/
var xggjLength = $('.xggj ul li').length;
if (!xggjLength) $('.xggj').hide();
});
$(document).ready(function () {
for (var i = 0; i < document.links.length; i++) {
var url = document.links[i].href.toLowerCase();
if (url.indexOf("gov.cn") == -1 && url.indexOf("36.101.208.222") == -1 && url != "#" && url.indexOf('javascript') == -1 && url.indexOf('#top') == -1 && !document.links[i].onclick) {
document.links[i].onclick = function () {
return confirm("鎮ㄨ闂殑閾炬帴鍗冲皢绂诲紑鈥滀笁浜氬競浜烘皯鏀垮簻闂ㄦ埛缃戠珯鈥濓紝鏄惁缁х画锛?)
};
}
}
// 绉诲姩鐗堝拰鐢佃剳鐗
// 鍒犻櫎url涓寚瀹氱殑鍙傛暟,骞惰繑鍥炲垹闄ゅ弬鏁板悗鐨勫畬鏁磚rl
function delParam (name) {
var loca = window.location;
var baseUrl = loca.origin + loca.pathname + "?";
var query = loca.search.substr(1);
if (query.indexOf(name) > -1) {
var obj = {}
var arr = query.split("&");
for (var i = 0; i < arr.length; i++) {
arr[i] = arr[i].split("=");
obj[arr[i][0]] = arr[i][1];
};
delete obj[name];
var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&");
return url
};
}
var pageRequestParams = getRequestParams();
var isPCViewType = pageRequestParams.viewport_type === "pc";
if (isPCViewType) {
document.getElementById("viewport").setAttribute('content', '');
var deleteParam = delParam('viewport_type')
$('.viewportApp a').attr("href", deleteParam);
$('.viewportApp').show();
}
$('.version .app').attr("href", window.location.href);
var url = window.location.search;
if (url.indexOf("?") != -1) {
$('.version .pc').attr("href", window.location.href + "&viewport_type=pc");
} else {
$('.version .pc').attr("href", window.location.protocol + "//" + window.location.host + window.location.pathname + "?viewport_type=pc");
}
function getRequestParams () {
var url = window.location.search;
var theRequest = {};
var str = url.substr(1),
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
}
return theRequest;
}
// 淇℃伅鍏紑鍐呭椤典腑鈥滀富棰樺垎绫烩€濆拰鈥滄枃浠剁姸鎬佲€濅腑鍚湁鈥淃鈥濆垎鍙风殑鎶婂垎鍙峰垹闄
if ($(".date_list ul li").size() > 0) {
var ztflxxgk = $(".date_list ul li").eq(2).text(),
wjztxxgk = $(".date_list ul li").eq(8).text(),
ztflhtml = $(".date_list ul li").eq(2).html().replace(';', ''),
wjzthtml = $(".date_list ul li").eq(8).html().replace(';', '');
if (ztflxxgk.indexOf(';') != -1) {
$(".date_list ul li").eq(2).html(ztflhtml);
}
if (wjztxxgk.indexOf(';') != -1) {
$(".date_list ul li").eq(8).html(wjzthtml);
}
}
});