Home > HowTo > facebook delete all messages button

facebook delete all messages button

I find it really really anoying that facebook removed the “Delete All” button.
For me its clear that they do not want anyone to remove the messages, so they
can sell this information to anyone who is willing to pay and make adds.

Well I found the solution, using Chrome

Click on the INSTALL on this page:
http://userscripts.org/scripts/show/106261

In case they remove it from that site I keep the code down here:

// ==UserScript==
// @name Facebook: Message quick-delete buttons
// @description Adds a direct delete button to message threads and replace the “archive” button with a immediate delete button.
// @namespace privacyplease
// @include http://*.facebook.com/*
// @include https://*.facebook.com/*
// @require http://code.jquery.com/jquery-1.3.2.min.js
//
// ==/UserScript==

// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement(“script”);
script.setAttribute(“src”, “http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”);
script.addEventListener(‘load’, function() {
var script = document.createElement(“script”);
script.textContent = “(” + callback.toString() + “)();”;
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}

function switchDeleteButtons() {
var q = jQuery;
// Restore global $ variable for sanity.
$.noConflict();
var running = false;
var run = function() {
if (running) return;
if (!document.getElementById(“MessagingDashboard”)) return;
running = true;
try {
if (document.getElementById(“MessagingShelf”)) {
// console.log(“Detected MessagingShelf.”);
if (!document.getElementById(“QuickDelete”)) {
var actions = q(“#MessagingFrame”).find(‘form[class~=”uiHeaderActions”]’);
var tid;
actions.find(‘input[name=”tid”]’).each(function() {
// console.log(“Have tid:”+q(this).attr(“value”));
tid=q(this).attr(“value”);
});
if (tid) {
var elem = q(‘Delete All‘);
elem.attr(“href”,”/ajax/messaging/async.php?action=deleteDialog&tid=”+encodeURIComponent(tid));
elem.attr(“ajaxify”,”/ajax/messaging/async.php?action=deleteDialog&tid=”+encodeURIComponent(tid));
// console.log(elem, actions.find(‘div[class~=”uiToolbarContent”]’));
elem.insertBefore(actions.find(‘div[class~=”uiToolbarContent”]’).children().children().first());
}
}
} else {
// console.log(“Looking for archive buttons to replace.”);
// Avoid false positives by class and structure matching. Better than URLs.
q(document).find(‘li[class~=”threadRow”]’).each(function() {
q(this).find(‘a[class~=”archiveLink”]’).each(function() {
var a = q(this);
var url = a.attr(“ajaxify”);
url = url.replace(“action=tag&”,”action=delete&”);
a.attr(“ajaxify”, url);

a.find(‘span[class~=”uiTooltipText”]’).html(“DELETE
INSTANTLY”);
a.find(‘input’).attr(“value”, “D”);
var l = a.find(‘label[class~=”uiCloseButton”]’);
var old = l.attr(“class”);
if (old) {
l.attr(“class”, old.replace(“uiCloseButton”, “uiDeleteButton”));
}
});
});
}
}catch(e){console.log(“Exception:”, e);};
running = false;
};

run();
jQuery(document).ready(run);
jQuery(document).bind(“DOMNodeInserted”, run);
}

// load jQuery and execute the main function
addJQuery(switchDeleteButtons);

  1. hynt
    March 1st, 2015 at 20:58 | #1

    tnx.. great
    peace & karma +

  1. No trackbacks yet.

VAMOVE *

*