Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgs4dvxq6j7jv57friends_off.jsJavaScript
/*
* Lampa plugin: friends_off
* Removes the CUB "Друзі / Друзья / Friends" entry from the menu,
* the header (next to the account button) and settings.
* Does not touch sync, bookmarks or the account itself.
*/
(function () {
'use strict';
if (window.__friends_off) return;
window.__friends_off = true;
var TEXT = /^\s*(друзі|друзья|friends)\s*$/i;
var ATTR = /friend/i;
// Containers where Lampa puts menu / header / settings entries
var SELECTOR = '.menu__item, .head__action, .head__button, .settings-folder, .settings-param, .selector';
function isFriends(el) {
try {
var attrs = [
el.getAttribute('data-action'),
el.getAttribute('data-component'),
el.getAttribute('data-name'),
el.getAttribute('data-type'),
el.id,
typeof el.className === 'string' ? el.className : ''
].join(' ');
if (ATTR.test(attrs)) return true;
var label = el.querySelector('.menu__text, .settings-folder__name, .settings-param__name');
var txt = label ? label.textContent : el.textContent;
return TEXT.test(txt || '');
} catch (e) {
return false;
}
}
function clean(root) {
var nodes = (root && root.querySelectorAll ? root : document).querySelectorAll(SELECTOR);
for (var i = 0; i < nodes.length; i++) {
var el = nodes[i];
if (isFriends(el)) {
if (el.parentNode) el.parentNode.removeChild(el);
}
}
}
var timer = null;
function schedule() {
if (timer) return;
timer = setTimeout(function () {
timer = null;
clean(document);
}, 150);
}
function start() {
clean(document);
new MutationObserver(schedule).observe(document.body, {
childList: true,
subtree: true
});
}
if (document.body) start();
else document.addEventListener('DOMContentLoaded', start);
})();
2,104 chars · codepastes.com