/ Published in: JavaScript
This is based on the [Sort Gmail Messages By Bookmarklet](http://snipplr.com/view/10432/sort-gmail-messages-by-subject/ "Sort Gmail Messages By Bookmarklet - http://snipplr.com/view/10432/sort-gmail-messages-by-subject/") snippet.
Drag this into your Bookmarks: [SortGmailBySender](javascript:(function(){function%20f(r){var%20t=r.getElementsByTagName("span");var%20i;for(i=0;i
Drag this into your Bookmarks: [SortGmailBySender](javascript:(function(){function%20f(r){var%20t=r.getElementsByTagName("span");var%20i;for(i=0;i
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
javascript:(function(){function%20f(r){var%20t=r.getElementsByTagName("span");var%20i;for(i=0;i<t.length;i++){if(t[i].hasAttribute("email")){return%20t[i].innerHTML}}return%20""}function%20ds(a,b){a=a[0].toLowerCase();b=b[0].toLowerCase();if(a<b)return%20-1;if(a>b)return%201;return%200}function%20sl(m){var%20l=Array.prototype.slice.call(m.getElementsByTagName("tr"),0);if(!l.length)return;var%20b=l[0].parentNode;var%20s=[];for(var%20i=0;i<l.length;i++){s[i]=[f(l[i]),l[i]]}s=s.sort(ds);for(i=0;i<s.length;i++){b.appendChild(s[i][1])}}var%20m=document.getElementById('canvas_frame').contentWindow.document.getElementById(":on");if(m)sl(m)})() // Expanded Script javascript:(function(){ function findFrom(r) { var span = r.getElementsByTagName("span"); var i; for (i = 0; i < span.length; i++) { if (span[i].hasAttribute("email")) { return span[i].innerHTML; } } return ""; } function doSort(a,b) { a = a[0].toLowerCase(); b = b[0].toLowerCase(); if(a<b) return -1; if(a>b) return 1; return 0; } function sortList(m) { var list = Array.prototype.slice.call(m.getElementsByTagName("tr"), 0); if(!list.length) return; var tbody = list[0].parentNode; var sortList = []; for(var i=0; i<list.length; i++) { sortList[i] = [findFrom(list[i]),list[i]]; } sortList = sortList.sort(doSort); for(i=0; i<sortList.length; i++) { tbody.appendChild(sortList[i][1]); } } var messages = document.getElementById('canvas_frame').contentWindow.document.getElementById(":on"); if(messages) sortList(messages); })()