//---------------------------------------------------------------------- //名稱:無障礙輔助瀏覽工具條 //開發:skyest、scorpio //---------------------------------------------------------------------- //載入運行模塊---------------------------- var pageLoaded = false; window.onload = function(){ getAllElement(); browserType(); beginCookie(); iframeKeyListenerWrite(); pageLoaded = true; try{pagescriptrun()}catch(e){} //try{skiptomain()}catch(e){} } window.onscroll = function(){ if(toolBarState){document.getElementById("toolbar").style.top = document.documentElement.scrollTop+"px";} if(guidesState){moveGuides();}; if(document.getElementById("tempdiv")){ document.getElementById("tempdiv").style.top=document.documentElement.scrollTop+"px"; } } //功能快捷鍵預設(隻預設單鍵)------------ var toolBarControlKey = 74; //工具條開啟(J鍵) var textModeControlKey = 74; //純文本通道控制(J鍵) var columnSkipKey = 90; //欄目跳轉(z鍵) var skipToHeaderAreaKey = 75; //跳到頭部區域(k鍵) var skipToMainAreaKey = 77; //跳到中間內容區域(m鍵) var skipToLeftAreaKey = 76; //跳到左側區域(l鍵) var skipToContentAreaKey = 67; //跳到主要內容區域(c鍵) var skipToRightAreaKey = 100; //跳到右側區域(J鍵) var skipToFooterAreaKey = 66; //跳到底部區域(b鍵) //節點命名規則預設------------------------ var header = "header"; //頭部 var otherheader = "head"; //頭部例外 var main = "main"; //內容區域 var leftSideBar = "leftcolumn"; //左側 var content = "content"; //主要內容區 var rightSideBar = "rightcolumn"; //右側 var footer = "footer"; //底部 var articleBox = "mainpage"; //內容頁正文容器 var skipclassName = "columnjump"; //跳轉節點的class名 //其它全局變量預設------------------------ var defaultFontSize = 16; //初始頁面字號 var maxFontSize = 24; //頁面最大字號 var minFontSize = 16; //頁面最小字號 var guidesWidth = 2; //輔助線寬度 var guidesColor = "#f00"; //輔助線顏色 var guidesSkew = 5; //輔助線相對鼠標指針偏移量 //工具條操作說明URL----------------------- var operateExplainURL = "/col/col1336/index.html"; //公共節點獲取函數------------------------ //function document.getElementById(elementId){return document.getElementById(elementId);} //瀏覽器類型判斷函數---------------------- var browserIsIE; var IEVAR; function browserType(){ if(window.ActiveXObject){ browserIsIE = true; var ua = navigator.userAgent.toLowerCase(); IEVAR = Number(ua.match(/msie ([\d.]+)/)[1]); } else{browserIsIE = false;} } //獲取節點公用函數------------------------ var allElements = new Array(); var allFrame = new Array(); var allColumnElement = new Array(); var allLink = new Array(); var allImg = new Array(); function getAllElement(){ allElements = document.getElementById("container").getElementsByTagName("*"); allFrame = document.getElementById("container").getElementsByTagName("iframe"); allLink = document.getElementsByTagName("link"); var ColumnElementCount = 0; for(var i=0;i"; toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; if(browserIsIE){ toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; } toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; toolBarDOM = toolBarDOM+""; } var guidesHTML = "
"; //工具條開關函數-------------------------- var toolBarState = false; function toolBarControl(){ if(!toolBarState){ assemblyToolBar(); var toolBarElement = document.createElement("div"); toolBarElement.setAttribute("id","toolbar"); toolBarElement.style.cssText = "text-align:center;width:100%;background:#FFF;"; toolBarElement.innerHTML = toolBarDOM; document.body.insertBefore(toolBarElement,document.getElementById("skip")); var guidesElement = document.createElement("div"); guidesElement.setAttribute("id","guides"); guidesElement.style.display = "none"; guidesElement.style.zIndex = 199; guidesElement.innerHTML = guidesHTML; document.body.insertBefore(guidesElement,document.getElementById("skip")); toolBarPosition(); setCookie("toolBarState",1); toolBarState = true; } else{ document.body.removeChild(document.getElementById("toolbar")); document.body.removeChild(document.getElementById("guides")); document.body.style.paddingTop = 0+"px"; setCookie("toolBarState",0); setCookie("guidesState",0); toolBarState = false; guidesState = false; } toolBarStatePrompt(); } //工具條樣式及定位函數-------------------- function toolBarPosition(){ document.body.style.position = "relative"; document.body.style.paddingTop = 30+"px"; document.getElementById("toolbar").style.position = "absolute"; document.getElementById("toolbar").style.top = document.documentElement.scrollTop+"px"; document.getElementById("toolbar").style.left = 0+"px"; document.getElementById("toolbar").style.zIndex = 202; } //---------------------------------------------------------------------- //頁面文字放大縮小模塊 //---------------------------------------------------------------------- function fontSizeZoom(zoomMode){ if(zoomMode == "zoomIn"){ defaultFontSize = defaultFontSize+2; if(defaultFontSize>maxFontSize){defaultFontSize=maxFontSize;} } else if(zoomMode == "zoomOut"){ defaultFontSize = defaultFontSize-2; if(defaultFontSize2){defaultPageSize=2;}; } else if(zoomMode == "zoomOut"){ defaultPageSize = defaultPageSize - 0.2; if(defaultPageSize<1){defaultPageSize=1;}; } else{return false;}; document.getElementById("container").style.zoom = defaultPageSize; setCookie("pageZoomState",defaultPageSize); } //界面直接放大函数------------------------ function directPageZoom(){document.getElementById("container").style.zoom = defaultPageSize;} //---------------------------------------------------------------------- //栏目跳转及区域跳转执行函数 //---------------------------------------------------------------------- //跳转节点删除函数------------------------ function delSkipElement(skipElement){ skipElement.parentNode.parentNode.removeChild(skipElement.parentNode); } //---------------------------------------------------------------------- //cookie部分模块 //---------------------------------------------------------------------- //页面初始cookie读取函数------------------ function beginCookie(){ //alert(document.cookie); if(document.cookie ==""){ setCookie("toolBarState",0); } else{ if(getCookie("toolBarState") == 1){toolBarControl();}; } } //cookie修改函数-------------------------- function setCookie(setProject,projectValue){ if(setProject == undefined||projectValue == undefined){return false;}; var Days = 30; var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = setProject+"="+ escape(projectValue)+";expires="+exp.toGMTString(); } //cookie读取函数-------------------------- function getCookie(name){ var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return unescape(arr[2]); return null; } //---------------------------------------------------------------------- //跨iframe的键盘监听功能 //---------------------------------------------------------------------- function iframeKeyListenerWrite(){ for(var i=0;i無障礙輔助工具條已開啟"; document.body.insertBefore(promptElement,document.getElementById("toolbar")); } else{ promptElement.innerHTML = "無障礙輔助工具條已關閉"; document.body.insertBefore(promptElement,document.getElementById("skip")); } document.getElementById("toolbarprompt").firstChild.focus(); } //---------------------------------------------------------------------- //原頭部定位控制模塊模塊 //---------------------------------------------------------------------- function zoombig(){ document.getElementById("zoom").style.border="1px solid red"; document.getElementById("zoom").style.fontSize="24px"; document.getElementById("zoom").style.lineHeight="26px"; document.getElementById("zoom").style.position="absolute"; document.getElementById("zoom").style.width="120px"; document.getElementById("zoom").style.height="26px"; document.getElementById("zoom").style.zIndex="10"; document.getElementById("zoom").style.display="block"; document.getElementById("zoom").style.marginTop="-5px"; document.getElementById("zoom").style.marginleft="-5px"; document.getElementById("zoom").style.backgroundColor="#FFF"; } function zoomsmall(){ document.getElementById("zoom").style.border=""; document.getElementById("zoom").style.fontSize=""; document.getElementById("zoom").style.lineHeight=""; document.getElementById("zoom").style.position=""; document.getElementById("zoom").style.width=""; document.getElementById("zoom").style.height=""; document.getElementById("zoom").style.zIndex=""; document.getElementById("zoom").style.display=""; document.getElementById("zoom").style.backgroundColor=""; document.getElementById("zoom").style.marginTop=""; document.getElementById("zoom").style.marginleft=""; } function zoomthis(){ document.getElementById('zoomthis').style.width="140px" document.getElementById('zoomthis').style.height="48px" document.getElementById('zoomthis').style.position="absolute"; document.getElementById('zoomthis').style.zIndex=99; } function zoomthat(){ document.getElementById('zoomthis').style.width="70px" document.getElementById('zoomthis').style.height="24px" document.getElementById('zoomthis').style.position="static"; } function kqNav(){ toolBarControl(); }