Last active
December 23, 2015 15:39
-
-
Save juque/6656700 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BulkIntercom | |
// ------------ | |
// Author: Juan Pablo Aqueveque - juque.cl | |
// | |
// | |
// Bulk method for archiving intercom.io messages. | |
// | |
// Tired of clicking checkbox fields | |
// and scrolling to the bottom time and again to | |
// the end of times?. | |
// Try this from your browser console: | |
// Target | |
var $table = $('#MessageThreadBody'); | |
var when = $table.find('.when'); | |
// regular expression, all messages 29 days old. | |
// this could be: "1 month" or "2 months" or "months" | |
// or all together maybe: | |
// var rg = /5 days|1 month|2 months/ | |
var rg = /29 days/ | |
// finding, triggering and checking field | |
$.each(when,function(index,value){ | |
var txt = $(value).find('time').text(); | |
if ( txt.match(rg) ) { | |
var cb = $(value).parent('tr').find('input[type=checkbox]'); | |
cb.trigger('click').attr('checked',true); | |
} | |
}); | |
// and now... click the "Close" button and go take a nap. | |
// | |
// version: Looking for messages from user | |
// --------------------------------------- | |
// | |
// var $table = $('#MessageThreadBody'); | |
// var fromUser = $table.find('.from_user'); | |
// var rg = /Sergey Brin/ | |
// $.each(fromUser,function(index,value){ | |
// var txt = $(value).text(); | |
// if ( txt.match(rg) ) { | |
// var cb = $(value).parent('tr').find('input[type=checkbox]'); | |
// cb.trigger('click').attr('checked',true); | |
// } | |
// }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment