diff --git a/test/samples-all.generated.js b/test/samples-all.generated.js index 82e41440..a9c76af4 100644 --- a/test/samples-all.generated.js +++ b/test/samples-all.generated.js @@ -52,17 +52,37 @@ define([], function() { return[ "name": "run-editor-sample-msn-js.txt", "content": "(function(n){function t(n,i,r){return typeof n==\"number\"&&(t(i)?n>=i:!0)&&(t(r)?n<=r:!0)}function i(n,i){return typeof n==\"string\"&&(t(i)?n.length>=i:!0)}var r=n.isArray;n.extend({isNumber:t,isString:i,isObject:function(n){return typeof n==\"object\"&&n!==null},isDefined:function(n){return typeof n!=\"undefined\"},isArray:function(n,i){return r(n)&&(t(i)?n.length>=i:!0)}})})($vxp),function(n){function i(i){var u={},f,e,r;if(n.isString(i,1)){f=arguments.length>1?n.makeArray(arguments).slice(1).join(\"|\"):\"\\\\w+\",e=new RegExp(\"\\\\b(\"+f+\")=([^&#]+)\",\"ig\");while(r=e.exec(i))u[r[1][t]()]=r[2]}return u}function r(t,r){var e=n.param(n.extend(i(t),u(r))),f=/\\b[^?]*/g.exec(t).join(\"\");return f=e?f+\"?\"+e:f}function u(n){var r={},i;for(i in n)r[i[t]()]=n[i];return r}var t=\"toLowerCase\";n.extend({queryString:{setParam:r,getParam:i}})}($vxp),function(){String.prototype.format=function(){for(var t=this,n=0;n0},nt=function(){return u()>=10},f,g=function(){var r,e;if(undefined==f){f=!1;var t=null,i=window.navigator.plugins,n=\"Shockwave Flash\",u=window.ActiveXObject;if(i&&i.length)t=i[n]||i[n+\" 2.0\"],t&&t.description&&(f=!0);else if(u)for(n=n.replace(\" \",\"\")+\".\",r=15;r>2;--r)try{t=new u(n+n+r),e=parseActiveXVersion(getActiveXVersion(t)),f=!0;break}catch(o){}}return f},it=function(n){for(var t in n)n[t]=encodeURIComponent(c(n[t]));return n},c=function(n,t){var i=\"\",e,u,o,f,r;if(n instanceof Array){for(e=t,t.charAt(t.length-1)==\"s\"&&(i+=\"<\"+t+\">\",e=t.substr(0,t.length-1)),u=0;u\")}else if(n instanceof Object){t&&t!=\"$\"&&t!=\"value\"&&(i+=\"<\"+t),o=\"\",f={};for(r in n)r.indexOf(\"$\")!=0||r==\"$\"||r==\"value\"?o+=c(n[r],r):f[r.substr(1,r.length-1)]=n[r];if(t&&t!=\"$\"&&t!=\"value\"){for(r in f)i+=\" \"+r+'=\"'+tt(f[r])+'\"';i+=\">\"}i+=o,t&&t!=\"$\"&&t!=\"value\"&&(i+=\"\")}else n!=null&&(t&&t!=\"$\"&&t!=\"value\"&&(i+=\"<\"+t+\">\"),i+=k(n.toString()),t&&t!=\"$\"&&t!=\"value\"&&(i+=\"\"));return i},k=function(n){return n.replace(/&/g,\"&\").replace(//g,\">\").replace(/\\\"/g,\""\").replace(/'/g,\"'\")},tt=function(n){return n.replace(/\\\"/g,\""\")},l=function(t,i){n.initHub(t,i)},a=function(){for(var n=0;n\",{id:\"vxp_css_load_indicator\",name:\"vxp_css_load_indicator\",content:\"vxp_css_load_indicator\"}).appendTo(\"head\"),t=n(\"#vxp_css_load_indicator\")),i=t.css(\"font-size\"),i==\"8px\"},b=function(){window.MsnVideoUxStylesRequested||!window.MsnVideoUx.versionedFiles||v()||(window.MsnVideoUxStylesRequested=!0,p(window.MsnVideoUx.versionedFiles.css))},w=function(n){window.MsnVideoUxPaletteStylesRequested||(window.MsnVideoUxPaletteStylesRequested=!0,p(n))},d=function(n){var t=setInterval(function(){v()&&(clearInterval(t),n())},100)};b(),t.render=function(t,i,r,u,f,e){function k(){var k=document.getElementById(i),u=n.queryString.getParam(document.location.href.toString()),b,c;delete u.id,delete u.csid,delete u.type,delete u.width,delete u.preview,u.vxpenv&&(o=u.vxpenv),u.usehtml5&&(n.vxpGlobal.UseHtml5=!0),u.mmvLite&&(n.vxpGlobal.MmvLite=!0),l&&(u.overrideId=l),y(\".ux.hub{display:none;}\"),b=n.extend(u,it(r)),o.indexOf(\"http\")!=0&&(o=\"http://\"+o),s=\"{0}/hub/{1}/?rt=script&siteId={2}&divId={3}&loadCss={4}&csid={5}&pageUrl={6}&type={7}\".format(o,t,encodeURIComponent(a),encodeURIComponent(i),v,h,encodeURIComponent(p),w);for(c in b)c.toLowerCase()!=\"siteid\"&&(s+=\"&\"+c+\"=\"+b[c]);n.ajax({url:s,type:\"GET\",dataType:\"jsonp\",success:function(t){f?f(t.html):n(\"#\"+i).html(t.html)},error:function(){e&&e()}})}var c;i||(i=t),r||(r={}),u||(u={});var b=document.location.href.indexOf(\"https\")==0,o=u.hubDomain?u.hubDomain:b?\"https://hubs-video.msn.com\":\"http://hub.video.msn.com\",h=u.csid?u.csid:\"\",l=u.overrideId,a=u.siteId?u.siteId:u.siteUrl?u.siteUrl:document.location.href.toString().split(\"?\")[0],p=u.pageUrl?u.pageUrl:document.location.href.toString(),v=n.isDefined(u.loadCss)?u.loadCss:!0,w=u.type?u.type:\"\",s;h&&(a=\"\"),n.isHub||(v=!1),n.vxpGlobal.csid=h,c=n(\"#\"+i).find(\"div.ux.hub\"),c.widgetDispose&&c.widgetDispose(),k()},t.remove=function(t){var i=n(\"#\"+t).find(\"div.ux.hub\");i.widgetDispose&&i.widgetDispose(),n(\"#\"+t).html(\"\")},t.launchOverlayPlayer=function(i,r,f,e,c,l,a){var ft,k,p,tt,b,v,it,rt,ut,w;f||(f={}),e||(e={});for(ft in f)l=!0;if(n.vxpGlobal.overlayPlayerState&&f.DynamicInitialVideoId){k=n(\"div.vxp_heroPlayerVideoModule\");if(k.length==1){n.fireEvent(\"playVideo\",{id:f.DynamicInitialVideoId},k.eq(0).attr(\"id\"));return}}(s()||nt()&&!g())&&(f.UseHtml5=!0),f.UseHtml5&&(n.vxpGlobal.UseHtml5=!0),f.MmvLite&&(n.vxpGlobal.MmvLite=!0),c||(n(\"#vxpOverlay\").length==0&&(p=n(\"
\"),n(\"body\").append(p),tt=s()?\"position: absolute; width: \"+n(\"body\").width()+\"px; height: \"+n(\"body\").height()+\"px; \":\"position: fixed; width: 100%; height: 100%; \",b=n(\"
\"),b.css(\"opacity\",0),p.append(b),v=(e.hubDomain?e.hubDomain:\"img1.video.s-msn.com\")+\"/i/heroPlayer/loader.gif\",v.indexOf(\"http\")==-1&&(it=document.location.href.indexOf(\"https\")==0,v=(it?\"https://\":\"http://\")+v),rt=n(document).scrollTop(),ut=Math.floor((n(document).width()-40)/2),v=n(\"
\"),p.append(v),w=n(\"
\"),w.css(\"top\",n(document).scrollTop()),!n.vxpGlobal.UseHtml5||h()&&u()<9||w.css(\"opacity\",0),p.append(w),b.click(t.closeOverlayPlayer),n.vxpGlobal.UseHtml5&&w.bind(s()?\"touchstart\":\"click\",function(i){var r=n(\".vxp_heroPlayerContainer\"),u=r.offset().top;i.pageY0&&(t.mmvSendMessage&&t.mmvSendMessage(\"close\"),t.widgetDispose&&t.widgetDispose()),i=n(\"#vxpOverlayBackground\"),n.vxpGlobal.UseHtml5?i.css(\"opacity\",0):(n(\"#vxpOverlayContent .vxp_heroPlayerContainer\").html(\"\"),i.animate({opacity:0},500)),setTimeout(function(){n(\"body\").removeClass(\"vxp_mmv_active\").removeClass(\"vxp_mmv_hide_embeds\"),n(\"#vxpOverlay\").css(\"display\",\"none\"),n(\"#vxpOverlayContent\")[0]&&(n(\"#vxpOverlayContent\")[0].innerHTML=\"\")},1e3)},0),window.MsnVideo2&&MsnVideo2.sendMessage({type:\"overlayClosed\"})},t.preloadOverlayPlayer=function(n,i,r,u){t.launchOverlayPlayer(n,i,r,u,!0)},t.createExternalWidget=function(n){e.push(n),window.Msn&&window.Msn.Video&&window.Msn.Video.createWidget2&&setTimeout(function(){a()},0)},t.initialize=function(t,i){function s(){n.initHub?(l(i.videoServiceUrl,u),h()):window.MsnVideoUxPostScriptRequested?r.push({videoServiceUrl:i.videoServiceUrl,hubDivId:u}):(window.MsnVideoUxPostScriptRequested=!0,n.ajax({type:\"GET\",url:i.postScriptUrl,dataType:\"script\",cache:!0,success:function(){setTimeout(function(){l(i.videoServiceUrl,u),h()},0)}}))}function h(){for(var t,n=0;n0,e=f.find(\".externalWidget\").length>0,o=f.attr(\"data-editable\")==\"true\";(e||o)&&(window.Msn&&window.Msn.Video&&window.Msn.Video.createWidget2?a():window.MsnVideoUxWidgetEmbedScriptRequested||(window.MsnVideoUxWidgetEmbedScriptRequested=!0,n.ajax({type:\"GET\",url:i.widgetEmbedScriptUrl,dataType:\"script\",cache:!0,success:function(){setTimeout(function(){a()},0)}}))),e&&c&&!o?n(\"div.uxVideo\").css(\"display\",\"block\"):(w(i.paletteCssUrl),window.jQueryWait?s():window.MsnVideoUxPreScriptRequested?r.push({videoServiceUrl:i.videoServiceUrl,hubDivId:u}):(window.MsnVideoUxPreScriptRequested=!0,n.ajax({type:\"GET\",url:i.preScriptUrl,dataType:\"script\",cache:!0,success:function(){var n=setInterval(function(){undefined!=window.jQueryWait&&(clearInterval(n),s())},50)}})))};if(t.bootstrap){for(i=0;i\",r=[u];for(f in i.param)i.param[f]!=null&&r.push('');r.push(\"\"),e=r.join(\"\")}return this.each(function(){e&&(n(this)[0].innerHTML=e)})},n.fn.createFlash.defaults={version:5,attr:{type:\"application/x-shockwave-flash\",width:363,height:170},param:{wmode:\"transparent\",quality:\"high\"}}});document&&document.body&&(document.body.className+=isPluginsUnsupported||isBrowserSafari?\" noPlugin\":\" plugin\"),jQueryWait(function(n){var s={},h={},o={},t={},u={},f=[],e=[],r,c,l={},a=n.isHub,v=0,y={},i;n.encodeXmlAttribute=function(n){return n?n.replace(/\\&/g,\"&\").replace(/\\/g,\">\").replace(/'/g,\"'\"):\"\"},n.decodeXmlAttribute=function(n){return n?n.replace(/\\&/g,\"&\").replace(/\\</g,\"<\").replace(/\\>/g,\">\").replace(/\\'/g,\"'\"):\"\"},n.registerWidget=function(n,t,i){for(var u=n.split(\",\"),r=0;r0?t.substring(0,i):t,c=n.setUrlParam(t,\"rt\",\"ajax\"),_scriptUrl=n.setUrlParam(t,\"rt\",\"script\"),r=n(document).getWidgets(),u=!0,n.initContent(u))},n.initHub=function(t,i){var f=n(\"#\"+i),e=f.getConfig(\"HubId\"),u,r;for(l[i]=n.qsps(t),u=f.getWidgets(),r=0;r0?(n(r[0]).widgetInit(),r=r.slice(1,r.length),setTimeout(n.initContent,10)):n.initComplete()},n.initComplete=function(){var t,o,a,r,b,i,c;n.vxpClearFind(\".uXPage, .ux.hub\"),t=n.getPageWidget(),t.getConfig(\"BuildType\")==\"debug\"&&(n(document.body).append('
    '),n(\".environmentData\").show()),o=t.getConfig(\"BingVerticalName\"),a=t.getConfig(\"CookieDomain\"),n.cookieSetup(a,o);var f,h=n.cookie(\"vidodb\"),p=n.cookie(\"vidosp\"),l=t.getConfig(\"OmnitureSampling\");(null==p||p!=l)&&(h=null);if(document.location.href.toString().indexOf(\"omniture=true\")!=-1)f=!1;else if(document.location.href.toString().indexOf(\"omniture=false\")!=-1)f=!0;else if(null!=h)f=h==\"1\";else{var g=n.cookie(\"sample\"),v=parseInt(g),it=isNaN(v)?Math.random()*100:v;f=it>parseInt(l)}n.cookie(\"vidodb\",f?\"1\":\"0\",182),n.cookie(\"vidosp\",l,182),r=document.location.pathname,o==\"videos\"&&(r=r.substr(o.length+1));var u=r,s=!0,k=null;\"/\"==u?u=\"home\":0==u.indexOf(\"/watch/\")?(i=u.substr(7),i=i.substr(0,i.indexOf(\"/\")),u=\"/watch/\"+i+\"/\",s=!1):n.vxpFind(\".vxp_player\").length>0&&(s=!1),n(\".errorTemplate\").length>0&&(s=!0,k=\"error\");var y=r.split(\"/\"),e=y.length>1?y[1]:\"\",w=t.getConfig(\"Product\")||\"MSN Video\";(r==\"/\"||r==\"\")&&(e=\"home\"),b=t.getConfig(\"Department\")||e,i=t.getConfig(\"OmnitureChannelName\")+\"-\"+t.getConfig(\"DI\"),n.reportSetup({path:r,od:f,suite:t.getConfig(\"OmnitureReportSuite\"),ps:t.getConfig(\"PS\"),pi:t.getConfig(\"PI\"),di:t.getConfig(\"DI\"),mkt:t.getConfig(\"Market\"),pn:u,cn:i,dpt:t.getConfig(\"Department\"),st:t.getConfig(\"SearchQuery\"),sc:n(\".searchCount\").text(),pv:s,pt:k,vid:t.getConfig(\"videoId\"),pr:w,prop5:e,prop10:document.title,prop47:t.getConfig(\"AdPageGroup\"),prop7:\"browse\"});var nt=t.getConfig(\"Market\").toLowerCase(),tt=t.getConfig(\"DI\"),d=\"http://c.msn.com/c.gif?\",l=document.location.href.toString().indexOf(\"omniture=true\")!=-1?99:9;n.track({trackInfoOpts:{sitePage:{product:w,server:document.domain,lang:nt,siteDI:tt,sitePI:\"0\",sitePS:\"0\",pagename:u,dept:b,sdept:\"\",pgGrpId:t.getConfig(\"AdPageGroup\"),cntType:e,title:document.title,ch:i,srchQ:\"\"},userStatic:{signedIn:\"false\",age:\"\",gender:\"\"}},spinTimeout:150}).register(new n.track.genericTracking({base:\"http://udc.msn.com/c.gif?\",linkTrack:1,samplingRate:99,commonMap:{event:{evt:\"type\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"},client:{clid:\"clientId\"}},impr:{param:{evt:\"impr\"},paramMap:{client:{rf:\"referrer\",bh:\"height\",bw:\"width\",sl:\"silverlightEnabled\",slv:\"silverlightVersion\",scr:\"screenResolution\",sd:\"colorDepth\"},userDynamic:{hp:\"isHomePage\"},userStatic:{pp:\"signedIn\",bd:\"age\",gnd:\"gender\"},sitePage:{pr:\"product\",cu:\"server\",mk:\"lang\",di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\",pn:\"pagename\",pid:\"pageId\",\"st.dpt\":\"dept\",\"dv.pgGrpId\":\"pgGrpId\",\"dv.Title1\":\"title\",\"dv.contnTp\":\"cntType\",mv:\"pgVer\",q:\"srchQ\"}}},click:{paramMap:{report:{hl:\"headline\",ce:\"contentElement\",cm:\"contentModule\",du:\"destinationUrl\"}}},unload:{}}),new n.track.genericTracking({base:\"http://b.scorecardresearch.com/b?\",linkTrack:0,impr:{param:{c1:\"2\",c2:\"3000001\"},paramMap:{client:{c7:\"pageUrl\",c9:\"referrer\"},userDynamic:{rn:\"timeStamp\"}}}}),new n.track.genericTracking({base:d,linkTrack:0,impr:{param:{udc:\"true\"},paramMap:{client:{rf:\"referrer\",tp:\"pageUrl\"},sitePage:{di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"}}}})),n.track.trackPage(),c=function(){n.cookie(\"vidref\",document.location.href.toString())},window.addEventListener?window.addEventListener(\"unload\",c,!1):window.attachEvent(\"onunload\",c),u.indexOf(\"/watch/\")==-1&&n.cookie(\"q\",null),n.browser.msie&&parseInt(n.browser.version,10)<7&&n(\".uXPage\").height()<700&&n(\".uXPage\").height(700),n.pageIsReady=!0,n.fireEvent(\"pageReady\")},n.log=function(t){n(\".uxDebug ol\").append(\"
  1. \"+t+\"
  2. \")},n.format=function(n){var i,t,r,u=0;while(!i){i=!0,t=\"{\"+u+\"}\",r=n.indexOf(t);while(r!=-1)i=!1,n=n.replace(t,arguments[u+1]),r=n.indexOf(t);u++}return n},n.qsps=function(n,t){var o={},i,r,e,u,f;if(n){i=n.split(\"#\"),qIndex=i[0].indexOf(\"?\");if(i.length!=-1)for(i=i[0].substr(qIndex+1).split(\"&\"),r=0;r=\"0\"&&n<=\"9\"||n>=\"A\"&&n<=\"Z\"||n>=\"a\"&&n<=\"z\"},n.parseUTCDate=function(n){var t=parseInt(n.substring(0,4),10),i=parseInt(n.substring(5,7),10)-1,r=parseInt(n.substring(8,10),10),u=parseInt(n.substring(11,13),10),f=parseInt(n.substring(14,16),10),e=parseInt(n.substring(17,19),10);return new Date(Date.UTC(t,i,r,u,f,e))},n.urlTagEncode=function(n){for(var i,r,o,u=\"\",f=\"+?*&%:/\\\\<>.#$@\",e=160,t=0;t\",o=i.substr(0,i.length-1)),f=0;f\")}else if(t instanceof Object){i&&i!=\"$\"&&i!=\"value\"&&(r+=\"<\"+i),s=\"\",e={};for(u in t)u.indexOf(\"$\")!=0||u==\"$\"||u==\"value\"?s+=n.toXmlString(t[u],u):e[u.substr(1,u.length-1)]=t[u];if(i&&i!=\"$\"&&i!=\"value\"){for(u in e)r+=\" \"+u+'=\"'+n.encodeAttr(e[u])+'\"';r+=\">\"}r+=s,i&&i!=\"$\"&&i!=\"value\"&&(r+=\"\")}else t!=null&&(i&&i!=\"$\"&&i!=\"value\"&&(r+=\"<\"+i+\">\"),r+=n.encodeXml(t.toString()),i&&i!=\"$\"&&i!=\"value\"&&(r+=\"\"));return r},n.encodeXml=function(n){return n.replace(/&/g,\"&\").replace(//g,\">\").replace(/\\\"/g,\""\").replace(/'/g,\"'\")},n.encodeAttr=function(n){return n.replace(/\\\"/g,\""\")},n.asArray=function(n){return n instanceof Array?n:[n]},n.getPageWidget=function(){return n.vxpFind(\".uXPage, .ux.hub\")},n.extend(n.easing,{easeInCubic:function(n,t,i,r,u){return r*(t/=u)*t*t+i},easeOutCubic:function(n,t,i,r,u){return r*((t=t/u-1)*t*t+1)+i},easeInOutCubic:function(n,t,i,r,u){return(t/=u/2)<1?r/2*t*t*t+i:r/2*((t-=2)*t*t+2)+i}}),i={},n.vxpFind=function(t,r){var u=null,f;return r?r.attr(\"id\")&&(u=r.attr(\"id\")):u=\"global\",u&&i[u]&&i[u][t]?i[u][t]:(f=r?r.find(t):n(t),u&&(i[u]||(i[u]={}),i[u][t]=f),f)},n.vxpClearFind=function(n,t){var r=null;t?t.attr(\"id\")&&(r=t.attr(\"id\")):r=\"global\",r==\"global\"&&i[r]?delete i[r][n]:r&&i[r]&&delete i[r]},n.fn.first||(n.fn.first=function(){return this.eq(0)}),n.fn.vxpFind=function(t){return n.vxpFind(t,n(this))},n.fn.vxpFindId=function(t){var i=n(this).attr(\"id\");return n(\"#\"+i+\"_\"+t)},n.fn.vxpClearFind=function(t){n.vxpClearFind(t,n(this))},n.fn.getWidgets=function(){return n(this).find(\".ux\").add(n(this).filter(\".ux\"))},n.fn.widgetInit=function(){return this.each(function(){var r,i,u;n(this).attr(\"data-lazy\")?n(this).widgetRefresh():(r=n(this).attr(\"id\"),delete t[r],i=n(this).attr(\"data-type\"),u=n(this).attr(\"data-init\"),u||(s[i]&&s[i](this),n(this).attr(\"data-init\",1),n(this).fireEvent(\"isReady\"),n(this).trigger(\"isReady\"),n(this).data(\"isReady\",!0)),n.browser.msie&&parseInt(n.browser.version,10)<7&&parseInt(n.browser.version,10)>4&&n(this).find(\".ie6png\").each(function(){var i=n(this),t=i.css(\"background-image\"),r,u;t.length>7&&(r=t.substring(5,t.length-2),u={filter:\"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='\"+r+\"', sizingMethod='scale')\",\"background-image\":\"none\"},i.css(u))}))})},n.fn.loadConfigs=function(){var node=this,data=n(this).attr(\"data-clientConfig\"),id,k;data&&(data=n.decodeXmlAttribute(data)),eval(\"data=\"+data),id=n(this).attr(\"id\"),t[id]=t[id]||{};for(k in data)t[id][k.toLowerCase()]=data[k];t[id].clientConfigReady=!0},n.fn.setConfig=function(i,r,f,e){var o=n(this).attr(\"id\"),s=t[o];e||s&&s.clientConfigReady||n(this).loadConfigs(),null!=i&&\"\"!=i&&(i=i.toLowerCase(),t[o]=t[o]||{},u[o]=u[o]||{},null==r?(delete t[o][i],delete u[o][i]):(t[o][i]=r,(f||undefined==f)&&(u[o][i]=r)))},n.fn.getConfig=function(i){var u=n(this).attr(\"id\"),r=t[u];return r&&r.clientConfigReady||(n(this).loadConfigs(),r=t[u]),i=i.toLowerCase(),r&&r[i]!=undefined?r[i]:null},n.fn.getConfigs=function(i){var f=n(this).attr(\"id\"),r=t[f];return r&&r.clientConfigReady||(n(this).loadConfigs(),r=t[f]),(i?u[f]:r)||{}},n.fn.getSerializedConfigs=function(i,r){var b=n(this).attr(\"id\"),e=t[b],l,w,s,v,k,y,f,a,o,c,nt,d,p;e&&e.clientConfigReady||(n(this).loadConfigs(),e=t[b]),l=u[b]||{},!l.videoid&&e.videoid&&document.location.href.toString().indexOf(\"edit=true\")==-1&&(l.videoid=e.videoid),w=(i?l:e)||{},s={};if(r){var h=[n(this)],g={},tt=n(this).find(\".ux\");for(f=tt.length-1;f>=0;f--)h.push(tt.eq(f));for(v=n(this).parents(\".ux\"),f=v.length-1;f>=0;f--){k=v.eq(f).getSerializedConfigs(i,!1);for(y in k)s[y]=n.toXmlString(k[y]);h.push(v.eq(f))}for(f=0;f0)return n(this).widgetRefreshScript(t,null);var l=n(this).attr(\"id\"),a=this,u=n(this).parent(),s=null,y=r||c,k=n.getPageWidget().getConfig(\"FDLoggingEnabled\")&&typeof _G==\"object\",d=n.qsps(document.location.href.toString()),o=n.qsps(y);if(k){u=this;while(!p&&u)p=n(u).attr(\"data-insertId\"),u=n(u).length&&n(u)[0].tagName!=\"BODY\"?n(u).parent():null;p&&(o.IG=_G.IG,o.IID=p,o.SFX=v++)}else o.IID=\"1\";if(l){n(this).cancelPendingRequests(),n(this).cancelPendingScripts(),n(this).setConfig(\"id\",l),w=n(this).getSerializedConfigs(!0,!0),h=d;for(e in o)try{h[e]=decodeURIComponent(o[e])}catch(g){h[e]=o[e]}for(e in w)try{h[e]=decodeURIComponent(w[e])}catch(g){h[e]=w[e]}b=y.split(\"?\"),y=encodeURI(decodeURI(b[0])),s=n.ajax({url:y,dataType:\"html\",data:h,success:function(r){f=n.grep(f,function(n){return n.xhr!=s}),n(a).widgetDispose().replaceWith(r),n(u).getWidgets().widgetInit(),n.isFunction(t)?t():\"\",a=u=s=t=i=null,n.fireEvent(\"widgetRefreshComplete\",l)},error:function(){f=n.grep(f,function(n){return n.xhr!=s}),n.isFunction(i)?i():n.log(\"Ajax Error\"),a=u=s=t=i=null}}),a&&f.push({id:l,xhr:s})}},n.fn.widgetRefreshScript=function(t){var o=n(this).attr(\"id\"),y=this,w=n(this).parent(),u,a,i,p,v,h;if(o){var s=n(this).hasClass(\"hub\")?n(this):n(this).parents(\".ux.hub\").eq(0),b=s.getConfig(\"HubId\"),k=s.getConfig(\"HubDomain\"),d=s.attr(\"id\"),f=l[d]||{};f.hubId=b,f.rt=\"script\",n(this).setConfig(\"id\",o),n(this).cancelPendingRequests(),n(this).cancelPendingScripts(),u=k+\"/hub/id\";var g=n.qsps(document.location.href.toString()),c=n(this).getSerializedConfigs(!0,!0),r=g;for(i in f){a=i.toLowerCase();try{r[a]=decodeURIComponent(f[i])}catch(nt){r[a]=f[i]}}for(i in c)try{r[i]=decodeURIComponent(c[i])}catch(nt){r[i]=c[i]}delete r.callback,delete r._,p=u.split(\"?\"),u=p[0];for(v in r)u=n.setUrlParam(u,v,encodeURIComponent(r[v]));h=n.ajax({url:u,type:\"GET\",dataType:\"jsonp\",success:function(i){i&&(e=n.grep(e,function(n){return n.xhr!=h}),n(y).widgetDispose().replaceWith(i.html),n(w).getWidgets().widgetInit(),n.isFunction(t)?t():\"\",y=w=t=null,n.fireEvent(\"widgetRefreshComplete\",o))}}),e.push({id:o,xhr:h})}},n.fn.widgetDispose=function(){var t=n(this).getWidgets(),i=n(this).attr(\"id\");return t.each(function(){var t=n(this).attr(\"id\");i!=t&&delete u[t],n(this).dispose(),n(this).unbind(),n(this).unsubscribeEvents(),n(this).vxpClearFind()}),n(this)},n.fn.isViewable=function(){var t={x:n(window).scrollLeft(),y:n(window).scrollTop(),w:n(window).width(),h:n(window).height()},i={x:n(this).offset().left,y:n(this).offset().top};return i.xt.x&&i.yt.y},n.fn.scrollTo=function(){var t=n(this).offset().top;n(\"html, body\").animate({scrollTop:t},\"slow\")},n.fn.setSizedText=function(t,i,r,u){var f,e,s,o;r||(r=\"\"),f=r.substr(0,u),e=n(t).data(\"_height\"),undefined==e&&(e=parseInt(t.css(\"ellipsis-height\")),e||(e=parseInt(t.css(\"max-height\"))),n(t).data(\"_height\",e));if(e){i.text(f),t.css(\"height\",\"auto\"),t.css(\"max-height\",\"none\"),s=t.css(\"white-space\"),t.css(\"white-space\",\"normal\");if(t.height()>e)while(f.length>0){o=f.lastIndexOf(\" \"),f=o!=-1?f.substr(0,o):f.substr(0,f.length-1),(f.charAt(f.length-1)==\".\"||f.charAt(f.length-1)==\",\")&&(f=f.substr(0,f.length-1)),i.text(f+\"... \");if(t.height()<=e)break}t.css(\"white-space\",s)}},n.fn.swipe=function(n,t){function u(n){n.touches&&n.touches.length?i=n.touches[0].pageX:(alert(n.touches),alert(n.clientX),alert(n.screenX))}function f(n){n.touches&&n.touches.length&&(r=n.touches[0].pageX),n.preventDefault()}function e(){var f=i-r;alert(\"coord=\"+i+\",\"+r),f>25&&n(),f<-25&&t()}var i=0,r=0;this.addEventListener&&(this.addEventListener(\"touchstart\",u,!1),this.addEventListener(\"touchmove\",f,!1),this.addEventListener(\"touchend\",e,!1))},n.fn.updateScrolling=function(){n(this).find(\".vxp_scrollable\").each(function(){n.updateScrolling(n(this))})},n.fn.setLoadingMode=function(t){n(this).toggleClass(\"loading\",t)},n.fn.refresh=function(t){var u=n(this).attr(\"data-type\"),r=h[u],i;undefined!=r&&(t=r(n(this),t));for(i in t)n(this).setConfig(i,t[i]);n(this).widgetRefresh()}}),jQueryWait(function(n){n(document).ready(n.initBegin)});(function(n){var t;n.vxpGlobal.geo={},n.vxpGlobal.geo.isReady=function(){return t?!0:!1},n.vxpGlobal.geo.data=function(){return{country:t[0],countryFlags:t[1],market:t[2],marketEnabled:t[3]==\"True\"}},n.subscribeEvent(\"pageReady\",function(){var u=n.cookie(\"vidgeo\"),r,i;u&&(t=u.split(\"|\"),t.length!=4?t=null:n.fireEvent(\"geoDataReady\")),t||(r=n.getPageWidget().getConfig(\"UserServiceUrl\"),i=n.qsps(window.location.href.toString()),i.responseEncoding=\"json\",i.uxmkt=n.getPageWidget().getConfig(\"Market\"),delete i.mkt,delete i.search,delete i.vid,delete i.searchterm,n.getJSON(r+\"user/info?callback=?\",i,function(i){if(i&&i.user){var r=i.user.country,u=i.user.market;t=[r.name.$,r.flags.$,u.name.$,u.enabled.$],n.cookie(\"vidgeo\",t.join(\"|\"),1),n.fireEvent(\"geoDataReady\")}}))})})($vxp);(function(n){n.vxpGlobal.playlist={};var t=[],u=20,i=function(){var i=t.join(\",\");n.cookie(\"vxp_playlist_ids\",i)},f=function(){var i=n.cookie(\"vxp_playlist_ids\");i&&(t=i.split(\",\"))},r=function(n){for(var r=-1,i=0;i0},n.vxpGlobal.playlist.count=function(){return t.length},f()})($vxp);jQueryWait(function(n){n.vxpGlobal.smartPool={};var t,i,r=function(n,t){var r=n,u=!0,i,f;for(i in t)r+=(u?\"?\":\"&\")+i+\"=\"+t[i],u=!1;f=new Image,f.src=r},u=function(n){var i={},t;for(t in n)i[t]=n[t];return i};n.vxpGlobal.smartPool.ping=function(f,e,o){var l=f.split(\"?\")[0],s=n.qsps(f),a=document.location.href.toString().substr(0,300),v=document.referrer.substr(0,300),h,c;s.pl=encodeURIComponent(a),s.rl=encodeURIComponent(v),h=n.qsps(\"?\"+decodeURIComponent(s.tk)),h.vid&&(s.vid=h.vid),c=u(s),o.click&&(e==\"cp\"?s.c1=o.click:s.c=e==\"pg\"?o.click:s.c1=o.click),o.views&&o.views.length>0&&(s.v=o.views.join(\",\")),(s.c||s.c1||s.v)&&r(l,s),t&&i&&!o.views&&(r(t,i),t=i=null),e!=\"pg\"&&o.click&&(c.p1=o.click,t=l,i=c)},n.vxpGlobal.smartPool.getTargetingKey=function(t,i){var r=t+\"&callbackName=?\",u=document.location.href.toString().substr(0,300),f=document.referrer.substr(0,300);n.getJSON(r,{pl:u,rl:f,responseEncoding:\"json\"},function(n){i(n.tk)})}});jQueryWait(function(n){function f(){if(typeof n==\"undefined\")var n={};n.beacon=function(n){var r;if(!n)return;var o=1.7,u=document,f=u.location,e=512,t=function(n,t){return n==null?\"\":(n=(encodeURIComponent||escape)(n),t&&(n=n.substr(0,t)),n)},i=[f.protocol==\"https:\"?\"https://sb\":\"http://b\",\".scorecardresearch.com/b?\",\"c1=\",t(n.c1),\"&c2=\",t(n.c2),\"&rn=\",Math.random(),\"&c7=\",t(f.href,e),\"&c4=\",t(n.c4,e),\"&c8=\",t(u.title),\"&c9=\",t(n.c9)].join(\"\");return i=i.length>2080?i.substr(0,2075)+\"&ct=1\":i,r=new Image,r.onload=function(){},r.src=i,i},n.beacon({c1:2,c2:3000001,c4:document.location.href,c9:document.referrerRefreshTrcking})}var t,i=!1,r=null,u=!1;n.reportSetImpl=function(n){t=n},n.reportClick=function(n){t&&t.reportClick(n)},n.reportPageView=function(n){t&&t.reportPageView(n)},n.initTrack=function(t){var p=t||r,s,e;r=p;var i=n.getPageWidget(),h=i.getConfig(\"Market\").toLowerCase(),o=i.getConfig(\"DI\"),c=\"http://c.msn.com/c.gif?\",l=i.getConfig(\"BingVerticalName\"),f=document.location.pathname;l==\"videos\"&&(f=f.substr(l.length+1)),t=t||f,s=f.split(\"/\"),e=s.length>1?s[1]:\"\",(f==\"/\"||f==\"\")&&(e=\"home\");var a=i.getConfig(\"Department\")||e,v=i.getConfig(\"ChannelName\")+\"-\"+o,y=i.getConfig(\"Product\")||\"MSN Video\";u?n.track({trackInfoOpts:{sitePage:{product:y,server:document.domain,lang:h,siteDI:o,sitePI:\"0\",sitePS:\"0\",pagename:t,dept:a,sdept:\"\",pgGrpId:i.getConfig(\"AdPageGroup\"),cntType:e,title:document.title,ch:v,srchQ:\"\"},userStatic:{signedIn:\"false\",age:\"\",gender:\"\"}},spinTimeout:150}).register(new n.track.genericTracking({base:\"http://udc.msn.com/c.gif?\",linkTrack:1,samplingRate:99,commonMap:{event:{evt:\"type\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"},client:{clid:\"clientId\"}},impr:{param:{evt:\"impr\"},paramMap:{client:{rf:\"referrer_slideshow\",bh:\"height\",bw:\"width\",sl:\"silverlightEnabled\",slv:\"silverlightVersion\",scr:\"screenResolution\",sd:\"colorDepth\"},userDynamic:{hp:\"isHomePage\"},userStatic:{pp:\"signedIn\",bd:\"age\",gnd:\"gender\"},sitePage:{pr:\"product\",cu:\"server\",mk:\"lang\",di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\",pn:\"pagename\",pid:\"pageId\",\"st.dpt\":\"dept\",\"dv.pgGrpId\":\"pgGrpId\",\"dv.Title1\":\"title\",\"dv.contnTp\":\"cntType\",mv:\"pgVer\",q:\"srchQ\"}}},click:{paramMap:{report:{hl:\"headline\",ce:\"contentElement\",cm:\"contentModule\",du:\"destinationUrl\"}}},unload:{}}),new n.track.genericTracking({base:c,linkTrack:0,impr:{param:{udc:\"true\"},paramMap:{client:{rf:\"referrer_slideshow\",tp:\"pageUrl\"},sitePage:{di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"}}}})):n.track({trackInfoOpts:{sitePage:{product:y,server:document.domain,lang:h,siteDI:o,sitePI:\"0\",sitePS:\"0\",pagename:t,dept:a,sdept:\"\",pgGrpId:i.getConfig(\"AdPageGroup\"),cntType:e,title:document.title,ch:v,srchQ:\"\"},userStatic:{signedIn:\"false\",age:\"\",gender:\"\"}},spinTimeout:150}).register(new n.track.genericTracking({base:\"http://udc.msn.com/c.gif?\",linkTrack:1,samplingRate:99,commonMap:{event:{evt:\"type\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"},client:{clid:\"clientId\"}},impr:{param:{evt:\"impr\"},paramMap:{client:{rf:\"referrer\",bh:\"height\",bw:\"width\",sl:\"silverlightEnabled\",slv:\"silverlightVersion\",scr:\"screenResolution\",sd:\"colorDepth\"},userDynamic:{hp:\"isHomePage\"},userStatic:{pp:\"signedIn\",bd:\"age\",gnd:\"gender\"},sitePage:{pr:\"product\",cu:\"server\",mk:\"lang\",di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\",pn:\"pagename\",pid:\"pageId\",\"st.dpt\":\"dept\",\"dv.pgGrpId\":\"pgGrpId\",\"dv.Title1\":\"title\",\"dv.contnTp\":\"cntType\",mv:\"pgVer\",q:\"srchQ\"}}},click:{paramMap:{report:{hl:\"headline\",ce:\"contentElement\",cm:\"contentModule\",du:\"destinationUrl\"}}},unload:{}}),new n.track.genericTracking({base:\"http://b.scorecardresearch.com/b?\",linkTrack:0,impr:{param:{c1:\"2\",c2:\"3000001\"},paramMap:{client:{c7:\"pageUrl\",c9:\"referrer\"},userDynamic:{rn:\"timeStamp\"}}}}),new n.track.genericTracking({base:c,linkTrack:0,impr:{param:{udc:\"true\"},paramMap:{client:{rf:\"referrer\",tp:\"pageUrl\"},sitePage:{di:\"siteDI\",pi:\"sitePI\",ps:\"sitePS\"},userDynamic:{rid:\"requestId\",cts:\"timeStamp\"}}}}))},n.reportCircularModuleLoad=function(t){var f,u,e,r,i,o;$.track.recipients||n.initTrack(),f={evt:\"xnet\",xnet:\"vicross\"},$.extend(!0,f,t);if(typeof $.track!=\"undefined\"&&typeof $.track.recipients!=\"undefined\"){for(u=0;u<$.track.recipients.length;u++)if($.track.recipients[u].opts.base==\"http://udc.msn.com/c.gif?\"){for(e=$.track.recipients[u],udcCall=e.getPageViewTrackingUrl($.track.trackInfo),r=udcCall.split(\"?\")[1].split(\"&\"),udcCall=\"http://udc.msn.com/c.gif?\",i=0;iparseInt(v)}return n.cookie(\"vidodb\",f?\"1\":\"0\",182),n.cookie(\"vidosp\",v,182),r=document.location.pathname,a==\"videos\"&&(r=r.substr(a.length+1)),u=r,s=null,\"/\"==u?u=\"home\":0==u.indexOf(\"/watch/\")&&(e=u.substr(7),e=e.substr(0,e.indexOf(\"/\")),u=\"/watch/\"+e+\"/\"),o=r.split(\"/\"),h=o.length>1?o[1]:\"\",(r==\"/\"||r==\"\")&&(h=\"home\"),n(\".errorTemplate\").length>0&&(s=\"error\"),c={path:r,od:f,suite:i.getConfig(\"OmnitureReportSuite\"),ps:i.getConfig(\"PS\"),pi:i.getConfig(\"PI\"),mkt:i.getConfig(\"Market\"),dpt:i.getConfig(\"Department\"),pn:u,cn:i.getConfig(\"OmnitureChannelName\")+\"-\"+i.getConfig(\"DI\"),st:i.getConfig(\"SearchQuery\"),sc:n(\".searchCount\").text(),pv:!0,pt:s,vid:i.getConfig(\"videoId\"),pr:i.getConfig(\"Product\"),prop7:\"browse\",prop5:h,prop10:document.title,prop47:i.getConfig(\"AdPageGroup\")},$.extend(!0,c,t),c},n.reportOmnitureOnPhotoChange=function(t){isOmniturePV=t.OmniturePV;var i=n.initializeOmniTrackings(t);n.reportSetup(i)},n.reportComScoreOnPhotoChange=function(){u=!0,n.reportExternalPageView(),f()},n.reportSetup=function(n){t&&t.setup(n)},n.reportEvent=function(n){t&&t.event(n)},n.reportNavigation=function(n){t&&t.navigation(n)},n.writeTrackingCookie=function(t,i,r){n.updateTracking(t,i,r,!0)},n.updateTracking=function(t,i,r,u){var e=n.getPageWidget().getConfig(\"ClickTrackingType\"),f;return t=t||\"Gal\",i=i||\"play\",r=r||\"\",f=[e,t,i,r].join(\":\"),n.vxpGlobal.vidps=f,u&&n.cookie(\"vidps\",f),f}}),jQueryWait(function(n){function v(n){return{action:n.name}}function y(n,t){var i=g(n);for(ndx=0;trackUrl=i[ndx++];)c(trackUrl);if(t)throw\"Not Implemented\";}function k(){var n=new Date;return n.getDate()+\"/\"+n.getMonth()+\"/\"+n.getFullYear()+\" \"+n.getHours()+\":\"+n.getMinutes()+\":\"+n.getSeconds()+\" \"+n.getDay()+\" \"+n.getTimezoneOffset()}function p(){var t=new Date,n=Math,i=n&&n.random?n.floor(n.random()*1e13):t.getTime();return\"s\"+n.floor(t.getTime()/108e5)%10+i}function h(n){var f=r,ft,w,pt,et,ot,ht,yt,bt,wt,vt,kt,at,nt,st,lt,ct,it,h,rt,o,a,e,v,l,g,b,ut,k,tt,y;$vxp.extend(f,n),ft=t.location.href,et=$vxp.cookie(\"gt1\")||\"\",ot=$vxp.cookie(\"ocid\")||\"\",ht=$vxp.cookie(\"anid\")||\"\",yt=f.mkt||\"\",bt=f.cn||\"\",wt=f.pt||\"\",path=f.path||\"\",lt=f.prop11||\"\",vt=f.vid||\"\",at=f.prop5||\"\",prop10=f.prop10||\"\",st=f.prop7||\"\",ct=f.prop28||\"\",prop47=f.prop47||\"\",$vxp.cookie(\"ocid\",null),it=path.split(\"/\"),w=it.length>1?it[1]:\"\",(path==\"/\"||path==\"\")&&(w=pt=\"home\"),w=f.dpt||w,nt=$vxp.cookie(\"from\")||\"\",h=t.referrer||\"\",h.toLowerCase().indexOf(\"http://\")==0&&(h=h.substr(7),rt=h.indexOf(\"/\"),h>0&&(h=refDomain.substr(0,rt)),nt+=\"^\"+h),o={c1:f.pr,c2:yt,c3:w,c5:at,c6:nt,c7:st,c10:prop10,c11:lt,c18:et,c23:ht,c28:ct,c29:ft,c32:vt,c47:prop47,v0:ot},undefined!=window.Silverlight&&(a=\"\",$vxp.hasSilverlight(4)?a=\"4.0\":$vxp.hasSilverlight(3)?a=\"3.0\":$vxp.hasSilverlight(2)?a=\"2.0\":$vxp.hasSilverlight(1)&&(a=\"1.0\"),o.c31=a),e=f.st,e&&e.length>0&&(o.c35=f.sc,v=e.toLowerCase().charAt(0),v<=\"d\"?o.c36=e:v<=\"k\"?o.c37=e:v<=\"p\"?o.c38=e:v<=\"u\"?o.c39=e:o.c40=e),l={},$vxp.extend(l,s),l.pageName=n.pn||r.pn,l.r=n.r?n.r:n.rf==\"\"?\"\":$vxp.cookie(\"rf\")||document.referrer,i&&(g=$vxp.format(i,p(),u(l),u(o)),c(g)),k=t.location.host,tt=k+path,e&&e.length>0?b=k+\"/search\":path.indexOf(\"/watch/\")==0?(y=path.substr(7),y=y.substr(0,y.indexOf(\"/\")),b=\"/watch/\"+y+\"/player\"):b=tt,typeof _G==\"object\"&&(ut=_G.IG),g=$vxp.format(d,f.di,f.pi,f.ps,encodeURIComponent(t.referrer),encodeURIComponent(b),encodeURIComponent(tt),ut)}function w(n){var l,a,v,t,e,f,h;if(!o)return;v=r.mkt||\"\",t=r.path.split(\"/\"),l=t.length>1?t[1]:\"\",a=t.length>2?t[2]:\"\",e={c13:n.prop13||\"\",c16:n.click,c17:s.pageName,pe:\"lnk_o\",pev2:n.click},n.pt&&(e.c10=n.pt),f={},$vxp.extend(f,s),f.pageName=\"\",f.r=n.rf==\"\"?\"\":$vxp.cookie(\"rf\")||document.referrer,i&&(h=$vxp.format(i,p(),u(f),u(e)),c(h))}function u(n){var r=[],i,t;for(i in n)t=n[i].toString().toLowerCase(),t.length>100&&(t=t.substring(0,100)),r.push(i+\"=\"+encodeURIComponent(t));return r.join(\"&\")}function g(){}function c(n){if($vxp(\".ux.hub\").length==0||b){var t=new Image;t.onload=t.onerror=function(){t.onload=t.onerror=null},t.src=n}}$vxp.reportImpl=n;var t=document,nt,d=\"http://c.msn.com/c.gif?DI={0}&PI={1}&PS={2}&RF={3}&TP={4}&pageurl={5}&IG={6}\",i,f=0,e=0,o=!1,a,l=[],b=!1,r={},s;n.setup=function(n){var c,u;for(o=!0,r=n,b=n.OmniturePV,n.od||(c=n.suite||\"msnportalvideodev\",i=\"http://msnportal.112.2o7.net/b/ss/\"+c+\"/1/H.7-pdv-2/{0}?[AQB]=1&{1}&{2}&[AQE]=1\"),typeof window.innerWidth==\"number\"?(f=window.innerWidth,e=window.innerHeight):document.documentElement&&document.documentElement.clientWidth?(f=document.documentElement.clientWidth,e=document.documentElement.clientHeight):document.documentElement.offsetWidth&&(f=document.documentElement.offsetWidth,e=document.documentElement.offsetHeight),s={ndh:1,t:k(),ns:\"msnportal\",pageName:n.pn,g:t.location.href,ch:n.cn,server:document.domain,ce:\"ISO-8859-1\",r:$vxp.cookie(\"rf\")||t.referrer,bw:f,bh:e,s:screen.width+\"x\"+screen.height},n.pv?h(n):a&&h(a),u=0;u=i:!0)&&(t(r)?n<=r:!0)}function i(n,i){return typeof n==\"string\"&&(t(i)?n.length>=i:!0)}var r=n.isArray;n.extend({isNumber:t,isString:i,isObject:function(n){return typeof n==\"object\"&&n!==null},isDefined:function(n){return typeof n!=\"undefined\"},isArray:function(n,i){return r(n)&&(t(i)?n.length>=i:!0)}})})($vxp),function(){String.prototype.getCookie=function(){var t=new RegExp(\"\\\\b\"+this+\"\\\\s*=\\\\s*([^;]*)\",\"i\"),n=t.exec(document.cookie);return n&&n.length>1?n[1]:\"\"}}(),function(){String.prototype.setCookie=function(n,t,i,r,u){var f=[this,\"=\",n],e;t&&(e=new Date,e.setTime(e.getTime()+t*864e5),f.push(\";expires=\"),f.push(e.toUTCString())),i&&(f.push(\";domain=\"),f.push(i)),r&&(f.push(\";path=\"),f.push(r)),u&&f.push(\";secure\"),document.cookie=f.join(\"\")},String.prototype.delCookie=function(){document.cookie=this+\"=; expires=Fri, 31 Dec 1999 23:59:59 GMT;\"}}(),function(n){n.fireAndForget=function(n){if(n){var t=new Image;t.onload=t.onerror=function(){t.onload=t.onerror=null},t.src=n.replace(/&/gi,\"&\")}}}($vxp),function(n){function i(i){var o=n.extend(!0,{},t,i),c=window,f,r,l,e,a,u,s,h;if(!n.isArray(o.silverlightVersions,1))return 0;r=0;try{l=c.navigator,e=l.plugins;if(e&&e.length)f=e[\"Silverlight Plug-In\"],f&&(r=/^\\d+\\.\\d+/.exec(f.description)[0]),f=0;else if(c.ActiveXObject){a=new ActiveXObject(\"AgControl.AgControl\");if(a){r=1,u=n(\"\")[0],u.codeType=o.silverlightMimeType;if(typeof u.IsVersionSupported!=\"undefined\")for(h=0;s=o.silverlightVersions[h];++h)if(u.IsVersionSupported(s)){r=s;break}u=0}}}catch(v){}return r}var t={silverlightVersions:[\"5.0\",\"4.0\",\"3.0\",\"2.0\"],silverlightMimeType:\"application/x-silverlight-2\"};n.silverlight=i,n.silverlight.version=i(),n.silverlight.defaults=t}($vxp),function(){String.prototype.format=function(){for(var t=this,n=0;n+new Date);}}function s(i){if(i&&i.target&&i.button!=2){var u=n(i.target),r=u.filter(\"*[href]:first\");r.length||(r=u.closest(\"*[href]\")),r.length&&t.trackEvent(i,r[0])}}function h(n){t.trackEvent(n)}var u=n.extend(!0,{},o,i);return t.recipients=[],t.trackInfo=new r(u.trackInfoOpts),t.trackInfo.client.pageUrl=f.href,t.register=function(){return t.recipients=t.recipients.concat(Array.prototype.slice.call(arguments)),t},t.trackEvent=function(n,i,r,u,f,o,s){t.trackInfo.event=n,t.trackInfo.createReport(i,r,u,f,o,s)&&e(\"getEventTrackingUrl\",!0)},t.trackPage=function(){e(\"getPageViewTrackingUrl\",!1)},t.genericTrackUrl=function(i){t.trackInfo.incrementEventNumber();var r=t.recipients[i];if(n.isFunction(r.getPageViewTrackingUrl))return r.getPageViewTrackingUrl(t.trackInfo)},n.fn.trackForms=function(){return this.each(function(){var t=n(this);t=t.is(\"form\")?t:n(\"form\",t),t.bind(\"submit\",h)})},n(document).bind(u.evtType,s).bind(\"impr\",t.trackEvent),n(window).bind(\"load unload\",t.trackEvent),n(function(){n(\"body\").trackForms()}),t}function r(t){function b(t,i){var f={},u,e,r;if(t&&i)for(u in t)e=t[u],r=i[e],r&&(f[u]=n.isFunction(r)?r():r);return f}function p(t,i,r){var s,u,o,f;for(r||(r=-1),s=n(t).children(),o=0;r<0&&(u=s[o]);++o){if(u==i)return-r;f=n(u),f.attr(\"id\")||(f.attr(\"href\")&&!f.attr(e.notrack)&&--r,r=p(u,i,r))}return r}function k(n){var t=/\\bGT1=(\\d+)/i.exec(n);return t?t[1]:\"\"}function w(){if(n.isNumber(i.innerWidth))c=i.innerWidth,h=i.innerHeight;else{var t=u.documentElement;t&&t.clientWidth?(c=t.clientWidth,h=t.clientHeight):t.offsetWidth&&(c=t.offsetWidth,h=t.offsetHeight)}}var l=screen,o=r.prototype,e=n.extend(!0,{},t),h,c,a,s,v,y;o.sitePage=e.sitePage,o.userStatic=e.userStatic,s=-1,o.client=n.extend({screenResolution:function(){return l.width+\"x\"+l.height},clientId:function(){if(!y){var t=e.MUIDCookie.getCookie();y=t?t:n.track.trackInfo.userStatic.requestId}return y},colorDepth:l.colorDepth,cookieSupport:function(){return u.cookie?\"Y\":\"N\"},height:function(){return h||w(),h},width:function(){return c||w(),c},isIE:function(){return n.isDefined(a)||(a=n.isDefined(i.ActiveXObject)),a},connectionType:function(){return e.defaultConnectionType},pageUrl:f.href,referrer:u.referrer,referrer_slideshow:function(){return document.referrerRefreshTrcking},getAllPgId:function(){return typeof setprop47Var!=\"undefined\"&&setprop47Var!=null?setprop47Var():\"\"},getQParam:function(){var n=\"q\",i,t;return n=n.replace(/[\\[]/,\"\\\\[\").replace(/[\\]]/,\"\\\\]\"),i=new RegExp(\"[\\\\?&]\"+n+\"=([^&#]*)\"),t=i.exec(window.location.href),t?t[1]:\"\"},sample:function(){var t,n,i;return s==-1&&(t=e.smpCookie.getCookie(),s=parseInt(t),s=isNaN(s)?Math.floor(Math.random()*100):s%100,n=location.hostname.match(/([^.]+\\.[^.]*)$vxp/),i=n?n[0]:\"\",e.smpCookie.setCookie(s,e.smpExp,i)),s},timezone:function(){var n,t,i,r;return v||(n=new Date,t=new Date,t.setMonth(n.getMonth()+6),i=Math.round(n.getTimezoneOffset()/60)*-1,r=Math.round(t.getTimezoneOffset()/60)*-1,v=in)},o.generateUrl=function(t,i,r,u,f){var h=\"\",o=n.extend(!0,{},u,i),e,c,s;f=n.extend(!0,{},r,f);if(f)for(e in f)this[e]&&(c=b(f[e],this[e]),o=n.extend(!0,{},c,o));return s=n.param(o),s.length>0&&(h=t+s),h}}var u=document,i=window,f=i.location,e,o={evtType:\"click\",spinTimeout:150,trackInfoOpts:{notrack:\"notrack\",cmSeparator:\">\",defaultModule:\"body\",defaultFormHeadline:\"[form submit]\",piitxt:\"piitxt\",piiurl:\"piiurl\",wrapperId:\"wrapper\",defaultConnectionType:\"LAN\",smpCookie:\"Sample\",smpExp:182,MUIDCookie:\"MUID\",event:{},sitePage:{},userStatic:{}}};n.track=t,r.prototype.client={},r.prototype.userDynamic={isHomePage:function(){var t=u.documentElement,i=0;if(n.isDefined(t.addBehavior)&&t.addBehavior(\"#default#homePage\"))try{i=t.isHomePage(f.href)?\"Y\":\"N\"}catch(r){}return i},anid:function(){return\"ANON\".getCookie()},timeStamp:function(){return+new Date},requestId:function(){var t,r,i,u;if(n.track.trackInfo.userStatic.requestId)return n.track.trackInfo.userStatic.requestId;for(t=[],r=\"0123456789ABCDEF\",i=0;i<32;i++)t[i]=r.substr(Math.floor(Math.random()*16),1);return t[12]=\"4\",t[16]=r.substr(t[16]&3|8,1),u=t.join(\"\"),e=u,n.track.trackInfo.userStatic.requestId=e,u},eventNumber:0},t.trackInfo=r}($vxp),function(n){function t(i){function o(t){var i,r,u,f;if(n.isObject(t))for(r in t)u=t[r],f=r.match(\"Map\")?u:o(u),i=n.extend(!0,i,f);return i}function s(t){var i=[],h=u.individualChecks,c=u.combinedChecks,v=u.nonImplementationChecks,r,l,a,s;f(t,i,{},v);if(n.isArray(h)||n.isArray(c)){for(l in e)a=e[l],s=o(a.opts),f(t,i,s,h),r=n.extend(!0,r,s);f(t,i,r,c)}return i}function f(t,i,u,f){return u&&f&&n.map(f,function(f){var e=r[f];n.isFunction(e)&&(i=n.merge(i,e(t,u)))}),i}var r=this,u=r.opts=n.extend(!0,{},i),e=n.track.recipients;r.getTrackInfoPropertyList=function(t,i){var o=[],r,u,f,e,s;i=i||[];for(r in t)if(n.inArray(r,i)==-1){u=t[r];for(f in u)e=r+\".\"+f,s=u[f],n.inArray(e,i)==-1&&n.isDefined(s)&&o.push(e)}return o},r.missingProperties=function(t,i){var u=[],r,f,e,o,s,h,c;for(r in i){f=t[r];if(!n.isDefined(f)){u.push(\"missing trackInfo.\"+r);continue}e=i[r];for(o in e)s=e[o],h=f[s],n.isDefined(h)||(c=[\"missing trackInfo.\",r,\".\",s,\" which maps to \",o],u.push(c.join(\"\")))}return u},r.duplicateProperties=function(t,i){var o=[],s=[],r,h,f,e,u,c;for(r in i){h=t[r];if(n.isDefined(h)){f=i[r];for(e in f)u=r+\".\"+f[e],n.inArray(u,s)!=-1&&(c=[\"duplicate use of trackInfo.\",u,\" which maps to \",e],o.push(c.join(\"\"))),s.push(u)}}return o},r.unusedProperties=function(t,i){var h=[],e=r.getTrackInfoPropertyList(t,u.excludeTrackInfoProperties),f,c,o,l,a,s;for(f in i){c=t[f];if(n.isDefined(c)){o=i[f];for(l in o)a=f+\".\"+o[l],s=n.inArray(a,e),s!=-1&&(e[s]=\"\")}}return h=n.map(e,function(n){if(n.length>0)return\"unused property \"+n})},r.requiredProperties=function(t){var f=[],o=r.getTrackInfoPropertyList(t),e,i;for(e in u.requiredPropertyList)i=u.requiredPropertyList[e],n.inArray(i,o)==-1&&f.push(\"required property missing \"+i);return f},r.getEventTrackingUrl=function(n){var i=\"\";return n.event.type==\"checks\"&&(t.results=s(n)),i}}t.urlLength=function(t){function f(n){n.preventDefault()}function e(t,r){n(\"body\").bind(r,f),n(t).each(function(){i=n(this),i.unbind(r).trigger(r)}),n(\"body\").unbind(r,f)}var r=[],u=-1,i,o=n.fireAndForget;return n.fireAndForget=function(n){n.length>u&&(u=n.length),n.length>t&&(r.push(n),i&&i.attr({style:\"border: 2px solid red\"}))},e(\"a[notrack!=1]\",\"click\"),e(\"form\",\"submit\"),n.fireAndForget=o,r.push(\"Max url.length=\"+u),r};var i={messageAttr:{style:\"text-align: center; width: 100%; border: solid 1px Red;\"},nonImplementationChecks:[\"requiredProperties\"],individualChecks:[\"duplicateProperties\"],combinedChecks:[\"missingProperties\",\"unusedProperties\"],excludeTrackInfoProperties:[\"event\",\"client.isIE\",\"client.sample\",\"userStatic.defaultSlotTrees\",\"userStatic.userGroup\",\"userStatic.optKey\"],requiredPropertyList:[\"sitePage.sourceUrl\",\"sitePage.pageName\",\"userStatic.requestId\"],maxUrlLength:2083};n.runCheck=function(t){var f=n.extend(!0,i,t),o=n(\"body\"),e=[],u,r;n.track?(u=n.track.initCheck.urlLength(f.maxUrlLength),n.track.register(new n.track.initCheck(f)),n(document).bind(\"checks\",n.track.trackEvent),o.trigger(\"checks\"),u=n.merge(u,n.track.initCheck.results),e=n.map(u,function(n){return\"
    \"+n+\"
    \"})):e.push(\"$vxp.track is not defined\"),r=n(\".initCheck\"),r.length==0&&(r=n(\"
    \").attr(\"class\",\"initCheck\").attr(f.messageAttr).text(\"\"),o.prepend(r)),r.html(e.join(\"\"))},n.track&&(n.track.initCheck=t)}($vxp),function(n){var t,i,r,u,f;if(n.track&&n.track.trackInfo){t=n.track.trackInfo.prototype,i=t.client;if(i){function e(){return t.userStatic&&t.userStatic.userGroup}i=n.extend(i,{flightKey:function(){if(!r){var n=e();r=n&&n.substring(0,n.indexOf(\":\"))||\"default\"}return r},groupAssignment:function(){if(!u){var n=e();u=n&&parseInt(n.substring(n.indexOf(\":\")+1))?\"S\":\"P\"}return u},optKey:function(){return f||(f=t.userStatic.optKey||\"default\"),f}})}}}($vxp),function(n){if(n.track&&n.track.trackInfo){var t=n.track.trackInfo.prototype.client,i=-1;if(t){function r(){return i==-1&&(i=n.silverlight&&n.silverlight.version?n.silverlight.version:\"\"),i}t.silverlightVersion=r,t.silverlightEnabled=function(){return Number(r()>0)}}}}($vxp),function(n){function r(){var n=[t.getDate(),\"/\",t.getMonth(),\"/\",t.getFullYear(),\" \",t.getHours(),\":\",t.getMinutes(),\":\",t.getSeconds(),\" \",t.getDay(),\" \",t.getTimezoneOffset()];return n.join(\"\")}var t=new Date,i={base:\"\",linkTrack:1,samplingRate:100,common:{v:\"Y\",j:\"1.3\"},commonMap:{client:{c:\"colorDepth\"}},page:{v1:t.getMonth()+1+\"/\"+t.getFullYear(),v2:t.getMonth()+1+\"/\"+t.getDate()+\"/\"+t.getFullYear(),t:r()},pageMap:{sitePage:{c3:\"pageVersion\"}},link:{t:r(),ndh:1,pidt:1,pe:\"lnk_o\"},linkMap:{sitePage:{c38:\"pageVersion\"}},eventList:[\"click\",\"mouseenter\",\"mouseleave\",\"submit\"]};n.track.omniTracking=function(t){var u=this,r=u.opts=n.extend(!0,{},i,t);u.getEventTrackingUrl=function(t){var u=\"\",i,f,e;return t.isSampled(r.samplingRate)&&(i=t.event?t.event.type:\"\",r.linkTrack&&n.inArray(i,r.eventList)!=-1&&(f=n.extend(!0,{},r.link,{c11:i==\"mouseenter\"||i==\"mouseleave\"?\"hover\":i,events:\"events4\"}),e=t.generateUrl(\"\",r.common,r.commonMap,f,r.linkMap),u=r.base.format(t.userDynamic.timeStamp(),e))),u},u.getPageViewTrackingUrl=function(n){var t=\"\",i;return n.isSampled(r.samplingRate)&&(i=n.generateUrl(\"\",r.common,r.commonMap,r.page,r.pageMap),t=r.base.format(n.userDynamic.timeStamp(),i)),t}},n.track.omniTracking.defaults=i}($vxp),function(n){var t={base:\"\",samplingRate:100,eventAlias:{submit:\"click\",mouseenter:\"click\",mouseleave:\"click\"}};n.track.genericTracking=function(i){var u=this,r=u.opts=n.extend(!0,{},t,i);u.getEventTrackingUrl=function(t,i){var e=\"\",u,f,o;return t.isSampled(r.samplingRate)&&(i=i?i:t.event.type,u=r[i],!n.isDefined(u)&&n.isDefined(r.eventAlias[i])&&(u=r[r.eventAlias[i]]),n.isDefined(u)&&(f=u.condition,(!n.isDefined(f)||n.isNumber(f)&&f||n.isFunction(n[f])&&n[f].call())&&(o=r.base+(u.url?u.url:\"\"),e=t.generateUrl(o,r.common,r.commonMap,u.param,u.paramMap)))),e},u.getPageViewTrackingUrl=function(n){return u.getEventTrackingUrl(n,\"impr\")}}}($vxp);jQueryWait(function(n){var i,r=0,u=0,t=n('
    ');n(document).ready(function(){i=n(\"body\"),n.frontDoorMode?(i=n(\".uxVideo\"),r=i.offset().left,u=i.offset().top):n.isHub&&(t=n('
    ')),t.appendTo(i)}),n.fn.hideTooltip=function(i){setTimeout(function(){n(this).removeClass(\"over\"),t.empty().removeClass(i)},0)},n.fn.registerTooltip=function(i,f,e,o,s,h,c,l,a,v){var y=n(this),w,b,p;e=e||function(){},o=o||0,c=c==undefined?1e3:w,l=l||\"normal\",p=function(){clearTimeout(w),e(),t.empty().removeClass(f),y.removeClass(\"over\")},t.mouseleave(function(){p()}),t.mouseenter(function(){clearTimeout(b),clearTimeout(w)}),n(this).hover(function(){var k=i.clone(),b;if(!e(!0,k))return;y.addClass(\"over\"),b=function(){var e,nt,tt,it;t.empty().addClass(f).addClass(\"uxVideo\"),e=k.css(\"display\",\"block\").appendTo(t),l==\"overlay\"&&e.hover(function(){},function(){p()});var b,c,w,g={x:n(window).scrollLeft(),y:n(window).scrollTop(),w:n(window).width(),h:n(window).height()},i={x:y.offset().left-r,y:y.offset().top-u,x2:y.offset().left+y.width()-r,y2:y.offset().top+y.height()-u,w:y.width(),h:y.height()},d={w:e.outerWidth(),h:e.outerHeight()};i.x+i.w+d.wg.x&&!a||a==\"left\"?(b=\"left\",c=(d.w+o)*-1,w=h):i.y-d.h>g.y&&!a||a==\"above\"?(b=\"top\",c=s,w=(d.h+o)*-1):(b=\"bottom_\"+(v==\"right\"?\"right\":\"left\"),w=h+o+i.h,c=s),l==\"normal\"?(a==\"below\"&&i.h>150&&(w-=84),nt=a==\"below\"&&v==\"right\"?i.x2+c-e.width():i.x+c,tt=i.y+w):(nt=i.x+s,tt=i.y+h),t.css({left:nt+\"px\",top:tt+\"px\"}),e.addClass(b)},c>0?w=setTimeout(function(){b()},c):b()},function(t){if(l==\"overlay\"&&n(t.relatedTarget||t.toElement).parents().andSelf().filter(\".vxp_galleryTooltip\").length>0)return;l==\"overlay\"?p():b=setTimeout(function(){p()},250)})}});jQueryWait(function(n){function h(){n(\"body\").mousemove(function(n){if(e){var u=n.pageY-o,r=s,f=t.find(\".vxp_scrollbar\").height()-t.find(\".topButton\").height()-t.find(\".vxp_scrollbar_bottomButton\").height()-t.find(\".vxp_scrollbar_handle\").height();return r+=u/f,i(t,r,!1),!1}}),n(\"body\").mouseup(function(){e=!1,clearTimeout(r),clearInterval(u)})}function f(n,t,r){var e=36,u=n.find(\".vxp_scrollContent\"),f=u.attr(\"scrollHeight\")-u.height(),o=u.attr(\"scrollTop\")/f;o+=t?e/f:-(e/f),i(n,o,r)}function i(n,t,i){var r,f,s,o;t>1&&(t=1),t<0&&(t=0),r=n.find(\".vxp_scrollContent\"),f=r.attr(\"scrollHeight\")-r.height(),i?r.animate({scrollTop:t*f},200):r.attr(\"scrollTop\",t*f);var h=n.find(\".vxp_scrollbar\"),e=n.find(\".vxp_scrollbar_handle\"),u=n.find(\".vxp_scrollbar_topButton\").height();u==0&&(u=8),s=h.height()-u-u-e.height(),o=s*t+u,i?e.animate({top:o},200):e.css(\"top\",o)}var e=!1,o=0,s=0,t,r,u;n.pageIsReady?h():n.subscribeEvent(\"pageReady\",h,\"scrollbar\"),n.scrollTo=function(n,t){var r=n.find(\".vxp_scrollContent\"),u=r.attr(\"scrollHeight\")-r.height(),f,e;u>0&&(f=parseInt(t.attr(\"offsetTop\")),e=f/u,i(n,e,!0))},n.updateScrolling=function(h){var c=h.find(\".vxp_scrollbar\"),l=h.find(\".vxp_scrollContent\"),a,v;c.length==0&&(h.append(\"\"),c=h.find(\".vxp_scrollbar\"),c.find(\".vxp_scrollbar_bottomButton\").click(function(){f(h,!0,!0)}).mousedown(function(){return r=setTimeout(function(){u=setInterval(function(){f(h,!0,!1)},100)},200),!1}).mouseout(function(){clearTimeout(r),clearInterval(u)}),c.find(\".vxp_scrollbar_topButton\").click(function(){f(h,!1,!0)}).mousedown(function(){return r=setTimeout(function(){u=setInterval(function(){f(h,!1,!1)},100)},200),!1}).mouseout(function(){clearTimeout(r),clearInterval(u)}),c.find(\".vxp_scrollbar_handle\").mousedown(function(n){e=!0,o=n.pageY;var i=l.attr(\"scrollHeight\")-l.height();return s=l.attr(\"scrollTop\")/i,t=h,!1}),c.find(\".vxp_scrollbar_backgroundClick\").click(function(t){var r=t.pageY-n(this).offset().top,u=r/n(this).height();i(h,u,!1)})),c.height(h.height()),l.height(h.height()),c.height(h.height()),a=h.find(\".vxp_scrollbar_handle\"),v=h.find(\".vxp_scrollbar_topButton\").height(),v==0&&(v=8);var y=c.height()-2*v,p=l.height()/l.attr(\"scrollHeight\"),b=l.attr(\"scrollHeight\")-l.height(),k=c.find(\".vxp_scrollbar_background\"),d=l.attr(\"scrollTop\")/b,w=!1;isNaN(y)||isNaN(p)||(a.height(y*p),k.height(y),p<1?(h.addClass(\"active\"),c.show(),i(h,d,!1)):(i(h,0,!1),h.removeClass(\"active\"),c.hide(),w=!0),n.browser.msie&&parseInt(n.browser.version,10)<7&&(a.hide(),a.show())),n.browser.msie&&parseInt(n.browser.version,10)<7&&!w&&(c.hide(),c.show())}});$vxp.registerWidget(\"bingDestinationPage,destinationPage\",function(n){function h(){if(s&&c()){var n=u?\"http://extreme.mobile.msn.com/video/\":\"http://extreme.mobile.msn.com/video/watch/\"+u;document.location.href=n}}function c(){for(var t=[\"windows phone\",\"zunewp7\"],i=navigator.userAgent.toLowerCase(),n=0;n0&&(_ht=\"http:\"+escape(\"//www.video.bing.com\"+document.location.pathname)),O_LC()}catch(n){}}),!1}var r=$vxp(n).getConfigs(),i=r.bingverticalname,f=r.market,e=\"http://help.live.com/resources/neutral/launchhelp.js\",o=\"http://hp.msn.com/scr/op/ol-fdbkv3_r1.js\",u=r.videoid,s=i&&i.length>0,t;setTimeout(h,1e3),t=$vxp(\"#sb_feedback\"),t.attr(\"href\")==\"#\"&&t.click(a),t=$vxp(\"#sb_help\"),t.attr(\"href\")==\"#\"&&t.click(l),$vxp.browser.msie&&document.location.href.indexOf(\"edit=true\")==-1&&(7==parseInt(document.documentMode)||7==parseInt($vxp.browser.version))&&$vxp(document.body).css(\"overflow-x\",\"hidden\")});$vxp.registerWidget(\"adWidget,superBannerAd\",function(n){var t=$vxp(n).getConfigs(),i=!1,r=!0,e=t.pagegroup,o=t.sizecode,u=t.adcontainerid,s=t.width,h=t.height,c=!1,f=function(){c||!window.dapMgr?(i||$vxp(n).widgetRefresh(),i=!0):($(\"#\"+u).empty(),dapMgr.renderAd(u,\"&PG=\"+e+\"&AP=\"+o,s,h))};$vxp(n).subscribeEvent(\"adChanged\",f),$vxp(n).subscribeEvent(\"videoChanged\",function(){r||f(),r=!1})});$vxp.registerWidget(\"tabbedContainer\",function(n){var t=!1,i;$vxp(n).mouseenter(function(i){var u,f,o,r,e;t||(t=!0,u=$vxp(n).children(\"div.vxp_tabRow\").find(\"div.vxp_tab\"),f=$vxp(n).children(\"div.vxp_tab_content\"),$vxp(n).subscribeEvent(\"tabEvent\",function(n){u.eq(n.tab).click()}),o=$vxp(n).find(\".vxp_border_3\"),r=null,o.length>0&&(r=o[0]),e=$vxp.inArray(r,u),u.each(function(){var o,i=this,s=function(){if(r!=null&&i!=r){$vxp(i).addClass(\"vxp_th2\"),$vxp(i).addClass(\"vxp_border_3\"),$vxp(i).addClass(\"vxp_tc1\"),$vxp(i).removeClass(\"vxp_th3\"),$vxp(i).removeClass(\"vxp_tc2\"),$vxp(i).removeClass(\"vxp_border_4\"),$vxp(r).addClass(\"vxp_th3\"),$vxp(r).addClass(\"vxp_tc2\"),$vxp(r).addClass(\"vxp_border_4\"),$vxp(r).removeClass(\"vxp_th2\"),$vxp(r).removeClass(\"vxp_border_3\"),$vxp(r).removeClass(\"vxp_tc1\"),r=i,e=$vxp.inArray(r,u);var t=f.height();t>0&&(t=t/12),f.css(\"min-height\",t+\"em\"),f.children(\"div.vxp_tab_widget\").children(\"div.ux\").each(function(n){var t=\"none\",r=0,i;n==e&&(i=$vxp(this).children().size()>0,i||$vxp(this).widgetRefresh(),t=\"block\",r=1),$vxp(this).parent().css({display:t}),$vxp(this).parent().attr(\"data-selected\",t==\"none\"?\"false\":\"true\")}),$vxp(n).fireEvent(\"tabChanged\",e)}};$vxp(this).mouseenter(function(){o=setTimeout(s,500)}),$vxp(this).click(function(){s()}),$vxp(this).mouseout(function(){o&&(clearTimeout(o),o=null)})}),$vxp(i.target).mouseenter())}),$vxp(n).bind(\"selectTab\",function(t,i){$vxp.isNumber(i)?$vxp(n).children(\"div.vxp_tabRow\").find(\"div.vxp_tab\").eq(i).mouseenter():$vxp(n).children(\"div.vxp_tabRow\").find(\"div.vxp_tab\").each(function(){if($vxp(this).html().toLowerCase()==i.toLowerCase()){$vxp(this).mouseenter();return}})}),i=$vxp(n).getConfig(\"Preload\"),i&&$vxp(n).children(\"div.vxp_tab_content\").children(\"div.vxp_tab_widget\").children(\"div.ux\").each(function(){var n=$vxp(this).children().size()>0;n||$vxp(this).widgetRefresh()})});$vxp.registerWidget(\"footer\",function(n){$vxp.subscribeEvent(\"attributions\",function(t){var r,i,u,f,e;if(t)for(r=t.split(\",\"),i=0;if.indexOf(\"·')):($vxp(n).find(\".attributionsRow .textAttributions\").append($vxp(f)),$vxp(n).find(\".hiddenPrompt\").removeClass(\"hiddenPrompt\")):($vxp(n).find(\".attributionsRow .imageAttributions\").append($vxp(f)),$vxp(n).find(\".hiddenPrompt\").removeClass(\"hiddenPrompt\")):(e=$vxp(''),$vxp(e).attr(\"data-key\",u),$vxp(e).text(r[i]),$vxp(n).find(\".attributionsRow .textAttributions\").append($vxp(e)),$vxp(n).find(\".hiddenPrompt\").removeClass(\"hiddenPrompt\")))})});$vxp.registerWidget(\"header\",function(n){var t=$vxp.getPageWidget().getConfig(\"PrimaryDomainUrl\"),i,r=function(){var r=$vxp.vxpGlobal.geo.data(),u,f,e;i||(i=!0,u=document.location,r.market&&\"en-us\"!=r.market&&t==u.hostname.toLowerCase()&&u.pathname==\"/\"&&r.marketEnabled&&(f=\"http://\"+t+\"/video.aspx?mkt=\"+r.market,e=$vxp.cookie(\"vidgeor\"),e!=\"1\"?($vxp.cookie(\"vidgeor\",\"1\"),document.location.href=f):$vxp(n).find(\".geoTxt\").fadeIn(500).click(function(){return document.location.href=f,!1})))};$vxp.vxpGlobal.geo.isReady()?r():$vxp(n).subscribeEvent(\"geoDataReady\",r)});$vxp.registerWidget(\"headerMoreMenu\",function(n){if($vxp(n).getConfig(\"Refreshing\"))$vxp(n).find(\"div.vxp_moreButton\").hover(function(){$vxp(this).addClass(\"vxp_hover\"),$vxp(n).find(\"div.moreButton_contentModule\").show()},function(){$vxp(this).removeClass(\"vxp_hover\"),$vxp(n).find(\"div.moreButton_contentModule\").hide()}),$vxp(n).find(\"div.moreButton_contentModule\").hover(function(){$vxp(this).show()},function(){$vxp(this).hide()});else{var t=$vxp.setUrlParam(\"/\",\"rt\",\"ajax\");$vxp(n).widgetRefresh(null,null,t)}});$vxp.registerWidget(\"premiumTagHeader\",function(){});$vxp.registerWidget(\"SubHeader\",function(){});$vxp.registerWidget(\"marketPicker\",function(){});$vxp.registerWidget(\"navigation\",function(n){var i=!1,r=$vxp(n).getConfig(\"NewMsnNav\")==!0,t=r==!0?\"vxp_bg5\":\"vxp_bg7\";$vxp(n).mouseover(function(r){if(!i){i=!0,$vxp(n).find(\".vxp_primaryNav LI\").hover(function(){$vxp(this).hasClass(\"vxp_menu\")||$vxp(this).addClass(\"vxp_hover \"+t),f()},function(){$vxp(this).hasClass(\"vxp_menu\")||$vxp(this).hasClass(\"vxp_selected\")||$vxp(this).removeClass(\"vxp_hover \"+t)}).click(function(){var n=$vxp(this).find(\"A\").attr(\"href\");n&&(window.location=n)}),$vxp(n).find(\".vxp_subMenu .vxp_category\").hover(function(){$vxp(this).addClass(\"vxp_hover\")},function(){$vxp(this).removeClass(\"vxp_hover\")}).click(function(){return $vxp(this).hasClass(\"vxp_selected\")||(window.location=$vxp(this).find(\"A\").attr(\"href\")),!1});var u,e=!1;$vxp(n).find(\".vxp_menu\").hover(function(){clearTimeout(u),$vxp(n).find(\".vxp_subMenu\").show(),$vxp(n).find(\".vxp_menu\").addClass(\"vxp_menuHover \"+t)},function(){}),$vxp(n).find(\".vxp_subMenu\").hover(function(){clearTimeout(u),$vxp(n).find(\".vxp_menu\").addClass(\"vxp_menuHover \"+t)},function(){clearTimeout(u),u=setTimeout(f,1e3)});function f(){$vxp(n).find(\".vxp_subMenu\").hide(),$vxp(n).find(\".vxp_menu\").removeClass(\"vxp_menuHover \"+t)}$vxp(r.target).mouseover()}})});$vxp.registerWidget(\"searchBar\",function(n){var i=$vxp(n).getConfig(\"defaultText\"),r=$vxp(n).getConfig(\"clearDefaultText\"),t=function(t){var r=$vxp(n).getConfig(t?\"webSearchUrl\":\"videoSearchUrl\").toLowerCase(),i=$vxp.trim($vxp(n).find(\"INPUT\")[0].value);return i!=\"\"&&(i=r.indexOf(\"?\")>0?encodeURIComponent(i):$vxp.urlTagEncode(i),r=r.replace(\"searchquery\",i),document.location.href=r),!1};$vxp(n).find(\".vxp_videoSearch\").click(function(){t()}),$vxp(n).find(\".vxp_webSearch\").click(function(){t(!0)}),$vxp(n).find(\"INPUT\").each(function(){var n=this;$vxp(this).focus(function(){n.value==i&&r&&(n.value=\"\"),n.select()}),$vxp(this).keydown(function(n){if(n.keyCode==13)return t()})})});$vxp.registerWidget(\"slideshowPageRightRail\",function(n){$vxp(n).subscribeEvent(\"playSlideshow\",function(t){$vxp(n).setConfig(\"GalleryId\",t.id),$vxp(n).setConfig(\"AutoPlay\",!0),$vxp(n).widgetRefresh()})});$vxp.registerWidget(\"alphabet\",function(n){var t=$vxp(n).getConfig(\"EventTarget\"),i=function(){$vxp(this).addClass(\"vxp_alphabet_over vxp_tl2\")},r=function(){$vxp(this).removeClass(\"vxp_alphabet_over vxp_tl2\")};$vxp(n).find(\".vxp_alpha_available\").each(function(){$vxp(this).click(function(){return $vxp.fireEvent(\"alphabetEvent\",$vxp(this).attr(\"data-letter\"),t),!1}),$vxp(this).mouseover(i),$vxp(this).mouseout(r)})});$vxp.registerWidget(\"filteredTagList\",function(n){$vxp(n).subscribeEvent(\"filterEvent\",function(t){var u=$vxp(n).getConfig(\"TagQuery\"),i=$vxp.asArray(u.tagQuery.tags.tag),f,r;for(u.tagQuery.tags.tag=i,f=!1,r=0;r=a?0:t+1},f=function(i){c||(c=!0,setTimeout(function(){var a,l,h,p,b,k;c=!1,r&&r.find(\".vxp_playlist_countdown_text\").hide(),a=$vxp(n).getConfig(\"SelectedMenuItemIndex\"),a==s&&(l=$vxp(n).find(\"div[data-videolist=front]\").find(\"li.vxp_gallery_item\"),l.removeClass(\"vxp_playlist_playing\").removeClass(\"vxp_playlist_next\"),p=l.filter('[data-dataIndex=\"'+t+'\"]'),p.addClass(\"vxp_playlist_playing\"),h=l.filter('[data-dataIndex=\"'+e()+'\"]'),r=h,t!=e()&&h.addClass(\"vxp_playlist_next\")),h&&h.length>0?u={url:h.find(\".vxp_playerUrl\").eq(0).attr(\"href\"),id:h.attr(\"data-videoId\"),playerType:h.attr(\"data-playerAdapter\"),index:e()}:i?(b=Math.floor(e()/d)+1,a==s?(o.setConfig(\"CurrentPage\",b),o.widgetRefresh(function(){o=$vxp(n).find(\"div.vxp_pagedGallery\").eq(0),f()})):($vxp(n).setConfig(\"CurrentPage\",null),y(s),$vxp(n).widgetRefresh())):(k=$vxp.getPageWidget().getConfig(\"ServicesRoot\")+\"/playlist/get?callback=?\",$vxp.getJSON(k,{responseEncoding:\"json\",pageSize:\"1\",contextKey:v,pageNum:(e()+1).toString(),maxTotalSize:w.toString()},function(n){if(n&&n.playlist){var t=n.playlist.videos.video;t&&(u={url:t.url.$,id:t.uuid.$,playerType:t.playerType.$,index:e()})}}))},100))},k=function(){var i,r;t++,t>=a&&(t=0),u&&($vxp.cookie(\"vidap\",\"editor\"),i=$vxp(n).find(\".vxp_gallery\").getConfig(\"tracking\"),b?(r=$vxp.updateTracking(\"cp\",\"\",i),$vxp.fireEvent(\"playVideo\",{id:u.id,metadata:{supportedPlayers:u.playerType,source:\"cp\",dataIndex:u.index,playerSource:r}})):($vxp.writeTrackingCookie(\"cp\",\"\",\"\"),document.location.href=u.url))},y=function(t){$vxp(n).setConfig(\"SelectedMenuItemIndex\",t)},h,p;$vxp(n).subscribeEvent(\"countdownComplete\",k),$vxp(n).subscribeEvent(\"playVideo\",function(i){t=-1,$vxp(n).setConfig(\"VideoId\",i.id),(i.metadata.source==\"playlist\"||i.metadata.source==\"cp\")&&(t=i.metadata.dataIndex,f(i.metadata.source==\"cp\"))}),$vxp(n).subscribeEvent(\"geoFencedVideoRemoved\",function(){f()}),$vxp(n).subscribeEvent(\"galleryPageChanged\",function(){f()},o),$vxp(n).subscribeEvent(\"smartPoolRefreshReady\",function(t){$vxp(n).setConfig(\"SmartPoolTargetingKey\",t),$vxp(n).widgetRefresh()},o),$vxp(n).subscribeEvent(\"countdownStart\",function(n){var t,i;n>0&&(r&&(t=r.find(\".vxp_playlist_countdown_text\"),t.html(n),t.show()),i=n,l=setInterval(function(){i--,t&&t.html(i),i==0&&(clearInterval(l),t&&t.hide())},1e3))}),$vxp(n).subscribeEvent(\"countdownCancel\",function(){clearInterval(l),r&&r.find(\".vxp_playlist_countdown_text\").hide()}),h=$vxp(n).find(\"div.vxp_dropDownMenu\"),h.length>0&&$vxp(n).subscribeEvent(\"dropDownItemSelected\",function(t){y(t.itemIndex),$vxp(n).widgetRefresh()},h),p=$vxp(n).parents(\".vxp_tabbedContainer\"),$vxp(n).subscribeEvent(\"tabChanged\",function(n){n==0&&f()},p),f(),$vxp(n).setConfig(\"cpkey\",v)});$vxp.registerWidget(\"watchPageRightRail\",function(n){$vxp(n).subscribeEvent(\"playVideo\",function(t){t.metadata.source==\"playlist\"||t.metadata.source==\"cp\"||($vxp(n).setConfig(\"VideoId\",t.id),$vxp(n).widgetRefresh())})});$vxp.registerWidget(\"dropDownMenu\",function(n){var t=!1,i=function(){t=!1,$vxp(n).parent().removeClass(\"vxpDropDownOpened\")},r=function(){t=!0,$vxp(n).parent().addClass(\"vxpDropDownOpened\")},u=function(){t?i():r()};$vxp(n).find(\"div.vxpDropDownHeader\").click(function(n){n.stopPropagation(),u()}),$vxp(n).find(\"div.vxpDropDownItem\").click(function(){var t=$vxp(this).attr(\"data-itemId\"),i=$vxp(this).attr(\"data-itemIndex\");$vxp(n).fireEvent(\"dropDownItemSelected\",{itemId:t,itemIndex:i})}),$vxp(document.body).click(function(){i()})});$vxp.registerWidget(\"filterPane\",function(n){var t=$vxp(n).getConfig(\"EventTarget\");$vxp(n).subscribeEvent(\"widgetRefreshComplete\",function(){$vxp(\"a.vxp_playerUrl\").each(function(){var r;if(this.href.indexOf(\"sf=\")<0)return;var u=this.href,n=u.split(\"&\"),t=\"\",f=[];for(i=0;i1):n.hasClass(\"vxp_prevPage\")?f=t>1:n.hasClass(\"vxp_nextPage\")?(e+=114,f=t0&&(i=Math.ceil(o/f),i>Math.ceil((c+f-1)/f)&&h==\"_gallery\"&&(i=Math.floor((c+f-1)/f)),i>1&&(t=parseInt(t),u&&($vxp(n).find(\".vxp_currentPage\").text(t),$vxp(n).find(\".vxp_totalPages\").text(i)),l.attr(\"data-param\",1),a.attr(\"data-param\",t-1),v.attr(\"data-param\",t+1),y.attr(\"data-param\",i),r()))}var u=$vxp(n).getConfigs(),h=u.eventtarget,f=u.pagesize,o=u.totalcount,t=u.currentpage,c=u.gallerymaxcount,i,l=$vxp(n).find(\".vxp_firstPage\"),a=$vxp(n).find(\".vxp_prevPage\"),v=$vxp(n).find(\".vxp_nextPage\"),y=$vxp(n).find(\".vxp_lastPage\"),s;$vxp(n).subscribeEvent(\"PaginationCountChangedEvent\",function(n){o=n,e(!0)}),$vxp(n).subscribeEvent(\"PaginationPageChangedEvent\",function(n){t!=n&&(t=n,e(!0))}),s=!1,$vxp(n).mouseover(function(i){s||(s=!0,$vxp(n).find(\".vxp_lastPage,.vxp_nextPage,.vxp_firstPage,.vxp_prevPage\").each(function(){$vxp(this).click(function(){return $vxp(this).hasClass(\"vxp_inactive\")||(t=$vxp(this).attr(\"data-param\"),e(!0),$vxp.fireEvent(\"paginationEvent\",t,h)),!1})}),$vxp(n).find(\".vxp_lastPage,.vxp_nextPage,.vxp_firstPage,.vxp_prevPage\").each(function(){var n=$vxp(this);$vxp(this).mouseover(function(){r(n,!0)}).mouseout(function(){r(n)})}),$vxp(i.target).mouseover())}),e()});$vxp.registerWidget(\"gallery\",function(n){function e(n,t){var i=setTimeout(n,t);return r||(r=[]),r.push(i),i}function o(n){clearTimeout(n);if(r){var t=r.indexOf(n);t==r.length-1?r.pop():t==0?r.shift():r.splice(t,1)}}function fi(){if(r){for(var n in r)clearTimeout(n);r=null}}function v(i){t.thumbnailaddimmingenabled&&$vxp(n).find(\"li.vxp_gallery_item\").each(function(){var n=c($vxp(this));n.isBing!=\"true\"||n.providerId!=\"\"&&n.providerId||(i?y(this,t.addimmessagetext,null,!0,.2,!0,\"bingdim\"):et(this,\"bingdim\"))})}function kt(){var s;if(!b){var v=ft(),h=$vxp(n).vxpFindId(\"gallery_tooltip\"),r=$vxp(n).children().first(),p=$vxp(document.body).find(\".uxVideo .uxBody\").length>0,a=$vxp(document.body).find(\".ux.hub\").length>0,u=0;p?u=$vxp(r).hasClass(\"vxp_list\")?72:$vxp(r).hasClass(\"vxp_grid\")?100:100:$vxp(r).hasClass(\"vxp_list\")&&(u=-22),s=h.attr(\"data-tooltiptype\"),b=!0,$vxp(n).find(\"li.vxp_gallery_item\").each(function(){var r=$vxp(this),w,p;ut(r),v&&($vxp(r).attr(\"data-isExternal\")!=\"true\"||i==\"Dtp\"||i==\"Gallery\")&&(ot()||$vxp(r).find(\".vxp_playerUrl\").attr(\"href\",\"#\")),w=parseInt(r.parent().attr(\"data-column\")),s==\"thumbnailoverlay\"?(r.hover(function(){var n=c(r);r.find(\".vxp_thumbnailOverlayTooltip\").show(),r.find(\".vxp_thumbnailOverlayTitle\").text(n.title.text()),r.find(\".vxp_thumbnailOverlayDuration\").text(n.duration?n.duration+\" \"+ii:\"\")},function(){r.find(\".vxp_thumbnailOverlayTooltip\").hide()}),$vxp(r).find(\".vxp_motionThumb\").attr(\"title\",\"\")):s==\"infotip\"&&r.registerTooltip(h,\"vxp_gallery\",function(t,u){var f,o;if(t){f=c(r),a||f.isBing==\"true\"?$vxp(u).find(\".vxp_title\").text(f.title.text()):$vxp(u).find(\".vxp_title\").html(f.title.html()),f.groupName.length>0?(f.subTitle?$vxp(u).find(\".vxp_networkLabel\").text(f.subTitle).show():$vxp(u).find(\".vxp_networkLabel\").hide(),a||f.isBing==\"true\"?$vxp(u).find(\".vxp_group\").text(f.groupName.text()).show():$vxp(u).find(\".vxp_group\").html(f.groupName.html()).show()):$vxp(u).find(\".vxp_group\").hide(),f.duration||f.date?$vxp(u).find(\".vxp_extras\").show():$vxp(u).find(\".vxp_extras\").hide(),f.duration?($vxp(u).find(\".vxp_durationLabel\").show(),$vxp(u).find(\".vxp_duration\").text(f.duration).show(),$vxp(u).find(\".vxp_duration_separator\").show()):($vxp(u).find(\".vxp_durationLabel\").hide(),$vxp(u).find(\".vxp_duration\").hide(),$vxp(u).find(\".vxp_duration_separator\").hide()),f.date&&f.dateLabel?($vxp(u).find(\".vxp_dateLabel\").text(f.dateLabel+\":\"),$vxp(u).find(\".vxp_date\").text(f.date)):($vxp(u).find(\".vxp_dateLabel\").hide(),$vxp(u).find(\".vxp_date\").hide(),$vxp(u).find(\".vxp_duration_separator\").hide());if(f.isExternal==\"true\"||f.isBing==\"true\")$vxp(u).find(\".vxp_counts\").hide();else{$vxp(u).find(\".vxp_views\").text(f.views);var e=f.rating,s=Math.round(e)!=e,h=75-Math.round(e)*15,l=s*14,v=-1*h+\"px \"+-1*l+\"px\";$vxp(u).find(\".vxp_rating\").css(\"background-position\",v),$vxp(u).find(\".vxp_counts\").show()}o=$vxp(n).getConfig(\"HasExternalWarning\")&&f.isExternal==\"true\"&&i!=\"Dtp\"&&i!=\"Gallery\",o||f.description?$vxp(u).find(\".vxp_divider\").show():$vxp(u).find(\".vxp_divider\").hide(),f.description?$vxp(u).find(\".vxp_desc\").text(f.description).show():$vxp(u).find(\".vxp_desc\").hide(),o?$vxp(u).find(\".vxp_externalWarning\").show():$vxp(u).find(\".vxp_externalWarning\").hide(),f.copyright?($vxp(u).find(\".copyrightText\").text(f.copyright),$vxp(u).find(\".vxp_copyright\").show()):$vxp(u).find(\".vxp_copyright\").hide(),vt&&($vxp(u).find(\".vxp_counts\").hide(),$vxp(u).find(\".vxp_source\").hide(),$vxp(u).find(\".vxp_extras\").hide()),$vxp(r).find(\".vxp_motionThumb\").attr(\"title\",\"\")}return!0},8,0,u,null,null,dt,w%2==0?\"left\":\"right\"),f&&($vxp(r).mouseover(function(){$vxp(n).parents(\".vxp_showcase\").length>0?($vxp(n).find(\".selected .vxp_title.vxp_tl1\").removeClass(\"vxp_tl1\").addClass(\"vxp_tb2\"),$vxp(n).find(\".selected.vxp_bgSelected\").removeClass(\"selected vxp_bgSelected\"),$vxp(r).addClass(\"selected vxp_bgSelected\"),$vxp(r).find(\".vxp_title\").addClass(\"vxp_tl1\")):($vxp(n).find(\".selected\").removeClass(\"selected\"),$vxp(r).addClass(\"selected\"));var t=c(r);$vxp.fireEvent(\"galleryItemHover\",t,f)}),(i==\"Dtp\"||i==\"Gallery\")&&$vxp(r).mouseout(function(){$vxp(r).removeClass(\"selected\")})),$vxp(r).hover(function(){$vxp(r).addClass(\"hovered\"),it&&l&&!$vxp(r).attr(\"data-blockType\")&&$(r).find(\"img\").length>0&&y($vxp(r),si,null,!0,.2,!0,\"noAdClick\")},function(){$vxp(r).removeClass(\"hovered\"),it&&et($vxp(r),\"noAdClick\")}),$vxp(r).find(\"a.vxp_addToQueueButton\").mousedown(function(n){var i=$vxp(this),f,s;undefined==p&&(p=$vxp(r).find(\"div.vxp_addedToQueueText\").text());var u=c($vxp(r)),l={id:u.id,compactId:u.compactId,url:u.playerLink,thumb:u.thumbImage,motionThumb:u.motionThumb||\"\",title:u.title,description:u.description||\"\",isBing:u.isBing,providerId:u.providerId,playerType:u.playerType,playerAdapter:u.playerAdapter,source:u.source},h=$vxp.vxpGlobal.playlist.add(l);return\"added\"==h?(i.hide(),$vxp(r).find(\"div.vxp_addedToQueueText\").text(p),i.siblings(\"div.vxp_addedToQueueButton\").show(),i.siblings(\"div.vxp_addedToQueue\").show(),$vxp.vxpFind(\"div.tabbedPlayerPane .tab.queue\").click(),f=e(function(){o(f),i.siblings(\"div.vxp_addedToQueue\").fadeOut(2e3),i.siblings(\"div.vxp_addedToQueueButton\").fadeOut(2e3),i.show(),s=e(function(){o(s),i.siblings(\"div.vxp_addedToQueue\").hide(),i.siblings(\"div.vxp_addedToQueueButton\").hide()},3e3)},5e3)):\"exists\"==h?($vxp(r).find(\"div.vxp_addedToQueueText\").text(t.queuedupeerrortext),i.siblings(\"div.vxp_addedToQueue\").show(),f=e(function(){o(f),i.siblings(\"div.vxp_addedToQueue\").fadeOut(2e3),s=e(function(){o(s),i.siblings(\"div.vxp_addedToQueue\").hide()},3e3)},5e3)):\"max\"==h&&($vxp(r).find(\"div.vxp_addedToQueueText\").text(t.queuefullerrortext),i.siblings(\"div.vxp_addedToQueue\").show(),f=e(function(){o(f),i.siblings(\"div.vxp_addedToQueue\").fadeOut(2e3),s=e(function(){o(s),i.siblings(\"div.vxp_addedToQueue\").hide()},3e3)},5e3)),n.stopPropagation(),!1})}),$vxp(n).addClass(\"vxp_js_ready\")}}function k(n){var t;switch(h){case\"playlist\":t=\"UpNext\";break;case\"showcase\":t=\"Show\";break;case\"filmstrip\":t=\"Filmstrip\";break;default:t=\"Gal\"}return $vxp.updateTracking(t,\"play\",ht,n)}function d(r){var d,v,a,c,u,nt,o;if($vxp(r).attr(\"data-geofenced\")==\"true\"||$vxp(r).attr(\"data-blockType\")||l&&it||+new Date-at<100)return!1;at=+new Date;var y=$vxp(r).attr(\"data-isExternal\")==\"true\",st=$vxp(r).attr(\"data-isMmvSupported\")==\"true\",b=$vxp(r).attr(\"data-isMultiLiteSupported\")==\"true\",e=$vxp(r).attr(\"data-videoId\");if(hi){u=$vxp(r).find(\"a.vxp_thumbClickTarget\").attr(\"href\")||$vxp(r).find(\"a.vxp_motionThumb\").attr(\"href\")||$vxp(r).find(\".title\").attr(\"href\")||$vxp(r).parents(\"a.vxp_motionThumb\").attr(\"href\"),d=$vxp(r).find(\"a.vxp_thumbClickTarget\").attr(\"data-id\")||$vxp(r).find(\"a.vxp_motionThumb\").attr(\"data-id\")||$vxp(r).find(\".title\").attr(\"data-id\")||$vxp(r).parents(\"a.vxp_motionThumb\").attr(\"data-id\")||$vxp(r).find(\"a.vxp_thumbClickTarget\").attr(\"data-instKey\");try{PlayVideo(d,u)}catch(ct){}}else if(st&&ui(y)&&window.MsnVideoUx&&MsnVideoUx.launchOverlayPlayer){var ot=g.widget.configId.$||g.widget.label.$,rt=g.widget.csid.$,et=$vxp.getPageWidget().getConfig(\"hubDomain\"),ut=tt,ht=$vxp.isHub?!0:!1;MsnVideoUx.launchOverlayPlayer(ot,rt,{DynamicInitialVideoId:e,DynamicPlaylistQuery:ut,DynamicModules:\"video\",Preview:\"true\"},{hubDomain:et,loadCss:ht},!1,!0)}else{if(ft(y,b)||gt)return v=$vxp(r).attr(\"data-selectedImgSrc\"),a=parseInt($vxp(r).attr(\"data-dataIndex\")),i==\"Dtp\"?$vxp.fireEvent(\"photoClicked\",{id:e,metadata:{selectedImgSrc:v,dataIndex:a,source:h}},f):i==\"Gallery\"?$vxp.fireEvent(\"playSlideshow\",{id:e,metadata:{source:h}},f):b?(c=k(),lt?$vxp(n).fireEvent(\"playVideo\",{id:e,metadata:{supportedPlayers:$vxp(r).attr(\"data-playerAdapter\"),playerSource:c,selectedImgSrc:v,dataIndex:a,source:h,playlist:tt}},s?$vxp(\"#\"+s):null):$vxp(n).fireEvent(\"playVideo\",{id:e,metadata:{supportedPlayers:$vxp(r).attr(\"data-playerAdapter\"),playerSource:c,selectedImgSrc:v,dataIndex:a,source:h}},s?$vxp(\"#\"+s):null),o=$vxp(r).attr(\"data-activityId\"),$vxp.vxpGlobal.smartPool.ping(w,i==\"Dtp\"||i==\"Gallery\"?\"pg\":\"vg\",{click:o})):(c=k(!0),u=$vxp.setUrlParam(document.location.href.toString(),\"videoId\",e),window.location=u),!1;u=$vxp(r).find(\"a.vxp_thumbClickTarget\").attr(\"href\")||$vxp(r).find(\"a.vxp_motionThumb\").attr(\"href\")||$vxp(r).find(\".title\").attr(\"href\")||$vxp(r).parents(\"a.vxp_motionThumb\").attr(\"href\"),nt=$vxp(r).find(\"a.vxp_thumbClickTarget\").attr(\"target\")||$vxp(r).find(\"a.vxp_motionThumb\").attr(\"target\")||$vxp(r).find(\".title\").attr(\"target\")||$vxp(r).parents(\"a.vxp_motionThumb\").attr(\"target\");if(u){o=$vxp(r).attr(\"data-activityId\"),$vxp.vxpGlobal.smartPool.ping(w,i==\"Dtp\"||i==\"Gallery\"?\"pg\":\"vg\",{click:o}),lt&&t.contentsource!=\"SmartPool\"&&(u+=\"?DefaultPlaylist=\"+encodeURIComponent(tt));if(nt==\"_blank\")return window.open(u,\"_blank\"),!1;k(!0);if(!p)return document.location=u,!1}}return!0}function ot(){return t.sitetypename==\"image\"}var t=$vxp(n).getConfigs(),f=t.eventtarget,yt=t.usesmartmotionthumbs,pt=t.smartpreviewplayerurl,wt=t.removegeofencedvideos,bt=t.userplaylistenabled,lt=t.passgalleryasplaylist,w=t.smartpoolpingserviceurl,dt=t.tooltiporientation,gt=t.alwayssendplayevent,p=t.removeonclickhandler,it=t.preventclicksduringads,si=t.noadclicktext,ti=t.nospping,ii=t.minutestext,ci=null,ct,i=t.datacatalog,s=t.linkedplayerid,u=$vxp(n).attr(\"id\"),h=t.clicksource,g=t.multimediaviewer,li=t.videocontent,tt=t.rawvideocontent,ht=t.tracking,hi=$vxp(n).getConfig(\"CallExternalMethodForPlayback\")==!0,l=$vxp.vxpGlobal.playerAdapter()?$vxp.vxpGlobal.playerAdapter().isAdPlaying():!1,at=0,vt=i==\"Dtp\"||$vxp(n).parents(\".vxp_photoGallery\").length>0,oi=isBrowserSafari&&$vxp.hasFlash(9),ei=t.tmxtext,r,b,rt,nt,a,st;$vxp(n).registerDispose(function(){fi(),$vxp(n).find(\"li.vxp_gallery_item\").each(function(){var n=$vxp(this);$vxp(n).find(\"a.vxp_addToQueueButton\").each(function(){var n=$vxp(this);n.siblings(\"div.vxp_addedToQueue\").stop(!0,!1),n.siblings(\"div.vxp_addedToQueueButton\").stop(!0,!1)})})});var ft=function(n,r){if(i==\"Dtp\"&&$vxp.find(\"div.vxpPhotoViewer\").length>0)return!0;if(i==\"Gallery\"&&ot())return!1;if(i==\"Gallery\"&&$vxp.find(\"div.vxpSlideshow\").length>0)return!0;if(!n&&i==\"Video\"&&t.playbackmode==\"Standard\"){var u=$vxp.find(\"div.vxp_player\");if(u.length>0||$vxp.find(\"div.vxp_multiplayerLite\").length>0){if(r)return!0;if($vxp(u).parents(\"div.vxp_videoModule\").length>0)return!0}}return!1},ui=function(n){return!n&&t.playbackmode==\"MultimediaViewer\"&&window.MsnVideoUx?!0:!1},ut=function(n){var u=$vxp(n).attr(\"data-hoverImgSrc\"),i,r,t;u?(i=$vxp(''),$vxp(i).attr(\"src\",u),$vxp(i).addClass(\"hoverImage\"),$vxp(i).hide(),$vxp(n).find(\"div.vxp_hoverThumb\").append(i).show(),$vxp(n).find(\"a.vxp_motionThumb.vxp_playerUrl\").hover(function(){$vxp(i).show()},function(){$vxp(i).hide()})):$vxp.frontDoorMode&&isBrowserSafari&&!oi?($vxp(n).find(\".vxp_motionThumbContainer\").remove(),r=$vxp(n).attr(\"data-externalUrl\"),r&&($vxp(n).attr(\"data-isExternal\",\"true\"),$vxp(n).find(\"a.vxp_playerUrl\").each(function(){$vxp(this).attr(\"href\",r)}))):yt&&!isBrowserSafari?($vxp.MotionThumb.setPlayerUrl(pt),$vxp.MotionThumb.bind($vxp(n),d)):($vxp(n).find(\".vxp_motionThumbContainer\").remove(),p||$vxp(n).find(\"a.vxp_motionThumb\").click(function(n){return n.preventDefault(),!1})),t=n,$vxp(n).find(\"img.vxp_thumb, a.vxp_thumbClickTarget, div.vxp_thumbnailOverlayTooltip, div.vxp_playButtonPositionForegroundCenter, div.vxp_playButtonPositionForegroundBottomRight, div.vxp_vidAdvertisementBackground\").click(function(n){return p||n.preventDefault(),d(t)}),$vxp(n).find(\"a.vxp_motionThumb, img.vxp_thumb, a.vxp_thumbClickTarget, div.vxp_thumbnailOverlayTooltip, div.vxp_playButtonPositionForegroundCenter, div.vxp_playButtonPositionForegroundBottomRight, div.vxp_vidAdvertisementBackground\").each(function(){var n=$vxp(this);n.keydown(function(n){if(n.keyCode==13||n.keyCode==32)return p||n.preventDefault(),d(t)})});var f=$vxp(t).attr(\"data-isHtml5Supported\")==\"false\",e=$vxp(t).attr(\"data-playerType\")==\"YouTube\"||$vxp(t).attr(\"data-playerType\")==\"Bing\"&&$vxp(t).attr(\"data-playerAdapter\")==\"YouTube\",o=$vxp(t).attr(\"data-playerType\")==\"DailyMotion\"||$vxp(t).attr(\"data-playerType\")==\"Bing\"&&$vxp(t).attr(\"data-playerAdapter\")==\"DailyMotion\",s=isPluginsUnsupported&&f&&!e&&!o;s&&(y(t,ei,null,!1,.2,!1,\"tmx\"),$vxp(t).find(\"a.vxp_addToQueueButton\").css(\"display\",\"none\"))};$vxp(n).attr(\"data-refresh\")&&$vxp(n).vxpFind(\"li.vxp_gallery_item\").each(function(){var n=$vxp(this).attr(\"data-attributions\");n&&$vxp.fireEvent(\"attributions\",n)});var ri=function(i){$vxp(n).vxpFind(\"li.vxp_gallery_item\").each(function(){var s=this,f=!1,n,r,u,e,o;if(i){n=$vxp(this).attr(\"data-geoFence\");if(n){r=n.length>i.length?n.length:i.length,r%2&&r++;while(n.length
    '),h=$vxp('
    '),$vxp(s).append(h),$vxp(h).text(t),r||$vxp(n).find(\"a.vxp_addToQueueButton\").css(\"visibility\",\"hidden\"),$vxp(n).find(\"img.vxp_thumb\").css(\"opacity\",u||.3),$vxp(n).find(\"span.vxp_motionThumbContainer\").hide(),$vxp(n).find(\"div.vxp_playButtonPositionContainer\").hide(),$vxp(n).find(\"div.vxp_info\").addClass(\"vxp_geoFencedInfo\"),r||$vxp(n).attr(\"data-geofenced\",\"true\"),o=$vxp(n).find(\"a\"),i?o.attr(\"href\",i):(o.addClass(\"vxp_dim\"),r?$vxp(n).find(\"img.vxp_thumb, .vxp_title\").css(\"cursor\",\"pointer\"):(o.unbind(\"click\").bind(\"click\",function(n){return n.preventDefault(),!1}),o.find(\"IMG\").unbind(\"click\").bind(\"click\",function(){return!1}),$vxp(n).find(\"img.vxp_thumb, .vxp_title\").css(\"cursor\",\"default\")),c=$vxp(n).find(\"a.vxp_motionThumb\"),$vxp(c).length?$vxp(c).append(s):$vxp(n).find(\"div.vxp_extra\").addClass(\"geoFencedList vxp_tb1\").html(t))))},et=function(n,t){var r=$vxp(n).attr(\"data-blockType\"),i;r==t&&($vxp(n).attr(\"data-blockType\",\"\"),$vxp(n).find(\"a.vxp_addToQueueButton\").css(\"visibility\",\"visible\"),$vxp(n).find(\"img.vxp_thumb\").css(\"opacity\",1),$vxp(n).find(\"span.vxp_motionThumbContainer\").show(),$vxp(n).find(\"div.vxp_playButtonPositionContainer\").show(),$vxp(n).find(\"div.vxp_info\").removeClass(\"vxp_geoFencedInfo\"),$vxp(n).find(\"img.vxp_thumb, .vxp_title\").css(\"cursor\",\"pointer\"),i=$vxp(n).find(\"a.vxp_playerUrl\"),$vxp(i).removeClass(\"vxp_dim\"),$vxp(n).find(\".vxp_geoFenced\").hide())},c=function(n){return{id:$vxp(n).attr(\"data-videoId\"),wholeTitle:$vxp(n).find(\".vxp_tooltip_data\").attr(\"data-title\"),title:$vxp(n).data(\"title\")?$vxp(n).data(\"title\"):$vxp(n).find(\".vxp_tooltip_data .vxp_title\"),subTitle:$vxp(n).find(\".vxp_tooltip_data .vxp_networkLabel\").text(),dateLabel:$vxp(n).find(\"em.vxp_gallery_dateLabel\").text(),date:$vxp(n).find(\"em.vxp_gallery_date\").text(),duration:$vxp(n).find(\"em.vxp_gallery_duration\").text(),views:$vxp(n).find(\".vxp_views\").eq(0).text(),description:$vxp(n).find(\".vxp_description\").eq(0).text(),playerLink:$vxp(n).find(\"div.vxp_gallery_thumb\").children(\"a\").attr(\"href\"),thumbImage:$vxp(n).find(\"img\").attr(\"src\"),motionThumb:$vxp(n).attr(\"data-motionThumb\"),selectedImage:$vxp(n).attr(\"data-selectedImgSrc\"),rating:$vxp(n).find(\".vxp_rating\").eq(0).text(),groupName:$vxp(n).find(\"div.vxp_source\"),isBing:$vxp(n).attr(\"data-isBing\"),dataSource:$vxp(n).attr(\"data-dataSource\"),playerType:$vxp(n).attr(\"data-playerType\"),isExternalPlayer:$vxp(n).attr(\"data-externalPlayer\"),providerId:$vxp(n).attr(\"data-providerId\"),isExternal:$vxp(n).attr(\"data-isExternal\"),copyright:$vxp(n).attr(\"data-copyright\"),playerAdapter:$vxp(n).attr(\"data-playerAdapter\")}},ni=function(){for(var n in $vxp.vxpGlobal.players)($vxp.vxpGlobal.players[n].type==\"msn:silverlight\"||$vxp.vxpGlobal.players[n].type==\"msn:flash\")&&v(!0)};for(u in $vxp.vxpGlobal.players)$vxp.vxpGlobal.players[u].adapter&&$vxp.vxpGlobal.players[u].adapter.isAdPlaying()&&($vxp.vxpGlobal.players[u].type==\"msn:silverlight\"||$vxp.vxpGlobal.players[u].type==\"msn:flash\")&&v(!0);$vxp.subscribeEvent(\"adPlaying\",function(){l=!0,ni()},u,s),$vxp.subscribeEvent(\"adComplete\",function(){l=!1,v(!1)},u,s),$vxp.subscribeEvent(\"mmvClose\",function(){l=!1,v(!1)}),b=!1,f&&$vxp(n).parents(\".vxp_showcase\").length>0&&$vxp(n).find(\"li.vxp_gallery_item:first\").mouseover(),f&&$vxp(n).parents(\".vxp_filmstrip\").length>0&&$vxp(n).find(\"li.vxp_gallery_item:first\").mouseover(),rt=function(){var n=$vxp.vxpGlobal.geo.data();ct||(ct=!0,ri(n.countryFlags))},$vxp(n).subscribeEvent(\"galleryAddVideo\",function(t){ht=\"UserPlaylist\",$vxp(n).find(\".vxp_videoqueuegrid\").append(t),ut(t)}),$vxp.vxpGlobal.geo.isReady()?rt():$vxp(n).subscribeEvent(\"geoDataReady\",rt),nt=$vxp.vxpFind(\"div.vxp_videoModule\"),!bt||nt.find(\".vxp_widgetMode\").length||nt.find(\".vxp_slotMode\").length||$vxp(n).find(\"a.vxp_addToQueueButton\").addClass(\"active\"),a=t.smartpoolvideoids,a&&a!=\"\"&&!ti&&(st=a.split(\",\"),$vxp.vxpGlobal.smartPool.ping(w,i==\"Dtp\"||i==\"Gallery\"?\"pg\":\"vg\",{views:st})),kt()});(function(n){function b(i,u){n(i).find(\".vxp_motionThumb\").click(function(t){return t.preventDefault(),o||u(n(i)),!1}),n(i).find(\".vxp_motionThumb\").hover(function(){var e,s,i,o,h;t&&r(),n(this)[0].clickFunc=u,e=n(this).parents(\".vxp_gallery_item\").attr(\"data-motionThumb\"),s=\"motion_thumb_\"+y++;if(e==\"\"||e==f||!n.hasFlash(9))return;f=e,i=n(this).find(\".vxp_motionThumbContainer\"),o=n(this).find(\".vxp_thumb\"),i.width(o.width()),i.height(o.height()),h=it(e,s),i.html(h),t=n(this).find(\"OBJECT\"),t.css(\"position\",\"relative\"),t.css(\"left\",o.width()-1),i.css(\"background-position\",o.width()/2-12+\"px center\"),i.addClass(\"vxp_loading\")},function(){r()})}function tt(){if(t){var n=t.parents(\".vxp_motionThumb\")[0];n.clickFunc&&n.clickFunc(t.parents(\".vxp_gallery_item\"))}}function p(){setTimeout(function(){setTimeout(function(){t&&t.parent(\".vxp_motionThumbContainer\").removeClass(\"vxp_loading\")},0),t&&t.css(\"left\",\"0px\"),o=!0,l&&setTimeout(function(){t&&window.alert(\"Version: \"+t[0].getVersion())},100)},100)}function r(){o=!1;if(t){var n=t.parent(\".vxp_motionThumbContainer\");h(t[0]),n.html(\"\"),n.removeClass(\"vxp_loading\"),t=null,f=null}}function v(){var t,f,r,o;i=!i;if(c)return;t=\"\",f=window.location.host.split(\".\"),f.length>=3&&(t=\".\"+f.slice(-2).join(\".\"));var h=new RegExp(\"([&=])\"+s+\"=[0|1]\",\"i\"),e=s+\"=\"+(i?1:0),l=document.cookie.match(new RegExp(\"(^| )\"+u+\"=.*?(;|$vxp)\",\"i\")),n=u+\"=\";l&&(n=l[0],n=n.replace(/(^ +)|(;$vxp)/g,\"\"),n=n.replace(h,\"$vxp1\"+e)),n.match(h)||(n+=n==u+\"=\"?e:\"&\"+e),r=new Date,r.setTime(r.getTime()+w),o=[n,\"expires=\"+r.toGMTString(),\"path=\"+d],t!=\"\"&&o.push(\"domain=\"+t),document.cookie=o.join(\"; \")}function a(){if(c)i=!0;else{var n=document.cookie.match(new RegExp(\"(^| )\"+u+\"=.*?&?\"+s+\"=([01])\",\"i\"));i=!n||n[2]==\"0\"?!1:!0}}function h(t){if(n.browser.msie)try{t.style.display=\"none\";for(var i in t)typeof t[i]==\"function\"&&(t[i]=nul)}catch(r){}else t&&(t.style.display=\"none\")}function g(){for(var i=n(\".vxp_motionThumb OBJECT\"),t=i.length-1;t>=0;--t)h(i[t])}function it(n,t){a();var r=\"playerMode=embedded&playUrl=\"+encodeURIComponent(n)+\"&vMute=\"+i+\"&id=\"+t+\"&mode=\"+nt;return''}var y=0,e,t,k,f,i=!0,nt=\"fill\",o=!1,c=n(document.body).find(\".watchTemplate\").length>0,l=!1,u=\"SRCHHPGUSR\",s=\"VMUTE\",d=\"/\",w=63072e6;isBrowserSafari||(n.MotionThumb={status:function(n){n==\"Error\"&&r(),n==\"MouseOut\"&&(t.parents(\".vxp_tooltipTarget\").hover(),r()),n==\"NetStream.Play.Start\"&&p(),n==\"NetStream.Play.Stop\"&&r(),n==\"Click\"&&tt(),n==\"Mute\"&&v()},setPlayerUrl:function(n){e=n},setClickFunction:function(n){k=n},bind:function(n,t){b(n,t)},cleanAll:g,debug:function(n){l=n}})})($vxp);var nul=function(){};$vxp.browser.msie&&(window.onbeforeunload=function(){__flash_unloadHandler=nul,__flash_savedUnloadHandler=nul,__flash__removeCallback=function(n,t){n&&(n[t]=null)},$vxp.MotionThumb&&window.attachEvent(\"onunload\",$vxp.MotionThumb.cleanAll)});$vxp.registerWidget(\"pagedGallery\",function(n){function ct(){e!=null&&!isNaN(e)&&e>0?(e=Math.floor(e*1e3),ft()):e=0}function ft(){e>0&&(w(),v=setInterval(gt,e))}function w(){v!=-1&&(clearInterval(v),v=-1)}function ht(){rt=!1}function dt(){rt=!0}function gt(){if(!rt){var r=!1;$vxp(n).parents(\".vxp_tab_widget\").each(function(){$vxp(this).attr(\"data-selected\")==\"false\"&&(r=!0)}),r||(i0,i=t.currentpage,vt=t.totaldata,it=t.paginationstyle,s=!1,e=t.autopaginatedelay,v=-1,rt=!1,c,st=t.pagesize,l=t.activeitemindex,ot=l+1,bt=t.smartpooltkserviceurl,p=t.videocontent?t.videocontent.videoQuery.videoFilter:null,ti=p?p.dataCatalog.$:null,ii,ut=t.refreshkeyid,tt=t.refreshkeyvalue,yt=t.manualsmartpoolrefresh,kt=t.allowswipe,nt={},a,r,u,f,b,et,h,y;nt[i]=!0,a=!1,$vxp(n).registerDispose(function(){w(),c&&(clearTimeout(c),c=null),u&&$vxp(u).stop(!0,!1),r&&$vxp(r).stop(!0,!1),$vxp(n).stop(!0,!1)});if(t.doclientrefresh)if(p.type.$==\"SmartPool\"){$vxp.vxpGlobal.smartPool.getTargetingKey(bt,function(i){p.smartPoolTargetingKey={$:i},yt?$vxp(n).fireEvent(\"smartPoolRefreshReady\",i):($vxp(n).setConfig(\"VideoContent\",t.videocontent),$vxp(n).widgetRefresh())});return}$vxp(n).subscribeEvent(\"videoChanged\",function(t){var f=!1,r,i,e,o,u;if(tt)for(f=!0,r=t.refreshKeys,i=0;ii,i=f,a=$vxp(n).getConfig(\"PersistentQueryStringParams\"),s=!0,o=function(t){var f,e;if(it==\"Carousel\"&&$vxp(n).is(\":visible\")){var o=8,i=$vxp(u).width(),c=$vxp(u).height(),h=1e3;$vxp(n).find(\".vxpGalleryContainer\").width(i),$vxp(n).find(\".vxpGalleryContainer\").height(c),$vxp(n).find(\".vxpGalleryContainer\").css(\"position\",\"relative\"),$vxp(n).find(\".vxpGalleryContainer\").css(\"overflow\",\"hidden\"),$vxp(u).width(i),$vxp(u).css(\"position\",\"absolute\"),v?(f=i+o,e=-i):(f=-(i+o),e=i),$vxp(r).width(i),$vxp(r).css(\"position\",\"absolute\"),$vxp(r).css(\"left\",f+\"px\"),$vxp(r).css(\"display\",\"block\"),$vxp(u).animate({left:e},h),$vxp(r).animate({left:0},h,null,function(){$vxp(n).find(\".vxpGalleryContainer\").css(\"position\",\"static\"),$vxp(n).find(\".vxpGalleryContainer\").css(\"overflow\",\"visible\"),$vxp(u).css(\"position\",\"static\"),$vxp(u).css(\"display\",\"none\"),$vxp(r).css(\"position\",\"static\"),s=!1})}else $vxp(u).hide(),$vxp(r).show(),s=!1;ft(),t()},h=function(){u.attr(\"data-videolist\",\"back\"),r.attr(\"data-videolist\",\"front\"),g(),at=!1,$vxp(n).fireEvent(\"galleryPageChanged\",f)},$vxp(n).getConfig(\"RenderAllPages\")?(u=$vxp(n).find(\"div[data-videolist=front]\"),r=$vxp($vxp(n).find(\"div[data-videolist]\")[f-1]),o(h)):(r=$vxp(n).find(\"div[data-videolist=back]\"),u=$vxp(n).find(\"div[data-videolist=front]\"),e=$vxp(r).children(\".vxp_gallery\"),$vxp(e).getConfig(\"currentpage\")==f&&$vxp(e).html()?o(h):($vxp(n).setLoadingMode(!0),$vxp(e).setConfig(\"currentpage\",f),$vxp(e).setConfig(\"ActiveItemIndex\",l),$vxp(e).setConfig(\"VideoContent\",$vxp(n).getConfig(\"MmvGallery\")?\"\":t.videocontent),$vxp(e).setConfig(\"NoSpPing\",nt[f]?\"true\":\"false\"),a&&$vxp(e).setConfig(\"PersistentQueryStringParams\",a),nt[f]=!0,$vxp.browser.msie&&$vxp.browser.version<9||$vxp(n).animate({opacity:.4},200),$vxp(e).widgetRefresh(function(){c=setTimeout(function(){c=null,$vxp.browser.msie&&$vxp.browser.version<9||$vxp(n).animate({opacity:1},200),o(h)},100),$vxp(n).setLoadingMode(!1)}))),$vxp.fireEvent(\"PaginationPageChangedEvent\",f,lt+\"_paging\")},$vxp(n).subscribeEvent(\"paginationEvent\",function(n){loding=!0,n=parseInt(n),f(n)}),$vxp(n).subscribeEvent(\"updateActiveGalleryItem\",function(t){var u=t+1,r;u>=vt&&(u=0),r=wt(t),l=t,ot=u,r>0&&(r!=i?($vxp(n).find(\"div.vxp_gallery_item\").removeClass(\"vxpActiveItem\").removeClass(\"vxpUpNextItem\"),f(r),$vxp(n).fireEvent(\"PaginationPageChangedEvent\",r,$vxp(n).find(\".vxp_pagination\")),o()):g())}),$vxp(n).subscribeEvent(\"filterEvent\",function(t){var e=$vxp(n).getConfig(\"VideoContent\"),o=$vxp(n).getConfig(\"PersistentQueryStringParams\"),r=e.videoQuery.videoFilter,i,f,u;for(r.tags&&r.tags.tag?i=$vxp.asArray(r.tags.tag):(i=[],r.tags||(r.tags={})),r.tags.tag=i,f=!1,u=0;u.25&!s&&r>0&&r<=t.pagetotal&&(f(r),o())}}).bind(\"touchmove\",function(n){n.preventDefault();if(h!=-1){var e=n.originalEvent.touches[0],c=y=e.pageX,u=c-h,l=300,a=Math.min(1,Math.abs(u/l)),v=u<0,r=v?i+1:i-1;a>.5&&!s&&r>0&&r<=t.pagetotal&&(f(r),o())}}))}l!=0&&g(),ct()},function(n,t){var u=$vxp(n).getConfigs(),i,r;return t.label&&t.label!=\"\"&&(i=$vxp(n).parents(\".vxp_tabbedContainer\"),r=i.find(\".vxp_tab_widget\").index($vxp(n).parents(\".vxp_tab_widget\")),-1!=r&&$vxp(i.find(\".vxp_tab\").get(r)).html(t.label)),t});$vxp.registerWidget(\"filteredGallery\",function(n){$vxp(n).subscribeEvent(\"filterEvent\",function(t){var e=$vxp(n).getConfig(\"VideoContent\"),r=e.videoQuery.videoFilter,i,f,u;for(r.tags&&r.tags.tag?i=$vxp.asArray(r.tags.tag):(i=[],r.tags||(r.tags={})),r.tags.tag=i,f=!1,u=0;ue&&($vxp(r).remove(),i=!0);i?$vxp(n).find(\".vxp_searchFooter\").show():$vxp(n).find(\".vxp_searchFooter\").hide(),$vxp(n).find(\".vxp_searchTerm\").click(function(){return f($vxp(this).text()),!1})},f=function(t){if(t){r(),$vxp(n).find(\".vxp_searchBox\").attr(\"value\",t);var i=$vxp(n).find(\".vxp_searchGallery2\");$vxp(i).setLoadingMode(!0),$vxp(i).setConfig(\"QueryTerm\",t),$vxp(i).setConfig(\"ST\",\"UI\"),$vxp(i).widgetRefresh(function(){var i=$vxp(n).find(\".vxp_searchFooter .vxp_relatedSearchesList\"),t=i.html(),r;t?($vxp(n).find(\".vxp_searchHeader .vxp_relatedSearchesList\").empty(),e&&(t=\"\"+t+\"\"),$vxp(n).find(\".vxp_searchHeader .vxp_relatedSearchesList\").html(t),r=$vxp(i).attr(\"data-usedPopular\"),\"true\"==r?($vxp(n).find(\".vxp_searchHeader .vxp_popularSearchesLabel\").show(),$vxp(n).find(\".vxp_searchHeader .vxp_relatedSearchesLabel\").hide(),$vxp(n).find(\".vxp_searchFooter\").hide()):($vxp(n).find(\".vxp_searchHeader .vxp_popularSearchesLabel\").hide(),$vxp(n).find(\".vxp_searchHeader .vxp_relatedSearchesLabel\").show()),$vxp(n).find(\".vxp_searchHeader .vxp_relatedSearches\").show(),u()):$vxp(n).find(\".vxp_searchHeader .vxp_relatedSearches\").hide()})}};$vxp(n).find(\".vxp_searchBox\").each(function(){$vxp(this).focus(function(){r(),\"true\"==$vxp(this).attr(\"data-clearPrompt\")&&($vxp(this).attr(\"value\",\"\"),$vxp(this).attr(\"data-clearPrompt\",!1)),$vxp(this).select()}),$vxp(this).keypress(function(t){return 13==t.which?($vxp(n).find(\".vxp_searchButton\").click(),!1):!0})}),$vxp(n).find(\".vxp_searchButton\").click(function(){var t=$vxp(n).find(\".vxp_searchBox\");return\"true\"!=$vxp(t).attr(\"data-clearPrompt\")&&f(t.attr(\"value\")),!1}),u()});$vxp.registerWidget(\"searchGallery2\",function(n){function f(){if(t&&t.length){var n=$vxp(\".sw_qbox\");n.length&&n[0].value==\"\"&&(n[0].value=t)}}var t=$vxp(n).getConfig(\"QueryTerm\"),r,u,i;$vxp(n).find(\".vxp_hideResults\").click(function(){return $vxp(n).hide(),!1});if(null!=t&&$vxp.frontDoorMode){for(r=t.split(\" \"),u=[],i=0;i=f){var n=(t+1)%4;s(n,!0)}}}var h=$vxp(n).getConfig(\"EventTarget\"),c=$vxp(n).getConfig(\"AutoPlay\"),f=parseInt($vxp(n).getConfig(\"AutoPlayTime\")),t=0,r=0,e=500,o=.4,u=!1,i;$vxp(n).registerDispose(function(){l()}),$vxp(n).subscribeEvent(\"viewerPhotoChanged\",function(t){if(t&&t.metadata){var r=t.metadata.dataIndex,u=$vxp(n).find(\".vxpFlipperSmallPane\").eq(r),i=u.find(\".vxpFlipperAnchor\").attr(\"href\");i&&i!=\"#\"&&(document.location.href=i)}}),$vxp(n).find(\".vxpFlipperAnchor\").click(function(){var n=$vxp(this).attr(\"href\");return n!=\"#\"}),$vxp(n).find(\".vxpFlipperMetadata\").each(function(){var i=$vxp(this).find(\".vxpFlipperTitle\"),t=i.outerHeight();$vxp(this).css(\"opacity\",0).css(\"visibility\",\"visible\").css(\"height\",t),$vxp(this).animate({bottom:t+3,opacity:.8},e)}),$vxp(n).find(\".vxpFlipperSmallPane\").each(function(n){var r=t==n?0:o,i=$vxp(this).find(\".vxpFlipperOverlay\");i.css(\"opacity\",0).css(\"visibility\",\"visible\"),i.animate({opacity:r},e),$vxp(this).mouseover(function(){t!=n&&s(n,!1)})}),$vxp(n).hover(function(){u=!0},function(){u=!1}),i=setInterval(a,1e3)});$vxp.registerWidget(\"modernShowcase\",function(n){function ft(n,t,i,r){var e=$vxp(n).attr(\"data-blockType\"),u,f;e||($vxp(n).attr(\"data-blockType\",r),u=$vxp(n).find(\"a\"),u.unbind(\"click\").bind(\"click\",function(n){return n.preventDefault(),!1}),u.attr(\"href\",\"#\"),$vxp(n).children().each(function(n,t){$vxp(t).css(\"opacity\",.2)}),$vxp(n).find(\"img\").each(function(n,t){$vxp(t).css(\"opacity\",.2)}),f=$vxp('
    ').text(ut),$vxp(n).append(f))}function pt(){!k&&e.length==0&&+new Date-l>wt&&s()}function c(){i>0&&(e.push(-1),setTimeout(y,1))}function s(){i>0&&(e.push(1),setTimeout(y,1))}function y(){!p&&e.length>0&&(e.shift()==-1?lt():ct())}function lt(){var n=t==0?i-1:t-1;nt(n)}function nt(n){for(var f=0;f0&&($vxp(n).find(\"div.vxpModernShowcaseScrollPage\")[0].style.height=o,$vxp(n).find(\"div.vxpModernShowcasePagePanel1\").each(function(){$vxp(this)[0].style.height=o}),$vxp(n).find(\"div.vxpModernShowcasePagePanel2\").each(function(){$vxp(this)[0].style.height=o}),$vxp(n).find(\"div.vxpModernShowcasePagePanel3\").each(function(){$vxp(this)[0].style.height=o})),w=$vxp(n).find(\"#_heightTable\")[0],w.deleteRow(w.rows.length-1),$vxp(n).mouseover(function(){bt()}),$vxp(n).mouseout(function(){kt()}),$vxp(n).find(\"div.vxpModernShowcaseLeftChevron\").click(function(){c()}),$vxp(n).find(\"div.vxpModernShowcaseLeftChevron\").dblclick(function(){c()}),$vxp(n).find(\"div.vxpModernShowcaseRightChevron\").click(function(){s()}),$vxp(n).find(\"div.vxpModernShowcaseRightChevron\").dblclick(function(){s()}),$vxp(n).find(\"#_leftPagerChevron\").click(function(){c()}),$vxp(n).find(\"#_leftPagerChevron\").dblclick(function(){c()}),$vxp(n).find(\"#_rightPagerChevron\").click(function(){s()}),$vxp(n).find(\"#_rightPagerChevron\").dblclick(function(){s()}),$vxp(n).find(\"#_pageBlock\").each(function(){$vxp(this).click(function(){ot(this)})})});$vxp.registerWidget(\"showcase\",function(n){function y(){var t=$vxp(n).find(\".vxp_gallery_item\"),i,r=t.index($vxp(n).find(\".vxp_gallery_item.selected\"));i=r+10,i=$vxp(n).find(\".vxp_feature .vxp_image\"),s=$vxp(n).getConfig(\"Tracking\"),h,a;f=f<1?5:f,$vxp(n).registerDispose(function(){e()}),h=$vxp(n).getConfig(\"PlaybackMode\")==\"SamePage\"||$vxp(n).getConfig(\"PlaybackMode\")==\"Auto\"&&$vxp.vxpFind(\"div.vxp_player\").length>0,$vxp(n).find(\".vxp_gallery_item .vxp_title.vxp_tl1\").each(function(){$vxp(this).removeClass(\"vxp_tl1\").addClass(\"vxp_tb2\")}),$vxp(n).find(\".vxp_feature .vxp_image, .vxp_feature .vxp_anchor\").click(function(){var i,t,r;return h?(i=$vxp.updateTracking(\"Show\",\"main\",s),$vxp.fireEvent(\"playVideo\",{id:$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-id\"),playerType:$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-playerType\"),playerSource:i,mode:\"click\"})):(t=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"href\"),r=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"target\"),t&&($vxp.writeTrackingCookie(\"Show\",\"main\",s),r==\"_blank\"?window.open(t,\"_blank\"):window.location=t)),!1}),$vxp(n).subscribeEvent(\"galleryItemHover\",function(n){l(n,!u),u&&e()}),$vxp(n).mouseout(function(){e(),c()}),c(),a=i.eq(0).attr(\"src\"),$vxp(n).find(\".vxp_gallery_item\").each(function(){var n=$vxp(this).attr(\"data-selectedImgSrc\");n!=a&&$vxp('')})});$vxp.registerWidget(\"superShowcase\",function(n){function ut(){var u=!1,i=$vxp(n).getConfig(\"ZuneFlight\"),t,f,r;if(i){u=!0,i=\"=\"+i.toLowerCase()+\"&\",t=$vxp.cookie(\"OVR\");if(t)for(t=t.toLowerCase(),f=t.split(\"&\"),r=0;ru){i=200,$vxp(n).hasClass(\"vxp_descriptionMedium\")?i=400:$vxp(n).hasClass(\"vxp_descriptionLarge\")&&(i=750),$vxp(n).find(\".vxp_expand\").show();while($vxp(n).attr(\"scrollHeight\")>u&&t.length>1)t=t.length>i?t.substr(0,i):t.substr(0,t.length-1),$vxp(r).text(t);while(t.substr(t.length-1,1)==\" \"||t.substr(t.length-1,1)==\".\")t=t.substr(0,t.length-1);$vxp(r).text(t)}$vxp(n).data(\"trimText\",t)}}function c(n){f&&(clearInterval(f),f=null),!0==n&&o&&(clearInterval(o),o=null)}function l(t){var i;c(!0);var r=$vxp(n).find(\".vxp_pages .vxp_current\")[0],u=$vxp(r).find(\".vxp_page2\"),f=$vxp(t).find(\".vxp_page2\");if(r.className==t.className)return;$vxp(r).removeClass(\"vxp_current\"),$vxp(u).removeClass(\"vxp_bg2\"),$vxp(u).addClass(\"vxp_bg1\"),$vxp(t).addClass(\"vxp_current\"),$vxp(f).addClass(\"vxp_bg2\"),$vxp(f).removeClass(\"vxp_bg1\"),i=$vxp(n).find(\".vxp_features .vxp_feature\"+$vxp(t).attr(\"data-feature\")),$vxp(n).find(\".vxp_features .vxp_current\").removeClass(\"vxp_current\").fadeOut(250),$vxp(i).addClass(\"vxp_current\"),o=setTimeout(function(){$vxp(i).fadeIn(250),v($vxp(i).find(\".vxp_description\")),$vxp.updateScrolling($vxp(i).find(\".vxp_scrollable\"))},250)}function nt(){var t=$vxp(n).find(\".vxp_pages .vxp_current\").prev();return $vxp(t).length||(t=$vxp(n).find(\".vxp_pages .vxp_page:last\")),l($vxp(t)[0]),!1}function k(){var t=$vxp(n).find(\".vxp_pages .vxp_current\").next();return $vxp(t).length||(t=$vxp(n).find(\".vxp_pages .vxp_page:first\")),l($vxp(t)[0]),!1}function h(){f||(f=setInterval(function(){k(),h()},s*1e3))}function g(){var h=!1,t=$vxp.cookie(\"SRCHHPGUSR\"),e,s,o,f,n;if(t){for(n=t.split(\"&\"),e=0;el))break;0>r.indexOf(\":\")?(f=r.indexOf(\"am\"),0>f&&(f=r.indexOf(\"pm\")),0>f&&(f=r.indexOf(\")\")),e+=0>f?i[t]+\":00 \":r.substr(0,f)+\":00\"+r.substr(f)+\" \"):e+=i[t]+\" \",++t}for(u=0;u=i.length&&(y=!0)}return b=new Date,p[b.getDay()]}function tt(t,i){var r,u,f=!1;return t?(r=i.getUTCHours(),11=r?t=$vxp(n).getConfig(\"MinAgoStringFormat\").replace(\"{0}\",\"1\"):60>r?t=$vxp(n).getConfig(\"MinsAgoStringFormat\").replace(\"{0}\",r):(r=parseInt((f+18e5)/36e5),t=1>=r?$vxp(n).getConfig(\"HourAgoStringFormat\").replace(\"{0}\",\"1\"):24>r?$vxp(n).getConfig(\"HoursAgoStringFormat\").replace(\"{0}\",r):p(!1,u)),t}function rt(n){return function(){return ft?BingPopup.comingSoon():BingPopup.play(n.songId,n.songTitle,n.artistName,n.albumName,n.albumId,n.artistId,n.lyricsUrl,n.isDto,n.isPreviewOnly,n.isExplicit),!1}}function t(n){$vxp(n).hasClass(\"vxp_current\")&&$vxp.updateScrolling($vxp(n).find(\".vxp_scrollable\"))}function d(){$vxp(n).find(\".vxp_feature\").each(function(){var f=this,c=$vxp(f).attr(\"data-objectType\"),s=$vxp(f).attr(\"data-queryData\"),o={},h;if(s&&c)switch(c.toLowerCase()){case\"tvshow\":$vxp(f).find(\".vxp_tvShow .vxp_castCrew\").length&&($vxp(f).find(\".vxp_tvShow .vxp_links .vxp_link.vxp_tl2\").length?($vxp(f).find(\".vxp_tvShow .vxp_links\").css(\"height\",\"auto\"),$vxp(f).find(\".vxp_tvShow .vxp_castCrew\").show(),t(f)):(o.Sources=\"Entertainment\",o[\"Entertainment.ListAnswer.Scenario\"]=\"TVShowsCastCrew\",o.Query=s,o.Version=\"2.4\",o.AppId=$vxp(n).getConfig(\"BingApiAppId\"),o.Market=$vxp(n).getConfig(\"BingMarket\"),$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",o,function(n){var c=null,u,i,s,o,h;if(n.SearchResponse&&n.SearchResponse.Entertainment&&n.SearchResponse.Entertainment.Results&&n.SearchResponse.Entertainment.Results.length)for(u=n.SearchResponse.Entertainment.Results,i=0;i, \")),h=$vxp(''),$vxp(h).attr(\"href\",e(\"search?\",l[o].ReQuery)),$vxp(h).text(l[o].Value),$vxp(r).append(h);if(o&&$vxp(r).height()>s){$vxp(r).find(\":last-child\").remove(),$vxp(r).find(\":last-child\").remove();break}}$vxp(f).css(\"display\")==\"inline-block\"&&($vxp(f).css(\"display\",\"none\"),$vxp(f).css(\"visibility\",\"visible\"))}t(f)})));break;case\"musicartist\":o.AppId=$vxp(n).getConfig(\"BingApiAppId\"),o.Market=$vxp(n).getConfig(\"BingMarket\"),$vxp(f).find(\".vxp_musicArtist .vxp_songs\").length&&(o.Sources=\"Entertainment\",o.Query=\"Songs by \"+s,o.Version=\"2.4\",$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",o,function(i){var d=null,h,u,p,c,ft,o,et,g,ot;if(i.SearchResponse&&i.SearchResponse.Entertainment&&i.SearchResponse.Entertainment.Results&&i.SearchResponse.Entertainment.Results.length)for(h=i.SearchResponse.Entertainment.Results,u=0;ub;++p){var r=nt[p],a=r.Name,v=null;r.MediaId&&(v=r.MediaId.ZuneMediaId);if(a&&v){var l=$vxp('
    '),tt=\"\",it=\"\",k=\"\",ut=\"\",y=\"\";r.Albums&&r.Albums.length&&r.Albums[0].MediaId&&r.Albums[0].MediaId.ZuneMediaId&&(k=r.Albums[0].MediaId.ZuneMediaId,ut=r.Albums[0].Name),r.Artists&&r.Artists.length&&r.Artists[0].ContributorId&&(tt=r.Artists[0].ContributorId,it=r.Artists[0].Name),r.MediaId.LyricsAMGId&&(y=e(\"music/lyrics/detail?lyricsID=\"+encodeURIComponent(r.MediaId.LyricsAMGId)+\"&albumID=\"+encodeURIComponent(k)+\"&songID=\"+encodeURIComponent(v)+\"&\",s+\" \"+a,w)),c=null,r.IsStreamable&&(c=$vxp(''),$vxp(c).attr(\"href\",\"#\"),$vxp(c).attr(\"title\",$vxp(n).getConfig(\"PlaySongStringFormat\").replace(\"{0}\",a)),ft={songId:v,songTitle:a,artistName:it,albumName:ut,albumId:k,artistId:tt,lyricsUrl:y,isDto:r.IsDTO,isPreviewOnly:r.IsPreviewOnly,isExplicit:r.IsExplicit},$vxp(c).click(rt(ft))),c&&($vxp(l).append(c),o=$vxp(''),et=e(\"music/songs/search?songID=\"+encodeURIComponent(v)+\"&\",s+\" \"+a,w),$vxp(o).attr(\"href\",et),$vxp(o).text(a),$vxp(l).append(o),y&&($vxp(o).addClass(\"vxp_hasLyrics\"),g=$vxp('·'),$vxp(l).append(g),o=$vxp(''),$vxp(o).attr(\"href\",y),$vxp(o).text($vxp(n).getConfig(\"LyricsString\")),$vxp(l).append(o)),ot=$vxp('
    '),$vxp(l).append(ot),$vxp(ht).append(l),b++)}}b&&$vxp(f).find(\".vxp_musicArtist .vxp_songs\").show()}t(f)})),h=function(){if($vxp(f).find(\".vxp_musicArtist .vxp_news\").length){var i={};i.Sources=\"News\",i[\"News.Category\"]=\"rt_Entertainment\",i.Query=s+\" News\",i.Version=\"2.3\",i.AppId=$vxp(n).getConfig(\"BingApiAppId\"),i.Market=$vxp(n).getConfig(\"BingMarket\"),$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",i,function(n){var e,i,o,s,u,r;if(n.SearchResponse&&n.SearchResponse.News&&n.SearchResponse.News.Results&&n.SearchResponse.News.Results.length){var l=new Date,a=$vxp(f).find(\".vxp_musicArtist .vxp_news .vxp_links\"),c=n.SearchResponse.News.Results,h=c.length;for(h>2&&(h=2),e=0;e'),s=$vxp(''),$vxp(s).attr(\"href\",i.Url),$vxp(s).text(i.Title),$vxp(o).append(s),(i.Snippet||i.Source||i.Date)&&(u=$vxp('
    '),i.Snippet&&(r=$vxp(''),$vxp(r).text(i.Snippet),$vxp(u).append(r)),i.Source&&(r=$vxp(''),$vxp(r).text(i.Source),$vxp(u).append(r)),i.Date&&(r=$vxp(''),$vxp(r).text(it(i.Date,l)),$vxp(u).append(r)),$vxp(o).append(u)),$vxp(a).append(o));$vxp(f).find(\".vxp_musicArtist .vxp_news\").show()}t(f)})}},$vxp(f).find(\".vxp_musicArtist .vxp_events\").length?(o.Sources=\"Events\",o.Query=s+\" Events\",o.Version=\"2.3\",$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",o,function(n){var l,i,u,r,d,c,o,g;if(n.SearchResponse&&n.SearchResponse.Events&&n.SearchResponse.Events.Results&&n.SearchResponse.Events.Results.length){var it=new Date,nt=$vxp(f).find(\".vxp_musicArtist .vxp_events .vxp_links\"),b=n.SearchResponse.Events.Results,a=b.length;for(a>3&&(a=3),l=0;l'),w=$vxp(''),k=e(\"events/search?p1=\"+encodeURIComponent('[Events source=\"vertical\" qzeventid=\"'+i.Id+'\"]')+\"&\",s);$vxp(w).attr(\"href\",k),$vxp(w).text(i.Name),$vxp(v).append(w),(i.StartTime||i.Location&&i.Location.Name)&&(u=null,r=$vxp(''),i.StartTime&&(u=y(i.StartTime,parseInt(i.StartTimeOffset)*6e4),o=$vxp(''),$vxp(o).text(p(!0,u)),$vxp(r).append(o)),i.Location&&i.Location.Name&&(i.StartTime&&(d=$vxp('·'),$vxp(r).append(d)),c=$vxp(''),u&&$vxp(c).addClass(\"vxp_hasTime\"),$vxp(c).attr(\"href\",k+\"#venue\"),$vxp(c).text(i.Location.Name),$vxp(r).append(c)),u&&(o=$vxp(''),$vxp(o).text(tt(!0,u)),$vxp(r).append(o)),g=$vxp('
    '),$vxp(r).append(g),$vxp(v).append(r)),$vxp(nt).append(v)}}$vxp(f).find(\".vxp_musicArtist .vxp_events\").show(),t(f)}else h()})):h();break;case\"movie\":$vxp(f).find(\".vxp_movie .vxp_showTimes\").length&&(o={},o.Sources=\"Showtimes\",o.Query=s,o.Version=\"2.3\",o.AppId=$vxp(n).getConfig(\"BingApiAppId\"),o.Market=$vxp(n).getConfig(\"BingMarket\"),$vxp(f).find(\".vxp_movie .vxp_location .vxp_dot\").hide(),i&&r&&(o.Latitude=i,o.Longitude=r,u&&($vxp(f).find(\".vxp_movie .vxp_location .vxp_name\").text(u),$vxp(f).find(\".vxp_movie .vxp_location .vxp_dot\").show())),$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",o,function(i){var u,l,r;if(i.SearchResponse&&i.SearchResponse.Showtimes&&i.SearchResponse.Showtimes.Results&&i.SearchResponse.Showtimes.Results.length){var a=$vxp(f).find(\".vxp_movie .vxp_links\"),v=i.SearchResponse.Showtimes.Results,s=v.length;for(s>3&&(s=3),u=0;u'),c=$vxp('');$vxp(c).attr(\"href\",e(\"movies/search?\",o.ShowtimeResultTitle)),r=o.ShowtimeResultTitle;if(30'),r=null,o.Times&&(r=et(o.Times)),r||(r=$vxp(n).getConfig(\"NoShowtimesString\")),$vxp(l).text(\": \"+r),$vxp(h).append(l),$vxp(a).append(h)}$vxp(a).show()}else $vxp(f).find(\".vxp_movie .vxp_noLinks\").show();$vxp(f).find(\".vxp_movie .vxp_showTimes\").show(),t(f)}));break;case\"gameoffline\":($vxp(f).find(\".vxp_gameOffline .vxp_walkthroughs\").length||$vxp(f).find(\".vxp_gameOffline .vxp_cheats\").length)&&(o.Sources=\"Entertainment\",o.Query=s,o.Version=\"2.4\",o.AppId=$vxp(n).getConfig(\"BingApiAppId\"),o.Market=$vxp(n).getConfig(\"BingMarket\"),$vxp.getJSON($vxp(n).getConfig(\"BingApiBase\")+\"json.aspx?JsonType=Callback&JsonCallback=?\",o,function(n){var e,h,n,c,l,r,i,u;if(n.SearchResponse&&n.SearchResponse.Entertainment&&n.SearchResponse.Entertainment.Results&&n.SearchResponse.Entertainment.Results.length){var o=[],s=[],a=n.SearchResponse.Entertainment.Results;for(i=0;i2&&(r=2),i=0;i'),$vxp(u).attr(\"href\",o[i].url),$vxp(u).text(o[i].title),$vxp(l).append(u);$vxp(f).find(\".vxp_gameOffline .vxp_walkthroughs\").show()}if($vxp(f).find(\".vxp_gameOffline .vxp_cheats\").length&&02&&(r=2),i=0;i'),$vxp(u).attr(\"href\",s[i].url),$vxp(u).text(s[i].title),$vxp(l).append(u);$vxp(f).find(\".vxp_gameOffline .vxp_cheats\").show()}}t(f)}))}})}var f,o=null,s=parseInt($vxp(n).getConfig(\"AutoAdvanceTime\")),w=$vxp(n).getConfig(\"SongFlight\"),ft=ut(),a,b;s=s<1?5:s,$vxp(n).registerDispose(function(){c(!0)});if(!$vxp(n).find(\".vxp_features\").length)return;var ot=!1,i=0,r=0,u=\"\";$vxp(n).find(\".vxp_feature .vxp_anchor\").click(function(){var n=$vxp(this).attr(\"href\"),t=$vxp(this).attr(\"target\");return n&&(t==\"_blank\"?window.open(n,\"_blank\"):window.location=n),!1}),a=!0,$vxp(n).find(\".vxp_feature .vxp_detailPane\").each(function(){var n=$vxp(this).find(\".vxp_description\"),r=$vxp(n).find(\".vxp_descText\"),t=$vxp(n).find(\".vxp_expand\"),i=$vxp(n).find(\".vxp_contract\"),u=$vxp(this).find(\".vxp_scrollable\");a&&(v(n),a=!1),t.click(function(){$vxp(t).hide(),$vxp(i).show(),$vxp(r).text($vxp(n).data(\"origText\")),$vxp.updateScrolling(u)}),i.click(function(){$vxp(t).show(),$vxp(i).hide(),$vxp(r).text($vxp(n).data(\"trimText\")),$vxp.updateScrolling(u)})}),$vxp(n).find(\".vxp_page\").attr(\"href\",\"#\").click(function(){return l(this),!1}),$vxp(n).find(\".vxp_prevButton\").attr(\"href\",\"#\").click(nt),$vxp(n).find(\".vxp_nextButton\").attr(\"href\",\"#\").click(k),h(),$vxp(n).hover(c,h),g()?setTimeout(d,250):(b=$vxp.getPageWidget().getConfig(\"ServicesRoot\")+\"/user/settings?callback=?\",$vxp.getJSON(b,{responseEncoding:\"json\"},function(n){n&&n.user&&n.user.settings&&n.user.settings.location&&n.user.settings.location.$&&n.user.settings.location.$latitude&&n.user.settings.location.$longitude&&(i=parseFloat(n.user.settings.location.$latitude),r=parseFloat(n.user.settings.location.$longitude),u=n.user.settings.location.$,$vxp.cookie(\"videouserloc\",u+\"|\"+i+\"|\"+r,30)),d()}))});$vxp.registerWidget(\"filmstrip\",function(n){function k(t){var r,u,i,f;if(b){i=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"href\"),r=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-id\")||$vxp(t).find(\".vxp_motionThumb\").attr(\"data-instKey\");try{PlayVideo(r,i)}catch(e){}}else w?(u=$vxp.updateTracking(\"Show\",\"main\",nt),$vxp.fireEvent(\"playVideo\",{id:$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-id\"),playerType:$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-playerType\"),playerSource:u,mode:\"click\"})):(i=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"href\"),f=$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"target\"),i&&($vxp.writeTrackingCookie(\"Show\",\"main\",nt),f==\"_blank\"?window.open(i,\"_blank\"):window.location=i));return!1}function d(){var i=$vxp(n).find(\".vxp_gallery_item\"),u=i.index($vxp(n).find(\".vxp_gallery_item.selected\")),t=u+1,r;t>=i.length&&(t=0),r=$vxp(i[t]),v(t,o),r.mouseover()}function f(){try{u&&(clearInterval(u),u=null)}catch(n){}}function a(){f();if(!l){u=setInterval(function(){f(),i=!1,d(),i=!0},1);return}u=setInterval(function(){i=!1,d(),i=!0},h*1e3)}function g(t,i){var h,u,s;if(i&&l)h=r.eq(e%2),u=r.eq((e+1)%2),e++,u.attr(\"alt\",t.title.text()).attr(\"src\",t.selectedImage),u.css({opacity:0,zIndex:1,visibility:\"visible\"}),h.css(\"z-index\",0),u.animate({opacity:1},1e3),g(t,!1);else{$vxp(n).find(\".vxp_feature .vxp_hidePrompt\").removeClass(\"vxp_hidePrompt\");var f=$vxp(n).find(\".vxp_feature .vxp_title\"),o=$vxp(n).find(\".vxp_feature .vxp_description\"),c=$vxp(n).find(\".vxp_feature .vxp_text\");$vxp(o).css(\"overflow\",\"visible\").css(\"height\",\"auto\").css(\"max-height\",\"none\"),$vxp(this).setSizedText(f,f,t.wholeTitle,100),$vxp(f).css(\"overflow\",\"visible\"),$vxp(f).attr(\"title\",t.wholeTitle),$vxp(this).setSizedText(c,o,t.description,300),$vxp(o).attr(\"title\",t.description),s=t.playerLink,$vxp.frontDoorMode&&isBrowserSafari&&t.externalLink&&!$vxp.hasFlash(9)&&(s=t.externalLink),$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"href\",s),$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-id\",t.id),$vxp(n).find(\".vxp_feature .vxp_anchor\").attr(\"data-playerType\",t.playerType),r.eq(e%2).attr(\"alt\",t.title.text()).attr(\"src\",t.selectedImage),r.eq(e%2).attr(\"src\",t.selectedImage),$vxp(n).find(\".vxp_feature .vxp_anchor\").removeAttr(\"target\")}l=!0}function v(i,r){var e=$vxp(n).find(\".vxp_gallery_item\"),o,f,u;if(i>=0){for(f=Math.floor(e.length/t),f!=e.length/t&&f++,u=0;u=u*t&&i<(u+1)*t&&(s=u*t,o=u*y);$vxp(n).find(\"div.vxp_GalleryColumnButLast\").animate({scrollLeft:o},r),s==0?($vxp(n).find(\"div.vxp_left_arrow\").removeClass(\"vxp_arrowEnabled\").addClass(\"vxp_arrowDisabled\"),$vxp(n).find(\"#filmstripLeftArrowNormal\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripLeftArrowDisabled\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripLeftArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\")):($vxp(n).find(\"div.vxp_left_arrow\").removeClass(\"vxp_arrowDisabled\").addClass(\"vxp_arrowEnabled\"),$vxp(n).find(\"#filmstripLeftArrowNormal\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripLeftArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripLeftArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"))}}var u,i,l,e=0,h=parseInt($vxp(n).getConfig(\"AutoAdvanceTime\")),r=$vxp(n).find(\".vxp_feature .vxp_image\"),nt=$vxp(n).getConfig(\"Tracking\"),t=parseInt($vxp(n).getConfig(\"VideosPerPage\")),o=parseInt($vxp(n).getConfig(\"AnimationSpeed\")),y=500,s=0,w,b,c,p,tt;h=h<1?5:h,t=t<1?4:t,y=125*t,o=o<1?2e3:o,w=$vxp(n).getConfig(\"PlaybackMode\")==\"SamePage\"||$vxp(n).getConfig(\"PlaybackMode\")==\"Auto\"&&$vxp.vxpFind(\"div.player\").length>0,b=$vxp(n).getConfig(\"CallExternalMethodForPlayback\")==!0,$vxp(n).registerDispose(function(){try{f(),$vxp(n).find(\"div.vxp_GalleryColumnButLast\").each(function(){$vxp(this).stop(!0,!1)}),r.each(function(){$vxp(this).stop(!0,!1)})}catch(t){}}),$vxp(n).find(\".vxp_gallery_item .vxp_title.vxp_tl1\").each(function(){$vxp(this).removeClass(\"vxp_tl1\").addClass(\"vxp_tb2\")}),$vxp(n).find(\".vxp_feature .vxp_image, .vxp_feature .vxp_anchor, .vxp_galleryThumb .vxp_motionThumb\").each(function(){var n=$vxp(this);n.unbind(\"click\").click(function(){return k(n)})}),$vxp(n).find(\"div.vxp_right_arrow\").click(function(){c(!0)}),$vxp(n).find(\"div.vxp_left_arrow\").click(function(){c(!1)}),$vxp(n).find(\".vxp_gallery_item\").length<=t?($vxp(n).find(\"div.vxp_right_arrow\").removeClass(\"vxp_arrowEnabled\").addClass(\"vxp_arrowDisabled\"),$vxp(n).find(\"#filmstripRightArrowNormal\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripRightArrowDisabled\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripRightArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\")):($vxp(n).find(\"div.vxp_right_arrow\").removeClass(\"vxp_arrowDisabled\").addClass(\"vxp_arrowEnabled\"),$vxp(n).find(\"#filmstripRightArrowNormal\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripRightArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripRightArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\")),$vxp(n).find(\"div.vxp_left_arrow\").hover(function(){$vxp(this).hasClass(\"vxp_arrowDisabled\")||($vxp(n).find(\"#filmstripLeftArrowNormal\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripLeftArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripLeftArrowHover\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"))},function(){$vxp(this).hasClass(\"vxp_arrowDisabled\")||($vxp(n).find(\"#filmstripLeftArrowNormal\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripLeftArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripLeftArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"))}),$vxp(n).find(\"div.vxp_right_arrow\").hover(function(){$vxp(this).hasClass(\"vxp_arrowDisabled\")||($vxp(n).find(\"#filmstripRightArrowNormal\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripRightArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripRightArrowHover\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"))},function(){$vxp(this).hasClass(\"vxp_arrowDisabled\")||($vxp(n).find(\"#filmstripRightArrowNormal\").removeClass(\"vxp_arrowHidden\").addClass(\"vxp_arrowVisible\"),$vxp(n).find(\"#filmstripRightArrowDisabled\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"),$vxp(n).find(\"#filmstripRightArrowHover\").removeClass(\"vxp_arrowVisible\").addClass(\"vxp_arrowHidden\"))}),c=function(r){var f=$vxp(n).find(\".vxp_gallery_item\"),u;r?u=s+t:(u=s-t,u<0&&(u=0)),u>=f.length&&(u=0),nextSelectedVideoNode=$vxp(f[u]),v(u,o),i=!1,nextSelectedVideoNode.mouseover()},$vxp(n).subscribeEvent(\"galleryItemHover\",function(n){g(n,!i),i?f():a(),i=!0}),$vxp(n).mouseout(function(){f(),a()}),p=n,$vxp(n).find(\".vxp_gallery_item\").each(function(){var t=$vxp(this);t.focusin(function(){var n=$vxp(p).find(\".vxp_gallery_item\"),i=n.index(t);v(i,0),t.mouseover()}),t.unbind(\"keydown\").keydown(function(t){if(t.keyCode==13||t.keyCode==32)return k($vxp(n).find(\".vxp_feature .vxp_image\")[0])})}),a(),tt=r.eq(0).attr(\"src\"),$vxp(n).find(\".vxp_gallery_item\").each(function(){var n=$vxp(this).attr(\"data-selectedImgSrc\");n!=tt&&$vxp('')})});$vxp.registerWidget(\"photoViewer\",function(n){function tr(n,t,i){var r=n,u=r.indexOf(t);while(u!=-1)r=r.replace(t,i),u=r.indexOf(t);return r}function lr(){d&&(clearInterval(d),d=null),k&&(clearInterval(k),k=null)}function gt(t){var i=$vxp(n).find(\".vxpPhotoViewerLeftArrowContainer\");t?i.addClass(\"active\"):i.removeClass(\"active\")}function ni(t){var i=$vxp(n).find(\".vxpPhotoViewerRightArrowContainer\");t?i.addClass(\"active\"):i.removeClass(\"active\")}function ti(n){n?(pt.hide(),ct.show()):(pt.show(),ct.hide())}function ii(n){n?(r&&s&&(r.css(\"visibility\",\"visible\"),s.css(\"visibility\",\"visible\")),b&&b.css(\"visibility\",\"visible\")):(r&&s&&(r.css(\"visibility\",\"hidden\"),s.css(\"visibility\",\"hidden\")),b&&b.css(\"visibility\",\"hidden\"))}function v(){var n=t>=vi?0:t+1;u(n,\"slide\")}function u(r,u){var c,s,v,y,w;if(r!=t){c=$vxp(n).find(\".vxpPhotoViewerLayer\").eq(t),s=$vxp(n).find(\".vxpPhotoViewerLayer\").eq(r);if(s.length){pi(r),p&&h<=0&&(g.hide(),p=!1,$vxp.fireEvent(\"photoViewerAdCompleted\",null,i),u=null),ri>0&&at>ri&&(h=cr,at=1,rt?1:-1,w=$vxp(n).width(),s.css({left:w*y,opacity:null,visibility:\"visible\"}).animate({left:0},v),v.complete=null,c.animate({left:w*y*-1},v);break;default:s.css({left:0,opacity:null,visibility:\"visible\"}),c.css(\"visibility\",\"hidden\")}tt&&(s.find(\".vxpPhotoViewerTitle\").html()!=null&&s.find(\".vxpPhotoViewerTitle\").html()!=\"\"&&($vxp(\"h3.vxpSlideshowTitle\").html(s.find(\".vxpPhotoViewerTitle\").html()),document.title=s.find(\".vxpPhotoViewerTitle\").html()),document.title=document.title.split(\"#\")[0]),t=r,ut=0}else!or&&f&&(o(e,\"\",l,\"PlayEnd\",a,\"qs\",\"gallery\"),lt500;i=r?t?c+\" \"+ur+\"\":c.substr(0,500)+\" \"+fr+\"\":c,ir&&(i=\"\"+i+\"\"),s.html(i),$vxp(n).find(\"a.vxpPhotoViewerImageDescriptionMore\").click(function(){return ht(!0),!1}),$vxp(n).find(\"a.vxpPhotoViewerImageDescriptionLess\").click(function(){return ht(!1),!1})}}function di(n){var t,i;n&&n.metadata&&n.metadata.dataIndex==0?gt(!1):gt(!0),n&&n.metadata&&n.metadata.dataIndex+1=ai&&v();if(rt){var t=$vxp(\"#\"+yt).find(\".slideshowMetadata\");t.length&&($vxp(n).fireEvent(\"photoChanged\",{metadata:rt},t),rt=null)}}function gi(){return ki.sitetypename==\"image\"}function bi(){var n=window.location.pathname,t=n.lastIndexOf(\"/\"),i=!1;return t>0&&(n=n.substr(t),n.toLowerCase().indexOf(\"/search\")==0&&(i=!0)),i}function kt(){var t=NaN,i;return(!tt||ft)&&window.location.hash!=null&&window.location.hash.length>0&&(t=parseInt(window.location.hash.substr(1)),i=$vxp(n).find(\".vxpPhotoViewerLayer\").eq(t-1),i.length==0&&(t=NaN)),t}function it(){fi=window.location.hash;var n=kt();isNaN(n)||(y=n-1,u(y,null))}function ar(){window.location.hash!=fi&&it()}var ki=$vxp(n).getConfigs(),i=$vxp(n).getConfig(\"EventTarget\"),li=parseInt($vxp(n).getConfig(\"PhotoHeight\")),t=parseInt($vxp(n).getConfig(\"Index\")),f=$vxp(n).getConfig(\"AutoPlay\"),rr=$vxp(n).getConfig(\"AdvanceOnClick\"),ai=parseInt($vxp(n).getConfig(\"AutoPlayTime\")),vi=parseInt($vxp(n).getConfig(\"Count\")),yt=$vxp(n).getConfig(\"MetadataNodeId\"),oi=$vxp(n).getConfig(\"AdNodeId\"),ut=0,ri=$vxp(n).getConfig(\"AdFrequency\"),cr=$vxp(n).getConfig(\"AdDuration\"),vt=$vxp(n).getConfig(\"ReportImagePings\")==!0,hr=$vxp(n).getConfig(\"ReportingType\"),sr=$vxp(n).getConfig(\"ReportingFr\"),or=$vxp(n).getConfig(\"EndSlate\")!=\"None\",ei=$vxp(n).getConfig(\"SlideshowPlaylist\"),lt=0,at=0,h=0,p=!1,er=500,rt,ci=!1,g=$vxp(n).find(\".vxpSlideshowAd\"),b=$vxp(n).find(\".vxpPhotoViewerPagination .vxp_pagination\"),pt=$vxp(n).find(\".vxpPhotoViewerPlay\"),ct=$vxp(n).find(\".vxpPhotoViewerPause\"),wt=$vxp(n).find(\".vxpPhotoViewerShowThumbnails\"),st=$vxp(n).find(\".vxpPhotoViewerHideThumbnails\"),yi=$vxp(n).find(\".vxpPhotoViewerGallery\"),r=$vxp(n).find(\".vxpPhotoViewerImageTitle\"),s=$vxp(n).find(\".vxpPhotoViewerImageDescription\"),fr=$vxp(n).find(\".vxpPhotoViewerMore\")?$vxp(n).find(\".vxpPhotoViewerMore\").text():\"...more\",ur=$vxp(n).find(\".vxpPhotoViewerLess\")?$vxp(n).find(\".vxpPhotoViewerLess\").text():\"...less\",c=\"\",nt=$vxp(n).find(\".vxpPhotoViewerImageAttribution\"),e=\"\",a=\"\",l=\"\",si=-1,nr=$vxp.getPlaySource(),ir=/chrome/.test(window.navigator.userAgent.toLowerCase()),tt=bi(),ot=window.location.href.toLowerCase().split(\"/\"),ft=ot[3]==\"slideshow\"&&ot[4]==\"photo\"&&ot[6].indexOf(\"search\")!=-1,y=kt(),fi=null,bt=!0,d,k,et;$vxp(n).registerDispose(function(){lr()}),et=!0,document.referrerRefreshTrcking=document.referrer==null||document.referrer.length==0?document.location.href:document.referrer,$vxp.find(\"div.vxpSlideshow\").length>0&&(e=$vxp.find(\"div.vxpSlideshowGalleryId\").length>0?$vxp.find(\"div.vxpSlideshowGalleryId\")[0].innerText:\"\",a=$vxp.find(\"div.vxpSlideshowGalleryAdPageGroup\").length>0?$vxp.find(\"div.vxpSlideshowGalleryAdPageGroup\")[0].innerText:\"\",l=$vxp.find(\"div.vxpSlideshowGalleryDataCount\").length>0?$vxp.find(\"div.vxpSlideshowGalleryDataCount\")[0].innerText:\"\",gi()||$vxp(n).find(\"div.vxpPhotoViewerEndslateGallery\").click(function(){var r=$vxp(this),t=$vxp(r).attr(\"data-galleryId\");if(t)return $vxp.fireEvent(\"playSlideshow\",{id:t,metadata:{source:\"endslate\"}},i),!1})),$vxp(n).find(\".vxpPhotoViewerMetadata\").css(\"opacity\",.8),r||$vxp(n).find(\".vxp_pagedGallery\").css(\"background-color\",\"#fff\").css(\"opacity\",.6),$vxp(n).subscribeEvent(\"photoClicked\",function(n){u(n.metadata.dataIndex,n.metadata.transition)}),$vxp(n).subscribeEvent(\"setAutoplay\",function(n){w(n)}),$vxp(n).subscribeEvent(\"paginationEvent\",function(n){setTimeout(function(){h=0,u(n-1,\"slide\")},10)}),$vxp(n).find(\"span.vxpSlideShowAdSkip\").click(function(){h=0,v()}),$vxp(n).find(\".vxpPhotoViewerWatchAgain\").click(function(){w(!0),vt&&o(e,\"\",l,\"PlayStart\",\"\",\"qs\",\"gallery\"),u(0,\"slide\")}),$vxp(n).find(\".vxpPhotoViewerImage\").click(function(){var n={dataIndex:t};$vxp.fireEvent(\"viewerPhotoChanged\",{metadata:n},i),rr&&v()}),$vxp(n).find(\".vxpPhotoViewerRightArrowContainer\").click(function(){t>=0&&u(t+1,\"slide\")}),$vxp(n).find(\".vxpPhotoViewerLeftArrowContainer\").click(function(){t>0&&u(t-1,\"slide\")}),$vxp(n).swipe(function(){u(t-1,\"slide\")},function(){u(t+1,\"slide\")}),pt.click(function(){$vxp.fireEvent(\"setAutoplay\",!0,i)}),ct.click(function(){$vxp.fireEvent(\"setAutoplay\",!1,i)}),wt.click(function(){wt.hide(),st.show(),yi.css(\"visibility\",\"visible\")}),st.click(function(){st.hide(),wt.show(),yi.css(\"visibility\",\"hidden\")}),ti(f),$vxp(n).subscribeEvent(\"autoplayChanged\",function(n){ti(n)}),$vxp(n).subscribeEvent(\"photoViewerAdStarted\",function(){ii(!1)}),$vxp(n).subscribeEvent(\"photoViewerAdCompleted\",function(){ii(!0)}),$vxp(n).subscribeEvent(\"playSlideshow\",function(){w(!1)}),$vxp.pageIsReady?hi():$vxp(n).subscribeEvent(\"pageReady\",hi),$vxp(n).subscribeEvent(\"photoChanged\",function(n){di(n)}),isNaN(y)&&(y=t),pi(t),it(),vt&&o(e,\"\",l,\"PlayStart\",\"\",\"qs\",\"gallery\"),d=setInterval(wi,1e3),(!tt||ft)&&(window.onhashchange!==undefined?typeof window.addEventListener!=\"undefined\"?window.addEventListener(\"hashchange\",it,!1):typeof window.attachEvent!=\"undefined\"&&window.attachEvent(\"onhashchange\",it):k=setInterval(ar,200))});$vxp.registerWidget(\"slideshow\",function(n){$vxp.useExternalReporting(),$vxp(n).subscribeEvent(\"playSlideshow\",function(t){$vxp(n).setConfig(\"GalleryId\",t.id),$vxp(n).setConfig(\"AutoPlay\",!0),$vxp(n).widgetRefresh()})});$vxp.registerWidget(\"slideshowMetadata\",function(n){function f(){var h=$vxp(n).find(\".vxpSlideshowMetadataTitle\"),f=$vxp(n).find(\".vxpSlideshowMetadataDescription\"),o=u.length>400,c=o&&!t?u.substr(0,400)+\"...\":u;h.text(e),f.text(c),o?t?($vxp(i).hide(),$vxp(r).show()):($vxp(i).show(),$vxp(r).hide()):($vxp(i).hide(),$vxp(r).hide());var l=f.height(),s=s>100?50:l/2,a=$vxp(n).find(\".vxpSlideshowMetadataArrow\");a.css(\"visibility\",\"visible\").css(\"bottom\",\"0px\").css(\"bottom\",s+\"px\")}var o=$vxp(n).getConfig(\"EventTarget\"),i=$vxp(n).find(\".vxpSlideshowMetadataExpand\"),r=$vxp(n).find(\".vxpSlideshowMetadataContract\"),e,u,t;$vxp(n).subscribeEvent(\"photoChanged\",function(n){if(n&&n.metadata){var i=n.metadata;i.title&&i.description&&(e=i.title,u=i.description,t=!1,f())}}),i.click(function(){t=!0,f()}),r.click(function(){t=!1,f()})});$vxp.registerWidget(\"heroPlayerAdModule\",function(){});$vxp.registerWidget(\"heroPlayerBingMapsModule\",function(n){if(!$vxp(n).html()||$vxp(n).find(\"div.vxp_mmv_content_active\").length==0)return;var t=$vxp(n).getConfigs(),u=t.bingmapsscripturl,f=t.mapkey,e=t.mapzoom,o=t.mapview.toLowerCase(),r=t.mapquery,i,s=function(){i=new Microsoft.Maps.Map($vxp(n).find(\"div.vxp_mmv_bmm_map_container\").get(0),{credentials:f,mapTypeId:Microsoft.Maps.MapTypeId[o],backgroundColor:new Microsoft.Maps.Color(255,32,32,32)}),r&&i.getCredentials(function(n){var t=\"http://dev.virtualearth.net/REST/v1/Locations/\"+r+\"?output=json&jsonp=?&key=\"+n;$vxp.ajax({type:\"GET\",url:t,dataType:\"jsonp\",cache:!0,success:function(n){if(n.resourceSets.length>0&&n.resourceSets[0].resources.length>0){var t=n.resourceSets[0].resources[0].point.coordinates;i.setView({zoom:e,center:new Microsoft.Maps.Location(t[0],t[1])}),i.entities.clear(),i.entities.push(new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(t[0],t[1]),null))}}})})},h=setInterval(function(){document.readyState===\"complete\"&&(clearInterval(h),$vxp.ajax({type:\"GET\",url:u,dataType:\"script\",cache:!0,success:function(){setTimeout(function(){s()},0)}}))},50)});$vxp.registerWidget(\"heroPlayerBingSearchModule\",function(n){var t=$vxp(n).getConfigs();if(t.mmvflippermode)return;$vxp(n).find(\"div.vxp_bing_scope\").click(function(){var t=$vxp(this).attr(\"data-searchScope\");$vxp(n).setConfig(\"SearchScope\",t),$vxp(n).widgetRefresh()}),$vxp(n).find(\"div.vxp_bing_search_input input\").each(function(){$vxp(this).keypress(function(t){return 13==t.which?($vxp(n).find(\"div.vxp_bing_search_button\").click(),!1):!0})}),$vxp(n).find(\"div.vxp_bing_search_button\").click(function(){var t=$vxp(n).find(\"div.vxp_bing_search_input input\"),i=t.attr(\"value\");return $vxp(n).setConfig(\"SearchQuery\",i),$vxp(n).widgetRefresh(),!1})});$vxp.registerWidget(\"heroPlayer\",function(n){var l=$vxp(n).getConfigs(),dt=l.clicktoclosetext,gt=$vxp(n).attr(\"id\"),pt=gt+\"_carousel\",r=null,t=null,y=$vxp(n).find(\"div.vxp_heroPlayerContainer\"),d=$vxp(n).find(\"div.vxpCarousel\"),f=y.find(\"div.vxpModuleContainer\"),c=[],u=y.find(\"div.vxpSpinner\"),wt=$vxp(\"#player1000x650ad\"),rt=!1,b=!1,w=!1,o=l.usehtml5,g=l.mmvlite,nt=!$vxp.browser.msie||parseInt($vxp.browser.version)>=9,i=parseInt(y.attr(\"data-initialmoduleindex\")),tt=500,ei=l.activecontentinwings,oi=window.navigator.userAgent.match(/iPad/i),yt,ui=l.msnvideoreporting,ti=$vxp.getPageWidget().getConfig(\"HubId\"),it,p,ct;ui&&$vxp.useExternalReporting();var vt=function(){o?u.css(\"display\",\"block\").css(\"opacity\",1):nt?u.css(\"opacity\",0).css(\"display\",\"block\").stop().animate({opacity:1},tt/2):u.show();if(!o){var t=u.width(),i=u.height(),r=MsnVideo2.getProperties({type:\"currentModule\",targetId:pt})[0],n=r.param.metadata,f=n.staticWidth,e=n.staticHeight,s=n.staticImageOffset.x,h=n.staticImageOffset.y,c=(f-t)/2+s,l=(e-i)/2+h;u.css(\"left\",c+\"px\"),u.css(\"top\",l+\"px\")}},ut=function(){b||(nt?u.stop().animate({opacity:0},tt/2,function(){u.hide()}):u.hide())},at=function(){rt&&t.find(\"div.vxp_mmv_content_active\").length==1&&(o?t.parent().removeClass(\"vxpHide\"):(nt?t.parent().removeClass(\"vxpHide\").css(\"opacity\",0).animate({opacity:1},tt):t.parent().removeClass(\"vxpHide\"),ut()))},lt=function(i){rt=!1,b=!1,r=i,t=$vxp(\"#\"+r),$vxp.getPageWidget().setConfig(\"VideoId\",null),$vxp(n).find(\"div.vxpModuleContainer\").addClass(\"vxpHide\"),ut();if(t.find(\"div.vxp_mmv_content_active\").length==0||!t.html()){var u=t.getConfig(\"ModuleIndex\");$vxp(n).setConfig(\"InitialModuleIndex\",(u+1).toString()),t.setConfig(\"FullRender\",\"true\"),t.setConfig(\"FullRenderVisible\",\"false\"),t.widgetRefresh(function(){t=$vxp(\"#\"+r),t.setConfig(\"FullRenderVisible\",\"true\"),at()})}},bt=function(){rt=!0,ht(),o||vt(),at();var n=t.attr(\"data-type\");n!=\"heroPlayerAdModule\"&&n!=\"heroPlayerWegPageModule\"&&$vxp.reportExternalPageView(ti+\"_\"+r)},ft=function(n){w=!0,window.MsnVideo2&&MsnVideo2.sendMessage({type:\"overlayOpened\"}),o||g?($vxp.vxpGlobal.overlayPlayerState=\"loaded:complete\",ii()):(lt(n),bt())},kt=function(){ht()},ht=function(){var n=d.width(),u=Math.round((n-1e3)/2),r;wt.css(\"left\",u+\"px\");if(!o){var t=MsnVideo2.getProperties({type:\"currentModule\",targetId:pt})[0],f=t.param.containerWidth,i=t.param.metadata;i&&(r=Math.round((n-f)/2)+i.activeContentMarginLeft,y.css(\"left\",r+\"px\"))}},st=function(n,t,i,r){var k=390,b=320,w=525,p=450,y=15,d=70,a=Math.abs(t-n),u={},e=0,l=0,c=0,h=0,s=0,o=0,v=\"center\",f,g;return nt&&(e=(a-1)*b+p,l=y,c=-((a-1)*k+w),h=-d,s=0,o=1,v=\"right\"),undefined!=i&&undefined!=r&&t!=i&&r>0&&(f=st(n,i),r>1&&(r=1),g=e,e+=(f.translateX-e)*r,l+=(f.translateY-l)*r,c+=(f.translateZ-c)*r,h+=(f.rotationY-h)*r,s+=(f.leftShadowOpacity-s)*r,o+=(f.rightShadowOpacity-o)*r,u.transitionPosition=f.position),u.translateX=e,u.translateY=l,u.translateZ=c,u.rotationY=h,u.leftShadowOpacity=s,u.rightShadowOpacity=o,u.position=v,u},h=!1,ot=null,ri=function(n){n.transform.position==\"center\"&&(n.leftShadow.css(\"visibility\",\"hidden\"),n.rightShadow.css(\"visibility\",\"hidden\")),setTimeout(function(){n.transform.position==\"right\"?(n.leftShadow.css(\"opacity\",0),n.rightShadow.css(\"opacity\",1).css(\"visibility\",\"visible\"),n.closeButton.css(\"visibility\",\"hidden\")):n.transform.position==\"left\"?(n.leftShadow.css(\"opacity\",1).css(\"visibility\",\"visible\"),n.rightShadow.css(\"opacity\",0),n.closeButton.css(\"visibility\",\"visible\")):n.closeButton.css(\"visibility\",\"visible\")},100)},e=function(u,e,o,s){var ut,w,v,p,a,k;if(h)return;for(h=!0,i=u,w=650,v=0;v=9&&(l.css(\"opacity\",1).css(\"z-index\",y.translateZ).get(0).style[\"-ms-transform\"]=k)):$vxp.browser.mozilla?(l.css(\"-moz-transition-duration\",p),a&&l.css(\"-moz-transition-timing-function\",a),l.css(\"opacity\",1).css(\"-moz-transform\",k)):(l.css(\"-webkit-transition-duration\",p),a&&l.css(\"-webkit-transition-timing-function\",a),l.css(\"opacity\",1).css(\"-webkit-transform\",k)),b.position!=y.position&&undefined==o&&(ri(b),b.position=y.position)}ot=e,w==0&&(h=!1),undefined==o&&c.length>0&&(t=c[i].module,r=c[i].id,setTimeout(function(){$vxp(n).setConfig(\"InitialModuleIndex\",(i+1).toString()),$vxp(n).fireEvent(\"moduleChangeBegin\",r)},100),clearTimeout(yt),yt=setTimeout(function(){h=!1,$vxp(n).fireEvent(\"moduleChangeComplete\")},w))},ii=function(){$vxp.browser.msie&&$vxp.browser.version<9||$vxp(\"#vxpOverlayContent\").css(\"opacity\",1),e(i,\"slow\")},et=function(){var t=$vxp(\"div.watchTemplate div.vxp_player\"),n;t.length>0&&(n=t.attr(\"id\"),$vxp.vxpGlobal.players[n]&&$vxp.vxpGlobal.players[n].adapter&&$vxp.vxpGlobal.players[n].adapter.pauseVideo&&$vxp.vxpGlobal.players[n].adapter.pauseVideo())};$vxp.fn.mmvSendMessage=function(n,t){if(window.MsnVideo2){var i=$vxp(this).parents().andSelf().filter(\".vxp_heroPlayer\").attr(\"id\")+\"_carousel\";MsnVideo2.sendMessage({type:n,param:t,targetId:i})}},$vxp.fn.mmvProperty=function(n){var i=null,r,t;return window.MsnVideo2&&(r=$vxp(this).parents(\".vxp_heroPlayer\").attr(\"id\")+\"_carousel\",t=MsnVideo2.getProperties({type:n,targetId:r}),t.length>0&&(i=t[0].param)),i},$vxp.fn.mmvOnCarouselReady=function(n){w?n(r):$vxp(this).subscribeEvent(\"carouselLoadBegin\",function(){n(r)})},$vxp.fn.clickOrTouch=function(n){var t=window.navigator.userAgent.match(/iPad/i);t?$vxp(this).bind(\"touchend\",n):$vxp(this).click(n)},$vxp(n).subscribeEvent(\"moduleChangeBegin\",function(n){w&<(n)}),$vxp(n).subscribeEvent(\"moduleChangeComplete\",function(){w&&bt()}),$vxp(n).subscribeEvent(\"heroPlayerResize\",function(){kt()}),$vxp(n).subscribeEvent(\"heroPlayerClose\",function(){MsnVideoUx.closeOverlayPlayer()}),$vxp(n).subscribeEvent(\"heroPlayerShowSpinner\",function(){b=!0,vt()}),$vxp(n).subscribeEvent(\"heroPlayerHideSpinner\",function(){b=!1,ut()}),$vxp(document).keyup(function(t){t.which==27&&$vxp(n).fireEvent(\"heroPlayerClose\")});var si=d.height(),fi=90,ni=0;y.css(\"top\",fi+\"px\"),wt.css(\"top\",ni+\"px\"),$vxp(\"#vxpOverlaySpinner\").hide(),$vxp(n).parents(\".vxpOverlay\").find(\"div.vxpOverlayBackground, #vxpOverlayContent\").css(\"cursor\",\"pointer\").attr(\"title\",dt);if(o||g){r=f.eq(i).children().attr(\"id\"),t=$vxp(\"#\"+r),ft(r),f.clickOrTouch(function(n){var t=parseInt($vxp(this).attr(\"data-moduleIndex\"));t!=i&&(n.preventDefault(),e(t))}),f.find(\"div.vxp_mmv_close_button\").click(function(){$vxp(n).fireEvent(\"heroPlayerClose\")}),g&&(et(),$vxp(\"#vxpOverlayContent\").click(function(){$vxp(n).fireEvent(\"heroPlayerClose\")}),it=$vxp(\"div.vxp_mmv_content_active\"),it.css(\"cursor\",\"default\"),it.click(function(n){n||(n=window.event),n.cancelBubble=!0,n.stopPropagation&&n.stopPropagation()}));var k=!1,v=!1,s=-1,a=-1;$vxp(\"#vxpOverlayContent, #vxpOverlayBackground\").bind(\"touchstart\",function(n){var t=$vxp(n.target).parents(\".vxpModuleContainer\").children(\".ux\"),i=n.originalEvent.touches,u;t.length>0&&t.attr(\"id\")==r||i.length!=1||(u=i[0],s=u.pageX,n.preventDefault(),v=!0,k=!1)}).bind(\"touchend\",function(){if(v&&k){var r=a-s,u=300,o=Math.min(1,Math.abs(r/u)),c=r<0,t=c?i+1:i-1;t>=0&&t1?v=!1:n.preventDefault();if(v){k=!0;var c=n.originalEvent.touches[0],l=a=c.pageX,u=l-s,y=300,r=Math.min(1,Math.abs(u/y)),p=u<0,t=p?i+1:i-1;t>=0&&t.5?(e(t,\"fast\",null,null),s=a=-1,k=!1,v=!1):r>0&&e(i,\"none\",t,r)))}}),$vxp(n).subscribeEvent(\"rotateToModule\",function(n){e(n)})}else $vxp(n).setConfig(\"fullrenderallmodules\",\"true\"),et(),$vxp(\".vxpCarousel\").css(\"width\",\"100%\").css(\"height\",\"100%\"),p=d.find(\"object\"),$vxp.vxpGlobal.overlayPlayerState&&$vxp.vxpGlobal.overlayPlayerState.indexOf(\"loaded\")!=-1&&d.length>0&&p[0].getActiveModuleId?(ct=p[0].getActiveModuleId(),ft(ct)):$vxp(n).subscribeEvent(\"carouselLoadBegin\",function(){var n=p[0].getActiveModuleId();ft(n)})});$vxp.registerWidget(\"heroPlayerGalleryModule\",function(n){var u=$vxp(n).getConfigs(),f=$vxp(n).find(\"div.vxp_heroPlayerModuleTitlebar .vxp_pagination\"),i=$vxp(n).find(\"div.vxp_pagedGallery\"),t,r,e=u.usehtml5,o=u.mmvlite;if(u.mmvflippermode)return;$vxp(n).subscribeEvent(\"paginationEvent\",function(t){i.setConfig(\"CurrentPage\",t),i.widgetRefresh(function(){i=$vxp(n).find(\"div.vxp_pagedGallery\")}),$vxp.reportExternalPageView()},f),$vxp(n).subscribeEvent(\"playVideo\",function(i){t=$vxp(n).parents(\".vxp_heroPlayerContainer\").find(\"div.vxp_heroPlayerVideoModule\");var u=t.getConfig(\"ModuleIndex\");i.metadata.dataIndex=0,e||o?(r=i,$vxp(n).fireEvent(\"rotateToModule\",u)):(t.html()?r=i:t.setConfig(\"VideoId\",i.id),$vxp(n).mmvSendMessage(\"rotateToModule\",{moduleIndex:u}),$vxp(n).mmvSendMessage(\"updateStaticImage\",{imageUrl:i.metadata.selectedImgSrc}))},i.find(\".vxp_gallery\").eq(0)),$vxp(n).mmvOnCarouselReady(function(){$vxp(n).subscribeEvent(\"moduleChangeComplete\",function(){t&&r&&$vxp(n).fireEvent(\"playVideo\",r,t)})})});$vxp.registerWidget(\"mmvFlipper\",function(n){function ft(n){var t,i;if(n!=null){t=n.attributes.getNamedItem(\"data-containermap\");if(t!=null&&t.value!=null&&t.value.length>0)for(t=t.value,i=0;i0?\"vxpMmvFlipperPlay\":\"vxpMmvFlipperPlayHidden\",t.active=null)}function it(){var n=r;n=a!=null&&a.length>r?a[r]:0,n++,MsnVideoUx.launchOverlayPlayer(e,o,{initialModuleIndex:n},{hubDomain:$vxp.getPageWidget().getConfig(\"hubDomain\")})}function rt(){ut(!0)}function p(){ut(!1)}function ut(n){var o,s,a;if(u>2){var e=r,h=e>0?e-1:u-1,l=e0?f-1:u-1,s=f0?e.value:null,o=o!=null&&o.value!=null&&o.value.length>0?o.value:null,i.each(function(){$vxp(this).appendTo(y)}),s!=null&&(s.className=\"vxpMmvZIndexAuto \"+s.className,r=parseInt(s.attributes.getNamedItem(\"data-initialModuleIndex\").value),s.appendChild(b),s.appendChild(w)),(isNaN(r)||r<0||r>=u)&&(r=0),u>0?($vxp(n).find(\"#_prevArrow\").click(function(){rt()}),$vxp(n).find(\"#_prevArrow\").dblclick(function(){rt()}),$vxp(n).find(\"#_nextArrow\").click(function(){p()}),$vxp(n).find(\"#_nextArrow\").dblclick(function(){p()}),$vxp(n).find(\"img.vxpMmvFlipperHiddenImg\").each(function(){$vxp(this).click(function(){it()})}),$vxp(n).find(\"div.vxpMmvFlipperPlayHidden\").click(function(){it()}),ft(et),f=r,u>2?(d=f>0?f-1:u-1,g=f1&&(i[1].className=\"vxpMmvFlipperHiddenImg\"),i[f].className=\"vxpMmvFlipperActiveImg\",k.innerText=i[f].attributes.getNamedItem(\"data-subtitle\").value,l=i[f].attributes.getNamedItem(\"data-isVideo\"),c.className=l!=null&&l.value!=null&&l.value.length>0?\"vxp_anchor vxpMmvFlipperPlay\":\"vxp_anchor vxpMmvFlipperPlayHidden\"):(h!=null&&(h.style.display=\"block\"),h!=null&&(h.style.display=\"block\"),e==null&&(h.firstChild.style.visibility=\"visible\"))});$vxp.registerWidget(\"heroPlayerOpenHtmlModule\",function(){});$vxp.registerWidget(\"heroPlayerPhotoModule\",function(n){var o=$vxp(n).attr(\"id\"),r=$vxp(n).find(\".vxp_photoViewer\"),u=$vxp(n).find(\".vxp_pagedGallery\"),f=$vxp(n).find(\".vxp_heroPlayerModuleTitlebar .vxp_pagination\"),t=0,e=$vxp(n).getConfigs(),i;if(e.mmvflippermode)return;i=function(i,e){i.metadata.dataIndex!=t&&(t=i.metadata.dataIndex,i.metadata.transition||(i.metadata.transition=\"dissolve\"),e||$vxp(n).fireEvent(\"photoClicked\",i,r),$vxp(n).fireEvent(\"updateActiveGalleryItem\",i.metadata.dataIndex,u),$vxp(n).fireEvent(\"PaginationPageChangedEvent\",i.metadata.dataIndex+1,f),i.metadata.selectedImgSrc&&$vxp(n).mmvSendMessage(\"updateStaticImage\",{imageUrl:i.metadata.selectedImgSrc}),$vxp.reportExternalPageView())},$vxp(n).subscribeEvent(\"paginationEvent\",function(i){$vxp(n).fireEvent(\"paginationEvent\",i,r),$vxp(n).fireEvent(\"updateActiveGalleryItem\",i-1,u),t=i-1,$vxp.reportExternalPageView()}),$vxp(n).subscribeEvent(\"photoClicked\",function(n){i(n)}),$vxp(n).subscribeEvent(\"photoChanged\",function(n){i(n,!0)}),$vxp(n).subscribeEvent(\"photoViewerAdStarted\",function(){$vxp(n).find(\".vxpPhotoModuleGalleryOverlay\").show()}),$vxp(n).subscribeEvent(\"photoViewerAdCompleted\",function(){$vxp(n).find(\".vxpPhotoModuleGalleryOverlay\").hide()})});$vxp.registerWidget(\"heroPlayerTrendingSearchesModule\",function(n){!$vxp(n).html()||$vxp(n).find(\"div.vxp_mmv_content_active\").length==0});$vxp.registerWidget(\"heroPlayerTwitterModule\",function(n){if(!$vxp(n).html()||$vxp(n).find(\"div.vxp_mmv_content_active\").length==0)return;var t=$vxp(n).getConfigs(),u=t.twitterscripturl,i=t.querytype.toLowerCase(),r=t.query,f=t.twittercontainerid,e=function(){var n={version:2,interval:6e3,width:640,id:f,theme:{shell:{background:\"#222222\",color:\"#ffffff\"},tweets:{background:\"#111111\",color:\"#999999\",links:\"#ffffff\"}},features:{scrollbar:!1,hashtags:!0,timestamp:!0}},t;i==\"searchterm\"?(n.type==\"search\",n.search=r,n.height=302,n.features.loop=!0,n.features.live=!0,n.features.avatars=!0,n.features.behavior=\"default\"):(n.type=\"profile\",n.height=269,n.rpp=5,n.features.loop=!0,n.features.live=!0,n.features.avatars=!1,n.features.behavior=\"all\"),t=new TWTR.Widget(n).render(),i==\"searchterm\"?t.start():t.setUser(r).start()};$vxp.ajax({type:\"GET\",url:u,dataType:\"script\",cache:!0,success:function(){setTimeout(function(){e()},0)}})});$vxp.registerWidget(\"heroPlayerVideoModule\",function(n){var r,v;if(!$vxp(n).html()||$vxp(n).find(\"div.vxp_mmv_content_active\").length==0)return;r=$vxp(n).getConfigs();if(r.mmvflippermode)return;var ri=r.continuousplaydelaytime,li=r.isactive,rt=r.playlistdata,ei={ad:r.secondaryadsallowed==\"Sponsorship\"?\"sponsor\":r.secondaryadsallowed==\"NoAds\"?\"false\":\"true\",adfull:r.secondaryadfullexperience,adpartial:r.secondaryadpartialexperience,videosplayed:r.secondaryadtriggervideosplayed,timeplaying:r.secondaryadtriggertimeplaying},h=$vxp(n).find(\"div.vxpPlayerContainer\"),t=h.find(\"div.vxp_player\"),ui=$vxp(n).find(\"div.vxp_heroPlayerModuleTitlebar .vxp_pagination\"),ni=$vxp(n).attr(\"id\"),oi=!0,ci=!1,l=!1,o=!1,f=1,ft=!1,a=null,fi=!1,e=!1,it=!1,tt=!1,bt=!1,g=!1,c=!1,d=-1,lt=!1,s=r.usehtml5,hi=r.mmvlite,k=window.navigator.userAgent.match(/iPad/i),at=!1,b=!1,i=function(){var n=u();return n?n.adapter:null},u=function(){return $vxp.vxpGlobal.players[t.attr(\"id\")]},w=function(){return a&&a==ni},ii=function(){$vxp(n).find(\".vxpTitlebarPageCurrent\").html(f)},st=function(n){n=parseInt(n);var t=rt.list.item[n-1].video,i={selectedImgSrc:t.selectedImageSrc.$,dataIndex:n-1,supportedPlayers:t.playerAdapter.$,mode:\"click\"};ut(t.id.$,i)},ti=function(){e||(h.removeClass(\"vxpPlayerHide\"),$vxp.browser.msie&&$vxp.browser.version<9||(oi?t.css(\"opacity\",0).animate({opacity:1},500):t.css(\"opacity\",1))),e=!0,s?it&&(it=!ht()):$vxp(n).fireEvent(\"heroPlayerHideSpinner\")},si=function(){s||(e=!1,h.addClass(\"vxpPlayerHide\"))},y=function(){var t=$vxp(\"#player1000x650ad\");t.html(\"\"),$vxp(n).mmvSendMessage(\"setSideModuleVisibility\",{visible:!0}),t.parent().removeClass(\"vxpBrandedAdActive\")},et=function(n){var i=Math.floor(n/60),r=n%60,t=\"\";return i>0&&(t+=i),t+=\":\",r<10&&(t+=\"0\"),t+=r},wt=function(){bt&&tt&&!e&&!t.html()&&t.html(t.getConfig(\"PlayerHtml\"))},nt=function(){var r,f,e;t=$vxp(n).find(\"div.vxp_player\"),c=!0,r=u()?u().type||\"\":\"\",r&&r.indexOf(\"msn\")!=-1&&(lt=!0,$vxp(n).setConfig(\"UseSecondaryAdPolicy\",!0)),i()&&i().isVideoPlayingEventSupported()&&t.getConfig(\"AutoPlayVideo\")&&!i().isContentStarted()||p(),f=$vxp(n).mmvProperty(\"currentModule\");if(f){var o=f.metadata,s=o.originalActiveHeight,h=u().controlBarHeight;d==-1&&(d=r.indexOf(\"msn\")!=-1?0:u().controlBarHeight),e=s+(h-d),$vxp(n).mmvSendMessage(\"updateActiveHeight\",{height:e}),$vxp(n).parent().height(e)}},p=function(){ti()},dt=function(){e||p()},kt=function(){f++,f>rt.list.item.length&&(f=1);var t=rt.list.item[f-1].video.id.$;$vxp(n).setConfig(\"VideoId\",t),$vxp(n).find(\"div.vxp_heroPlayerVideoModuleInfoPane\").widgetRefresh(function(){var i=$vxp(n).find(\".vxpInfoPanelUpNextCount\"),t=ri,r;$vxp(n).find(\"div.vxpInfoPanelContainer\").addClass(\"vxpUpNextMode\"),i.html(et(t)),ft=!0,r=setInterval(function(){t--,i.html(et(t)),t<=0&&(clearInterval(r),ft&&st(f))},1e3)})},ct=function(){e||p();if(i().getAdPosition){var t=$vxp(\"#player1000x650ad\");t.html().length>10&&($vxp(n).mmvSendMessage(\"setSideModuleVisibility\",{visible:!1}),s||t.parent().addClass(\"vxpBrandedAdActive\"))}},gt=function(){fi=!1,y()},yt=function(){bt=!0,wt()},vt=function(r){a=r,tt=!1;try{c&&i()&&i().pauseVideo&&i().pauseVideo(),y(),si()}catch(f){}w()?s&&(at=!0,it=!ht()):s?at?k&&(b=$vxp(n).find(\"video\").attr(\"controls\"),$vxp(n).find(\"video\").attr(\"controls\",\"\")):setTimeout(function(){$vxp(n).find(\"video\").css(\"display\",\"none\")},100):(!c||u()&&u().type&&u().type.indexOf(\"msn\")==-1)&&t.html(\"\")},ht=function(){var t=$vxp(n).find(\"video\");return t.length?(t.css(\"display\",\"block\"),k&&b&&(t.attr(\"controls\",\"1\"),b=null),!0):!1},ot=function(){if(w()){e||s||$vxp(n).fireEvent(\"heroPlayerShowSpinner\");if(t.html()){if(t.getConfig(\"AutoPlayVideo\")||s){i()&&i().playVideo();var r=t.attr(\"id\");$vxp.vxpGlobal.players[r]&&$vxp.vxpGlobal.players[r].isReady&&nt()}}else setTimeout(function(){tt=!0,wt()},500)}},ut=function(r,e){if(w()){ft=!1,e.dataIndex&&(f=e.dataIndex+1),ii(),y(),$vxp(n).setConfig(\"VideoId\",r);var o=u()?u().type||\"\":\"\";o&&o.indexOf(\"msn\")!=-1&<&&i().setAdPolicy&&i().setAdPolicy(ei),$vxp(n).fireEvent(\"playVideoInternal\",{id:r,metadata:e},t),$vxp(n).mmvSendMessage(\"updateStaticImage\",{imageUrl:e.selectedImgSrc}),$vxp(n).find(\"div.vxp_heroPlayerVideoModuleInfoPane\").widgetRefresh(),$vxp(n).fireEvent(\"updateActiveGalleryItem\",e.dataIndex,$vxp(n).find(\"div.vxp_mmv_vim_playlist .vxp_pagedGallery\")),$vxp(n).fireEvent(\"PaginationPageChangedEvent\",f,$vxp(n).find(\"div.heroPlayerModuleTitlebar .vxp_pagination\"))}},pt=!1;$vxp(n).mouseover(function(t){if(!pt){pt=!0;var i=function(){l=!1;var t=$vxp(n).find(\"div.vxp_mmv_vim_playlist\");$vxp.browser.msie&&$vxp.browser.version<9?(t.css(\"display\",\"none\"),o=!1):t.animate({opacity:0},500,null,function(){o=!1,t.css(\"display\",\"none\")})};h.find(\".vxp_mmv_vim_playlist_close\").click(function(){i()}),h.hover(function(){_playlistHover=!0,setTimeout(function(){if(_playlistHover&&!o&&!l){o=!0,l=!0;var t=$vxp(n).find(\"div.vxp_mmv_vim_playlist\");$vxp.browser.msie&&$vxp.browser.version<9?(t.css(\"display\",\"block\"),o=!1):t.css(\"display\",\"block\").css(\"opacity\",0).animate({opacity:1},500,null,function(){o=!1})}},500)},function(n){if($vxp(n.relatedTarget||n.toElement).parents().andSelf().filter(\".vxp_mmv_vim_playlist\").length>0)return;_playlistHover=!1,setTimeout(function(){_playlistHover||o||!l||g||i()},500)}),h.find(\"div.vxp_grid .vxp_gallery_item\").hover(function(){g=!0},function(){g=!1}),$vxp(t.target).mouseover()}}),$vxp.vxpGlobal.overlayPlayerState==\"loaded:complete\"?yt():$vxp(n).subscribeEvent(\"carouselLoadComplete\",function(){yt()}),$vxp(n).subscribeEvent(\"paginationEvent\",function(n){st(n)},ui),t.length>0&&($vxp(n).subscribeEvent(\"playerReady\",function(){nt()},t),$vxp(n).subscribeEvent(\"videoPlaying\",function(){dt()},t),$vxp(n).subscribeEvent(\"adPlaying\",function(){ct()},t),$vxp(n).subscribeEvent(\"adComplete\",function(){gt()},t),$vxp(n).subscribeEvent(\"contentComplete\",function(){kt()},t)),$vxp(n).subscribeEvent(\"playVideo\",function(t){if(t.metadata)ut(t.id,t.metadata);else{var i=t.id,r=$vxp.getPageWidget().getConfig(\"ServicesRoot\")+\"/videodata/?callback=?\";$vxp.getJSON(r,{responseEncoding:\"json\",ids:i,detailed:\"true\",v:\"2\"},function(t){if(t&&t.videos&&t.videos.length==1){var r={dataIndex:0,selectedImgSrc:t.videos[0].thumb,supportedPlayers:t.videos[0].playerAdapter};ut(i,r),$vxp(n).setConfig(\"VideoId\",i),$vxp(n).find(\"div.vxpPlaylistContent .vxp_pagedGallery\").widgetRefresh()}})}}),$vxp(n).subscribeEvent(\"mmvClose\",function(){c&&i()&&i().pauseVideo(),c=!1}),$vxp(n).mmvOnCarouselReady(function(i){a=i,$vxp(n).subscribeEvent(\"moduleChangeBegin\",function(n){vt(n)}),$vxp(n).subscribeEvent(\"moduleChangeComplete\",function(){ot()}),t.length>0&&(vt(i),ot())}),k&&$vxp(n).find(\"div.vxp_mmv_vim_playlist\").addClass(\"vxp_never_show\"),v=t.attr(\"id\"),$vxp.vxpGlobal.players[v]&&$vxp.vxpGlobal.players[v].isReady&&nt(),i()&&i().isAdPlaying()&&ct()});$vxp.registerWidget(\"heroPlayerVideoModuleInfoPane\",function(n){var f=$vxp(n).getConfigs(),i=f.playerid,r=!0,u,t=function(){var n=e();return n?n.adapter:null},e=function(){return $vxp.vxpGlobal.players[i]},o=function(n){var i=Math.floor(n/60),r=n%60,t=\"\";return i>0&&(t+=i),t+=\":\",r<10&&(t+=\"0\"),t+=r},s=function(){if(t()&&t().getAdPosition){r=!0,$vxp(n).find(\".vxpInfoPanelUpNextCount\").html(\"\");var i=!0;u=setInterval(function(){if(r){if(!t()){clearInterval(u);return}param=t().getAdPosition();if(param){i&&(i=!1,$vxp(n).find(\"div.vxpInfoPanelContainer\").addClass(\"vxpUpNextMode\"));var f=Math.floor(param.duration-param.position);!isNaN(f)&&f>=0&&$vxp(n).find(\".vxpInfoPanelUpNextCount\").html(o(f))}}},500)}},h=function(){r=!1,clearInterval(u),$vxp(n).find(\"div.vxpInfoPanelContainer\").removeClass(\"vxpUpNextMode\")};$vxp(n).subscribeEvent(\"adPlaying\",function(){s()},$vxp(\"#\"+i)),$vxp(n).subscribeEvent(\"adComplete\",function(){h()},$vxp(\"#\"+i))});$vxp.registerWidget(\"heroPlayerWebpageModule\",function(){});$vxp.registerWidget(\"openGraphRedirectModule\",function(){});$vxp.registerWidget(\"chaptersControl\",function(n){function tt(){var r,i;$vxp(n).find(\"table.vxp_chaptersControlChaptersOuterContainer\").length>0&&(f=$vxp(n).find(\"table.vxp_chaptersControlChaptersOuterContainer\")[0].attributes.getNamedItem(\"data-videoid\"),f=f!=null&&f.value!=null&&f.value.length>0?f.value:null);if(t!=null&&t.length>0)for($vxp(n).find(\"td.vxp_chaptersControlDisabledChapter\").each(function(){$vxp(this).click(function(){y(this)})}),$vxp(n).find(\"a\").each(function(){$vxp(this).focus(function(){g(this)}),$vxp(this).blur(function(){d(this)}),$vxp(this).click(function(n){return et(n,this)}),$vxp(this).keydown(function(n){return st(n,this)})}),r=0;r0?i.value:null,i!=null&&(i=parseInt(i),isNaN(i)||(o.push(i),a=i))}function ft(){var u,f,t,r;i==null&&($vxp(n).parents(\"div.vxp_multiplayerLite\").length>0?i=$vxp(n).parents(\"div.vxp_multiplayerLite\").find(\"div.vxp_player\"):$vxp(n).parents(\"div.vxp_playerContainer\").length>0&&(c=$vxp(n).parents(\"div.vxp_playerContainer\")[0],i=$vxp(n).parents(\"div.vxp_playerContainer\").find(\"div.vxp_player\")),u=i==null?null:i.find(\"object\"),f=u==null?null:u.attr(\"type\"),f!=null&&f.toLowerCase().indexOf(\"silverlight\")>0&&(t=$vxp(n).find(\"div.vxp_chaptersControlLeftMarginFlash\"),r=$vxp(n).find(\"div.vxp_chaptersControlRightMarginFlash\"),t!=null&&(t.removeClass(\"vxp_chaptersControlLeftMarginFlash\"),t.addClass(\"vxp_chaptersControlLeftMarginSl\")),r!=null&&(r.removeClass(\"vxp_chaptersControlRightMarginFlash\"),r.addClass(\"vxp_chaptersControlRightMarginSl\"))))}function ut(){$vxp(n)[0].style.display=\"none\";if(i!=null){var t=i.attr(\"id\");t!=null&&$vxp.vxpGlobal.players!=null&&$vxp.vxpGlobal.players[t]!=null&&(r=$vxp.vxpGlobal.players[t].adapter,r!=null&&(r.isSeekSupported()?(c!=null&&(c.style.height=\"auto\"),$vxp(n)[0].style.display=\"block\",b(),h=setInterval(rt,1e3)):r=null))}}function rt(){var u;if(r!=null){var i=!0,t=r.getStatus(),n=r.getPositionEx(),f=n!=null?n.downloadProgress:0;t!=null&&(t=t.toLowerCase()),(t==\"videoplaying\"||t==\"videopaused\")&&(i=!1),!i&&e?(e=!1,u=n==null||isNaN(n.duration)||isNaN(n.downloadProgress)?a:Math.floor(n.duration*n.downloadProgress),v(u)):!i&&f<1?(u=n==null||isNaN(n.duration)||isNaN(n.downloadProgress)?a:Math.floor(n.duration*n.downloadProgress),v(u)):i&&!e&&(e=!0,v(0)),t==\"videoplaying\"&&it(r.getPosition())}}function k(){t!=null&&t.length>0&&ut(),c!=null&&$vxp.VideoModule.updateLayout()}function it(n){var r=-1,i;for(n=Math.floor(n),i=0;i=o[i]&&(r=i);p(r==-1?null:t[r])}function y(n){var i=n==null?-1:n.cellIndex,u=i==-1?\"\":t[i].className;r==null||e||u==\"vxp_chaptersControlDisabledChapter\"||(p(n),ot())}function ot(){u>=0&&u0)for(var i=0;in?\"vxp_chaptersControlDisabledChapter\":i==u?\"vxp_chaptersControlActiveChapter\":\"vxp_chaptersControlInactiveChapter\"}function nt(t){t!=f&&(w||(w=!0,b(),$vxp(n)[0].style.display=\"none\",$vxp(n).setConfig(\"VideoId\",t),$vxp(n).widgetRefresh()))}function b(){h!=null&&(clearInterval(h),h=null)}function g(n){var t=$(n).parent();t!=null&&t.addClass(\"vxp_focusedChapter\")}function d(n){var t=$(n).parent();t!=null&&t.removeClass(\"vxp_focusedChapter\")}function et(n,t){var i=t.parentNode;return i!=null&&y(i),!1}function st(n,t){if(n.which==32||n.keyCode==32){var i=t.parentNode;if(i!=null)return y(i),!1}}var ht=0,f=null,l=$vxp(n).find(\"table.vxp_chaptersControlChaptersContainer\")[0],c=null,t=l!=null&&l.rows.length>0?l.rows[0].cells:null,i=null,r=null,u=-1,o=[],h=null,e=!0,w=!1,a=0,s;tt(),ft(),i!=null&&(s=i.attr(\"id\"),s!=null&&$vxp.vxpGlobal.players!=null&&$vxp.vxpGlobal.players[s]!=null&&$vxp.vxpGlobal.players[s].isReady&&k()),i!=null&&(r==null&&$vxp(n).subscribeEvent(\"playerReady\",k,i),$vxp(n).subscribeEvent(\"videoChanged\",function(n){nt(n.uuid)},i))});$vxp.registerWidget(\"rating\",function(n){var t,u=$vxp(n).getConfig(\"Rating\"),f=$vxp(n).getConfig(\"VideoId\"),i=function(t,i){var r=Math.round(t)!=Math.ceil(t),u=75-Math.ceil(t)*15,f=r*14+i*28,e=-1*u+\"px \"+-1*f+\"px\";$vxp(n).find(\".r\").css(\"background-position\",e)},r=function(){t?i(t,!0):i(u,!1)},e=function(n,t){var r=$vxp.getPageWidget().getConfig(\"VideoCatalogUrl\"),u=r+\"/frauddetect.aspx?callbackName=?\",f={u:n,t:3,ag:t};$vxp.getJSON(u,f,function(){})},o=function(n){var i=n.offsetX,u;typeof i==\"undefined\"&&(u=$vxp(n.target).offset(!1),i=n.pageX-u.left),t=Math.ceil(i/15),e(f,t),r()},s=$vxp(n).find(\".r\");s.mousemove(function(n){var t=n.offsetX,r;typeof t==\"undefined\"&&(r=$vxp(n.target).offset(!1),t=n.pageX-r.left),i(Math.ceil(t/15),!0)}).mouseout(r).mouseup(function(n){o(n)}),r()});(function(n){n.vxpGlobal.adapters.bing=function(){this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!1},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getPositionEx=function(){},this.getVolume=function(){return null},this.setVolume=function(){},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){}}})($vxp);(function(n){n.vxpGlobal.adapters.cbs=function(t){function f(n){var i=n[0],r=n[1],f=n[2],t;e(n[3]),f==\"img\"&&u(''),f==\"swf\"&&(t=\"\",t='\",t+='',t+='',t+='',t+='',t+='',t+='',t+='',t+=\"\",t+=\"\",u(t))}function u(i){var r=t.getConfig(\"BannerAdDivId\");n(\"#\"+r).html(i)}function e(n){for(i=0;i',document.getElementsByTagName(\"body\")[0].appendChild(t)}}var r;this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!0},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getPositionEx=function(){},this.getVolume=function(){return null},this.setVolume=function(){},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){r=null},window.cbsAdapterOnPlayListEnd=function(){n(t).fireEvent(\"contentComplete\")},window.cbsAdapterOnContentStart=function(){n.fireEvent(\"CountdownCancelRequest\",!0),n(t).fireEvent(\"videoPlaying\")},window.cbsAdapterOnAdStart=function(){n.fireEvent(\"CountdownCancelRequest\",!0)},window.setExternalAd=function(t,i){var e=i,o=t,f;n(\"#vxp300x60ad\").html(\"\"),o&&o!=\"\"&&(f=\"\",e&&e!=\"\"&&(f=\"\"+f+\"\"),n(\"#vxp300x60ad\").html(f))},window.onCBSI_AdResourcesInfo=function(){var n=r.getCompanionAdInfoBySize(300,60);n.length>0&&f(n[0])},this.init=function(){setTimeout(function(){r=t.find(\"OBJECT\")[0],r.addEventJSCallback(\"onPlayListEnd_cbsi\",\"cbsAdapterOnPlayListEnd\"),r.addEventJSCallback(\"onContentStart_cbsi\",\"cbsAdapterOnContentStart\"),r.addEventJSCallback(\"onAdStart_cbsi\",\"cbsAdapterOnAdStart\"),r.addEventJSCallback(\"onAdResourcesInfo\",\"onCBSI_AdResourcesInfo\")},0)},this.init()}})($vxp);(function(n){n.vxpGlobal.adapters.dailymotion=function(t){var i=t.find(\"object\").length>0?t.find(\"object\")[0]:null;this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!0},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.getPositionEx=function(){},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getAdPosition=function(){return 0},this.getVolume=function(){var n=i.getVolume()/100,t=i.isMuted();return{volume:n,mute:t}},this.setVolume=function(n,t){i.setVolume(Math.floor(n*100)),t?i.mute():i.unMute()},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){i=null},window.dailyMotionAdapterOnStateChange=function(i){i==0?n(t).fireEvent(\"contentComplete\"):i==1&&n.fireEvent(\"CountdownCancelRequest\",!0)},i&&i.addEventListener(\"onStateChange\",\"dailyMotionAdapterOnStateChange\")}})($vxp);(function(n){n.vxpGlobal.adapters.hulu=function(t){function i(){return{videoPlayheadUpdate:function(n){f=n.position},videoStateChange:function(){n.fireEvent(\"CountdownCancelRequest\",!0)},videoStart:function(){u=!0,n.fireEvent(\"CountdownCancelRequest\",!0),n(t).fireEvent(\"videoPlaying\")},videoAdBegin:function(){r=!0,u=!0},videoAdEnd:function(){r=!1},theEnd:function(){n(t).fireEvent(\"contentComplete\")},newsiteError:function(){n(t).fireEvent(\"contentComplete\")},init:function(){NewSite.addListener(\"videoStateChange\",i()),NewSite.addListener(\"videoStart\",i()),NewSite.addListener(\"videoPlayheadUpdate\",i()),NewSite.addListener(\"theEnd\",i()),NewSite.addListener(\"newsiteError\",i())}}}var f=-1,r=!1,u=!1;this.isSeekSupported=function(){return!0},this.isShareSupported=function(){return!0},this.isContinuousPlaySupported=function(){return!0},this.isVideoPlayingEventSupported=function(){return!0},this.isAdPlaying=function(){return r},this.isContentStarted=function(){return u},this.getPosition=function(){return f},this.getPositionEx=function(){},this.setPosition=function(n){NewSite.videoPlayerComponent.seek(n)},this.getAdPosition=function(){return 0},this.getVolume=function(){var n=NewSite.videoPlayerComponent.getProperty(\"volume\"),t=n/100,i=n==0;return{volume:t,mute:i}},this.setVolume=function(n,t){NewSite.videoPlayerComponent.setVolume(t?0:Math.floor(n*100))},this.pauseVideo=function(){NewSite.videoPlayerComponent.pauseVideo()},this.playVideo=function(){NewSite.videoPlayerComponent.resumeVideo()},this.openSharePane=function(){NewSite.videoPlayerComponent.openMenu()},this.closeSharePane=function(){},this.toggleSharePane=function(){this.openSharePane()},this.resize=function(){},this.dispose=function(){},i().init()}})($vxp);(function(n){n.vxpGlobal.adapters.maximumtv=function(t){var i=t.find(\"object\")[0];this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!0},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getPositionEx=function(){},this.getVolume=function(){return null},this.setVolume=function(){},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){i=null},i.Content.MaximumTvEmbeddedPlayer.VideoStarted=function(){n.fireEvent(\"CountdownCancelRequest\",!0),n(t).fireEvent(\"videoPlaying\")},i.Content.MaximumTvEmbeddedPlayer.VideoEnded=function(){n(t).fireEvent(\"contentComplete\")}}})($vxp);(function(n){var t=function(t){var r=t._player;t._isAdPlaying=!1,t._playerId=t._player.attr(\"id\"),t._lastPlayerWidth=0,t._lastPlayerHeight=0,t._adImageShown=!1,t._playerObject,t._isContentStarted=!1,t._status=null,t._savedBackgroundImage=null,t._widgetFrameworkId=n.vxpGlobal.players[t._playerId].loadContext.widgetFrameworkId,t._groupId=r.groupId(),t.isSeekSupported=function(){return!0},t.isShareSupported=function(){return!0},t.isContinuousPlaySupported=function(){return!0},t.isVideoPlayingEventSupported=function(){return!0},t.getStatus=function(){var n=MsnVideo.getProperties({type:\"playbackStatus\",targetId:t._widgetFrameworkId})[0];return n?n.param.status:null},t.currentVideo=function(){var n=MsnVideo.getProperties({type:\"currentVideo\",targetId:t._widgetFrameworkId})[0];return n?n.param.video:null},t.getAdPosition=function(){var n=MsnVideo.getProperties({type:\"currentAdPosition\",targetId:t._widgetFrameworkId})[0];return n?n.param:null},t.getPosition=function(){var n=MsnVideo.getProperties({type:\"currentVideoPosition\",targetId:t._widgetFrameworkId})[0];return n?n.param.position:0},t.getPositionEx=function(){var n=MsnVideo.getProperties({type:\"currentVideoPosition\",targetId:t._widgetFrameworkId})[0];return n?n.param:null},t.setPosition=function(n){MsnVideo.sendMessage({type:\"seekVideo\",param:{position:n},targetId:t._widgetFrameworkId})},t.getVolume=function(){var n=MsnVideo.getProperties({type:\"volume\",targetId:t._widgetFrameworkId})[0],i=n?n.param.volume:.5,r=n?n.param.mute:!1;return{volume:i,mute:r}},t.setVolume=function(n,i){MsnVideo.sendMessage({type:\"SetVolume\",param:{volume:n,mute:i},targetId:t._widgetFrameworkId})},t.setAdPolicy=function(n){MsnVideo.sendMessage({type:\"setAdvertisingOptions\",param:n,targetId:t._widgetFrameworkId})},t.isAdPlaying=function(){return t._isAdPlaying},t.isContentStarted=function(){return t._isContentStarted},t.pauseVideo=function(){MsnVideo.sendMessage({type:\"PauseVideo\",targetId:t._widgetFrameworkId})},t.playVideo=function(n,i,r){n?(MsnVideo.sendMessage({type:\"LoadVideo\",param:{uuid:n},targetId:t._widgetFrameworkId}),MsnVideo.sendMessage({type:\"PlayVideo\",param:{reportingSource:i,playSource:r},targetId:t._widgetFrameworkId})):MsnVideo.sendMessage({type:\"PlayVideo\",param:{reportingSource:i,playSource:r},targetId:t._widgetFrameworkId})},t.openSharePane=function(){t._shareIsOpen=!0,MsnVideo.sendMessage({type:\"OpenPane\",param:{paneType:\"share\"},targetId:t._widgetFrameworkId})},t.closeSharePane=function(){t._shareIsOpen=!1,MsnVideo.sendMessage({type:\"ClosePane\",param:{paneType:\"share\"},targetId:t._widgetFrameworkId})},t.toggleSharePane=function(){t._shareIsOpen?t.closeSharePane():t.openSharePane()},t.resize=function(){},t.dispose=function(){MsnVideo.sendMessage({type:\"QueSavePlaylist\",targetId:t._widgetFrameworkId})};var s=function(i){i.sourceId!=t._widgetFrameworkId&&i.widgetId!=t._widgetFrameworkId&&(i.sourceId||i.widgetId)||(i.param.paneType.toLowerCase()==\"endslate\"?n(r).fireEvent(\"contentComplete\"):n(r).fireEvent(\"paneOpened\",i.param.paneType))},h=function(n){n.sourceId!=t._widgetFrameworkId&&n.widgetId!=t._widgetFrameworkId&&(n.sourceId||n.widgetId)||(n.param.id.toLowerCase()==\"player1000x650ad\"||n.param.id.toLowerCase()==\"player1380x650ad\")&&e(n.param.id.toLowerCase())},c=function(i){i.sourceId!=t._widgetFrameworkId&&i.widgetId!=t._widgetFrameworkId&&(i.sourceId||i.widgetId)||(t._status=i.param.status,i.param.status==\"videoPlaying\"?(o(),t._isContentStarted=!0,n(r).fireEvent(\"videoPlaying\")):i.param.status==\"videoOpening\"?n(r).fireEvent(\"videoOpening\"):i.param.status==\"adPlaying\"?(t._isContentStarted=!0,t._isAdPlaying=!0,n(r).fireEvent(\"adPlaying\")):i.param.status==\"adOpening\"?n(r).fireEvent(\"adOpening\"):i.param.status==\"adPlayCompleted\"?(o(),n(r).fireEvent(\"adComplete\")):i.param.status==\"adPlayFailed\"?t._isContentStarted=!0:i.param.status==\"videoPlayFailed\"?t._isContentStarted=!0:i.param.status==\"playbackCompleted\"&&l(),i.param.status!=\"playbackCompleted\"&&i.param.status!=\"videoPlayCompleted\"&&i.param.status!=\"videoPaused\"&&n.fireEvent(\"CountdownCancelRequest\",!0))},e=function(){setTimeout(function(){var o=n(\"#player1000x650ad\"),s=n(\"#player1380x650ad\"),i,h=!1,r,u,a,v,y,e;if(s.html()&&!n.frontDoorMode)i=s,o.hide(),s.show(),h=!0,i.parent().addClass(\"vxp_ad1380\");else if(o.html())i=o,s.hide(),o.show(),i.parent().removeClass(\"vxp_ad1380\");else return;i.css(\"zoom\",null),i.css(\"zoom\",\"1\");if(i.length>0&&i.width()>10){u=i.parents(\".vxp_videoModule\");if(u.length>0){var c=u.innerWidth(),p=u.width(),f=h?1380:u.getConfig(\"BrandedPlayerSkinWidth\"),l=i.parent();f==0&&(f=c),l.width(f),a=(c-f)/2,l.css(\"left\",a+\"px\"),v=(f-(h?1380:1e3))/2,i.css(\"left\",v+\"px\"),y=(p-640)/2,e=u.find(\"div.vxp_playerContainer\"),e.css(\"left\",y+\"px\"),t._lastPlayerWidth==0&&t._lastPlayerHeight==0&&(r=e.find(\"div.vxp_player object\"),r.length||(r=e.find(\"div.vxp_player video\")),t._lastPlayerWidth=r.width(),t._lastPlayerHeight=r.height()),u.find(\"div.vxp_moduleContainer\").addClass(\"vxp_playerAdCenter\"),e.find(\"div.vxp_player .vxp_richEmbedContainer, div.vxp_player object\").width(640).height(360),t.resize(),u.find(\"div.vxp_infoPaneContainer\").width(640).show()}else t._lastPlayerWidth==0&&t._lastPlayerHeight==0&&(r=n(\"div.vxp_player object\"),r.length||(r=n(\"div.vxp_player video\")),t._lastPlayerWidth=r.width(),t._lastPlayerHeight=r.height()),n(\"#\"+t._playerId).parents(\".vxpMultiLitePlayer\").find(\"div.vxpMultiLiteInfoPane\").show(),n(\"div.vxp_rightRailLayoutContent\").addClass(\"vxp_playerAdCenter\");t._adImageShown=!0}setTimeout(function(){n(\"#\"+t._playerId).find(\"div.vxp_richEmbedContainer, div.vxp_player object\").width(640).height(360)},100)},0)},l=function(){var i=n(\"body\");i.removeClass(\"vxp_pant_legs\"),t._savedBackgroundImage&&i.css(\"background-image\",t._savedBackgroundImage),t._savedBackgroundImage=null},o=function(){var i,r,e,f,o,u;t._isAdPlaying=!1,i=n(\"#player1000x650ad\"),i.html(\"\"),i.hide(),i=n(\"#player1380x650ad\"),i.html(\"\"),i.hide(),t._adImageShown&&(r=i.parents(\".vxp_videoModule\"),r.length>0?(r.find(\"div.vxp_moduleContainer\").removeClass(\"vxp_playerAdCenter\"),r.find(\"div.vxp_playerContainer\").css(\"left\",\"0px\"),r.find(\"div.vxp_player .vxp_richEmbedContainer, div.vxp_player OBJECT\").width(t._lastPlayerWidth).height(t._lastPlayerHeight),t.resize(),t._lastPlayerWidth=t._lastPlayerHeight=0,r.find(\"div.vxp_infoPaneContainer, div.vxpMultiLiteInfoPane\").hide()):(n(\"div.vxp_rightRailLayoutContent\").removeClass(\"vxp_playerAdCenter\"),n(\"#\"+t._playerId).find(\"div.vxp_richEmbedContainer, div.vxp_player object\").width(t._lastPlayerWidth).height(t._lastPlayerHeight),t.resize(),n(\"#\"+t._playerId).parents(\".vxpMultiLitePlayer\").find(\"div.vxpMultiLiteInfoPane\").hide())),e=n(\"#player1380x1024ad_temp\"),f=e.find(\"img\"),f.length>0&&(o=f.attr(\"src\"),u=n(\"body\"),t._savedBackgroundImage||(t._savedBackgroundImage=u.css(\"background-image\")),u.css(\"background-image\",\"url('\"+o+\"')\"),u.addClass(\"vxp_pant_legs\")),$(\".vxp_destinationPage\").addClass(\"vxp_bg\"),t._adImageShown=!1},f=function(n,i){MsnVideo.addMessageReceiver({eventType:n,widgetId:t._widgetFrameworkId,funcCb:function(r){i&&i(r),MsnVideo.sendMessage({type:n,targetGroup:t._groupId,param:r})}})},u=function(n){MsnVideo.addMessageReceiver({eventType:n,widgetGroup:t._groupId,funcCb:function(i){MsnVideo.sendMessage({type:n,targetId:t._widgetFrameworkId,param:i})}})},i=function(n){MsnVideo.addPropertyProvider({propertyType:n,widgetGroup:t._groupId,funcCb:function(){return MsnVideo.getProperties({type:n,targetId:t._widgetFrameworkId})}})};MsnVideo.addMessageReceiver({eventType:\"debug\",widgetId:t._widgetFrameworkId,funcCb:function(t){n(r).fireEvent(\"debug\",t.param)}}),f(\"widgetLoaded\"),f(\"currentVideoChanged\"),f(\"currentVideoDataUpdated\"),f(\"playlistCompleted\"),f(\"playbackStatusChanged\",c),f(\"companionAdRendered\",h),f(\"paneOpened\",s),u(\"playVideo\"),u(\"pauseVideo\"),u(\"seekVideo\"),u(\"stopVideo\"),u(\"setVolume\"),u(\"openPane\"),u(\"closePane\"),u(\"setCompanionAds\"),u(\"setAdvertisingOptions\"),i(\"widgetType\"),i(\"isFullScreen\"),i(\"currentVideo\"),i(\"currentVideoPosition\"),i(\"currentAdPosition\"),i(\"playbackStatus\"),i(\"volume\"),i(\"Playlist.GetCurrentIndex\"),i(\"Playlist.GetCount\"),i(\"Playlist.GetVideo\"),t.init=function(){t._playerObject=t._player.find(\"object\");var n=MsnVideo.getProperties({type:\"playbackStatus\"})[0],i=n&&n.param&&n.param.status?n.param.status.toLowerCase():null;(i==\"adopening\"||i==\"adplaying\"||i==\"adpaused\")&&(t._isAdPlaying=!0,e())},t.init()},i=function(n){MsnVideo&&MsnVideo.removeAllReceivers&&MsnVideo.removeAllReceivers(n._widgetFrameworkId)};n.vxpGlobal.adapters[\"msn:flash\"]=function(n){this._player=n,t(this),this.dispose=function(){try{this._playerObject[0].queSavePlaylist(null)}catch(n){}this._playerObject=null,i(this)}},n.vxpGlobal.adapters[\"msn:silverlight\"]=function(n){this._player=n,t(this),this.dispose=function(){i(this)}},n.vxpGlobal.adapters[\"msn:html5\"]=function(r){var u=n(r).find(\".video_player\");this._player=r,t(this),this.dispose=function(){i(this),u.trigger(\"OnDispose\")},this.resize=function(){u.trigger(\"OnResize\")},MsnVideo.addMessageReceiver({eventType:\"onFullscreenEnter\",widgetId:this._widgetFrameworkId,funcCb:function(){n.frontDoorMode?(n(\"#sw_hdr\").hide(),n(\"#sw_abar\").hide(),n(\".vxp_navigation\").hide(),n(\"#PB_Badge\").hide()):(n(\".header\").hide(),n(\".footer\").hide())}}),MsnVideo.addMessageReceiver({eventType:\"onFullscreenExit\",widgetId:this._widgetFrameworkId,funcCb:function(){n.frontDoorMode?(n(\"#sw_hdr\").show(),n(\"#sw_abar\").show(),n(\".vxp_navigation\").show(),n(\"#PB_Badge\").show()):(n(\".header\").show(),n(\".footer\").show())}}),u.bind(\"ContentNext\",function(){n.fireEvent(\"CountdownSkipRequest\")})}})($vxp);(function(n){n.vxpGlobal.adapters.mtv=function(){this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!1},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getPositionEx=function(){},this.getVolume=function(){return null},this.setVolume=function(){},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){}}})($vxp);$vxp.registerWidget(\"player\",function(n){function bt(n){var t=-1;return n&&(t=parseFloat(n)),t}function a(){var n=\"qs\",t=$vxp.cookie(\"vidap\")||$vxp.vxpGlobal.vidap,r,i,u;return $vxp.cookie(\"vidap\",null),$vxp.vxpGlobal.vidap=t,r=$vxp.cookie(\"vidref\"),t==\"user\"?n=\"add\":t==\"editor\"?n=\"auto\":t==\"click\"?n=\"pb\":(i=document.referrer,u=document.location.hostname,i&&i!=\"\"?i.indexOf(u)>=0&&(n=\"pb\"):r&&r.indexOf(u)>=0&&(n=\"pb\")),n}function b(){return vt==\"Small\"?\"544x306\":\"800x450\"}function dt(n){var t=n;o.appendChild(document.createTextNode(\"[\"+(new Date).toLocaleString()+\"] \"+t)),o.appendChild(document.createElement(\"BR\")),o.scrollTop=o.scrollHeight-o.clientHeight}function st(){f||(f=$vxp(\"li.vxp_playlist_next .vxp_playlist_next_text\"),s=f.html()),y?setTimeout(st,1e3):(h=parseInt($vxp(n).getConfig(\"CountdownTime\")),p(),nt(),h>=0&&(c=setInterval(nt,1e3)))}function nt(){f&&f.html(s+\": \"+h);var n=$vxp(\".vxp_videoQueue\").find(\".vxp_removeFromQueueButton\");n.length==1&&n.removeClass(\"active\");if(!y){if(h<=0){it();return}h--}}function at(n){y=n}function p(){c&&(clearInterval(c),c=0)}function ct(){p(),f&&s&&f.html(s)}function it(){f.html(s),f=null,p(),$vxp.fireEvent(\"countdownComplete\")}function rt(){var n=window.sa_config;typeof n==\"object\"?n.m=3:setTimeout(rt,1e3)}var i=$vxp(n).getConfigs(),gt=i.plugin,t=i.playertype,yt=i.datasource,vt=i.playersize,wt=i.videocontentsource,e=i.videoid,ni=i.playervideoid,ut=i.autoplayvideo,ti=i.reportingtype,kt=i.reportingfr,pt=i.leadwithimage,ri=i.isrefresh,ii=!0,et=!1,l=null,o=null,u=$vxp(n).attr(\"id\"),k=$vxp.getPlaySource(),r,v,d,g,w;$vxp.vxpClearFind(\"div.vxp_player\"),$vxp.vxpGlobal.playerVideoId=e,v=$vxp.cookie(\"vidlastid\"),v&&v==e&&(l=bt($vxp.cookie(\"vidlastpos\"))),setTimeout(function(){$vxp.cookie(\"vidlastid\",null),$vxp.cookie(\"vidlastpos\",null),$vxp.cookie(\"vidps\",null)},1e3),t==\"Msn\"&&document.location.href.toString().indexOf(\"debug=true\")!=-1&&(d=$vxp(\"
    \"),$vxp(\".uXPage\").append(d),o=d[0]),$vxp(n).subscribeEvent(\"contentComplete\",function(){$vxp(n).parents(\".vxp_videoModule\").length>0&&st()},$vxp(n)),$vxp(n).subscribeEvent(\"videoPlaying\",function(){if(l>0){var n=l;setTimeout(function(){},0),l=-1}},$vxp(n)),o&&$vxp(n).subscribeEvent(\"debug\",function(n){dt(n)},$vxp(n)),g=function(){var n=function(){var d,n;if(!et){et=!0,$vxp.cookie(\"vxpSpPingUrl\",null),$vxp.cookie(\"vxpSpClickId\",null);if(t!=\"Msn\"){var h=yt==\"Msn\"?e:\"d7ca5ba2-2d45-4629-9718-cdd106857354\",f=$vxp.getPageWidget().getConfig(\"VideoCatalogUrl\"),c=f+\"/usage.aspx?callbackName=?\",l=f+\"/frauddetect.aspx?callbackName=?\",v=b(),y=document.body.offsetWidth+\"x\"+$vxp(window).height(),o=$vxp.getPageWidget().getConfig(\"Market\"),i=k,r=$vxp.qsp(\"from\");r==null&&(r=\"\"),i==null&&(i=\"\");var p=$vxp.getPageWidget().getConfig(\"FlightId\"),w=$vxp.getFlightId(p),s={u:h,t:\"1\",plt:t,fr:kt||o,from:r,flight:w,src:i,c8:t,c9:\"v5Pl\",pl:document.location.href,rl:document.referrer,pbStatus:\"VideoBuffering\",av:4,brs:y,mkt:o,pv:\"3rd-party\",size:v};$vxp.getJSON(c,s,function(){}),$vxp.getJSON(l,s,function(){})}t=$vxp.vxpGlobal.players[u].type,d=!0,n=\"msnv:sl3\",t==\"msn:flash\"&&(n=\"msnv:fl\"),t==\"msn:html5\"&&(n=\"msnv:html5\"),t!=\"Msn\"&&(n=t.toLowerCase()),t==\"Bing\"&&(n=n+\":\"+wt),$vxp.vxpFind(\"div.vxp_videoModule .vxp_widgetMode\").length==0?$vxp.reportPageView({cn:\"msn video^\"+b(),pt:n,prop4:null,prop7:\"watch\",prop11:a()}):$vxp.reportPageView({cn:\"msn video^\"+b(),pt:ut?n:\"browse\",prop4:null,prop7:\"dest hub\",prop11:ut?a():null,prop28:document.location.href.toString()})}};$vxp.pageIsReady?n():$vxp.subscribeEvent(\"pageReady\",n,\"player1\")},$vxp.subscribeEvent(\"pageReady\",function(){t==\"Msn\"||$vxp.hasFlash(9)?t!=\"MaximumTV\"||$vxp.hasSilverlight(4)||($vxp.reportPageView({pt:null,prop4:\"slinstaller\",prop11:a()}),$vxp(\".vxp_playerControls_button.vxp_playerControls_dim\").addClass(\"vxp_playerControls_disabled\")):($vxp.reportPageView({pt:null,prop4:\"flinstaller\",prop11:a()}),$vxp(\".vxp_playerControls_button.vxp_playerControls_dim\").addClass(\"vxp_playerControls_disabled\"))},\"player2\"),w=function(){if(r){r.dispose();var n=r.getPosition();e&&n&&($vxp.cookie(\"vidlastid\",e),$vxp.cookie(\"vidlastpos\",n))}},window.addEventListener?window.addEventListener(\"unload\",w,!1):window.attachEvent(\"onunload\",w);var h=0,c=0,y=!1,s,f;$vxp(n).subscribeEvent(\"CountdownPauseRequest\",function(n){at(n)}),$vxp(n).subscribeEvent(\"CountdownCancelRequest\",function(){ct()}),$vxp(n).subscribeEvent(\"CountdownSkipRequest\",function(){it()}),$vxp.frontDoorMode&&rt();var ft=function(){var n,t;r&&$vxp.vxpGlobal.players[u].type!=\"msn:html5\"&&(n=r.currentVideo(),n&&(t=n.uuid,t!=e&&$vxp.fireEvent(\"playVideo\",{id:t,metadata:{supportedPlayers:\"MsnFlash,MsnSilverlight,MsnHtml5\",source:\"player\"}})))},ht=function(n,t){if(!pt&&t.indexOf(\"msn\")!=-1&&r&&r.playVideo){if(t==\"msnsilverlight\"&&n.indexOf(t)!=-1)return!0;if(t==\"msnflash\"&&n.indexOf(t)!=-1)return!0;if(t==\"msnhtml5\"&&n.indexOf(t)!=-1)return!0}return!1},lt=function(i,u){var o,s,f;e=i,$vxp.vxpGlobal.playerVideoId=i,o=t.toLowerCase().replace(\":\",\"\"),u&&u.playerSource&&(k=u.playerSource),u&&u.supportedPlayers&&(s=u.supportedPlayers.toLowerCase()),$vxp.getPageWidget().setConfig(\"VideoId\",i),$vxp(n).setConfig(\"VideoId\",i),ht(s,o.toLowerCase())?u&&u.source==\"player\"||r.playVideo(i,$vxp.getPlayType(),k):(f=$vxp(n),f.height(f.height()),f.css(\"visibility\",\"hidden\"),f.find(\"iframe\").attr(\"src\",\"\"),setTimeout(function(){r&&r.dispose(),f[0].innerHTML=\"\",f.setConfig(\"AutoPlayVideo\",\"true\"),f.setConfig(\"RenderHtmlAsAttribute\",\"false\"),f.widgetRefresh(function(){$vxp.vxpClearFind(\"div.vxp_player\"),f.css(\"height\",\"auto\")})},0)),$vxp(\"#player1380x1024ad\").hide(),$vxp(\"#player1000x650ad\").html(\"\")},ot=function(){var t=$vxp.vxpGlobal.players[u].type;r=new $vxp.vxpGlobal.adapters[t]($vxp(n)),$vxp.vxpGlobal.players[u].adapter=r,$vxp.vxpGlobal.players[u].isReady=!0,g(),$vxp(n).fireEvent(\"playerReady\",u)},tt=function(t){var i=$vxp.getPageWidget().getConfig(\"ServicesRoot\")+\"/videodata/?callback=?\";$vxp.getJSON(i,{responseEncoding:\"json\",ids:t,detailed:\"true\",v:\"2\"},function(t){t&&t.videos&&t.videos.length==1&&($vxp(n).data(\"videoMetadata\",t.videos[0]),$vxp(n).fireEvent(\"videoChanged\",t.videos[0]))})};$vxp.vxpGlobal.players[u]&&$vxp.vxpGlobal.players[u].loadState==\"loaded\"?ot():$vxp(n).subscribeEvent(\"playerObjectReady\",ot,$vxp(n)),$vxp(n).subscribeEvent(\"videoOpening\",ft,$vxp(n)),$vxp(n).subscribeEvent(\"adOpening\",ft,$vxp(n)),$vxp(n).subscribeEvent(\"playVideoInternal\",function(n){lt(n.id,n.metadata),tt(n.id)}),$vxp(n).registerDispose(function(){var t,i;$vxp.vxpGlobal.players[u]&&($vxp.vxpGlobal.players[u].adapter&&$vxp.vxpGlobal.players[u].adapter.dispose(),delete $vxp.vxpGlobal.players[u]),t=$vxp(n).find(\"object\");if(t.length>0){t=t[0];try{for(i in t)typeof t[i]==\"function\"&&(t[i]=null)}catch(r){}}t=null}),tt(e)});(function(n){n.vxpGlobal.adapters.vevo=function(){this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!1},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.getPositionEx=function(){},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getVolume=function(){return null},this.setVolume=function(){},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){}}})($vxp);(function(n){n.vxpGlobal.adapters.youtube=function(t){var i=window[\"ytp_\"+t.attr(\"id\")];this.isSeekSupported=function(){return!1},this.isShareSupported=function(){return!1},this.isContinuousPlaySupported=function(){return!1},this.isVideoPlayingEventSupported=function(){return!1},this.isAdPlaying=function(){return!1},this.getPosition=function(){return 0},this.getPositionEx=function(){},this.setPosition=function(){},this.getAdPosition=function(){return 0},this.getAdPosition=function(){return 0},this.getVolume=function(){if(i.getVolume){var n=i.getVolume()/100,t=i.isMuted();return{volume:n,mute:t}}return{volume:0,mute:!1}},this.setVolume=function(n,t){i.setVolume&&(i.setVolume(Math.floor(n*100)),t?i.mute():i.unMute())},this.pauseVideo=function(){},this.playVideo=function(){},this.resize=function(){},this.dispose=function(){i=null},window.youTubeAdapterOnStateChange=function(i){i.data==0?n(t).fireEvent(\"contentComplete\"):i.data==1&&n.fireEvent(\"CountdownCancelRequest\",!0)},i&&i.addEventListener&&i.addEventListener(\"onStateChange\",youTubeAdapterOnStateChange)}})($vxp);$vxp.registerWidget(\"infoPane\",function(n){var t=$vxp(n).find(\".description\"),i=$vxp(n).parents(\".vxp_scrollable\"),r=parseInt(t.css(\"max-height\"));t.css(\"max-height\",\"1000px\"),$vxp.updateScrolling($vxp(n))});$vxp.registerWidget(\"playerControls\",function(n){function c(n,t){try{var e=n.videoid,o=$vxp.getPageWidget().getConfig(\"VideoCatalogUrl\"),s=o+\"/frauddetect.aspx?callbackName=?\",h=n.playersize==\"Small\"?\"544x306\":\"800x450\",c=document.body.offsetWidth+\"x\"+$vxp(window).height(),f=$vxp.getPageWidget().getConfig(\"Market\"),r=$vxp.getPlaySource(),u=$vxp.qsp(\"from\");u==null&&(u=\"\"),r==null&&(r=\"\");var l=$vxp.getPageWidget().getConfig(\"FlightId\"),a=$vxp.getFlightId(l),v={u:e,t:\"4\",plt:n.playertype,fr:n.reportingfr||f,from:u,flight:a,src:r,c8:n.playertype,c9:\"MP\",pl:document.location.href,rl:document.referrer,pbStatus:\"\",av:4,brs:c,ng:t,mkt:f,pv:\"\",size:h};$vxp.getJSON(s,v,function(){})}catch(y){}}function l(){var t=$vxp(\".vxp_videoModule .vxpMultiplayerAd\"),i,n,c,s,a,h,v;i=t.offset().left,n=t.offset().top,c=t.width(),s=t.height(),a=Math.max($vxp(window).height(),$vxp(\".uXPage\").height()),h=Math.max($vxp(window).width(),$vxp(\".uXPage\").width()),v=Math.max(0,h-(i+c)),r.css(\"width\",h+\"px\").css(\"height\",n+\"px\"),f.css(\"width\",h+\"px\").css(\"height\",a+\"px\").css(\"top\",n+s+\"px\"),e.css(\"width\",i+\"px\").css(\"height\",s+\"px\").css(\"top\",n+\"px\"),o.css(\"width\",v+\"px\").css(\"height\",s+\"px\").css(\"top\",n+\"px\").css(\"left\",i+c+\"px\"),u=setTimeout(l,1e3)}var r,f,e,o,u,t=$vxp.vxpFind(\"div.vxp_player\"),i,a=$vxp(n).find(\".vxp_playerControls_facebook .vxp_playerControls_facebookLike\"),h,s;$vxp(a).each(function(){var t=$vxp(this).attr(\"href\"),i=$vxp(this).attr(\"colorscheme\"),r=$vxp(this).attr(\"layout\"),u=$vxp(this).attr(\"show_faces\"),f=$vxp(this).attr(\"font\"),e=$vxp(this).attr(\"send\"),o=document.location.protocol+\"//\"+document.location.host+document.location.pathname,n;t=t.replace(\"\",encodeURI(o)),n=\"\",$vxp(this).html(n),setTimeout(function(){try{FB.XFBML.parse()}catch(n){}},1500)}),h=$vxp(n).find(\".vxp_playerControls_facebook .vxp_playerControls_facebookSend\"),$vxp(h).each(function(){var n=$vxp(this).attr(\"href\"),i=$vxp(this).attr(\"colorscheme\"),r=$vxp(this).attr(\"layout\"),u=$vxp(this).attr(\"show_faces\"),f=$vxp(this).attr(\"font\"),e=document.location.protocol+\"//\"+document.location.host+document.location.pathname,t;n=n.replace(\"\",encodeURI(e)),t=\"\",$vxp(this).html(\"\").html(t);try{FB.XFBML.parse()}catch(o){}});try{$vxp(\".vxp_fbsubscribe_mp\").length<1&&(FB.Event.subscribe(\"edge.create\",function(n){var t=$vxp(\".vxp_player\").getConfigs();c(t,0,n)}),FB.Event.subscribe(\"edge.remove\",function(n){var t=$vxp(\".vxp_player\").getConfigs();c(t,1,n)}),$vxp(\"body\").append(\"
    \"))}catch(v){}$vxp(n).find(\".vxp_playerControls_button\").hover(function(){$vxp(this).addClass(\"vxp_playerControls_hover\")},function(){$vxp(this).removeClass(\"vxp_playerControls_hover\")}),$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_share\").click(function(){$vxp(this).hasClass(\"vxp_playerControls_disabled\")||i.adapter.toggleSharePane()}),$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_dim\").click(function(){$vxp(this).hasClass(\"vxp_playerControls_disabled\")||$vxp.dimLights(800,!0)}),$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_size\").click(function(){var u=t.getConfig(\"PlayerType\"),f=t.getConfig(\"VideoContentSource\"),e=t.getConfig(\"VideoId\"),r=$vxp.VideoModule.getSize()==\"Small\",i;if((u==\"Bing\"||u==\"BingExternal\")&&f!=\"YouTube\"&&f!=\"Dailymotion\")return i=document.location.href.toString(),i.indexOf(\"/watch/\")==-1&&(i=$vxp.setUrlParam(i,\"videoId\",e)),i=$vxp.setUrlParam(i,\"PlayerSize\",r?\"Large\":\"Small\"),window.location=i,!1;r?($vxp(n).find(\".vxp_playerControls_size .vxp_videomodule_small\").show(),$vxp(n).find(\".vxp_playerControls_size .vxp_videomodule_large\").hide()):($vxp(n).find(\".vxp_playerControls_size .vxp_videomodule_small\").hide(),$vxp(n).find(\".vxp_playerControls_size .vxp_videomodule_large\").show()),$vxp.VideoModule.setSize(r?\"Large\":\"Small\"),$vxp.VideoModule.updateLayout(),$vxp.reportClick({click:r?\"large\":\"small\",prop13:\"playerResize\",rf:\"\"})}),setTimeout(function(){var r=t.getConfig(\"PlayerType\");r==\"Bing\"&&navigator.userAgent.indexOf(\"Mac\")==-1&&i.type!=\"msn:html5\"&&i.type!=\"dailymotion\"&&$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_dim\").removeClass(\"vxp_playerControls_disabled\")},0),$vxp.raiseLights=function(){u&&(clearTimeout(u),u=null),$vxp(\".dimBg\").hide()},$vxp.dimLights=function(n,t){if(!r){var i=$vxp('
    ');r=i.clone(),f=i.clone(),e=i.clone(),o=i.clone(),$vxp(document.body).append(r).append(f).append(e).append(o),t&&$vxp(\".dimBg\").click(function(){$vxp.raiseLights()})}$vxp(\".dimBg\").css(\"opacity\",0).show().animate({opacity:$vxp.frontDoorMode?.8:.7},n),l()},s=function(){t=$vxp.vxpFind(\"div.vxp_player\"),i=$vxp.vxpGlobal.players[t.attr(\"id\")],i.adapter&&i.adapter.isShareSupported()?$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_share\").removeClass(\"vxp_playerControls_disabled\"):$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_share\").addClass(\"vxp_playerControls_disabled\"),navigator.userAgent.indexOf(\"Mac\")==-1&&i.type!=\"msn:html5\"&&i.type!=\"dailymotion\"&&$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_dim\").removeClass(\"vxp_playerControls_disabled\"),$vxp(\".vxp_player .vxp_externalVideo\").length>0?$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_size\").hide():$vxp(n).find(\".vxp_playerControls_button.vxp_playerControls_size\").show()},$vxp.vxpGlobal.players[t.attr(\"id\")]&&$vxp.vxpGlobal.players[t.attr(\"id\")].loadState==\"loaded\"&&s(),$vxp(n).subscribeEvent(\"playerReady\",function(){s()})});$vxp.registerWidget(\"playerRow\",function(){});$vxp.registerWidget(\"videoModule\",function(n){var u=$vxp.getPageWidget().getConfig(\"VideoId\"),i=$vxp(n).getConfig(\"BannerAdHtml\"),t=$vxp.vxpFind(\"div.vxp_player\").attr(\"id\"),r=function(t,r){$vxp.vxpGlobal.vidap=r.source,$vxp(n).fireEvent(\"playVideoInternal\",{id:t,metadata:r}),$vxp(n).find(\".vxpMultiplayerAd\").html(i);var u=$vxp.VideoModule.getSize();$vxp(n).find(\".vxp_playerControls\").setConfig(\"PlayerSize\",u),$vxp(n).find(\".vxp_playerControls\").setConfig(\"VideoId\",t),$vxp(n).find(\".vxp_playerControls\").widgetRefresh(),$vxp(n).find(\".vxp_infoPane\").setConfig(\"VideoId\",t),$vxp(n).find(\".vxp_infoPane\").widgetRefresh(function(){$vxp.updateScrolling($vxp(n).find(\".vxp_infoPane .vxp_scrollable\"))}),r.source==\"click\"&&($vxp(n).scrollTo(),$vxp(n).find(\".vxp_videoQueue\").setConfig(\"VideoId\",t),$vxp(n).find(\".vxp_videoQueue\").setConfig(\"SmartPoolTargetingKey\",\"\"),$vxp(n).find(\".vxp_videoQueue\").widgetRefresh(function(){$vxp.updateScrolling($vxp(n).find(\".vxp_videoQueue .vxp_scrollable\"))}))};$vxp(n).subscribeEvent(\"playerReady\",function(){$vxp.VideoModule.updateLayout()}),$vxp(n).subscribeEvent(\"playVideo\",function(n){r(n.id,n.metadata)}),$vxp.VideoModule={},$vxp.VideoModule.getSize=function(){return $vxp.vxpFind(\"div.vxp_player\").getConfig(\"PlayerSize\")},$vxp.VideoModule.setSize=function(t){$vxp.vxpFind(\"div.vxp_player\").setConfig(\"PlayerSize\",t),$vxp(n).find(\".vxp_playerControls\").setConfig(\"PlayerSize\",t)},$vxp.VideoModule.updateLayout=function(i){function g(){$vxp.browser.msie&&parseInt($vxp.browser.version,10)<7&&($vxp(\".vxp_videoModule .vxp_leftPanel\").css(\"top\",o?\"1px\":\"-1px\"),$vxp(\".vxp_videoModule .vxpMultiplayerAd\").css(\"bottom\",o?\"29px\":\"31px\"),$vxp(\".watchPageGallery\").hide(),$vxp(\".watchPageGallery\").show()),i||$vxp.updateScrolling($vxp(\".vxp_videoQueue\").find(\".vxp_scrollable\")),$vxp.vxpGlobal.players[t]&&$vxp.vxpGlobal.players[t].adapter&&$vxp.vxpGlobal.players[t].adapter.resize&&$vxp.vxpGlobal.players[t].adapter.resize()}var u=$vxp(n).find(\".vxp_playerContainer\"),r=u.find(\"div.vxp_player\"),p=r.find(\".vxp_richEmbedContainer\"),h=r.getConfig(\"PlayerType\"),a=r.getConfig(\"VideoContentSource\"),nt=r.getConfig(\"VideoId\"),v=r.find(\"OBJECT, EMBED\"),c=$vxp(n).find(\".vxp_videoContainer\"),e=$vxp(n).find(\".vxp_videoQueueContainer\"),o=$vxp.VideoModule.getSize()==\"Small\",s=o?r.getConfig(\"SmallWidth\"):r.getConfig(\"LargeWidth\"),f=o?r.getConfig(\"SmallHeight\"):r.getConfig(\"LargeHeight\"),w=u.find(\".vxp_controlsContainer\").outerHeight(),d,y;o?($vxp(n).find(\".vxp_moduleContainer\").addClass(\"vxp_videomodule_small\"),$vxp(n).find(\".vxp_moduleContainer\").removeClass(\"vxp_videomodule_large\")):($vxp(n).find(\".vxp_moduleContainer\").addClass(\"vxp_videomodule_large\"),$vxp(n).find(\".vxp_moduleContainer\").removeClass(\"vxp_videomodule_small\")),$vxp.vxpGlobal.players[t]&&$vxp.vxpGlobal.players[t].type==\"msn:flash\"&&(f+=r.getConfig(\"FlashControlBarHeight\"));var b=u.width(),k=u.height(),l=b!=s||k!=f+w;(h==\"Bing\"||h==\"BingExternal\")&&a!=\"YouTube\"&&a!=\"Dailymotion\"||!l||(v.css(\"height\",f),v.css(\"width\",s),p.css(\"height\",f),p.css(\"width\",s),u[0].style.height!=\"auto\"&&u.css(\"height\",f+w),u.css(\"width\",s),u.find(\"iframe\").css(\"width\",s).css(\"height\",f)),o?(e.removeClass(\"vxp_videomodule_large\"),e.addClass(\"vxp_videomodule_small\")):(e.removeClass(\"vxp_videomodule_small\"),e.addClass(\"vxp_videomodule_large\")),d=$vxp.vxpFind(\"div.vxp_videoModule\").width()-u.outerWidth(!0),y=u.outerHeight(!0)-(e.outerHeight(!0)-e.height())-(c.outerHeight(!0)-c.height())-e.find(\".vxpVideoQueueHeader\").height(),c.css(\"height\",y),h==\"Hulu\"&&undefined!=window.NewSite&&l&&!i?NewSite.videoPlayerComponent.setSize(s,f):(h==\"Cbs\"||h==\"Mtv\"||h==\"Vevo\")&&l&&!i&&(r.setConfig(\"AutoPlayVideo\",\"true\"),r.setConfig(\"IsRefresh\",\"true\"),r.css(\"visibility\",\"hidden\"),setTimeout(function(){r[0].innerHTML=\"\",r.widgetRefresh(function(){$vxp.vxpClearFind(\"div.vxp_player\")})},0)),g()}});$vxp.registerWidget(\"multiplayerLite\",function(n){var t=$vxp(n).getConfigs(),e=t.playlistdata,o=t.countdowntime,u,kt=t.continuousplayenabled,vt=t.continuousplaysource,dt=t.playlistvideoid,d=t.playbackmode,k=t.multimediaviewer,nt=t.leadwithimagevideoid,ai=t.leadwithimagevideolink,it=t.leadwithimagelinkoff,li=t.rawplaylist,ci=t.useexternalad,hi=t.banneradhtml,ei=t.adtriggervideosplayed,ti=t.adtriggertimeplaying,gt=t.adsallowed,ii=t.adfullexperience,ri=t.adpartialexperience,ui=t.msnplayerleadswith,fi=t.displaymetadata,wi=t.videoid,pi=$vxp(n).attr(\"id\"),r=t.playlistindex,ut=t.banneraddivid,si=t.socialreader,ft=!1,bi,i=$vxp(n).find(\"div.vxp_player\"),ki,yi=!1,y,v=!1,f=!1,a=!1,l=window.navigator.userAgent.match(/MSIE\\s([\\d.]+)/),vi=l&&l.length>1&&l[1].indexOf(\"10\")==0,ni=window.navigator.userAgent.match(/iPad/i),et,c=function(){var n=oi();return n?n.adapter:null},oi=function(){return $vxp.vxpGlobal.players[i.attr(\"id\")]},st=function(n){y=n,g()},g=function(){var t=y,u=t.playerType.toLowerCase(),i;u==\"msn\"?(i=$vxp(n).find(\"div.vxp_player\").attr(\"id\"),$vxp(n).data(\"msnPlayerId\",i)):$vxp(n).data(\"msnPlayerId\",null),$vxp(n).data(\"playlistIndex\",r),$vxp(n).data(\"videoMetadata\",t),$vxp(n).trigger(\"videoChanged\",t)},tt=function(n){if($vxp.isNumber(n)&&e.list.item&&n>=0&&n10&&t.height()>=5&&(i=$vxp(n).find(\"div.vxpMultiLiteImagePlaceholder\"),i.length>0&&i.position()&&t.css(\"top\",$vxp(n).find(\"div.vxpMultiLiteImagePlaceholder\").position().top).parents(\".vxpMultiLiteInfo\").addClass(\"vxpMultiLiteAdEnabled\"))},100))},lt=function(t){var i=$vxp(n).find(\".vxp_multiplayerLiteInfoPane\");i.height(i.height()),i.setConfig(\"VideoId\",t),i.setConfig(\"InfoPaneExpanded\",!0),i.widgetRefresh(function(){i.css(\"height\",\"auto\")})},at=function(){fi&&$vxp(n).find(\".vxpMultiLiteExtraRow\").addClass(\"vxpMultiLiteExpandedInfo\"),$vxp(n).addClass(\"vxpMultiLiteExpandedInfo\")},w=function(){s(),at()},yt=function(){w()},pt=function(){w()},wt=function(){var s,f,t;o=i.getConfig(\"CountdownTime\"),vt.toLowerCase()==\"internal\"?(r++,r>=e.list.item.length&&(r=0),s=e.list.item[r].video.id.$,$vxp(n).setConfig(\"VideoId\",s),f=o,t=$vxp(n).find(\".vxpUpNextItem .vxp_playlist_countdown_text\"),t.html(f).show(),u=setInterval(function(){f--,f<=0?(clearInterval(u),t.hide(),tt(r)):t.html(f)},1e3)):($vxp(n).fireEvent(\"countdownStart\",o),t=o,u=setInterval(function(){t--,t==0&&($vxp(n).fireEvent(\"countdownComplete\"),clearInterval(u))},1e3))},bt=function(){var u=!1,r,o;$(\"meta\").each(function(n,t){var r=t.httpEquiv,i=$(t).attr(\"content\");r&&i&&(r=r.toLowerCase(),i=i.toLowerCase(),r==\"x-ua-compatible\"&&(i==\"ie=7\"||i==\"ie=8\")&&(u=!0))});var s=$vxp.hasSilverlight(4),f=$vxp.hasFlash(10),h=$vxp.hasHtml5();if(si&&it)r=document.location.href.replace(\"https://\",\"http://\"),r=$vxp.setUrlParam(r,\"social\",null),window.open(r,\"_blank\");else if(!it&&(d!=\"MultimediaViewer\"||f||ni||vi)&&(!l||!u||s||f||h))if(d==\"MultimediaViewer\"&&window.MsnVideoUx&&MsnVideoUx.launchOverlayPlayer){var e=k.widget.configId.$||k.widget.label.$,c=k.widget.csid.$,a=$vxp.getPageWidget().getConfig(\"hubDomain\"),i={DynamicInitialVideoId:nt,DynamicPlaylistQuery:li,DynamicModules:\"video\",DynamicMsnPlayerLeadsWith:ui,Preview:\"true\"};e==\"vxp_launch_empty\"&&(i.DynamicAdTriggerVideosPlayed=ei,i.DynamicAdTriggerTimePlaying=ti,i.DynamicAdsAllowed=gt,i.DynamicAdFullExperience=ii,i.DynamicAdPartialExperience=ri,i.DynamicHtml5UseHls=t.html5usehls,i.DynamicHtml5AdTriggerTimePlaying=t.html5adtriggertimeplaying,i.DynamicHtml5AdTriggerVideosPlayedNoAds=t.html5adtriggervideosplayednoads,i.DynamicHtml5AdPolicy=t.html5adpolicy,i.DynamicHtml5AdFullExperience=t.html5adfullexperience,i.DynamicHtml5AdEventTimeout=t.html5adeventtimeout,i.DynamicHtml5AdServiceUrl=t.html5adserviceurl,i.DynamicHtml5AdProxyServiceUrl=t.html5adproxyserviceurl,i.DynamicHtml5AdServiceType=t.html5adservicetype),o=$vxp.isHub?!0:!1,MsnVideoUx.launchOverlayPlayer(e,c,i,{hubDomain:a,loadCss:o},!1,!0)}else $vxp(n).setConfig(\"PlaybackMode\",\"Inline\"),$vxp(n).setConfig(\"AutoPlayVideo\",\"True\"),$vxp(n).setConfig(\"VideoId\",nt),$vxp(n).widgetRefresh();else window.location=ai},p=function(){v=!1,f=!0;var t=$vxp(n).find(\"div.vxpMultiLitePlaylist\");t.animate({opacity:0},500,null,function(){f=!1,t.css(\"display\",\"none\")})},ot=function(n,t){if(t)h(n,t);else{var i=$vxp.getPageWidget().getConfig(\"ServicesRoot\")+\"/videodata/?callback=?\";$vxp.getJSON(i,{responseEncoding:\"json\",ids:n,detailed:\"true\",v:\"2\"},function(t){if(t&&t.videos&&t.videos.length==1){var i={dataIndex:0,selectedImgSrc:t.videos[0].thumb,supportedPlayers:t.videos[0].playerAdapter};h(n,i)}})}},b;$vxp(n).subscribeEvent(\"videoPlaying\",yt,i),$vxp(n).subscribeEvent(\"adPlaying\",pt,i),$vxp(n).subscribeEvent(\"videoOpening\",s,i),$vxp(n).subscribeEvent(\"adOpening\",s,i),$vxp(n).subscribeEvent(\"paneOpened\",s,i),$vxp(n).subscribeEvent(\"videoChanged\",st,i),kt&&$vxp(n).subscribeEvent(\"contentComplete\",wt,i),$vxp(n).subscribeEvent(\"playerReady\",function(){i=$vxp(n).find(\"div.vxp_player\"),c()&&(!c().isVideoPlayingEventSupported()||c().isContentStarted())&&w(),$vxp(n).data(\"playerReady\",!0),$vxp(n).trigger(\"playerReady\",c())},i),$vxp(n).bind(\"playVideo\",function(n,t,i){ot(t,i)}),$vxp(n).bind(\"playVideoIndex\",function(n,t){tt(t)}),$vxp(n).subscribeEvent(\"playVideo\",function(n){h(n.id,n.metadata)}),MsnVideo2.addMessageReceiver({eventType:\"LoadVideo\",widgetGroup:$vxp(n).groupId(),funcCb:function(n){ot(n.param.uuid)}}),b=!1,$vxp(n).mouseover(function(t){b||(b=!0,d!=\"Inline\"&&i.find(\"div.vxp_richEmbedContainer\").click(bt),i.parent().hover(function(){$vxp(n).getConfig(\"PlaybackMode\")==\"Inline\"&&(a=!0,setTimeout(function(){if(a&&!f&&!v){f=!0,v=!0;var t=$vxp(n).find(\"div.vxpPlaylistOverVideo\");t.css(\"display\",\"block\").css(\"opacity\",0).animate({opacity:1},500,null,function(){f=!1})}},500))},function(n){a=!1,setTimeout(function(){if($vxp(n.relatedTarget||n.toElement).parents().andSelf().filter(\".vxpPlaylistOverVideo\").length>0)return;a||f||!v||p()},500)}),$vxp(n).find(\"div.vxpPlaylistOverVideo\").hover(function(){},function(){p()}),$vxp(n).find(\"div.vxpMultiLitePlaylistClose\").click(function(){p()}),$vxp(t.target).mouseover())}),ct(),rt(),!y&&i.data(\"videoMetadata\")&&(y=i.data(\"videoMetadata\"),g()),$vxp(n).registerDispose(function(){clearInterval(et)})});$vxp.registerWidget(\"multiplayerLiteInfoPane\",function(n){function r(n,t){try{var e=n.videoid,o=$vxp.getPageWidget().getConfig(\"VideoCatalogUrl\"),s=o+\"/frauddetect.aspx?callbackName=?\",h=n.playersize==\"Small\"?\"544x306\":\"800x450\",c=document.body.offsetWidth+\"x\"+$vxp(window).height(),f=$vxp.getPageWidget().getConfig(\"Market\"),r=$vxp.getPlaySource(),u=$vxp.qsp(\"from\");u==null&&(u=\"\"),r==null&&(r=\"\");var l=$vxp.getPageWidget().getConfig(\"FlightId\"),a=$vxp.getFlightId(l),v={u:e,t:\"4\",plt:n.playertype,fr:n.reportingfr||f,from:u,flight:a,src:r,c8:n.playertype,c9:\"MPL\",pl:document.location.href,rl:document.referrer,pbStatus:\"\",av:4,brs:c,ng:t,mkt:f,pv:\"\",size:h};$vxp.getJSON(s,v,function(){})}catch(y){}}var t,i;$vxp(n).find(\"span.vxpMultiLiteDescriptionMore\").click(function(){$vxp(n).find(\"span.vxpMultiLiteDescriptionFull\").show(),$vxp(n).find(\"span.vxpMultiLiteDescriptionPartial, span.vxpMultiLiteDescriptionMore\").hide()}),t=$vxp(n).find(\".vxp_playerControls_facebook .vxp_playerControls_facebookLike\"),$vxp(t).each(function(){var t=$vxp(this).attr(\"href\"),i=$vxp(this).attr(\"colorscheme\"),r=$vxp(this).attr(\"layout\"),u=$vxp(this).attr(\"show_faces\"),f=$vxp(this).attr(\"font\"),e=$vxp(this).attr(\"send\"),o=document.location.protocol+\"//\"+document.location.host+document.location.pathname,n;t=t.replace(\"\",encodeURI(o)),n=\"\",$vxp(this).html(\"\").html(n),setTimeout(function(){try{FB.XFBML.parse()}catch(n){}},1500)}),i=$vxp(n).find(\".vxp_playerControls_facebook .vxp_playerControls_facebookSend\"),$vxp(i).each(function(){var n=$vxp(this).attr(\"href\"),i=$vxp(this).attr(\"colorscheme\"),r=$vxp(this).attr(\"layout\"),u=$vxp(this).attr(\"show_faces\"),f=$vxp(this).attr(\"font\"),e=document.location.protocol+\"//\"+document.location.host+document.location.pathname,t;n=n.replace(\"\",encodeURI(e)),t=\"\",$vxp(this).html(\"\").html(t);try{FB.XFBML.parse()}catch(o){}});try{$vxp(\".vxp_fbsubscribe_mpl\").length<1&&(FB.Event.subscribe(\"edge.create\",function(n){var t=$vxp(\".vxp_multiplayerLiteInfoPane\").parents(\".vxp_multiplayerLite\").find(\".vxp_player\").getConfigs();r(t,0,n)}),FB.Event.subscribe(\"edge.remove\",function(n){var t=$vxp(\".vxp_multiplayerLiteInfoPane\").parents(\".vxp_multiplayerLite\").find(\".vxp_player\").getConfigs();r(t,1,n)}),$vxp(\"body\").append(\"
    \"))}catch(u){}});$vxp.registerWidget(\"silverlightInstall\",function(n){var t=$vxp.vxpGlobal.players[$vxp.vxpFind(\"div.vxp_player\").attr(\"id\")],i;if(t&&t.loadState&&t.loadState.indexOf(\"install\")!=-1&&t.loadState!=\"install:flash\"){i=$vxp.hasFlash(t.loadContext.flashVersion),t.loadState==\"install:restart\"?s():t.loadState==\"install:incompatible\"?h():t.loadState==\"install:unpromptable\"?c():t.loadState==\"install:flash\"||t.loadState==\"install:silverlight\"&&(i&&$vxp(\".remindLater\").show(),$vxp(\".noThanks\").show()),$vxp.browser.msie?$vxp(\".homePage\").show():$vxp(\"#homePageCheckBox\").attr(\"checked\",!1),window.external&&typeof window.external.AddSearchProvider!=\"undefined\"?$vxp(\".searchProvider\").show():$vxp(\"#searchProviderCheckBox\").attr(\"checked\",\"false\"),$vxp(\".install\").click(function(){var i=$vxp(this).hasClass(\"restartInstallation\")?\"restart install\":\"install button\",t;return $vxp.cookie(\"rf\",null),$vxp.reportClick({click:i,prop13:\"sl3installer\",rf:\"\"}),$vxp.reportPageView({pn:\"sl3install:run\",pt:\"SL_click\",prop4:\"sl3install:run\",rf:\"\"}),o(),$vxp(\"#homePageCheckBox\").attr(\"checked\")&&(t=document.createElement(\"div\"),t.style.behavior=\"url(#default#homepage)\",t.setHomePage($vxp(n).getConfig(\"HomePageUrl\"))),window.location=f()&&a()&&!v()?$vxp(\".installLink\").attr(\"href\"):\"http://go2.microsoft.com/fwlink/?linkid=124807\",!1}),$vxp(\".remindLater\").click(function(){$vxp.reportClick({click:\"remind me later\",prop13:\"sl3installer\"}),r()}),$vxp(\".noThanks\").click(function(){$vxp.reportClick({click:\"no thanks\",prop13:\"sl3installer\"}),r()});function r(){$vxp.cookie(\"viddsl\",\"1\",t.loadContext.declineSilverlightCookieTime);if(i&&t.loadContext.flashAvailable)document.location=document.location.href.toString();else{var n=document.referrer.toString();n==\"\"&&(n=$vxp.cookie(\"vidref\")),e(n)&&n!=document.location.href.toString()||(n=t.loadContext.fallbackUrl),document.location=n}}function e(n){return n!=undefined&&n!=\"\"&&u(document.location.href.toString())==u(n)}function u(n){return n&&(n=n.slice(7),n=n.split(\"/\")[0]),n}function o(){$vxp(n).addClass(\"step2\"),$vxp(n).find(\".restartInstallation\").show(),$vxp(n).find(\".pane\").hide(),f()?l()?$vxp(n).find(\".step2.pc\").show():$vxp(n).find(\".step2.pcff\").show():$vxp(n).find(\".step2.mac\").show()}function s(){$vxp(n).find(\".pane\").hide(),$vxp(n).find(\".restart\").show()}function h(){$vxp(n).find(\".pane\").hide(),$vxp(n).find(\".notsupported\").show()}function c(){$vxp(n).find(\".pane\").hide(),$vxp(n).find(\".unpromptable\").show()}function f(){return navigator.appVersion.indexOf(\"Mac\")==-1}function l(){return navigator.appVersion.indexOf(\"MSIE\")!=-1}function a(){return $vxp.browser.msie&&($vxp.browser.version==\"7.0\"||$vxp.browser.version==\"8.0\")&&navigator.userAgent.indexOf(\"Trident/5.0\")<0}function v(){return window.navigator.userAgent.toString().indexOf(\"Windows NT 5.1\")!=-1}}}),vxpPreWait(function(n){function t(t){var i=n.vxpGlobal.players[n.vxpFind(\"div.vxp_player\").attr(\"id\")];if(i&&i.loadState&&i.loadState.indexOf(\"install\")!=-1&&i.loadState!=\"install:flash\"&&i.loadState!=\"install:silverlight:simple\"){n(\".ux.vxp_player\").hide(),n.dimLights(500,!1);var u=n(\".vxp_pageContent, .ux.hub\"),f=n(\".vxp_playerRow\"),r=n(\".vxp_silverlightInstall\"),e=(n(u).width()-r.width())/2+n(u).offset().left,o=n(f).offset().top;r.setConfig(\"UserHasFlash\",n.hasFlash(i.loadContext.flashVersion)),r.widgetRefresh(function(){r=n(\".vxp_silverlightInstall\");var t=n(i.loadContext.videoData.isBing?'
    ':\"
    \");n(document.body).append(t),n(t).append(r),n(t).css(\"position\",\"absolute\"),n(t).css(\"z-index\",1e5),n(t).css(\"left\",e+\"px\"),n(t).css(\"top\",o+\"px\")}),t||n.reportPageView({prop4:\"sl3installer\",prop7:n(\".vxp_videoModule .vxp_widgetMode\").length==0?\"dest^slinstall\":\"dest hub^slinstall\",pt:\"slinstall\",pn:\"sl3installer\",prop11:\"\"})}}n.subscribeEvent(\"pageReady\",t,\"silverlightInstall\"),n.subscribeEvent(\"openSilverlightInstaller\",t,\"silverlightInstall\")});$vxp.registerWidget(\"videoQueue\",function(n){var i=$vxp(n).getConfigs(),ft=i.smartpreviewplayerurl,it=i.userplaylistenabled,ut=i.continuousplaycontextkey,t=i.continuousplayindex,r=i.continuousplaytotal,nt=i.currentvideoid,g=i.issmartpool,b=i.issmartpoolready,p=i.smartpooltkserviceurl,v=i.smartpoolpingserviceurl,o=i.smartpoolvideoids,a=\"editor\",w=$vxp(n).find(\".vxp_gallery_item\")[0].cloneNode(!0),f=!1,k=i.playinline,d=function(t){t.find(\".vxp_removeFromQueueButton\").click(function(i){i.preventDefault();var r=$vxp(n).find(\".vxp_gallery_item\").index(t);$vxp.vxpGlobal.playlist.remove(r)})},u=function(){var u,i;$vxp(n).find(\".vxp_gallery_item\").removeClass(\"vxp_playlist_playing\").removeClass(\"vxp_playlist_next\"),t!=-1&&(u=$vxp(n).find(\".vxp_gallery_item\").eq(t),u.addClass(\"vxp_playlist_playing\"),$vxp.scrollTo($vxp(n).find(\"div.vxp_videoContainer\"),u)),i=t+1,i>=r&&(i=0),i!=t&&$vxp(n).find(\".vxp_gallery_item\").eq(i).addClass(\"vxp_playlist_next\")},c=function(){t=-1,r=0,e(r),$vxp(n).find(\"div.vxp_videoqueuegrid\").html(\"\"),$vxp.updateScrolling($vxp(n).find(\".vxp_scrollable\")),$vxp.vxpGlobal.playlist.exists()||(f=!1,$vxp(n).widgetRefresh())},tt=function(i){r--,e(r),i==t?t=-1:i0)try{l=$vxp.queryString.setParam(s,{rel:h.rel,q:h.q,playerSize:h.playersize})}catch(y){}l&&(s=l),o.attr(\"data-videoId\",t.id),o.attr(\"data-motionThumb\",t.motionThumb),o.attr(\"data-isBing\",t.isBing),o.attr(\"data-providerId\",t.providerId||\"\"),o.find(\".vxp_motionThumb\").attr(\"title\",t.description),o.find(\".vxp_playerUrl.vxp_title\").attr(\"title\",t.description),o.attr(\"data-desc\",t.desc),o.find(\".vxp_title\").html(\"\"+(t.title&&t.title.text?t.title.text():t.title)+\"\"),o.find(\".vxp_playerUrl\").attr(\"href\",s),o.find(\"IMG\").attr(\"src\",t.thumb),o.attr(\"data-source\",t.source),o.attr(\"data-playerType\",t.playerType),o.attr(\"data-playerAdapter\",t.playerAdapter),o.attr(\"data-copyright\",t.copyright),o.find(\".vxp_removeFromQueueButton\").addClass(\"active\"),d(o),a=$vxp(n).find(\".vxp_gallery\"),$vxp(n).fireEvent(\"galleryAddVideo\",o,a),i||($vxp.updateScrolling($vxp(n).find(\".vxp_scrollable\")),u())},e=function(t){$vxp(n).find(\".vxpVideoQueueCount\").html(\" (\"+t+\")\")},rt=function(){var u,o,s;t++,t>=r&&(t=0);var i=$vxp(n).find(\".vxp_gallery_item\").eq(t),e=i.find(\".vxp_playerUrl\").eq(0).attr(\"href\"),h=i.attr(\"data-videoId\"),c=i.attr(\"data-playerAdapter\");e&&($vxp.cookie(\"vidap\",a),u=f?\"UserPlaylist\":$vxp(n).find(\".vxp_gallery\").getConfig(\"tracking\"),o=$vxp(i).attr(\"data-activityId\"),$vxp.vxpGlobal.smartPool.ping(v,\"cp\",{click:o}),k?(s=$vxp.updateTracking(\"cp\",\"\",u),$vxp.fireEvent(\"playVideo\",{id:h,metadata:{supportedPlayers:c,source:a,playerSource:s}})):($vxp.writeTrackingCookie(\"cp\",\"\",u),document.location.href=e))},s=function(){var f,s,r;$vxp(n).find(\"div.vxpVideoQueueHeader\").removeClass(\"vxp_playlist_hidden\"),f=$vxp(n).find(\"div.vxp_videoContainer\"),f.removeClass(\"vxp_playlist_hidden\"),$vxp.VideoModule.updateLayout(!0),$vxp.updateScrolling(f),u();if(o&&o!=\"\"){var i=o.split(\",\"),h=$vxp(n).width()>300,e=h?3:1,l=h?3:4,c=Math.max(0,t),a=Math.floor(Math.max(0,t)/e),c=a*e,y=Math.min(c+e*l,i.length-1);for(i=i.slice(c,y),s=[],r=0;r0&&u?(t.addClass(\"vxp_active\"),t.attr(\"title\",e)):(t.removeClass(\"vxp_active\"),t.attr(\"title\",o))};$vxp(n).click(function(n){var t,i,r;n.preventDefault(),t=$vxp.vxpGlobal.playlist.getAll(),t.length>0&&u&&(i=t[0],r=\"http://\"+$vxp.getPageWidget().getConfig(\"SiteRoot\")+\"?vid=\"+i+\"&mkt=\"+$vxp.getPageWidget().getConfig(\"Market\"),document.location.href=r)}),$vxp(n).subscribeEvent(\"playlistVideoAdded\",r),$vxp(n).subscribeEvent(\"playlistVideoRemoved\",r),$vxp(n).subscribeEvent(\"playlistCleared\",r),r()});$vxp.registerWidget(\"browserDetect\",function(n){for(var r=[\"windows ce\",\"wm5 pie\",\"iemobile\",\"blackberry\",\"android\"],h=$vxp(n).getConfig(\"IEMinVer\"),c=$vxp(n).getConfig(\"FFMinVer\"),u=$vxp(n).getConfig(\"MobileUrl\"),l=navigator.userAgent.toLowerCase(),f=!1,s,t=0;tcreate_by_url(\n EXPORTING\n url = 'http://rosettacode.org/favicon.ico'\n IMPORTING\n client = li_client ).\n\nli_client->send( ).\nli_client->receive( ).\n\nlv_data = li_client->response->get_data( ).\n\nCALL FUNCTION 'SSFC_BASE64_ENCODE'\n EXPORTING\n bindata = lv_data\n IMPORTING\n b64data = lv_encoded.\n\nWHILE strlen( lv_encoded ) > 100.\n WRITE: / lv_encoded(100).\n lv_encoded = lv_encoded+100.\nENDWHILE.\nWRITE: / lv_encoded.\n" + }, { "name": "sample.aes.txt", "content": "// Contract simulating developers organization\ncontract HackBG =\n\n record state = { developers: map(address, developer) }\n\n record developer = { name: string\n , age: int\n , skillset: map(skill, experience) }\n\n type skill = string\n type experience = int\n\n datatype event =\n LogDeveloperAdded(indexed address, indexed int, string)\n\n entrypoint init() : state = { developers = {} }\n\n stateful entrypoint dev_add(account: address, dev_name: string, dev_age: int) =\n require(!is_member(account), \"ERROR_DEVELOPER_ALREADY_EXISTS\")\n let dev : developer = { name = dev_name\n , age = dev_age\n , skillset = {} }\n put(state{ developers[account] = dev })\n Chain.event(LogDeveloperAdded(account, Chain.timestamp, dev_name))\n\n stateful entrypoint dev_update(account: address, dev_name: string, dev_age: int) =\n require(is_member(account), \"ERROR_DEVELOPER_DOES_NOT_EXIST\")\n put(state{ developers[account].name = dev_name })\n put(state{ developers[account].age = dev_age })\n\n function is_member(account: address) : bool =\n Map.member(account, state.developers)\n\n stateful entrypoint dev_skill_modify(account: address, skill: string, experience: int) =\n put(state{ developers[account].skillset[skill] = experience })\n\n entrypoint dev_get(account: address) : developer =\n state.developers[account]" }, + { + "name": "sample.apex.txt", + "content": "/* Using a single database query, find all the leads in\n the database that have the same email address as any\n of the leads being inserted or updated. */\nfor (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) {\n Lead newLead = leadMap.get(lead.Email);\n newLead.Email.addError('A lead with this email address already exists.');\n}\n" + }, + { + "name": "sample.azcli.txt", + "content": "# Create a resource group.\naz group create --name myResourceGroup --location westeurope\n\n# Create a new virtual machine, this creates SSH keys if not present.\naz vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --generate-ssh-keys" + }, { "name": "sample.bat.txt", "content": "rem *******Begin Comment**************\nrem This program starts the superapp batch program on the network,\nrem directs the output to a file, and displays the file\nrem in Notepad.\nrem *******End Comment**************\n@echo off\nif exist C:\\output.txt goto EMPTYEXISTS\nsetlocal\n\tpath=g:\\programs\\superapp;%path%\n\tcall superapp>C:\\output.txt\nendlocal\n:EMPTYEXISTS\nstart notepad c:\\output.txt" }, { "name": "sample.c.txt", - "content": "#include \"pch.h\"\n#include \"Direct3DBase.h\"\n\nusing namespace Microsoft::WRL;\nusing namespace Windows::UI::Core;\nusing namespace Windows::Foundation;\n\n// Constructor.\nDirect3DBase::Direct3DBase()\n{\n}\n\n// Initialize the Direct3D resources required to run.\nvoid Direct3DBase::Initialize(CoreWindow^ window)\n{\n m_window = window;\n \n CreateDeviceResources();\n CreateWindowSizeDependentResources();\n}\n\n// These are the resources that depend on the device.\nvoid Direct3DBase::CreateDeviceResources()\n{\n // This flag adds support for surfaces with a different color channel ordering than the API default.\n // It is recommended usage, and is required for compatibility with Direct2D.\n UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;\n\n#if defined(_DEBUG)\n // If the project is in a debug build, enable debugging via SDK Layers with this flag.\n creationFlags |= D3D11_CREATE_DEVICE_DEBUG;\n#endif\n\n // This array defines the set of DirectX hardware feature levels this app will support.\n // Note the ordering should be preserved.\n // Don't forget to declare your application's minimum required feature level in its\n // description. All applications are assumed to support 9.1 unless otherwise stated.\n D3D_FEATURE_LEVEL featureLevels[] = \n {\n D3D_FEATURE_LEVEL_11_1,\n D3D_FEATURE_LEVEL_11_0,\n D3D_FEATURE_LEVEL_10_1,\n D3D_FEATURE_LEVEL_10_0,\n D3D_FEATURE_LEVEL_9_3,\n D3D_FEATURE_LEVEL_9_2,\n D3D_FEATURE_LEVEL_9_1\n };\n\n // Create the DX11 API device object, and get a corresponding context.\n ComPtr device;\n ComPtr context;\n DX::ThrowIfFailed(\n D3D11CreateDevice(\n nullptr, // specify null to use the default adapter\n D3D_DRIVER_TYPE_HARDWARE,\n nullptr, // leave as nullptr unless software device\n creationFlags, // optionally set debug and Direct2D compatibility flags\n featureLevels, // list of feature levels this app can support\n ARRAYSIZE(featureLevels), // number of entries in above list\n D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION\n &device, // returns the Direct3D device created\n &m_featureLevel, // returns feature level of device created\n &context // returns the device immediate context\n )\n );\n\n // Get the DirectX11.1 device by QI off the DirectX11 one.\n DX::ThrowIfFailed(\n device.As(&m_d3dDevice)\n );\n\n // And get the corresponding device context in the same way.\n DX::ThrowIfFailed(\n context.As(&m_d3dContext)\n );\n}\n\n// Allocate all memory resources that change on a window SizeChanged event.\nvoid Direct3DBase::CreateWindowSizeDependentResources()\n{ \n // Store the window bounds so the next time we get a SizeChanged event we can\n // avoid rebuilding everything if the size is identical.\n m_windowBounds = m_window->Bounds;\n\n // If the swap chain already exists, resize it.\n if(m_swapChain != nullptr)\n {\n DX::ThrowIfFailed(\n m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)\n );\n }\n // Otherwise, create a new one.\n else\n {\n // Create a descriptor for the swap chain.\n DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};\n swapChainDesc.Width = 0; // use automatic sizing\n swapChainDesc.Height = 0;\n swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format\n swapChainDesc.Stereo = false; \n swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling\n swapChainDesc.SampleDesc.Quality = 0;\n swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\n swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect\n swapChainDesc.Scaling = DXGI_SCALING_NONE;\n swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications\n swapChainDesc.Flags = 0;\n\n // Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device\n\n // First, retrieve the underlying DXGI Device from the D3D Device\n ComPtr dxgiDevice;\n DX::ThrowIfFailed(\n m_d3dDevice.As(&dxgiDevice)\n );\n\n // Identify the physical adapter (GPU or card) this device is running on.\n ComPtr dxgiAdapter;\n DX::ThrowIfFailed(\n dxgiDevice->GetAdapter(&dxgiAdapter)\n );\n\n // And obtain the factory object that created it.\n ComPtr dxgiFactory;\n DX::ThrowIfFailed(\n dxgiAdapter->GetParent(\n __uuidof(IDXGIFactory2), \n &dxgiFactory\n )\n );\n\n\t\tWindows::UI::Core::CoreWindow^ p = m_window.Get();\n\n // Create a swap chain for this window from the DXGI factory.\n DX::ThrowIfFailed(\n dxgiFactory->CreateSwapChainForCoreWindow(\n m_d3dDevice.Get(),\n reinterpret_cast(p),\n &swapChainDesc,\n nullptr, // allow on all displays\n &m_swapChain\n )\n );\n \n // Ensure that DXGI does not queue more than one frame at a time. This both reduces \n // latency and ensures that the application will only render after each VSync, minimizing \n // power consumption.\n DX::ThrowIfFailed(\n dxgiDevice->SetMaximumFrameLatency(1)\n );\n }\n \n // Obtain the backbuffer for this window which will be the final 3D rendertarget.\n ComPtr backBuffer;\n DX::ThrowIfFailed(\n m_swapChain->GetBuffer(\n 0,\n __uuidof(ID3D11Texture2D),\n &backBuffer\n )\n );\n\n // Create a view interface on the rendertarget to use on bind.\n DX::ThrowIfFailed(\n m_d3dDevice->CreateRenderTargetView(\n backBuffer.Get(),\n nullptr,\n &m_renderTargetView\n )\n );\n\n // Cache the rendertarget dimensions in our helper class for convenient use.\n D3D11_TEXTURE2D_DESC backBufferDesc;\n backBuffer->GetDesc(&backBufferDesc);\n m_renderTargetSize.Width = static_cast(backBufferDesc.Width);\n m_renderTargetSize.Height = static_cast(backBufferDesc.Height);\n\n // Create a descriptor for the depth/stencil buffer.\n CD3D11_TEXTURE2D_DESC depthStencilDesc(\n DXGI_FORMAT_D24_UNORM_S8_UINT, \n backBufferDesc.Width,\n backBufferDesc.Height,\n 1,\n 1,\n D3D11_BIND_DEPTH_STENCIL);\n\n // Allocate a 2-D surface as the depth/stencil buffer.\n ComPtr depthStencil;\n DX::ThrowIfFailed(\n m_d3dDevice->CreateTexture2D(\n &depthStencilDesc,\n nullptr,\n &depthStencil\n )\n );\n\n // Create a DepthStencil view on this surface to use on bind.\n DX::ThrowIfFailed(\n m_d3dDevice->CreateDepthStencilView(\n depthStencil.Get(),\n &CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D),\n &m_depthStencilView\n )\n );\n\n // Create a viewport descriptor of the full window size.\n CD3D11_VIEWPORT viewPort(\n 0.0f,\n 0.0f,\n static_cast(backBufferDesc.Width),\n static_cast(backBufferDesc.Height)\n );\n \n // Set the current viewport using the descriptor.\n m_d3dContext->RSSetViewports(1, &viewPort);\n}\n\nvoid Direct3DBase::UpdateForWindowSizeChange()\n{\n if (m_window->Bounds.Width != m_windowBounds.Width ||\n m_window->Bounds.Height != m_windowBounds.Height)\n {\n m_renderTargetView = nullptr;\n m_depthStencilView = nullptr;\n CreateWindowSizeDependentResources();\n }\n}\n\nvoid Direct3DBase::Present()\n{\n // The first argument instructs DXGI to block until VSync, putting the application\n // to sleep until the next VSync. This ensures we don't waste any cycles rendering\n // frames that will never be displayed to the screen.\n HRESULT hr = m_swapChain->Present(1, 0);\n\n // If the device was removed either by a disconnect or a driver upgrade, we \n // must completely reinitialize the renderer.\n if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)\n {\n Initialize(m_window.Get());\n }\n else\n {\n DX::ThrowIfFailed(hr);\n }\n}\n" + "content": "// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full\n// license information.\n\n/*\n *\tCOMMAND LINE: -Ox -Gz -YX -UPROTOTYPES_REQUIRED\n */\n\n#pragma warning(disable : 4532)\n#pragma warning(disable : 4702)\n\n#if defined(_WIN32)\n\n#if defined(_M_SH)\n#define WIN_CE\n#endif\n\n#if defined(_M_AMD64)\n#define NEST_IN_FINALLY /* allow when __try nested in __finally OK */\n#endif\n\n#define NTSTATUS LONG\n#define EXCEPTION_NESTED_CALL 0x10\n#define RtlRaiseStatus(x) RaiseException((x), 0, 0, NULL)\n#define RtlRaiseException(x) \\\n RaiseException((x)->ExceptionCode, (x)->ExceptionFlags, \\\n (x)->NumberParameters, (x)->ExceptionInformation)\n#define IN\n#define OUT\n#if !(defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \\\n defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64))\n#define i386 1\n#endif\n#define try __try\n#define except __except\n#define finally __finally\n#define leave __leave\n\n#endif\n\n#define WIN32_LEAN_AND_MEAN\n\n#include \"stdio.h\"\n#if defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \\\n defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)\n#include \"setjmpex.h\"\n#else\n#include \"setjmp.h\"\n#endif\n#include \"float.h\"\n#include \"windows.h\"\n#include \"math.h\"\n\n#if !defined(STATUS_SUCCESS)\n#define STATUS_SUCCESS 0\n#endif\n#if !defined(STATUS_UNSUCCESSFUL)\n#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)\n#endif\n\n//\n// Define switch constants.\n//\n\n#define BLUE 0\n#define RED 1\n\n//\n// Define function prototypes.\n//\n\nVOID addtwo(IN LONG First, IN LONG Second, IN PLONG Place);\n\nVOID bar1(IN NTSTATUS Status, IN PLONG Counter);\n\nVOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter);\n\nVOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter);\n\nLONG Echo(IN LONG Value);\n\n#if !defined(WIN_CE) // return through finally not allowed on WinCE\nVOID eret(IN NTSTATUS Status, IN PLONG Counter);\n#endif\n\nVOID except1(IN PLONG Counter);\n\nULONG\nexcept2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);\n\nULONG\nexcept3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);\n\nVOID foo1(IN NTSTATUS Status);\n\nVOID foo2(IN PLONG BlackHole, IN PLONG BadAddress);\n\n#if !defined(WIN_CE) // return from finally not allowed on WinCE\nVOID fret(IN PLONG Counter);\n#endif\n\nBOOLEAN\nTkm(VOID);\n\nVOID Test61Part2(IN OUT PULONG Counter);\n\ndouble SquareDouble(IN double op);\n\nDECLSPEC_NOINLINE\nULONG\nPgFilter(VOID)\n\n{\n\n printf(\"filter entered...\");\n return EXCEPTION_EXECUTE_HANDLER;\n}\n\n#pragma warning(push)\n#pragma warning(disable : 4532)\n\nVOID PgTest69(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 1) {\n *State += 1;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 1) == 1) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n if (*State != 2) {\n *Fault += 1;\n }\n }\n\n return;\n}\n\nVOID PgTest70(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 2) {\n PgFilter();\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 2) == 2) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest71(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 3) {\n *State += 3;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 6) {\n *State += 3;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 3) == 3) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest72(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 4) {\n *State += 4;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 8) {\n *State += 4;\n PgFilter();\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 4) == 4) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest73(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 5) {\n *State += 5;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 10) {\n *State += 5;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 5) == 5) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest74(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 6) {\n *State += 6;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 12) {\n *State += 6;\n PgFilter();\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 6) == 6) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest75(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 7) {\n *State += 7;\n *Fault += 1;\n\n } else {\n *State += 10;\n }\n }\n }\n }\n except(((*State += 7) == 7) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 28) {\n *State += 7;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 7) == 28) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest76(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 8) {\n *State += 8;\n *Fault += 1;\n\n } else {\n *State += 10;\n }\n }\n }\n }\n except(((*State += 8) == 8) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 32) {\n *State += 8;\n PgFilter();\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 8) == 32) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest77(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 9) {\n *State += 9;\n *Fault += 1;\n\n } else {\n *State += 10;\n }\n }\n }\n }\n except(((*State += 9) == 9) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 36) {\n *State += 9;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 9) == 36) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest78(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 10) {\n *State += 10;\n PgFilter();\n *Fault += 1;\n\n } else {\n *State += 10;\n }\n }\n }\n }\n except(((*State += 10) == 10) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 40) {\n *State += 10;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 10) == 40) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\n#pragma warning(pop)\n\nVOID Test79(PLONG Counter, PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n printf(\"finally 1...\");\n *Fault += 1;\n }\n }\n finally { printf(\"finally 2...\"); }\n }\n except(*Counter += 1, printf(\"filter 1...\"), EXCEPTION_CONTINUE_SEARCH) {}\n\n return;\n}\n\nULONG G;\n\nULONG\nTest80(VOID)\n\n{\n\n G = 1;\n try {\n while (G) {\n try {\n if (G == 10) {\n return 1;\n }\n\n if (G == 1) {\n continue;\n }\n }\n finally { G = 0; }\n }\n }\n finally { G = 10; }\n\n return 0;\n}\n\nvoid Test81(int *pCounter) {\n volatile char *AvPtr = NULL;\n\n __try {\n __try { *AvPtr = '\\0'; }\n __except(EXCEPTION_EXECUTE_HANDLER) { __leave; }\n }\n __finally {\n printf(\"in finally \");\n *pCounter += 1;\n }\n return;\n}\n\nDECLSPEC_NOINLINE\nVOID Test82Foo(VOID)\n\n{\n *(volatile int *)0 = 0;\n}\n\nVOID Test82(__inout PLONG Counter)\n\n{\n\n int retval = 1;\n\n __try {\n __try { Test82Foo(); }\n __finally {\n switch (*Counter) {\n case 0:\n printf(\"something failed!\\n\");\n retval = 6;\n break;\n\n case 1:\n retval = 0;\n break;\n\n case 2:\n printf(\"how did you get here?\\n\");\n retval = 2;\n break;\n\n case 3:\n printf(\"what?!?\\n\");\n retval = 3;\n break;\n\n case 4:\n printf(\"not correct\\n\");\n retval = 4;\n break;\n\n case 5:\n printf(\"error!\\n\");\n retval = 5;\n break;\n }\n }\n }\n __except(1){}\n\n *Counter = retval;\n return;\n}\n\nLONG Test83(VOID)\n\n{\n\n G = 1;\n try {\n try {\n while (G) {\n try {\n if (G == 10) {\n return 1;\n }\n\n if (G == 1) {\n continue;\n }\n }\n finally { G = 0; }\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { leave; }\n }\n finally { G = 10; }\n\n return 0;\n}\n\nDECLSPEC_NOINLINE\nVOID Test84(_Inout_ PLONG Counter)\n\n{\n volatile int *Fault = 0;\n\n try {\n try {\n *Fault += 1;\n }\n except(EXCEPTION_EXECUTE_HANDLER) {\n try {\n return;\n }\n finally { *Counter += 1; }\n }\n }\n finally {\n\n if (AbnormalTermination()) {\n *Counter += 1;\n }\n }\n\n return;\n}\n\nDECLSPEC_NOINLINE\nLONG Test85(_Inout_ PLONG Counter)\n\n{\n volatile int *Fault = 0;\n\n G = 1;\n try {\n try {\n try {\n while (G) {\n try {\n try {\n if (G == 10) {\n return 1;\n }\n try {\n *Counter += 1;\n }\n except(EXCEPTION_EXECUTE_HANDLER) {}\n\n if (G == 1) {\n continue;\n }\n }\n finally {\n G = 0;\n *Counter += 1;\n *Fault += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) {\n *Counter += 1;\n leave;\n }\n }\n }\n finally {\n G = 10;\n *Counter += 1;\n *Fault += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { *Counter += 1; }\n *Counter += 1;\n }\n finally { *Counter += 1; }\n return 1;\n}\n\nDECLSPEC_NOINLINE\nVOID Test86(_Inout_ PLONG Counter)\n\n{\n volatile int *Fault = 0;\n\n try {\n try {\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n except(printf(\"Filter1 %d..\", *Counter),\n EXCEPTION_EXECUTE_HANDLER) {\n try {\n printf(\"Handler1 %d..\", *Counter);\n return;\n }\n finally {\n printf(\"Finally1 %d..\", *Counter);\n *Counter += 1;\n }\n }\n }\n finally {\n printf(\"Finally2 %d..\", *Counter);\n *Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { leave; }\n }\n finally { *Counter += 1; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { leave; }\n }\n finally { *Counter += 1; }\n\n return;\n}\n\nVOID Test87(_Inout_ PLONG Counter)\n\n/*++\n\nRoutine Description:\n\n This function verifies the behavior of nested exception dispatching.\n\nArguments:\n\n Counter - Supplies a pointer to the state counter.\n\nReturn Value:\n None.\n\n--*/\n\n{\n volatile int *Fault = 0;\n\n//\n// N.B. Disabled on x86 due to failing test case with handling of returns\n// in nested termination handlers on x86.\n//\n// Disabled on ARM due to failing test case with handling of abutting\n// termination handlers within an except handler.\n//\n// Disabled on AMD64 due to failing test case with handling of\n// abutting termination handlers within an except handler when a\n// non-local goto is involved.\n//\n\n#if !defined(_X86_)\n try {\n try {\n try {\n try {\n try {\n *Fault += 1;\n\n try {\n }\n finally {\n if (AbnormalTermination()) {\n *Fault += 1;\n }\n }\n }\n finally {\n\n if (AbnormalTermination()) {\n if ((*Counter += 13) == 26) {\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination()) {\n *Counter += 13;\n *Fault += 1;\n }\n }\n }\n except(((*Counter += 13) == 13) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n }\n except(((*Counter += 13) == 65) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n try {\n *Counter += 13;\n return;\n }\n finally {\n if (AbnormalTermination()) {\n *Counter += 13;\n goto Finish;\n }\n }\n }\n }\n finally {\n\n if (AbnormalTermination()) {\n if ((*Counter += 13) == 104) {\n goto Finish;\n }\n }\n }\n\nFinish:\n#else\n *Counter = 104;\n#endif\n\n return;\n}\n\nVOID Test88(_Inout_ PLONG Counter)\n\n{\n volatile int *Fault = 0;\n\n try {\n try {\n try {\n try {\n try {\n try {\n try {\n try {\n *Fault += 1;\n }\n except(((*Counter += 1) == 1) ? *Fault\n : EXCEPTION_CONTINUE_SEARCH) {}\n }\n except(*Counter += 1, EXCEPTION_EXECUTE_HANDLER) { *Fault += 2; }\n }\n except(*Counter += 1, EXCEPTION_CONTINUE_SEARCH) { leave; }\n }\n except(*Counter += 1, EXCEPTION_CONTINUE_SEARCH) { leave; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) {}\n }\n except(EXCEPTION_EXECUTE_HANDLER) {}\n }\n except(EXCEPTION_EXECUTE_HANDLER) { leave; }\n }\n finally { *Counter += 1; }\n}\n\nint main(int argc, char *argv[])\n\n{\n\n PLONG BadAddress;\n PCHAR BadByte;\n PLONG BlackHole;\n ULONG Index1;\n ULONG Index2 = RED;\n jmp_buf JumpBuffer;\n LONG Counter;\n EXCEPTION_RECORD ExceptionRecord;\n double doubleresult;\n\n //\n // Announce start of exception test.\n //\n\n printf(\"Start of exception test\\n\");\n\n //\n // Initialize exception record.\n //\n\n ExceptionRecord.ExceptionCode = STATUS_INTEGER_OVERFLOW;\n ExceptionRecord.ExceptionFlags = 0;\n ExceptionRecord.ExceptionRecord = NULL;\n ExceptionRecord.NumberParameters = 0;\n\n //\n // Initialize pointers.\n //\n\n BadAddress = (PLONG)NULL;\n BadByte = (PCHAR)NULL;\n BadByte += 1;\n BlackHole = &Counter;\n\n //\n // Simply try statement with a finally clause that is entered sequentially.\n //\n\n printf(\" test1...\");\n Counter = 0;\n try {\n Counter += 1;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 1;\n }\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try statement with an exception clause that is never executed\n // because there is no exception raised in the try clause.\n //\n\n printf(\" test2...\");\n Counter = 0;\n try {\n Counter += 1;\n }\n except(Counter) { Counter += 1; }\n\n if (Counter != 1) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try statement with an exception handler that is never executed\n // because the exception expression continues execution.\n //\n\n printf(\" test3...\");\n Counter = 0;\n try {\n Counter -= 1;\n RtlRaiseException(&ExceptionRecord);\n }\n except(Counter) { Counter -= 1; }\n\n if (Counter != -1) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try statement with an exception clause that is always executed.\n //\n\n printf(\" test4...\");\n Counter = 0;\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(Counter) { Counter += 1; }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try statement with an exception clause that is always executed.\n //\n\n printf(\" test5...\");\n Counter = 0;\n try {\n Counter += 1;\n *BlackHole += *BadAddress;\n }\n except(Counter) { Counter += 1; }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simply try statement with a finally clause that is entered as the\n // result of an exception.\n //\n\n printf(\" test6...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n RtlRaiseException(&ExceptionRecord);\n }\n finally {\n if (abnormal_termination() != FALSE) {\n Counter += 1;\n }\n }\n }\n except(Counter) {\n if (Counter == 2) {\n Counter += 1;\n }\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simply try statement with a finally clause that is entered as the\n // result of an exception.\n //\n\n printf(\" test7...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n *BlackHole += *BadAddress;\n }\n finally {\n if (abnormal_termination() != FALSE) {\n Counter += 1;\n }\n }\n }\n except(Counter) {\n if (Counter == 2) {\n Counter += 1;\n }\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try that calls a function which raises an exception.\n //\n\n printf(\" test8...\");\n Counter = 0;\n try {\n Counter += 1;\n foo1(STATUS_ACCESS_VIOLATION);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try that calls a function which raises an exception.\n //\n\n printf(\" test9...\");\n Counter = 0;\n try {\n Counter += 1;\n foo2(BlackHole, BadAddress);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try that calls a function which calls a function that\n // raises an exception. The first function has a finally clause\n // that must be executed for this test to work.\n //\n\n printf(\" test10...\");\n Counter = 0;\n try {\n bar1(STATUS_ACCESS_VIOLATION, &Counter);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter -= 1;\n }\n\n if (Counter != 98) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try that calls a function which calls a function that\n // raises an exception. The first function has a finally clause\n // that must be executed for this test to work.\n //\n\n printf(\" test11...\");\n Counter = 0;\n try {\n bar2(BlackHole, BadAddress, &Counter);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter -= 1;\n }\n\n if (Counter != 98) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try within an except\n //\n\n printf(\" test12...\");\n Counter = 0;\n try {\n foo1(STATUS_ACCESS_VIOLATION);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n try {\n foo1(STATUS_SUCCESS);\n }\n except((GetExceptionCode() == STATUS_SUCCESS) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n if (Counter != 1) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded...\");\n }\n\n Counter += 1;\n }\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try within an except\n //\n\n printf(\" test13...\");\n Counter = 0;\n try {\n foo2(BlackHole, BadAddress);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n try {\n foo1(STATUS_SUCCESS);\n }\n except((GetExceptionCode() == STATUS_SUCCESS) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n if (Counter != 1) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded...\");\n }\n\n Counter += 1;\n }\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from except/finally not allowed on WinCE\n //\n // A goto from an exception clause that needs to pass\n // through a finally\n //\n\n printf(\" test14...\");\n Counter = 0;\n try {\n try {\n foo1(STATUS_ACCESS_VIOLATION);\n }\n except((GetExceptionCode() == STATUS_ACCESS_VIOLATION)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n goto t9;\n }\n }\n finally { Counter += 1; }\n\nt9:\n ;\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A goto from an finally clause that needs to pass\n // through a finally\n //\n\n printf(\" test15...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n }\n finally {\n Counter += 1;\n goto t10;\n }\n }\n finally { Counter += 1; }\n\nt10:\n ;\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A goto from an exception clause that needs to pass\n // through a finally into the outer finally clause.\n //\n\n printf(\" test16...\");\n Counter = 0;\n try {\n try {\n try {\n Counter += 1;\n foo1(STATUS_INTEGER_OVERFLOW);\n }\n except(EXCEPTION_EXECUTE_HANDLER) {\n Counter += 1;\n goto t11;\n }\n }\n finally { Counter += 1; }\n t11:\n ;\n }\n finally { Counter += 1; }\n\n if (Counter != 4) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A goto from an finally clause that needs to pass\n // through a finally into the outer finally clause.\n //\n\n printf(\" test17...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n }\n finally {\n Counter += 1;\n goto t12;\n }\n t12:\n ;\n }\n finally { Counter += 1; }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A return from an except clause\n //\n\n printf(\" test18...\");\n Counter = 0;\n try {\n Counter += 1;\n eret(STATUS_ACCESS_VIOLATION, &Counter);\n }\n finally { Counter += 1; }\n\n if (Counter != 4) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A return from a finally clause\n //\n\n printf(\" test19...\");\n Counter = 0;\n try {\n Counter += 1;\n fret(&Counter);\n }\n finally { Counter += 1; }\n\n if (Counter != 5) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // A simple set jump followed by a long jump.\n //\n\n printf(\" test20...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump followed by a long jump out of a finally clause that is\n // sequentially executed.\n //\n\n printf(\" test21...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n try {\n Counter += 1;\n }\n finally {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump within a try clause followed by a long jump out of a\n // finally clause that is sequentially executed.\n //\n\n printf(\" test22...\");\n Counter = 0;\n try {\n if (setjmp(JumpBuffer) == 0) {\n Counter += 1;\n\n } else {\n Counter += 1;\n }\n }\n finally {\n Counter += 1;\n if (Counter == 2) {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n }\n\n if (Counter != 5) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump followed by a try/except, followed by a try/finally where\n // the try body of the try/finally raises an exception that is handled\n // by the try/excecpt which causes the try/finally to do a long jump out\n // of a finally clause. This will create a collided unwind.\n //\n\n printf(\" test23...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n try {\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump followed by a try/except, followed by a several nested\n // try/finally's where the inner try body of the try/finally raises an\n // exception that is handled by the try/except which causes the\n // try/finally to do a long jump out of a finally clause. This will\n // create a collided unwind.\n //\n\n printf(\" test24...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n try {\n try {\n try {\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally { Counter += 1; }\n }\n finally {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n }\n finally { Counter += 1; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 5) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump followed by a try/except, followed by a try/finally which\n // calls a subroutine which contains a try finally that raises an\n // exception that is handled to the try/except.\n //\n\n printf(\" test25...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n try {\n try {\n try {\n Counter += 1;\n dojump(JumpBuffer, &Counter);\n }\n finally { Counter += 1; }\n }\n finally { Counter += 1; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 7) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A set jump followed by a try/except, followed by a try/finally which\n // calls a subroutine which contains a try finally that raises an\n // exception that is handled to the try/except.\n //\n\n printf(\" test26...\");\n Counter = 0;\n if (setjmp(JumpBuffer) == 0) {\n try {\n try {\n try {\n try {\n Counter += 1;\n dojump(JumpBuffer, &Counter);\n }\n finally { Counter += 1; }\n }\n finally {\n Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n }\n finally { Counter += 1; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }\n\n } else {\n Counter += 1;\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Test nested exceptions.\n //\n\n printf(\" test27...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n except1(&Counter);\n }\n except(except2(GetExceptionInformation(), &Counter)) { Counter += 2; }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 3; }\n\n if (Counter != 55) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Simple try that causes an integer overflow exception.\n //\n\n printf(\" test28...\");\n Counter = 0;\n try {\n Counter += 1;\n addtwo(0x7fff0000, 0x10000, &Counter);\n }\n except((GetExceptionCode() == STATUS_INTEGER_OVERFLOW)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n//\n// Simple try that raises an misaligned data exception.\n//\n#if !defined(i386) && !defined(_M_IA64) && !defined(_M_AMD64) && \\\n !defined(_M_ARM) && !defined(_M_ARM64)\n printf(\" test29...\");\n Counter = 0;\n try {\n Counter += 1;\n foo2(BlackHole, (PLONG)BadByte);\n }\n except((GetExceptionCode() == STATUS_DATATYPE_MISALIGNMENT)\n ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n Counter += 1;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#endif\n //\n // Continue from a try body with an exception clause in a loop.\n //\n\n printf(\" test30...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 0) {\n continue;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; }\n\n Counter += 2;\n }\n\n if (Counter != 15) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Continue from a try body with an finally clause in a loop.\n //\n\n printf(\" test31...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 0) {\n continue;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n\n if (Counter != 40) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Continue from doubly nested try body with an exception clause in a\n // loop.\n //\n\n printf(\" test32...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 0) {\n continue;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; }\n\n Counter += 2;\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; }\n\n Counter += 3;\n }\n\n if (Counter != 30) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Continue from doubly nested try body with an finally clause in a loop.\n //\n\n printf(\" test33...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 0) {\n continue;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n finally { Counter += 4; }\n\n Counter += 5;\n }\n\n if (Counter != 105) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Continue from a finally clause in a loop.\n //\n\n printf(\" test34...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 0) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n continue;\n }\n\n Counter += 4;\n }\n\n if (Counter != 25) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Continue from a doubly nested finally clause in a loop.\n //\n\n printf(\" test35...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 0) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n continue;\n }\n\n Counter += 4;\n }\n finally { Counter += 5; }\n\n Counter += 6;\n }\n\n if (Counter != 75) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Continue from a doubly nested finally clause in a loop.\n //\n\n printf(\" test36...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 0) {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 4;\n }\n finally {\n Counter += 5;\n continue;\n }\n\n Counter += 6;\n }\n\n if (Counter != 115) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Break from a try body with an exception clause in a loop.\n //\n\n printf(\" test37...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; }\n\n Counter += 2;\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Break from a try body with an finally clause in a loop.\n //\n\n printf(\" test38...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Break from doubly nested try body with an exception clause in a\n // loop.\n //\n\n printf(\" test39...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; }\n\n Counter += 2;\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; }\n\n Counter += 3;\n }\n\n if (Counter != 6) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Break from doubly nested try body with an finally clause in a loop.\n //\n\n printf(\" test40...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n finally { Counter += 4; }\n\n Counter += 5;\n }\n\n if (Counter != 21) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a finally clause in a loop.\n //\n\n printf(\" test41...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n break;\n }\n\n Counter += 4;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a doubly nested finally clause in a loop.\n //\n\n printf(\" test42...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n break;\n }\n\n Counter += 4;\n }\n finally { Counter += 5; }\n\n Counter += 6;\n }\n\n if (Counter != 7) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a doubly nested finally clause in a loop.\n //\n\n printf(\" test43...\");\n Counter = 0;\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 4;\n }\n finally {\n Counter += 5;\n break;\n }\n\n Counter += 6;\n }\n\n if (Counter != 11) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Break from a try body with an exception clause in a switch.\n //\n\n printf(\" test44...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; }\n\n Counter += 2;\n break;\n }\n\n if (Counter != 0) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Break from a try body with an finally clause in a switch.\n //\n\n printf(\" test45...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Break from doubly nested try body with an exception clause in a\n // switch.\n //\n\n printf(\" test46...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; }\n\n Counter += 2;\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; }\n\n Counter += 3;\n }\n\n if (Counter != 0) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE\n //\n // Break from doubly nested try body with an finally clause in a switch.\n //\n\n printf(\" test47...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n break;\n\n } else {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 3;\n }\n finally { Counter += 4; }\n\n Counter += 5;\n }\n\n if (Counter != 6) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a finally clause in a switch.\n //\n\n printf(\" test48...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n break;\n }\n\n Counter += 4;\n }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a doubly nested finally clause in a switch.\n //\n\n printf(\" test49...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally {\n Counter += 2;\n break;\n }\n\n Counter += 4;\n }\n finally { Counter += 5; }\n\n Counter += 6;\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Break from a doubly nested finally clause in a switch.\n //\n\n printf(\" test50...\");\n Counter = 0;\n Index1 = 1;\n switch (Index2) {\n case BLUE:\n Counter += 100;\n break;\n\n case RED:\n try {\n try {\n if ((Index1 & 0x1) == 1) {\n Counter += 1;\n }\n }\n finally { Counter += 2; }\n\n Counter += 4;\n }\n finally {\n Counter += 5;\n break;\n }\n\n Counter += 6;\n }\n\n if (Counter != 12) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Leave from an if in a simple try/finally.\n //\n\n printf(\" test51...\");\n Counter = 0;\n try {\n if (Echo(Counter) == Counter) {\n Counter += 3;\n leave;\n\n } else {\n Counter += 100;\n }\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Leave from a loop in a simple try/finally.\n //\n\n printf(\" test52...\");\n Counter = 0;\n try {\n for (Index1 = 0; Index1 < 10; Index1 += 1) {\n if (Echo(Index1) == Index1) {\n Counter += 3;\n leave;\n }\n\n Counter += 100;\n }\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Leave from a switch in a simple try/finally.\n //\n\n printf(\" test53...\");\n Counter = 0;\n try {\n switch (Index2) {\n case BLUE:\n break;\n\n case RED:\n Counter += 3;\n leave;\n }\n\n Counter += 100;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Counter != 8) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Leave from an if in doubly nested try/finally followed by a leave\n // from an if in the outer try/finally.\n //\n\n printf(\" test54...\");\n Counter = 0;\n try {\n try {\n if (Echo(Counter) == Counter) {\n Counter += 3;\n leave;\n\n } else {\n Counter += 100;\n }\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Echo(Counter) == Counter) {\n Counter += 3;\n leave;\n\n } else {\n Counter += 100;\n }\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Counter != 16) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#if !defined(WIN_CE) // leave from finally not allowed on WinCE\n //\n // Leave from an if in doubly nested try/finally followed by a leave\n // from the finally of the outer try/finally.\n //\n\n printf(\" test55...\");\n Counter = 0;\n try {\n try {\n if (Echo(Counter) == Counter) {\n Counter += 3;\n leave;\n\n } else {\n Counter += 100;\n }\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n leave;\n }\n }\n\n Counter += 100;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n\n if (Counter != 13) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif\n\n //\n // Try/finally within the except clause of a try/except that is always\n // executed.\n //\n\n printf(\" test56...\");\n Counter = 0;\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(Counter) {\n try {\n Counter += 3;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n }\n\n if (Counter != 9) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Try/finally within the finally clause of a try/finally.\n //\n\n printf(\" test57...\");\n Counter = 0;\n try {\n Counter += 1;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n try {\n Counter += 3;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n }\n }\n\n if (Counter != 9) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Try/except within the finally clause of a try/finally.\n //\n\n printf(\" test58...\");\n#if !defined(NEST_IN_FINALLY)\n printf(\"skipped\\n\");\n#else\n Counter = 0;\n try {\n Counter -= 1;\n }\n finally {\n try {\n Counter += 2;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(Counter) {\n try {\n Counter += 3;\n }\n finally {\n if (abnormal_termination() == FALSE) {\n Counter += 5;\n }\n }\n }\n }\n\n if (Counter != 9) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif /* def(NEST_IN_FINALLY) */\n\n //\n // Try/except within the except clause of a try/except that is always\n // executed.\n //\n\n printf(\" test59...\");\n Counter = 0;\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(Counter) {\n try {\n Counter += 3;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(Counter - 3) { Counter += 5; }\n }\n\n if (Counter != 9) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Try with a Try which exits the scope with a goto\n //\n\n printf(\" test60...\");\n Counter = 0;\n try {\n try {\n goto outside;\n }\n except(1) { Counter += 1; }\n\n outside:\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(1) { Counter += 3; }\n\n if (Counter != 3) {\n printf(\"failed, count = %d\\n\", Counter);\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Try/except which gets an exception from a subfunction within\n // a try/finally which has a try/except in the finally clause\n //\n\n printf(\" test61...\");\n#if !defined(NEST_IN_FINALLY)\n printf(\"skipped\\n\");\n#else\n Counter = 0;\n try {\n Test61Part2(&Counter);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { Counter += 11; }\n\n if (Counter != 24) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n#endif /* def(NEST_IN_FINALLY) */\n\n //\n // Check for precision of exception on floating point\n //\n\n printf(\" test62...\");\n\n#if defined(i386) || defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_AMD64)\n\n/* enable floating point overflow */\n#if defined(i386)\n _control87(_control87(0, 0) & ~EM_OVERFLOW, _MCW_EM);\n#else\n //\n // use portable version of _control87\n //\n _controlfp(_controlfp(0, 0) & ~EM_OVERFLOW, _MCW_EM);\n#endif\n\n Counter = 0;\n try {\n doubleresult = SquareDouble(1.7e300);\n\n try {\n doubleresult = SquareDouble(1.0);\n }\n except(1) { Counter += 3; }\n }\n except(1) { Counter += 1; }\n\n if (Counter != 1) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n/* clear up pending unmasked exceptions and restore FP control registers */\n#if defined(i386)\n _clear87();\n _control87(_control87(0, 0) | EM_OVERFLOW, 0xfffff);\n#else\n _clearfp();\n _controlfp(_controlfp(0, 0) | EM_OVERFLOW, 0xfffff);\n#endif\n\n#else\n printf(\"skipped\\n\");\n#endif\n\n //\n // A try/finally inside a try/except where an exception is raised in the\n // try/finally.\n //\n\n printf(\" test63...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n }\n finally {\n Counter += 3;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n }\n except(1) { Counter += 6; }\n\n if (Counter != 10) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try/finally inside a try/except where an exception is raised in the\n // in the try/except and the try/finally.\n //\n\n printf(\" test64...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally {\n Counter += 3;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n }\n except(1) { Counter += 6; }\n\n if (Counter != 10) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try/finally inside a try/except where an exception is raised in the\n // try/finally.\n //\n\n printf(\" test65...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n }\n finally {\n Counter += 3;\n *BlackHole += *BadAddress;\n Counter += 13;\n }\n }\n except(1) { Counter += 6; }\n\n if (Counter != 10) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try/finally inside a try/except where an exception is raised in the\n // in the try/except and the try/finally.\n //\n\n printf(\" test66...\");\n Counter = 0;\n try {\n try {\n Counter += 1;\n *BlackHole += *BadAddress;\n Counter += 13;\n }\n finally {\n Counter += 3;\n *BlackHole += *BadAddress;\n Counter += 13;\n }\n }\n except(1) { Counter += 6; }\n\n if (Counter != 10) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try/finally inside a try/finally inside a try/except where an\n // exception is raised in the in the try/except and in try/finally.\n //\n\n printf(\" test67...\");\n try {\n try {\n *BlackHole += *BadAddress;\n }\n finally {\n try {\n Counter = 0;\n }\n finally {\n if (Counter != 0) {\n Counter += 1;\n }\n }\n\n Counter += 1;\n *BlackHole += *BadAddress;\n }\n }\n except(1) { Counter += 1; }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // A try/finally inside a try/finally inside a try/except where an\n // exception is raised in the in the try/except and in try/finally.\n //\n\n printf(\" test68...\");\n try {\n try {\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally {\n try {\n Counter = 0;\n }\n finally {\n if (Counter != 0) {\n Counter += 1;\n }\n }\n\n Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n }\n except(1) { Counter += 1; }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n//\n// Patch guard test 69.\n//\n\n#if defined(_AMD64_) || defined(_X86_)\n\n printf(\" test69...\");\n Counter = 0;\n try {\n PgTest69(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test70...\");\n Counter = 0;\n try {\n PgTest70(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 2) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test71...\");\n Counter = 0;\n try {\n PgTest71(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 9) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test72...\");\n Counter = 0;\n try {\n PgTest72(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 12) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test73...\");\n Counter = 0;\n try {\n PgTest73(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 15) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test74...\");\n Counter = 0;\n try {\n PgTest74(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 18) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test75...\");\n Counter = 0;\n try {\n PgTest75(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 35) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test76...\");\n Counter = 0;\n try {\n PgTest76(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 40) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test77...\");\n Counter = 0;\n try {\n PgTest77(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 45) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test78...\");\n Counter = 0;\n try {\n PgTest78(&Counter, BadAddress);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { printf(\"unexpected exception...\"); }\n\n if (Counter != 50) {\n printf(\"failed, count = %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n#else\n printf(\" test69...filter entered...succeeded\\n\");\n printf(\" test70...filter entered...succeeded\\n\");\n printf(\" test71...filter entered...succeeded\\n\");\n printf(\" test72...filter entered...succeeded\\n\");\n printf(\" test73...filter entered...succeeded\\n\");\n printf(\" test74...filter entered...succeeded\\n\");\n printf(\" test75...filter entered...succeeded\\n\");\n printf(\" test76...filter entered...succeeded\\n\");\n printf(\" test77...filter entered...succeeded\\n\");\n printf(\" test78...filter entered...succeeded\\n\");\n#endif\n\n if (LOBYTE(LOWORD(GetVersion())) < 6) {\n printf(\" test79...\");\n printf(\"filter 1...filter 2...finally 1...filter 1...filter 2...finally \"\n \"2...passed\\n\");\n } else {\n\n printf(\" test79...\");\n Counter = 0;\n try {\n Test79(&Counter, BadAddress);\n }\n except(printf(\"filter 2...\"), EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }\n\n if (Counter == 3) {\n printf(\"passed\\n\");\n\n } else {\n printf(\"failed %d \\n\", Counter);\n }\n }\n\n printf(\" test80...\");\n if (Test80() != 0) {\n printf(\"failed\\n\");\n\n } else {\n printf(\"passed\\n\");\n }\n\n printf(\" test81...\");\n Counter = 0;\n Test81(&Counter);\n if (Counter != 1) {\n printf(\"failed %d \\n\", Counter);\n\n } else {\n printf(\"passed\\n\");\n }\n\n printf(\" test82...\");\n Counter = 1;\n Test82(&Counter);\n if (Counter != 0) {\n printf(\"failed\\n\");\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test83...\");\n if (Test83() != 0) {\n printf(\"failed\\n\");\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test84...\");\n Counter = 0;\n Test84(&Counter);\n if (Counter != 2) {\n printf(\"failed\\n\");\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test85...\");\n Counter = 0;\n Test85(&Counter);\n if (Counter != 7) {\n printf(\"failed\\n\");\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test86...\");\n Counter = 0;\n Test86(&Counter);\n if (Counter != 4) {\n printf(\"failed %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test87...\");\n Counter = 0;\n Test87(&Counter);\n if (Counter != 104) {\n printf(\"failed %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n printf(\" test88...\");\n Counter = 0;\n Test88(&Counter);\n if (Counter != 6) {\n printf(\"failed %d\\n\", Counter);\n\n } else {\n printf(\"succeeded\\n\");\n }\n\n //\n // Announce end of exception test.\n //\n\n printf(\"End of exception test\\n\");\n return;\n}\n\n#pragma optimize(\"a\", off)\nVOID addtwo(long First, long Second, long *Place)\n\n{\n\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n *Place = First + Second;\n return;\n}\n#pragma optimize(\"\", on)\n\nVOID bar1(IN NTSTATUS Status, IN PLONG Counter) {\n\n try {\n foo1(Status);\n }\n finally {\n if (abnormal_termination() != FALSE) {\n *Counter = 99;\n\n } else {\n *Counter = 100;\n }\n }\n\n return;\n}\n\nVOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter) {\n\n try {\n foo2(BlackHole, BadAddress);\n }\n finally {\n if (abnormal_termination() != FALSE) {\n *Counter = 99;\n\n } else {\n *Counter = 100;\n }\n }\n\n return;\n}\n\nVOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter)\n\n{\n\n try {\n try {\n *Counter += 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally { *Counter += 1; }\n }\n finally {\n *Counter += 1;\n longjmp(JumpBuffer, 1);\n }\n}\n\n#if !defined(WIN_CE) // return through finally not allowed on WinCE\nVOID eret(IN NTSTATUS Status, IN PLONG Counter)\n\n{\n\n try {\n try {\n foo1(Status);\n }\n except((GetExceptionCode() == Status) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Counter += 1;\n return;\n }\n }\n finally { *Counter += 1; }\n\n return;\n}\n#endif\n\nVOID except1(IN PLONG Counter)\n\n{\n\n try {\n *Counter += 5;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(except3(GetExceptionInformation(), Counter)) { *Counter += 7; }\n\n *Counter += 9;\n return;\n}\n\nULONG\nexcept2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter)\n\n{\n\n PEXCEPTION_RECORD ExceptionRecord;\n\n ExceptionRecord = ExceptionPointers->ExceptionRecord;\n if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) &&\n ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) {\n *Counter += 11;\n return EXCEPTION_EXECUTE_HANDLER;\n\n } else {\n *Counter += 13;\n return EXCEPTION_CONTINUE_SEARCH;\n }\n}\n\nULONG\nexcept3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter)\n\n{\n\n PEXCEPTION_RECORD ExceptionRecord;\n\n ExceptionRecord = ExceptionPointers->ExceptionRecord;\n if ((ExceptionRecord->ExceptionCode == STATUS_INTEGER_OVERFLOW) &&\n ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) {\n *Counter += 17;\n RtlRaiseStatus(STATUS_UNSUCCESSFUL);\n\n } else if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) &&\n ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) != 0)) {\n *Counter += 19;\n return EXCEPTION_CONTINUE_SEARCH;\n }\n\n *Counter += 23;\n return EXCEPTION_EXECUTE_HANDLER;\n}\n\nVOID foo1(IN NTSTATUS Status)\n\n{\n\n //\n // Raise exception.\n //\n\n RtlRaiseStatus(Status);\n return;\n}\n\nVOID foo2(IN PLONG BlackHole, IN PLONG BadAddress)\n\n{\n\n //\n // Raise exception.\n //\n\n *BlackHole += *BadAddress;\n return;\n}\n\n#if !defined(WIN_CE) // return from finally not allowed on WinCE\nVOID fret(IN PLONG Counter)\n\n{\n\n try {\n try {\n *Counter += 1;\n }\n finally {\n *Counter += 1;\n return;\n }\n }\n finally { *Counter += 1; }\n\n return;\n}\n#endif\n\nLONG Echo(IN LONG Value)\n\n{\n return Value;\n}\n\n#if defined(NEST_IN_FINALLY)\nVOID Test61Part2(IN OUT PULONG Counter) {\n try {\n *Counter -= 1;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n finally {\n try {\n *Counter += 2;\n RtlRaiseStatus(STATUS_INTEGER_OVERFLOW);\n }\n except(EXCEPTION_EXECUTE_HANDLER) { *Counter += 5; }\n *Counter += 7;\n }\n}\n#endif /* def(NEST_IN_FINALLY) */\n\ndouble SquareDouble(IN double op) {\n return exp(2.0 * log(op));\n}\n" + }, + { + "name": "sample.cameligo.txt", + "content": "type storage = int\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\ntype return = operation list * storage\n// Two entrypoints\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n" + }, + { + "name": "sample.clojure.txt", + "content": "(ns game-of-life\n \"Conway's Game of Life, based on the work of\n Christophe Grand (http://clj-me.cgrand.net/2011/08/19/conways-game-of-life)\n and Laurent Petit (https://gist.github.com/1200343).\")\n\n;;; Core game of life's algorithm functions\n\n(defn neighbors\n \"Given a cell's coordinates `[x y]`, returns the coordinates of its\n neighbors.\"\n [[x y]]\n (for [dx [-1 0 1]\n dy (if (zero? dx)\n [-1 1]\n [-1 0 1])]\n [(+ dx x) (+ dy y)]))\n\n(defn step\n \"Given a set of living `cells`, computes the new set of living cells.\"\n [cells]\n (set (for [[cell n] (frequencies (mapcat neighbors cells))\n :when (or (= n 3)\n (and (= n 2)\n (cells cell)))]\n cell)))\n\n;;; Utility methods for displaying game on a text terminal\n\n(defn print-grid\n \"Prints a `grid` of `w` columns and `h` rows, on *out*, representing a\n step in the game.\"\n [grid w h]\n (doseq [x (range (inc w))\n y (range (inc h))]\n (when (= y 0) (println))\n (print (if (grid [x y])\n \"[X]\"\n \" . \"))))\n\n(defn print-grids\n \"Prints a sequence of `grids` of `w` columns and `h` rows on *out*,\n representing several steps.\"\n [grids w h]\n (doseq [grid grids]\n (print-grid grid w h)\n (println)))\n\n;;; Launches an example grid\n\n(def grid\n \"`grid` represents the initial set of living cells\"\n #{[2 1] [2 2] [2 3]})\n\n(print-grids (take 3 (iterate step grid)) 5 5)" }, { "name": "sample.coffeescript.txt", @@ -76,10 +96,18 @@ define([], function() { return[ "name": "sample.csharp.txt", "content": "/*\r\n* C# Program to Display All the Prime Numbers Between 1 to 100\r\n*/\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace VS\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tstatic void Main(string[] args)\r\n \t\t{\r\n\t\t\tbool isPrime = true;\r\n\t\t\tConsole.WriteLine(\"Prime Numbers : \");\r\n\t\t\tfor (int i = 2; i <= 100; i++)\r\n\t\t\t{\r\n\t\t\t\tfor (int j = 2; j <= 100; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j && i % j == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tisPrime = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (isPrime)\r\n\t\t\t\t{\r\n\t\t\t\t\tConsole.Write(\"\\t\" +i);\r\n\t\t\t\t}\r\n\t\t\t\tisPrime = true;\r\n\t\t\t}\r\n\t\t\tConsole.ReadKey();\r\n\t\t}\r\n\t}\r\n}\r\n" }, + { + "name": "sample.csp.txt", + "content": "Content-Security-Policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com" + }, { "name": "sample.css.txt", "content": "html {\r\n background-color: #e2e2e2;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\nbody {\r\n background-color: #fff;\r\n border-top: solid 10px #000;\r\n color: #333;\r\n font-size: .85em;\r\n font-family: \"Segoe UI\",\"HelveticaNeue-Light\", sans-serif;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\na:link, a:visited, \r\na:active, a:hover {\r\n color: #333;\r\n outline: none;\r\n padding-left: 0;\r\n padding-right: 3px;\r\n text-decoration: none;\r\n \r\n}\r\n\r\n\r\na:hover {\r\n background-color: #c7d1d6;\r\n}\r\n\r\n\r\nheader, footer, hgroup\r\nnav, section {\r\n display: block;\r\n}\r\n\r\n.float-left {\r\n float: left;\r\n}\r\n\r\n.float-right {\r\n float: right;\r\n}\r\n\r\n.highlight {\r\n/* background-color: #a6dbed;\r\n padding-left: 5px;\r\n padding-right: 5px;*/\r\n}\r\n\r\n.clear-fix:after {\r\n content: \".\";\r\n clear: both;\r\n display: block;\r\n height: 0;\r\n visibility: hidden;\r\n}\r\n\r\nh1, h2, h3, \r\nh4, h5, h6 {\r\n color: #000;\r\n margin-bottom: 0;\r\n padding-bottom: 0;\r\n \r\n}\r\n\r\nh1 {\r\n font-size: 2em; \r\n}\r\n\r\nh2 {\r\n font-size: 1.75em;\r\n}\r\n\r\nh3 {\r\n font-size: 1.2em;\r\n}\r\n\r\nh4 {\r\n font-size: 1.1em;\r\n}\r\n\r\nh5, h6 {\r\n font-size: 1em;\r\n}\r\n\r\n\r\n.tile {\r\n /* 2px solid #7ac0da; */\r\n border: 0;\r\n \r\n float: left;\r\n width: 200px;\r\n height: 325px;\r\n \r\n padding: 5px;\r\n margin-right: 5px;\r\n margin-bottom: 20px;\r\n margin-top: 20px;\r\n -webkit-perspective: 0;\r\n -webkit-transform-style: preserve-3d;\r\n -webkit-transition: -webkit-transform 0.2s;\r\n -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);\r\n background-position: center center;\r\n background-repeat: no-repeat;\r\n \r\n background-color: #fff;\r\n}\r\n\r\n.tile-item {\r\n /* 2px solid #7ac0da; */\r\n border-color: inherit;\r\n float: left;\r\n width: 50px;\r\n height: 70px;\r\n margin-right: 20px;\r\n margin-bottom: 20px;\r\n margin-top: 20px;\r\n background-image: url('../Images/documents.png');\r\n background-repeat: no-repeat;\r\n \r\n}\r\n\r\n.tile-wrapper {\r\n width: 100%;\r\n font-family: \"Segoe UI\" , Tahoma, Geneva, Verdana, sans-serif;\r\n line-height: 21px;\r\n font-size: 14px;\r\n}\r\n\r\na.blue-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.blue-box:hover {\r\n border: 4px solid #8ABAE4; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n \r\na.green-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.green-box:hover {\r\n border: 4px solid #9CCF42; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n\r\n\r\na.green-box2 {\r\n font-size: 14px;\r\n height: 48px;\r\n width: 48px;\r\n display: block; /* border-color: #C0C0C0; */\r\n padding-top: 6px;\r\n font-weight: bold;\r\n \r\n}\r\n\r\n a.green-box2:hover {\r\n border: solid #8ABAE4;\r\n padding-top: 0px;\r\n padding-left: 0px;\r\n background-image: url('../Images/documents.png');\r\n background-color: #EFEFEF;\r\n}\r\n\r\na.yellow-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.yellow-box:hover {\r\n border: 4px solid #DECF6B; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n \r\n \r\na.red-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.red-box:hover {\r\n border: 4px solid #F79E84; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n \r\n/* main layout \r\n----------------------------------------------------------*/\r\n.content-wrapper {\r\n margin: 0 auto;\r\n max-width: 960px;\r\n}\r\n\r\n#body {\r\n background-color: #efeeef;\r\n clear: both;\r\n padding-bottom: 35px;\r\n}\r\n\r\n .main-content {\r\n background: url(\"../images/accent.png\") no-repeat;\r\n padding-left: 10px;\r\n padding-top: 30px;\r\n }\r\n\r\n .featured + .main-content {\r\n background: url(\"../images/heroaccent.png\") no-repeat;\r\n }\r\n\r\nfooter {\r\n clear: both;\r\n background-color: #e2e2e2;\r\n font-size: .8em;\r\n height: 100px;\r\n}\r\n\r\n\r\n/* site title\r\n----------------------------------------------------------*/\r\n.site-title {\r\n color: #0066CC; /* font-family: Rockwell, Consolas, \"Courier New\", Courier, monospace; */\r\n font-size: 3.3em;\r\n margin-top: 40px;\r\n margin-bottom: 0;\r\n}\r\n\r\n.site-title a, .site-title a:hover, .site-title a:active {\r\n background: none;\r\n color: #0066CC;\r\n outline: none;\r\n text-decoration: none;\r\n}\r\n\r\n\r\n/* login \r\n----------------------------------------------------------*/\r\n#login {\r\n display: block;\r\n font-size: .85em;\r\n margin-top: 20px;\r\n text-align: right;\r\n}\r\n\r\n #login a {\r\n background-color: #d3dce0;\r\n margin-left: 10px;\r\n margin-right: 3px;\r\n padding: 2px 3px;\r\n text-decoration: none;\r\n }\r\n \r\n #login a.username {\r\n background: none;\r\n margin-left: 0px;\r\n text-decoration: underline;\r\n }\r\n\r\n #login li {\r\n display: inline;\r\n list-style: none;\r\n }\r\n \r\n \r\n/* menu \r\n----------------------------------------------------------*/\r\nul#menu {\r\n font-size: 1.3em;\r\n font-weight: 600;\r\n margin: 0;\r\n text-align: right;\r\n text-decoration: none;\r\n\r\n}\r\n\r\n ul#menu li {\r\n display: inline;\r\n list-style: none;\r\n padding-left: 15px;\r\n }\r\n\r\n ul#menu li a {\r\n background: none;\r\n color: #999;\r\n text-decoration: none;\r\n }\r\n\r\n ul#menu li a:hover {\r\n color: #333;\r\n text-decoration: none;\r\n }\r\n\r\n\r\n\r\n/* page elements \r\n----------------------------------------------------------*/\r\n/* featured */\r\n.featured {\r\n background-color: #fff;\r\n}\r\n\r\n .featured .content-wrapper {\r\n /*background-color: #7ac0da;\r\n background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);\r\n background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);\r\n background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6));\r\n background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);\r\n background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);\r\n color: #3e5667;\r\n */\r\n padding: 0px 40px 30px 40px;\r\n }\r\n\r\n .featured hgroup.title h1, .featured hgroup.title h2 {\r\n /* color: #fff;\r\n */\r\n }\r\n\r\n .featured p {\r\n font-size: 1.1em;\r\n }\r\n\r\n/* page titles */ \r\nhgroup.title {\r\n margin-bottom: 10px;\r\n}\r\n\r\nhgroup.title h1, hgroup.title h2 {\r\ndisplay: inline;\r\n}\r\n\r\nhgroup.title h2 {\r\n font-weight: normal;\r\n}\r\n\r\n/* releases */\r\n.milestone {\r\n color: #fff;\r\n background-color: #8ABAE4;\r\n font-weight: normal;\r\n padding: 10px 10px 10px 10px;\r\n margin: 0 0 0 0;\r\n}\r\n .milestone .primary {\r\n font-size: 1.75em;\r\n }\r\n\r\n .milestone .secondary {\r\n font-size: 1.2em;\r\n font-weight: normal;\r\n /* padding: 5px 5px 5px 10px;*/\r\n }\r\n \r\n/* features */\r\nsection.feature {\r\n width: 200px;\r\n float: left;\r\n padding: 10px;\r\n}\r\n\r\n/* ordered list */\r\nol.round {\r\n list-style-type: none;\r\n padding-left: 0;\r\n}\r\n\r\n ol.round li {\r\n margin: 25px 0;\r\n padding-left: 45px;\r\n }\r\n \r\n ol.round li.one {\r\n background: url(\"../images/orderedlistOne.png\") no-repeat; \r\n }\r\n \r\n ol.round li.two {\r\n background: url(\"../images/orderedlistTwo.png\") no-repeat; \r\n }\r\n \r\n ol.round li.three {\r\n background: url(\"../images/orderedlistThree.png\") no-repeat; \r\n }\r\n \r\n/* content */ \r\narticle {\r\n float: left;\r\n width: 70%;\r\n}\r\n\r\naside {\r\n float: right;\r\n width: 25%;\r\n}\r\n\r\n aside ul {\r\n list-style: none;\r\n padding: 0;\r\n }\r\n \r\n aside ul li {\r\n background: url(\"../images/bullet.png\") no-repeat 0 50%;\r\n padding: 2px 0 2px 20px;\r\n }\r\n \r\n.label {\r\n font-weight: 700;\r\n}\r\n\r\n/* login page */ \r\n#loginForm {\r\n border-right: solid 2px #c8c8c8;\r\n float: left;\r\n width: 45%;\r\n}\r\n\r\n #loginForm .validation-error {\r\n display: block;\r\n margin-left: 15px;\r\n }\r\n\r\n#socialLoginForm {\r\n margin-left: 40px;\r\n float: left;\r\n width: 50%;\r\n}\r\n\r\n/* contact */\r\n.contact h3 {\r\n font-size: 1.2em;\r\n}\r\n\r\n.contact p {\r\n margin: 5px 0 0 10px;\r\n}\r\n\r\n.contact iframe {\r\n border: solid 1px #333;\r\n margin: 5px 0 0 10px;\r\n}\r\n\r\n/* forms */\r\nfieldset {\r\n border: none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\n fieldset legend {\r\n display: none;\r\n }\r\n \r\n fieldset ol {\r\n padding: 0;\r\n list-style: none;\r\n }\r\n \r\n fieldset ol li {\r\n padding-bottom: 5px;\r\n }\r\n \r\n fieldset label {\r\n display: block;\r\n font-size: 1.2em;\r\n font-weight: 600;\r\n }\r\n \r\n fieldset label.checkbox {\r\n display: inline;\r\n }\r\n \r\n fieldset input[type=\"text\"], \r\n fieldset input[type=\"password\"] {\r\n border: 1px solid #e2e2e2;\r\n color: #333;\r\n font-size: 1.2em;\r\n margin: 5px 0 6px 0;\r\n padding: 5px;\r\n width: 300px;\r\n }\r\n \r\n fieldset input[type=\"text\"]:focus, \r\n fieldset input[type=\"password\"]:focus {\r\n border: 1px solid #7ac0da;\r\n }\r\n \r\n fieldset input[type=\"submit\"] {\r\n background-color: #d3dce0;\r\n border: solid 1px #787878;\r\n cursor: pointer;\r\n font-size: 1.2em;\r\n font-weight: 600;\r\n padding: 7px;\r\n }\r\n\r\n/* ajax login/registration dialog */\r\n.modal-popup {\r\n font-size: 0.7em;\r\n}\r\n\r\n/* info and errors */ \r\n.message-info {\r\n border: solid 1px;\r\n clear: both;\r\n padding: 10px 20px;\r\n}\r\n\r\n.message-error {\r\n clear: both;\r\n color: #e80c4d;\r\n font-size: 1.1em;\r\n font-weight: bold;\r\n margin: 20px 0 10px 0;\r\n}\r\n\r\n.message-success {\r\n color: #7ac0da;\r\n font-size: 1.3em;\r\n font-weight: bold;\r\n margin: 20px 0 10px 0;\r\n}\r\n\r\n.success {\r\n color: #7ac0da;\r\n}\r\n\r\n.error {\r\n color: #e80c4d;\r\n}\r\n\r\n/* styles for validation helpers */\r\n.field-validation-error {\r\n color: #e80c4d;\r\n font-weight: bold;\r\n}\r\n\r\n.field-validation-valid {\r\n display: none;\r\n}\r\n\r\ninput[type=\"text\"].input-validation-error,\r\ninput[type=\"password\"].input-validation-error {\r\n border: solid 1px #e80c4d;\r\n}\r\n\r\n.validation-summary-errors {\r\n color: #e80c4d;\r\n font-weight: bold;\r\n font-size: 1.1em;\r\n}\r\n\r\n.validation-summary-valid {\r\n display: none;\r\n}\r\n\r\n\r\n/* social */\r\nul#social li {\r\n display: inline;\r\n list-style: none;\r\n}\r\n\r\n ul#social li a {\r\n color: #999;\r\n text-decoration: none;\r\n }\r\n \r\n a.facebook, a.twitter {\r\n display: block;\r\n float: left;\r\n height: 24px;\r\n padding-left: 17px;\r\n text-indent: -9999px;\r\n width: 16px;\r\n }\r\n \r\n a.facebook {\r\n background: url(\"../images/facebook.png\") no-repeat;\r\n }\r\n \r\n a.twitter {\r\n background: url(\"../images/twitter.png\") no-repeat;\r\n }\r\n \r\n \r\n \r\n/********************\r\n* Mobile Styles *\r\n********************/\r\n@media only screen and (max-width: 850px) {\r\n \r\n /* header \r\n ----------------------------------------------------------*/\r\n header .float-left, \r\n header .float-right {\r\n float: none;\r\n }\r\n \r\n /* logo */\r\n header .site-title {\r\n /*margin: 0; */\r\n /*margin: 10px;*/\r\n text-align: left;\r\n padding-left: 0;\r\n }\r\n\r\n /* login */\r\n #login {\r\n font-size: .85em;\r\n margin-top: 0;\r\n text-align: center;\r\n }\r\n \r\n #login ul {\r\n margin: 5px 0;\r\n padding: 0;\r\n }\r\n \r\n #login li {\r\n display: inline;\r\n list-style: none;\r\n margin: 0;\r\n padding:0;\r\n }\r\n\r\n #login a {\r\n background: none;\r\n color: #999;\r\n font-weight: 600;\r\n margin: 2px;\r\n padding: 0;\r\n }\r\n \r\n #login a:hover {\r\n color: #333;\r\n }\r\n\r\n /* menu */\r\n nav {\r\n margin-bottom: 5px;\r\n }\r\n \r\n ul#menu {\r\n margin: 0;\r\n padding:0;\r\n text-align: center;\r\n }\r\n\r\n ul#menu li {\r\n margin: 0;\r\n padding: 0;\r\n }\r\n\r\n \r\n /* main layout \r\n ----------------------------------------------------------*/\r\n .main-content,\r\n .featured + .main-content {\r\n background-position: 10px 0;\r\n }\r\n \r\n .content-wrapper {\r\n padding-right: 10px;\r\n padding-left: 10px;\r\n }\r\n\r\n .featured .content-wrapper {\r\n padding: 10px;\r\n }\r\n \r\n /* page content */ \r\n article, aside {\r\n float: none;\r\n width: 100%;\r\n }\r\n \r\n /* ordered list */\r\n ol.round {\r\n list-style-type: none;\r\n padding-left: 0;\r\n }\r\n\r\n ol.round li {\r\n padding-left: 10px;\r\n margin: 25px 0;\r\n }\r\n \r\n ol.round li.one,\r\n ol.round li.two,\r\n ol.round li.three {\r\n background: none; \r\n }\r\n \r\n /* features */\r\n section.feature {\r\n float: none;\r\n padding: 10px;\r\n width: auto;\r\n }\r\n \r\n section.feature img {\r\n color: #999;\r\n content: attr(alt);\r\n font-size: 1.5em;\r\n font-weight: 600;\r\n }\r\n \r\n /* forms */ \r\n fieldset input[type=\"text\"], \r\n fieldset input[type=\"password\"] {\r\n width: 90%;\r\n }\r\n \r\n /* login page */ \r\n #loginForm {\r\n border-right: none;\r\n float: none;\r\n width: auto;\r\n }\r\n\r\n #loginForm .validation-error {\r\n display: block;\r\n margin-left: 15px;\r\n }\r\n\r\n #socialLoginForm {\r\n margin-left: 0;\r\n float: none;\r\n width: auto;\r\n }\r\n\r\n /* footer \r\n ----------------------------------------------------------*/ \r\n footer .float-left,\r\n footer .float-right {\r\n float: none;\r\n }\r\n \r\n footer {\r\n text-align: center;\r\n height: auto;\r\n padding: 10px 0;\r\n }\r\n \r\n footer p {\r\n margin: 0;\r\n }\r\n \r\n ul#social {\r\n padding:0;\r\n margin: 0;\r\n }\r\n \r\n a.facebook, a.twitter {\r\n background: none;\r\n display: inline;\r\n float: none;\r\n height: auto;\r\n padding-left: 0;\r\n text-indent: 0;\r\n width: auto;\r\n } \r\n}\r\n\r\n.subsite {\r\n\tcolor: #444;\r\n}\r\n\r\nh3 {\r\n\tfont-weight: normal;\r\n\tfont-size: 24px;\r\n\tcolor: #444;\r\n\tmargin-bottom: 20px;\r\n}\r\n\r\n.tiles {\r\n\tpadding-bottom: 20px;\r\n\tbackground-color: #e3e3e3;\r\n}\r\n\r\n#editor {\r\n\tmargin: 0 auto;\r\n\theight: 500px;\r\n\tborder: 1px solid #ccc;\r\n}\r\n\r\n.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse {\r\n\tbackground: #F9F9F9;\r\n}\r\n\r\n.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background {\r\n\tbackground: #F9F9F9;\r\n}" }, + { + "name": "sample.dart.txt", + "content": "import 'dart:async';\nimport 'dart:math' show Random;\nmain() async {\n print('Compute π using the Monte Carlo method.');\n await for (var estimate in computePi().take(100)) {\n print('π ≅ $estimate');\n }\n}\n/// Generates a stream of increasingly accurate estimates of π.\nStream computePi({int batch: 100000}) async* {\n var total = 0;\n var count = 0;\n while (true) {\n var points = generateRandom().take(batch);\n var inside = points.where((p) => p.isInsideUnitCircle);\n total += batch;\n count += inside.length;\n var ratio = count / total;\n // Area of a circle is A = π⋅r², therefore π = A/r².\n // So, when given random points with x ∈ <0,1>,\n // y ∈ <0,1>, the ratio of those inside a unit circle\n // should approach π / 4. Therefore, the value of π\n // should be:\n yield ratio * 4;\n }\n}\nIterable generateRandom([int seed]) sync* {\n final random = Random(seed);\n while (true) {\n yield Point(random.nextDouble(), random.nextDouble());\n }\n}\nclass Point {\n final double x, y;\n const Point(this.x, this.y);\n bool get isInsideUnitCircle => x * x + y * y <= 1;\n}\n" + }, { "name": "sample.dockerfile.txt", "content": "FROM mono:3.12\r\n\r\nENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2\r\nENV KRE_USER_HOME /opt/kre\r\n\r\nRUN apt-get -qq update && apt-get -qqy install unzip \r\n\r\nONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh\r\nONBUILD RUN bash -c \"source $KRE_USER_HOME/kvm/kvm.sh \\\r\n && kvm install latest -a default \\\r\n && kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default\"\r\n\r\n# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)\r\nRUN apt-get -qqy install \\\r\n autoconf \\\r\n automake \\\r\n build-essential \\\r\n libtool \r\nRUN LIBUV_VERSION=1.0.0-rc2 \\\r\n && curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \\\r\n && cd /usr/local/src/libuv-$LIBUV_VERSION \\\r\n && sh autogen.sh && ./configure && make && make install \\\r\n && rm -rf /usr/local/src/libuv-$LIBUV_VERSION \\\r\n && ldconfig\r\n\r\nENV PATH $PATH:$KRE_USER_HOME/packages/default/bin\r\n\r\n# Extra things to test\r\nRUN echo \"string at end\"\r\nRUN echo must work 'some str' and some more\r\nRUN echo hi this is # not a comment\r\nRUN echo 'String with ${VAR} and another $one here'" @@ -124,10 +152,22 @@ define([], function() { return[ "name": "sample.json.txt", "content": "{\r\n\t\"type\": \"team\",\r\n\t\"test\": {\r\n\t\t\"testPage\": \"tools/testing/run-tests.htm\",\r\n\t\t\"enabled\": true\r\n\t},\r\n \"search\": {\r\n \"excludeFolders\": [\r\n\t\t\t\".git\",\r\n\t\t\t\"node_modules\",\r\n\t\t\t\"tools/bin\",\r\n\t\t\t\"tools/counts\",\r\n\t\t\t\"tools/policheck\",\r\n\t\t\t\"tools/tfs_build_extensions\",\r\n\t\t\t\"tools/testing/jscoverage\",\r\n\t\t\t\"tools/testing/qunit\",\r\n\t\t\t\"tools/testing/chutzpah\",\r\n\t\t\t\"server.net\"\r\n ]\r\n },\r\n\t\"languages\": {\r\n\t\t\"vs.languages.typescript\": {\r\n\t\t\t\"validationSettings\": [{\r\n\t\t\t\t\"scope\":\"/\",\r\n\t\t\t\t\"noImplicitAny\":true,\r\n\t\t\t\t\"noLib\":false,\r\n\t\t\t\t\"extraLibs\":[],\r\n\t\t\t\t\"semanticValidation\":true,\r\n\t\t\t\t\"syntaxValidation\":true,\r\n\t\t\t\t\"codeGenTarget\":\"ES5\",\r\n\t\t\t\t\"moduleGenTarget\":\"\",\r\n\t\t\t\t\"lint\": {\r\n \"emptyBlocksWithoutComment\": \"warning\",\r\n \"curlyBracketsMustNotBeOmitted\": \"warning\",\r\n \"comparisonOperatorsNotStrict\": \"warning\",\r\n \"missingSemicolon\": \"warning\",\r\n \"unknownTypeOfResults\": \"warning\",\r\n \"semicolonsInsteadOfBlocks\": \"warning\",\r\n \"functionsInsideLoops\": \"warning\",\r\n \"functionsWithoutReturnType\": \"warning\",\r\n \"tripleSlashReferenceAlike\": \"warning\",\r\n \"unusedImports\": \"warning\",\r\n \"unusedVariables\": \"warning\",\r\n \"unusedFunctions\": \"warning\",\r\n \"unusedMembers\": \"warning\"\r\n }\r\n\t\t\t}, \r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/client\",\r\n\t\t\t\t\"baseUrl\":\"/client\",\r\n\t\t\t\t\"moduleGenTarget\":\"amd\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/server\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/build\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/node_modules/nake\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t}],\r\n\t\t\t\"allowMultipleWorkers\": true\r\n\t\t}\r\n\t}\r\n}" }, + { + "name": "sample.julia.txt", + "content": "# good style\nfunction fixedpointmap(f; iv, tolerance=1E-7, maxiter=1000)\n # setup the algorithm\n x_old = iv\n normdiff = Inf\n iter = 1\n while normdiff > tolerance && iter <= maxiter\n x_new = f(x_old) # use the passed in map\n normdiff = norm(x_new - x_old)\n x_old = x_new\n iter = iter + 1\n end\n return (value = x_old, normdiff=normdiff, iter=iter) # A named tuple\nend\n\n# define a map and parameters\np = 1.0\nβ = 0.9\nf(v) = p + β * v # note that p and β are used in the function!\n\nsol = fixedpointmap(f, iv=0.8, tolerance=1.0E-8) # don't need to pass\nprintln(\"Fixed point = $(sol.value), and |f(x) - x| = $(sol.normdiff) in $(sol.iter)\"*\n \" iterations\")\n" + }, + { + "name": "sample.kotlin.txt", + "content": "const val POINTS_X_PASS: Int = 15\r\nval EZPassAccounts: MutableMap = mutableMapOf(1 to 100, 2 to 100, 3 to 100)\r\nval EZPassReport: Map = EZPassAccounts\r\n\r\n// update points credit\r\nfun updatePointsCredit(accountId: Int) {\r\n if (EZPassAccounts.containsKey(accountId)) {\r\n println(\"Updating $accountId...\")\r\n EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS\r\n } else {\r\n println(\"Error: Trying to update a non-existing account (id: $accountId)\")\r\n }\r\n}\r\n\r\nfun accountsReport() {\r\n println(\"EZ-Pass report:\")\r\n EZPassReport.forEach{\r\n k, v -> println(\"ID $k: credit $v\")\r\n }\r\n}\r\n\r\nfun main() {\r\n accountsReport()\r\n updatePointsCredit(1)\r\n updatePointsCredit(1)\r\n updatePointsCredit(5)\r\n accountsReport()\r\n}" + }, { "name": "sample.less.txt", "content": "@base: #f938ab;\r\n\r\n.box-shadow(@style, @c) when (iscolor(@c)) {\r\n\tborder-radius: @style @c;\r\n}\r\n\r\n.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {\r\n\t.box-shadow(@style, rgba(0, 0, 0, @alpha));\r\n}\r\n\r\n.box { \r\n\tcolor: saturate(@base, 5%);\r\n\tborder-color: lighten(@base, 30%);\r\n\t\r\n\tdiv {\r\n\t\t.box-shadow((0 0 5px), 30%);\r\n\t}\r\n}\r\n\r\n#header {\r\n\th1 {\r\n\t\tfont-size: 26px;\r\n\t\tfont-weight: bold;\r\n\t}\r\n\t\r\n\tp { font-size: 12px;\r\n\t\ta { text-decoration: none;\r\n\t\t\t&:hover { border-width: 1px }\r\n\t\t}\r\n\t}\r\n}\r\n\r\n@the-border: 1px;\r\n@base-color: #111;\r\n@red: #842210;\r\n\r\n#header {\r\n\tcolor: (@base-color * 3);\r\n\tborder-left: @the-border;\r\n\tborder-right: (@the-border * 2);\r\n}\r\n\r\n#footer {\r\n\tcolor: (@base-color + #003300);\r\n\tborder-color: desaturate(@red, 10%);\r\n}\r\n" }, + { + "name": "sample.lex.txt", + "content": "LEX Paid Escrow.\nLEXON: 0.2.20\nCOMMENT: 3.f - an escrow that is controlled by a third party for a fee.\n\n“Payer” is a person.\n“Payee” is a person.\n“Arbiter” is a person.\n“Fee” is an amount.\n\nThe Payer pays an Amount into escrow,\nappoints the Payee,\nappoints the Arbiter,\nand also fixes the Fee.\n\nCLAUSE: Pay Out.\nThe Arbiter may pay from escrow the Fee to themselves,\nand afterwards pay the remainder of the escrow to the Payee.\n\nCLAUSE: Pay Back.\nThe Arbiter may pay from escrow the Fee to themselves,\nand afterwards return the remainder of the escrow to the Payer.\n" + }, { "name": "sample.lua.txt", "content": " -- defines a factorial function\n function fact (n)\n if n == 0 then\n return 1\n else\n return n * fact(n-1)\n end\n end\n \n print(\"enter a number:\")\n a = io.read(\"*number\") -- read a number\n print(fact(a))" @@ -136,17 +176,37 @@ define([], function() { return[ "name": "sample.markdown.txt", "content": "# Header 1 #\r\n## Header 2 ##\r\n### Header 3 ### (Hashes on right are optional)\r\n## Markdown plus h2 with a custom ID ## {#id-goes-here}\r\n[Link back to H2](#id-goes-here)\r\n\r\n```js\r\nvar x = \"string\";\r\nfunction f() {\r\n return x;\r\n}\r\n```\r\n\r\n\r\n
    \r\n
    \r\n nested div\r\n
    \r\n \r\n This is a div _with_ underscores\r\n and a & bold element.\r\n \r\n
    \r\n\r\n* Bullet lists are easy too\r\n- Another one\r\n+ Another one\r\n\r\nThis is a paragraph, which is text surrounded by\r\nwhitespace. Paragraphs can be on one\r\nline (or many), and can drone on for hours.\r\n\r\nNow some inline markup like _italics_, **bold**,\r\nand `code()`. Note that underscores\r\nin_words_are ignored.\r\n\r\n````application/json\r\n { value: [\"or with a mime type\"] }\r\n````\r\n\r\n> Blockquotes are like quoted text in email replies\r\n>> And, they can be nested\r\n\r\n1. A numbered list\r\n2. Which is numbered\r\n3. With periods and a space\r\n\r\nAnd now some code:\r\n\r\n // Code is just text indented a bit\r\n which(is_easy) to_remember();\r\n\r\nAnd a block\r\n\r\n~~~\r\n// Markdown extra adds un-indented code blocks too\r\n\r\nif (this_is_more_code == true && !indented) {\r\n // tild wrapped code blocks, also not indented\r\n}\r\n~~~\r\n\r\nText with\r\ntwo trailing spaces\r\n(on the right)\r\ncan be used\r\nfor things like poems\r\n\r\n### Horizontal rules\r\n\r\n* * * *\r\n****\r\n--------------------------\r\n\r\n![picture alt](/images/photo.jpeg \"Title is optional\")\r\n\r\n## Markdown plus tables ##\r\n\r\n| Header | Header | Right |\r\n| ------ | ------ | -----: |\r\n| Cell | Cell | $10 |\r\n| Cell | Cell | $20 |\r\n\r\n* Outer pipes on tables are optional\r\n* Colon used for alignment (right versus left)\r\n\r\n## Markdown plus definition lists ##\r\n\r\nBottled water\r\n: $ 1.25\r\n: $ 1.55 (Large)\r\n\r\nMilk\r\nPop\r\n: $ 1.75\r\n\r\n* Multiple definitions and terms are possible\r\n* Definitions can include multiple paragraphs too\r\n\r\n*[ABBR]: Markdown plus abbreviations (produces an tag)" }, + { + "name": "sample.mips.txt", + "content": "# A[i] = A[i/2] + 1;\n lw $t0, 0($gp) # fetch i\n srl $t1, $t0, 1 # i/2\n sll $t1, $t1, 2 # turn i/2 into a byte offset (*4)\n add $t1, $gp, $t1 # &A[i/2] - 28\n lw $t1, 28($t1) # fetch A[i/2]\n addi $t1, $t1, 1 # A[i/2] + 1\n sll $t2, $t0, 2 # turn i into a byte offset\n add $t2, $t2, $gp # &A[i] - 28\n sw $t1, 28($t2) # A[i] = ...\n# A[i+1] = -1;\n addi $t1, $zero, -1 # -1\n sw $t1, 32($t2) # A[i+1] = -1\n" + }, { "name": "sample.msdax.txt", "content": " = CALCULATE(SUM(Sales[SalesAmount]), PREVIOUSQUARTER(Calendar[DateKey]))" }, + { + "name": "sample.mysql.txt", + "content": "CREATE TABLE shop (\n article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,\n dealer CHAR(20) DEFAULT '' NOT NULL,\n price DOUBLE(16,2) DEFAULT '0.00' NOT NULL,\n PRIMARY KEY(article, dealer));\nINSERT INTO shop VALUES\n (1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),\n (3,'C',1.69),(3,'D',1.25),(4,'D',19.95);" + }, { "name": "sample.objective-c.txt", "content": "//\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n//\r\n\r\n#import \"UseQuotes.h\"\r\n#import \r\n\r\n/*\r\n\tMulti \r\n\tLine\r\n\tComments \r\n*/\r\n@implementation Test\r\n\r\n- (void) applicationWillFinishLaunching:(NSNotification *)notification\r\n{\r\n}\r\n\r\n- (IBAction)onSelectInput:(id)sender\r\n{\r\n NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];\r\n \r\n NSOpenPanel* panel = [NSOpenPanel openPanel];\r\n [panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@\"ipa\", @\"xcarchive\", @\"app\", nil]];\r\n \r\n [panel beginWithCompletionHandler:^(NSInteger result)\r\n {\r\n if (result == NSFileHandlingPanelOKButton)\r\n [self.inputTextField setStringValue:[panel.URL path]];\r\n }];\r\n return YES;\r\n\r\n int hex = 0xFEF1F0F;\r\n\t float ing = 3.14;\r\n\t ing = 3.14e0;\r\n\t ing = 31.4e-2;\r\n}\r\n\r\n-(id) initWithParams:(id) aHandler withDeviceStateManager:(id) deviceStateManager\r\n{\r\n // add a tap gesture recognizer\r\n UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];\r\n NSMutableArray *gestureRecognizers = [NSMutableArray array];\r\n [gestureRecognizers addObject:tapGesture];\r\n [gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];\r\n scnView.gestureRecognizers = gestureRecognizers;\r\n\r\n\treturn tapGesture;\r\n\treturn nil;\r\n}\r\n\r\n@end\r\n" }, { "name": "sample.pascal.txt", - "content": "program GreetingsNumberOfTimes;\n\n{$APPTYPE CONSOLE}\n\n{$R *.res}\n\nuses\n System.SysUtils;\n\nvar\n greetingsMessage: string;\n numberOfTimes, i: integer;\n\nbegin\n try\n { TODO -oUser -cConsole Main : Insert code here }\n greetingsMessage := 'Hello World!';\n numberOfTimes := 10;\n\n for i := 1 to numberOfTimes do\n begin\n Writeln(greetingsMessage);\n end;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n\n" + "content": "program GreetingsNumberOfTimes;\n\n{$APPTYPE CONSOLE}\n\n{$R *.res}\n\nuses\n System.SysUtils;\n\nvar\n greetingsMessage: string;\n numberOfTimes, i: integer;\n\nbegin\n try\n { TODO -oUser -cConsole Main : Insert code here }\n greetingsMessage := 'Hello World!';\n numberOfTimes := 10;\n\n for i := 1 to numberOfTimes do\n begin\n Writeln(greetingsMessage);\n end;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n" + }, + { + "name": "sample.pascaligo.txt", + "content": "type storage is int\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\ntype return is list (operation) * storage\n// Two entrypoints\nfunction add (const store : storage; const delta : int) : storage is\n store + delta\nfunction sub (const store : storage; const delta : int) : storage is\n store - delta\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n end)\n" + }, + { + "name": "sample.perl.txt", + "content": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nuse Path::Tiny;\n\nmy $dir = path('foo','bar'); # foo/bar\n\n# Iterate over the content of foo/bar\nmy $iter = $dir->iterator;\nwhile (my $file = $iter->()) {\n\n # See if it is a directory and skip\n next if $file->is_dir();\n\n # Print out the file name and path\n print \"$file\\n\";\n}" + }, + { + "name": "sample.pgsql.txt", + "content": "BEGIN\n SELECT * INTO STRICT myrec FROM emp WHERE empname = myname;\n EXCEPTION\n WHEN NO_DATA_FOUND THEN\n RAISE EXCEPTION 'employee % not found', myname;\n WHEN TOO_MANY_ROWS THEN\n RAISE EXCEPTION 'employee % not unique', myname;\nEND;" }, { "name": "sample.php.txt", @@ -160,6 +220,10 @@ define([], function() { return[ "name": "sample.postiats.txt", "content": "// http://www.ats-lang.org/\n(* Say Hello! once *)\nval () = print\"Hello!\\n\"\n//\n(* Say Hello! 3 times *)\nval () = 3*delay(print\"Hello!\")\nval () = print_newline((*void*))\n//\n\n//\n(* Build a list of 3 *)\nval xs = $list{int}(0, 1, 2)\n//\nval x0 = xs[0] // legal\nval x1 = xs[1] // legal\nval x2 = xs[2] // legal\nval x3 = xs[3] // illegal\n//\n\n//\nextern\nfun{} f0 (): int\nextern\nfun{} f1 (int): int\nextern\nfun{} repeat_f0f1 (int): int\n//\nimplement\n{}(*tmp*)\nrepeat_f0f1(n) =\n if n = 0\n then f0()\n else f1(repeat_f0f1(n-1))\n // end of [if]\n//\nfun\ntimes (\n m:int, n:int\n) : int = // m*n\n repeat_f0f1 (m) where\n{\n implement f0<> () = 0\n implement f1<> (x) = x + n\n}\n//\nfun\npower (\n m:int, n:int\n) : int = // m^n\n repeat_f0f1 (n) where\n{\n implement f0<> () = 1\n implement f1<> (x) = m * x\n}\n//\nval () =\nprintln! (\"5*5 = \", times(5,5))\nval () =\nprintln! (\"5^2 = \", power(5,2))\nval () =\nprintln! (\"2^10 = \", power(2,10))\nval () =\nprintln! (\"3^10 = \", power(3,10))\n//\n" }, + { + "name": "sample.powerquery.txt", + "content": "let\n Source = Excel.CurrentWorkbook(){[Name=\"Table1\"]}[Content],\n SplitColumnDelimiter = Table.SplitColumn(Source,\"Input\",Splitter.SplitTextByDelimiter(\",\"),13),\n Unpivot = Table.Unpivot(SplitColumnDelimiter,{\"Input.1\", \"Input.2\", \"Input.3\", \"Input.4\",\n \"Input.5\", \"Input.6\", \"Input.7\", \"Input.8\", \"Input.9\", \"Input.10\", \"Input.11\", \"Input.12\"\n , \"Input.13\"},\"Attribute\",\"Value\"),\n RemovedColumns = Table.RemoveColumns(Unpivot,{\"Attribute\"}),\n DuplicatesRemoved = Table.Distinct(RemovedColumns),\n GroupedRows = Table.Group(DuplicatesRemoved, {\"RowID\"}, {{\"Count of Distinct Values\"\n , each Table.RowCount(_), type number}})\nin\n GroupedRows" + }, { "name": "sample.powershell.txt", "content": "$SelectedObjectNames=@();\n$XenCenterNodeSelected = 0;\n#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list\nforeach($parameterSet in $ObjInfoArray)\n{\n\tif ($parameterSet[\"class\"] -eq \"blank\")\n\t{\n\t\t#When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank\n\t\tif ($XenCenterNodeSelected)\n\t\t{\n\t\t\tcontinue\n\t\t}\n\t\t$XenCenterNodeSelected = 1;\n\t\t$SelectedObjectNames += \"XenCenter\"\n\t}\n\telseif ($parameterSet[\"sessionRef\"] -eq \"null\")\n\t{\n\t\t#When a disconnected server is selected there is no session information, we get null for everything except class\n\t}\n\t\t$SelectedObjectNames += \"a disconnected server\"\n\telse\n\t{\n\t\tConnect-XenServer -url $parameterSet[\"url\"] -opaqueref $parameterSet[\"sessionRef\"]\n\t\t#Use $class to determine which server objects to get\n\t\t#-properties allows us to filter the results to just include the selected object\n\t\t$exp = \"Get-XenServer:{0} -properties @{{uuid='{1}'}}\" -f $parameterSet[\"class\"], $parameterSet[\"objUuid\"]\n\t\t$obj = Invoke-Expression $exp\n\t\t$SelectedObjectNames += $obj.name_label;\n\t} \n}" @@ -180,14 +244,46 @@ define([], function() { return[ "name": "sample.razor.txt", "content": "@{\r\n var total = 0;\r\n var totalMessage = \"\";\r\n @* a multiline\r\n razor comment embedded in csharp *@\r\n if (IsPost) {\r\n\r\n // Retrieve the numbers that the user entered.\r\n var num1 = Request[\"text1\"];\r\n var num2 = Request[\"text2\"];\r\n\r\n // Convert the entered strings into integers numbers and add.\r\n total = num1.AsInt() + num2.AsInt();\r\n\t\ttotalMessage = \"Total = \" + total;\r\n }\r\n}\r\n\r\n\r\n\r\n \r\n Add Numbers\r\n \r\n \r\n\r\n

    Enter two whole numbers and then click Add.

    \r\n
    \r\n

    \r\n \r\n

    \r\n

    \r\n \r\n

    \r\n

    \r\n
    \r\n\r\n\t@* now we call the totalMessage method \r\n\t (a multi line razor comment outside code) *@\r\n\r\n

    @totalMessage

    \r\n \r\n

    @(totalMessage+\"!\")

    \r\n \r\n An email address (with escaped at character): name@@domain.com\r\n \r\n\r\n\r\n" }, + { + "name": "sample.redis.txt", + "content": "EXISTS mykey\nAPPEND mykey \"Hello\"\nAPPEND mykey \" World\"\nGET mykey" + }, + { + "name": "sample.redshift.txt", + "content": "create view tables_vw as\nselect distinct(id) table_id\n,trim(datname) db_name\n,trim(nspname) schema_name\n,trim(relname) table_name\nfrom stv_tbl_perm\njoin pg_class on pg_class.oid = stv_tbl_perm.id\njoin pg_namespace on pg_namespace.oid = relnamespace\njoin pg_database on pg_database.oid = stv_tbl_perm.db_id;\n" + }, + { + "name": "sample.restructuredtext.txt", + "content": "=================\nMy Project Readme\n=================\n-------------------------\nClever subtitle goes here\n-------------------------\n\nIntroduction\n============\n\nThis is an example reStructuredText document that starts at the very top\nwith a title and a sub-title. There is one primary header, Introduction.\nThere is one example subheading below.\nThe document is just plain text so it is easily readable even before\nbeing converted to HTML, man page, PDF or other formats.\n\nSubheading\n----------\n\nThe basic syntax is not that different from Markdown, but it also\nhas many more powerful features that Markdown doesn't have. We aren't\ntaking advantage of those yet though.\n\n- Bullet points\n- Are intuitive\n- And simple too\n" + }, { "name": "sample.ruby.txt", "content": "#-------------------------------------------------------------------------\r\n# Copyright (c) Microsoft. All rights reserved.\r\n#--------------------------------------------------------------------------\r\n\r\nmodule Azure\r\n module Blob\r\n class Blob\r\n \r\n def initialize\r\n @properties = {}\r\n @metadata = {}\r\n yield self if block_given?\r\n end\r\n\r\n attr_accessor :name\r\n attr_accessor :snapshot\r\n attr_accessor :properties\r\n attr_accessor :metadata\r\n end\r\n end\r\nend" }, + { + "name": "sample.rust.txt", + "content": "fn main() {\n let greetings = [\"Hello\", \"Hola\", \"Bonjour\",\n \"Ciao\", \"こんにちは\", \"안녕하세요\",\n \"Cześć\", \"Olá\", \"Здравствуйте\",\n \"Chào bạn\", \"您好\", \"Hallo\",\n \"Hej\", \"Ahoj\", \"سلام\"];\n\n for (num, greeting) in greetings.iter().enumerate() {\n print!(\"{} : \", greeting);\n match num {\n 0 => println!(\"This code is editable and runnable!\"),\n 1 => println!(\"¡Este código es editable y ejecutable!\"),\n 2 => println!(\"Ce code est modifiable et exécutable !\"),\n 3 => println!(\"Questo codice è modificabile ed eseguibile!\"),\n 4 => println!(\"このコードは編集して実行出来ます!\"),\n 5 => println!(\"여기에서 코드를 수정하고 실행할 수 있습니다!\"),\n 6 => println!(\"Ten kod można edytować oraz uruchomić!\"),\n 7 => println!(\"Este código é editável e executável!\"),\n 8 => println!(\"Этот код можно отредактировать и запустить!\"),\n 9 => println!(\"Bạn có thể edit và run code trực tiếp!\"),\n 10 => println!(\"这段代码是可以编辑并且能够运行的!\"),\n 11 => println!(\"Dieser Code kann bearbeitet und ausgeführt werden!\"),\n 12 => println!(\"Den här koden kan redigeras och köras!\"),\n 13 => println!(\"Tento kód můžete upravit a spustit\"),\n 14 => println!(\"این کد قابلیت ویرایش و اجرا دارد!\"),\n _ => {},\n }\n }\n}\n" + }, + { + "name": "sample.sb.txt", + "content": "begin:\nTextWindow.Write(\"Enter a number: \")\nnum = TextWindow.ReadNumber()\nremainder = Math.Remainder(num, 2)\nIf (remainder = 0) Then\n TextWindow.WriteLine(\"The number is Even\")\nElse\n TextWindow.WriteLine(\"The number is Odd\")\nEndIf\nGoto begin" + }, + { + "name": "sample.scala.txt", + "content": "package examples\n\n/** Quick sort, imperative style */\nobject sort {\n\n /** Nested methods can use and even update everything\n * visible in their scope (including local variables or\n * arguments of enclosing methods).\n */\n def sort(a: Array[Int]) {\n\n def swap(i: Int, j: Int) {\n val t = a(i); a(i) = a(j); a(j) = t\n }\n\n def sort1(l: Int, r: Int) {\n val pivot = a((l + r) / 2)\n var i = l\n var j = r\n while (i <= j) {\n while (a(i) < pivot) i += 1\n while (a(j) > pivot) j -= 1\n if (i <= j) {\n swap(i, j)\n i += 1\n j -= 1\n }\n }\n if (l < j) sort1(l, j)\n if (j < r) sort1(i, r)\n }\n\n if (a.length > 0)\n sort1(0, a.length - 1)\n }\n\n def println(ar: Array[Int]) {\n def print1 = {\n def iter(i: Int): String =\n ar(i) + (if (i < ar.length-1) \",\" + iter(i+1) else \"\")\n if (ar.length == 0) \"\" else iter(0)\n }\n Console.println(\"[\" + print1 + \"]\")\n }\n\n def main(args: Array[String]) {\n val ar = Array(6, 2, 8, 5, 1)\n println(ar)\n sort(ar)\n println(ar)\n }\n\n}\n" + }, + { + "name": "sample.scheme.txt", + "content": ";;; make-matrix creates a matrix (a vector of vectors).\n(define make-matrix\n (lambda (rows columns)\n (do ((m (make-vector rows))\n (i 0 (+ i 1)))\n ((= i rows) m)\n (vector-set! m i (make-vector columns)))))\n\n;;; matrix? checks to see if its argument is a matrix.\n;;; It isn't foolproof, but it's generally good enough.\n(define matrix?\n (lambda (x)\n (and (vector? x)\n (> (vector-length x) 0)\n (vector? (vector-ref x 0)))))\n\n;; matrix-rows returns the number of rows in a matrix.\n(define matrix-rows\n (lambda (x)\n (vector-length x)))\n\n;; matrix-columns returns the number of columns in a matrix.\n(define matrix-columns\n (lambda (x)\n (vector-length (vector-ref x 0))))\n\n;;; matrix-ref returns the jth element of the ith row.\n(define matrix-ref\n (lambda (m i j)\n (vector-ref (vector-ref m i) j)))\n\n;;; matrix-set! changes the jth element of the ith row.\n(define matrix-set!\n (lambda (m i j x)\n (vector-set! (vector-ref m i) j x)))\n\n;;; mul is the generic matrix/scalar multiplication procedure\n(define mul\n (lambda (x y)\n ;; mat-sca-mul multiplies a matrix by a scalar.\n (define mat-sca-mul\n (lambda (m x)\n (let* ((nr (matrix-rows m))\n (nc (matrix-columns m))\n (r (make-matrix nr nc)))\n (do ((i 0 (+ i 1)))\n ((= i nr) r)\n (do ((j 0 (+ j 1)))\n ((= j nc))\n (matrix-set! r i j\n (* x (matrix-ref m i j))))))))\n\n ;; mat-mat-mul multiplies one matrix by another, after verifying\n ;; that the first matrix has as many columns as the second\n ;; matrix has rows.\n (define mat-mat-mul\n (lambda (m1 m2)\n (let* ((nr1 (matrix-rows m1))\n (nr2 (matrix-rows m2))\n (nc2 (matrix-columns m2))\n (r (make-matrix nr1 nc2)))\n (if (not (= (matrix-columns m1) nr2))\n (match-error m1 m2))\n (do ((i 0 (+ i 1)))\n ((= i nr1) r)\n (do ((j 0 (+ j 1)))\n ((= j nc2))\n (do ((k 0 (+ k 1))\n (a 0\n (+ a\n (* (matrix-ref m1 i k)\n (matrix-ref m2 k j)))))\n ((= k nr2)\n (matrix-set! r i j a))))))))\n\n ;; type-error is called to complain when mul receives an invalid\n ;; type of argument.\n (define type-error\n (lambda (what)\n (error 'mul\n \"~s is not a number or matrix\"\n what)))\n\n ;; match-error is called to complain when mul receives a pair of\n ;; incompatible arguments.\n (define match-error\n (lambda (what1 what2)\n (error 'mul\n \"~s and ~s are incompatible operands\"\n what1\n what2)))\n\n ;; body of mul; dispatch based on input types\n (cond\n ((number? x)\n (cond\n ((number? y) (* x y))\n ((matrix? y) (mat-sca-mul y x))\n (else (type-error y))))\n ((matrix? x)\n (cond\n ((number? y) (mat-sca-mul x y))\n ((matrix? y) (mat-mat-mul x y))\n (else (type-error y))))\n (else (type-error x)))))" + }, { "name": "sample.scss.txt", "content": "$baseFontSizeInPixels: 14;\r\n\r\n@function px2em ($font_size, $base_font_size: $baseFontSizeInPixels) { \r\n @return ($font_size / $base_font_size) + em; \r\n}\r\n\r\nh1 {\r\n font-size: px2em(36, $baseFontSizeInPixels);\r\n}\r\nh2 {\r\n font-size: px2em(28, $baseFontSizeInPixels);\r\n}\r\n.class {\r\n font-size: px2em(14, $baseFontSizeInPixels);\r\n}\r\n\r\nnav {\r\n ul {\r\n margin: 0;\r\n padding: 0;\r\n list-style: none;\r\n }\r\n\r\n li { display: inline-block; }\r\n\r\n a {\r\n display: block;\r\n padding: 6px 12px;\r\n text-decoration: none;\r\n }\r\n \r\n @each $animal in puma, sea-slug, egret, salamander {\r\n .#{$animal}-icon {\r\n background-image: url('/images/#{$animal}.png');\r\n }\r\n }\r\n}" }, + { + "name": "sample.shell.txt", + "content": "#!/bin/bash\n# Simple line count example, using bash\n#\n# Bash tutorial: http://linuxconfig.org/Bash_scripting_Tutorial#8-2-read-file-into-bash-array\n# My scripting link: http://www.macs.hw.ac.uk/~hwloidl/docs/index.html#scripting\n#\n# Usage: ./line_count.sh file\n# -----------------------------------------------------------------------------\n\n# Link filedescriptor 10 with stdin\nexec 10<&0\n# stdin replaced with a file supplied as a first argument\nexec < $1\n# remember the name of the input file\nin=$1\n\n# init\nfile=\"current_line.txt\"\nlet count=0\n\n# this while loop iterates over all lines of the file\nwhile read LINE\ndo\n # increase line counter\n ((count++))\n # write current line to a tmp file with name $file (not needed for counting)\n echo $LINE > $file\n # this checks the return code of echo (not needed for writing; just for demo)\n if [ $? -ne 0 ]\n then echo \"Error in writing to file ${file}; check its permissions!\"\n fi\ndone\n\necho \"Number of lines: $count\"\necho \"The last line of the file is: `cat ${file}`\"\n\n# Note: You can achieve the same by just using the tool wc like this\necho \"Expected number of lines: `wc -l $in`\"\n\n# restore stdin from filedescriptor 10\n# and close filedescriptor 10\nexec 0<&10 10<&-" + }, { "name": "sample.sol.txt", "content": "pragma solidity ^0.4.11;\n\n/// @title Voting with delegation.\ncontract Ballot {\n // This declares a new complex type which will\n // be used for variables later.\n // It will represent a single voter.\n struct Voter {\n uint weight; // weight is accumulated by delegation\n bool voted; // if true, that person already voted\n address delegate; // person delegated to\n uint vote; // index of the voted proposal\n }\n\n // This is a type for a single proposal.\n struct Proposal {\n bytes32 name; // short name (up to 32 bytes)\n uint voteCount; // number of accumulated votes\n }\n\n address public chairperson;\n\n // This declares a state variable that\n // stores a `Voter` struct for each possible address.\n mapping(address => Voter) public voters;\n\n // A dynamically-sized array of `Proposal` structs.\n Proposal[] public proposals;\n\n /// Create a new ballot to choose one of `proposalNames`.\n function Ballot(bytes32[] proposalNames) {\n chairperson = msg.sender;\n voters[chairperson].weight = 1;\n\n // For each of the provided proposal names,\n // create a new proposal object and add it\n // to the end of the array.\n for (uint i = 0; i < proposalNames.length; i++) {\n // `Proposal({...})` creates a temporary\n // Proposal object and `proposals.push(...)`\n // appends it to the end of `proposals`.\n proposals.push(Proposal({\n name: proposalNames[i],\n voteCount: 0\n }));\n }\n }\n\n // Give `voter` the right to vote on this ballot.\n // May only be called by `chairperson`.\n function giveRightToVote(address voter) {\n // If the argument of `require` evaluates to `false`,\n // it terminates and reverts all changes to\n // the state and to Ether balances. It is often\n // a good idea to use this if functions are\n // called incorrectly. But watch out, this\n // will currently also consume all provided gas\n // (this is planned to change in the future).\n require((msg.sender == chairperson) && !voters[voter].voted && (voters[voter].weight == 0));\n voters[voter].weight = 1;\n }\n\n /// Delegate your vote to the voter `to`.\n function delegate(address to) {\n // assigns reference\n Voter sender = voters[msg.sender];\n require(!sender.voted);\n\n // Self-delegation is not allowed.\n require(to != msg.sender);\n\n // Forward the delegation as long as\n // `to` also delegated.\n // In general, such loops are very dangerous,\n // because if they run too long, they might\n // need more gas than is available in a block.\n // In this case, the delegation will not be executed,\n // but in other situations, such loops might\n // cause a contract to get \"stuck\" completely.\n while (voters[to].delegate != address(0)) {\n to = voters[to].delegate;\n\n // We found a loop in the delegation, not allowed.\n require(to != msg.sender);\n }\n\n // Since `sender` is a reference, this\n // modifies `voters[msg.sender].voted`\n sender.voted = true;\n sender.delegate = to;\n Voter delegate = voters[to];\n if (delegate.voted) {\n // If the delegate already voted,\n // directly add to the number of votes\n proposals[delegate.vote].voteCount += sender.weight;\n } else {\n // If the delegate did not vote yet,\n // add to her weight.\n delegate.weight += sender.weight;\n }\n }\n\n /// Give your vote (including votes delegated to you)\n /// to proposal `proposals[proposal].name`.\n function vote(uint proposal) {\n Voter sender = voters[msg.sender];\n require(!sender.voted);\n sender.voted = true;\n sender.vote = proposal;\n\n // If `proposal` is out of the range of the array,\n // this will throw automatically and revert all\n // changes.\n proposals[proposal].voteCount += sender.weight;\n }\n\n /// @dev Computes the winning proposal taking all\n /// previous votes into account.\n function winningProposal() constant\n returns (uint winningProposal)\n {\n uint winningVoteCount = 0;\n for (uint p = 0; p < proposals.length; p++) {\n if (proposals[p].voteCount > winningVoteCount) {\n winningVoteCount = proposals[p].voteCount;\n winningProposal = p;\n }\n }\n }\n\n // Calls winningProposal() function to get the index\n // of the winner contained in the proposals array and then\n // returns the name of the winner\n function winnerName() constant\n returns (bytes32 winnerName)\n {\n winnerName = proposals[winningProposal()].name;\n }\n}" @@ -196,10 +292,26 @@ define([], function() { return[ "name": "sample.sql.txt", "content": "CREATE TABLE dbo.EmployeePhoto\n(\n EmployeeId INT NOT NULL PRIMARY KEY,\n Photo VARBINARY(MAX) FILESTREAM NULL,\n MyRowGuidColumn UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL\n UNIQUE DEFAULT NEWID()\n);\n\nGO\n\n/*\ntext_of_comment\n/* nested comment */\n*/\n\n-- line comment\n\nCREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID\n ON Production.WorkOrder(ProductID)\n WITH (FILLFACTOR = 80,\n PAD_INDEX = ON,\n DROP_EXISTING = ON);\nGO\n\nWHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300\nBEGIN\n UPDATE Production.Product\n SET ListPrice = ListPrice * 2\n SELECT MAX(ListPrice) FROM Production.Product\n IF (SELECT MAX(ListPrice) FROM Production.Product) > $500\n BREAK\n ELSE\n CONTINUE\nEND\nPRINT 'Too much for the market to bear';\n\nMERGE INTO Sales.SalesReason AS [Target]\nUSING (VALUES ('Recommendation','Other'), ('Review', 'Marketing'), ('Internet', 'Promotion'))\n AS [Source] ([NewName], NewReasonType)\nON [Target].[Name] = [Source].[NewName]\nWHEN MATCHED\nTHEN UPDATE SET ReasonType = [Source].NewReasonType\nWHEN NOT MATCHED BY TARGET\nTHEN INSERT ([Name], ReasonType) VALUES ([NewName], NewReasonType)\nOUTPUT $action INTO @SummaryOfChanges;\n\nSELECT ProductID, OrderQty, SUM(LineTotal) AS Total\nFROM Sales.SalesOrderDetail\nWHERE UnitPrice < $5.00\nGROUP BY ProductID, OrderQty\nORDER BY ProductID, OrderQty\nOPTION (HASH GROUP, FAST 10);\n" }, + { + "name": "sample.st.txt", + "content": "CONFIGURATION DefaultCfg\n VAR_GLOBAL\n Start_Stop AT %IX0.0: BOOL; (* This is a comment *)\n END_VAR\n TASK NewTask (INTERVAL := T#20ms);\n PROGRAM Main WITH NewTask : PLC_PRG;\nEND_CONFIGURATION\n\nPROGRAM demo\n VAR_EXTERNAL\n Start_Stop: BOOL;\n END_VAR\n VAR\n a : REAL; // Another comment\n todTest: TIME_OF_DAY := TOD#12:55;\n END_VAR\n a := csq(12.5);\n TON1(IN := TRUE, PT := T#2s);\n 16#FAC0 2#1001_0110\n IF TON1.Q AND a > REAL#100 THEN\n Start_Stop := TRUE;\n END_IF\nEND_PROGRAM;\n\n/* Get a square of the circle */\nFUNCTION csq : REAL\n VAR_INPUT\n r: REAL;\n END_VAR\n VAR CONSTANT\n c_pi: REAL := 3.14;\n END_VAR\n csq := ABS(c_pi * (r * 2));\nEND_FUNCTION" + }, { "name": "sample.swift.txt", "content": "import Foundation\r\n\r\nprotocol APIControllerProtocol {\r\n func didReceiveAPIResults(results: NSArray)\r\n}\r\n\r\nclass APIController {\r\n var delegate: APIControllerProtocol\r\n\r\n init(delegate: APIControllerProtocol) {\r\n self.delegate = delegate\r\n }\r\n\r\n func get(path: String) {\r\n let url = NSURL(string: path)\r\n let session = NSURLSession.sharedSession()\r\n let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in\r\n println(\"Task completed\")\r\n if(error != nil) {\r\n // If there is an error in the web request, print it to the console\r\n println(error.localizedDescription)\r\n }\r\n var err: NSError?\r\n if let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as? NSDictionary {\r\n if(err != nil) {\r\n // If there is an error parsing JSON, print it to the console\r\n println(\"JSON Error \\(err!.localizedDescription)\")\r\n }\r\n if let results: NSArray = jsonResult[\"results\"] as? NSArray {\r\n self.delegate.didReceiveAPIResults(results)\r\n }\r\n }\r\n })\r\n\r\n // The task is just an object with all these properties set\r\n // In order to actually make the web request, we need to \"resume\"\r\n task.resume()\r\n }\r\n\r\n func searchItunesFor(searchTerm: String) {\r\n // The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs\r\n let itunesSearchTerm = searchTerm.stringByReplacingOccurrencesOfString(\" \", withString: \"+\", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil)\r\n\r\n // Now escape anything else that isn't URL-friendly\r\n if let escapedSearchTerm = itunesSearchTerm.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {\r\n let urlPath = \"https://itunes.apple.com/search?term=\\(escapedSearchTerm)&media=music&entity=album\"\r\n }\r\n }\r\n\r\n}" }, + { + "name": "sample.systemverilog.txt", + "content": "// File : tb_top.sv\nmodule tb_top ();\n\n\treg clk;\n\treg resetn;\n\treg d;\n\twire q;\n\n\t// Instantiate the design\n\td_ff d_ff0 (\t.clk (clk),\n\t\t \t\t.resetn (resetn),\n\t\t \t\t.d (d),\n\t\t \t\t.q (q));\n\n\t// Create a clock\n\talways #10 clk <= ~clk;\n\n\tinitial begin\n\t\tresetn <= 0;\n\t\td <= 0;\n\n\t\t#10 resetn <= 1;\n\t\t#5 d <= 1;\n\t\t#8 d <= 0;\n\t\t#2 d <= 1;\n\t\t#10 d <= 0;\n\tend\nendmodule\n" + }, + { + "name": "sample.tcl.txt", + "content": "proc find {{basedir .} {filterScript {}}} {\n set oldwd [pwd]\n cd $basedir\n set cwd [pwd]\n set filenames [glob -nocomplain * .*]\n set files {}\n set filt [string length $filterScript]\n foreach filename $filenames {\n if {!$filt || [eval $filterScript [list $filename]]} {\n lappend files [file join $cwd $filename]\n }\n if {[file isdirectory $filename]} {\n set files [concat $files [find $filename $filterScript]]\n }\n }\n cd $oldwd\n return $files\n}\n" + }, + { + "name": "sample.twig.txt", + "content": "\n\n \n \n {% block title %}Welcome!{% endblock %}\n {% block stylesheets %}{% endblock %}\n \n \n {% block body %}{% endblock %}\n {% block javascripts %}{% endblock %}\n \n\n" + }, { "name": "sample.typescript.txt", "content": "/* Game of Life\r\n * Implemented in TypeScript\r\n * To learn more about TypeScript, please visit http://www.typescriptlang.org/\r\n */\r\n\r\nnamespace Conway {\r\n\r\n\texport class Cell {\r\n\t\tpublic row: number;\r\n\t\tpublic col: number;\r\n\t\tpublic live: boolean;\r\n\r\n\t\tconstructor(row: number, col: number, live: boolean) {\r\n\t\t\tthis.row = row;\r\n\t\t\tthis.col = col;\r\n\t\t\tthis.live = live;\r\n\t\t}\r\n\t}\r\n\r\n\texport class GameOfLife {\r\n\t\tprivate gridSize: number;\r\n\t\tprivate canvasSize: number;\r\n\t\tprivate lineColor: string;\r\n\t\tprivate liveColor: string;\r\n\t\tprivate deadColor: string;\r\n\t\tprivate initialLifeProbability: number;\r\n\t\tprivate animationRate: number;\r\n\t\tprivate cellSize: number;\r\n\t\tprivate context: CanvasRenderingContext2D;\r\n\t\tprivate world;\r\n\r\n\r\n\t\tconstructor() {\r\n\t\t\tthis.gridSize = 50;\r\n\t\t\tthis.canvasSize = 600;\r\n\t\t\tthis.lineColor = '#cdcdcd';\r\n\t\t\tthis.liveColor = '#666';\r\n\t\t\tthis.deadColor = '#eee';\r\n\t\t\tthis.initialLifeProbability = 0.5;\r\n\t\t\tthis.animationRate = 60;\r\n\t\t\tthis.cellSize = 0;\r\n\t\t\tthis.world = this.createWorld();\r\n\t\t\tthis.circleOfLife();\r\n\t\t}\r\n\r\n\t\tpublic createWorld() {\r\n\t\t\treturn this.travelWorld( (cell : Cell) => {\r\n\t\t\t\tcell.live = Math.random() < this.initialLifeProbability;\r\n\t\t\t\treturn cell;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tpublic circleOfLife() : void {\r\n\t\t\tthis.world = this.travelWorld( (cell: Cell) => {\r\n\t\t\t\tcell = this.world[cell.row][cell.col];\r\n\t\t\t\tthis.draw(cell);\r\n\t\t\t\treturn this.resolveNextGeneration(cell);\r\n\t\t\t});\r\n\t\t\tsetTimeout( () => {this.circleOfLife()}, this.animationRate);\r\n\t\t}\r\n\r\n\t\tpublic resolveNextGeneration(cell : Cell) {\r\n\t\t\tvar count = this.countNeighbors(cell);\r\n\t\t\tvar newCell = new Cell(cell.row, cell.col, cell.live);\r\n\t\t\tif(count < 2 || count > 3) newCell.live = false;\r\n\t\t\telse if(count == 3) newCell.live = true;\r\n\t\t\treturn newCell;\r\n\t\t}\r\n\r\n\t\tpublic countNeighbors(cell : Cell) {\r\n\t\t\tvar neighbors = 0;\r\n\t\t\tfor(var row = -1; row <=1; row++) {\r\n\t\t\t\tfor(var col = -1; col <= 1; col++) {\r\n\t\t\t\t\tif(row == 0 && col == 0) continue;\r\n\t\t\t\t\tif(this.isAlive(cell.row + row, cell.col + col)) {\r\n\t\t\t\t\t\tneighbors++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn neighbors;\r\n\t\t}\r\n\r\n\t\tpublic isAlive(row : number, col : number) {\r\n\t\t\tif(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false;\r\n\t\t\treturn this.world[row][col].live;\r\n\t\t}\r\n\r\n\t\tpublic travelWorld(callback) {\r\n\t\t\tvar result = [];\r\n\t\t\tfor(var row = 0; row < this.gridSize; row++) {\r\n\t\t\t\tvar rowData = [];\r\n\t\t\t\tfor(var col = 0; col < this.gridSize; col++) {\r\n\t\t\t\t\trowData.push(callback(new Cell(row, col, false)));\r\n\t\t\t\t}\r\n\t\t\t\tresult.push(rowData);\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tpublic draw(cell : Cell) {\r\n\t\t\tif(this.context == null) this.context = this.createDrawingContext();\r\n\t\t\tif(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize;\r\n\r\n\t\t\tthis.context.strokeStyle = this.lineColor;\r\n\t\t\tthis.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);\r\n\t\t\tthis.context.fillStyle = cell.live ? this.liveColor : this.deadColor;\r\n\t\t\tthis.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);\r\n\t\t}\r\n\r\n\t\tpublic createDrawingContext() {\r\n\t\t\tvar canvas = document.getElementById('conway-canvas');\r\n\t\t\tif(canvas == null) {\r\n\t\t\t\t\tcanvas = document.createElement('canvas');\r\n\t\t\t\t\tcanvas.id = 'conway-canvas';\r\n\t\t\t\t\tcanvas.width = this.canvasSize;\r\n\t\t\t\t\tcanvas.height = this.canvasSize;\r\n\t\t\t\t\tdocument.body.appendChild(canvas);\r\n\t\t\t}\r\n\t\t\treturn canvas.getContext('2d');\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvar game = new Conway.GameOfLife();\r\n" @@ -208,6 +320,10 @@ define([], function() { return[ "name": "sample.vb.txt", "content": "Imports System\r\nImports System.Collections.Generic\r\n\r\nModule Module1\r\n\r\n Sub Main()\r\n Dim a As New M8Ball\r\n\r\n Do While True\r\n\r\n Dim q As String = \"\"\r\n Console.Write(\"ask me about the future... \")\r\n q = Console.ReadLine()\r\n\r\n If q.Trim <> \"\" Then\r\n Console.WriteLine(\"the answer is... {0}\", a.getAnswer(q))\r\n Else\r\n Exit Do\r\n End If\r\n Loop\r\n\r\n End Sub\r\n\r\nEnd Module\r\n\r\nClass M8Ball\r\n\r\n Public Answers As System.Collections.Generic.Dictionary(Of Integer, String)\r\n\r\n Public Sub New()\r\n Answers = New System.Collections.Generic.Dictionary(Of Integer, String)\r\n Answers.Add(0, \"It is certain\")\r\n Answers.Add(1, \"It is decidedly so\")\r\n Answers.Add(2, \"Without a doubt\")\r\n Answers.Add(3, \"Yes, definitely\")\r\n Answers.Add(4, \"You may rely on \")\r\n Answers.Add(5, \"As I see it, yes\")\r\n Answers.Add(6, \"Most likely\")\r\n Answers.Add(7, \"Outlook good\")\r\n Answers.Add(8, \"Signs point to yes\")\r\n Answers.Add(9, \"Yes\")\r\n Answers.Add(10, \"Reply hazy, try again\")\r\n Answers.Add(11, \"Ask again later\")\r\n Answers.Add(12, \"Better not tell you now\")\r\n Answers.Add(13, \"Cannot predict now\")\r\n Answers.Add(14, \"Concentrate and ask again\")\r\n Answers.Add(15, \"Don't count on it\")\r\n Answers.Add(16, \"My reply is no\")\r\n Answers.Add(17, \"My sources say no\")\r\n Answers.Add(18, \"Outlook not so\")\r\n Answers.Add(19, \"Very doubtful\")\r\n End Sub\r\n\r\n Public Function getAnswer(theQuestion As String) As String\r\n Dim r As New Random\r\n Return Answers(r.Next(0, 19))\r\n End Function\r\n\r\nEnd Class\r\n" }, + { + "name": "sample.verilog.txt", + "content": "`include \"first_counter.v\"\nmodule first_counter_tb();\n// Declare inputs as regs and outputs as wires\nreg clock, reset, enable;\nwire [3:0] counter_out;\n\n// Initialize all variables\ninitial begin\n $display (\"time\\t clk reset enable counter\");\n $monitor (\"%g\\t %b %b %b %b\",\n\t $time, clock, reset, enable, counter_out);\n clock = 1; // initial value of clock\n reset = 0; // initial value of reset\n enable = 0; // initial value of enable\n #5 reset = 1; // Assert the reset\n #10 reset = 0; // De-assert the reset\n #10 enable = 1; // Assert enable\n #100 enable = 0; // De-assert enable\n #5 $finish; // Terminate simulation\nend\n\n// Clock generator\nalways begin\n #5 clock = ~clock; // Toggle clock every 5 ticks\nend\n\n// Connect DUT to test bench\nfirst_counter U_counter (\nclock,\nreset,\nenable,\ncounter_out\n);\n\nendmodule\n" + }, { "name": "sample.xml.txt", "content": "\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n" diff --git a/test/samples/sample.abap.txt b/test/samples/sample.abap.txt new file mode 100644 index 00000000..0acb41b6 --- /dev/null +++ b/test/samples/sample.abap.txt @@ -0,0 +1,29 @@ +REPORT zrosetta_base64_encode_data. + +DATA: li_client TYPE REF TO if_http_client, + lv_encoded TYPE string, + lv_data TYPE xstring. + + +cl_http_client=>create_by_url( + EXPORTING + url = 'http://rosettacode.org/favicon.ico' + IMPORTING + client = li_client ). + +li_client->send( ). +li_client->receive( ). + +lv_data = li_client->response->get_data( ). + +CALL FUNCTION 'SSFC_BASE64_ENCODE' + EXPORTING + bindata = lv_data + IMPORTING + b64data = lv_encoded. + +WHILE strlen( lv_encoded ) > 100. + WRITE: / lv_encoded(100). + lv_encoded = lv_encoded+100. +ENDWHILE. +WRITE: / lv_encoded. diff --git a/test/samples/sample.apex.txt b/test/samples/sample.apex.txt new file mode 100644 index 00000000..a90f18f8 --- /dev/null +++ b/test/samples/sample.apex.txt @@ -0,0 +1,7 @@ +/* Using a single database query, find all the leads in + the database that have the same email address as any + of the leads being inserted or updated. */ +for (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) { + Lead newLead = leadMap.get(lead.Email); + newLead.Email.addError('A lead with this email address already exists.'); +} diff --git a/test/samples/sample.azcli.txt b/test/samples/sample.azcli.txt new file mode 100644 index 00000000..0aedade8 --- /dev/null +++ b/test/samples/sample.azcli.txt @@ -0,0 +1,5 @@ +# Create a resource group. +az group create --name myResourceGroup --location westeurope + +# Create a new virtual machine, this creates SSH keys if not present. +az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --generate-ssh-keys \ No newline at end of file diff --git a/test/samples/sample.c.txt b/test/samples/sample.c.txt index cd8482fc..7f6fee8c 100644 --- a/test/samples/sample.c.txt +++ b/test/samples/sample.c.txt @@ -1,246 +1,3463 @@ -#include "pch.h" -#include "Direct3DBase.h" +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full +// license information. -using namespace Microsoft::WRL; -using namespace Windows::UI::Core; -using namespace Windows::Foundation; +/* + * COMMAND LINE: -Ox -Gz -YX -UPROTOTYPES_REQUIRED + */ -// Constructor. -Direct3DBase::Direct3DBase() -{ -} +#pragma warning(disable : 4532) +#pragma warning(disable : 4702) -// Initialize the Direct3D resources required to run. -void Direct3DBase::Initialize(CoreWindow^ window) -{ - m_window = window; - - CreateDeviceResources(); - CreateWindowSizeDependentResources(); -} +#if defined(_WIN32) -// These are the resources that depend on the device. -void Direct3DBase::CreateDeviceResources() -{ - // This flag adds support for surfaces with a different color channel ordering than the API default. - // It is recommended usage, and is required for compatibility with Direct2D. - UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; - -#if defined(_DEBUG) - // If the project is in a debug build, enable debugging via SDK Layers with this flag. - creationFlags |= D3D11_CREATE_DEVICE_DEBUG; +#if defined(_M_SH) +#define WIN_CE #endif - // This array defines the set of DirectX hardware feature levels this app will support. - // Note the ordering should be preserved. - // Don't forget to declare your application's minimum required feature level in its - // description. All applications are assumed to support 9.1 unless otherwise stated. - D3D_FEATURE_LEVEL featureLevels[] = - { - D3D_FEATURE_LEVEL_11_1, - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - D3D_FEATURE_LEVEL_9_3, - D3D_FEATURE_LEVEL_9_2, - D3D_FEATURE_LEVEL_9_1 - }; +#if defined(_M_AMD64) +#define NEST_IN_FINALLY /* allow when __try nested in __finally OK */ +#endif - // Create the DX11 API device object, and get a corresponding context. - ComPtr device; - ComPtr context; - DX::ThrowIfFailed( - D3D11CreateDevice( - nullptr, // specify null to use the default adapter - D3D_DRIVER_TYPE_HARDWARE, - nullptr, // leave as nullptr unless software device - creationFlags, // optionally set debug and Direct2D compatibility flags - featureLevels, // list of feature levels this app can support - ARRAYSIZE(featureLevels), // number of entries in above list - D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION - &device, // returns the Direct3D device created - &m_featureLevel, // returns feature level of device created - &context // returns the device immediate context - ) - ); +#define NTSTATUS LONG +#define EXCEPTION_NESTED_CALL 0x10 +#define RtlRaiseStatus(x) RaiseException((x), 0, 0, NULL) +#define RtlRaiseException(x) \ + RaiseException((x)->ExceptionCode, (x)->ExceptionFlags, \ + (x)->NumberParameters, (x)->ExceptionInformation) +#define IN +#define OUT +#if !(defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)) +#define i386 1 +#endif +#define try __try +#define except __except +#define finally __finally +#define leave __leave - // Get the DirectX11.1 device by QI off the DirectX11 one. - DX::ThrowIfFailed( - device.As(&m_d3dDevice) - ); +#endif - // And get the corresponding device context in the same way. - DX::ThrowIfFailed( - context.As(&m_d3dContext) - ); -} +#define WIN32_LEAN_AND_MEAN -// Allocate all memory resources that change on a window SizeChanged event. -void Direct3DBase::CreateWindowSizeDependentResources() -{ - // Store the window bounds so the next time we get a SizeChanged event we can - // avoid rebuilding everything if the size is identical. - m_windowBounds = m_window->Bounds; +#include "stdio.h" +#if defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64) +#include "setjmpex.h" +#else +#include "setjmp.h" +#endif +#include "float.h" +#include "windows.h" +#include "math.h" - // If the swap chain already exists, resize it. - if(m_swapChain != nullptr) - { - DX::ThrowIfFailed( - m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0) - ); - } - // Otherwise, create a new one. - else - { - // Create a descriptor for the swap chain. - DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0}; - swapChainDesc.Width = 0; // use automatic sizing - swapChainDesc.Height = 0; - swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format - swapChainDesc.Stereo = false; - swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling - swapChainDesc.SampleDesc.Quality = 0; - swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect - swapChainDesc.Scaling = DXGI_SCALING_NONE; - swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications - swapChainDesc.Flags = 0; +#if !defined(STATUS_SUCCESS) +#define STATUS_SUCCESS 0 +#endif +#if !defined(STATUS_UNSUCCESSFUL) +#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L) +#endif - // Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device +// +// Define switch constants. +// - // First, retrieve the underlying DXGI Device from the D3D Device - ComPtr dxgiDevice; - DX::ThrowIfFailed( - m_d3dDevice.As(&dxgiDevice) - ); +#define BLUE 0 +#define RED 1 - // Identify the physical adapter (GPU or card) this device is running on. - ComPtr dxgiAdapter; - DX::ThrowIfFailed( - dxgiDevice->GetAdapter(&dxgiAdapter) - ); +// +// Define function prototypes. +// - // And obtain the factory object that created it. - ComPtr dxgiFactory; - DX::ThrowIfFailed( - dxgiAdapter->GetParent( - __uuidof(IDXGIFactory2), - &dxgiFactory - ) - ); +VOID addtwo(IN LONG First, IN LONG Second, IN PLONG Place); - Windows::UI::Core::CoreWindow^ p = m_window.Get(); +VOID bar1(IN NTSTATUS Status, IN PLONG Counter); - // Create a swap chain for this window from the DXGI factory. - DX::ThrowIfFailed( - dxgiFactory->CreateSwapChainForCoreWindow( - m_d3dDevice.Get(), - reinterpret_cast(p), - &swapChainDesc, - nullptr, // allow on all displays - &m_swapChain - ) - ); - - // Ensure that DXGI does not queue more than one frame at a time. This both reduces - // latency and ensures that the application will only render after each VSync, minimizing - // power consumption. - DX::ThrowIfFailed( - dxgiDevice->SetMaximumFrameLatency(1) - ); - } - - // Obtain the backbuffer for this window which will be the final 3D rendertarget. - ComPtr backBuffer; - DX::ThrowIfFailed( - m_swapChain->GetBuffer( - 0, - __uuidof(ID3D11Texture2D), - &backBuffer - ) - ); +VOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter); - // Create a view interface on the rendertarget to use on bind. - DX::ThrowIfFailed( - m_d3dDevice->CreateRenderTargetView( - backBuffer.Get(), - nullptr, - &m_renderTargetView - ) - ); +VOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter); - // Cache the rendertarget dimensions in our helper class for convenient use. - D3D11_TEXTURE2D_DESC backBufferDesc; - backBuffer->GetDesc(&backBufferDesc); - m_renderTargetSize.Width = static_cast(backBufferDesc.Width); - m_renderTargetSize.Height = static_cast(backBufferDesc.Height); +LONG Echo(IN LONG Value); - // Create a descriptor for the depth/stencil buffer. - CD3D11_TEXTURE2D_DESC depthStencilDesc( - DXGI_FORMAT_D24_UNORM_S8_UINT, - backBufferDesc.Width, - backBufferDesc.Height, - 1, - 1, - D3D11_BIND_DEPTH_STENCIL); +#if !defined(WIN_CE) // return through finally not allowed on WinCE +VOID eret(IN NTSTATUS Status, IN PLONG Counter); +#endif - // Allocate a 2-D surface as the depth/stencil buffer. - ComPtr depthStencil; - DX::ThrowIfFailed( - m_d3dDevice->CreateTexture2D( - &depthStencilDesc, - nullptr, - &depthStencil - ) - ); +VOID except1(IN PLONG Counter); - // Create a DepthStencil view on this surface to use on bind. - DX::ThrowIfFailed( - m_d3dDevice->CreateDepthStencilView( - depthStencil.Get(), - &CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D), - &m_depthStencilView - ) - ); +ULONG +except2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter); - // Create a viewport descriptor of the full window size. - CD3D11_VIEWPORT viewPort( - 0.0f, - 0.0f, - static_cast(backBufferDesc.Width), - static_cast(backBufferDesc.Height) - ); - - // Set the current viewport using the descriptor. - m_d3dContext->RSSetViewports(1, &viewPort); -} +ULONG +except3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter); + +VOID foo1(IN NTSTATUS Status); + +VOID foo2(IN PLONG BlackHole, IN PLONG BadAddress); + +#if !defined(WIN_CE) // return from finally not allowed on WinCE +VOID fret(IN PLONG Counter); +#endif + +BOOLEAN +Tkm(VOID); + +VOID Test61Part2(IN OUT PULONG Counter); + +double SquareDouble(IN double op); + +DECLSPEC_NOINLINE +ULONG +PgFilter(VOID) -void Direct3DBase::UpdateForWindowSizeChange() { - if (m_window->Bounds.Width != m_windowBounds.Width || - m_window->Bounds.Height != m_windowBounds.Height) - { - m_renderTargetView = nullptr; - m_depthStencilView = nullptr; - CreateWindowSizeDependentResources(); - } + + printf("filter entered..."); + return EXCEPTION_EXECUTE_HANDLER; } -void Direct3DBase::Present() +#pragma warning(push) +#pragma warning(disable : 4532) + +VOID PgTest69(IN PLONG State, IN PLONG Fault) + { - // The first argument instructs DXGI to block until VSync, putting the application - // to sleep until the next VSync. This ensures we don't waste any cycles rendering - // frames that will never be displayed to the screen. - HRESULT hr = m_swapChain->Present(1, 0); - // If the device was removed either by a disconnect or a driver upgrade, we - // must completely reinitialize the renderer. - if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) - { - Initialize(m_window.Get()); + try { + try { + *Fault += 1; } - else - { - DX::ThrowIfFailed(hr); + finally { + if (AbnormalTermination()) { + if (*State == 1) { + *State += 1; + + } else { + *Fault += 1; + } + } } + } + except(((*State += 1) == 1) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) { + if (*State != 2) { + *Fault += 1; + } + } + + return; +} + +VOID PgTest70(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 2) { + PgFilter(); + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 2) == 2) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest71(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 3) { + *State += 3; + return; + + } else { + *Fault += 1; + } + } + } + } + finally { + if (AbnormalTermination()) { + if (*State == 6) { + *State += 3; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 3) == 3) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest72(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 4) { + *State += 4; + return; + + } else { + *Fault += 1; + } + } + } + } + finally { + if (AbnormalTermination()) { + if (*State == 8) { + *State += 4; + PgFilter(); + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 4) == 4) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest73(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 5) { + *State += 5; + + } else { + *Fault += 1; + } + } + } + } + finally { + if (AbnormalTermination()) { + if (*State == 10) { + *State += 5; + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 5) == 5) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest74(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 6) { + *State += 6; + + } else { + *Fault += 1; + } + } + } + } + finally { + if (AbnormalTermination()) { + if (*State == 12) { + *State += 6; + PgFilter(); + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 6) == 6) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest75(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 7) { + *State += 7; + *Fault += 1; + + } else { + *State += 10; + } + } + } + } + except(((*State += 7) == 7) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + } + finally { + if (AbnormalTermination()) { + if (*State == 28) { + *State += 7; + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 7) == 28) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest76(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 8) { + *State += 8; + *Fault += 1; + + } else { + *State += 10; + } + } + } + } + except(((*State += 8) == 8) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + } + finally { + if (AbnormalTermination()) { + if (*State == 32) { + *State += 8; + PgFilter(); + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 8) == 32) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest77(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 9) { + *State += 9; + *Fault += 1; + + } else { + *State += 10; + } + } + } + } + except(((*State += 9) == 9) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + } + finally { + if (AbnormalTermination()) { + if (*State == 36) { + *State += 9; + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 9) == 36) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +VOID PgTest78(IN PLONG State, IN PLONG Fault) + +{ + + try { + try { + try { + try { + *Fault += 1; + } + finally { + if (AbnormalTermination()) { + if (*State == 10) { + *State += 10; + PgFilter(); + *Fault += 1; + + } else { + *State += 10; + } + } + } + } + except(((*State += 10) == 10) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + } + finally { + if (AbnormalTermination()) { + if (*State == 40) { + *State += 10; + return; + + } else { + *Fault += 1; + } + } + } + } + except(((*State += 10) == 40) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + + return; +} + +#pragma warning(pop) + +VOID Test79(PLONG Counter, PLONG Fault) + +{ + + try { + try { + try { + *Fault += 1; + } + finally { + printf("finally 1..."); + *Fault += 1; + } + } + finally { printf("finally 2..."); } + } + except(*Counter += 1, printf("filter 1..."), EXCEPTION_CONTINUE_SEARCH) {} + + return; +} + +ULONG G; + +ULONG +Test80(VOID) + +{ + + G = 1; + try { + while (G) { + try { + if (G == 10) { + return 1; + } + + if (G == 1) { + continue; + } + } + finally { G = 0; } + } + } + finally { G = 10; } + + return 0; +} + +void Test81(int *pCounter) { + volatile char *AvPtr = NULL; + + __try { + __try { *AvPtr = '\0'; } + __except(EXCEPTION_EXECUTE_HANDLER) { __leave; } + } + __finally { + printf("in finally "); + *pCounter += 1; + } + return; +} + +DECLSPEC_NOINLINE +VOID Test82Foo(VOID) + +{ + *(volatile int *)0 = 0; +} + +VOID Test82(__inout PLONG Counter) + +{ + + int retval = 1; + + __try { + __try { Test82Foo(); } + __finally { + switch (*Counter) { + case 0: + printf("something failed!\n"); + retval = 6; + break; + + case 1: + retval = 0; + break; + + case 2: + printf("how did you get here?\n"); + retval = 2; + break; + + case 3: + printf("what?!?\n"); + retval = 3; + break; + + case 4: + printf("not correct\n"); + retval = 4; + break; + + case 5: + printf("error!\n"); + retval = 5; + break; + } + } + } + __except(1){} + + *Counter = retval; + return; +} + +LONG Test83(VOID) + +{ + + G = 1; + try { + try { + while (G) { + try { + if (G == 10) { + return 1; + } + + if (G == 1) { + continue; + } + } + finally { G = 0; } + } + } + except(EXCEPTION_EXECUTE_HANDLER) { leave; } + } + finally { G = 10; } + + return 0; +} + +DECLSPEC_NOINLINE +VOID Test84(_Inout_ PLONG Counter) + +{ + volatile int *Fault = 0; + + try { + try { + *Fault += 1; + } + except(EXCEPTION_EXECUTE_HANDLER) { + try { + return; + } + finally { *Counter += 1; } + } + } + finally { + + if (AbnormalTermination()) { + *Counter += 1; + } + } + + return; +} + +DECLSPEC_NOINLINE +LONG Test85(_Inout_ PLONG Counter) + +{ + volatile int *Fault = 0; + + G = 1; + try { + try { + try { + while (G) { + try { + try { + if (G == 10) { + return 1; + } + try { + *Counter += 1; + } + except(EXCEPTION_EXECUTE_HANDLER) {} + + if (G == 1) { + continue; + } + } + finally { + G = 0; + *Counter += 1; + *Fault += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { + *Counter += 1; + leave; + } + } + } + finally { + G = 10; + *Counter += 1; + *Fault += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { *Counter += 1; } + *Counter += 1; + } + finally { *Counter += 1; } + return 1; +} + +DECLSPEC_NOINLINE +VOID Test86(_Inout_ PLONG Counter) + +{ + volatile int *Fault = 0; + + try { + try { + try { + try { + try { + try { + *Fault += 1; + } + except(printf("Filter1 %d..", *Counter), + EXCEPTION_EXECUTE_HANDLER) { + try { + printf("Handler1 %d..", *Counter); + return; + } + finally { + printf("Finally1 %d..", *Counter); + *Counter += 1; + } + } + } + finally { + printf("Finally2 %d..", *Counter); + *Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { leave; } + } + finally { *Counter += 1; } + } + except(EXCEPTION_EXECUTE_HANDLER) { leave; } + } + finally { *Counter += 1; } + + return; +} + +VOID Test87(_Inout_ PLONG Counter) + +/*++ + +Routine Description: + + This function verifies the behavior of nested exception dispatching. + +Arguments: + + Counter - Supplies a pointer to the state counter. + +Return Value: + None. + +--*/ + +{ + volatile int *Fault = 0; + +// +// N.B. Disabled on x86 due to failing test case with handling of returns +// in nested termination handlers on x86. +// +// Disabled on ARM due to failing test case with handling of abutting +// termination handlers within an except handler. +// +// Disabled on AMD64 due to failing test case with handling of +// abutting termination handlers within an except handler when a +// non-local goto is involved. +// + +#if !defined(_X86_) + try { + try { + try { + try { + try { + *Fault += 1; + + try { + } + finally { + if (AbnormalTermination()) { + *Fault += 1; + } + } + } + finally { + + if (AbnormalTermination()) { + if ((*Counter += 13) == 26) { + return; + + } else { + *Fault += 1; + } + } + } + } + finally { + if (AbnormalTermination()) { + *Counter += 13; + *Fault += 1; + } + } + } + except(((*Counter += 13) == 13) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Fault += 1; + } + } + except(((*Counter += 13) == 65) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + try { + *Counter += 13; + return; + } + finally { + if (AbnormalTermination()) { + *Counter += 13; + goto Finish; + } + } + } + } + finally { + + if (AbnormalTermination()) { + if ((*Counter += 13) == 104) { + goto Finish; + } + } + } + +Finish: +#else + *Counter = 104; +#endif + + return; +} + +VOID Test88(_Inout_ PLONG Counter) + +{ + volatile int *Fault = 0; + + try { + try { + try { + try { + try { + try { + try { + try { + *Fault += 1; + } + except(((*Counter += 1) == 1) ? *Fault + : EXCEPTION_CONTINUE_SEARCH) {} + } + except(*Counter += 1, EXCEPTION_EXECUTE_HANDLER) { *Fault += 2; } + } + except(*Counter += 1, EXCEPTION_CONTINUE_SEARCH) { leave; } + } + except(*Counter += 1, EXCEPTION_CONTINUE_SEARCH) { leave; } + } + except(EXCEPTION_EXECUTE_HANDLER) {} + } + except(EXCEPTION_EXECUTE_HANDLER) {} + } + except(EXCEPTION_EXECUTE_HANDLER) { leave; } + } + finally { *Counter += 1; } +} + +int main(int argc, char *argv[]) + +{ + + PLONG BadAddress; + PCHAR BadByte; + PLONG BlackHole; + ULONG Index1; + ULONG Index2 = RED; + jmp_buf JumpBuffer; + LONG Counter; + EXCEPTION_RECORD ExceptionRecord; + double doubleresult; + + // + // Announce start of exception test. + // + + printf("Start of exception test\n"); + + // + // Initialize exception record. + // + + ExceptionRecord.ExceptionCode = STATUS_INTEGER_OVERFLOW; + ExceptionRecord.ExceptionFlags = 0; + ExceptionRecord.ExceptionRecord = NULL; + ExceptionRecord.NumberParameters = 0; + + // + // Initialize pointers. + // + + BadAddress = (PLONG)NULL; + BadByte = (PCHAR)NULL; + BadByte += 1; + BlackHole = &Counter; + + // + // Simply try statement with a finally clause that is entered sequentially. + // + + printf(" test1..."); + Counter = 0; + try { + Counter += 1; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 1; + } + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try statement with an exception clause that is never executed + // because there is no exception raised in the try clause. + // + + printf(" test2..."); + Counter = 0; + try { + Counter += 1; + } + except(Counter) { Counter += 1; } + + if (Counter != 1) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try statement with an exception handler that is never executed + // because the exception expression continues execution. + // + + printf(" test3..."); + Counter = 0; + try { + Counter -= 1; + RtlRaiseException(&ExceptionRecord); + } + except(Counter) { Counter -= 1; } + + if (Counter != -1) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try statement with an exception clause that is always executed. + // + + printf(" test4..."); + Counter = 0; + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(Counter) { Counter += 1; } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try statement with an exception clause that is always executed. + // + + printf(" test5..."); + Counter = 0; + try { + Counter += 1; + *BlackHole += *BadAddress; + } + except(Counter) { Counter += 1; } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simply try statement with a finally clause that is entered as the + // result of an exception. + // + + printf(" test6..."); + Counter = 0; + try { + try { + Counter += 1; + RtlRaiseException(&ExceptionRecord); + } + finally { + if (abnormal_termination() != FALSE) { + Counter += 1; + } + } + } + except(Counter) { + if (Counter == 2) { + Counter += 1; + } + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simply try statement with a finally clause that is entered as the + // result of an exception. + // + + printf(" test7..."); + Counter = 0; + try { + try { + Counter += 1; + *BlackHole += *BadAddress; + } + finally { + if (abnormal_termination() != FALSE) { + Counter += 1; + } + } + } + except(Counter) { + if (Counter == 2) { + Counter += 1; + } + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try that calls a function which raises an exception. + // + + printf(" test8..."); + Counter = 0; + try { + Counter += 1; + foo1(STATUS_ACCESS_VIOLATION); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try that calls a function which raises an exception. + // + + printf(" test9..."); + Counter = 0; + try { + Counter += 1; + foo2(BlackHole, BadAddress); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try that calls a function which calls a function that + // raises an exception. The first function has a finally clause + // that must be executed for this test to work. + // + + printf(" test10..."); + Counter = 0; + try { + bar1(STATUS_ACCESS_VIOLATION, &Counter); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter -= 1; + } + + if (Counter != 98) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try that calls a function which calls a function that + // raises an exception. The first function has a finally clause + // that must be executed for this test to work. + // + + printf(" test11..."); + Counter = 0; + try { + bar2(BlackHole, BadAddress, &Counter); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter -= 1; + } + + if (Counter != 98) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try within an except + // + + printf(" test12..."); + Counter = 0; + try { + foo1(STATUS_ACCESS_VIOLATION); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + try { + foo1(STATUS_SUCCESS); + } + except((GetExceptionCode() == STATUS_SUCCESS) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + if (Counter != 1) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded..."); + } + + Counter += 1; + } + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try within an except + // + + printf(" test13..."); + Counter = 0; + try { + foo2(BlackHole, BadAddress); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + try { + foo1(STATUS_SUCCESS); + } + except((GetExceptionCode() == STATUS_SUCCESS) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + if (Counter != 1) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded..."); + } + + Counter += 1; + } + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from except/finally not allowed on WinCE + // + // A goto from an exception clause that needs to pass + // through a finally + // + + printf(" test14..."); + Counter = 0; + try { + try { + foo1(STATUS_ACCESS_VIOLATION); + } + except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + goto t9; + } + } + finally { Counter += 1; } + +t9: + ; + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A goto from an finally clause that needs to pass + // through a finally + // + + printf(" test15..."); + Counter = 0; + try { + try { + Counter += 1; + } + finally { + Counter += 1; + goto t10; + } + } + finally { Counter += 1; } + +t10: + ; + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A goto from an exception clause that needs to pass + // through a finally into the outer finally clause. + // + + printf(" test16..."); + Counter = 0; + try { + try { + try { + Counter += 1; + foo1(STATUS_INTEGER_OVERFLOW); + } + except(EXCEPTION_EXECUTE_HANDLER) { + Counter += 1; + goto t11; + } + } + finally { Counter += 1; } + t11: + ; + } + finally { Counter += 1; } + + if (Counter != 4) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A goto from an finally clause that needs to pass + // through a finally into the outer finally clause. + // + + printf(" test17..."); + Counter = 0; + try { + try { + Counter += 1; + } + finally { + Counter += 1; + goto t12; + } + t12: + ; + } + finally { Counter += 1; } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A return from an except clause + // + + printf(" test18..."); + Counter = 0; + try { + Counter += 1; + eret(STATUS_ACCESS_VIOLATION, &Counter); + } + finally { Counter += 1; } + + if (Counter != 4) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A return from a finally clause + // + + printf(" test19..."); + Counter = 0; + try { + Counter += 1; + fret(&Counter); + } + finally { Counter += 1; } + + if (Counter != 5) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // A simple set jump followed by a long jump. + // + + printf(" test20..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + Counter += 1; + longjmp(JumpBuffer, 1); + + } else { + Counter += 1; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump followed by a long jump out of a finally clause that is + // sequentially executed. + // + + printf(" test21..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + try { + Counter += 1; + } + finally { + Counter += 1; + longjmp(JumpBuffer, 1); + } + + } else { + Counter += 1; + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump within a try clause followed by a long jump out of a + // finally clause that is sequentially executed. + // + + printf(" test22..."); + Counter = 0; + try { + if (setjmp(JumpBuffer) == 0) { + Counter += 1; + + } else { + Counter += 1; + } + } + finally { + Counter += 1; + if (Counter == 2) { + Counter += 1; + longjmp(JumpBuffer, 1); + } + } + + if (Counter != 5) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump followed by a try/except, followed by a try/finally where + // the try body of the try/finally raises an exception that is handled + // by the try/excecpt which causes the try/finally to do a long jump out + // of a finally clause. This will create a collided unwind. + // + + printf(" test23..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + try { + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { + Counter += 1; + longjmp(JumpBuffer, 1); + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; } + + } else { + Counter += 1; + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump followed by a try/except, followed by a several nested + // try/finally's where the inner try body of the try/finally raises an + // exception that is handled by the try/except which causes the + // try/finally to do a long jump out of a finally clause. This will + // create a collided unwind. + // + + printf(" test24..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + try { + try { + try { + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { Counter += 1; } + } + finally { + Counter += 1; + longjmp(JumpBuffer, 1); + } + } + finally { Counter += 1; } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; } + + } else { + Counter += 1; + } + + if (Counter != 5) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump followed by a try/except, followed by a try/finally which + // calls a subroutine which contains a try finally that raises an + // exception that is handled to the try/except. + // + + printf(" test25..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + try { + try { + try { + Counter += 1; + dojump(JumpBuffer, &Counter); + } + finally { Counter += 1; } + } + finally { Counter += 1; } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; } + + } else { + Counter += 1; + } + + if (Counter != 7) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A set jump followed by a try/except, followed by a try/finally which + // calls a subroutine which contains a try finally that raises an + // exception that is handled to the try/except. + // + + printf(" test26..."); + Counter = 0; + if (setjmp(JumpBuffer) == 0) { + try { + try { + try { + try { + Counter += 1; + dojump(JumpBuffer, &Counter); + } + finally { Counter += 1; } + } + finally { + Counter += 1; + longjmp(JumpBuffer, 1); + } + } + finally { Counter += 1; } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 1; } + + } else { + Counter += 1; + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Test nested exceptions. + // + + printf(" test27..."); + Counter = 0; + try { + try { + Counter += 1; + except1(&Counter); + } + except(except2(GetExceptionInformation(), &Counter)) { Counter += 2; } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 3; } + + if (Counter != 55) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Simple try that causes an integer overflow exception. + // + + printf(" test28..."); + Counter = 0; + try { + Counter += 1; + addtwo(0x7fff0000, 0x10000, &Counter); + } + except((GetExceptionCode() == STATUS_INTEGER_OVERFLOW) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +// +// Simple try that raises an misaligned data exception. +// +#if !defined(i386) && !defined(_M_IA64) && !defined(_M_AMD64) && \ + !defined(_M_ARM) && !defined(_M_ARM64) + printf(" test29..."); + Counter = 0; + try { + Counter += 1; + foo2(BlackHole, (PLONG)BadByte); + } + except((GetExceptionCode() == STATUS_DATATYPE_MISALIGNMENT) + ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + Counter += 1; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#endif + // + // Continue from a try body with an exception clause in a loop. + // + + printf(" test30..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 0) { + continue; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; } + + Counter += 2; + } + + if (Counter != 15) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Continue from a try body with an finally clause in a loop. + // + + printf(" test31..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 0) { + continue; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + + if (Counter != 40) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Continue from doubly nested try body with an exception clause in a + // loop. + // + + printf(" test32..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 0) { + continue; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; } + + Counter += 2; + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; } + + Counter += 3; + } + + if (Counter != 30) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Continue from doubly nested try body with an finally clause in a loop. + // + + printf(" test33..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 0) { + continue; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + finally { Counter += 4; } + + Counter += 5; + } + + if (Counter != 105) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Continue from a finally clause in a loop. + // + + printf(" test34..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 0) { + Counter += 1; + } + } + finally { + Counter += 2; + continue; + } + + Counter += 4; + } + + if (Counter != 25) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Continue from a doubly nested finally clause in a loop. + // + + printf(" test35..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 0) { + Counter += 1; + } + } + finally { + Counter += 2; + continue; + } + + Counter += 4; + } + finally { Counter += 5; } + + Counter += 6; + } + + if (Counter != 75) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Continue from a doubly nested finally clause in a loop. + // + + printf(" test36..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 0) { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 4; + } + finally { + Counter += 5; + continue; + } + + Counter += 6; + } + + if (Counter != 115) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Break from a try body with an exception clause in a loop. + // + + printf(" test37..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; } + + Counter += 2; + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Break from a try body with an finally clause in a loop. + // + + printf(" test38..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Break from doubly nested try body with an exception clause in a + // loop. + // + + printf(" test39..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; } + + Counter += 2; + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; } + + Counter += 3; + } + + if (Counter != 6) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Break from doubly nested try body with an finally clause in a loop. + // + + printf(" test40..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + finally { Counter += 4; } + + Counter += 5; + } + + if (Counter != 21) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a finally clause in a loop. + // + + printf(" test41..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { + Counter += 2; + break; + } + + Counter += 4; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a doubly nested finally clause in a loop. + // + + printf(" test42..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { + Counter += 2; + break; + } + + Counter += 4; + } + finally { Counter += 5; } + + Counter += 6; + } + + if (Counter != 7) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a doubly nested finally clause in a loop. + // + + printf(" test43..."); + Counter = 0; + for (Index1 = 0; Index1 < 10; Index1 += 1) { + try { + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 4; + } + finally { + Counter += 5; + break; + } + + Counter += 6; + } + + if (Counter != 11) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Break from a try body with an exception clause in a switch. + // + + printf(" test44..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 40; } + + Counter += 2; + break; + } + + if (Counter != 0) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Break from a try body with an finally clause in a switch. + // + + printf(" test45..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Break from doubly nested try body with an exception clause in a + // switch. + // + + printf(" test46..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 10; } + + Counter += 2; + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 20; } + + Counter += 3; + } + + if (Counter != 0) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE + // + // Break from doubly nested try body with an finally clause in a switch. + // + + printf(" test47..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + try { + if ((Index1 & 0x1) == 1) { + break; + + } else { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 3; + } + finally { Counter += 4; } + + Counter += 5; + } + + if (Counter != 6) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a finally clause in a switch. + // + + printf(" test48..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { + Counter += 2; + break; + } + + Counter += 4; + } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a doubly nested finally clause in a switch. + // + + printf(" test49..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { + Counter += 2; + break; + } + + Counter += 4; + } + finally { Counter += 5; } + + Counter += 6; + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Break from a doubly nested finally clause in a switch. + // + + printf(" test50..."); + Counter = 0; + Index1 = 1; + switch (Index2) { + case BLUE: + Counter += 100; + break; + + case RED: + try { + try { + if ((Index1 & 0x1) == 1) { + Counter += 1; + } + } + finally { Counter += 2; } + + Counter += 4; + } + finally { + Counter += 5; + break; + } + + Counter += 6; + } + + if (Counter != 12) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Leave from an if in a simple try/finally. + // + + printf(" test51..."); + Counter = 0; + try { + if (Echo(Counter) == Counter) { + Counter += 3; + leave; + + } else { + Counter += 100; + } + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Leave from a loop in a simple try/finally. + // + + printf(" test52..."); + Counter = 0; + try { + for (Index1 = 0; Index1 < 10; Index1 += 1) { + if (Echo(Index1) == Index1) { + Counter += 3; + leave; + } + + Counter += 100; + } + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Leave from a switch in a simple try/finally. + // + + printf(" test53..."); + Counter = 0; + try { + switch (Index2) { + case BLUE: + break; + + case RED: + Counter += 3; + leave; + } + + Counter += 100; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Counter != 8) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Leave from an if in doubly nested try/finally followed by a leave + // from an if in the outer try/finally. + // + + printf(" test54..."); + Counter = 0; + try { + try { + if (Echo(Counter) == Counter) { + Counter += 3; + leave; + + } else { + Counter += 100; + } + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Echo(Counter) == Counter) { + Counter += 3; + leave; + + } else { + Counter += 100; + } + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Counter != 16) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#if !defined(WIN_CE) // leave from finally not allowed on WinCE + // + // Leave from an if in doubly nested try/finally followed by a leave + // from the finally of the outer try/finally. + // + + printf(" test55..."); + Counter = 0; + try { + try { + if (Echo(Counter) == Counter) { + Counter += 3; + leave; + + } else { + Counter += 100; + } + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + leave; + } + } + + Counter += 100; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + + if (Counter != 13) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif + + // + // Try/finally within the except clause of a try/except that is always + // executed. + // + + printf(" test56..."); + Counter = 0; + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(Counter) { + try { + Counter += 3; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + } + + if (Counter != 9) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Try/finally within the finally clause of a try/finally. + // + + printf(" test57..."); + Counter = 0; + try { + Counter += 1; + } + finally { + if (abnormal_termination() == FALSE) { + try { + Counter += 3; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + } + } + + if (Counter != 9) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Try/except within the finally clause of a try/finally. + // + + printf(" test58..."); +#if !defined(NEST_IN_FINALLY) + printf("skipped\n"); +#else + Counter = 0; + try { + Counter -= 1; + } + finally { + try { + Counter += 2; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(Counter) { + try { + Counter += 3; + } + finally { + if (abnormal_termination() == FALSE) { + Counter += 5; + } + } + } + } + + if (Counter != 9) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif /* def(NEST_IN_FINALLY) */ + + // + // Try/except within the except clause of a try/except that is always + // executed. + // + + printf(" test59..."); + Counter = 0; + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(Counter) { + try { + Counter += 3; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(Counter - 3) { Counter += 5; } + } + + if (Counter != 9) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Try with a Try which exits the scope with a goto + // + + printf(" test60..."); + Counter = 0; + try { + try { + goto outside; + } + except(1) { Counter += 1; } + + outside: + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(1) { Counter += 3; } + + if (Counter != 3) { + printf("failed, count = %d\n", Counter); + } else { + printf("succeeded\n"); + } + + // + // Try/except which gets an exception from a subfunction within + // a try/finally which has a try/except in the finally clause + // + + printf(" test61..."); +#if !defined(NEST_IN_FINALLY) + printf("skipped\n"); +#else + Counter = 0; + try { + Test61Part2(&Counter); + } + except(EXCEPTION_EXECUTE_HANDLER) { Counter += 11; } + + if (Counter != 24) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } +#endif /* def(NEST_IN_FINALLY) */ + + // + // Check for precision of exception on floating point + // + + printf(" test62..."); + +#if defined(i386) || defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_AMD64) + +/* enable floating point overflow */ +#if defined(i386) + _control87(_control87(0, 0) & ~EM_OVERFLOW, _MCW_EM); +#else + // + // use portable version of _control87 + // + _controlfp(_controlfp(0, 0) & ~EM_OVERFLOW, _MCW_EM); +#endif + + Counter = 0; + try { + doubleresult = SquareDouble(1.7e300); + + try { + doubleresult = SquareDouble(1.0); + } + except(1) { Counter += 3; } + } + except(1) { Counter += 1; } + + if (Counter != 1) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +/* clear up pending unmasked exceptions and restore FP control registers */ +#if defined(i386) + _clear87(); + _control87(_control87(0, 0) | EM_OVERFLOW, 0xfffff); +#else + _clearfp(); + _controlfp(_controlfp(0, 0) | EM_OVERFLOW, 0xfffff); +#endif + +#else + printf("skipped\n"); +#endif + + // + // A try/finally inside a try/except where an exception is raised in the + // try/finally. + // + + printf(" test63..."); + Counter = 0; + try { + try { + Counter += 1; + } + finally { + Counter += 3; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + } + except(1) { Counter += 6; } + + if (Counter != 10) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try/finally inside a try/except where an exception is raised in the + // in the try/except and the try/finally. + // + + printf(" test64..."); + Counter = 0; + try { + try { + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { + Counter += 3; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + } + except(1) { Counter += 6; } + + if (Counter != 10) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try/finally inside a try/except where an exception is raised in the + // try/finally. + // + + printf(" test65..."); + Counter = 0; + try { + try { + Counter += 1; + } + finally { + Counter += 3; + *BlackHole += *BadAddress; + Counter += 13; + } + } + except(1) { Counter += 6; } + + if (Counter != 10) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try/finally inside a try/except where an exception is raised in the + // in the try/except and the try/finally. + // + + printf(" test66..."); + Counter = 0; + try { + try { + Counter += 1; + *BlackHole += *BadAddress; + Counter += 13; + } + finally { + Counter += 3; + *BlackHole += *BadAddress; + Counter += 13; + } + } + except(1) { Counter += 6; } + + if (Counter != 10) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try/finally inside a try/finally inside a try/except where an + // exception is raised in the in the try/except and in try/finally. + // + + printf(" test67..."); + try { + try { + *BlackHole += *BadAddress; + } + finally { + try { + Counter = 0; + } + finally { + if (Counter != 0) { + Counter += 1; + } + } + + Counter += 1; + *BlackHole += *BadAddress; + } + } + except(1) { Counter += 1; } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // A try/finally inside a try/finally inside a try/except where an + // exception is raised in the in the try/except and in try/finally. + // + + printf(" test68..."); + try { + try { + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { + try { + Counter = 0; + } + finally { + if (Counter != 0) { + Counter += 1; + } + } + + Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + } + except(1) { Counter += 1; } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +// +// Patch guard test 69. +// + +#if defined(_AMD64_) || defined(_X86_) + + printf(" test69..."); + Counter = 0; + try { + PgTest69(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test70..."); + Counter = 0; + try { + PgTest70(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 2) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test71..."); + Counter = 0; + try { + PgTest71(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 9) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test72..."); + Counter = 0; + try { + PgTest72(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 12) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test73..."); + Counter = 0; + try { + PgTest73(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 15) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test74..."); + Counter = 0; + try { + PgTest74(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 18) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test75..."); + Counter = 0; + try { + PgTest75(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 35) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test76..."); + Counter = 0; + try { + PgTest76(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 40) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test77..."); + Counter = 0; + try { + PgTest77(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 45) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test78..."); + Counter = 0; + try { + PgTest78(&Counter, BadAddress); + } + except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); } + + if (Counter != 50) { + printf("failed, count = %d\n", Counter); + + } else { + printf("succeeded\n"); + } + +#else + printf(" test69...filter entered...succeeded\n"); + printf(" test70...filter entered...succeeded\n"); + printf(" test71...filter entered...succeeded\n"); + printf(" test72...filter entered...succeeded\n"); + printf(" test73...filter entered...succeeded\n"); + printf(" test74...filter entered...succeeded\n"); + printf(" test75...filter entered...succeeded\n"); + printf(" test76...filter entered...succeeded\n"); + printf(" test77...filter entered...succeeded\n"); + printf(" test78...filter entered...succeeded\n"); +#endif + + if (LOBYTE(LOWORD(GetVersion())) < 6) { + printf(" test79..."); + printf("filter 1...filter 2...finally 1...filter 1...filter 2...finally " + "2...passed\n"); + } else { + + printf(" test79..."); + Counter = 0; + try { + Test79(&Counter, BadAddress); + } + except(printf("filter 2..."), EXCEPTION_EXECUTE_HANDLER) { Counter += 1; } + + if (Counter == 3) { + printf("passed\n"); + + } else { + printf("failed %d \n", Counter); + } + } + + printf(" test80..."); + if (Test80() != 0) { + printf("failed\n"); + + } else { + printf("passed\n"); + } + + printf(" test81..."); + Counter = 0; + Test81(&Counter); + if (Counter != 1) { + printf("failed %d \n", Counter); + + } else { + printf("passed\n"); + } + + printf(" test82..."); + Counter = 1; + Test82(&Counter); + if (Counter != 0) { + printf("failed\n"); + + } else { + printf("succeeded\n"); + } + + printf(" test83..."); + if (Test83() != 0) { + printf("failed\n"); + + } else { + printf("succeeded\n"); + } + + printf(" test84..."); + Counter = 0; + Test84(&Counter); + if (Counter != 2) { + printf("failed\n"); + + } else { + printf("succeeded\n"); + } + + printf(" test85..."); + Counter = 0; + Test85(&Counter); + if (Counter != 7) { + printf("failed\n"); + + } else { + printf("succeeded\n"); + } + + printf(" test86..."); + Counter = 0; + Test86(&Counter); + if (Counter != 4) { + printf("failed %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test87..."); + Counter = 0; + Test87(&Counter); + if (Counter != 104) { + printf("failed %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + printf(" test88..."); + Counter = 0; + Test88(&Counter); + if (Counter != 6) { + printf("failed %d\n", Counter); + + } else { + printf("succeeded\n"); + } + + // + // Announce end of exception test. + // + + printf("End of exception test\n"); + return; +} + +#pragma optimize("a", off) +VOID addtwo(long First, long Second, long *Place) + +{ + + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + *Place = First + Second; + return; +} +#pragma optimize("", on) + +VOID bar1(IN NTSTATUS Status, IN PLONG Counter) { + + try { + foo1(Status); + } + finally { + if (abnormal_termination() != FALSE) { + *Counter = 99; + + } else { + *Counter = 100; + } + } + + return; +} + +VOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter) { + + try { + foo2(BlackHole, BadAddress); + } + finally { + if (abnormal_termination() != FALSE) { + *Counter = 99; + + } else { + *Counter = 100; + } + } + + return; +} + +VOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter) + +{ + + try { + try { + *Counter += 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { *Counter += 1; } + } + finally { + *Counter += 1; + longjmp(JumpBuffer, 1); + } +} + +#if !defined(WIN_CE) // return through finally not allowed on WinCE +VOID eret(IN NTSTATUS Status, IN PLONG Counter) + +{ + + try { + try { + foo1(Status); + } + except((GetExceptionCode() == Status) ? EXCEPTION_EXECUTE_HANDLER + : EXCEPTION_CONTINUE_SEARCH) { + *Counter += 1; + return; + } + } + finally { *Counter += 1; } + + return; +} +#endif + +VOID except1(IN PLONG Counter) + +{ + + try { + *Counter += 5; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(except3(GetExceptionInformation(), Counter)) { *Counter += 7; } + + *Counter += 9; + return; +} + +ULONG +except2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter) + +{ + + PEXCEPTION_RECORD ExceptionRecord; + + ExceptionRecord = ExceptionPointers->ExceptionRecord; + if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) && + ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) { + *Counter += 11; + return EXCEPTION_EXECUTE_HANDLER; + + } else { + *Counter += 13; + return EXCEPTION_CONTINUE_SEARCH; + } +} + +ULONG +except3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter) + +{ + + PEXCEPTION_RECORD ExceptionRecord; + + ExceptionRecord = ExceptionPointers->ExceptionRecord; + if ((ExceptionRecord->ExceptionCode == STATUS_INTEGER_OVERFLOW) && + ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) { + *Counter += 17; + RtlRaiseStatus(STATUS_UNSUCCESSFUL); + + } else if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) && + ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) != 0)) { + *Counter += 19; + return EXCEPTION_CONTINUE_SEARCH; + } + + *Counter += 23; + return EXCEPTION_EXECUTE_HANDLER; +} + +VOID foo1(IN NTSTATUS Status) + +{ + + // + // Raise exception. + // + + RtlRaiseStatus(Status); + return; +} + +VOID foo2(IN PLONG BlackHole, IN PLONG BadAddress) + +{ + + // + // Raise exception. + // + + *BlackHole += *BadAddress; + return; +} + +#if !defined(WIN_CE) // return from finally not allowed on WinCE +VOID fret(IN PLONG Counter) + +{ + + try { + try { + *Counter += 1; + } + finally { + *Counter += 1; + return; + } + } + finally { *Counter += 1; } + + return; +} +#endif + +LONG Echo(IN LONG Value) + +{ + return Value; +} + +#if defined(NEST_IN_FINALLY) +VOID Test61Part2(IN OUT PULONG Counter) { + try { + *Counter -= 1; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + finally { + try { + *Counter += 2; + RtlRaiseStatus(STATUS_INTEGER_OVERFLOW); + } + except(EXCEPTION_EXECUTE_HANDLER) { *Counter += 5; } + *Counter += 7; + } +} +#endif /* def(NEST_IN_FINALLY) */ + +double SquareDouble(IN double op) { + return exp(2.0 * log(op)); } diff --git a/test/samples/sample.cameligo.txt b/test/samples/sample.cameligo.txt new file mode 100644 index 00000000..55573f26 --- /dev/null +++ b/test/samples/sample.cameligo.txt @@ -0,0 +1,17 @@ +type storage = int +type parameter = + Increment of int +| Decrement of int +| Reset +type return = operation list * storage +// Two entrypoints +let add (store, delta : storage * int) : storage = store + delta +let sub (store, delta : storage * int) : storage = store - delta +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) +let main (action, store : parameter * storage) : return = + ([] : operation list), // No operations + (match action with + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0) diff --git a/test/samples/sample.clojure.txt b/test/samples/sample.clojure.txt new file mode 100644 index 00000000..d9de4831 --- /dev/null +++ b/test/samples/sample.clojure.txt @@ -0,0 +1,54 @@ +(ns game-of-life + "Conway's Game of Life, based on the work of + Christophe Grand (http://clj-me.cgrand.net/2011/08/19/conways-game-of-life) + and Laurent Petit (https://gist.github.com/1200343).") + +;;; Core game of life's algorithm functions + +(defn neighbors + "Given a cell's coordinates `[x y]`, returns the coordinates of its + neighbors." + [[x y]] + (for [dx [-1 0 1] + dy (if (zero? dx) + [-1 1] + [-1 0 1])] + [(+ dx x) (+ dy y)])) + +(defn step + "Given a set of living `cells`, computes the new set of living cells." + [cells] + (set (for [[cell n] (frequencies (mapcat neighbors cells)) + :when (or (= n 3) + (and (= n 2) + (cells cell)))] + cell))) + +;;; Utility methods for displaying game on a text terminal + +(defn print-grid + "Prints a `grid` of `w` columns and `h` rows, on *out*, representing a + step in the game." + [grid w h] + (doseq [x (range (inc w)) + y (range (inc h))] + (when (= y 0) (println)) + (print (if (grid [x y]) + "[X]" + " . ")))) + +(defn print-grids + "Prints a sequence of `grids` of `w` columns and `h` rows on *out*, + representing several steps." + [grids w h] + (doseq [grid grids] + (print-grid grid w h) + (println))) + +;;; Launches an example grid + +(def grid + "`grid` represents the initial set of living cells" + #{[2 1] [2 2] [2 3]}) + +(print-grids (take 3 (iterate step grid)) 5 5) \ No newline at end of file diff --git a/test/samples/sample.csp.txt b/test/samples/sample.csp.txt new file mode 100644 index 00000000..c59176d9 --- /dev/null +++ b/test/samples/sample.csp.txt @@ -0,0 +1 @@ +Content-Security-Policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com \ No newline at end of file diff --git a/test/samples/sample.dart.txt b/test/samples/sample.dart.txt new file mode 100644 index 00000000..3a16aa6d --- /dev/null +++ b/test/samples/sample.dart.txt @@ -0,0 +1,37 @@ +import 'dart:async'; +import 'dart:math' show Random; +main() async { + print('Compute π using the Monte Carlo method.'); + await for (var estimate in computePi().take(100)) { + print('π ≅ $estimate'); + } +} +/// Generates a stream of increasingly accurate estimates of π. +Stream computePi({int batch: 100000}) async* { + var total = 0; + var count = 0; + while (true) { + var points = generateRandom().take(batch); + var inside = points.where((p) => p.isInsideUnitCircle); + total += batch; + count += inside.length; + var ratio = count / total; + // Area of a circle is A = π⋅r², therefore π = A/r². + // So, when given random points with x ∈ <0,1>, + // y ∈ <0,1>, the ratio of those inside a unit circle + // should approach π / 4. Therefore, the value of π + // should be: + yield ratio * 4; + } +} +Iterable generateRandom([int seed]) sync* { + final random = Random(seed); + while (true) { + yield Point(random.nextDouble(), random.nextDouble()); + } +} +class Point { + final double x, y; + const Point(this.x, this.y); + bool get isInsideUnitCircle => x * x + y * y <= 1; +} diff --git a/test/samples/sample.julia.txt b/test/samples/sample.julia.txt new file mode 100644 index 00000000..2535072d --- /dev/null +++ b/test/samples/sample.julia.txt @@ -0,0 +1,23 @@ +# good style +function fixedpointmap(f; iv, tolerance=1E-7, maxiter=1000) + # setup the algorithm + x_old = iv + normdiff = Inf + iter = 1 + while normdiff > tolerance && iter <= maxiter + x_new = f(x_old) # use the passed in map + normdiff = norm(x_new - x_old) + x_old = x_new + iter = iter + 1 + end + return (value = x_old, normdiff=normdiff, iter=iter) # A named tuple +end + +# define a map and parameters +p = 1.0 +β = 0.9 +f(v) = p + β * v # note that p and β are used in the function! + +sol = fixedpointmap(f, iv=0.8, tolerance=1.0E-8) # don't need to pass +println("Fixed point = $(sol.value), and |f(x) - x| = $(sol.normdiff) in $(sol.iter)"* + " iterations") diff --git a/test/samples/sample.kotlin.txt b/test/samples/sample.kotlin.txt new file mode 100644 index 00000000..ce0b94e4 --- /dev/null +++ b/test/samples/sample.kotlin.txt @@ -0,0 +1,28 @@ +const val POINTS_X_PASS: Int = 15 +val EZPassAccounts: MutableMap = mutableMapOf(1 to 100, 2 to 100, 3 to 100) +val EZPassReport: Map = EZPassAccounts + +// update points credit +fun updatePointsCredit(accountId: Int) { + if (EZPassAccounts.containsKey(accountId)) { + println("Updating $accountId...") + EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS + } else { + println("Error: Trying to update a non-existing account (id: $accountId)") + } +} + +fun accountsReport() { + println("EZ-Pass report:") + EZPassReport.forEach{ + k, v -> println("ID $k: credit $v") + } +} + +fun main() { + accountsReport() + updatePointsCredit(1) + updatePointsCredit(1) + updatePointsCredit(5) + accountsReport() +} \ No newline at end of file diff --git a/test/samples/sample.lex.txt b/test/samples/sample.lex.txt new file mode 100644 index 00000000..2f32ba96 --- /dev/null +++ b/test/samples/sample.lex.txt @@ -0,0 +1,21 @@ +LEX Paid Escrow. +LEXON: 0.2.20 +COMMENT: 3.f - an escrow that is controlled by a third party for a fee. + +“Payer” is a person. +“Payee” is a person. +“Arbiter” is a person. +“Fee” is an amount. + +The Payer pays an Amount into escrow, +appoints the Payee, +appoints the Arbiter, +and also fixes the Fee. + +CLAUSE: Pay Out. +The Arbiter may pay from escrow the Fee to themselves, +and afterwards pay the remainder of the escrow to the Payee. + +CLAUSE: Pay Back. +The Arbiter may pay from escrow the Fee to themselves, +and afterwards return the remainder of the escrow to the Payer. diff --git a/test/samples/sample.mips.txt b/test/samples/sample.mips.txt new file mode 100644 index 00000000..0ce051f1 --- /dev/null +++ b/test/samples/sample.mips.txt @@ -0,0 +1,13 @@ +# A[i] = A[i/2] + 1; + lw $t0, 0($gp) # fetch i + srl $t1, $t0, 1 # i/2 + sll $t1, $t1, 2 # turn i/2 into a byte offset (*4) + add $t1, $gp, $t1 # &A[i/2] - 28 + lw $t1, 28($t1) # fetch A[i/2] + addi $t1, $t1, 1 # A[i/2] + 1 + sll $t2, $t0, 2 # turn i into a byte offset + add $t2, $t2, $gp # &A[i] - 28 + sw $t1, 28($t2) # A[i] = ... +# A[i+1] = -1; + addi $t1, $zero, -1 # -1 + sw $t1, 32($t2) # A[i+1] = -1 diff --git a/test/samples/sample.mysql.txt b/test/samples/sample.mysql.txt new file mode 100644 index 00000000..0a25e9d3 --- /dev/null +++ b/test/samples/sample.mysql.txt @@ -0,0 +1,8 @@ +CREATE TABLE shop ( + article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL, + dealer CHAR(20) DEFAULT '' NOT NULL, + price DOUBLE(16,2) DEFAULT '0.00' NOT NULL, + PRIMARY KEY(article, dealer)); +INSERT INTO shop VALUES + (1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45), + (3,'C',1.69),(3,'D',1.25),(4,'D',19.95); \ No newline at end of file diff --git a/test/samples/sample.pascal.txt b/test/samples/sample.pascal.txt index dbdeabbe..c935c5d1 100644 --- a/test/samples/sample.pascal.txt +++ b/test/samples/sample.pascal.txt @@ -26,4 +26,3 @@ begin Writeln(E.ClassName, ': ', E.Message); end; end. - diff --git a/test/samples/sample.pascaligo.txt b/test/samples/sample.pascaligo.txt new file mode 100644 index 00000000..da128671 --- /dev/null +++ b/test/samples/sample.pascaligo.txt @@ -0,0 +1,20 @@ +type storage is int +type parameter is + Increment of int +| Decrement of int +| Reset +type return is list (operation) * storage +// Two entrypoints +function add (const store : storage; const delta : int) : storage is + store + delta +function sub (const store : storage; const delta : int) : storage is + store - delta +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) +function main (const action : parameter; const store : storage) : return is + ((nil : list (operation)), // No operations + case action of + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0 + end) diff --git a/test/samples/sample.perl.txt b/test/samples/sample.perl.txt new file mode 100644 index 00000000..28ec777e --- /dev/null +++ b/test/samples/sample.perl.txt @@ -0,0 +1,18 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Path::Tiny; + +my $dir = path('foo','bar'); # foo/bar + +# Iterate over the content of foo/bar +my $iter = $dir->iterator; +while (my $file = $iter->()) { + + # See if it is a directory and skip + next if $file->is_dir(); + + # Print out the file name and path + print "$file\n"; +} \ No newline at end of file diff --git a/test/samples/sample.pgsql.txt b/test/samples/sample.pgsql.txt new file mode 100644 index 00000000..5b8b10bc --- /dev/null +++ b/test/samples/sample.pgsql.txt @@ -0,0 +1,8 @@ +BEGIN + SELECT * INTO STRICT myrec FROM emp WHERE empname = myname; + EXCEPTION + WHEN NO_DATA_FOUND THEN + RAISE EXCEPTION 'employee % not found', myname; + WHEN TOO_MANY_ROWS THEN + RAISE EXCEPTION 'employee % not unique', myname; +END; \ No newline at end of file diff --git a/test/samples/sample.powerquery.txt b/test/samples/sample.powerquery.txt new file mode 100644 index 00000000..dd7e3b86 --- /dev/null +++ b/test/samples/sample.powerquery.txt @@ -0,0 +1,12 @@ +let + Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], + SplitColumnDelimiter = Table.SplitColumn(Source,"Input",Splitter.SplitTextByDelimiter(","),13), + Unpivot = Table.Unpivot(SplitColumnDelimiter,{"Input.1", "Input.2", "Input.3", "Input.4", + "Input.5", "Input.6", "Input.7", "Input.8", "Input.9", "Input.10", "Input.11", "Input.12" + , "Input.13"},"Attribute","Value"), + RemovedColumns = Table.RemoveColumns(Unpivot,{"Attribute"}), + DuplicatesRemoved = Table.Distinct(RemovedColumns), + GroupedRows = Table.Group(DuplicatesRemoved, {"RowID"}, {{"Count of Distinct Values" + , each Table.RowCount(_), type number}}) +in + GroupedRows \ No newline at end of file diff --git a/test/samples/sample.redis.txt b/test/samples/sample.redis.txt new file mode 100644 index 00000000..f22ca57f --- /dev/null +++ b/test/samples/sample.redis.txt @@ -0,0 +1,4 @@ +EXISTS mykey +APPEND mykey "Hello" +APPEND mykey " World" +GET mykey \ No newline at end of file diff --git a/test/samples/sample.redshift.txt b/test/samples/sample.redshift.txt new file mode 100644 index 00000000..54270d88 --- /dev/null +++ b/test/samples/sample.redshift.txt @@ -0,0 +1,9 @@ +create view tables_vw as +select distinct(id) table_id +,trim(datname) db_name +,trim(nspname) schema_name +,trim(relname) table_name +from stv_tbl_perm +join pg_class on pg_class.oid = stv_tbl_perm.id +join pg_namespace on pg_namespace.oid = relnamespace +join pg_database on pg_database.oid = stv_tbl_perm.db_id; diff --git a/test/samples/sample.restructuredtext.txt b/test/samples/sample.restructuredtext.txt new file mode 100644 index 00000000..37c139e3 --- /dev/null +++ b/test/samples/sample.restructuredtext.txt @@ -0,0 +1,26 @@ +================= +My Project Readme +================= +------------------------- +Clever subtitle goes here +------------------------- + +Introduction +============ + +This is an example reStructuredText document that starts at the very top +with a title and a sub-title. There is one primary header, Introduction. +There is one example subheading below. +The document is just plain text so it is easily readable even before +being converted to HTML, man page, PDF or other formats. + +Subheading +---------- + +The basic syntax is not that different from Markdown, but it also +has many more powerful features that Markdown doesn't have. We aren't +taking advantage of those yet though. + +- Bullet points +- Are intuitive +- And simple too diff --git a/test/samples/sample.rust.txt b/test/samples/sample.rust.txt new file mode 100644 index 00000000..aca64b4f --- /dev/null +++ b/test/samples/sample.rust.txt @@ -0,0 +1,29 @@ +fn main() { + let greetings = ["Hello", "Hola", "Bonjour", + "Ciao", "こんにちは", "안녕하세요", + "Cześć", "Olá", "Здравствуйте", + "Chào bạn", "您好", "Hallo", + "Hej", "Ahoj", "سلام"]; + + for (num, greeting) in greetings.iter().enumerate() { + print!("{} : ", greeting); + match num { + 0 => println!("This code is editable and runnable!"), + 1 => println!("¡Este código es editable y ejecutable!"), + 2 => println!("Ce code est modifiable et exécutable !"), + 3 => println!("Questo codice è modificabile ed eseguibile!"), + 4 => println!("このコードは編集して実行出来ます!"), + 5 => println!("여기에서 코드를 수정하고 실행할 수 있습니다!"), + 6 => println!("Ten kod można edytować oraz uruchomić!"), + 7 => println!("Este código é editável e executável!"), + 8 => println!("Этот код можно отредактировать и запустить!"), + 9 => println!("Bạn có thể edit và run code trực tiếp!"), + 10 => println!("这段代码是可以编辑并且能够运行的!"), + 11 => println!("Dieser Code kann bearbeitet und ausgeführt werden!"), + 12 => println!("Den här koden kan redigeras och köras!"), + 13 => println!("Tento kód můžete upravit a spustit"), + 14 => println!("این کد قابلیت ویرایش و اجرا دارد!"), + _ => {}, + } + } +} diff --git a/test/samples/sample.sb.txt b/test/samples/sample.sb.txt new file mode 100644 index 00000000..23cb9280 --- /dev/null +++ b/test/samples/sample.sb.txt @@ -0,0 +1,10 @@ +begin: +TextWindow.Write("Enter a number: ") +num = TextWindow.ReadNumber() +remainder = Math.Remainder(num, 2) +If (remainder = 0) Then + TextWindow.WriteLine("The number is Even") +Else + TextWindow.WriteLine("The number is Odd") +EndIf +Goto begin \ No newline at end of file diff --git a/test/samples/sample.scala.txt b/test/samples/sample.scala.txt new file mode 100644 index 00000000..6da4bf61 --- /dev/null +++ b/test/samples/sample.scala.txt @@ -0,0 +1,53 @@ +package examples + +/** Quick sort, imperative style */ +object sort { + + /** Nested methods can use and even update everything + * visible in their scope (including local variables or + * arguments of enclosing methods). + */ + def sort(a: Array[Int]) { + + def swap(i: Int, j: Int) { + val t = a(i); a(i) = a(j); a(j) = t + } + + def sort1(l: Int, r: Int) { + val pivot = a((l + r) / 2) + var i = l + var j = r + while (i <= j) { + while (a(i) < pivot) i += 1 + while (a(j) > pivot) j -= 1 + if (i <= j) { + swap(i, j) + i += 1 + j -= 1 + } + } + if (l < j) sort1(l, j) + if (j < r) sort1(i, r) + } + + if (a.length > 0) + sort1(0, a.length - 1) + } + + def println(ar: Array[Int]) { + def print1 = { + def iter(i: Int): String = + ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "") + if (ar.length == 0) "" else iter(0) + } + Console.println("[" + print1 + "]") + } + + def main(args: Array[String]) { + val ar = Array(6, 2, 8, 5, 1) + println(ar) + sort(ar) + println(ar) + } + +} diff --git a/test/samples/sample.scheme.txt b/test/samples/sample.scheme.txt new file mode 100644 index 00000000..ddc5fb69 --- /dev/null +++ b/test/samples/sample.scheme.txt @@ -0,0 +1,105 @@ +;;; make-matrix creates a matrix (a vector of vectors). +(define make-matrix + (lambda (rows columns) + (do ((m (make-vector rows)) + (i 0 (+ i 1))) + ((= i rows) m) + (vector-set! m i (make-vector columns))))) + +;;; matrix? checks to see if its argument is a matrix. +;;; It isn't foolproof, but it's generally good enough. +(define matrix? + (lambda (x) + (and (vector? x) + (> (vector-length x) 0) + (vector? (vector-ref x 0))))) + +;; matrix-rows returns the number of rows in a matrix. +(define matrix-rows + (lambda (x) + (vector-length x))) + +;; matrix-columns returns the number of columns in a matrix. +(define matrix-columns + (lambda (x) + (vector-length (vector-ref x 0)))) + +;;; matrix-ref returns the jth element of the ith row. +(define matrix-ref + (lambda (m i j) + (vector-ref (vector-ref m i) j))) + +;;; matrix-set! changes the jth element of the ith row. +(define matrix-set! + (lambda (m i j x) + (vector-set! (vector-ref m i) j x))) + +;;; mul is the generic matrix/scalar multiplication procedure +(define mul + (lambda (x y) + ;; mat-sca-mul multiplies a matrix by a scalar. + (define mat-sca-mul + (lambda (m x) + (let* ((nr (matrix-rows m)) + (nc (matrix-columns m)) + (r (make-matrix nr nc))) + (do ((i 0 (+ i 1))) + ((= i nr) r) + (do ((j 0 (+ j 1))) + ((= j nc)) + (matrix-set! r i j + (* x (matrix-ref m i j)))))))) + + ;; mat-mat-mul multiplies one matrix by another, after verifying + ;; that the first matrix has as many columns as the second + ;; matrix has rows. + (define mat-mat-mul + (lambda (m1 m2) + (let* ((nr1 (matrix-rows m1)) + (nr2 (matrix-rows m2)) + (nc2 (matrix-columns m2)) + (r (make-matrix nr1 nc2))) + (if (not (= (matrix-columns m1) nr2)) + (match-error m1 m2)) + (do ((i 0 (+ i 1))) + ((= i nr1) r) + (do ((j 0 (+ j 1))) + ((= j nc2)) + (do ((k 0 (+ k 1)) + (a 0 + (+ a + (* (matrix-ref m1 i k) + (matrix-ref m2 k j))))) + ((= k nr2) + (matrix-set! r i j a)))))))) + + ;; type-error is called to complain when mul receives an invalid + ;; type of argument. + (define type-error + (lambda (what) + (error 'mul + "~s is not a number or matrix" + what))) + + ;; match-error is called to complain when mul receives a pair of + ;; incompatible arguments. + (define match-error + (lambda (what1 what2) + (error 'mul + "~s and ~s are incompatible operands" + what1 + what2))) + + ;; body of mul; dispatch based on input types + (cond + ((number? x) + (cond + ((number? y) (* x y)) + ((matrix? y) (mat-sca-mul y x)) + (else (type-error y)))) + ((matrix? x) + (cond + ((number? y) (mat-sca-mul x y)) + ((matrix? y) (mat-mat-mul x y)) + (else (type-error y)))) + (else (type-error x))))) \ No newline at end of file diff --git a/test/samples/sample.shell.txt b/test/samples/sample.shell.txt new file mode 100644 index 00000000..4ee3d196 --- /dev/null +++ b/test/samples/sample.shell.txt @@ -0,0 +1,42 @@ +#!/bin/bash +# Simple line count example, using bash +# +# Bash tutorial: http://linuxconfig.org/Bash_scripting_Tutorial#8-2-read-file-into-bash-array +# My scripting link: http://www.macs.hw.ac.uk/~hwloidl/docs/index.html#scripting +# +# Usage: ./line_count.sh file +# ----------------------------------------------------------------------------- + +# Link filedescriptor 10 with stdin +exec 10<&0 +# stdin replaced with a file supplied as a first argument +exec < $1 +# remember the name of the input file +in=$1 + +# init +file="current_line.txt" +let count=0 + +# this while loop iterates over all lines of the file +while read LINE +do + # increase line counter + ((count++)) + # write current line to a tmp file with name $file (not needed for counting) + echo $LINE > $file + # this checks the return code of echo (not needed for writing; just for demo) + if [ $? -ne 0 ] + then echo "Error in writing to file ${file}; check its permissions!" + fi +done + +echo "Number of lines: $count" +echo "The last line of the file is: `cat ${file}`" + +# Note: You can achieve the same by just using the tool wc like this +echo "Expected number of lines: `wc -l $in`" + +# restore stdin from filedescriptor 10 +# and close filedescriptor 10 +exec 0<&10 10<&- \ No newline at end of file diff --git a/test/samples/sample.st.txt b/test/samples/sample.st.txt new file mode 100644 index 00000000..7fcfd8a3 --- /dev/null +++ b/test/samples/sample.st.txt @@ -0,0 +1,34 @@ +CONFIGURATION DefaultCfg + VAR_GLOBAL + Start_Stop AT %IX0.0: BOOL; (* This is a comment *) + END_VAR + TASK NewTask (INTERVAL := T#20ms); + PROGRAM Main WITH NewTask : PLC_PRG; +END_CONFIGURATION + +PROGRAM demo + VAR_EXTERNAL + Start_Stop: BOOL; + END_VAR + VAR + a : REAL; // Another comment + todTest: TIME_OF_DAY := TOD#12:55; + END_VAR + a := csq(12.5); + TON1(IN := TRUE, PT := T#2s); + 16#FAC0 2#1001_0110 + IF TON1.Q AND a > REAL#100 THEN + Start_Stop := TRUE; + END_IF +END_PROGRAM; + +/* Get a square of the circle */ +FUNCTION csq : REAL + VAR_INPUT + r: REAL; + END_VAR + VAR CONSTANT + c_pi: REAL := 3.14; + END_VAR + csq := ABS(c_pi * (r * 2)); +END_FUNCTION \ No newline at end of file diff --git a/test/samples/sample.systemverilog.txt b/test/samples/sample.systemverilog.txt new file mode 100644 index 00000000..198384fb --- /dev/null +++ b/test/samples/sample.systemverilog.txt @@ -0,0 +1,28 @@ +// File : tb_top.sv +module tb_top (); + + reg clk; + reg resetn; + reg d; + wire q; + + // Instantiate the design + d_ff d_ff0 ( .clk (clk), + .resetn (resetn), + .d (d), + .q (q)); + + // Create a clock + always #10 clk <= ~clk; + + initial begin + resetn <= 0; + d <= 0; + + #10 resetn <= 1; + #5 d <= 1; + #8 d <= 0; + #2 d <= 1; + #10 d <= 0; + end +endmodule diff --git a/test/samples/sample.tcl.txt b/test/samples/sample.tcl.txt new file mode 100644 index 00000000..6f87bebf --- /dev/null +++ b/test/samples/sample.tcl.txt @@ -0,0 +1,18 @@ +proc find {{basedir .} {filterScript {}}} { + set oldwd [pwd] + cd $basedir + set cwd [pwd] + set filenames [glob -nocomplain * .*] + set files {} + set filt [string length $filterScript] + foreach filename $filenames { + if {!$filt || [eval $filterScript [list $filename]]} { + lappend files [file join $cwd $filename] + } + if {[file isdirectory $filename]} { + set files [concat $files [find $filename $filterScript]] + } + } + cd $oldwd + return $files +} diff --git a/test/samples/sample.twig.txt b/test/samples/sample.twig.txt new file mode 100644 index 00000000..043f42d1 --- /dev/null +++ b/test/samples/sample.twig.txt @@ -0,0 +1,12 @@ + + + + + {% block title %}Welcome!{% endblock %} + {% block stylesheets %}{% endblock %} + + + {% block body %}{% endblock %} + {% block javascripts %}{% endblock %} + + diff --git a/test/samples/sample.verilog.txt b/test/samples/sample.verilog.txt new file mode 100644 index 00000000..9ddb8572 --- /dev/null +++ b/test/samples/sample.verilog.txt @@ -0,0 +1,35 @@ +`include "first_counter.v" +module first_counter_tb(); +// Declare inputs as regs and outputs as wires +reg clock, reset, enable; +wire [3:0] counter_out; + +// Initialize all variables +initial begin + $display ("time\t clk reset enable counter"); + $monitor ("%g\t %b %b %b %b", + $time, clock, reset, enable, counter_out); + clock = 1; // initial value of clock + reset = 0; // initial value of reset + enable = 0; // initial value of enable + #5 reset = 1; // Assert the reset + #10 reset = 0; // De-assert the reset + #10 enable = 1; // Assert enable + #100 enable = 0; // De-assert enable + #5 $finish; // Terminate simulation +end + +// Clock generator +always begin + #5 clock = ~clock; // Toggle clock every 5 ticks +end + +// Connect DUT to test bench +first_counter U_counter ( +clock, +reset, +enable, +counter_out +); + +endmodule diff --git a/website/index/samples/sample.aes.txt b/website/index/samples/sample.aes.txt new file mode 100644 index 00000000..b91d07e2 --- /dev/null +++ b/website/index/samples/sample.aes.txt @@ -0,0 +1,38 @@ +// Contract simulating developers organization +contract HackBG = + + record state = { developers: map(address, developer) } + + record developer = { name: string + , age: int + , skillset: map(skill, experience) } + + type skill = string + type experience = int + + datatype event = + LogDeveloperAdded(indexed address, indexed int, string) + + entrypoint init() : state = { developers = {} } + + stateful entrypoint dev_add(account: address, dev_name: string, dev_age: int) = + require(!is_member(account), "ERROR_DEVELOPER_ALREADY_EXISTS") + let dev : developer = { name = dev_name + , age = dev_age + , skillset = {} } + put(state{ developers[account] = dev }) + Chain.event(LogDeveloperAdded(account, Chain.timestamp, dev_name)) + + stateful entrypoint dev_update(account: address, dev_name: string, dev_age: int) = + require(is_member(account), "ERROR_DEVELOPER_DOES_NOT_EXIST") + put(state{ developers[account].name = dev_name }) + put(state{ developers[account].age = dev_age }) + + function is_member(account: address) : bool = + Map.member(account, state.developers) + + stateful entrypoint dev_skill_modify(account: address, skill: string, experience: int) = + put(state{ developers[account].skillset[skill] = experience }) + + entrypoint dev_get(account: address) : developer = + state.developers[account] \ No newline at end of file diff --git a/website/index/samples/sample.cameligo.txt b/website/index/samples/sample.cameligo.txt new file mode 100644 index 00000000..55573f26 --- /dev/null +++ b/website/index/samples/sample.cameligo.txt @@ -0,0 +1,17 @@ +type storage = int +type parameter = + Increment of int +| Decrement of int +| Reset +type return = operation list * storage +// Two entrypoints +let add (store, delta : storage * int) : storage = store + delta +let sub (store, delta : storage * int) : storage = store - delta +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) +let main (action, store : parameter * storage) : return = + ([] : operation list), // No operations + (match action with + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0) diff --git a/website/index/samples/sample.csharp.txt b/website/index/samples/sample.csharp.txt index 979eb7f0..ed2c0af3 100644 --- a/website/index/samples/sample.csharp.txt +++ b/website/index/samples/sample.csharp.txt @@ -1,23 +1,38 @@ +/* +* C# Program to Display All the Prime Numbers Between 1 to 100 +*/ + using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace VS { class Program { static void Main(string[] args) - { - ProcessStartInfo si = new ProcessStartInfo(); - float load= 3.2e02f; - - si.FileName = @"tools\\node.exe"; - si.Arguments = "tools\\simpleserver.js"; - - Process.Start(si); + { + bool isPrime = true; + Console.WriteLine("Prime Numbers : "); + for (int i = 2; i <= 100; i++) + { + for (int j = 2; j <= 100; j++) + { + if (i != j && i % j == 0) + { + isPrime = false; + break; + } + } + + if (isPrime) + { + Console.Write("\t" +i); + } + isPrime = true; + } + Console.ReadKey(); } } } diff --git a/website/index/samples/sample.dart.txt b/website/index/samples/sample.dart.txt new file mode 100644 index 00000000..3a16aa6d --- /dev/null +++ b/website/index/samples/sample.dart.txt @@ -0,0 +1,37 @@ +import 'dart:async'; +import 'dart:math' show Random; +main() async { + print('Compute π using the Monte Carlo method.'); + await for (var estimate in computePi().take(100)) { + print('π ≅ $estimate'); + } +} +/// Generates a stream of increasingly accurate estimates of π. +Stream computePi({int batch: 100000}) async* { + var total = 0; + var count = 0; + while (true) { + var points = generateRandom().take(batch); + var inside = points.where((p) => p.isInsideUnitCircle); + total += batch; + count += inside.length; + var ratio = count / total; + // Area of a circle is A = π⋅r², therefore π = A/r². + // So, when given random points with x ∈ <0,1>, + // y ∈ <0,1>, the ratio of those inside a unit circle + // should approach π / 4. Therefore, the value of π + // should be: + yield ratio * 4; + } +} +Iterable generateRandom([int seed]) sync* { + final random = Random(seed); + while (true) { + yield Point(random.nextDouble(), random.nextDouble()); + } +} +class Point { + final double x, y; + const Point(this.x, this.y); + bool get isInsideUnitCircle => x * x + y * y <= 1; +} diff --git a/website/index/samples/sample.graphql.txt b/website/index/samples/sample.graphql.txt index 9e3769bf..2f783785 100644 --- a/website/index/samples/sample.graphql.txt +++ b/website/index/samples/sample.graphql.txt @@ -1,263 +1,263 @@ -# GraphQL Schema Definition Language - -""" -Color value -""" -scalar Color - -""" -Node interface - -- allows (re)fetch arbitrary entity only by ID -- allows client side cache normalization - -See [Relay Global Object Identification Specification](https://facebook.github.io/relay/graphql/objectidentification.htm) -""" -interface Node { - """ - Globally unique identifier, - typically `${__typename}:${dbId}` - may be encoded in *base64* - """ - id: ID! -} - -""" -A character in the Star Wars Trilogy -""" -interface Character { - """ - The id of the character. - """ - id: ID! - - """ - The name of the character. - """ - name: String - - """ - The friends of the character, or an empty list if they have none. - """ - friends: [Character] - - """ - Which movies they appear in - """ - appearsIn: [Episode] - - """ - All secrets about their past - """ - secretBackstory: String -} - -""" -A mechanical creature in the Star Wars universe. -""" -type Droid implements Character { - """ - The id of the droid. - """ - id: ID! - - """ - The name of the droid. - """ - name: String - - """ - The friends of the droid, or an empty list if they have none. - """ - friends: [Character] - - """ - Which movies they appear in. - """ - appearsIn: [Episode] - - """ - Construction date and the name of the designer. - """ - secretBackstory: String - - """ - The primary function of the droid. - """ - primaryFunction: String - - """ - Chase color of the droid. - """ - color: Color -} - -# One of the films in the Star Wars Trilogy -enum Episode { - """ - Released in 1977. - """ - NEWHOPE - - """ - Released in 1980. - """ - EMPIRE - - """ - Released in 1983. - """ - JEDI -} - -""" -A humanoid creature in the Star Wars universe. -""" -type Human implements Character { - """ - The id of the human. - """ - id: ID! - - """ - The name of the human. - """ - name: String - - """ - The friends of the human, or an empty list if they have none. - """ - friends: [Character] - - """ - Which movies they appear in. - """ - appearsIn: [Episode] - - """ - The home planet of the human, or null if unknown. - """ - homePlanet: String - - """ - Where are they from and how they came to be who they are. - """ - secretBackstory: String -} - -enum LengthUnit { - METER - FEET -} - -type Starship { - id: ID! - name: String! - length(unit: LengthUnit = METER): Float -} - -union SearchResult = Human | Droid | Starship - -input SearchInput { - name: String - episode: Episode -} - -""" -Root Query -""" -type Query { - """ - Return the hero by episode. - """ - hero( - """ - If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode. - """ - episode: Episode - ): Character - - """ - Return the Human by ID. - """ - human( - """ - id of the human - """ - id: ID! - ): Human - - """ - Return the Droid by ID. - """ - droid( - """ - id of the droid - """ - id: ID! - ): Droid - - """ - Search everything by name - - __NOTE__: You should use Relay pagination - """ - search(search: SearchInput!): [SearchResult] - @deprecated(reason: "`search` will be replaced.") -} - -""" -Root Mutation -""" -type Mutation { - """ - Save the favorite episode. - """ - favorite( - """ - Favorite episode. - """ - episode: Episode! - ): Episode -} - -""" -Subscriptions — live events -""" -type Subscription { - """ - Message - """ - message: String -} - -extend type Query { - """ - Dummy query for highlighting test - """ - dummy( - int: Int = 123 - float: Float = 123.456 - str: String = "Hello World!" - boolDefaultTrue: Boolean = true - boolDefaultFalse: Boolean = false - id: ID - search: SearchInput = null - ): Boolean -} - -schema { - query: Query - mutation: Mutation - subscription: Subscription -} - -# GraphQL Query Language - -query dummyQuery($int: Int) { - dummy(int: $int) -} - -mutation favoriteEpisode($episode: Episode) { - favorite(episode: $episode) -} +# GraphQL Schema Definition Language + +""" +Color value +""" +scalar Color + +""" +Node interface + +- allows (re)fetch arbitrary entity only by ID +- allows client side cache normalization + +See [Relay Global Object Identification Specification](https://facebook.github.io/relay/graphql/objectidentification.htm) +""" +interface Node { + """ + Globally unique identifier, + typically `${__typename}:${dbId}` + may be encoded in *base64* + """ + id: ID! +} + +""" +A character in the Star Wars Trilogy +""" +interface Character { + """ + The id of the character. + """ + id: ID! + + """ + The name of the character. + """ + name: String + + """ + The friends of the character, or an empty list if they have none. + """ + friends: [Character] + + """ + Which movies they appear in + """ + appearsIn: [Episode] + + """ + All secrets about their past + """ + secretBackstory: String +} + +""" +A mechanical creature in the Star Wars universe. +""" +type Droid implements Character { + """ + The id of the droid. + """ + id: ID! + + """ + The name of the droid. + """ + name: String + + """ + The friends of the droid, or an empty list if they have none. + """ + friends: [Character] + + """ + Which movies they appear in. + """ + appearsIn: [Episode] + + """ + Construction date and the name of the designer. + """ + secretBackstory: String + + """ + The primary function of the droid. + """ + primaryFunction: String + + """ + Chase color of the droid. + """ + color: Color +} + +# One of the films in the Star Wars Trilogy +enum Episode { + """ + Released in 1977. + """ + NEWHOPE + + """ + Released in 1980. + """ + EMPIRE + + """ + Released in 1983. + """ + JEDI +} + +""" +A humanoid creature in the Star Wars universe. +""" +type Human implements Character { + """ + The id of the human. + """ + id: ID! + + """ + The name of the human. + """ + name: String + + """ + The friends of the human, or an empty list if they have none. + """ + friends: [Character] + + """ + Which movies they appear in. + """ + appearsIn: [Episode] + + """ + The home planet of the human, or null if unknown. + """ + homePlanet: String + + """ + Where are they from and how they came to be who they are. + """ + secretBackstory: String +} + +enum LengthUnit { + METER + FEET +} + +type Starship { + id: ID! + name: String! + length(unit: LengthUnit = METER): Float +} + +union SearchResult = Human | Droid | Starship + +input SearchInput { + name: String + episode: Episode +} + +""" +Root Query +""" +type Query { + """ + Return the hero by episode. + """ + hero( + """ + If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode. + """ + episode: Episode + ): Character + + """ + Return the Human by ID. + """ + human( + """ + id of the human + """ + id: ID! + ): Human + + """ + Return the Droid by ID. + """ + droid( + """ + id of the droid + """ + id: ID! + ): Droid + + """ + Search everything by name + + __NOTE__: You should use Relay pagination + """ + search(search: SearchInput!): [SearchResult] + @deprecated(reason: "`search` will be replaced.") +} + +""" +Root Mutation +""" +type Mutation { + """ + Save the favorite episode. + """ + favorite( + """ + Favorite episode. + """ + episode: Episode! + ): Episode +} + +""" +Subscriptions — live events +""" +type Subscription { + """ + Message + """ + message: String +} + +extend type Query { + """ + Dummy query for highlighting test + """ + dummy( + int: Int = 123 + float: Float = 123.456 + str: String = "Hello World!" + boolDefaultTrue: Boolean = true + boolDefaultFalse: Boolean = false + id: ID + search: SearchInput = null + ): Boolean +} + +schema { + query: Query + mutation: Mutation + subscription: Subscription +} + +# GraphQL Query Language + +query dummyQuery($int: Int) { + dummy(int: $int) +} + +mutation favoriteEpisode($episode: Episode) { + favorite(episode: $episode) +} diff --git a/website/index/samples/sample.html.txt b/website/index/samples/sample.html.txt index fd53da8a..838f5a2d 100644 --- a/website/index/samples/sample.html.txt +++ b/website/index/samples/sample.html.txt @@ -1,21 +1,100 @@ - + + HTML Sample + + + + + -

    Heading No.1

    - + +
    +

    NAME OF SITE

    +
    +
    +

    I'm h2 Header! Edit me in <h2>

    +

    + I'm a paragraph! Edit me in <p> + to add your own content and make changes to the style and font. + It's easy! Just change the text between <p> ... </p> and change the style in <style>. + You can make it as long as you wish. The browser will automatically wrap the lines to accommodate the + size of the browser window. +

    + +
    diff --git a/website/index/samples/sample.java.txt b/website/index/samples/sample.java.txt index e5347aa4..d9932046 100644 --- a/website/index/samples/sample.java.txt +++ b/website/index/samples/sample.java.txt @@ -1,14 +1,54 @@ -import java.util.ArrayList; -import org.junit.Test; +/* + Basic Java example using FizzBuzz +*/ + +import java.util.Random; public class Example { - @Test - public void method() { - org.junit.Assert.assertTrue( "isEmpty", new ArrayList().isEmpty()); - } - - @Test(timeout=100) public void infinity() { - while(true); - } - } + public static void main (String[] args){ + // Generate a random number between 1-100. (See generateRandomNumber method.) + int random = generateRandomNumber(100); + + // Output generated number. + System.out.println("Generated number: " + random + "\n"); + + // Loop between 1 and the number we just generated. + for (int i=1; i<=random; i++){ + // If i is divisible by both 3 and 5, output "FizzBuzz". + if (i % 3 == 0 && i % 5 == 0){ + System.out.println("FizzBuzz"); + } + // If i is divisible by 3, output "Fizz" + else if (i % 3 == 0){ + System.out.println("Fizz"); + } + // If i is divisible by 5, output "Buzz". + else if (i % 5 == 0){ + System.out.println("Buzz"); + } + // If i is not divisible by either 3 or 5, output the number. + else { + System.out.println(i); + } + } + } + + /** + Generates a new random number between 0 and 100. + @param bound The highest number that should be generated. + @return An integer representing a randomly generated number between 0 and 100. + */ + private static int generateRandomNumber(int bound){ + // Create new Random generator object and generate the random number. + Random randGen = new Random(); + int randomNum = randGen.nextInt(bound); + + // If the random number generated is zero, use recursion to regenerate the number until it is not zero. + if (randomNum < 1){ + randomNum = generateRandomNumber(bound); + } + + return randomNum; + } +} \ No newline at end of file diff --git a/website/index/samples/sample.julia.txt b/website/index/samples/sample.julia.txt new file mode 100644 index 00000000..2535072d --- /dev/null +++ b/website/index/samples/sample.julia.txt @@ -0,0 +1,23 @@ +# good style +function fixedpointmap(f; iv, tolerance=1E-7, maxiter=1000) + # setup the algorithm + x_old = iv + normdiff = Inf + iter = 1 + while normdiff > tolerance && iter <= maxiter + x_new = f(x_old) # use the passed in map + normdiff = norm(x_new - x_old) + x_old = x_new + iter = iter + 1 + end + return (value = x_old, normdiff=normdiff, iter=iter) # A named tuple +end + +# define a map and parameters +p = 1.0 +β = 0.9 +f(v) = p + β * v # note that p and β are used in the function! + +sol = fixedpointmap(f, iv=0.8, tolerance=1.0E-8) # don't need to pass +println("Fixed point = $(sol.value), and |f(x) - x| = $(sol.normdiff) in $(sol.iter)"* + " iterations") diff --git a/website/index/samples/sample.lex.txt b/website/index/samples/sample.lex.txt new file mode 100644 index 00000000..2f32ba96 --- /dev/null +++ b/website/index/samples/sample.lex.txt @@ -0,0 +1,21 @@ +LEX Paid Escrow. +LEXON: 0.2.20 +COMMENT: 3.f - an escrow that is controlled by a third party for a fee. + +“Payer” is a person. +“Payee” is a person. +“Arbiter” is a person. +“Fee” is an amount. + +The Payer pays an Amount into escrow, +appoints the Payee, +appoints the Arbiter, +and also fixes the Fee. + +CLAUSE: Pay Out. +The Arbiter may pay from escrow the Fee to themselves, +and afterwards pay the remainder of the escrow to the Payee. + +CLAUSE: Pay Back. +The Arbiter may pay from escrow the Fee to themselves, +and afterwards return the remainder of the escrow to the Payer. diff --git a/website/index/samples/sample.markdown.txt b/website/index/samples/sample.markdown.txt index 998c99ef..ea6f2bb1 100644 --- a/website/index/samples/sample.markdown.txt +++ b/website/index/samples/sample.markdown.txt @@ -4,6 +4,13 @@ ## Markdown plus h2 with a custom ID ## {#id-goes-here} [Link back to H2](#id-goes-here) +```js +var x = "string"; +function f() { + return x; +} +``` +
    @@ -23,12 +30,12 @@ - Another one + Another one -This is a paragraph, which is text surrounded by -whitespace. Paragraphs can be on one -line (or many), and can drone on for hours. +This is a paragraph, which is text surrounded by +whitespace. Paragraphs can be on one +line (or many), and can drone on for hours. -Now some inline markup like _italics_, **bold**, -and `code()`. Note that underscores +Now some inline markup like _italics_, **bold**, +and `code()`. Note that underscores in_words_are ignored. ````application/json @@ -57,11 +64,11 @@ if (this_is_more_code == true && !indented) { } ~~~ -Text with -two trailing spaces -(on the right) -can be used -for things like poems +Text with +two trailing spaces +(on the right) +can be used +for things like poems ### Horizontal rules @@ -69,7 +76,7 @@ for things like poems **** -------------------------- -![picture alt](/images/photo.jpeg "Title is optional") +![picture alt](/images/photo.jpeg "Title is optional") ## Markdown plus tables ## diff --git a/website/index/samples/sample.mips.txt b/website/index/samples/sample.mips.txt new file mode 100644 index 00000000..0ce051f1 --- /dev/null +++ b/website/index/samples/sample.mips.txt @@ -0,0 +1,13 @@ +# A[i] = A[i/2] + 1; + lw $t0, 0($gp) # fetch i + srl $t1, $t0, 1 # i/2 + sll $t1, $t1, 2 # turn i/2 into a byte offset (*4) + add $t1, $gp, $t1 # &A[i/2] - 28 + lw $t1, 28($t1) # fetch A[i/2] + addi $t1, $t1, 1 # A[i/2] + 1 + sll $t2, $t0, 2 # turn i into a byte offset + add $t2, $t2, $gp # &A[i] - 28 + sw $t1, 28($t2) # A[i] = ... +# A[i+1] = -1; + addi $t1, $zero, -1 # -1 + sw $t1, 32($t2) # A[i+1] = -1 diff --git a/website/index/samples/sample.pascal.txt b/website/index/samples/sample.pascal.txt index 477a1c62..c935c5d1 100644 --- a/website/index/samples/sample.pascal.txt +++ b/website/index/samples/sample.pascal.txt @@ -25,4 +25,4 @@ begin on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; -end. \ No newline at end of file +end. diff --git a/website/index/samples/sample.pascaligo.txt b/website/index/samples/sample.pascaligo.txt new file mode 100644 index 00000000..da128671 --- /dev/null +++ b/website/index/samples/sample.pascaligo.txt @@ -0,0 +1,20 @@ +type storage is int +type parameter is + Increment of int +| Decrement of int +| Reset +type return is list (operation) * storage +// Two entrypoints +function add (const store : storage; const delta : int) : storage is + store + delta +function sub (const store : storage; const delta : int) : storage is + store - delta +(* Main access point that dispatches to the entrypoints according to + the smart contract parameter. *) +function main (const action : parameter; const store : storage) : return is + ((nil : list (operation)), // No operations + case action of + Increment (n) -> add (store, n) + | Decrement (n) -> sub (store, n) + | Reset -> 0 + end) diff --git a/website/index/samples/sample.restructuredtext.txt b/website/index/samples/sample.restructuredtext.txt new file mode 100644 index 00000000..37c139e3 --- /dev/null +++ b/website/index/samples/sample.restructuredtext.txt @@ -0,0 +1,26 @@ +================= +My Project Readme +================= +------------------------- +Clever subtitle goes here +------------------------- + +Introduction +============ + +This is an example reStructuredText document that starts at the very top +with a title and a sub-title. There is one primary header, Introduction. +There is one example subheading below. +The document is just plain text so it is easily readable even before +being converted to HTML, man page, PDF or other formats. + +Subheading +---------- + +The basic syntax is not that different from Markdown, but it also +has many more powerful features that Markdown doesn't have. We aren't +taking advantage of those yet though. + +- Bullet points +- Are intuitive +- And simple too diff --git a/website/index/samples/sample.scala.txt b/website/index/samples/sample.scala.txt new file mode 100644 index 00000000..6da4bf61 --- /dev/null +++ b/website/index/samples/sample.scala.txt @@ -0,0 +1,53 @@ +package examples + +/** Quick sort, imperative style */ +object sort { + + /** Nested methods can use and even update everything + * visible in their scope (including local variables or + * arguments of enclosing methods). + */ + def sort(a: Array[Int]) { + + def swap(i: Int, j: Int) { + val t = a(i); a(i) = a(j); a(j) = t + } + + def sort1(l: Int, r: Int) { + val pivot = a((l + r) / 2) + var i = l + var j = r + while (i <= j) { + while (a(i) < pivot) i += 1 + while (a(j) > pivot) j -= 1 + if (i <= j) { + swap(i, j) + i += 1 + j -= 1 + } + } + if (l < j) sort1(l, j) + if (j < r) sort1(i, r) + } + + if (a.length > 0) + sort1(0, a.length - 1) + } + + def println(ar: Array[Int]) { + def print1 = { + def iter(i: Int): String = + ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "") + if (ar.length == 0) "" else iter(0) + } + Console.println("[" + print1 + "]") + } + + def main(args: Array[String]) { + val ar = Array(6, 2, 8, 5, 1) + println(ar) + sort(ar) + println(ar) + } + +} diff --git a/website/index/samples/sample.systemverilog.txt b/website/index/samples/sample.systemverilog.txt new file mode 100644 index 00000000..198384fb --- /dev/null +++ b/website/index/samples/sample.systemverilog.txt @@ -0,0 +1,28 @@ +// File : tb_top.sv +module tb_top (); + + reg clk; + reg resetn; + reg d; + wire q; + + // Instantiate the design + d_ff d_ff0 ( .clk (clk), + .resetn (resetn), + .d (d), + .q (q)); + + // Create a clock + always #10 clk <= ~clk; + + initial begin + resetn <= 0; + d <= 0; + + #10 resetn <= 1; + #5 d <= 1; + #8 d <= 0; + #2 d <= 1; + #10 d <= 0; + end +endmodule diff --git a/website/index/samples/sample.tcl.txt b/website/index/samples/sample.tcl.txt new file mode 100644 index 00000000..6f87bebf --- /dev/null +++ b/website/index/samples/sample.tcl.txt @@ -0,0 +1,18 @@ +proc find {{basedir .} {filterScript {}}} { + set oldwd [pwd] + cd $basedir + set cwd [pwd] + set filenames [glob -nocomplain * .*] + set files {} + set filt [string length $filterScript] + foreach filename $filenames { + if {!$filt || [eval $filterScript [list $filename]]} { + lappend files [file join $cwd $filename] + } + if {[file isdirectory $filename]} { + set files [concat $files [find $filename $filterScript]] + } + } + cd $oldwd + return $files +} diff --git a/website/index/samples/sample.twig.txt b/website/index/samples/sample.twig.txt new file mode 100644 index 00000000..043f42d1 --- /dev/null +++ b/website/index/samples/sample.twig.txt @@ -0,0 +1,12 @@ + + + + + {% block title %}Welcome!{% endblock %} + {% block stylesheets %}{% endblock %} + + + {% block body %}{% endblock %} + {% block javascripts %}{% endblock %} + + diff --git a/website/index/samples/sample.typescript.txt b/website/index/samples/sample.typescript.txt index 0bc28fad..0cc1f35e 100644 --- a/website/index/samples/sample.typescript.txt +++ b/website/index/samples/sample.typescript.txt @@ -2,21 +2,21 @@ * Implemented in TypeScript * To learn more about TypeScript, please visit http://www.typescriptlang.org/ */ - -module Conway { + +namespace Conway { export class Cell { public row: number; public col: number; public live: boolean; - + constructor(row: number, col: number, live: boolean) { this.row = row; this.col = col; - this.live = live + this.live = live; } } - + export class GameOfLife { private gridSize: number; private canvasSize: number; @@ -28,8 +28,8 @@ module Conway { private cellSize: number; private context: CanvasRenderingContext2D; private world; - - + + constructor() { this.gridSize = 50; this.canvasSize = 600; @@ -42,14 +42,14 @@ module Conway { this.world = this.createWorld(); this.circleOfLife(); } - + public createWorld() { return this.travelWorld( (cell : Cell) => { cell.live = Math.random() < this.initialLifeProbability; return cell; }); } - + public circleOfLife() : void { this.world = this.travelWorld( (cell: Cell) => { cell = this.world[cell.row][cell.col]; @@ -57,8 +57,8 @@ module Conway { return this.resolveNextGeneration(cell); }); setTimeout( () => {this.circleOfLife()}, this.animationRate); - } - + } + public resolveNextGeneration(cell : Cell) { var count = this.countNeighbors(cell); var newCell = new Cell(cell.row, cell.col, cell.live); @@ -66,7 +66,7 @@ module Conway { else if(count == 3) newCell.live = true; return newCell; } - + public countNeighbors(cell : Cell) { var neighbors = 0; for(var row = -1; row <=1; row++) { @@ -79,12 +79,12 @@ module Conway { } return neighbors; } - + public isAlive(row : number, col : number) { if(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false; return this.world[row][col].live; } - + public travelWorld(callback) { var result = []; for(var row = 0; row < this.gridSize; row++) { @@ -93,20 +93,20 @@ module Conway { rowData.push(callback(new Cell(row, col, false))); } result.push(rowData); - } + } return result; } - + public draw(cell : Cell) { if(this.context == null) this.context = this.createDrawingContext(); if(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize; - + this.context.strokeStyle = this.lineColor; this.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize); this.context.fillStyle = cell.live ? this.liveColor : this.deadColor; this.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize); - } - + } + public createDrawingContext() { var canvas = document.getElementById('conway-canvas'); if(canvas == null) { diff --git a/website/index/samples/sample.verilog.txt b/website/index/samples/sample.verilog.txt new file mode 100644 index 00000000..9ddb8572 --- /dev/null +++ b/website/index/samples/sample.verilog.txt @@ -0,0 +1,35 @@ +`include "first_counter.v" +module first_counter_tb(); +// Declare inputs as regs and outputs as wires +reg clock, reset, enable; +wire [3:0] counter_out; + +// Initialize all variables +initial begin + $display ("time\t clk reset enable counter"); + $monitor ("%g\t %b %b %b %b", + $time, clock, reset, enable, counter_out); + clock = 1; // initial value of clock + reset = 0; // initial value of reset + enable = 0; // initial value of enable + #5 reset = 1; // Assert the reset + #10 reset = 0; // De-assert the reset + #10 enable = 1; // Assert enable + #100 enable = 0; // De-assert enable + #5 $finish; // Terminate simulation +end + +// Clock generator +always begin + #5 clock = ~clock; // Toggle clock every 5 ticks +end + +// Connect DUT to test bench +first_counter U_counter ( +clock, +reset, +enable, +counter_out +); + +endmodule