NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Web Im show deleted messages // @namespace http://tampermonkey.net/ // @version 1.0.2 // @description Показывает удаленные сообщения (только если открыт диалог) // @author Flyink13 // @match https://*.vk.com/* // @copyright 2018, flyink13 (https://openuserjs.org/users/flyink13) // @updateURL https://openuserjs.org/meta/flyink13/Web_Im_show_deleted_messages.meta.js // @license MIT // ==/UserScript== /* global geByClass1 */ function showDeletedMessages() { var flagDelete = 1 << 7; var typeUpdateFlag = 2; XMLHttpRequest.prototype.send = (function buildFakeSend(sendOrg) { return function fakeSend(...sendArgs) { var self = this; self.onreadystatechange = (function buildFakeOnChang(changeOrg) { if (!changeOrg) return; return function fakeOnReadyStateChange (...changeArgs) { var isLongPoll = (/^https:\/\/.?im(v4)?\.vk\.com\/.?im\d+/.test(self.responseURL)); var isReady = (self.readyState == 4); if (isLongPoll && isReady && self.responseText) { try { let newJson = JSON.parse(self.responseText); newJson.updates.forEach((update) => { var isDelete = (update[0] == typeUpdateFlag && update[2] & flagDelete); if (isDelete) { var el = geByClass1('_im_mess_' + update[1]); if (el) { var newEl = el.cloneNode(true); el.style.opacity = 0.5; el.parentElement.insertBefore(newEl, el); } } return !isDelete; }); // тут пробовал заменять self.responseText но ничего не вышло :C } catch(e) {} } return changeOrg.apply(self, changeArgs); }; })(self.onreadystatechange); return sendOrg.apply(self, sendArgs); }; })(XMLHttpRequest.prototype.send); } (function injectScript() { var script = document.createElement('script'); var code = '(' + showDeletedMessages + ')();'; script.appendChild(document.createTextNode(code)); (document.body || document.head || document.documentElement).appendChild(script); })();