// ==UserScript== // @name Unbreak Snapchat web. Disable focus tracking, screenshot prevention, and enable video downloads // @name:zh-CN 修复Snapchat网络版:禁用焦点追踪、屏幕截图防护,并启用视频下载 // @namespace http://tampermonkey.net/ // @version 0.1.4.1 // @description Improve the Snapchat web experience by disabling screenshot prevention features which don't prevent screenshots but do actively harm the usability. And enabling video downloads // @description:zh-CN 通过禁用防护功能并启用视频下载,改善Snapchat网络版的体验。 // @homepage https://gist.github.com/varenc/20e4dbfe8e7a2cc305043ffcbc5454d0 // @author https://github.com/varenc // @match https://web.snapchat.com/* // @match https://www.snapchat.com/web/* // @icon http://snapchat.com/favicon.ico // @license MIT // @run-at document-idle // @grant none // @downloadURL https://update.greasyfork.cloud/scripts/468156/Unbreak%20Snapchat%20web%20Disable%20focus%20tracking%2C%20screenshot%20prevention%2C%20and%20enable%20video%20downloads.user.js // @updateURL https://update.greasyfork.cloud/scripts/468156/Unbreak%20Snapchat%20web%20Disable%20focus%20tracking%2C%20screenshot%20prevention%2C%20and%20enable%20video%20downloads.meta.js // ==/UserScript== (function() { 'use strict'; function __unblockControlKeyEvents() { const events = ["keydown", "keyup", "keypress"]; const modifyKeys = ["Control", "Meta", "Alt", "Shift"]; for (var i = 0; i < events.length; i++) { var event_type = events[i]; document.addEventListener( event_type, function (e) { // console.log(`${event_type}[${i}]=`, e.key); if (modifyKeys.includes(e.key)) { e.preventDefault(); e.stopPropagation(); console.log(`'${event_type}' event for '${e.key}' received and prevented:`, e); e.stopImmediatePropagation(); } }, true ); } } function __unblockEvent() { for (var i = 0; i < arguments.length; i++) { var event_type = arguments[i]; document.addEventListener( arguments[i], function (e) { // e.preventDefault(); e.stopPropagation(); console.log(`'${event_type}' event received and prevented:`, e); // e.stopImmediatePropagation(); }, true ); } } function __fixConsole() { // snapchat tries to disable console.log.. how mean. So we copy the real Console object from a new iframe const iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe); const nativeConsole = iframe.contentWindow.console; window.console = nativeConsole; } function __enableVideoDownloads() { // Process all videos on the page, making them downloadable and fully functional document.querySelectorAll("video").forEach((video, index) => { console.log(`VideoFixer: Processing