"undefined"==typeof TestRecorder&&(TestRecorder={});"undefined"==typeof TestRecorder.Browser&&(TestRecorder.Browser={});TestRecorder.Browser.captureEvent=function(a,b,c){var d=b.toLowerCase();a.captureEvents(Event[b.toUpperCase()]);a["on"+d]=c};TestRecorder.Browser.releaseEvent=function(a,b,c){c=b.toLowerCase();a.releaseEvents(Event[b.toUpperCase()]);a["on"+c]=null};
TestRecorder.Browser.getSelection=function(a){var b=a.document;return a.getSelection?a.getSelection()+"":b.getSelection?b.getSelection()+"":b.selection&&b.selection.createRange?b.selection.createRange().text+"":""};TestRecorder.Browser.windowHeight=function(a){var b=a.document;return a.innerHeight?a.innerHeight:b.documentElement&&b.documentElement.clientHeight?b.documentElement.clientHeight:document.body?document.body.clientHeight:-1};
TestRecorder.Browser.windowWidth=function(a){var b=a.document;return a.innerWidth?a.innerWidth:b.documentElement&&b.documentElement.clientWidth?b.documentElement.clientWidth:document.body?document.body.clientWidth:-1};TestRecorder.Event=function(a){this.event=a?a:window.event};TestRecorder.Event.LeftButton=0;TestRecorder.Event.MiddleButton=1;TestRecorder.Event.RightButton=2;TestRecorder.Event.UnknownButton=3;TestRecorder.Event.prototype.stopPropagation=function(){this.event.stopPropagation&&this.event.stopPropagation()};
TestRecorder.Event.prototype.preventDefault=function(){this.event.preventDefault&&this.event.preventDefault()};TestRecorder.Event.prototype.type=function(){return this.event.type};TestRecorder.Event.prototype.button=function(){return this.event.button?2==this.event.button?TestRecorder.Event.RightButton:TestRecorder.Event.LeftButton:this.event.which?1<this.event.which?TestRecorder.Event.RightButton:TestRecorder.Event.LeftButton:TestRecorder.Event.UnknownButton};
TestRecorder.Event.prototype.target=function(){var a=this.event.target?this.event.target:this.event.srcElement;return a&&3==a.nodeType?a.parentNode:a};TestRecorder.Event.prototype.keycode=function(){return this.event.keyCode?this.event.keyCode:this.event.which};TestRecorder.Event.prototype.keychar=function(){return String.fromCharCode(this.keycode())};TestRecorder.Event.prototype.shiftkey=function(){return this.event.shiftKey?!0:!1};
TestRecorder.Event.prototype.posX=function(){return this.event.pageX?this.event.pageX:this.event.clientX?this.event.clientX+document.body.scrollLeft:0};TestRecorder.Event.prototype.posY=function(){return this.event.pageY?this.event.pageY:this.event.clientY?this.event.clientY+document.body.scrollTop:0};TestRecorder.TestCase=function(){this.title="Test Case";this.items=[]};
TestRecorder.TestCase.prototype.append=function(a){this.items[this.items.length]=a;chrome.runtime.sendMessage({action:"append",obj:a})};TestRecorder.TestCase.prototype.peek=function(){return this.items[this.items.length-1]};TestRecorder.TestCase.prototype.poke=function(a){this.items[this.items.length-1]=a;chrome.runtime.sendMessage({action:"poke",obj:a})};"undefined"==typeof TestRecorder.EventTypes&&(TestRecorder.EventTypes={});TestRecorder.EventTypes.OpenUrl=0;TestRecorder.EventTypes.Click=1;
TestRecorder.EventTypes.Change=2;TestRecorder.EventTypes.Comment=3;TestRecorder.EventTypes.Submit=4;TestRecorder.EventTypes.CheckPageTitle=5;TestRecorder.EventTypes.CheckPageLocation=6;TestRecorder.EventTypes.CheckTextPresent=7;TestRecorder.EventTypes.CheckValue=8;TestRecorder.EventTypes.CheckValueContains=9;TestRecorder.EventTypes.CheckText=10;TestRecorder.EventTypes.CheckHref=11;TestRecorder.EventTypes.CheckEnabled=12;TestRecorder.EventTypes.CheckDisabled=13;
TestRecorder.EventTypes.CheckSelectValue=14;TestRecorder.EventTypes.CheckSelectOptions=15;TestRecorder.EventTypes.CheckImageSrc=16;TestRecorder.EventTypes.PageLoad=17;TestRecorder.EventTypes.ScreenShot=18;TestRecorder.EventTypes.ElementScreenShot=24;TestRecorder.EventTypes.MoveCursorToElement=25;TestRecorder.EventTypes.PrintElementText=26;TestRecorder.EventTypes.SaveElementText=27;TestRecorder.EventTypes.ExplicitWait=28;TestRecorder.EventTypes.FetchElementText=29;
TestRecorder.EventTypes.SelectElementOption=30;TestRecorder.EventTypes.CancelLastStep=31;TestRecorder.EventTypes.NoteDownElement=32;TestRecorder.EventTypes.InspectElement=33;TestRecorder.EventTypes.Cancel=99;TestRecorder.EventTypes.MouseDown=19;TestRecorder.EventTypes.MouseUp=20;TestRecorder.EventTypes.MouseDrag=21;TestRecorder.EventTypes.MouseDrop=22;TestRecorder.EventTypes.KeyPress=23;
TestRecorder.ElementInfo=function(a){this.action=a.action;this.method=a.method;this.href=a.href;this.tagName=a.tagName;this.selector=this.getCleanCSSSelector(a);this.value=a.value;this.checked=a.checked;this.name=a.name;if(this.type=a.type)this.type=this.type.toLowerCase();a.form&&(this.form={id:a.form.id,name:a.form.getAttribute("name")});this.src=a.src;this.id=a.id;this.title=a.title;this.selectedIndex=a.selectedIndex;this.options=[];if(a.selectedIndex)for(var b=0;b<a.options.length;b++){var c=
a.options[b];this.options[b]={text:c.text,value:c.value}}this.label=this.findLabelText(a)};TestRecorder.ElementInfo.prototype.findLabelText=function(a){var b=this.findContainingLabel(a);b||(b=this.findReferencingLabel(a));if(b){var c=b.innerHTML;c=c.replace("\n"," ");c=c.replace(/<[^>]*>/g," ");c=c.replace(/^\W*/mg,"");c=c.replace(/\W*$/mg,"");c=c.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\s+/g," ")}return c};
TestRecorder.ElementInfo.prototype.findReferencingLabel=function(a){for(var b=window.document.getElementsByTagName("label"),c=0;c<b.length;c++)if(b[c].attributes["for"]&&b[c].attributes["for"].value==a.id)return b[c]};TestRecorder.ElementInfo.prototype.findContainingLabel=function(a){if(a=a.parentNode)return a.tagName&&"label"==a.tagName.toLowerCase()?a:this.findContainingLabel(a)};
TestRecorder.ElementInfo.prototype.getCleanCSSSelector=function(a){if(a){var b=a.tagName?a.tagName.toLowerCase():"";if(""==b||"html"==b)return"";var c=document.querySelectorAll(b).length;if(a.id&&(b="#"+a.id.replace(/\./g,"\\."),c=document.querySelectorAll(b).length,1==c))return b;if(a.className){var d="."+a.className.trim().replace(/ /g,".");if(document.querySelectorAll(d).length<c&&(b=d,c=document.querySelectorAll(b).length,1==c))return b}d=a.parentNode;var e=this.getCleanCSSSelector(d);if(e){var f=
0,g=document.querySelectorAll(e+" > "+b);for(c=0;c<g.length;c++)g[c].parentNode==d&&f++;if(1<f){c=1;for(a=a.previousElementSibling;a;a=a.previousElementSibling)c++;b=b+":nth-child("+c+")"}selector_array=e.split(" ");if(1<selector_array.length)for(c=1;c<selector_array.length;c++)if(d=selector_array.slice(0,c).join(" ")+" "+b,1==document.querySelectorAll(d).length){b=d;break}c=document.querySelectorAll(b).length;1<c&&(d=e+" "+b,b=1==document.querySelectorAll(d).length?d:e+" > "+b)}return b}};
TestRecorder.DocumentEvent=function(a,b){this.type=a;this.url=b.URL;this.title=b.title};TestRecorder.ElementEvent=function(a,b,c){this.type=a;this.info=new TestRecorder.ElementInfo(b);this.text=c?c:recorder.strip(contextmenu.innertext(b))};TestRecorder.CommentEvent=function(a){this.type=TestRecorder.EventTypes.Comment;this.text=a};TestRecorder.KeyEvent=function(a,b){this.type=TestRecorder.EventTypes.KeyPress;this.info=new TestRecorder.ElementInfo(a);this.text=b};
TestRecorder.MouseEvent=function(a,b,c,d){this.type=a;this.info=new TestRecorder.ElementInfo(b);this.x=c;this.y=d;this.text=recorder.strip(contextmenu.innertext(b))};TestRecorder.ScreenShotEvent=function(){this.type=TestRecorder.EventTypes.ScreenShot};TestRecorder.ElementScreenShotEvent=function(){this.type=TestRecorder.EventTypes.ElementScreenShot};TestRecorder.InspectElement=function(){this.type=TestRecorder.EventTypes.InspectElement};TestRecorder.NoteDownElement=function(){this.type=TestRecorder.EventTypes.NoteDownElement};
TestRecorder.MoveCursorToElementEvent=function(){this.type=TestRecorder.EventTypes.MoveCursorToElement};TestRecorder.FetchElementTextEvent=function(){this.type=TestRecorder.EventTypes.FetchElementText};TestRecorder.SelectElementOptionEvent=function(){this.type=TestRecorder.EventTypes.SelectElementOption};TestRecorder.PrintElementTextEvent=function(){this.type=TestRecorder.EventTypes.PrintElementText};TestRecorder.SaveElementTextEvent=function(){this.type=TestRecorder.EventTypes.SaveElementText};
TestRecorder.ExplicitWaitEvent=function(){this.type=TestRecorder.EventTypes.ExplicitWait};TestRecorder.CancelLastStepEvent=function(){this.type=TestRecorder.EventTypes.CancelLastStep};TestRecorder.CancelEvent=function(){this.type=TestRecorder.EventTypes.Cancel};TestRecorder.OpenURLEvent=function(a){this.type=TestRecorder.EventTypes.OpenUrl;this.url=a;this.width=window.innerWidth;this.height=window.innerHeight};
TestRecorder.PageLoadEvent=function(a){this.type=TestRecorder.EventTypes.OpenUrl;this.url=a};TestRecorder.ContextMenu=function(){this.window=this.target=this.selected=null;this.over=this.visible=!1;this.menu=null};contextmenu=new TestRecorder.ContextMenu;
TestRecorder.ContextMenu.prototype.build=function(a,b,c){var d=recorder.window.document;a=d.getElementsByTagName("body").item(0);d=d.createElement("div");d.setAttribute("style","backgroundColor:#ffffff;color:#000000;border:1px solid #000000;padding:2px;position:absolute;display:none;top:"+c+"px;left:"+b+"px;border:1px;z-index:10000;");d.style.backgroundColor="#ffffff";d.style.color="#000000";d.style.border="1px solid #000000";d.style.padding="2px";d.style.position="absolute";d.style.display="none";
d.style.zIndex="10000";d.style.top=c.toString();d.style.left=b.toString();d.onmouseover=contextmenu.onmouseover;d.onmouseout=contextmenu.onmouseout;TestRecorder.Browser.getSelection(recorder.window);d.appendChild(this.item("\u68c0\u67e5\u5143\u7d20",this.doInspectElement));d.appendChild(this.item("\u6807\u6ce8\u5143\u7d20",this.doNoteDownElement));d.appendChild(this.item("\u8bfb\u53d6\u5143\u7d20\u6587\u672c",this.doFetchElementText));d.appendChild(this.item("\u663e\u793a\u5143\u7d20\u6587\u672c",
this.doPrintElementText));d.appendChild(this.item("\u4fdd\u5b58\u5143\u7d20\u6587\u672c",this.doSaveElementText));d.appendChild(this.item("\u4fdd\u5b58\u9875\u9762\u622a\u56fe",this.doScreenShot));d.appendChild(this.item("\u4fdd\u5b58\u5143\u7d20\u622a\u56fe",this.doElementScreenShot));d.appendChild(this.item("\u9f20\u6807\u79fb\u52a8\u5230\u5143\u7d20",this.doMoveCursorToElement));d.appendChild(this.item("\u7b49\u5f85\u51e0\u79d2\u79cd",this.doExplicitWait));d.appendChild(this.item("\u5173\u95ed\u83dc\u5355",
this.cancel));a.insertBefore(d,a.firstChild);return d};TestRecorder.ContextMenu.prototype.item=function(a,b){var c=recorder.window.document,d=c.createElement("div");a=c.createTextNode(a);d.setAttribute("style","padding:6px;border:1px solid #ffffff;");d.style.border="1px solid #ffffff";d.style.padding="6px";d.appendChild(a);d.onmouseover=this.onitemmouseover;d.onmouseout=this.onitemmouseout;d.onclick=b;return d};
TestRecorder.ContextMenu.prototype.show=function(a){this.menu&&this.hide();var b=recorder.window;this.target=a.target();TestRecorder.Browser.captureEvent(b,"mousedown",this.onmousedown);var c=TestRecorder.Browser.windowHeight(b);b=TestRecorder.Browser.windowWidth(b);var d=a.posX(),e=a.posY();0<=b&&100>b-d&&(d-=100);0<=c&&100>c-e&&(e-=100);this.menu=a=this.build(a.target(),d,e);a.style.display="";this.visible=!0};
TestRecorder.ContextMenu.prototype.hide=function(){var a=recorder.window;TestRecorder.Browser.releaseEvent(a,"mousedown",this.onmousedown);a=a.document.getElementsByTagName("body").item(0);this.menu.style.display="none";a.removeChild(this.menu);this.target=null;this.over=this.visible=!1;this.menu=null};TestRecorder.ContextMenu.prototype.onitemmouseover=function(a){this.style.backgroundColor="#efefef";this.style.border="1px solid #c0c0c0";return!0};
TestRecorder.ContextMenu.prototype.onitemmouseout=function(a){this.style.backgroundColor="#ffffff";this.style.border="1px solid #ffffff";return!0};TestRecorder.ContextMenu.prototype.onmouseover=function(a){contextmenu.over=!0};TestRecorder.ContextMenu.prototype.onmouseout=function(a){contextmenu.over=!1};TestRecorder.ContextMenu.prototype.onmousedown=function(a){return contextmenu.visible?(0==contextmenu.over&&contextmenu.hide(),!0):!1};
TestRecorder.ContextMenu.prototype.record=function(a){recorder.testcase.append(a);recorder.log(a.type);contextmenu.hide()};TestRecorder.ContextMenu.prototype.checkPageTitle=function(){var a=new TestRecorder.DocumentEvent(TestRecorder.EventTypes.CheckPageTitle,recorder.window.document);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doScreenShot=function(){var a=new TestRecorder.ScreenShotEvent;contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.doElementScreenShot=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.ElementScreenShot,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doInspectElement=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.InspectElement,contextmenu.target);contextmenu.record(a);a=a.info.selector;"#"==a.charAt(0)&&(a=a.substring(1));prompt("\u5f53\u524d\u5143\u7d20\u7684\u5b9a\u4f4d\u6807\u8bc6\u662f \u25b9",a)};
TestRecorder.ContextMenu.prototype.doNoteDownElement=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.NoteDownElement,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doMoveCursorToElement=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.MoveCursorToElement,contextmenu.target);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.doFetchElementText=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.FetchElementText,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doSelectElementOption=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.SelectElementOption,contextmenu.target);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.doPrintElementText=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.PrintElementText,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doSaveElementText=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.SaveElementText,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.doExplicitWait=function(){var a=new TestRecorder.ExplicitWaitEvent;contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.doCancelLastStep=function(){var a=new TestRecorder.CancelLastStepEvent;contextmenu.record(a)};TestRecorder.ContextMenu.prototype.cancel=function(){contextmenu.hide();var a=new TestRecorder.CancelEvent;contextmenu.record(a)};TestRecorder.ContextMenu.prototype.checkPageLocation=function(){var a=new TestRecorder.DocumentEvent(TestRecorder.EventTypes.CheckPageLocation,recorder.window.document);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.checkValue=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckValue,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.checkValueContains=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckValueContains,contextmenu.target,contextmenu.selected);contextmenu.selected=null;contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.innertext=function(a){if(document.createRange){var b=recorder.window.document.createRange();b.selectNodeContents(a);return b.toString()}return a.innerText};TestRecorder.ContextMenu.prototype.checkText=function(){var a=contextmenu.target;var b="button"==a.type||"submit"==a.type?a.value:contextmenu.innertext(a);b=recorder.strip(b);a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckText,a,b);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.checkTextPresent=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckTextPresent,contextmenu.target,contextmenu.selected);contextmenu.selected=null;contextmenu.record(a)};TestRecorder.ContextMenu.prototype.checkHref=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckHref,contextmenu.target);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.checkEnabled=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckEnabled,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.checkDisabled=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckDisabled,contextmenu.target);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.checkSelectValue=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckSelectValue,contextmenu.target);contextmenu.record(a)};TestRecorder.ContextMenu.prototype.checkSelectOptions=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckSelectOptions,contextmenu.target);contextmenu.record(a)};
TestRecorder.ContextMenu.prototype.checkImgSrc=function(){var a=new TestRecorder.ElementEvent(TestRecorder.EventTypes.CheckImageSrc,contextmenu.target);contextmenu.record(a)};TestRecorder.Recorder=function(){this.testcase=new TestRecorder.TestCase;this.window=this.logfunc=null;this.active=!1};recorder=new TestRecorder.Recorder;recorder.logfunc=function(a){console.log(a)};
TestRecorder.Recorder.prototype.start=function(){this.window=window;this.captureEvents();var a="("+function(){var a=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){console.log(this);a.apply(this,arguments)}}+")();",b=document.createElement("script");b.textContent=a;(document.head||document.documentElement).appendChild(b);b.parentNode.removeChild(b);this.active=!0;this.log("recorder started")};
TestRecorder.Recorder.prototype.stop=function(){this.releaseEvents();this.active=!1;this.log("recorder stopped")};TestRecorder.Recorder.prototype.open=function(a){var b=new TestRecorder.OpenURLEvent(a);this.testcase.append(b);this.log("open url: "+a)};TestRecorder.Recorder.prototype.pageLoad=function(){var a=new TestRecorder.DocumentEvent(TestRecorder.EventTypes.PageLoad,recorder.window.document);this.testcase.append(a);this.log("page loaded url: "+a.url)};
TestRecorder.Recorder.prototype.captureEvents=function(){var a=this.window;TestRecorder.Browser.captureEvent(a,"contextmenu",this.oncontextmenu);TestRecorder.Browser.captureEvent(a,"drag",this.ondrag);TestRecorder.Browser.captureEvent(a,"mousedown",this.onmousedown);TestRecorder.Browser.captureEvent(a,"mouseup",this.onmouseup);TestRecorder.Browser.captureEvent(a,"click",this.onclick);TestRecorder.Browser.captureEvent(a,"change",this.onchange);TestRecorder.Browser.captureEvent(a,"keypress",this.onkeypress);
TestRecorder.Browser.captureEvent(a,"select",this.onselect);TestRecorder.Browser.captureEvent(a,"submit",this.onsubmit)};
TestRecorder.Recorder.prototype.releaseEvents=function(){var a=this.window;TestRecorder.Browser.releaseEvent(a,"contextmenu",this.oncontextmenu);TestRecorder.Browser.releaseEvent(a,"drag",this.ondrag);TestRecorder.Browser.releaseEvent(a,"mousedown",this.onmousedown);TestRecorder.Browser.releaseEvent(a,"mouseup",this.onmouseup);TestRecorder.Browser.releaseEvent(a,"click",this.onclick);TestRecorder.Browser.releaseEvent(a,"change",this.onchange);TestRecorder.Browser.releaseEvent(a,"keypress",this.onkeypress);
TestRecorder.Browser.releaseEvent(a,"select",this.onselect);TestRecorder.Browser.releaseEvent(a,"submit",this.onsubmit)};TestRecorder.Recorder.prototype.clickaction=function(a){if(!contextmenu.visible){var b=TestRecorder.EventTypes,c=a.target();c.href||c.type&&"submit"==c.type?this.testcase.append(new TestRecorder.ElementEvent(b.Click,a.target())):recorder.testcase.append(new TestRecorder.MouseEvent(TestRecorder.EventTypes.Click,a.target(),a.posX(),a.posY()))}};
TestRecorder.Recorder.prototype.addComment=function(a){this.testcase.append(new TestRecorder.CommentEvent(a))};TestRecorder.Recorder.prototype.check=function(a){contextmenu.show(a);a=a.target();if(a.type){var b=a.type.toLowerCase();"submit"!=b&&"button"!=b&&"image"!=b||recorder.log('check button == "'+a.value+'"')}else a.href&&a.innerText&&(recorder.strip(a.innerText),recorder.log('check link == "'+a.text+'"'))};
TestRecorder.Recorder.prototype.onpageload=function(){if(this.active){recorder.captureEvents();if(this.testcase.peek()){var a=this.testcase.peek().type;a!=TestRecorder.EventTypes.OpenUrl&&a!=TestRecorder.EventTypes.Click&&a!=TestRecorder.EventTypes.Submit&&this.open(this.window.location.toString())}this.window&&this.pageLoad()}};
TestRecorder.Recorder.prototype.onchange=function(a){a=new TestRecorder.Event(a);var b=TestRecorder.EventTypes,c=a.target();b=c.selectedIndex||"option"==c.type?new TestRecorder.ElementEvent(b.SelectElementOption,a.target()):new TestRecorder.ElementEvent(b.Change,a.target());recorder.testcase.append(b);recorder.log("value changed: "+a.target().value)};TestRecorder.Recorder.prototype.onselect=function(a){a=new TestRecorder.Event(a);recorder.log("select: "+a.target())};
TestRecorder.Recorder.prototype.onsubmit=function(a){a=new TestRecorder.Event(a);for(var b=TestRecorder.EventTypes,c=a.target();c.parentNode&&"FORM"!=c.tagName;)c=c.parentNode;b=new TestRecorder.ElementEvent(b.Submit,c);recorder.testcase.append(b);recorder.log("submit: "+a.target())};TestRecorder.Recorder.prototype.ondrag=function(a){a=new TestRecorder.Event(a);recorder.testcase.append(new TestRecorder.MouseEvent(TestRecorder.EventTypes.MouseDrag,a.target(),a.posX(),a.posY()))};
TestRecorder.Recorder.prototype.onmousedown=function(a){contextmenu.visible||(a=new TestRecorder.Event(a),a.button()==TestRecorder.Event.LeftButton&&recorder.testcase.append(new TestRecorder.MouseEvent(TestRecorder.EventTypes.MouseDown,a.target(),a.posX(),a.posY())))};
TestRecorder.Recorder.prototype.onmouseup=function(a){contextmenu.visible||(a=new TestRecorder.Event(a),a.button()==TestRecorder.Event.LeftButton&&recorder.testcase.append(new TestRecorder.MouseEvent(TestRecorder.EventTypes.MouseUp,a.target(),a.posX(),a.posY())))};
TestRecorder.Recorder.prototype.onclick=function(a){a=new TestRecorder.Event(a);if(a.shiftkey())return recorder.check(a),a.stopPropagation(),a.preventDefault(),!1;if(a.button()==TestRecorder.Event.RightButton)return recorder.check(a),!0;if(a.button()==TestRecorder.Event.LeftButton)return recorder.clickaction(a),!0;a.stopPropagation();a.preventDefault();return!1};
TestRecorder.Recorder.prototype.oncontextmenu=function(a){a=new TestRecorder.Event(a);recorder.check(a);a.stopPropagation();a.preventDefault();return!1};TestRecorder.Recorder.prototype.onkeypress=function(a){a=new TestRecorder.Event(a);var b=recorder.testcase.peek();b.type==TestRecorder.EventTypes.KeyPress?(b.text+=a.keychar(),recorder.testcase.poke(b)):recorder.testcase.append(new TestRecorder.KeyEvent(a.target(),a.keychar()));return!0};
TestRecorder.Recorder.prototype.strip=function(a){return a.replace(/^\s+/,"[whitespace]").replace(/\s+$/,"[whitespace]")};TestRecorder.Recorder.prototype.log=function(a){this.logfunc&&this.logfunc(a)};chrome.runtime.onMessage.addListener(function(a,b,c){"start"==a.action&&(recorder.start(),c({}));"stop"==a.action&&(recorder.stop(),c({}));"open"==a.action&&(recorder.open(a.url),c({}));"addComment"==a.action&&(recorder.addComment(a.text),c({}))});
chrome.runtime.sendMessage({action:"get_status"},function(a){a.active&&recorder.start()});
