function doPopup(url){ $(".sipac_shadow,.sipac_popup").show(); $(".p_item").show(); $('html,body').css("overflow","hidden"); var xurl=$(".sipac_popup .s_p_cont p span").html(url); $(".sipac_popup .controlBar .open").attr("href",url).click(function(){ $('.sipac_shadow,.sipac_popup').hide(); $(this).parent().parent().hide(); $('html,body').css("overflow",""); }); } $(function(){ //document $("body").prepend(''); $("body").append('

您即将离开本站!

您将要访问:

'); $('.sipac_popup .closed').click(function(){ $('.sipac_shadow,.sipac_popup').hide(); $(this).parent().parent().hide(); $('html,body').css("overflow",""); }); $("a[href]").each(function() { var url=$(this).attr("href"); urlL=url.toLowerCase(); var siteReg ="^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.([a-z]){2,6})(:[0-9]{1,4})?((/?)|(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)",siteR=new RegExp(siteReg); if(siteR.test(urlL)){//是站点地址 var sipacReg = "^((https|http|ftp|rtsp|mms)?://)?[a-z]+[0-9]*\.sipac\.gov\.cn", sipacR=new RegExp(sipacReg); var JcodeReg = "^(javascript)",JcodeR=new RegExp(JcodeReg); //var fileReg ="\.(html|htm|jpg|jpeg|gif|png|tif|bmp|swf|xls|xlsx|doc|docx|pdf|rar|zip|gz|txt|apk|mp3|mp4|avi|flv|ceb|ppt|pps)$",fileR=new RegExp(fileReg);//本地文件类型 //var site2Reg ="^((https|http|ftp|rtsp|mms)://",site2R=new RegExp(site2Reg); if(sipacR.test(urlL)){//是sipac站点地址 var xdeptReg = "^((https|http|ftp|rtsp|mms)?://)?(lw|zfw|sme|yqgh|women|tmc|cbd|stdc)", xdeptR=new RegExp(xdeptReg); if(xdeptR.test(urlL)){//是sipac外链 $(this).removeAttr("href").click(function(){doPopup(url)}); }else{} }else if(JcodeR.test(urlL)) {//js code }else {//不是sipac站点地址 var fileReg ="\.(html|htm|jpg|jpeg|png|tif|bmp|swf|xls|xlsx|doc|docx|pdf|rar|zip|gz|txt)$",fileR=new RegExp(fileReg); var httpReg ="^((https|http|ftp|rtsp|mms)://)|(([0-9]{1,3}\.){3}[0-9]{1,3})",httpR=new RegExp(httpReg); if ((!httpR.test(urlL))&&(fileR.test(urlL))){ //$(this).append("是站点,不是sipac站点,是file,没http弹出"); }else { $(this).removeAttr("href").click(function(){doPopup(url)}); //$(this).append("是站点,不是sipac站点,不是file,有http弹出"); } } } else {//不是站点地址 //$(this).append("//////不是站点地址!!"); } }); });