/*
 * WXA11Y.JS
 * version: 3.0.0 (2021/12/03)
 *
 * Copyright 2015,微象科技-李刚,moaol@foxmail.com
 */
(function($) {
	$.fn.hoverIntent = function(handlerIn, handlerOut, selector) {
		var cfg = {
			interval: 150,
			sensitivity: 6,
			timeout: 0
		};
		if (typeof handlerIn === "object") {
			cfg = $.extend(cfg, handlerIn);
		} else if ($.isFunction(handlerOut)) {
			cfg = $.extend(cfg, {
				over: handlerIn,
				out: handlerOut,
				selector: selector
			});
		} else {
			cfg = $.extend(cfg, {
				over: handlerIn,
				out: handlerIn,
				selector: handlerOut
			});
		}
		var cX, cY, pX, pY;
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};
		var compare = function(ev, ob) {
			var isSingle = $("#tts-single").hasClass("active"),
				isScreenread = $("#tts-screenread").hasClass("active"),
				isToolscreen = $("#tool-screen").hasClass("active"),
				isA11ytoolbar = $(".a11ytoolbar").is(":hidden");
			if (!isA11ytoolbar && (isSingle || isScreenread || isToolscreen)) {
				ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
				if (Math.sqrt((pX - cX) * (pX - cX) + (pY - cY) * (pY - cY)) < cfg.sensitivity) {
					$(ob).off("mousemove.hoverIntent", track);
					ob.hoverIntent_s = true;
					return cfg.over.apply(ob, [ev]);
				} else {
					pX = cX;
					pY = cY;
					ob.hoverIntent_t = setTimeout(function() {
						compare(ev, ob);
					}, cfg.interval);
				}
			}
		};
		var delay = function(ev, ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = false;
			return cfg.out.apply(ob, [ev]);
		};
		var handleHover = function(e) {
			var ev = $.extend({}, e);
			var ob = this;
			if (ob.hoverIntent_t) {
				ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			}
			if (e.type === "mouseenter") {
				pX = ev.pageX;
				pY = ev.pageY;
				$(ob).on("mousemove.hoverIntent", track);
				if (!ob.hoverIntent_s) {
					ob.hoverIntent_t = setTimeout(function() {
						compare(ev, ob);
					}, cfg.interval);
				}
			} else {
				$(ob).off("mousemove.hoverIntent", track);
				if (ob.hoverIntent_s) {
					ob.hoverIntent_t = setTimeout(function() {
						delay(ev, ob);
					}, cfg.timeout);
				}
			}
		};
		return this.on({
			'mouseenter.hoverIntent': handleHover,
			'mouseleave.hoverIntent': handleHover
		}, cfg.selector);
	};
})(jQuery);
var matched, browser;
jQuery.uaMatch = function(ua) {
	ua = ua.toLowerCase();
	var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) ||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie)[\s?]([\w.]+)/.exec(ua) ||/(trident)(?:.*? rv:([\w.]+)|)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
	return {
		browser: match[1] || "",
		version: match[2] || "0"
	};
};
matched = jQuery.uaMatch(navigator.userAgent);
matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
browser = {};
if (matched.browser) {
	browser[matched.browser] = true;
	browser.version = matched.version;
}
if (browser.chrome) {
	browser.webkit = true;
} else if (browser.webkit) {
	browser.safari = true;
}
jQuery.browser = browser;
(function($) {
	$.extend($.fn, {
		WXA11y: function(setting) {
			var ps = $.extend({
				mainDocument: $("body"),
				PageScale: 1.0,
				size: {
					barWidth: 200,
					sliderWidth: 5
				},
				onChanging: function() {}
			}, setting);
			ps.mainDocument = (typeof ps.mainDocument == 'string' ? $(ps.mainDocument) : ps.mainDocument);
			ps.currentSelectorNode = ps.mainDocument.children(":first");
			var NodeManager = {
				docNodeArray: [],
				currentSelectorNode: null,
				currentNodeIndex: 0,
				setCurrentNode: function(node) {
					this.currentSelectorNode = node[0];
					for (var e in this.docNodeArray) {
						if (this.docNodeArray[e].id == this.currentSelectorNode.id) {
							this.currentNodeIndex = e;
							break;
						}
					}
				},
				getcurrentNodeIndex: function() {
					return this.currentNodeIndex;
				},
				pushNode: function(n) {
					//if (n && n.parents("[tabindex=0]").length) {
					if (n) {
						if (n instanceof jQuery) this.docNodeArray.push(n[0]);
						else this.docNodeArray.push(n);
					}
				},
				nextNode: function() {
					if ($(this.docNodeArray[this.currentNodeIndex])) {
						$(this.docNodeArray[this.currentNodeIndex]).removeClass("WXA11y-hover");
					}
					if (this.currentNodeIndex < this.docNodeArray.length) {
						this.currentNodeIndex++;
						return this.docNodeArray[this.currentNodeIndex];
					}
					return null;
				}
			};
			//正文中增加语音播报按钮变量
			var ScreeReadCyle = {
				voiceText: '',
				voiceTextNum: 0,
				voiceTextMaxNum: 0
			};
			var ScreenRead = {
				delaytime: null,
				dealyprocess: null,
				dot: [",", "!", "?", ";", "|", "，", "。", "？", "！", "；", ":", "：", "\n", "、", "'",'"'],
				stopAll: false,
				isRead2EndOn: false,
				isReset: false,
				soundMute: false,
				oldmodInit:false,
				getTextNodesIn: function(node, includeWhitespaceNodes) {
					var textNodes = [],
						nonWhitespaceMatcher = /\S/,
						Nodeindex = 0;

					function getTextNodes(node) {
						if (node.nodeType == 3 && node.nodeType.display !== 'none') {
							if (includeWhitespaceNodes || nonWhitespaceMatcher.test(node.nodeValue)) {
								textNodes.push(node);
							}
						} else if (node.tagName != 'STYLE') {
							if (node.tagName == 'IFRAME') {
								if (node.style.display != "none" && node.src.indexOf(window.location.host) >= 0) {
									node.setAttribute("voiceFrame", true)
									var fileref = document.createElement("link");
									fileref.setAttribute("rel", "stylesheet");
									fileref.setAttribute("type", "text/css");
									fileref.setAttribute("href", require.path + "WXA11y.css");
									if (typeof fileref != "undefined");
									node.contentWindow.document.body.appendChild(fileref);
									node = node.contentWindow.document.body;
									for (var i = 0, len = node.childNodes.length; i < len; ++i) {
										if (node.childNodes[i].nodeName != "SCRIPT" && node.childNodes[i].nodeType.display !== 'none')
											getTextNodes(node.childNodes[i]);
									}
								}
							} else {
								for (var i = 0, len = node.childNodes.length; i < len; ++i) {
									if (node.className != "a11ytoolbar" && node.childNodes[i].nodeName != "SCRIPT" && node.nodeType.display !=='none') getTextNodes(node.childNodes[i]);
								}
							}
						}
					}
					getTextNodes(node);
					return textNodes;
				},
				StopAllRead: function() {
					this.isRead2EndOn = false;
				},
				positionNode: function() {
					var WST = $(window).scrollTop();
					var docNum = 0;
					if (WST > 5) {
						for (var i = 0; i < NodeManager.docNodeArray.length; i++) {
							var docTop = NodeManager.docNodeArray[i].offsetTop;
							if (docTop && docTop >= WST) {
								docNum = i;
								break;
							}
						}
					} else {
						docNum = 0;
					}
					NodeManager.setCurrentNode($(NodeManager.docNodeArray[docNum]));
					ScreenRead.Read2End(NodeManager.docNodeArray[docNum]);
				},
				positionContNode: function() {
					var WST = $(window).scrollTop();
					var docNum = 0;
					if (WST > 5) {
						for (var i = 0; i < NodeManager.docNodeArray.length; i++) {
							var docTop = NodeManager.docNodeArray[i].offsetTop;
							if (docTop && docTop >= WST) {
								docNum = i;
								break;
							}
						}
					} else {
						docNum = 0;
					}
					NodeManager.setCurrentNode($(NodeManager.docNodeArray[docNum]));
					ScreenRead.Read2End(NodeManager.docNodeArray[docNum]);
				},
				Read2End: function(n) {
					var isSingle = $("#tts-single").hasClass("active"),
						isScreenread = $("#tts-screenread").hasClass("active"),
						isA11ytoolbar = $(".a11ytoolbar").is(":hidden");
					if (!isA11ytoolbar && (isSingle || isScreenread)) {
						try {
							var node = n;
							var text;
							if (node !== true)
								if (!node) {
									node = NodeManager.nextNode();
								}
								text = this.handleElement(node);
							$(node).addClass("WXA11y-hover");
							var self = this;
							var patt = new RegExp("{[^>]*}");
							if (!patt.test(text) && text!=="") {
								if ($("#tool-screen").hasClass("active")) {
									if (require.tipScreenObj.Display != undefined) {
										require.tipScreenObj.Display(text);
									}
								}
								SoundPlayer.playWithTxt(text, function() {
									if (node != null) $(node).removeClass("WXA11y-hover");
									if (!isSingle) {
										var n = NodeManager.nextNode();
										if (n != null) ScreenRead.Read2End(n);
									} else {
										ScreenRead.StopAllRead();
									}
								});
							} else {
								if (node != null) $(node).removeClass("WXA11y-hover");
								if (!isSingle) {
									var n = NodeManager.nextNode();
									if (n != null) ScreenRead.Read2End(n);
								} else {
									ScreenRead.StopAllRead();
								}
							}
						} catch (e) {}
					}
				},
				init: function(callback) {
					if (!this.isReset) {
						this.reDocumentTagNodes();
						var self = this;
						ps.mainDocument.find(
							"img, button,input,label,select, textarea,.a11ydom").filter(
							function() {
								//排除鼠标悬浮事件
								return $(this).parents(".a11y-top").length <= 0;
							}).hoverIntent(this._state_over, this._state_out).click(
							function() {
								var $this = $(this);
								if ($this.parents("a").length > 0) {
									ScreenRead.StopAllRead();
									$("#tts-screenread").removeClass("active");
								}
							});
						var $objIframe = ps.mainDocument.find("iframe[voiceFrame=true]");
						if ($objIframe.length > 0)
							for (var i = 0; i < $objIframe.length; i++) {
								$objIframe.eq(i).contents().find(
										"img, button,input,label,select, textarea,.a11ydom")
									.filter(function() {
										return $(this).parents(".a11y-top").length <= 0;
									}).hoverIntent(this._state_over, this._state_out).click(
										function() {
											var $this = $(this);
											if ($this.parents("a").length > 0) {
												ScreenRead.StopAllRead();
												$("#tts-screenread").removeClass("active");
											}
										});
							}
						SoundPlayer.initPlayer();
						this.isReset = true;
					}
					if (callback) {
						callback();
					}
				},
				splitbydot: function(txt) {
					var sliceIndex = 0;
					var startindex = 0;
					var indexArray = [];
					var rtnArray = [];
					for (i = 0; i < this.dot.length; i++) {
						var searchIndex = -1;
						startindex = 0;
						while ((searchIndex = txt.indexOf(this.dot[i], startindex)) != -1) {
							if ($.inArray(searchIndex, indexArray) == -1) {
								indexArray.push(searchIndex);
							}
							startindex = searchIndex + 1;
						}
					}
					indexArray.sort(function(a, b) {
						return a - b;
					});
					$.each(indexArray, function(k, v) {
						var t = txt.substring(sliceIndex, v + 1);
						rtnArray.push(t);
						sliceIndex = v + 1;
					});
					if (sliceIndex < txt.length) rtnArray.push(txt.substr(sliceIndex));
					return rtnArray;
				},
				searchOneChat: function(txt) {
					if (txt.length > 1) {
						return true;
					} else if (txt.charCodeAt(0) > 255) {
						var dotstr = "，。、《》？；‘：“【】｛｝·~！@#￥%……&*（）";
						if (dotstr.indexOf(txt) >= 0) {
							return false;
						} else {
							return true;
						}
					} else {
						return false;
					}
				},
				reDocumentTagNodes: function() {
					var self = this;
					var docNodeArray = ScreenRead.getTextNodesIn(ps.mainDocument[0], true);
					for (var i in docNodeArray) {
						var t = docNodeArray[i].nodeValue;
						if (t && t.length > 0) {
							var docarray = self.splitbydot(t);
							var docarrayLen = docarray.length;
							for (j = 0; j < docarray.length; j++) {
								var txt = docarray[j];
								if (txt.replace(/[\r\n\s\f\t\v\o ]+/gm, "") != "") {
									if (self.searchOneChat(txt)) {
										var n = $('<font class="a11ydom" id="_label_' + i +
											"_" + j + '">' + txt + '</font>').insertBefore(
											$(docNodeArray[i]));
										NodeManager.pushNode(n);
										docNodeArray[i].nodeValue = docNodeArray[i].nodeValue
											.replace(txt, "");
									} else {
										var t = document.createTextNode(txt);
										var n = $(t).insertBefore($(docNodeArray[i]));
										NodeManager.pushNode(n);
										docNodeArray[i].nodeValue = docNodeArray[i].nodeValue
											.replace(txt, "");
									}
								}
							}
						}
					}
				},
				handleElement: function(nodeele) {
					var k = "";
					nodeele = $(nodeele);
					switch (nodeele[0].tagName) {
						case "A":
							var m = nodeele.attr("title");
							var l = nodeele.text();
							var i = nodeele.find("img"),
								ialt = "";
								t = "链接：";
							if(m != undefined){
								m = m.replace(/\s/g,'');
							}
							if(l != undefined){
								l = l.replace(/\s/g,'');
							}
							if(i && i.length > 0){
								ialt = i.attr("alt");
								if(ialt!= undefined){
									ialt = ialt.replace(/\s/g,'');
								}else{
									ialt="";
								}
							}
							if (m != undefined && m.length != 0) {
								k += t + m;
							} else if (l != undefined && l.length != 0) {
								k += t + l;
							} else if (i && i.length > 0) {
								k += t+ ialt;
							}
							if (i && i.length > 0 && k !=""){
								k = "图片" + k;
							}else if(i && i.length > 0 && k ==""){
								k = "图片链接";
							}
							if(nodeele.attr("target")=="_blank"){
								k+="(另开新窗口)";
							}
							break;
						case "SPAN":
						case "LABEL":
							k += nodeele.text();
							break;
						case "AREA":
							k += "链接区域：" + nodeele.getAttribute("alt") ? nodeele.getAttribute(
								"alt") : nodeele.getAttribute("href");
							break;
						case "BUTTON":
							k += "按钮：" + nodeele.text();
							break;
						case "OBJECT":
							k = nodeele.attr("title") ? nodeele.attr("title") : "";
							k = "按钮：" + k;
							break;
						case "EMBED":
							k = nodeele.attr("title") ? nodeele.attr("title") : "";
							k = "媒体：" + k;
							break;
						case "H1":
						case "H2":
						case "H3":
						case "H4":
						case "H5":
						case "H6":
							k += "标题：" + nodeele.text();
							break;
						case "IMG":
							if (nodeele.attr("alt") != undefined) {
								k += "图片：" + nodeele.attr("alt");
							} else {
								k += "图片";
							}
							break;
						case "INPUT":
							k += "文本输入框：" + nodeele.val();
							break;
						case "LI":
							k += nodeele.val();
							break;
						case "SELECT":
							k += "列表框：" + nodeele.val();
							break;
						case "TABLE":
							break;
						case "TEXTAREA":
							k += "多文本输入框内容为: " + nodeele.val();
							break;
						case "UL":
						case "OL":
							break;
						case "IFRAME":
							break;
						case "FONT":
							if(nodeele.parents("a[tabindex=0]")[0] && nodeele.parents("a[tabindex=0]")[0].tagName == "A"){
								k += "链接：" + nodeele.text()
							}else{
								k += nodeele.text()
							}
							break;
						case "EM":
						case "B":
						case "P":
						case "STRONG":
							k += nodeele.text();
							break;
					}

					if (nodeele.attr("title") && !k) {
						k = k + " " + nodeele.attr("title")
					}
					return k
				},
				handleCont: function(nodeele) {
					var k = "";
					nodeele = $(nodeele);
					switch (nodeele.tagName ? nodeele.tagName : nodeele.nodeName) {
						case "A":
							var m = nodeele.attr("title");
							var l = nodeele.text();
							var i = nodeele.find("img"),
								ialt = "";
								t = "链接：";
							if(m != undefined){
								m = m.replace(/\s/g,'');
							}
							if(l != undefined){
								l = l.replace(/\s/g,'');
							}
							if(i && i.length > 0){
								ialt = i.attr("alt");
								if(ialt!= undefined){
									ialt = ialt.replace(/\s/g,'');
								}else{
									ialt="";
								}
							}
							if (m != undefined && m.length != 0) {
								k += t + m;
							} else if (l != undefined && l.length != 0) {
								k += t + l;
							} else if (i && i.length > 0) {
								k += t+ ialt;
							}
							if (i && i.length > 0 && k !=""){
								k = "图片" + k;
							}else if(i && i.length > 0 && k ==""){
								k = "图片链接";
							}
							if(nodeele.attr("target")=="_blank"){
								k+="(另开新窗口)";
							}
							break;
						case "SPAN":
						case "LABEL":
							k += $(nodeele).text();
							break;
						case "AREA":
							k += "链接区域：" + nodeele.getAttribute("alt") ? nodeele.getAttribute(
								"alt") : nodeele.getAttribute("href");
							break;
						case "BUTTON":
							k += "按钮：" + $(nodeele).text();
							break;
						case "OBJECT":
							k = $(nodeele).attr("title") ? $(nodeele).attr("title") : "";
							k = "按钮：" + k;
							break;
						case "EMBED":
							k = $(nodeele).attr("title") ? $(nodeele).attr("title") : "";
							k = "媒体：" + k;
							break;
						case "H1":
						case "H2":
						case "H3":
						case "H4":
						case "H5":
						case "H6":
							k += "标题：" + $(nodeele).text();
							break;
						case "IMG":
							if ($(nodeele).attr("alt") != undefined) {
								k += "图片：" + $(nodeele).attr("alt");
							} else {
								k += "图片";
							}
							break;
						case "INPUT":
							k += "文本输入框：" + $(nodeele).val();
							break;
						case "LI":
							k += $(nodeele).val();
							break;
						case "SELECT":
							k += "列表框：" + $(nodeele).val();
							break;
						case "TABLE":
							break;
						case "TEXTAREA":
							k += "多文本输入框内容为: " + $(nodeele).val();
							break;
						case "UL":
						case "OL":
							break;
						case "IFRAME":
							break;
						case "#text":
						case "DIV":
							k += $.trim($(nodeele).text());
							break;
						case "EM":
						case "B":
						case "P":
						case "STRONG":
							k += nodeele.text();
							break;
					}
					if ($(nodeele).attr("title") && !k) {
						k = k + " " + $(nodeele).attr("title")
					}
					return k
				},
				handleRole: function(nodeele) {
					var k = "";
					switch (nodeele[0].tagName) {
						case "A":
							var m = nodeele.attr("title");
							var l = nodeele.text();
							var i = nodeele.find("img"),
								ialt = "";
								t = "链接：";
							if(m != undefined){
								m = m.replace(/\s/g,'');
							}
							if(l != undefined){
								l = l.replace(/\s/g,'');
							}
							if(i && i.length > 0){
								ialt = i.attr("alt");
								if(ialt!= undefined){
									ialt = ialt.replace(/\s/g,'');
								}else{
									ialt="";
								}
							}
							if (m != undefined && m.length != 0) {
								k += t + m;
							} else if (l != undefined && l.length != 0) {
								k += t + l;
							} else if (i && i.length > 0) {
								k += t+ ialt;
							}
							if (i && i.length > 0 && k !=""){
								k = "图片" + k;
							}else if(i && i.length > 0 && k ==""){
								k = "图片链接";
							}
							if(nodeele.attr("target")=="_blank"){
								k+="(另开新窗口)";
							}
							break;
						case "IMG":
							if (!nodeele.parent("[tabindex=0]")) {
								var r = (nodeele.attr("alt") || "");
								if (r && r.length > 0) {
									k += "图片：" + r
								} else {
									k += "图片"
								}
							}
							break;
						case "SPAN":
							if(this.hasFont(nodeele)){
								var t = nodeele.text();
								if(nodeele.parents("[tabindex=0]").length<1 &&nodeele.find("a,img").length < 1 && t.length > 0) {
									k += t;
								}
							}
							break;
						case "LABEL":
							k += nodeele.text();
							break;
						case "AREA":
							var t = nodeele.getAttribute("alt") ? nodeele.getAttribute("alt") :
								nodeele.getAttribute("href");
							if (t.length > 0) k += "链接区域：" + t;
							break;
						case "BUTTON":
							var t = nodeele.text();
							if (t.length > 0) k += "按钮：" + t;
							break;
						case "OBJECT":
							var t = nodeele.attr("title") ? nodeele.attr("title") : "";
							if (t.length > 0) k += "按钮：" + t;
							break;
						case "EMBED":
							var t = nodeele.attr("title") ? nodeele.attr("title") : "";
							if (t.length > 0) k += "媒体：" + t;
							break;
						case "H1":
						case "H2":
						case "H3":
						case "H4":
						case "H5":
				 	case "H6":
						if(this.hasFont(nodeele)){
							var t = nodeele.text();
							if (nodeele.find("a,img").length < 1 && t.length > 0) {
								k += "标题：" + t;
							}
						}
							break;
						case "INPUT":
							if (nodeele.attr("type") == "text") {
								k += "文本输入框：" + nodeele.val();
								nodeele.bind('input propertychange', function() {
									if ($("#tool-screen").hasClass("active")) {
										if (require.tipScreenObj.Display != undefined) {
									
											require.tipScreenObj.Display("已输入：" + nodeele.val());
										}
									}
									SoundPlayer.playWithTxt("已输入：" + nodeele.val());
									return false;
								});
							} else if (nodeele.attr("type") == "submit") {
								k += "按钮：" + nodeele.val();
							}
				 		break;
						case "LI":
							if(this.hasFont(nodeele)){
								var ltxt = $.trim(nodeele.text());
								if (nodeele.find("a,img").length < 1 && ltxt.length > 0) {
									k += ltxt;
								}
							}
							break;
						case "SELECT":
							k += "列表框：" + nodeele.find("[value='" + nodeele.val() + "']")
							.text() + "，共" + nodeele.find("option").length + "项，按上下键进行选择。";
							nodeele.change(function() {
								var $this = $(this);
								SoundPlayer.playWithTxt(nodeele.find("[value='" +nodeele.val() + "']").text());
								return false;
							});
							break;
						case "TABLE":
							break;
						case "TEXTAREA":
							k += "多文本输入框内容为：" + nodeele.val();
							break;
				 	case "UL":
						case "OL":
							break;
						case "IFRAME":
							break;
						case "#text":
					case "EM":
					case "P":
					case "B":
					case "STRONG":
						if(this.hasFont(nodeele)){
							k += nodeele.text();
						}
						break;
					}
					return k.replace(/\s/g,'');
				},
				handleNodes: function(node) {
					for (var i = 0; i < node.length; i++) {
						//var nodeChild = node.childNodes?node.childNodes:node;
						if (node[i].childNodes.length >= 1) {
							this.handleNodes(node[i].childNodes);
						}
						ScreeReadCyle.voiceText += ScreenRead.handleCont(node[i]);
					}
					return ScreeReadCyle.voiceText
				},
				handleNode: function(node) {
					var result = "";
					switch (node[0].nodeType) {
						case 1:
							if (this.isVisible(node)) {
								result = "";
							} else {
								result = ScreenRead.handleElement(node);
							}
							break;
						case 2:
							result = "";
							break;
						case 3:
							var l = node.data;
							if (l.length > 0 && l.match(/[^\s,\.\?!:\-]/)) {
								l = l.replace(/&#\d+;/, "");
								result = l;
							} else {
								result = "";
							}
							break;
						case 8:
						case 9:
						case 10:
						default:
							result = ""
					}
					return result;
				},
				//判断是否为底层节点或顶层是否已经生成过tabindex
				hasFont:function(t){
					if(t.parents("[tabindex='0']").length<1 && t.children("font").length){
						return true;
					}
					return false;
				},
				_state_over: function() {
					if (!$(".a11ytoolbar").is(":hidden")) {
						var selfobj = $(this);
						//调整指读对象为当前焦点节点
						if (selfobj.attr("tabindex") == undefined) {
							var pt = selfobj.parents("[tabindex='0']");
							if (pt.length > 0) {
								pt.focus();
							} else {
								selfobj.parent().focus();
							}
						} else {
							selfobj.focus();
						}
						var node = selfobj,
							txt = ScreenRead.handleNode(node);
						if (!txt) {
							txt = node.text();
						}
						if (!txt) {
							txt = ScreenRead.handleElement(node);
						}
						if (this.delaytime) {
							window.clearTimeout(this.delaytime);
							this.delaytime = null;
						}
						var isSingle = $("#tts-single").hasClass("active"),
							isScreenread = $("#tts-screenread").hasClass("active"),
							isA11ytoolbar = $(".a11ytoolbar").is(":hidden");
						if (!isA11ytoolbar && (isSingle || isScreenread)) {
							this.delaytime = window.setTimeout(function() {
								NodeManager.setCurrentNode(node);
								SoundPlayer.playWithTxt(txt, function() {
									$(node).removeClass("WXA11y-hover");
									if ($("#tts-screenread").hasClass(
										"active")) {
										fontObj.changeColor(false);
										ScreenRead.Read2End();
									}
								});
							}, 100);
						}
						var isToolscreen = $("#tool-screen").hasClass("active");
						if (isToolscreen) {
							if (require.tipScreenObj.Display != undefined) {

								require.tipScreenObj.Display(txt);
							}
						}
						switch (this.tagName) {
							case "SELECT":
								break;
							default:
								node.addClass("WXA11y-hover")
						}
					}
				},
				_state_over_object: function() {},
				_state_out_object: function() {},
				_state_out: function() {
					var node = $(this);
					switch (this.tagName) {
						case "SELECT":
							break;
						default:
							node.removeClass("WXA11y-hover");
					}
				},
				isVisible: function(node) {
					if (node == null || typeof node == "undefined" || node.nodeType != 1 || node
						.nodeName == "BODY") {
						return false
					}
					if (node.offsetWidth <= 0 || !node.parentNode) return true;
					if ($(node).is(":hidden")) {
						return true;
					}
					return false
				},
				replaceAll: function(s0, s1, s2) {
					return s0.replace(new RegExp(s1, "gm"), s2);
				},
				//视窗区初始化
				roleInit: function() {
					//如果selectorConfig配合文件加载成功
					if (require.selectorConfig && !require.oldmodInit) {
						require.oldmodInit = true;
						//得到页面的区域指引信息
						var selectorConfig = require.selectorConfig,eventConfig = require.eventConfig;
						//个性化事件节点提前初始信息
						if(eventConfig && eventConfig.length){
							var $eventDom,$eventPanel,$eventPanelLast;
							for(var i=0;i<eventConfig.length;i++){
								$eventDom = $(eventConfig[i].changeBlock.tit.dom);
								if(!$eventDom.is(":hidden")&&$eventDom && $eventDom.length){
									$eventDom.attr("wxwza-event",eventConfig[i].changeBlock.tit.event);
								}
								$eventPanel = $(eventConfig[i].changeBlock.panel.dom);
								if($eventPanel && $eventPanel.length){
									//得到最后个语音节点调用mouseout事件
									$eventPanelLast = ScreenRead.roleFilter($eventPanel.find(fontObj.tagNames.join(",").replace(/BODY,|DIV,/g, "")))
									$eventPanelLast = $eventPanelLast[$eventPanelLast.length-1];
									$eventPanelLast.blur(function(e){
										$(this).trigger("mouseout");
									})
								}
							}
						}
						
						var blockDom, $childDom, $blockTemp, $changeBlock,
							nav = 0,
							vl = 0,
							ia = 0,
							prependText ="<span class='WXA11Y-block-text' wxa11y-block-pos='start' tabindex='0'>您已进入",
							meddileText = "",
							afterText = "</span>";
						
						for (var i = 0; i < selectorConfig.length; i++) {
							blockDom = selectorConfig[i];
							for (var j = 0; j < blockDom.children.length; j++) {
								$childDom = $(blockDom.children[j].dom);
								//如果本页包含计划节点则进行处理
								if (!$childDom.is(":hidden")&&$childDom.length > 0) {
									//计划区块内符合条件的DOM节点增加tabindex属性
									meddileText = ScreenRead.roleAnaly($childDom);
									//增加头尾DOM语音节点
									$childDom.prepend(prependText + blockDom.children[j].name +meddileText + afterText);
									$childDom.append("<span class='WXA11Y-block-text' wxa11y-block-pos='end' tabindex='0'>您已离开" + blockDom.children[j].name + "</span>");
									//过滤非语音节点
									$blockTemp = $childDom.find(fontObj.tagNames.join(",").replace(/BODY,|DIV,/g, ""));
									$blockTemp = ScreenRead.roleFilter($blockTemp);
									//判断对应区块数量为工具栏显示作准备
									switch (i) {
										case 0:
											$childDom.attr("wxwza-role","navigation");
											nav++;
											break;
										case 1:
											$childDom.attr("wxwza-role","interaction");
											ia++;
											break;
										case 2:
											$childDom.attr("wxwza-role","viewlist");
											vl++;
											break;
									}
									//焦点事件
									ScreenRead.roleFocus($childDom,$blockTemp);
									//重写切换块的焦点事件
									$changeBlock = blockDom.children[j].changeBlock;
									if ($changeBlock != undefined) {
										ScreenRead.reloTabsFocus($childDom,blockDom.children[j].changeBlock);
									}
									//标记已初始化
									$childDom.attr("wxwza-tip",1);
								} else {


								}
							}
						}
						//将到的正常节点初始化语言文本、tabindex、focus事件时的触发事件

						var oldChildStr = "",
							oldLang = "",
							$nav,$vl,$ia;
						if (nav != 0) {
							$nav = $('<a title="导航区" class="fun fun-block-child" id="tool-nav" href="javascript:;" target="_self" num="0" wxwza-role-name="navigation">导航区(<em>' +
								nav + '</em>)<span class="tool-nav-text">Alt+1</span></a>');
							oldLang += (nav + "个导航区，快捷键Alt+1,");
							$nav.click(function(){
								ScreenRead.roleSelected($(this));
							});
						}
						if (ia != 0) {
							$ia= $('<a title="交互区" class="fun fun-block-child" id="tool-ia" href="javascript:;" target="_self" num="0" wxwza-role-name="interaction">交互区(<em>' +
								ia + '</em>)<span class="tool-nav-text">Alt+4</span></a>');
							oldLang += (ia + "个交互区，快捷键Alt+4,");
							$ia.click(function(){
								ScreenRead.roleSelected($(this));
							});
						}
						if (vl != 0) {
							$vl = $('<a title="视窗区" class="fun fun-block-child" id="tool-vl" href="javascript:;" target="_self" num="0" wxwza-role-name="viewlist">视窗区(<em>' +
								vl + '</em>)<span class="tool-nav-text">Alt+2</span></a>');
							oldLang += (vl + "个视窗区，快捷键Alt+2,");
							$vl.click(function(){
								ScreenRead.roleSelected($(this));
							});
						}
						if (nav + vl + ia > 0) {
							oldLang = "本页面由" + oldLang + "共计" + (nav+ia+vl) + "个区域组成,";
							$("#tool-oldmode").attr("readtxt", oldLang);
							if(!$("#tool-oldmode").hasClass("active")){
								$nav.hide(0);
								$vl.hide(0);
								$ia.hide(0);
							}
							$("#oldmodbox").append($nav);
							$("#oldmodbox").append($vl);
							$("#oldmodbox").append($ia);
						}
					}
				},
				newReadInit:function(){
					
				},
				roleAnaly: function($rd) {
					var DText = "";
					//获取链接数
					var alen = $rd.find("a").length;
					if (alen > 0) {
						DText += "," + alen + "个链接"
					}
					//获取图片数
					var ilen = $rd.find("img").length;
					if (ilen > 0) {
						DText += "," + ilen + "张图片";
					}
					//获取列表框
					var butlen = $rd.find("select").length;
					if (butlen > 0) {
						DText += "," + butlen + "个列表框";
					}
					//获取输入框
					var inputlen = $rd.find("input[type='text']").length;
					if (inputlen > 0) {
						DText += "," + inputlen + "个文本输入框";
					}
					//获取搜索按钮
					var submitlen = $rd.find("input[type='submit']").length;
					var butlen = $rd.find("button").length;
					if (submitlen > 0 || butlen > 0) {
						DText += "," + (submitlen + butlen) + "个按钮";
					}
					if (DText) {
						DText = ",本区域包含" + DText;
					}
					return DText;
				},
				roleFilter: function(d) {
					//过滤tab非必要的节点
					var rfArr = [];
					d.each(function() {
						var $this = $(this),
							ds = ScreenRead.handleRole($this);
						if (ds) {
							$this.attr("tabindex", 0);
							rfArr.push($this);
						}
					})
					return rfArr;
				},
				roleFocus: function($childDom,$blockTemp) {
					//必要的节点增加tabindex属性，并绑定onfocus事件
					for (var i = 0; i < $blockTemp.length; i++) {
						$blockTemp[i].attr("tabindex", 0);
						$blockTemp[i].on("keyup",function(e) {
							if (e.keyCode == 9 && $("#tool-oldmode").hasClass("active") && !$(".a11ytoolbar").is(":hidden")) {
								var $this = $(this);
									thisPos = $this.attr("wxa11y-block-pos");
								if (thisPos != undefined) {
									if (thisPos == "start") {
										$childDom.addClass("WXA11y-hover");
									} else if (thisPos == "end") {
										$childDom.removeClass("WXA11y-hover");
									}
								}
								ScreenRead.roleMoveScreen($this);
								var wxevent = $this.attr("wxwza-event");
								if(wxevent){
									$this.trigger(wxevent);
								}
								var txt = ScreenRead.handleRole($this);
								if ($("#tool-screen").hasClass("active")) {
									require.tipScreenObj.Display(txt)
								}
								SoundPlayer.playWithTxt(txt);
							}
							return false;
						})
					}
				},
				reloTabsFocus:function($childDom,changeBlock){
					//重写切换块的得到及失去焦点事件
					var $tit = $(changeBlock.tit.dom);
					if($tit && $tit.length>0){
						$tit.each(function(){
							var $this = $(this),
								idx = $tit.index($this);
							$this.on("keyup",function(e) {
								if (e.keyCode == 9 && $("#tool-oldmode").hasClass("active") && !$(".a11ytoolbar").is(":hidden")) {
									ScreenRead.roleMoveScreen($this);
									var txt = ScreenRead.handleRole($this);
									if(changeBlock.tit.event){
										$this.trigger(changeBlock.tit.event);
									}else{
										ScreenRead.triggerEvent($this,"mouseover");
									}
									if ($("#tool-screen").hasClass("active")) {
										require.tipScreenObj.Display(txt)
									}
									SoundPlayer.playWithTxt(txt);
								}
								return false;
							});
							$this.on("keydown",function(e) {
								if (e.keyCode == 9 && $("#tool-oldmode").hasClass("active") && !$(".a11ytoolbar").is(":hidden")) {
									$(changeBlock.panel.dom).eq(idx).find("[tabindex=0]:eq(0)").focus();
								}
								$this.trigger("mouseout");
								return false;
							});
							//切换体最后一个DOM处理
							if(idx<$tit.length-1){
								var $childdoms = $(changeBlock.panel.dom).eq(idx).find("[tabindex=0]");
								$childdoms.eq($childdoms.length-1).on("keydown",function(e){
									if (e.keyCode == 9 && $("#tool-oldmode").hasClass("active") && !$(".a11ytoolbar").is(":hidden")) {
										var onfocusdom = $tit.eq(idx+1);
										if(onfocusdom.attr("tabindex")){
											onfocusdom.focus();
										}else if(onfocusdom.find("[tabindex=0]").length){
											onfocusdom.find("[tabindex=0]").focus();
										}else{
											onfocusdom.parent().focus();
										}
									}
									return false;
								});
							}
						})
					}
				},
				roleChoose: function(rn) {
					var bs = "";
					switch (rn) {
						case "navigation":
							bs = "导航区";
							break;
						case "viewlist":
							bs = "视窗区";
							break;
						case "interaction":
							bs = "交互区";
							break;
					}
					return bs;
				},
				roleSelected: function(d) {
					var n = d.attr("num") * 1,
						s = d.find("em").text() * 1,
						r = d.attr("wxwza-role-name"),
						$rd = $("[wxwza-role='" + r + "']").eq(n);
					//未生成过标签的区域
					if ($rd.attr("wxwza-tip") == undefined) {
						ScreenRead.roleInit(d);
					}
					//高亮当前区块
					$(".WXA11y-hover").removeClass("WXA11y-hover");
					$rd.addClass("WXA11y-hover");
					//滚动屏幕至当前块
					ScreenRead.roleMoveScreen($rd);
					//获得焦点并读取初始文字
					var $rdfirst = $rd.find("[tabindex='0']").eq(0);
					$rdfirst.focus();
					//因焦点事件调整为keyup，用户点击改为直接读取
					if ($("#tool-screen").hasClass("active")) {
						require.tipScreenObj.Display($rdfirst.text());
					}
					SoundPlayer.playWithTxt($rdfirst.text()+",按tab键浏览信息。");
					//在各个视窗中循环
					if (n < s - 1) {
						n += 1;
					} else {
						n = 0;
					}
					d.attr("num", n);
				},
				roleMoveScreen:function($d){
					var winH = $(window).height(),
						scrH = $(window).scrollTop(),
						domH = $d.offset().top;
					if(domH-scrH>winH/1.85 ||domH-scrH<100){
						$('body,html').stop(true,false).animate({
							scrollTop: $d.offset().top - 200
						}, 500);
					}
				},
				triggerEvent:function (element,eventNameStr){
					if(element instanceof jQuery){
						element = element[0];
					}
					if (document.createEvent) {
					  event = document.createEvent("HTMLEvents");
					  event.initEvent(eventNameStr, true, true);
					  event.eventName = eventNameStr;
					  element.dispatchEvent(event);
					} else {
					  event = document.createEventObject();
					  event.eventType = eventNameStr;
					  event.eventName = eventNameStr;
					  element.fireEvent("on" + event.eventType, event);
					}
				}
			};
			var fontsizeEnum = {
				'L': 1,
				'M': -1
			};
			var fontObj = {
				tagNames: ["BODY", "a", "LABEL", "BUTTON", "INPUT", "TD", "LI", "P", "H1", "H2",
					"H3", "UL", "TABLE", "DIV", "NAV", "IMG", "SPAN", "SELECT", "TEXTAREA","em","b","strong"
				],
				fontTagNames: ["a", "LABEL", "BUTTON", "INPUT", "TD", "LI", "P", "H1", "H2", "H3",
					"UL", "TABLE", "NAV", "SPAN", "SELECT", "TEXTAREA","em","b","strong"
				],
				maxSize: 20,
				minSize: 12,
				size: (typeof ps.mainDocument.css("font-size")) == undefined ? 12 : ps.mainDocument
					.css("font-size").replace('px', ''),
				classAttr: ['', 'WXA11y-hover-blue', 'WXA11y-hover-yellow', 'WXA11y-hover-black'],
				cDescAttr: ['原对比度', '蓝底黄字', '黄底黑字', '黑底黄字'],
				changeColor: function(d) {
					if (d == false) {
						var contrast = $("#tool-contrast"),
							o = contrast.attr("num") * 1;
						$("[wxwza-role]").removeClass("WXA11y-hover");
						$("#a11ybody").removeClass(this.classAttr[o]);
						if (o != 0) {
							$("." + this.classAttr[o]).removeClass(this.classAttr[o]);
						}
						contrast.attr("num", 0);
					} else {
						var n = o = d.attr("num") * 1;
						if (n < 4 - 1) {
							n += 1;
						} else {
							n = 0;
						}
						d.attr("num", n);
						if (o != 0) {
							$("#a11ybody").removeClass(this.classAttr[o]);
						}
						$("#a11ybody").addClass(fontObj.classAttr[n]);
						return {
							"oldClass": this.classAttr[o],
							"newClass": this.classAttr[n],
							"text": this.cDescAttr[n]
						};
					}
				},
				chanageFontsize: function(type) {
					var dom = this.fontTagNames.join(","),
						maxSize = this.maxSize,
						minSize = this.minSize,
						$children = ps.mainDocument.children("#a11ybody").find(this.fontTagNames
							.join(",")),
						depth = 0;
					if (type != false) {
						$children.each(function() {
							var $this = $(this),
								thisize = parseInt($this.css("fontSize"));
							if (isNaN(thisize)) {
								thisize = 16;
							}
							if ($this.attr("WXA11y-fs") == undefined) {
								$this.attr("WXA11y-fs", thisize);
							}
							if (thisize < maxSize || thisize > minSize) {
								$this.css({
									"fontSize": +thisize + type + "px"
								});
							}
						})
					} else {
						$children.each(function() {
							var $this = $(this),
								fs = $this.attr("WXA11y-fs");
							if (fs != undefined) {
								$this.css({
									"fontSize": fs + "px"
								});
							}
						})
					}
				}
			};
			var PanalInit = {
				oldmode: function(_o) {
					var isactive = _o.hasClass("active");
					if (isactive) {
						require.isoldmod = true;
						$(".fun-normalmode").css({
							"display": "none"
						});
						$(".fun-block-child").css({
							"display": "inline-block"
						});
						$("#WXA11Y").addClass("WXA11Y-OLDMODE");
						//开启老龄模式后，默认同步开启指读模式
						$("#tts-single").addClass("active");
						fontObj.changeColor(false);
						ScreenRead.init();
						ScreenRead.Read2End(true);
						//初始化视窗区文本
						ScreenRead.roleInit();
						//打开显示屏
						this.openFun("tool-screen");
						SoundPlayer.playWithTxt("已打开" + document.title + "页面，" + _o.attr(
							"readTxt") + "按tab键开始浏览页面。");
					} else {
						ScreenRead.StopAllRead();
						$(".fun-block-child").css({
							"display": "none"
						});
						$(".fun-normalmode").css({
							"display": "inline-block"
						});
						$("#WXA11Y").removeClass("WXA11Y-OLDMODE");
						fontObj.changeColor(false);
						$("#tts-single").removeClass("active");
						//SoundPlayer.playWithTxt("退出老龄模式");
						this.closeFun("tool-screen");
					}
				},
				closeFun: function(_o) {
					var $o = $("#" + _o);
					if ($o.hasClass("active")) {
						$o.trigger("click");
					}
				},
				openFun: function(_o) {
					var $o = $("#" + _o);
					if (!$o.hasClass("active")) {
						$o.trigger("click");
					}
				},
				reset: function(txt) {
					if($("#tool-oldmode").hasClass("active")){
						$("#tool-oldmode").trigger("click");
					}
					$(".a11ytoolbar .active").each(function() {
						$(this).trigger("click");
					});
					ScreenRead.StopAllRead();
					//背景还原
					fontObj.changeColor(false);
					//文字还原
					fontObj.chanageFontsize(false);
					//大小还原
					zoomObj.initzoom();
					//语速还原
					$("#tts-speed").attr("speed", 5);
					//鼠标样式还原
					$("#mousestyle").remove();
					if (ps.PageScale != 1) {
						ps.PageScale = 1;
						//ps.mainDocument.removeAttr("style");
					}
					if (!txt) {
						txt = ".";
					}
					SoundPlayer.playWithTxt(txt);
				}
			}
			var SoundPlayer = {
				isPlayInited: false,
				initPlayer: function() {
					if (this.isPlayInited) return;
					soundManager.setup({
						debugMode: false,
						debugFlash: false,
						url: require.path + "sm2/",
						onready: function() {
							this.isPlayInited = true;
						}
					});
				},
				playWithTxt: function(t, f) {
					this.sendJonsp(t, f);
				},
				//正文过长的进行切割后通过回调函数来循环
				playWithTxtCycle: function(f) {
					if (ScreeReadCyle.voiceTextNum <= ScreeReadCyle.voiceTextMaxNum) {
						this.playWithTxt(ScreeReadCyle.voiceText[ScreeReadCyle.voiceTextNum],
							function() {
								ScreeReadCyle.voiceTextNum++;
								SoundPlayer.playWithTxtCycle(f);
							});
					} else {
						if (f && typeof(f) === "function") {
							f();
						}
					}
				},
				sendJonsp: function(t, f) {
					var dj = {};
					if (t.length < 1) {
						return;
					} else {
						dj.t = t;
					}
					if (dj.s == undefined) dj.s = $("#tts-speed").attr("speed") || 5;
					$.ajax({
						url: "https://tts.wxzwb.com/front/voice-service/txt2audio",
						dataType: "jsonp",
						data: {
							text: encodeURI(dj.t),
							speed: dj.s
						},
						callback: "callback",
						jsonpCallback: ("jsonp_" + Math.random()).replace(".", ""),
						success: function(data) {
							if (!data.success) {
								console.log(data.message);
							}
							SoundPlayer.play(data.voiceURL, f);
						},
						error: function(data) {
							if (!data.success) {
								console.log(data.message);
							}
							SoundPlayer.play(data.voiceURL, f);
						}
					});
				},
				play: function(u, f) {
					try {
						if (!this.isPlayInited) {
							this.initPlayer();
						}
						if (ScreenRead.soundMute) {
							(f && typeof(f) === "function") && f();
						} else {
							if (soundManager) {
								soundManager.stopAll();
							}
							var mySoundObject = soundManager.createSound({
								url: u,
								onfinish: function() {
									soundManager.destroySound(this.id);
									(f && typeof(f) === "function") && f();
								},
								ondataerror: function() {
									(f && typeof(f) === "function") && f();
								}
							});
							lastUrl = u;
							mySoundObject.play();
						}
					} catch (e) {
						(f && typeof(f) === "function") && f();
					}
				}
			};
			var tipScreenObj = {
				isEnable: false,
				hidedisplay: function() {
					var self = this;
					$("#wxwzadisplay").slideUp("slow", function() {
						self.isEnable = true;
					});
					PanalInit.closeFun("#tool-screen");
				},
				ToggleDisplay: function() {
					var self = this;
					$("#wxwzadisplay").slideToggle(0, function() {
						if ($(this).is(":hidden")) self.isEnable = false;
						else self.isEnable = true;
					});
				},
				Display: function(txt, callback) {
					$("#wxwzadisplay>center").html(txt);
					if (callback) callback();
				}
			};
			var tipLineObj = {
				tip_page_x: '<div class="tip-page-x" style="width:5px;height:0px;background-color:transparent;position:absolute;left:50%;top:0;z-index:9999;overflow:hidden;background-color:red;"></div>',
				tip_page_y: '<div class="tip-page-y" style="width:0px;height:5px;background-color:transparent;position:absolute;left:0;top:50%;z-index:9999;overflow:hidden;background-color:red;"></div>',
				tip_page_ele: null,
				mouseX: function(evt) {
					if (evt.pageX) return evt.pageX;
					else if (evt.clientX) return evt.clientX + (document.documentElement
						.scrollLeft ? document.documentElement.scrollLeft : document
						.body.scrollLeft);
					else return null;
				},
				mouseY: function(evt) {
					if (evt.pageY) return evt.pageY;
					else if (evt.clientY) return evt.clientY + (document.documentElement
						.scrollTop ? document.documentElement.scrollTop : document.body
						.scrollTop);
					else return null;
				},
				_moveEvent: function(e) {
					if (e.data.caller.tip_page_x.is(":hidden")) return;
					var self = e.data.caller;
					self.setPosition(self.mouseX(e), self.mouseY(e));
				},
				setPosition: function(x, y) {
					this.tip_page_x.css({
						top: 0,
						left: x + 5
					});
					this.tip_page_y.css({
						top: y + 5,
						left: 0
					});
				},
				hideTipLine: function() {
					if ($(".tip-page-x").is(":visible")) {
						this.tip_page_x.hide();
						this.tip_page_y.hide();
					}
					PanalInit.closeFun("#tool-line");
				},
				ToggleTipLine: function() {
					if (typeof this.tip_page_x == "string") {
						this.tip_page_x = $(this.tip_page_x).appendTo(ps.mainDocument).css({
							height: ps.mainDocument.prop('scrollHeight')
						});
						this.tip_page_y = $(this.tip_page_y).appendTo(ps.mainDocument).css({
							width: ps.mainDocument.prop('scrollWidth')
						});
						ps.mainDocument.bind('mousemove', {
							caller: this
						}, this._moveEvent)
					} else {
						if (this.tip_page_x.is(":hidden")) {
							this.tip_page_x.show();
							this.tip_page_y.show();
						} else {
							this.tip_page_x.hide();
							this.tip_page_y.hide();
						}
					}
				}
			};
			var zoomObj = {
				docWidth: ps.mainDocument.children()[0].offsetWidth,
				docHeight: ps.mainDocument.children()[0].offsetWidth,
				zoomin: function(e) {
					if (ps.PageScale < 1.5) ps.PageScale += 0.1;
					this._zoom(ps.PageScale);
					//this._style();
				},
				zoomout: function(e) {
					if (ps.PageScale >= 1.1) {
						ps.PageScale -= 0.1;
						this._zoom(ps.PageScale);
					} else {
						ps.mainDocument.children()[0].removeAttribute("style");
					}
					//this._style();
				},
				_zoom: function(scale) {
					ps.mainDocument.children("#a11ybody").css({
						"-moz-transform": "scale(" + scale + ")",
						"-o-transform": "scale(" + scale + ")",
						"-webkit-transform": "scale(" + scale + ")",
						"-moz-transform-origin": "top center",
						"-webkit-transform-origin": "top center",
						"transform": "scale(" + scale + ")",
						"zoom": scale
					});
				},
				initzoom: function() {
					this._zoom(1);
				},
				_style: function() {}
			};
			$("div.a11ytoolbar .fun").on("click", function() {
				var $this = $(this);
				switch (this.id) {
					case "font-lagre":
						fontObj.chanageFontsize(fontsizeEnum.L);
						SoundPlayer.playWithTxt("字体增大", function() {
							ScreenRead.Read2End();
						});
						break;
					case "font-small":
						fontObj.chanageFontsize(fontsizeEnum.M);
						SoundPlayer.playWithTxt("字体缩小", function() {
							ScreenRead.Read2End();
						});
						break;
					case "page-zoomin":
						zoomObj.zoomin();
						SoundPlayer.playWithTxt("页面放大", function() {
							ScreenRead.Read2End();
						});
						break;
					case "page-zoomout":
						zoomObj.zoomout();
						SoundPlayer.playWithTxt("页面缩小", function() {
							ScreenRead.Read2End();
						});
						break;
					case "tool-line":
						tipLineObj.ToggleTipLine();
						$this.toggleClass("active");
						var isactive = $this.hasClass("active");
						if (isactive) {
							SoundPlayer.playWithTxt("辅助线开启", function() {
								ScreenRead.Read2End();
							});
						}
						break;
					case "tool-contrast":
						//多颜色切换
						//白底+黑字，蓝底+黄字，黄底+黑字，黑底+黄字
						cc = fontObj.changeColor($this);
						if (cc.oldClass != "") {
							$("#tool-contrast").removeClass(cc.oldClass);
						}
						$("#tool-contrast").addClass(cc.newClass);
						SoundPlayer.playWithTxt(cc.text + "模式");
						break;
					case "tool-screen":
						$this.toggleClass("active");
						ScreenRead.init();
						if (require.tipScreenObj.Display != undefined) {
							require.tipScreenObj.ToggleDisplay();
							require.tipScreenObj.Display("提示：在页面中移动鼠标，此处将突出显示相应文字。");
						} else {
							SoundPlayer.playWithTxt("显示屏开启失败，请刷新页面重试。");
						}
						var isactive = $this.hasClass("active");
						if (isactive && !require.isoldmod) {
							SoundPlayer.playWithTxt("显示屏开启，在页面中移动鼠标，此处将突出显示相应文字。");
						} else {
							SoundPlayer.playWithTxt(".");
						}
						break;
					case "tts-single":
						$this.toggleClass("active");
						$("#tts-screenread").removeClass("active");
						fontObj.changeColor(false);
						var isactive = $this.hasClass("active");
						if (isactive) {
							ScreenRead.roleInit();
							ScreenRead.init();
							ScreenRead.Read2End(true);
							SoundPlayer.playWithTxt("开启指读模式，移动鼠标至文本即可朗读");
						} else {
							ScreenRead.StopAllRead();
							SoundPlayer.playWithTxt("指读模式已关闭");
						}
						break;
					case "tts-screenread":
						$this.toggleClass("active");
						$("#tts-single").removeClass("active");
						var isactive = $this.hasClass("active");
						if (isactive) {
							ScreenRead.roleInit();
							ScreenRead.init();
							SoundPlayer.playWithTxt("开启全文朗读模式,"+$("#tool-oldmode").attr("readtxt"), function() {
								ScreenRead.positionNode();
								//ScreenRead.newReadInit();
							});
						} else {
							SoundPlayer.playWithTxt("全文朗读模式已关闭");
							ScreenRead.StopAllRead();
							var contrast = $("#tool-contrast");
							if (contrast.hasClass("active")) {
								contrast.trigger("click");
							}
							$(".WXA11y-hover").removeClass("WXA11y-hover");
							//如果老龄模式开启时，全文朗读模式模式关闭时，自动开启据指读模式
							if ($("#tool-oldmode").hasClass("active")) {
								SoundPlayer.playWithTxt("老龄模式开启过程中，不建议关闭指读模式。");
							}
						}
						break;
					case "WXA11y-fold":
						var _a = $(".WXA11Y");
						_a.toggleClass("WXA11Y-MIN");
						var _aismin = _a.hasClass("WXA11Y-MIN");
						if (_aismin) require.bodyPT(62);
						else require.bodyPT(84);
						break;
					case "WX-easyRead-Smooth":
						var crt = "关闭无障碍浏览";
						if (require.isoldmod) {
							crt = "退出老龄模式";
						}
						PanalInit.reset(crt);
						if (require.quitBtn != null && $(require.quitBtn).length > 0) {
							$(require.quitBtn).trigger("click");
						} else {
							require.WXA11yOpen.trigger("click");
						}
						require.isoldmod = false;
						break;
					case "tool-mousestyle":
						if ($("#mousestyle").length > 0) {
							$("#mousestyle").remove();
						} else {
							$("head").eq(0).append($(
								'<style id="mousestyle" type="text/Css">*{cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAnCAYAAAARrli9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozODNkOWYzOS00NjViLTZlNDUtYjRkYi0zMDhlZDBmM2Y2MmIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUI5MUI2QjdFNDQwMTFFQjg5MDRCQkZFMzIyNThFRkMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUI5MUI2QjZFNDQwMTFFQjg5MDRCQkZFMzIyNThFRkMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOmU3ZmJmYjY4LWNkOWEtMTk0Ni1iNzQ1LTU0Y2ZjMDlkY2JhYyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozODNkOWYzOS00NjViLTZlNDUtYjRkYi0zMDhlZDBmM2Y2MmIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5/KhyuAAADPUlEQVR42ryXX0hTURzHf456sRR8SY3e8s8cQgynmOmLjQjrwZfQiB4iiWlSL/og0Yz1IhKVQ0SnDxPnNqMgkhE9jECDhtM9KfnkU289tLmmoMHt9z3dI3NdZ84zv/C99/zuOTufe84993fPCjRNI8hms93hUwv7DHtxeXnZQwpVAJAO8WXUORn2XBXIpJ8dOAwMDJDL5ZJ1Lr6BEdUjEvPHIxAXI5EI9fb2yjZB3AjXJVSM6BcOW1tbImhsbCSfz0fFxcUIOzGtfDPnVYD+kdlspkAgQKWlpQhvst8yrFY5CAIEsKqqKoSX2e9zhZkOa4Dp8/v9YjpZF9lhhlmVg6RGR0eptbUVxXPsGMOu5QUEDQ8PU0dHhww/MexWXkBQf38/ORwOGb5h2KO8gKCuri7q6+uT4QjDnuUFJF6uzk4aGhqS4SDDXucFBNntdhobG5PhY4b52UXKQVBDQwPNzMxQUZHo/zY7wLALykFQTU2NeNfKysoQ3kB+ZJhFOQgqLy8XWaSyshLhFfa79CyiDARh+mZnZ/E1EOlSzyK1ykGiQ5OJxsfHM7OIWTkoPYu0t7ejeBpbhLyBoOrqalm0njpORxsbG7S+vk6pVIo2NzcpkUhQPB4XRry6uiqbLh4LhI6dTme2JjH2C94GBI4FslqtVF9fT9FoFOEr9nf2D91xBkT2GmNzUldXl2RrPAWakdxutxaLxQzr1tbWNPyWHUVfB/nQxeDxeGh6eprm5uYM6y0Wi9hf/N2D2p7klFQBgaFwOCwesJF6enpk8fqRQekQ1gcM3+v1GrZtamoSKYjVzKN6kA10FofCwkIjiJ0tPjzIZTs7O4aw7u5uWbybDfQFB6SOiYmJfRBeOWH2V8ze7u6uyNJGamtro5KSEjmqhweBxMswNTVFk5OT+yBpbbF8xcLItp/Q1WII4g4/8wlZcFD31QwI2oQw8mQySfPz84ag7e1tWUwZbvL/Vzwl9zFw7GBDodDe9aWlJQoGg7SwsCAv3eMb8+YM0mGLeA5Y0hUVFeL7s7KyIquRGZ5mQnIF4V35mHH5GxtvtJshPw/8f3RU6bBm9iVkZvZLBvw+9I/YSchEJ6QTA/0RYABk8YD9dAv/AQAAAABJRU5ErkJggg==),auto !important}</style>'
								));
						}
						SoundPlayer.playWithTxt("鼠标箭头样式切换");
						break;
					case "tool-oldmode":
						//if(!require.isoldmod){
						//文字还原
						fontObj.chanageFontsize(false);
						$this.toggleClass("active");
						PanalInit.oldmode($this);

						//}
						break;
					case "tool-nav":
						ScreenRead.roleSelected($this)
						break;
					case "tool-vl":
						ScreenRead.roleSelected($this)
						break;
					case "tool-ia":
						ScreenRead.roleSelected($this)
						break;
					case "tts-speed":
						var sp = $this.attr("speed") * 1,
							spDesc = "语速正常";
						if (sp >= 7) {
							sp = 3;
							spDesc = "语速缓慢";
						} else {
							sp += 2;
							if (sp == 7) {
								spDesc = "语速加快";
							}
						}
						$this.attr("speed", sp);
						SoundPlayer.playWithTxt(spDesc);
						break;
					case "tool-reload":
						//location.reload();
						var crt = "无障碍";
						if (require.isoldmod) {
							crt = "老龄模式";
						}
						PanalInit.reset(crt + "功能重致");
						break;
				}
				//return false;
			});

			//正文中增加语音播报按钮
			$("div.voiceTip").on("click", function() {
				var $voiceIco = $(this).find("i");
				if ($voiceIco.hasClass("stoped")) {
					//获取正文文本
					var bodyContrArr = $("[wxa11ycont]")[0].childNodes;
					ScreenRead.handleNodes(bodyContrArr);
					//防止文本过长，切割文本
					ScreeReadCyle.voiceText = document.title + "," + ScreeReadCyle.voiceText;
					ScreeReadCyle.voiceText = ScreenRead.replaceAll(ScreeReadCyle.voiceText,
						",", "，").split("，");
					ScreeReadCyle.voiceTextNum = 0
					ScreeReadCyle.voiceTextMaxNum = ScreeReadCyle.voiceText.length - 1;

					$voiceIco.removeClass("stoped");
					$voiceIco.addClass("starting");

					SoundPlayer.playWithTxtCycle(function() {
						$voiceIco.removeClass("starting");
						$voiceIco.addClass("stoped");
						ScreenRead.StopAllRead();
						SoundPlayer.playWithTxt(" 语音播报结束");
						//清空上一次读取过的方便内容
						ScreeReadCyle.voiceText = '';
					})
				} else {
					ScreeReadCyle.voiceTextMaxNum = ScreeReadCyle.voiceTextNum = 0;
					$voiceIco.removeClass("starting");
					$voiceIco.addClass("stoped");
					ScreenRead.StopAllRead();
					SoundPlayer.playWithTxt(" 语音播报结束");
				}
				return false;
			})
			$(document).focus();
			$(document).bind('keydown', function(e) {
				//alt+1，视窗-导航区
				if (e.keyCode == 49 && e.altKey) {
					$("#tool-nav").trigger("click");
				}
				//alt+2，视窗-视窗区
				if (e.keyCode == 50 && e.altKey) {
					$("#tool-vl").trigger("click");
				}
				//alt+4，视窗-交互区
				if (e.keyCode == 52 && e.altKey) {
					$("#tool-ia").trigger("click");
				}
				//alt+o,打开老龄模式
				if (e.keyCode == 79 && e.altKey) {
					$("#tool-oldmode").trigger("click");
				}
				//alt+ +,页面放大
				if (e.keyCode == 187 && e.altKey) {
					$("#page-zoomin").trigger("click");
				}
				//alt+ -,页面缩小
				if (e.keyCode == 189 && e.altKey) {
					$("#page-zoomout").trigger("click");
				}
			});
			//判断是否初始化【老龄模式】
			if (require.isoldmod) {
				PanalInit.oldmode($("#tool-oldmode"));
				require.initA11y(".a11ytoolbar");
			}
			return this;
		},
		setValue: function(v, callback) {}
	});
})(jQuery);
jQuery(document).ready(function() {
	setTimeout("var _a11y = $.fn.WXA11y()", 1000);
})
