From dc3de2a3caaf986800800dab2d02619038911035 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 21 Nov 2014 08:54:48 -0200 Subject: [PATCH] make ua-spoofing code easier to read from dev tools --- src/js/contentscript-start.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index d09efc7..80da5d8 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -144,22 +144,22 @@ var messaging = (function(name){ // https://github.com/gorhill/httpswitchboard/issues/252 var navigatorSpoofer = " \ -;(function() { \ - try { \ - /* https://github.com/gorhill/uMatrix/issues/61#issuecomment-63814351 */ \ - var navigator = window.navigator; \ - var spoofedUserAgent = {{ua-json}}; \ - if ( spoofedUserAgent === navigator.userAgent ) { \ - return; \ - } \ - var pos = spoofedUserAgent.indexOf('/'); \ - var appName = pos === -1 ? '' : spoofedUserAgent.slice(0, pos); \ - var appVersion = pos === -1 ? spoofedUserAgent : spoofedUserAgent.slice(pos + 1); \ - Object.defineProperty(navigator, 'userAgent', { get: function(){ return spoofedUserAgent; } }); \ - Object.defineProperty(navigator, 'appName', { get: function(){ return appName; } }); \ - Object.defineProperty(navigator, 'appVersion', { get: function(){ return appVersion; } }); \ - } catch (e) { \ - } \ +;(function() { \n \ + try { \n \ + /* https://github.com/gorhill/uMatrix/issues/61#issuecomment-63814351 */ \n \ + var navigator = window.navigator; \n \ + var spoofedUserAgent = {{ua-json}}; \n \ + if ( spoofedUserAgent === navigator.userAgent ) { \n \ + return; \n \ + } \n \ + var pos = spoofedUserAgent.indexOf('/'); \n \ + var appName = pos === -1 ? '' : spoofedUserAgent.slice(0, pos); \n \ + var appVersion = pos === -1 ? spoofedUserAgent : spoofedUserAgent.slice(pos + 1); \n \ + Object.defineProperty(navigator, 'userAgent', { get: function(){ return spoofedUserAgent; } }); \n \ + Object.defineProperty(navigator, 'appName', { get: function(){ return appName; } }); \n \ + Object.defineProperty(navigator, 'appVersion', { get: function(){ return appVersion; } }); \n \ + } catch (e) { \n \ + } \n \ })();"; /******************************************************************************/