diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..79b9535b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +/release/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..d97f6026 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "files.trimTrailingWhitespace": true +} \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..c03a33a5 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Microsoft Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index dfce96f9..ea36c58a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,123 @@ -# monaco-editor -A browser based code editor +# Monaco Editor + +The Monaco Editor is the code editor that powers [VS Code](https://github.com/Microsoft/vscode), a good page describing the code editor's features is [here](https://code.visualstudio.com/docs/editor/editingevolved). + +![image](https://cloud.githubusercontent.com/assets/5047891/15751937/4267b918-28ec-11e6-9fbd-d6cd2973c770.png) + +## Issues + +This repository contains only the scripts to glue things together, please create issues against the actual repositories where the source code lives: + * monaco-editor-core: [Issues](https://github.com/Microsoft/vscode) -- [npm module](https://www.npmjs.com/package/monaco-editor-core) (Issues with the editor itself) + * monaco-typescript: [Issues](https://github.com/Microsoft/monaco-typescript) -- [npm module](https://www.npmjs.com/package/monaco-typescript) (Issues with JavaScript or TypeScript language support) + * monaco-languages: [Issues](https://github.com/Microsoft/monaco-languages) -- [npm module](https://www.npmjs.com/package/monaco-languages) (Issues with bat, coffee script, cpp, csharp, fsharp, go, ini, jade, lua, objective-c, powershell, python, r, ruby, sql, swift, vb or xml) + +## Known issues +In IE, the editor must be completely surrounded in the body element, otherwise the hit testing we do for mouse operations does not work. You can inspect this using F12 and clicking on the body element and confirm that visually it surrounds the editor. + +## Installing + +``` +npm install monaco-editor +``` + +You will get: +* inside `dev`: bundled, not minified +* inside `min`: bundled, and minified +* inside `min-maps`: source maps for `min` +* `monaco.d.ts`: this specifies the API of the editor (this is what is actually versioned, everything else is considered private and might break with any release). + +It is recommended to develop against the `dev` version, and in production to use the `min` version. + +## Integrate + +Here is the most basic HTML page that embeds the editor. More samples are available at [monaco-editor-samples](https://github.com/Microsoft/monaco-editor-samples). + +```html + + + + + + + + +
+ + + + + +``` + +## Integrate cross domain + +If you are hosting your `.js` on a different domain (e.g. on a CDN) than the HTML, you should know that the Monaco Editor creates web workers for smart language features. Cross-domain web workers are not allowed, but here is how you can proxy their loading and get them to work: + +```html + + + + + +``` + +## FAQ + +* Q: What is the relationship between VS Code and the Monaco Editor? +* A: The Monaco Editor is generated straight from VS Code's sources with some shims around services the code needs to make it run in a web browser outside of its home. + +
+* Q: What is the relationship between VS Code's version and the Monaco Editor's version? +* A: None. The Monaco Editor is a library and it reflects directly the source code. + +
+* Q: I've written an extension for VS Code, will it work on the Monaco Editor in a browser? +* A: No. + +
+* Q: Why all these web workers and why should I care? +* A: Language services create web workers to compute heavy stuff outside the UI thread. They cost hardly anything in terms of resource overhead and you shouldn't worry too much about them, as long as you get them to work (see above the cross-domain case). + +
+* Q: What is this `loader.js`? Can I use `require.js`? +* A: It is an AMD loader that we use in VS Code. Yes. + +## License +[MIT](https://github.com/Microsoft/monaco-editor/blob/master/LICENSE.md) \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..ea704f0f --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,129 @@ + +var gulp = require('gulp'); +var metadata = require('./metadata'); +var es = require('event-stream'); +var path = require('path'); +var fs = require('fs'); +var rimraf = require('rimraf'); + +gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); }); +gulp.task('release', ['clean-release'], function() { + return es.merge( + + // dev folder + releaseOne('dev'), + + // min folder + releaseOne('min'), + + // package.json + gulp.src('package.json') + .pipe(es.through(function(data) { + var json = JSON.parse(data.contents.toString()); + json.private = false; + data.contents = new Buffer(JSON.stringify(json, null, ' ')); + this.emit('data', data); + })) + .pipe(gulp.dest('release')), + + // min-maps folder + gulp.src('node_modules/monaco-editor-core/min-maps/**/*').pipe(gulp.dest('release/min-maps')), + + // other files + gulp.src([ + 'node_modules/monaco-editor-core/LICENSE', + 'node_modules/monaco-editor-core/monaco.d.ts', + 'node_modules/monaco-editor-core/ThirdPartyNotices.txt', + 'README.md' + ]).pipe(gulp.dest('release')) + ) +}); + +function releaseOne(type) { + return es.merge( + gulp.src('node_modules/monaco-editor-core/' + type + '/**/*') + .pipe(addPluginContribs()) + .pipe(gulp.dest('release/' + type)), + pluginStreams('release/' + type + '/') + ) +} + +function mergePluginsContribsIntoCore(coreStream) { + return ( + coreStream + .pipe(addPluginContribs()) + ); +} + +function pluginStreams(destinationPath) { + return es.merge( + metadata.METADATA.PLUGINS.map(function(plugin) { + return pluginStream(plugin, destinationPath); + }) + ); +} + +function pluginStream(plugin, destinationPath) { + var contribPath = path.join(plugin.path, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js'; + return ( + gulp.src([ + plugin.path + '/**/*', + '!' + contribPath + ]) + .pipe(gulp.dest(destinationPath + plugin.modulePrefix)) + ); +} + +/** + * Edit editor.main.js: + * - rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main' + * - append contribs from plugins + * - append new AMD module 'vs/editor/editor.main' that stiches things together + */ +function addPluginContribs() { + return es.through(function(data) { + if (!/editor\.main\.js$/.test(data.path)) { + this.emit('data', data); + return; + } + var contents = data.contents.toString(); + + // Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main' + contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"'); + + var extraContent = []; + var allPluginsModuleIds = []; + + metadata.METADATA.PLUGINS.forEach(function(plugin) { + allPluginsModuleIds.push(plugin.contrib); + var contribPath = path.join(__dirname, plugin.path, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js'; + var contribContents = fs.readFileSync(contribPath).toString(); + + var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib); + if (contribDefineIndex === -1) { + console.error('(1) CANNOT DETERMINE AMD define location for contribution', plugin); + process.exit(-1); + } + + var depsEndIndex = contribContents.indexOf(']', contribDefineIndex); + if (contribDefineIndex === -1) { + console.error('(2) CANNOT DETERMINE AMD define location for contribution', plugin); + process.exit(-1); + } + + contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/edcore.main"' + contribContents.substring(depsEndIndex); + + extraContent.push(contribContents); + }); + + extraContent.push(`define("vs/editor/editor.main", ["vs/editor/edcore.main","${allPluginsModuleIds.join('","')}"], function() {});`); + var insertIndex = contents.lastIndexOf('//# sourceMappingURL='); + if (insertIndex === -1) { + insertIndex = contents.length; + } + contents = contents.substring(0, insertIndex) + '\n' + extraContent.join('\n') + '\n' + contents.substring(insertIndex); + + data.contents = new Buffer(contents); + this.emit('data', data); + }); +} diff --git a/metadata.js b/metadata.js new file mode 100644 index 00000000..7b0cb5ab --- /dev/null +++ b/metadata.js @@ -0,0 +1,30 @@ +(function() { + + var METADATA = { + CORE: { + path: 'node_modules/monaco-editor-core/min/vs', + srcPath: '/vscode/out/vs' + // srcPath: '/vscode/out-monaco-editor-core/min/vs' + }, + PLUGINS: [{ + name: 'monaco-typescript', + contrib: 'vs/language/typescript/src/monaco.contribution', + modulePrefix: 'vs/language/typescript', + path: 'node_modules/monaco-typescript/release', + srcPath: '/monaco-typescript/out' + }, { + name: 'monaco-languages', + contrib: 'vs/basic-languages/src/monaco.contribution', + modulePrefix: 'vs/basic-languages', + path: 'node_modules/monaco-languages/release', + srcPath: '/monaco-languages/out' + }] + } + + if (typeof exports !== 'undefined') { + exports.METADATA = METADATA + } else { + self.METADATA = METADATA; + } + +})(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..bf9d806c --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "monaco-editor", + "private": true, + "version": "0.2.4", + "description": "A browser based code editor", + "author": "Microsoft Corporation", + "license": "MIT", + "scripts": { + "simpleserver": "node_modules/.bin/http-server -c-1 ../", + "release": "node_modules/.bin/gulp release" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/monaco-editor" + }, + "devDependencies": { + "event-stream": "^3.3.2", + "gulp": "^3.9.1", + "http-server": "^0.9.0", + "monaco-editor-core": "0.3.1", + "monaco-languages": "0.1.1", + "monaco-typescript": "0.1.1", + "rimraf": "^2.5.2" + } +} diff --git a/test/index-release.html b/test/index-release.html new file mode 100644 index 00000000..53e6b990 --- /dev/null +++ b/test/index-release.html @@ -0,0 +1,38 @@ + + + + + + + + + +

Monaco Editor (running from release)

+ +[MULTIPLE SOURCES] + |  +[RELEASED] + |  +[SMOKETEST] +

+ +
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/test/index.css b/test/index.css new file mode 100644 index 00000000..dfeac5d5 --- /dev/null +++ b/test/index.css @@ -0,0 +1,14 @@ +.monaco-editor .token.custom-info { + color: grey !important; +} +.monaco-editor .token.custom-error { + color: red !important; + font-weight: bold !important; + font-size: 1.2em !important; +} +.monaco-editor .token.custom-notice { + color: orange !important; +} +.monaco-editor .token.custom-date { + color: green !important; +} \ No newline at end of file diff --git a/test/index.html b/test/index.html new file mode 100644 index 00000000..1af58eb7 --- /dev/null +++ b/test/index.html @@ -0,0 +1,71 @@ + + + + + + + + + +

Monaco Editor (running from multiple sources)

+ +[MULTIPLE SOURCES] + |  +[RELEASED] + |  +[SMOKETEST] +

+ +
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/test/index.js b/test/index.js new file mode 100644 index 00000000..4623a011 --- /dev/null +++ b/test/index.js @@ -0,0 +1,372 @@ +/// +define(['./samples'], function(SAMPLES) { + +var WRAPPING_COLUMN = 300; + +var model = monaco.editor.createModel('', 'plaintext'); + +var editor = monaco.editor.create(document.getElementById('container'), { + model: model, + readOnly: false, + glyphMargin: true, + wrappingColumn: WRAPPING_COLUMN, + outlineMarkers: false, + renderWhitespace: true, + // scrollbar: { + // verticalHasArrows: true, + // horizontalHasArrows: true + // } +}); + +editor.addCommand({ + ctrlCmd: true, + key: 'F9' +}, function(ctx, args) { + alert('Command Running!!'); + console.log(ctx); +}); + +editor.addAction({ + id: 'my-unique-id', + label: 'My Label!!!', + keybindings: [ + { + ctrlCmd: true, + key: 'F10' + } + ], + enablement: { + textFocus: true, + wordAtPosition: true, + tokensAtPosition: ['identifier', '', 'keyword'], + }, + contextMenuGroupId: '2_change/2_bla', + run: function(ed) { + console.log("i'm running => " + ed.getPosition()); + } +}); + + +var currentSamplePromise = null; +var samplesData = {}; +SAMPLES.sort(function(a,b) { + return a.name.localeCompare(b.name); +}).forEach(function(sample) { + samplesData[sample.name] = function() { + if (currentSamplePromise !== null) { + currentSamplePromise.cancel(); + currentSamplePromise = null; + } + currentSamplePromise = sample.loadText().then(function(modelText) { + currentSamplePromise = null; + updateEditor(sample.mimeType, modelText, sample.name); + }); + } +}); +var examplesComboBox = new ComboBox('Template', samplesData); + + +var modesData = {}; +monaco.languages.getLanguages().forEach(function(language) { + modesData[language.id] = updateEditor.bind(this, language.id); +}); +var modesComboBox = new ComboBox ('Mode', modesData); + + +// Do it in a timeout to simplify profiles +window.setTimeout(function () { + var START_SAMPLE = 'Y___DefaultJS'; + + var url_matches = location.search.match(/sample=([^?&]+)/i); + if (url_matches) { + START_SAMPLE = url_matches[1]; + } + + if (location.hash) { + START_SAMPLE = location.hash.replace(/^\#/, ''); + } + + samplesData[START_SAMPLE](); + examplesComboBox.set(START_SAMPLE); + + createOptions(editor); + createToolbar(editor); +}, 0); + + +function updateEditor(mode, value, sampleName) { + if (sampleName) { + window.location.hash = sampleName; + } + + if (typeof value !== 'undefined') { + var oldModel = model; + model = monaco.editor.createModel(value, mode); + editor.setModel(model); + if (oldModel) { + oldModel.dispose(); + } + } else { + monaco.editor.setModelLanguage(model, mode); + } + + modesComboBox.set(mode); +} + + +function createToolbar(editor) { + var bar = document.getElementById('bar'); + + bar.appendChild(examplesComboBox.domNode); + + bar.appendChild(modesComboBox.domNode); + + bar.appendChild(createButton("Dispose all", function (e) { + editor.dispose(); + editor = null; + if (model) { + model.dispose(); + model = null; + } + })); + + bar.appendChild(createButton("Remove Model", function(e) { + editor.setModel(null); + })); + + bar.appendChild(createButton("Dispose Model", function(e) { + if (model) { + model.dispose(); + model = null; + } + })); + + bar.appendChild(createButton('Ballistic scroll', (function() { + var friction = 1000; // px per second + var speed = 0; // px per second + var isRunning = false; + var lastTime; + var r = 0; + + var scroll = function() { + var currentTime = new Date().getTime(); + var ellapsedTimeS = (currentTime - lastTime) / 1000; + lastTime = currentTime; + + speed = speed - friction * ellapsedTimeS; + r = r + speed * ellapsedTimeS; + editor.setScrollTop(r); + + if (speed >= 0) { + domutils.scheduleAtNextAnimationFrame(scroll); + } else { + isRunning = false; + } + } + + return function (e) { + speed += 2000; + if (!isRunning) { + isRunning = true; + r = editor.getScrollTop(); + lastTime = new Date().getTime(); + domutils.runAtThisOrScheduleAtNextAnimationFrame(scroll); + } + }; + })())); + + bar.appendChild(createButton("Colorize", function(e) { + var out = document.getElementById('colorizeOutput'); + monaco.editor.colorize(editor.getModel().getValue(), editor.getModel().getMode().getId(), { tabSize: 4 }).then(function(r) { + out.innerHTML = r; + }); + })); +} + + +function createButton(label, onClick) { + var result = document.createElement("button"); + result.innerHTML = label; + result.onclick = onClick; + return result; +} + + +function createOptions(editor) { + var options = document.getElementById('options'); + + options.appendChild(createOptionToggle(editor, 'lineNumbers', function(config) { + return config.viewInfo.lineNumbers; + }, function(editor, newValue) { + editor.updateOptions({ lineNumbers: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'glyphMargin', function(config) { + return config.viewInfo.glyphMargin; + }, function(editor, newValue) { + editor.updateOptions({ glyphMargin: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'roundedSelection', function(config) { + return config.viewInfo.roundedSelection; + }, function(editor, newValue) { + editor.updateOptions({ roundedSelection: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'dark', function(config) { + return config.viewInfo.theme === 'vs-dark'; + }, function(editor, newValue) { + editor.updateOptions({ theme: newValue ? 'vs-dark' : 'vs' }); + })); + + options.appendChild(createOptionToggle(editor, 'readOnly', function(config) { + return config.readOnly; + }, function(editor, newValue) { + editor.updateOptions({ readOnly: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'hideCursorInOverviewRuler', function(config) { + return config.viewInfo.hideCursorInOverviewRuler; + }, function(editor, newValue) { + editor.updateOptions({ hideCursorInOverviewRuler: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'scrollBeyondLastLine', function(config) { + return config.viewInfo.scrollBeyondLastLine; + }, function(editor, newValue) { + editor.updateOptions({ scrollBeyondLastLine: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'wordWrap', function(config) { + return config.wrappingInfo.isViewportWrapping; + }, function(editor, newValue) { + editor.updateOptions({ wrappingColumn: newValue ? 0 : WRAPPING_COLUMN }); + })); + + options.appendChild(createOptionToggle(editor, 'quickSuggestions', function(config) { + return config.contribInfo.quickSuggestions; + }, function(editor, newValue) { + editor.updateOptions({ quickSuggestions: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'iconsInSuggestions', function(config) { + return config.contribInfo.iconsInSuggestions; + }, function(editor, newValue) { + editor.updateOptions({ iconsInSuggestions: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'autoClosingBrackets', function(config) { + return config.autoClosingBrackets; + }, function(editor, newValue) { + editor.updateOptions({ autoClosingBrackets: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'formatOnType', function(config) { + return config.contribInfo.formatOnType; + }, function(editor, newValue) { + editor.updateOptions({ formatOnType: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'suggestOnTriggerCharacters', function(config) { + return config.contribInfo.suggestOnTriggerCharacters; + }, function(editor, newValue) { + editor.updateOptions({ suggestOnTriggerCharacters: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'acceptSuggestionOnEnter', function(config) { + return config.contribInfo.acceptSuggestionOnEnter; + }, function(editor, newValue) { + editor.updateOptions({ acceptSuggestionOnEnter: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'selectionHighlight', function(config) { + return config.contribInfo.selectionHighlight; + }, function(editor, newValue) { + editor.updateOptions({ selectionHighlight: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'folding', function(config) { + return config.contribInfo.folding; + }, function(editor, newValue) { + editor.updateOptions({ folding: newValue }); + })); + + options.appendChild(createOptionToggle(editor, 'renderWhitespace', function(config) { + return config.viewInfo.renderWhitespace; + }, function(editor, newValue) { + editor.updateOptions({ renderWhitespace: newValue }); + })); +} + + +function createOptionToggle(editor, labelText, stateReader, setState) { + var domNode = document.createElement('div'); + domNode.className = 'option toggle'; + + var input = document.createElement('input'); + input.type = 'checkbox'; + + var label = document.createElement('label'); + label.appendChild(input); + label.appendChild(document.createTextNode(labelText)); + + domNode.appendChild(label); + + var renderState = function() { + input.checked = stateReader(editor.getConfiguration()); + }; + + renderState(); + editor.onDidChangeConfiguration(function() { + renderState(); + }); + input.onchange = function() { + setState(editor, !stateReader(editor.getConfiguration())); + }; + + return domNode; +} + + +function ComboBox(label, externalOptions) { + this.id = 'combobox-' + label.toLowerCase().replace(/\s/g, '-'); + + this.domNode = document.createElement('div'); + this.domNode.setAttribute('style', 'display: inline; margin-right: 5px;'); + + this.label = document.createElement('label'); + this.label.innerHTML = label; + this.label.setAttribute('for', this.id); + this.domNode.appendChild(this.label); + + this.comboBox = document.createElement('select'); + this.comboBox.setAttribute('id', this.id); + this.comboBox.setAttribute('name', this.id); + this.comboBox.onchange =(function (e) { + var target = e.target || e.srcElement; + this.options[target.options[target.selectedIndex].value].callback(); + }).bind(this); + + this.domNode.appendChild(this.comboBox); + + this.options = []; + for (var name in externalOptions) { + if (externalOptions.hasOwnProperty(name)) { + var optionElement = document.createElement('option'); + optionElement.value = name; + optionElement.innerHTML = name; + this.options[name] = { + element: optionElement, + callback: externalOptions[name] + }; + this.comboBox.appendChild(optionElement); + } + } +} +ComboBox.prototype.set = function (name) { + if (this.options[name]) { + this.options[name].element.selected = true; + } +}; + +}); \ No newline at end of file diff --git a/test/samples.js b/test/samples.js new file mode 100644 index 00000000..d072e2ed --- /dev/null +++ b/test/samples.js @@ -0,0 +1,271 @@ +/// + +define([], function() { + + var samples = []; + + var modesIds = monaco.languages.getLanguages().map(function(language) { return language.id; }); + modesIds.sort(); + + modesIds.forEach(function(modeId) { + samples.push({ + name: 'sample - ' + modeId, + mimeType: modeId, + loadText: function() { + return xhr('samples/sample.' + modeId + '.txt').then(function(xhrResponse) { + return xhrResponse.responseText; + }); + } + }); + }); + + function addXHRSample(name, modelUrl, mimeType, textModifier) { + textModifier = textModifier || function(text) { return text; }; + samples.push({ + name: name, + mimeType: mimeType, + loadText: function() { + return xhr('samples/' + modelUrl).then(function(xhrResponse) { + return textModifier(xhrResponse.responseText); + }); + } + }); + } + + function addStringPowerXHRSample(name, modelUrl, mimeType, power) { + addXHRSample(name, modelUrl, mimeType, function(text) { + var result = text; + for (var i = 0; i < power; ++i) { + result += "\n" + result; + } + return result; + }); + } + + function addSample(name, mimeType, modelText) { + samples.push({ + name: name, + mimeType: mimeType, + loadText: function() { + return monaco.Promise.as(modelText); + } + }); + } + + addXHRSample('Y___FailingJS', 'run-editor-failing-js.txt', 'text/javascript'); + addXHRSample('Y___DefaultJS', 'run-editor-sample-js.txt', 'text/javascript'); + addStringPowerXHRSample('Y___BigJS', 'run-editor-sample-js.txt', 'text/javascript', 11); + addXHRSample('Y___BigJS_msn', 'run-editor-sample-msn-js.txt', 'text/javascript'); + addXHRSample('Y___BigCSS', 'run-editor-sample-big-css.txt', 'text/css'); + addStringPowerXHRSample('Y___BigHTML', 'run-editor-sample-html.txt', 'text/html', 10); + addXHRSample('Y___Korean', 'run-editor-korean.txt', 'text/plain'); + addXHRSample('Y___BOM.cs', 'run-editor-sample-bom-cs.txt', 'text/x-csharp'); + addXHRSample('Z___CR.ps1', 'run-editor-sample-cr-ps1.txt', 'text/x-powershell'); + + addXHRSample('Z___jquery-min.js', 'run-editor-jquery-min-js.txt', 'text/javascript'); + + addXHRSample('Z___scrolling-strategy.js', 'run-editor-sample-js.txt', 'text/plain', function(text) { + var lines = text.split('\n'); + var newLines = lines.slice(0); + + var problemIsAt = 80733 + 5; + while (newLines.length < problemIsAt) { + newLines = newLines.concat(lines); + } + + newLines = newLines.slice(0, problemIsAt); + return newLines.join('\n'); + }); + + addSample('Z___special-chars', 'text/plain', [ + "// single line \u000D comment", // Carriage return + "// single line \u2028 comment", // Line separator + "// single line \u2029 comment" // Paragraph separator + ].join('\n')); + + // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt + addSample('Z___invalid-unicode', 'text/plain', [ + '\uFFFE\uFFFF', + '\uD800\uDC00', + '\uD800\uDFFF', + '\uDB7F\uDC00', + '\uDB7F\uDFFF', + '\uDB80\uDC00', + '\uDB80\uDFFF', + '\uDBFF\uDC00', + '\uDBFF\uDFFF' + ].join('\n')); + + addSample('Z___easy-debug.js', 'text/plain', (function() { + var myValue = "Line1"; + for (var i = 2; i < 50; i++) { + myValue += "\nLine" + i; + } + return myValue; + })()); + + addSample('Z___copy-paste.txt', 'text/plain', (function() { + var i = 0, sampleCopyPasteLine = ''; + while (sampleCopyPasteLine.length < 1000) { + i++; + sampleCopyPasteLine += i; + } + var sampleCopyPaste = sampleCopyPasteLine; + for (i = 1; i <= 600; i++) { + sampleCopyPaste += '\n' + sampleCopyPasteLine; + } + return sampleCopyPaste; + })()); + + addSample('Z___xss', 'text/html', (function() { + var xssRepresentations = [ + '<', + 'BAD\u2028CHARACTER', + '%3C', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '<', + '\x3c', + '\x3C', + '\u003c', + '\u003C' + ]; + return xssRepresentations.length + ':\n' + xssRepresentations.join('\n'); + })()); + + addSample('Z___many-links.js', 'text/javascript', (function() { + var result = "bla bla a url: https://microsoft.com some more bla bla"; + for (var i = 0; i < 13; ++i) { + result += "\n" + result; + } + return "/*" + result + "\n*/"; + })()); + + addSample('Z___line-separators.js', 'text/javascript', (function() { + return [ + "var x = '1'; // And\u2028 here I have a nice comment.", + "", + "var y = x + ' +\u2028 2 = res';", + "", + "y.replace(/re\u2028s/gi, '3');" + ].join('\n'); + })()); + + addXHRSample('Z___intellisense.js', 'run-editor-intellisense-js.txt', 'text/javascript'); + + addSample('Z___recursion attack', 'text/html', (function() { + var arr = []; + for (var i = 0; i < 10000; i++) { + arr.push('\n + + +

Heading No.1

+ + + \ No newline at end of file diff --git a/test/samples/run-editor-sample-js.txt b/test/samples/run-editor-sample-js.txt new file mode 100644 index 00000000..ce726bd3 --- /dev/null +++ b/test/samples/run-editor-sample-js.txt @@ -0,0 +1,219 @@ +/* + © Microsoft. All rights reserved. + +https://microsoft.com +blablahttp://en.wikipedia.org/wiki/Timisoara bla bla +blabla http://en.wikipedia.org/wiki/Timisoara bla bla + + This library is supported for use in Windows Tailored Apps only. + + Build: 6.2.8100.0 + Version: 0.5 +*/ +'a string\ +on multiple lines'; +(function (global, undefined) { + "use strict"; + undefinedVariable = {}; undefinedVariable.bar = 5; + undefinedVariable.foo = 5; undefinedVariable.baz = 10; + + function initializeProperties(target, members) { + var keys = Object.keys(members); + var properties; + var i, len; + for (i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var enumerable = key.charCodeAt(0) !== /*_*/95; + var member = members[key]; + if (member && typeof member === 'object') { + if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') { + if (member.enumerable === undefined) { + member.enumerable = enumerable; + } + properties = properties || {}; + properties[key] = member; + continue; + } + } + if (!enumerable) { + properties = properties || {}; + properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true } + continue; + } + target[key] = member; + } + if (properties) { + Object.defineProperties(target, properties); + } + } + + (function (rootNamespace) { + + // Create the rootNamespace in the global namespace + if (!global[rootNamespace]) { + global[rootNamespace] = Object.create(Object.prototype); + } + + // Cache the rootNamespace we just created in a local variable + var _rootNamespace = global[rootNamespace]; + if (!_rootNamespace.Namespace) { + _rootNamespace.Namespace = Object.create(Object.prototype); + } + + function defineWithParent(parentNamespace, name, members) { + /// + /// Defines a new namespace with the specified name, under the specified parent namespace. + /// + /// + /// The parent namespace which will contain the new namespace. + /// + /// + /// Name of the new namespace. + /// + /// + /// Members in the new namespace. + /// + /// + /// The newly defined namespace. + /// + var currentNamespace = parentNamespace, + namespaceFragments = name.split("."); + + for (var i = 0, len = namespaceFragments.length; i < len; i++) { + var namespaceName = namespaceFragments[i]; + if (!currentNamespace[namespaceName]) { + Object.defineProperty(currentNamespace, namespaceName, + { value: {}, writable: false, enumerable: true, configurable: true } + ); + } + currentNamespace = currentNamespace[namespaceName]; + } + + if (members) { + initializeProperties(currentNamespace, members); + } + + return currentNamespace; + }; + + function define(name, members) { + /// + /// Defines a new namespace with the specified name. + /// + /// + /// Name of the namespace. This could be a dot-separated nested name. + /// + /// + /// Members in the new namespace. + /// + /// + /// The newly defined namespace. + /// + return defineWithParent(global, name, members); + } + + // Establish members of the "WinJS.Namespace" namespace + Object.defineProperties(_rootNamespace.Namespace, { + + defineWithParent: { value: defineWithParent, writable: true, enumerable: true }, + + define: { value: define, writable: true, enumerable: true } + + }); + + })("WinJS"); + + (function (WinJS) { + + function define(constructor, instanceMembers, staticMembers) { + /// + /// Defines a class using the given constructor and with the specified instance members. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The set of instance fields, properties and methods to be made available on the class. + /// + /// + /// The set of static fields, properties and methods to be made available on the class. + /// + /// + /// The newly defined class. + /// + constructor = constructor || function () { }; + if (instanceMembers) { + initializeProperties(constructor.prototype, instanceMembers); + } + if (staticMembers) { + initializeProperties(constructor, staticMembers); + } + return constructor; + } + + function derive(baseClass, constructor, instanceMembers, staticMembers) { + /// + /// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter. + /// + /// + /// The class to inherit from. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The set of instance fields, properties and methods to be made available on the class. + /// + /// + /// The set of static fields, properties and methods to be made available on the class. + /// + /// + /// The newly defined class. + /// + if (baseClass) { + constructor = constructor || function () { }; + var basePrototype = baseClass.prototype; + constructor.prototype = Object.create(basePrototype); + Object.defineProperty(constructor.prototype, "_super", { value: basePrototype }); + Object.defineProperty(constructor.prototype, "constructor", { value: constructor }); + if (instanceMembers) { + initializeProperties(constructor.prototype, instanceMembers); + } + if (staticMembers) { + initializeProperties(constructor, staticMembers); + } + return constructor; + } else { + return define(constructor, instanceMembers, staticMembers); + } + } + + function mix(constructor) { + /// + /// Defines a class using the given constructor and the union of the set of instance members + /// specified by all the mixin objects. The mixin parameter list can be of variable length. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The newly defined class. + /// + constructor = constructor || function () { }; + var i, len; + for (i = 0, len = arguments.length; i < len; i++) { + initializeProperties(constructor.prototype, arguments[i]); + } + return constructor; + } + + // Establish members of "WinJS.Class" namespace + WinJS.Namespace.define("WinJS.Class", { + define: define, + derive: derive, + mix: mix + }); + + })(WinJS); + +})(this); \ No newline at end of file diff --git a/test/samples/run-editor-sample-msn-js.txt b/test/samples/run-editor-sample-msn-js.txt new file mode 100644 index 00000000..f4a0323f --- /dev/null +++ b/test/samples/run-editor-sample-msn-js.txt @@ -0,0 +1 @@ +(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.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+="',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;tC:\output.txt +endlocal +:EMPTYEXISTS +start notepad c:\output.txt \ No newline at end of file diff --git a/test/samples/sample.c.txt b/test/samples/sample.c.txt new file mode 100644 index 00000000..cd8482fc --- /dev/null +++ b/test/samples/sample.c.txt @@ -0,0 +1,246 @@ +#include "pch.h" +#include "Direct3DBase.h" + +using namespace Microsoft::WRL; +using namespace Windows::UI::Core; +using namespace Windows::Foundation; + +// Constructor. +Direct3DBase::Direct3DBase() +{ +} + +// Initialize the Direct3D resources required to run. +void Direct3DBase::Initialize(CoreWindow^ window) +{ + m_window = window; + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); +} + +// 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; +#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 + }; + + // 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 + ) + ); + + // Get the DirectX11.1 device by QI off the DirectX11 one. + DX::ThrowIfFailed( + device.As(&m_d3dDevice) + ); + + // And get the corresponding device context in the same way. + DX::ThrowIfFailed( + context.As(&m_d3dContext) + ); +} + +// 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; + + // 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; + + // Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device + + // First, retrieve the underlying DXGI Device from the D3D Device + ComPtr dxgiDevice; + DX::ThrowIfFailed( + m_d3dDevice.As(&dxgiDevice) + ); + + // Identify the physical adapter (GPU or card) this device is running on. + ComPtr dxgiAdapter; + DX::ThrowIfFailed( + dxgiDevice->GetAdapter(&dxgiAdapter) + ); + + // And obtain the factory object that created it. + ComPtr dxgiFactory; + DX::ThrowIfFailed( + dxgiAdapter->GetParent( + __uuidof(IDXGIFactory2), + &dxgiFactory + ) + ); + + Windows::UI::Core::CoreWindow^ p = m_window.Get(); + + // 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 + ) + ); + + // Create a view interface on the rendertarget to use on bind. + DX::ThrowIfFailed( + m_d3dDevice->CreateRenderTargetView( + backBuffer.Get(), + nullptr, + &m_renderTargetView + ) + ); + + // 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); + + // 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); + + // Allocate a 2-D surface as the depth/stencil buffer. + ComPtr depthStencil; + DX::ThrowIfFailed( + m_d3dDevice->CreateTexture2D( + &depthStencilDesc, + nullptr, + &depthStencil + ) + ); + + // 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 + ) + ); + + // 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); +} + +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(); + } +} + +void Direct3DBase::Present() +{ + // 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()); + } + else + { + DX::ThrowIfFailed(hr); + } +} diff --git a/test/samples/sample.coffeescript.txt b/test/samples/sample.coffeescript.txt new file mode 100644 index 00000000..d4d58f0b --- /dev/null +++ b/test/samples/sample.coffeescript.txt @@ -0,0 +1,28 @@ +""" +A CoffeeScript sample. +""" + +class Vehicle + constructor: (@name) => + + drive: () => + alert "Conducting #{@name}" + +class Car extends Vehicle + drive: () => + alert "Driving #{@name}" + +c = new Car "Brandie" + +while notAtDestination() + c.drive() + +raceVehicles = (new Car for i in [1..100]) + +startRace = (vehicles) -> [vehicle.drive() for vehicle in vehicles] + +fancyRegExp = /// + (\d+) # numbers + (\w*) # letters + $ # the end +/// diff --git a/test/samples/sample.cpp.txt b/test/samples/sample.cpp.txt new file mode 100644 index 00000000..cd8482fc --- /dev/null +++ b/test/samples/sample.cpp.txt @@ -0,0 +1,246 @@ +#include "pch.h" +#include "Direct3DBase.h" + +using namespace Microsoft::WRL; +using namespace Windows::UI::Core; +using namespace Windows::Foundation; + +// Constructor. +Direct3DBase::Direct3DBase() +{ +} + +// Initialize the Direct3D resources required to run. +void Direct3DBase::Initialize(CoreWindow^ window) +{ + m_window = window; + + CreateDeviceResources(); + CreateWindowSizeDependentResources(); +} + +// 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; +#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 + }; + + // 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 + ) + ); + + // Get the DirectX11.1 device by QI off the DirectX11 one. + DX::ThrowIfFailed( + device.As(&m_d3dDevice) + ); + + // And get the corresponding device context in the same way. + DX::ThrowIfFailed( + context.As(&m_d3dContext) + ); +} + +// 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; + + // 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; + + // Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device + + // First, retrieve the underlying DXGI Device from the D3D Device + ComPtr dxgiDevice; + DX::ThrowIfFailed( + m_d3dDevice.As(&dxgiDevice) + ); + + // Identify the physical adapter (GPU or card) this device is running on. + ComPtr dxgiAdapter; + DX::ThrowIfFailed( + dxgiDevice->GetAdapter(&dxgiAdapter) + ); + + // And obtain the factory object that created it. + ComPtr dxgiFactory; + DX::ThrowIfFailed( + dxgiAdapter->GetParent( + __uuidof(IDXGIFactory2), + &dxgiFactory + ) + ); + + Windows::UI::Core::CoreWindow^ p = m_window.Get(); + + // 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 + ) + ); + + // Create a view interface on the rendertarget to use on bind. + DX::ThrowIfFailed( + m_d3dDevice->CreateRenderTargetView( + backBuffer.Get(), + nullptr, + &m_renderTargetView + ) + ); + + // 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); + + // 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); + + // Allocate a 2-D surface as the depth/stencil buffer. + ComPtr depthStencil; + DX::ThrowIfFailed( + m_d3dDevice->CreateTexture2D( + &depthStencilDesc, + nullptr, + &depthStencil + ) + ); + + // 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 + ) + ); + + // 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); +} + +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(); + } +} + +void Direct3DBase::Present() +{ + // 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()); + } + else + { + DX::ThrowIfFailed(hr); + } +} diff --git a/test/samples/sample.csharp.txt b/test/samples/sample.csharp.txt new file mode 100644 index 00000000..979eb7f0 --- /dev/null +++ b/test/samples/sample.csharp.txt @@ -0,0 +1,23 @@ +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); + } + } +} diff --git a/test/samples/sample.css.txt b/test/samples/sample.css.txt new file mode 100644 index 00000000..6572f3d6 --- /dev/null +++ b/test/samples/sample.css.txt @@ -0,0 +1,828 @@ +html { + background-color: #e2e2e2; + margin: 0; + padding: 0; +} + +body { + background-color: #fff; + border-top: solid 10px #000; + color: #333; + font-size: .85em; + font-family: "Segoe UI","HelveticaNeue-Light", sans-serif; + margin: 0; + padding: 0; +} + +a:link, a:visited, +a:active, a:hover { + color: #333; + outline: none; + padding-left: 0; + padding-right: 3px; + text-decoration: none; + +} + + +a:hover { + background-color: #c7d1d6; +} + + +header, footer, hgroup +nav, section { + display: block; +} + +.float-left { + float: left; +} + +.float-right { + float: right; +} + +.highlight { +/* background-color: #a6dbed; + padding-left: 5px; + padding-right: 5px;*/ +} + +.clear-fix:after { + content: "."; + clear: both; + display: block; + height: 0; + visibility: hidden; +} + +h1, h2, h3, +h4, h5, h6 { + color: #000; + margin-bottom: 0; + padding-bottom: 0; + +} + +h1 { + font-size: 2em; +} + +h2 { + font-size: 1.75em; +} + +h3 { + font-size: 1.2em; +} + +h4 { + font-size: 1.1em; +} + +h5, h6 { + font-size: 1em; +} + + +.tile { + /* 2px solid #7ac0da; */ + border: 0; + + float: left; + width: 200px; + height: 325px; + + padding: 5px; + margin-right: 5px; + margin-bottom: 20px; + margin-top: 20px; + -webkit-perspective: 0; + -webkit-transform-style: preserve-3d; + -webkit-transition: -webkit-transform 0.2s; + -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3); + background-position: center center; + background-repeat: no-repeat; + + background-color: #fff; +} + +.tile-item { + /* 2px solid #7ac0da; */ + border-color: inherit; + float: left; + width: 50px; + height: 70px; + margin-right: 20px; + margin-bottom: 20px; + margin-top: 20px; + background-image: url('../Images/documents.png'); + background-repeat: no-repeat; + +} + +.tile-wrapper { + width: 100%; + font-family: "Segoe UI" , Tahoma, Geneva, Verdana, sans-serif; + line-height: 21px; + font-size: 14px; +} + +a.blue-box { + font-size: 28px; + height: 100px; + display: block; + border-style: solid; + border-width: 1px 1px 4px 1px; + border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0; + padding-top: 15px; + padding-left: 15px; +} + + a.blue-box:hover { + border: 4px solid #8ABAE4; + padding-top: 12px; + padding-left: 12px; + background-color: #FFFFFF; +} + +a.green-box { + font-size: 28px; + height: 100px; + display: block; + border-style: solid; + border-width: 1px 1px 4px 1px; + border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0; + padding-top: 15px; + padding-left: 15px; +} + + a.green-box:hover { + border: 4px solid #9CCF42; + padding-top: 12px; + padding-left: 12px; + background-color: #FFFFFF; +} + + +a.green-box2 { + font-size: 14px; + height: 48px; + width: 48px; + display: block; /* border-color: #C0C0C0; */ + padding-top: 6px; + font-weight: bold; + +} + + a.green-box2:hover { + border: solid #8ABAE4; + padding-top: 0px; + padding-left: 0px; + background-image: url('../Images/documents.png'); + background-color: #EFEFEF; +} + +a.yellow-box { + font-size: 28px; + height: 100px; + display: block; + border-style: solid; + border-width: 1px 1px 4px 1px; + border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0; + padding-top: 15px; + padding-left: 15px; +} + + a.yellow-box:hover { + border: 4px solid #DECF6B; + padding-top: 12px; + padding-left: 12px; + background-color: #FFFFFF; +} + + +a.red-box { + font-size: 28px; + height: 100px; + display: block; + border-style: solid; + border-width: 1px 1px 4px 1px; + border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0; + padding-top: 15px; + padding-left: 15px; +} + + a.red-box:hover { + border: 4px solid #F79E84; + padding-top: 12px; + padding-left: 12px; + background-color: #FFFFFF; +} + +/* main layout +----------------------------------------------------------*/ +.content-wrapper { + margin: 0 auto; + max-width: 960px; +} + +#body { + background-color: #efeeef; + clear: both; + padding-bottom: 35px; +} + + .main-content { + background: url("../images/accent.png") no-repeat; + padding-left: 10px; + padding-top: 30px; + } + + .featured + .main-content { + background: url("../images/heroaccent.png") no-repeat; + } + +footer { + clear: both; + background-color: #e2e2e2; + font-size: .8em; + height: 100px; +} + + +/* site title +----------------------------------------------------------*/ +.site-title { + color: #0066CC; /* font-family: Rockwell, Consolas, "Courier New", Courier, monospace; */ + font-size: 3.3em; + margin-top: 40px; + margin-bottom: 0; +} + +.site-title a, .site-title a:hover, .site-title a:active { + background: none; + color: #0066CC; + outline: none; + text-decoration: none; +} + + +/* login +----------------------------------------------------------*/ +#login { + display: block; + font-size: .85em; + margin-top: 20px; + text-align: right; +} + + #login a { + background-color: #d3dce0; + margin-left: 10px; + margin-right: 3px; + padding: 2px 3px; + text-decoration: none; + } + + #login a.username { + background: none; + margin-left: 0px; + text-decoration: underline; + } + + #login li { + display: inline; + list-style: none; + } + + +/* menu +----------------------------------------------------------*/ +ul#menu { + font-size: 1.3em; + font-weight: 600; + margin: 0; + text-align: right; + text-decoration: none; + +} + + ul#menu li { + display: inline; + list-style: none; + padding-left: 15px; + } + + ul#menu li a { + background: none; + color: #999; + text-decoration: none; + } + + ul#menu li a:hover { + color: #333; + text-decoration: none; + } + + + +/* page elements +----------------------------------------------------------*/ +/* featured */ +.featured { + background-color: #fff; +} + + .featured .content-wrapper { + /*background-color: #7ac0da; + background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%); + background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%); + background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6)); + background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%); + background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%); + color: #3e5667; + */ + padding: 0px 40px 30px 40px; + } + + .featured hgroup.title h1, .featured hgroup.title h2 { + /* color: #fff; + */ + } + + .featured p { + font-size: 1.1em; + } + +/* page titles */ +hgroup.title { + margin-bottom: 10px; +} + +hgroup.title h1, hgroup.title h2 { +display: inline; +} + +hgroup.title h2 { + font-weight: normal; +} + +/* releases */ +.milestone { + color: #fff; + background-color: #8ABAE4; + font-weight: normal; + padding: 10px 10px 10px 10px; + margin: 0 0 0 0; +} + .milestone .primary { + font-size: 1.75em; + } + + .milestone .secondary { + font-size: 1.2em; + font-weight: normal; + /* padding: 5px 5px 5px 10px;*/ + } + +/* features */ +section.feature { + width: 200px; + float: left; + padding: 10px; +} + +/* ordered list */ +ol.round { + list-style-type: none; + padding-left: 0; +} + + ol.round li { + margin: 25px 0; + padding-left: 45px; + } + + ol.round li.one { + background: url("../images/orderedlistOne.png") no-repeat; + } + + ol.round li.two { + background: url("../images/orderedlistTwo.png") no-repeat; + } + + ol.round li.three { + background: url("../images/orderedlistThree.png") no-repeat; + } + +/* content */ +article { + float: left; + width: 70%; +} + +aside { + float: right; + width: 25%; +} + + aside ul { + list-style: none; + padding: 0; + } + + aside ul li { + background: url("../images/bullet.png") no-repeat 0 50%; + padding: 2px 0 2px 20px; + } + +.label { + font-weight: 700; +} + +/* login page */ +#loginForm { + border-right: solid 2px #c8c8c8; + float: left; + width: 45%; +} + + #loginForm .validation-error { + display: block; + margin-left: 15px; + } + +#socialLoginForm { + margin-left: 40px; + float: left; + width: 50%; +} + +/* contact */ +.contact h3 { + font-size: 1.2em; +} + +.contact p { + margin: 5px 0 0 10px; +} + +.contact iframe { + border: solid 1px #333; + margin: 5px 0 0 10px; +} + +/* forms */ +fieldset { + border: none; + margin: 0; + padding: 0; +} + + fieldset legend { + display: none; + } + + fieldset ol { + padding: 0; + list-style: none; + } + + fieldset ol li { + padding-bottom: 5px; + } + + fieldset label { + display: block; + font-size: 1.2em; + font-weight: 600; + } + + fieldset label.checkbox { + display: inline; + } + + fieldset input[type="text"], + fieldset input[type="password"] { + border: 1px solid #e2e2e2; + color: #333; + font-size: 1.2em; + margin: 5px 0 6px 0; + padding: 5px; + width: 300px; + } + + fieldset input[type="text"]:focus, + fieldset input[type="password"]:focus { + border: 1px solid #7ac0da; + } + + fieldset input[type="submit"] { + background-color: #d3dce0; + border: solid 1px #787878; + cursor: pointer; + font-size: 1.2em; + font-weight: 600; + padding: 7px; + } + +/* ajax login/registration dialog */ +.modal-popup { + font-size: 0.7em; +} + +/* info and errors */ +.message-info { + border: solid 1px; + clear: both; + padding: 10px 20px; +} + +.message-error { + clear: both; + color: #e80c4d; + font-size: 1.1em; + font-weight: bold; + margin: 20px 0 10px 0; +} + +.message-success { + color: #7ac0da; + font-size: 1.3em; + font-weight: bold; + margin: 20px 0 10px 0; +} + +.success { + color: #7ac0da; +} + +.error { + color: #e80c4d; +} + +/* styles for validation helpers */ +.field-validation-error { + color: #e80c4d; + font-weight: bold; +} + +.field-validation-valid { + display: none; +} + +input[type="text"].input-validation-error, +input[type="password"].input-validation-error { + border: solid 1px #e80c4d; +} + +.validation-summary-errors { + color: #e80c4d; + font-weight: bold; + font-size: 1.1em; +} + +.validation-summary-valid { + display: none; +} + + +/* social */ +ul#social li { + display: inline; + list-style: none; +} + + ul#social li a { + color: #999; + text-decoration: none; + } + + a.facebook, a.twitter { + display: block; + float: left; + height: 24px; + padding-left: 17px; + text-indent: -9999px; + width: 16px; + } + + a.facebook { + background: url("../images/facebook.png") no-repeat; + } + + a.twitter { + background: url("../images/twitter.png") no-repeat; + } + + + +/******************** +* Mobile Styles * +********************/ +@media only screen and (max-width: 850px) { + + /* header + ----------------------------------------------------------*/ + header .float-left, + header .float-right { + float: none; + } + + /* logo */ + header .site-title { + /*margin: 0; */ + /*margin: 10px;*/ + text-align: left; + padding-left: 0; + } + + /* login */ + #login { + font-size: .85em; + margin-top: 0; + text-align: center; + } + + #login ul { + margin: 5px 0; + padding: 0; + } + + #login li { + display: inline; + list-style: none; + margin: 0; + padding:0; + } + + #login a { + background: none; + color: #999; + font-weight: 600; + margin: 2px; + padding: 0; + } + + #login a:hover { + color: #333; + } + + /* menu */ + nav { + margin-bottom: 5px; + } + + ul#menu { + margin: 0; + padding:0; + text-align: center; + } + + ul#menu li { + margin: 0; + padding: 0; + } + + + /* main layout + ----------------------------------------------------------*/ + .main-content, + .featured + .main-content { + background-position: 10px 0; + } + + .content-wrapper { + padding-right: 10px; + padding-left: 10px; + } + + .featured .content-wrapper { + padding: 10px; + } + + /* page content */ + article, aside { + float: none; + width: 100%; + } + + /* ordered list */ + ol.round { + list-style-type: none; + padding-left: 0; + } + + ol.round li { + padding-left: 10px; + margin: 25px 0; + } + + ol.round li.one, + ol.round li.two, + ol.round li.three { + background: none; + } + + /* features */ + section.feature { + float: none; + padding: 10px; + width: auto; + } + + section.feature img { + color: #999; + content: attr(alt); + font-size: 1.5em; + font-weight: 600; + } + + /* forms */ + fieldset input[type="text"], + fieldset input[type="password"] { + width: 90%; + } + + /* login page */ + #loginForm { + border-right: none; + float: none; + width: auto; + } + + #loginForm .validation-error { + display: block; + margin-left: 15px; + } + + #socialLoginForm { + margin-left: 0; + float: none; + width: auto; + } + + /* footer + ----------------------------------------------------------*/ + footer .float-left, + footer .float-right { + float: none; + } + + footer { + text-align: center; + height: auto; + padding: 10px 0; + } + + footer p { + margin: 0; + } + + ul#social { + padding:0; + margin: 0; + } + + a.facebook, a.twitter { + background: none; + display: inline; + float: none; + height: auto; + padding-left: 0; + text-indent: 0; + width: auto; + } +} + +.subsite { + color: #444; +} + +h3 { + font-weight: normal; + font-size: 24px; + color: #444; + margin-bottom: 20px; +} + +.tiles { + padding-bottom: 20px; + background-color: #e3e3e3; +} + +#editor { + margin: 0 auto; + height: 500px; + border: 1px solid #ccc; +} + +.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse { + background: #F9F9F9; +} + +.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background { + background: #F9F9F9; +} \ No newline at end of file diff --git a/test/samples/sample.dockerfile.txt b/test/samples/sample.dockerfile.txt new file mode 100644 index 00000000..246358b7 --- /dev/null +++ b/test/samples/sample.dockerfile.txt @@ -0,0 +1,32 @@ +FROM mono:3.12 + +ENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2 +ENV KRE_USER_HOME /opt/kre + +RUN apt-get -qq update && apt-get -qqy install unzip + +ONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh +ONBUILD RUN bash -c "source $KRE_USER_HOME/kvm/kvm.sh \ + && kvm install latest -a default \ + && kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default" + +# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old) +RUN apt-get -qqy install \ + autoconf \ + automake \ + build-essential \ + libtool +RUN LIBUV_VERSION=1.0.0-rc2 \ + && curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \ + && cd /usr/local/src/libuv-$LIBUV_VERSION \ + && sh autogen.sh && ./configure && make && make install \ + && rm -rf /usr/local/src/libuv-$LIBUV_VERSION \ + && ldconfig + +ENV PATH $PATH:$KRE_USER_HOME/packages/default/bin + +# Extra things to test +RUN echo "string at end" +RUN echo must work 'some str' and some more +RUN echo hi this is # not a comment +RUN echo 'String with ${VAR} and another $one here' \ No newline at end of file diff --git a/test/samples/sample.fsharp.txt b/test/samples/sample.fsharp.txt new file mode 100644 index 00000000..a8c0517e --- /dev/null +++ b/test/samples/sample.fsharp.txt @@ -0,0 +1,8 @@ +(* Sample F# application *) +[] +let main argv = + printfn "%A" argv + System.Console.WriteLine("Hello from F#") + 0 // return an integer exit code + +//-------------------------------------------------------- diff --git a/test/samples/sample.go.txt b/test/samples/sample.go.txt new file mode 100644 index 00000000..0068acef --- /dev/null +++ b/test/samples/sample.go.txt @@ -0,0 +1,111 @@ +// We often need our programs to perform operations on +// collections of data, like selecting all items that +// satisfy a given predicate or mapping all items to a new +// collection with a custom function. + +// In some languages it's idiomatic to use [generic](http://en.wikipedia.org/wiki/Generic_programming) +// data structures and algorithms. Go does not support +// generics; in Go it's common to provide collection +// functions if and when they are specifically needed for +// your program and data types. + +// Here are some example collection functions for slices +// of `strings`. You can use these examples to build your +// own functions. Note that in some cases it may be +// clearest to just inline the collection-manipulating +// code directly, instead of creating and calling a +// helper function. + +package main + +import "strings" +import "fmt" + +// Returns the first index of the target string `t`, or +// -1 if no match is found. +func Index(vs []string, t string) int { + for i, v := range vs { + if v == t { + return i + } + } + return -1 +} + +// Returns `true` if the target string t is in the +// slice. +func Include(vs []string, t string) bool { + return Index(vs, t) >= 0 +} + +// Returns `true` if one of the strings in the slice +// satisfies the predicate `f`. +func Any(vs []string, f func(string) bool) bool { + for _, v := range vs { + if f(v) { + return true + } + } + return false +} + +// Returns `true` if all of the strings in the slice +// satisfy the predicate `f`. +func All(vs []string, f func(string) bool) bool { + for _, v := range vs { + if !f(v) { + return false + } + } + return true +} + +// Returns a new slice containing all strings in the +// slice that satisfy the predicate `f`. +func Filter(vs []string, f func(string) bool) []string { + vsf := make([]string, 0) + for _, v := range vs { + if f(v) { + vsf = append(vsf, v) + } + } + return vsf +} + +// Returns a new slice containing the results of applying +// the function `f` to each string in the original slice. +func Map(vs []string, f func(string) string) []string { + vsm := make([]string, len(vs)) + for i, v := range vs { + vsm[i] = f(v) + } + return vsm +} + +func main() { + + // Here we try out our various collection functions. + var strs = []string{"peach", "apple", "pear", "plum"} + + fmt.Println(Index(strs, "pear")) + + fmt.Println(Include(strs, "grape")) + + fmt.Println(Any(strs, func(v string) bool { + return strings.HasPrefix(v, "p") + })) + + fmt.Println(All(strs, func(v string) bool { + return strings.HasPrefix(v, "p") + })) + + fmt.Println(Filter(strs, func(v string) bool { + return strings.Contains(v, "e") + })) + + // The above examples all used anonymous functions, + // but you can also use named functions of the correct + // type. + fmt.Println(Map(strs, strings.ToUpper)) + +} diff --git a/test/samples/sample.handlebars.txt b/test/samples/sample.handlebars.txt new file mode 100644 index 00000000..fe69341e --- /dev/null +++ b/test/samples/sample.handlebars.txt @@ -0,0 +1,31 @@ + +
    +

    {{title}}

    + {{#if author}} +

    {{author.firstName}} {{author.lastName}}

    + {{else}} +

    Unknown Author

    + {{/if}} + {{contentBody}} +
    + +{{#unless license}} +

    WARNING: This entry does not have a license!

    +{{/unless}} + +
    +
      + {{#each footnotes}} +
    • {{this}}
    • + {{/each}} +
    +
    + +

    Comments

    + +
    + {{#each comments}} +

    {{title}}

    +
    {{body}}
    + {{/each}} +
    diff --git a/test/samples/sample.html.txt b/test/samples/sample.html.txt new file mode 100644 index 00000000..de975842 --- /dev/null +++ b/test/samples/sample.html.txt @@ -0,0 +1,22 @@ + + + + + HTML Sample + + + + + +

    Heading No.1

    + + + \ No newline at end of file diff --git a/test/samples/sample.ini.txt b/test/samples/sample.ini.txt new file mode 100644 index 00000000..ab49225a --- /dev/null +++ b/test/samples/sample.ini.txt @@ -0,0 +1,15 @@ +# Example of a .gitconfig file + +[core] + repositoryformatversion = 0 + filemode = false + bare = false + logallrefupdates = true + symlinks = false + ignorecase = true + hideDotFiles = dotGitOnly + +# Defines the master branch +[branch "master"] + remote = origin + merge = refs/heads/master diff --git a/test/samples/sample.jade.txt b/test/samples/sample.jade.txt new file mode 100644 index 00000000..09410968 --- /dev/null +++ b/test/samples/sample.jade.txt @@ -0,0 +1,18 @@ +doctype 5 +html(lang="en") + head + title= pageTitle + script(type='text/javascript') + if (foo) { + bar() + } + body + // Disclaimer: You will need to turn insertSpaces to true in order for the + syntax highlighting to kick in properly (especially for comments) + Enjoy :) + h1 Jade - node template engine + #container + if youAreUsingJade + p You are amazing + else + p Get on it! \ No newline at end of file diff --git a/test/samples/sample.java.txt b/test/samples/sample.java.txt new file mode 100644 index 00000000..e5347aa4 --- /dev/null +++ b/test/samples/sample.java.txt @@ -0,0 +1,14 @@ +import java.util.ArrayList; +import org.junit.Test; + +public class Example { + @Test + public void method() { + org.junit.Assert.assertTrue( "isEmpty", new ArrayList().isEmpty()); + } + + @Test(timeout=100) public void infinity() { + while(true); + } + } + \ No newline at end of file diff --git a/test/samples/sample.javascript.txt b/test/samples/sample.javascript.txt new file mode 100644 index 00000000..9745cf2f --- /dev/null +++ b/test/samples/sample.javascript.txt @@ -0,0 +1,214 @@ +/* + © Microsoft. All rights reserved. + + This library is supported for use in Windows Tailored Apps only. + + Build: 6.2.8100.0 + Version: 0.5 +*/ + +(function (global, undefined) { + "use strict"; + undefinedVariable = {}; + undefinedVariable.prop = 5; + + function initializeProperties(target, members) { + var keys = Object.keys(members); + var properties; + var i, len; + for (i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + var enumerable = key.charCodeAt(0) !== /*_*/95; + var member = members[key]; + if (member && typeof member === 'object') { + if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') { + if (member.enumerable === undefined) { + member.enumerable = enumerable; + } + properties = properties || {}; + properties[key] = member; + continue; + } + } + if (!enumerable) { + properties = properties || {}; + properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true } + continue; + } + target[key] = member; + } + if (properties) { + Object.defineProperties(target, properties); + } + } + + (function (rootNamespace) { + + // Create the rootNamespace in the global namespace + if (!global[rootNamespace]) { + global[rootNamespace] = Object.create(Object.prototype); + } + + // Cache the rootNamespace we just created in a local variable + var _rootNamespace = global[rootNamespace]; + if (!_rootNamespace.Namespace) { + _rootNamespace.Namespace = Object.create(Object.prototype); + } + + function defineWithParent(parentNamespace, name, members) { + /// + /// Defines a new namespace with the specified name, under the specified parent namespace. + /// + /// + /// The parent namespace which will contain the new namespace. + /// + /// + /// Name of the new namespace. + /// + /// + /// Members in the new namespace. + /// + /// + /// The newly defined namespace. + /// + var currentNamespace = parentNamespace, + namespaceFragments = name.split("."); + + for (var i = 0, len = namespaceFragments.length; i < len; i++) { + var namespaceName = namespaceFragments[i]; + if (!currentNamespace[namespaceName]) { + Object.defineProperty(currentNamespace, namespaceName, + { value: {}, writable: false, enumerable: true, configurable: true } + ); + } + currentNamespace = currentNamespace[namespaceName]; + } + + if (members) { + initializeProperties(currentNamespace, members); + } + + return currentNamespace; + } + + function define(name, members) { + /// + /// Defines a new namespace with the specified name. + /// + /// + /// Name of the namespace. This could be a dot-separated nested name. + /// + /// + /// Members in the new namespace. + /// + /// + /// The newly defined namespace. + /// + return defineWithParent(global, name, members); + } + + // Establish members of the "WinJS.Namespace" namespace + Object.defineProperties(_rootNamespace.Namespace, { + + defineWithParent: { value: defineWithParent, writable: true, enumerable: true }, + + define: { value: define, writable: true, enumerable: true } + + }); + + })("WinJS"); + + (function (WinJS) { + + function define(constructor, instanceMembers, staticMembers) { + /// + /// Defines a class using the given constructor and with the specified instance members. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The set of instance fields, properties and methods to be made available on the class. + /// + /// + /// The set of static fields, properties and methods to be made available on the class. + /// + /// + /// The newly defined class. + /// + constructor = constructor || function () { }; + if (instanceMembers) { + initializeProperties(constructor.prototype, instanceMembers); + } + if (staticMembers) { + initializeProperties(constructor, staticMembers); + } + return constructor; + } + + function derive(baseClass, constructor, instanceMembers, staticMembers) { + /// + /// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter. + /// + /// + /// The class to inherit from. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The set of instance fields, properties and methods to be made available on the class. + /// + /// + /// The set of static fields, properties and methods to be made available on the class. + /// + /// + /// The newly defined class. + /// + if (baseClass) { + constructor = constructor || function () { }; + var basePrototype = baseClass.prototype; + constructor.prototype = Object.create(basePrototype); + Object.defineProperty(constructor.prototype, "_super", { value: basePrototype }); + Object.defineProperty(constructor.prototype, "constructor", { value: constructor }); + if (instanceMembers) { + initializeProperties(constructor.prototype, instanceMembers); + } + if (staticMembers) { + initializeProperties(constructor, staticMembers); + } + return constructor; + } else { + return define(constructor, instanceMembers, staticMembers); + } + } + + function mix(constructor) { + /// + /// Defines a class using the given constructor and the union of the set of instance members + /// specified by all the mixin objects. The mixin parameter list can be of variable length. + /// + /// + /// A constructor function that will be used to instantiate this class. + /// + /// + /// The newly defined class. + /// + constructor = constructor || function () { }; + var i, len; + for (i = 0, len = arguments.length; i < len; i++) { + initializeProperties(constructor.prototype, arguments[i]); + } + return constructor; + } + + // Establish members of "WinJS.Class" namespace + WinJS.Namespace.define("WinJS.Class", { + define: define, + derive: derive, + mix: mix + }); + + })(WinJS); + +})(this); \ No newline at end of file diff --git a/test/samples/sample.json.txt b/test/samples/sample.json.txt new file mode 100644 index 00000000..291dd43d --- /dev/null +++ b/test/samples/sample.json.txt @@ -0,0 +1,68 @@ +{ + "type": "team", + "test": { + "testPage": "tools/testing/run-tests.htm", + "enabled": true + }, + "search": { + "excludeFolders": [ + ".git", + "node_modules", + "tools/bin", + "tools/counts", + "tools/policheck", + "tools/tfs_build_extensions", + "tools/testing/jscoverage", + "tools/testing/qunit", + "tools/testing/chutzpah", + "server.net" + ] + }, + "languages": { + "vs.languages.typescript": { + "validationSettings": [{ + "scope":"/", + "noImplicitAny":true, + "noLib":false, + "extraLibs":[], + "semanticValidation":true, + "syntaxValidation":true, + "codeGenTarget":"ES5", + "moduleGenTarget":"", + "lint": { + "emptyBlocksWithoutComment": "warning", + "curlyBracketsMustNotBeOmitted": "warning", + "comparisonOperatorsNotStrict": "warning", + "missingSemicolon": "warning", + "unknownTypeOfResults": "warning", + "semicolonsInsteadOfBlocks": "warning", + "functionsInsideLoops": "warning", + "functionsWithoutReturnType": "warning", + "tripleSlashReferenceAlike": "warning", + "unusedImports": "warning", + "unusedVariables": "warning", + "unusedFunctions": "warning", + "unusedMembers": "warning" + } + }, + { + "scope":"/client", + "baseUrl":"/client", + "moduleGenTarget":"amd" + }, + { + "scope":"/server", + "moduleGenTarget":"commonjs" + }, + { + "scope":"/build", + "moduleGenTarget":"commonjs" + }, + { + "scope":"/node_modules/nake", + "moduleGenTarget":"commonjs" + }], + "allowMultipleWorkers": true + } + } +} \ No newline at end of file diff --git a/test/samples/sample.less.txt b/test/samples/sample.less.txt new file mode 100644 index 00000000..6928c2e8 --- /dev/null +++ b/test/samples/sample.less.txt @@ -0,0 +1,46 @@ +@base: #f938ab; + +.box-shadow(@style, @c) when (iscolor(@c)) { + border-radius: @style @c; +} + +.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) { + .box-shadow(@style, rgba(0, 0, 0, @alpha)); +} + +.box { + color: saturate(@base, 5%); + border-color: lighten(@base, 30%); + + div { + .box-shadow((0 0 5px), 30%); + } +} + +#header { + h1 { + font-size: 26px; + font-weight: bold; + } + + p { font-size: 12px; + a { text-decoration: none; + &:hover { border-width: 1px } + } + } +} + +@the-border: 1px; +@base-color: #111; +@red: #842210; + +#header { + color: (@base-color * 3); + border-left: @the-border; + border-right: (@the-border * 2); +} + +#footer { + color: (@base-color + #003300); + border-color: desaturate(@red, 10%); +} diff --git a/test/samples/sample.lua.txt b/test/samples/sample.lua.txt new file mode 100644 index 00000000..22afb767 --- /dev/null +++ b/test/samples/sample.lua.txt @@ -0,0 +1,12 @@ + -- defines a factorial function + function fact (n) + if n == 0 then + return 1 + else + return n * fact(n-1) + end + end + + print("enter a number:") + a = io.read("*number") -- read a number + print(fact(a)) \ No newline at end of file diff --git a/test/samples/sample.markdown.txt b/test/samples/sample.markdown.txt new file mode 100644 index 00000000..998c99ef --- /dev/null +++ b/test/samples/sample.markdown.txt @@ -0,0 +1,97 @@ +# Header 1 # +## Header 2 ## +### Header 3 ### (Hashes on right are optional) +## Markdown plus h2 with a custom ID ## {#id-goes-here} +[Link back to H2](#id-goes-here) + + +
    +
    + nested div +
    + + This is a div _with_ underscores + and a & bold element. + +
    + +* Bullet lists are easy too +- 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. + +Now some inline markup like _italics_, **bold**, +and `code()`. Note that underscores +in_words_are ignored. + +````application/json + { value: ["or with a mime type"] } +```` + +> Blockquotes are like quoted text in email replies +>> And, they can be nested + +1. A numbered list +2. Which is numbered +3. With periods and a space + +And now some code: + + // Code is just text indented a bit + which(is_easy) to_remember(); + +And a block + +~~~ +// Markdown extra adds un-indented code blocks too + +if (this_is_more_code == true && !indented) { + // tild wrapped code blocks, also not indented +} +~~~ + +Text with +two trailing spaces +(on the right) +can be used +for things like poems + +### Horizontal rules + +* * * * +**** +-------------------------- + +![picture alt](/images/photo.jpeg "Title is optional") + +## Markdown plus tables ## + +| Header | Header | Right | +| ------ | ------ | -----: | +| Cell | Cell | $10 | +| Cell | Cell | $20 | + +* Outer pipes on tables are optional +* Colon used for alignment (right versus left) + +## Markdown plus definition lists ## + +Bottled water +: $ 1.25 +: $ 1.55 (Large) + +Milk +Pop +: $ 1.75 + +* Multiple definitions and terms are possible +* Definitions can include multiple paragraphs too + +*[ABBR]: Markdown plus abbreviations (produces an tag) \ No newline at end of file diff --git a/test/samples/sample.objective-c.txt b/test/samples/sample.objective-c.txt new file mode 100644 index 00000000..0b872747 --- /dev/null +++ b/test/samples/sample.objective-c.txt @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// + +#import "UseQuotes.h" +#import + +/* + Multi + Line + Comments +*/ +@implementation Test + +- (void) applicationWillFinishLaunching:(NSNotification *)notification +{ +} + +- (IBAction)onSelectInput:(id)sender +{ + NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0]; + + NSOpenPanel* panel = [NSOpenPanel openPanel]; + [panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"ipa", @"xcarchive", @"app", nil]]; + + [panel beginWithCompletionHandler:^(NSInteger result) + { + if (result == NSFileHandlingPanelOKButton) + [self.inputTextField setStringValue:[panel.URL path]]; + }]; + return YES; + + int hex = 0xFEF1F0F; + float ing = 3.14; + ing = 3.14e0; + ing = 31.4e-2; +} + +-(id) initWithParams:(id) aHandler withDeviceStateManager:(id) deviceStateManager +{ + // add a tap gesture recognizer + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; + NSMutableArray *gestureRecognizers = [NSMutableArray array]; + [gestureRecognizers addObject:tapGesture]; + [gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers]; + scnView.gestureRecognizers = gestureRecognizers; + + return tapGesture; + return nil; +} + +@end diff --git a/test/samples/sample.php.txt b/test/samples/sample.php.txt new file mode 100644 index 00000000..cdf362dc --- /dev/null +++ b/test/samples/sample.php.txt @@ -0,0 +1,82 @@ + + + + Example page + + + + + + +
    +Hello + + + + guest + +! +
    + +"); + + // display shuffled cards (EXAMPLE ONLY) + for ($index = 0; $index < 52; $index++) { + if ($starting_point == 52) { $starting_point = 0; } + print("Uncut Point: $deck[$index] "); + print("Starting Point: $deck[$starting_point]
    "); + $starting_point++; + } +?> + + + \ No newline at end of file diff --git a/test/samples/sample.plaintext.txt b/test/samples/sample.plaintext.txt new file mode 100644 index 00000000..6bf05d85 --- /dev/null +++ b/test/samples/sample.plaintext.txt @@ -0,0 +1,9 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus aliquet sapien, sed rhoncus leo ullamcorper ornare. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus feugiat eleifend nisl, aliquet rhoncus quam scelerisque vel. Morbi eu pellentesque ex. Nam suscipit maximus leo blandit cursus. Aenean sollicitudin nisi luctus, ornare nibh viverra, laoreet ex. Donec eget nibh sit amet dolor ornare elementum. Morbi sollicitudin enim vitae risus pretium vestibulum. Ut pretium hendrerit libero, non vulputate ante volutpat et. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam malesuada turpis vitae est porttitor, id tincidunt neque dignissim. Integer rhoncus vestibulum justo in iaculis. Praesent nec augue ut dui scelerisque gravida vel id velit. Donec vehicula feugiat mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. + +Praesent diam lorem, luctus quis ullamcorper non, consequat quis orci. Ut vel massa vel nunc sagittis porttitor a vitae ante. Quisque euismod lobortis imperdiet. Vestibulum tincidunt vehicula posuere. Nulla facilisi. Donec sodales imperdiet risus id ullamcorper. Nulla luctus orci tortor, vitae tincidunt urna aliquet nec. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam consequat dapibus massa. Sed ac pharetra magna, in imperdiet neque. Nullam nunc nisi, consequat vel nunc et, sagittis aliquam arcu. Aliquam non orci magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id sem ut sem pulvinar rhoncus. Aenean venenatis nunc eget mi ornare, vitae maximus lacus varius. Quisque quis vestibulum justo. + +Donec euismod luctus volutpat. Donec sed lacinia enim. Vivamus aliquam elit cursus, convallis diam at, volutpat turpis. Sed lacinia nisl in auctor dapibus. Nunc turpis mi, mattis ut rhoncus id, lacinia sed lectus. Donec sodales tellus quis libero gravida pretium et quis magna. Etiam ultricies mollis purus, eget consequat velit. Duis vitae nibh vitae arcu tincidunt congue. Maecenas ut velit in ipsum condimentum dictum quis eget urna. Sed mattis nulla arcu, vitae mattis ligula dictum at. + +Praesent at dignissim dolor. Donec quis placerat sem. Cras vitae placerat sapien, eu sagittis ex. Mauris nec luctus risus. Cras imperdiet semper neque suscipit auctor. Mauris nisl massa, commodo sit amet dignissim id, malesuada sed ante. Praesent varius sapien eget eros vehicula porttitor. + +Mauris auctor nunc in quam tempor, eget consectetur nisi rhoncus. Donec et nulla imperdiet, gravida dui at, accumsan velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin sollicitudin condimentum auctor. Sed lacinia eleifend nisi, id scelerisque leo laoreet sit amet. Morbi congue augue a malesuada pulvinar. Curabitur nec ante finibus, commodo orci vel, aliquam libero. Morbi molestie purus non nunc placerat fermentum. Pellentesque commodo ligula sed pretium aliquam. Praesent ut nibh ex. Vivamus vestibulum velit in leo suscipit, vitae pellentesque urna vulputate. Suspendisse pretium placerat ligula eu ullamcorper. Nam eleifend mi tellus, ut tristique ante ultricies vitae. Quisque venenatis dapibus tellus sit amet mattis. Donec erat arcu, elementum vel nisl at, sagittis vulputate nisi. \ No newline at end of file diff --git a/test/samples/sample.powershell.txt b/test/samples/sample.powershell.txt new file mode 100644 index 00000000..fa6bc20c --- /dev/null +++ b/test/samples/sample.powershell.txt @@ -0,0 +1,30 @@ +$SelectedObjectNames=@(); +$XenCenterNodeSelected = 0; +#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list +foreach($parameterSet in $ObjInfoArray) +{ + if ($parameterSet["class"] -eq "blank") + { + #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 + if ($XenCenterNodeSelected) + { + continue + } + $XenCenterNodeSelected = 1; + $SelectedObjectNames += "XenCenter" + } + elseif ($parameterSet["sessionRef"] -eq "null") + { + #When a disconnected server is selected there is no session information, we get null for everything except class + } + $SelectedObjectNames += "a disconnected server" + else + { + Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"] + #Use $class to determine which server objects to get + #-properties allows us to filter the results to just include the selected object + $exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"] + $obj = Invoke-Expression $exp + $SelectedObjectNames += $obj.name_label; + } +} \ No newline at end of file diff --git a/test/samples/sample.python.txt b/test/samples/sample.python.txt new file mode 100644 index 00000000..d811ccca --- /dev/null +++ b/test/samples/sample.python.txt @@ -0,0 +1,12 @@ +from banana import * + +class Monkey: + # Bananas the monkey can eat. + capacity = 10 + def eat(self, N): + '''Make the monkey eat N bananas!''' + capacity = capacity - N*banana.size + + def feeding_frenzy(self): + eat(9.25) + return "Yum yum" \ No newline at end of file diff --git a/test/samples/sample.r.txt b/test/samples/sample.r.txt new file mode 100644 index 00000000..50712cbd --- /dev/null +++ b/test/samples/sample.r.txt @@ -0,0 +1,41 @@ +# © Microsoft. All rights reserved. + +#' Add together two numbers. +#' +#' @param x A number. +#' @param y A number. +#' @return The sum of \code{x} and \code{y}. +#' @examples +#' add(1, 1) +#' add(10, 1) +add <- function(x, y) { + x + y +} + +add(1, 2) +add(1.0, 2.0) +add(-1, -2) +add(-1.0, -2.0) +add(1.0e10, 2.0e10) + + +#' Concatenate together two strings. +#' +#' @param x A string. +#' @param y A string. +#' @return The concatenated string built of \code{x} and \code{y}. +#' @examples +#' strcat("one", "two") +strcat <- function(x, y) { + paste(x, y) +} + +paste("one", "two") +paste('one', 'two') +paste(NULL, NULL) +paste(NA, NA) + +paste("multi- + line", + 'multi- + line') diff --git a/test/samples/sample.razor.txt b/test/samples/sample.razor.txt new file mode 100644 index 00000000..c2f33098 --- /dev/null +++ b/test/samples/sample.razor.txt @@ -0,0 +1,46 @@ +@{ + var total = 0; + var totalMessage = ""; + @* a multiline + razor comment embedded in csharp *@ + if (IsPost) { + + // Retrieve the numbers that the user entered. + var num1 = Request["text1"]; + var num2 = Request["text2"]; + + // Convert the entered strings into integers numbers and add. + total = num1.AsInt() + num2.AsInt(); + totalMessage = "Total = " + total; + } +} + + + + + Add Numbers + + + +

    Enter two whole numbers and then click Add.

    +
    +

    + +

    +

    + +

    +

    +
    + + @* now we call the totalMessage method + (a multi line razor comment outside code) *@ + +

    @totalMessage

    + +

    @(totalMessage+"!")

    + + An email address (with escaped at character): name@@domain.com + + + diff --git a/test/samples/sample.ruby.txt b/test/samples/sample.ruby.txt new file mode 100644 index 00000000..57b27921 --- /dev/null +++ b/test/samples/sample.ruby.txt @@ -0,0 +1,21 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft. All rights reserved. +#-------------------------------------------------------------------------- + +module Azure + module Blob + class Blob + + def initialize + @properties = {} + @metadata = {} + yield self if block_given? + end + + attr_accessor :name + attr_accessor :snapshot + attr_accessor :properties + attr_accessor :metadata + end + end +end \ No newline at end of file diff --git a/test/samples/sample.scss.txt b/test/samples/sample.scss.txt new file mode 100644 index 00000000..d19f9898 --- /dev/null +++ b/test/samples/sample.scss.txt @@ -0,0 +1,37 @@ +$baseFontSizeInPixels: 14; + +@function px2em ($font_size, $base_font_size: $baseFontSizeInPixels) { + @return ($font_size / $base_font_size) + em; +} + +h1 { + font-size: px2em(36, $baseFontSizeInPixels); +} +h2 { + font-size: px2em(28, $baseFontSizeInPixels); +} +.class { + font-size: px2em(14, $baseFontSizeInPixels); +} + +nav { + ul { + margin: 0; + padding: 0; + list-style: none; + } + + li { display: inline-block; } + + a { + display: block; + padding: 6px 12px; + text-decoration: none; + } + + @each $animal in puma, sea-slug, egret, salamander { + .#{$animal}-icon { + background-image: url('/images/#{$animal}.png'); + } + } +} \ No newline at end of file diff --git a/test/samples/sample.sql.txt b/test/samples/sample.sql.txt new file mode 100644 index 00000000..c47a8504 --- /dev/null +++ b/test/samples/sample.sql.txt @@ -0,0 +1,52 @@ +CREATE TABLE dbo.EmployeePhoto +( + EmployeeId INT NOT NULL PRIMARY KEY, + Photo VARBINARY(MAX) FILESTREAM NULL, + MyRowGuidColumn UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL + UNIQUE DEFAULT NEWID() +); + +GO + +/* +text_of_comment +/* nested comment */ +*/ + +-- line comment + +CREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID + ON Production.WorkOrder(ProductID) + WITH (FILLFACTOR = 80, + PAD_INDEX = ON, + DROP_EXISTING = ON); +GO + +WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300 +BEGIN + UPDATE Production.Product + SET ListPrice = ListPrice * 2 + SELECT MAX(ListPrice) FROM Production.Product + IF (SELECT MAX(ListPrice) FROM Production.Product) > $500 + BREAK + ELSE + CONTINUE +END +PRINT 'Too much for the market to bear'; + +MERGE INTO Sales.SalesReason AS [Target] +USING (VALUES ('Recommendation','Other'), ('Review', 'Marketing'), ('Internet', 'Promotion')) + AS [Source] ([NewName], NewReasonType) +ON [Target].[Name] = [Source].[NewName] +WHEN MATCHED +THEN UPDATE SET ReasonType = [Source].NewReasonType +WHEN NOT MATCHED BY TARGET +THEN INSERT ([Name], ReasonType) VALUES ([NewName], NewReasonType) +OUTPUT $action INTO @SummaryOfChanges; + +SELECT ProductID, OrderQty, SUM(LineTotal) AS Total +FROM Sales.SalesOrderDetail +WHERE UnitPrice < $5.00 +GROUP BY ProductID, OrderQty +ORDER BY ProductID, OrderQty +OPTION (HASH GROUP, FAST 10); diff --git a/test/samples/sample.swift.txt b/test/samples/sample.swift.txt new file mode 100644 index 00000000..fad5a5eb --- /dev/null +++ b/test/samples/sample.swift.txt @@ -0,0 +1,50 @@ +import Foundation + +protocol APIControllerProtocol { + func didReceiveAPIResults(results: NSArray) +} + +class APIController { + var delegate: APIControllerProtocol + + init(delegate: APIControllerProtocol) { + self.delegate = delegate + } + + func get(path: String) { + let url = NSURL(string: path) + let session = NSURLSession.sharedSession() + let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in + println("Task completed") + if(error != nil) { + // If there is an error in the web request, print it to the console + println(error.localizedDescription) + } + var err: NSError? + if let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as? NSDictionary { + if(err != nil) { + // If there is an error parsing JSON, print it to the console + println("JSON Error \(err!.localizedDescription)") + } + if let results: NSArray = jsonResult["results"] as? NSArray { + self.delegate.didReceiveAPIResults(results) + } + } + }) + + // The task is just an object with all these properties set + // In order to actually make the web request, we need to "resume" + task.resume() + } + + func searchItunesFor(searchTerm: String) { + // The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs + let itunesSearchTerm = searchTerm.stringByReplacingOccurrencesOfString(" ", withString: "+", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil) + + // Now escape anything else that isn't URL-friendly + if let escapedSearchTerm = itunesSearchTerm.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) { + let urlPath = "https://itunes.apple.com/search?term=\(escapedSearchTerm)&media=music&entity=album" + } + } + +} \ No newline at end of file diff --git a/test/samples/sample.typescript.txt b/test/samples/sample.typescript.txt new file mode 100644 index 00000000..0bc28fad --- /dev/null +++ b/test/samples/sample.typescript.txt @@ -0,0 +1,124 @@ +/* Game of Life + * Implemented in TypeScript + * To learn more about TypeScript, please visit http://www.typescriptlang.org/ + */ + +module 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 + } + } + + export class GameOfLife { + private gridSize: number; + private canvasSize: number; + private lineColor: string; + private liveColor: string; + private deadColor: string; + private initialLifeProbability: number; + private animationRate: number; + private cellSize: number; + private context: CanvasRenderingContext2D; + private world; + + + constructor() { + this.gridSize = 50; + this.canvasSize = 600; + this.lineColor = '#cdcdcd'; + this.liveColor = '#666'; + this.deadColor = '#eee'; + this.initialLifeProbability = 0.5; + this.animationRate = 60; + this.cellSize = 0; + 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]; + this.draw(cell); + 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); + if(count < 2 || count > 3) newCell.live = false; + else if(count == 3) newCell.live = true; + return newCell; + } + + public countNeighbors(cell : Cell) { + var neighbors = 0; + for(var row = -1; row <=1; row++) { + for(var col = -1; col <= 1; col++) { + if(row == 0 && col == 0) continue; + if(this.isAlive(cell.row + row, cell.col + col)) { + neighbors++; + } + } + } + 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++) { + var rowData = []; + for(var col = 0; col < this.gridSize; col++) { + 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) { + canvas = document.createElement('canvas'); + canvas.id = 'conway-canvas'; + canvas.width = this.canvasSize; + canvas.height = this.canvasSize; + document.body.appendChild(canvas); + } + return canvas.getContext('2d'); + } + } +} + +var game = new Conway.GameOfLife(); diff --git a/test/samples/sample.vb.txt b/test/samples/sample.vb.txt new file mode 100644 index 00000000..c624adea --- /dev/null +++ b/test/samples/sample.vb.txt @@ -0,0 +1,59 @@ +Imports System +Imports System.Collections.Generic + +Module Module1 + + Sub Main() + Dim a As New M8Ball + + Do While True + + Dim q As String = "" + Console.Write("ask me about the future... ") + q = Console.ReadLine() + + If q.Trim <> "" Then + Console.WriteLine("the answer is... {0}", a.getAnswer(q)) + Else + Exit Do + End If + Loop + + End Sub + +End Module + +Class M8Ball + + Public Answers As System.Collections.Generic.Dictionary(Of Integer, String) + + Public Sub New() + Answers = New System.Collections.Generic.Dictionary(Of Integer, String) + Answers.Add(0, "It is certain") + Answers.Add(1, "It is decidedly so") + Answers.Add(2, "Without a doubt") + Answers.Add(3, "Yes, definitely") + Answers.Add(4, "You may rely on ") + Answers.Add(5, "As I see it, yes") + Answers.Add(6, "Most likely") + Answers.Add(7, "Outlook good") + Answers.Add(8, "Signs point to yes") + Answers.Add(9, "Yes") + Answers.Add(10, "Reply hazy, try again") + Answers.Add(11, "Ask again later") + Answers.Add(12, "Better not tell you now") + Answers.Add(13, "Cannot predict now") + Answers.Add(14, "Concentrate and ask again") + Answers.Add(15, "Don't count on it") + Answers.Add(16, "My reply is no") + Answers.Add(17, "My sources say no") + Answers.Add(18, "Outlook not so") + Answers.Add(19, "Very doubtful") + End Sub + + Public Function getAnswer(theQuestion As String) As String + Dim r As New Random + Return Answers(r.Next(0, 19)) + End Function + +End Class diff --git a/test/samples/sample.xml.txt b/test/samples/sample.xml.txt new file mode 100644 index 00000000..16a304c9 --- /dev/null +++ b/test/samples/sample.xml.txt @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/smoketest-release.html b/test/smoketest-release.html new file mode 100644 index 00000000..db0f1a96 --- /dev/null +++ b/test/smoketest-release.html @@ -0,0 +1,53 @@ + + + + + + + + + +

    Smoke Test (running from release)

    + +[MULTIPLE SOURCES] + |  +[RELEASED] + |  +[SMOKETEST] +

    + +
    +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/test/smoketest.js b/test/smoketest.js new file mode 100644 index 00000000..2afa88b8 --- /dev/null +++ b/test/smoketest.js @@ -0,0 +1,165 @@ +/// +define([], function() { + +var actions = (function() { + "use strict"; + + return [ + { + name: 'Undo', + run: function (editor) { + editor.trigger('keyboard', monaco.editor.Handler.Undo); + } + }, + { + name: 'type & suggest', + run: function (editor) { + editor.setPosition({ + lineNumber: 1, + column: 1 + }); + var firstChar = editor.getModel().getLineContent(1).charAt(0); + editor.trigger('keyboard', monaco.editor.Handler.CursorEnd); + editor.trigger('keyboard', monaco.editor.Handler.Type, { + text: '\n' + firstChar + }); + editor.focus(); + editor.trigger('test', 'editor.action.triggerSuggest'); + } + }, + { + name: 'links', + run: function (editor) { + editor.setPosition({ + lineNumber: 1, + column: 1 + }); + var commentsSupport = editor.getModel().getMode().commentsSupport; + var text = 'http://www.test.com'; + if (commentsSupport) { + var commentsConfig = commentsSupport.getCommentsConfiguration(); + if (commentsConfig && commentsConfig.lineCommentTokens) { + text = commentsConfig.lineCommentTokens[0] + ' ' + text; + } else if (commentsConfig && commentsConfig.blockCommentStartToken) { + text = commentsConfig.blockCommentStartToken + ' ' + text + ' ' + commentsConfig.blockCommentEndToken; + } + } + editor.trigger('keyboard', monaco.editor.Handler.Type, { + text: text + '\n' + }); + } + }, + { + name: 'multicursor', + run: function (editor) { + editor.setPosition({ + lineNumber: 1, + column: 1 + }); + editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown); + editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown); + editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown); + editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown); + editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown); + editor.trigger('keyboard', monaco.editor.Handler.Type, { + text: 'some text - ' + }); + } + } + ]; +})(); + +var panelContainer = document.getElementById('control'); +var editorContainer = document.getElementById('editor'); +var editors = {}, models = {}; + +function onError(err) { + console.error(err); + alert('error!!'); +} + +function getAllModes() { + var result = monaco.languages.getLanguages().map(function(language) { return language.id; }); + result.sort(); + return result; +} + +function createEditor(container, mode) { + editors[mode] = monaco.editor.create(container, { + value: mode + }); + xhr('samples/sample.' + mode + '.txt').then(function(response) { + var value = mode + '\n' + response.responseText; + var model = monaco.editor.createModel(value, mode); + editors[mode].setModel(model); + }); +} + +function createEditors(modes) { + for (var i = 0; i < modes.length; i++) { + var container = document.createElement('div'); + container.style.width = '300px'; + container.style.cssFloat = 'left'; + container.style.height = '200px'; + container.style.border = '1px solid #ccc'; + container.style.background = 'red'; + container.setAttribute('data-mime', modes[i]); + editorContainer.appendChild(container); + createEditor(container, modes[i]); + } + + var clearer = document.createElement('div'); + clearer.style.clear = 'both'; + editorContainer.appendChild(clearer); +} + +function executeAction(action) { + for (var mime in editors) { + if (editors.hasOwnProperty(mime)) { + action(editors[mime]); + } + } +} + +function createActions(actions) { + for (var i = 0; i < actions.length; i++) { + var btn = document.createElement('button'); + btn.appendChild(document.createTextNode('<<' + actions[i].name + '>>')); + btn.onclick = executeAction.bind(this, actions[i].run); + panelContainer.appendChild(btn); + } +} + +createEditors(getAllModes()); +createActions(actions); + +function xhr(url) { + var req = null; + return new monaco.Promise(function(c,e,p) { + req = new XMLHttpRequest(); + req.onreadystatechange = function () { + if (req._canceled) { return; } + + if (req.readyState === 4) { + if ((req.status >= 200 && req.status < 300) || req.status === 1223) { + c(req); + } else { + e(req); + } + req.onreadystatechange = function () { }; + } else { + p(req); + } + }; + + req.open("GET", url, true ); + req.responseType = ""; + + req.send(null); + }, function () { + req._canceled = true; + req.abort(); + }); +} + +}); \ No newline at end of file