(implemented—and for group-only deletion, remember you can sort message inbox by usergroups)

Problems immediately solved:

  • inbox stuffed with messages (especially of the edev kind)
  • too many bookmarks (the JavaScript solution in this node is far superior to this way)

The code is simple and flexible. It goes through all the tags in the current document. For each one that has a 'name' attribute which matches a given regex, an operation is performed. In both scripts below, the tags are checkboxes and the operation is setting them as checked. (A helpful additional feature is the printing of the text around each tag that is so checked, although this is only really helpful if you're using a shell as mentioned below.) It could solve any similar problem with minor modification.


I used the bookmarklet version of this Javascript Shell opened from the relevant page (Message Inbox, "(edit user information)" from homenode). Hopefully someone more familiar with the system can add these right in to E2. (Remember you need to use the edev JavaScript escaper. Also, the print() calls won't work outside of the JavaScript shell and should be removed.)

check Message Inbox "Archive" checkboxes

var elem_regex = /^archive_/;
var hide_regex = 0;  //  /\(edev\)/;

var allTags = document.getElementsByTagName("*");
var checkedTags = 0;

for (var k = 0; k < allTags.length; k++) {
	if (!allTags[k].attributes['name']) continue;
	if (!allTags[k].attributes['name'].value.match(elem_regex)) continue;
	allTags[k].checked = true;
	checkedTags++;
	
	var msg = allTags[k].parentNode.parentNode.innerHTML;
	msg = msg.replace(/<.*?>/g, '').replace(/&nbsp;/g, ' ');
	if (hide_regex && msg.match(hide_regex)) continue;
	print(msg); print('-----------');
} print('done: ' + checkedTags + ' messages checked');

check (edit user information) "remove bookmark" checkboxes

var elem_regex = /^unbookmark_/;
var print_bookmarks = 1;

var allTags = document.getElementsByTagName("*");
var checkedTags = 0;

for (var k = 0; k < allTags.length; k++) {
	if (!allTags[k].attributes['name']) continue;
	if (!allTags[k].attributes['name'].value.match(elem_regex)) continue;
	allTags[k].checked = true;
	checkedTags++;
	
	var msg = allTags[k].parentNode.parentNode.innerHTML;
	msg = msg.replace(/<.*?>/g, '').replace(/&nbsp;/g, ' ');
	if (!print_bookmarks) continue;
	print(msg);
} print('done: ' + checkedTags + ' bookmarks checked');

Note the very few differences — elem_regex is different (archive_* vs. unbookmark_*), and the bookmarks just use a blanket conditional (print_bookmarks) instead of the selective hiding regex used for messages (hide_regex).


And how could I have forgotten -- deleting only edev messages!

var elem_regex = /^deletemsg_/;
var dele_regex = /\(edev\)/;

var allTags = document.getElementsByTagName("*");
var checkedTags = 0;

for (var k = 0; k < allTags.length; k++) {
	if (!allTags[k].attributes['name']) continue;
	if (!allTags[k].attributes['name'].value.match(elem_regex)) continue;

	var msg = allTags[k].parentNode.parentNode.innerHTML;
	msg = msg.replace(/<.*?>/g, '').replace(/&nbsp;/g, ' ');
	if (msg.match(dele_regex)) {
		allTags[k].checked = true;
		checkedTags++;
		print(msg); print('-----------');
	}
} print('done: ' + checkedTags + ' edev messages marked for deletion');

I also made a bookmarklet out of these three things. It's in my scratch pads -- demenialization bookmarklet.

Log in or register to write something here or to contact authors.