1. Список говнокодов пользователя kaktus

    Всего: 1

  2. JavaScript / Говнокод #18179

    +143

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    } else if(hostname.indexOf('.google.')>-1){
    		/* Google */
    
    
    		if(hostname.startsWith('docs.google.') || hostname.startsWith('drive.google.')){
    			document.addEventListener('DOMContentLoaded', function() {
    				var target = document.querySelector('#drive_main_page [aria-live="assertive"]');
    
    				var observer = new MutationObserver(function(mutations) {
    					mutations.forEach(function(mutation) {
    						if(mutation.type == 'childList' &&
    							mutation.addedNodes.length == 1 &&
    							mutation.addedNodes[0].innerHTML.match(/\/\/support.google.com\/drive\/\?p=system_requirements"/)){
    							mutation.target.innerHTML = '';
    							observer.disconnect();
    						}
    					});
    				});
    
    				console.log('Google, please make sure your obfuscator does not change class names, so our patch continues working (or stop browser-sniffing as we both use and contribute to Blink!) - love, Opera.');
    				observer.observe(target, {childList: true, subtree:true});
    			}, false)
    
    			log('PATCH-1191, Still an "unsupported browser" according to Google');
    		}
    		if(hostname.startsWith('mail.google.')){
    			addCssToDocument2('div.n6 {display: block !important} table.cf.hX{display:inline-table}');//"more", labels
    			log('PATCH-1163, No "More" button in Gmail and misaligned labels');
    		}
    		if(hostname.startsWith('translate.google.')){
    			document.addEventListener('DOMContentLoaded',
    				function(){
    					var obj = '<object type="application/x-shockwave-flash" data="//ssl.gstatic.com/translate/sound_player2.swf" width="18" height="18" id="tts"><param value="//ssl.gstatic.com/translate/sound_player2.swf" name="movie"><param value="sound_name_cb=_TTSSoundFile" name="flashvars"><param value="transparent" name="wmode"><param value="always" name="allowScriptAccess"></object>';
    					var aud = document.getElementById('tts');
    					if(aud && aud instanceof HTMLAudioElement && aud.parentNode.childNodes.length == 1){
    						aud.parentNode.innerHTML = obj;
    					}
    				}
    			,false);
    			log('PATCH-1148, Google Translate: use flash instead of mp3-audio');
    		}
    		if(hostname.startsWith('www.google.') || hostname.startsWith('google.')){
    			addCssToDocument2('#prt {visibility:hidden}')
    			log('PATCH-1197, Hide Chrome ad from main Google page');
    		}
    		if(pathname.indexOf('hangouts')==-1){
    			var _newUA = navigator.userAgent.replace(/ ?OPR.[0-9.]*/, '');
    			Object.defineProperty(window.navigator, "userAgent", {
    				get: function() {return _newUA}
    			});
    
    			log('PATCH-1176, Navigation keys are not working on Google - hide Opera tag from userAgent for all sites except hangouts');
    		}
    	} else if(hostname.indexOf('.youtube.com')>-1){
    		addCssToDocument2('#movie_player { z-index: 100 !important; }');
    		log('PATCH-1185, youtube.com - show video above playlist');
    	}

    Кажется, кто-то продолжает есть меня, несмотря на колючки. Кто угадает, откуда этот код, тому ничего.

    kaktus, 16 Мая 2015

    Комментарии (4)