I have a code that should work at a certain time, but it is not working.
$(function() {
$(".post").each(function() {
var d = new Date();
var hora = d.getHours();
if (hora <= 7 && hora >= 22) {
alert("O código está funcionando!");
if (_userdata.user_level == 2 || _userdata.user_level == 1) {
return;
}
if ($('.pathname-box:contains(Tarefas), .pathname-box:contains(Redações)').length > 0) {
var username = _userdata.username;
if ($(this).has('.staff').length) {
return;
}
if ($(this).html().indexOf(username) <= 1) {
$(this).remove();
}
if ($(this).html().indexOf(username) >= 1) {
$(this).remove();
}
}
}
});
});
Part of setting the time:
var d = new Date();
var hora = d.getHours();
if (hora <= 7 && hora >= 22) {
Note: If I remove the part where it sets the time the code should work, it starts working so it can not be code problem.
Unlicensed code:
$(function() {
$(".post").each(function() {
alert("O código está funcionando!");
if (_userdata.user_level == 2 || _userdata.user_level == 1) {
return;
}
if ($('.pathname-box:contains(Tarefas), .pathname-box:contains(Redações)').length > 0) {
var username = _userdata.username;
if ($(this).has('.staff').length) {
return;
}
if ($(this).html().indexOf(username) <= 1) {
$(this).remove();
}
if ($(this).html().indexOf(username) >= 1) {
$(this).remove();
}
}
}
});
});