Created
January 31, 2012 21:06
-
-
Save XP1/1712912 to your computer and use it in GitHub Desktop.
Fix MSNBC: Fixes MSNBC's Adobe Flash detection by fixing the `UberSniff` function and by browser spoofing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fix MSNBC | |
// @version 1.01 | |
// @description Fixes MSNBC's Adobe Flash detection by fixing the `UberSniff` function and by browser spoofing. | |
// @author XP1 (https://github.com/XP1/) | |
// @namespace https://gist.github.com/1712912/ | |
// @include http*://msnbc.msn.com/* | |
// @include http*://*.msnbc.msn.com/* | |
// ==/UserScript== | |
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */ | |
(function (window) | |
{ | |
"use strict"; | |
function removeEventListenerAfterFiring(numberOfTimes, callback) | |
{ | |
var remaining = numberOfTimes; | |
return function listener(event) | |
{ | |
remaining -= 1; | |
if (remaining <= 0) | |
{ | |
var target = event.target; | |
var type = event.type; | |
target.removeEventListener(type, listener, false); | |
target.removeEventListener(type, listener, true); | |
} | |
callback(); | |
}; | |
} | |
function enhanceUberSniff() | |
{ | |
window.UberSniff.prototype.opera = true; | |
} | |
function spoofBrowser() | |
{ | |
window.navigator.userAgent += " Mozilla/5.0 Firefox"; | |
} | |
function initialize() | |
{ | |
enhanceUberSniff(); | |
spoofBrowser(); | |
} | |
window.addEventListener("DOMContentLoaded", removeEventListenerAfterFiring(1, initialize), false); | |
}(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I posted this user JS in these threads:
Why does this site insist I don't have Flash when using Opera?:
http://my.opera.com/community/forums/topic.dml?id=1045672
Resolving MSNBC Site Quirks...:
http://my.opera.com/community/forums/topic.dml?id=1288942