Estaba analizando un script para borrar posts y demases de facebook mediante consola, pero a la hora de ejecutarlo me sale el siguiente error:
Uncaught TypeError: $(...).css is not a function
En esta línea:
$('[placeholder="Search Facebook"]').css('color','#fff').css('background-color','#000');
Para ver esto, lo primero que hago es ir al ActivityLog
del perfil de Facebook
:
Código completo:
var deleted = 0;
function delete_new() {
$('[placeholder="Search Facebook"]').css('color','#fff').css('background-color','#000');
try {
throttle = parseFloat(throttle);
}
catch(ex) {
throttle = 1;
}
active = 1;
chrome.storage.local.set({active: 1}, function() {});
var all_action_options = [];
var dots = -1;
var dots_txt = '';
set_interval_id = setInterval(function(){
// remove empties - links only
$('[aria-label="List of Activity Log Items"]').find('[role="link"]').each(function(){
if($(this).parent().parent().find('[aria-label="Action options"]').length == 0) {
$(this).parent().parent().remove();
}
});
dots = dots + 1;
if(dots == 4) {
dots = 0;
}
var msg = 'Running';
dots_txt = '';
for(var i=0; i < dots; i++) {
msg += '.';
dots_txt += '.';
}
try {
if($("span:visible:contains('This Page Isn't Available Right Now'):first").length > 0) {
myreload2();
}
if($("span:visible:contains('Query Error'):first").length > 0) {
$("div[role*='button']:visible:contains('OK'):first").click();
}
}
catch(ex) {}
deleted = deleted + 1;
if(1 > $('[aria-label*="List of Activity Log Items"] h2:first').parent().parent().parent().parent().parent().parent().find('[aria-label*="Action options"]:visible:first').length) {
$('[aria-label*="List of Activity Log Items"] h2:first').parent().parent().parent().parent().parent().parent().remove();
}
var action_options = $('[aria-label*="Action options"]:visible:first');
$('[aria-label*="Action options"]:visible:first').parent().parent().css('opacity', 0.5);
$('[aria-label*="Action options"]:visible:first').parent().parent().css('background-color', '#fee');
//$('[aria-label*="Action options"]:visible:first').parent().parent().css('background-color', '#ddd');
var del_this = true;
try {
if(contains || contains_not) {
del_this = false;
$('[aria-label*="Action options"]:visible:first').parent().parent().css('background-color', '#efe');
}
if(contains != '' && action_options.parent().parent().html().toLowerCase().indexOf(contains.toLowerCase()) != -1) {
del_this = true;
$('[aria-label*="Action options"]:visible:first').parent().parent().css('background-color', '#fee');
}
if(contains_not != '' && action_options.parent().parent().html().toLowerCase().indexOf(contains_not.toLowerCase()) == -1) {
del_this = true;
$('[aria-label*="Action options"]:visible:first').parent().parent().css('background-color', '#fee');
}
}
catch(ex){console.log(ex);}
var activity_log_html = $('[aria-label*="Action options"]:visible:first').parent().prev('div').html();
if(all_action_options.includes(activity_log_html) || !del_this) {
$('[placeholder="Search Facebook"]').val('Skipping'+dots_txt);
$('[aria-label*="Action options"]:visible:first').parent().parent().remove();
return;
}
$('[placeholder="Search Facebook"]').val('Deleting'+dots_txt);
all_action_options.push(activity_log_html);
action_options.click();
//action_options.parent().css('background-color', 'yellow');
//$(this).find('i').next('div').click();
setTimeout(function(){
//action_options.parent().parent().slideUp();
//action_options.parent().css('background-color', '#ffcccc');
//$('[data-testid="Keycommand_wrapper_ModalLayer"]:visible:first > div > div > div > div > div > div > div').click();
var search_span = [
'Move to trash',
'Hide from Timeline',
'Remove Reaction',
'Delete',
'Unlike'
];
var found_span = false;
for(var i=0;i<search_span.length;i++) {
if($("[role*='menu'] span:visible:contains('"+search_span[i]+"'):first").length > 0) {
found_span = true;
}
}
$('[aria-label*="Delete"]:visible').click();
$('[aria-label*="Move to Trash"]:visible').click();
if(found_span) {
$("[role*='menu'] span:visible:contains('Remove Reaction'):first").click();
$("[role*='menu'] span:visible:contains('Delete'):first").click();
$("[role*='menu'] span:visible:contains('Unlike'):first").click();
$("[role*='menu'] span:visible:contains('Move to trash'):first").click();
$("[role*='menu'] span:visible:contains('Hide from Timeline'):first").click();
}
else {
action_options.parent().parent().remove();
}
setTimeout(function(){
$('[aria-label*="Delete"]:visible').click();
$('[aria-label*="Move to Trash"]:visible').click();
$('body').click();
},300*throttle);
},500*throttle);
try {
chrome.storage.local.get(['active'], function(result) {
active = result.active;
});
}
catch(ex) {}
if(active != 1) {
$('#posts-deleted').html(deleted);
clearInterval(set_interval_id)
}
// make sure we have stop button
if($('#fe-stop-delete-btn').length == 0) {
var del_btn = '<div id="fe-stop-delete-btn" style="opacity: 0.7;background-color: #006f94;position: fixed;bottom: 10px;height: 50px;'+
'z-index: 999999;'+
'width: 100%;'+
'text-align: center;'+
'color: #fff;'+
'font-size: 30px;'+
'line-height: 48px;'+
'cursor: pointer;'+
'border: 1px solid #555;'+
'" >Stop!</div>';
$('body').append(del_btn)
$('#fe-stop-delete-btn').click(function(){
stop_delete();$(this).remove();
});
}
},1000*throttle);
}
A este mismo lo añado a la consola y lo ejecuto:
Y aparece el error:
¿Alguna sugerencia de cómo puedo solucionarlo?