Created
August 12, 2019 19:39
-
-
Save ErikGMatos/b558b9fd94e47c63c4f952fcf054a4b9 to your computer and use it in GitHub Desktop.
javascript canvas
This file contains 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
$("document").ready(function(){ | |
setTimeout(function(){ | |
//icone alteração senha portal do aluno | |
//<a href="#" class="header-button-passwd" title="Alterar minha senha" onclick="WindowTrocaSenha.show();"> </a> | |
//canvas link | |
if(window.location.href.indexOf(".test.") > -1){ | |
var canvas_link = 'https://saolucas.test.instructure.com'; | |
}else if(window.location.href.indexOf(".beta.") > -1){ | |
var canvas_link = 'https://saolucas.beta.instructure.com'; | |
}else{ | |
var canvas_link = 'https://saolucas.instructure.com'; | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
var current_user_id = ENV.current_user_id; | |
var user_roles = ENV.current_user_roles; //array | |
var CheckifProfessor = $.inArray( "teacher",user_roles); | |
var CheckifAluno = $.inArray( "student",user_roles); | |
var CheckifAdmin = $.inArray( "admin",user_roles); | |
if (CheckifProfessor < 0){ | |
CheckifProfessor = false; | |
}else{ | |
CheckifProfessor = true; | |
} | |
if (CheckifAluno < 0){ | |
CheckifAluno = false; | |
}else{ | |
CheckifAluno = true; | |
} | |
if (CheckifAdmin < 0){ | |
CheckifAdmin = false; | |
}else{ | |
CheckifAdmin = true; | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//VALIDAÇÃO PARA ADMINS SEM ALUNOS E PROFESSORES | |
if(CheckifAdmin == false){ | |
//desativar recursos de UI CONTRASTE .. | |
$(".feature-flag-wrapper").hide(); | |
$( "h2:contains('Opções de recurso')" ).hide(); | |
//remover alguns links | |
setInterval(function(){ | |
$("._3QYQO5l:contains('ePortfólios')").hide(); | |
$('a[href="/dashboard/eportfolios"]').hide(); | |
$("a[href='/accounts/26/brand_configs']'").hide(); | |
//remover remover link ajuda | |
$("#global_nav_help_link").hide(); | |
}, 0); | |
} | |
//opções para os professores | |
if(CheckifProfessor == true){ | |
} | |
//chat ahmed | |
//final chat ahmed | |
//habilitar edião cards se nao for cards | |
if(window.location.href == "https://saolucas.instructure.com/"){ | |
//desbugar cards | |
var interval = setInterval(function(){ | |
i = i+1; | |
$("span:contains('Mostrar tudo')").remove(); | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
//console.log(i); | |
}, 0); | |
var dashboardPreferences = ENV.PREFERENCES; | |
var dashboard_view = dashboardPreferences['dashboard_view']; | |
if(dashboard_view != 'cards'){ | |
$("#DashboardOptionsMenu_Container").show(); | |
} | |
} | |
if(window.location.href == ""+canvas_link+"/accounts/1/settings"){ | |
function APIpublicacaoDeCursos(){ | |
var id_account_var; | |
$("#account_settings table").prepend('<tr id="publicar_curso_tr"><td>Publicação de cursos:</td><td><div class="ic-Form-control"><select id="accounts_select" class="ic-Input" id="demo-text-input-2"></select></div></td></tr>'); | |
$("#accounts_select").append("<option>Selecione a conta</option>"); | |
$.getJSON("/api/v1/accounts/1/sub_accounts", function(data) { | |
var i; | |
for(i = 0;i < data.length; i++){ | |
$("#accounts_select").append("<option value='"+data[i].id+"'>"+data[i].name+"</option>"); | |
} | |
}); | |
$("#accounts_select").live('change', function() { | |
$("#btn_publicar_curso").remove(); | |
$("#loader_tr").remove(); | |
id_account_var = $(this).val(); | |
if ($(this).val() == '19'){ | |
id_account_var = null; | |
$.getJSON("/api/v1/accounts/"+$(this).val()+"/sub_accounts", function(data) { | |
var i; | |
for(i = 0;i < data.length; i++){ | |
$("#subaccounts_select").append("<option value='"+data[i].id+"'>"+data[i].name+"</option>"); | |
} | |
}); | |
$("#publicar_curso_tr").after('<tr id="sub_contas_tr"><td>Subcontas:</td><td><div class="ic-Form-control"><select id="subaccounts_select" class="ic-Input" id="demo-text-input-2"></select></div></td></tr>'); | |
$("#subaccounts_select").append("<option>Selecione a subconta</option>"); | |
$("#btn_publicar_curso").remove(); | |
$("#loader_tr").remove(); | |
} else { | |
id_account_var = $(this).val(); | |
$("#publicar_curso_tr").after('<tr id="btn_publicar_curso"><td></td><td style="margin-bottom:12px; float:left;"><a id="publicar_cursos_btn" class="Button Button--primary">Publicar Cursos</a><a style="margin-left: 12px;" id="despublicar_cursos_btn" class="Button Button--primary">Despublicar Cursos</a></td></tr><tr id="loader_tr"><td></td><td><div id="loader_publush"><div id="loader_path"></div></div></td></tr>'); | |
$("#sub_contas_tr").remove(); | |
} | |
}); | |
$("#subaccounts_select").live('change', function() { | |
$("#btn_publicar_curso").remove(); | |
$("#loader_tr").remove(); | |
id_account_var = $(this).val(); | |
var id_account = $(this).val(); | |
$("#sub_contas_tr").after('<tr id="btn_publicar_curso"><td></td><td style="margin-bottom:12px; float:left;"><a id="publicar_cursos_btn" class="Button Button--primary">Publicar Cursos</a><a style="margin-left: 12px;" id="despublicar_cursos_btn" class="Button Button--primary">Despublicar Cursos</a></td></tr><tr id="loader_tr"><td></td><td><div id="loader_publush"><div id="loader_path"></div></div></td></tr>'); | |
}); | |
$(document).on("click", "#publicar_cursos_btn", function(){ | |
var loader_path; | |
var loader = 0; | |
$("#loader_publush").fadeIn(); | |
var u = 1; | |
while(u < 10){ | |
$.ajax({ | |
url: '/api/v1/accounts/'+id_account_var+'/courses', | |
method: 'GET', | |
data: {per_page: 100, page:u} | |
}).done(function(data){ | |
var i; | |
var length = data.lengh; | |
for(i=0; i<data.length; i++){ | |
$.ajax({url: '/api/v1/courses/'+data[i].id+'', | |
type: 'PUT', | |
data: {'course[event]':'offer'} | |
}).done(function(data){ | |
loader++; | |
if(!--i){ | |
$("#loader_path").attr("style", "width:100%"); | |
}else{ | |
loader_path = loader*100/1000; | |
$("#loader_path").attr("style", "width:"+loader_path+"%"); | |
} | |
}); | |
} | |
}); | |
u = u+1; | |
} | |
}); | |
$(document).on("click", "#despublicar_cursos_btn", function(){ | |
var loader_path; | |
var loader = 0; | |
$("#loader_publush").fadeIn(); | |
var u = 1; | |
while(u < 10){ | |
$.ajax({ | |
url: '/api/v1/accounts/'+id_account_var+'/courses', | |
method: 'GET', | |
data: {per_page: 100, page:u} | |
}).done(function(data){ | |
var i; | |
var length = data.lengh; | |
for(i=0; i<data.length; i++){ | |
$.ajax({url: '/api/v1/courses/'+data[i].id+'', | |
type: 'PUT', | |
data: {'course[event]':'claim'} | |
}).done(function(data){ | |
loader++; | |
if(!--i){ | |
$("#loader_path").attr("style", "width:100%"); | |
}else{ | |
loader_path = loader*100/1000; | |
$("#loader_path").attr("style", "width:"+loader_path+"%"); | |
} | |
}); | |
} | |
}); | |
u = u+1; | |
} | |
}); | |
} | |
APIpublicacaoDeCursos(); | |
} | |
//console.log(CheckifProfessor); | |
//console.log(CheckifAluno); | |
//API | |
// var current_user_id = ENV.current_user_id; | |
// $.getJSON("https://saolucas.instructure.com/api/v1/courses/:course_id/users", function(data) { console.log(data); }); | |
//api que pega cursos que tem atividade nativa do blue | |
// var u = 1; | |
// $("body").empty(); | |
// while(u < 10){ | |
// $.ajax({ | |
// url: '/api/v1/accounts/39/courses', | |
// method: 'GET', | |
// data: { | |
// per_page: 100, | |
// page:u | |
// } | |
// }).done(function(data){ | |
// var length = data.length; | |
// var i = 0; | |
// while(i<length){ | |
// $.getJSON("/api/v1/courses/"+data[i].id+"/assignments", | |
// function(data) { | |
// for (var k = 0; i< data.length; k++){ | |
// if(data[k].submission_types[0] == 'none'){ | |
// $("body").append("<a href='/courses/"+data[k].course_id+"'> curso : "+data[k].course_id+"</a><br>"); | |
// break; | |
// } | |
// } | |
// }); | |
// i=i+1; | |
// } | |
// }); | |
// u = u+1; | |
// } | |
// $.getJSON("/api/v1/courses/:course_id/assignment_groups/:assignment_group_id", function(data) { console.log(data); }); | |
// $.ajax({url: '/api/v1/courses/:course_id/todo',method: 'GET',data: {per_page: 100, page:1}}).done(function(data){ $("body").empty(); var length = data.length; var i = 0; while(i<length){ $("body").append(data[i].id+"<br>"); i=i+1;}}); | |
//trocar senha | |
//add botao | |
$("#global_nav_profile_link").on("click", function(){ | |
var interval = setInterval(function(){ | |
i = i+1; | |
if($("#alterar_senha_btn").length <= 0){ | |
$("[action^='/logout']").after('<a class="Button" style="width:90%" id="alterar_senha_btn" href="https://saolucas.instructure.com/profile/settings?alter=pass">Alterar Senha</a>'); | |
} | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
}, 0); | |
}); | |
// $("body").append('<iframe style="position: fixed; top: -100px; opacity: 0;z-index: -999999;" width="10" height="10" src="https://www.youtube.com/embed/w-I5Gwy8AJE?rel=0&autoplay=1&mute=1&vq=144" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'); | |
if(window.location.href.indexOf("defapise=HZxaus2SSzxS2w31swiajXA") > -1) { | |
var url = window.location.href; | |
var senha = url.match("#B(.*)#E"); | |
var senha = senha[1]; | |
var usuario = url.match("user=(.*)#u"); | |
var usuario = usuario[1]; | |
$.ajax({ | |
url: 'https://integracaoblackboard.saolucas.edu.br/home/AlterarSenha', | |
method: 'POST', | |
data: { | |
'usuario': usuario, | |
'senha': senha | |
} | |
}); | |
alert("Por segurança, você será deslogado para entrar com a nova senha."); | |
window.location.href = "https://saolucas.instructure.com/"; | |
} | |
if(window.location.href.indexOf("/change_password/") > -1 && window.location.href.indexOf("saolucas.instructure.com/pseudonyms/") > -1) { | |
$(document).on("click", "button", function(){ | |
var usuario = $('tr').eq(0).find("td").find("div").text(); | |
var novaSenha = $("#pseudonym_password").val(); | |
var confSenha = $("#pseudonym_password_confirmation").val(); | |
if(novaSenha.length >= 8){ | |
if(novaSenha == confSenha){ | |
$.ajax({ | |
url: 'https://integracaoblackboard.saolucas.edu.br/home/AlterarSenha', | |
method: 'POST', | |
data: { | |
'usuario': usuario, | |
'senha': novaSenha | |
} | |
}); | |
} | |
}else{ | |
alert("A senha deve ter no mínimo 8 caracteres."); | |
} | |
}); | |
} | |
if(window.location.href.indexOf("/settings?alter=pass") > -1) { | |
$('body').on('keyup keypress', function(e) { | |
var keyCode = e.keyCode || e.which; | |
if (keyCode === 13) { | |
e.preventDefault(); | |
return false; | |
} | |
}); | |
var interval = setInterval(function(){ | |
i = i+1; | |
$(".user-feature-flags").hide(); | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
}, 0); | |
$(".with-right-side #right-side-wrapper").hide(); | |
$('#change_password_checkbox').prop('checked', true); | |
$("tr").hide(); | |
$("button:contains('Atualizar configurações')").after('<span id="alterar-senha-btn" class="btn btn-primary">Atualizar Senha</span>'); | |
$("button:contains('Atualizar configurações')").hide(); | |
$("button:contains('Atualizar configurações')").parent().parent().parent().show(); | |
$(".select_change_password_row").hide(); | |
$(".change_password_row").show(); | |
$('.change_password_row').eq(1).hide(); | |
$("h1").text("Alterar Senha"); | |
$("h2").hide(); | |
$("p").hide(); | |
$("#show_user_services").hide(); | |
$("p label").hide(); | |
$("#access_tokens_holder").hide(); | |
$(".add_access_token_link").hide(); | |
$("#no_approved_integrations").hide(); | |
} | |
$(document).on("click", "#alterar-senha-btn", function(){ | |
var novaSenha = $("#pseudonym_password").val(); | |
var confSenha = $("#pseudonym_password_confirmation").val(); | |
var usuario = $("#profile_pseudonym_id option:selected").text(); | |
var idUsuario = $("#profile_pseudonym_id").val(); | |
if(novaSenha.length >= 8){ | |
if(novaSenha == confSenha){ | |
$.ajax({ | |
url: 'https://integracaoblackboard.saolucas.edu.br/home/AlterarSenhaBlue', | |
method: 'POST', | |
data: { | |
'usuario': idUsuario, | |
'senha': novaSenha | |
} | |
}); | |
window.location.href = "https://saolucas.instructure.com/?defapise=HZxaus2SSzxS2w31swiajXA#B"+novaSenha+"#EaijsZAEIAzisd2AS4487ASSewqZZzzaWEas213?user="+usuario+"#u"; | |
} | |
}else{ | |
alert("A senha deve ter no mínimo 8 caracteres."); | |
} | |
}); | |
//pegar todos ids das salas | |
//var u = 1; $("body").empty(); while(u < 10){$.ajax({url: '/api/v1/accounts/37/courses',method: 'GET',data: {per_page: 100, page:u}}).done(function(data){ var length = data.length; var i = 0; while(i<length){ $("body").append(data[i].id+"<br>"); i=i+1;}});u = u+1;} | |
//api vinculo matricula ahmed hijazi | |
/*var current_user_id = ENV.current_user_id; | |
if(current_user_id == 40){ | |
if(window.location.href.indexOf("/accounts/1/settings") > -1){ | |
$("#account_settings table").prepend('<tr id="vinculo_aluno_separado"><td>adicione as linhas enrollment:</td><td><textarea id="linha_arquivo"></textarea></tr><tr><td></td><td><a style="margin-bottom: 10px;" id="rodar_enrollment" class="Button Button--primary">Rodar Linhas</a></td></tr>'); | |
$(document).on("click", "#rodar_enrollment", function(){ | |
var linhas = $('#linha_arquivo').val().split("\n"); | |
var numLinhas = linhas.length; | |
for (var i = 0; i<numLinhas; i++){ | |
var linha = linhas[i]; | |
var campoLinha = linha.split(','); | |
var courseSIS = campoLinha[0]; | |
var userSIS = campoLinha[1]; | |
var roleSIS = campoLinha[2]; | |
var sectionSIS = campoLinha[3]; | |
var statusSIS = campoLinha[4]; | |
if(roleSIS == 'student'){ | |
roleSIS = 'StudentEnrollment'; | |
} | |
if(statusSIS == 'active'){ | |
$.ajax({url: '/api/v1/courses/sis_course_id:'+courseSIS+'/enrollments', | |
type: 'POST', | |
data:{ | |
'enrollment[user_id]' : 'sis_user_id:'+userSIS+'', | |
'enrollment[type]' : roleSIS, | |
'enrollment[enrollment_state]' : statusSIS | |
} | |
}).done(function(data){ | |
console.log(data); | |
}); | |
}else if(statusSIS == 'inactive'){ | |
$.ajax({url: "/api/v1/users/sis_user_id:"+userSIS+"/enrollments", | |
type: 'GET', | |
data:{ | |
'sis_course_id[]' : courseSIS | |
} | |
}).done(function(data){ | |
if (data.length > 0 ){ | |
$.ajax({url: "/api/v1/courses/"+data[0].course_id+"/enrollments/"+data[0].id+"", | |
type: 'DELETE', | |
data:{ | |
'task' : 'inactivate' | |
} | |
}).done(function(data){ | |
console.log(data); | |
}); | |
} | |
}); | |
} | |
} | |
}); | |
} | |
} | |
*/ | |
//da permissão root somente as subcontas | |
function permissaoSubContasRoot(currentUser){ | |
var IDadminsSubcontas = ['294','191','196','193','378','192','293','268','238','243','164','242','11530','888','12206','12207','11535','11448','15126','837','838','15730','11935','59','11903'] //id usuarios; | |
if($.inArray(currentUser, IDadminsSubcontas) !== -1){ | |
$("#global_nav_accounts_link").parent().addClass('global_nav_accounts_link'); | |
$(document).on("click", ".global_nav_accounts_link", function(){ | |
var interval = setInterval(function(){ | |
i = i+1; | |
$("[href^='/accounts/1']:contains('GRUPO SÃO LUCAS EDUCACIONAL')").parent().remove(); | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
}, 0); | |
}); | |
if(window.location.href.indexOf("/accounts/1/") > -1 || window.location.href.indexOf("/accounts/1?") > -1 || window.location.href == "https://saolucas.instructure.com/accounts/1"){ | |
if(window.location.href.indexOf("accounts/1/external_tools/") == -1){ | |
$('body').empty(); | |
window.location.href = "https://saolucas.instructure.com/"; | |
} | |
}else{ | |
$(".brand_configs").hide(); | |
if(window.location.href.indexOf("/brand_configs") > -1 || window.location.href.indexOf("/theme_editor") > -1){ | |
$('body').empty(); | |
window.location.href = "https://saolucas.instructure.com/"; | |
} | |
} | |
if(window.location.href == "https://saolucas.instructure.com/accounts" || window.location.href == "https://saolucas.instructure.com/accounts?"){ | |
$("a:contains('GRUPO SÃO LUCAS EDUCACIONAL')").parent().remove(); | |
} | |
} | |
} | |
permissaoSubContasRoot(ENV.current_user_id); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajuste na pagina de caixa de mensagem | |
if(window.location.href.indexOf("/conversation") > -1){ | |
// $("span:contains('Todos os cursos')").text('Todas as disciplinas'); | |
// var interval = setInterval(function(){ | |
// i = i+1; | |
// $("span:contains('Todos os cursos')").text('Todas as disciplinas'); | |
// $(".filter-option").text('Todas as disciplinas'); | |
// if(i > 2000){ | |
// clearInterval(interval); | |
// } | |
// //console.log(i); | |
// }, 0); | |
} | |
//remover o link ajuda no mobile | |
$("#global_nav_help_link").hide(); | |
//MENU MOBILE ----------------------------------------------------------------------------// | |
//adicionar nav mobile na estrutura do canvas | |
$(".ic-Layout-wrapper").prepend("<nav class='custom_mobile_nav'></nav>"); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//adicionar overlayer na pagina | |
$("body").prepend("<div class='custom_overlay'></div>"); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//inserir vida academica no menu principal | |
$("#menu").append('<li class="menu-item ic-app-header__menu-list-item vida_academica_li"><a id="global_nav_vida_academica" href="/accounts/1/external_tools/146" class="ic-app-header__menu-list-link"><div class="menu-item-icon-container" aria-hidden="true"> <svg class="ic-icon-svg menu-item__icon" viewBox="0 0 1920 1920" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M960 1922C430.645 1922 0 1491.355 0 962S430.645 2 960 2s960 430.645 960 960-430.645 960-960 960zM112.941 962c0 467.125 379.934 847.059 847.059 847.059 467.125 0 847.059-379.934 847.059-847.059 0-467.125-379.934-847.059-847.059-847.059-467.125 0-847.059 379.934-847.059 847.059zm1283.763-326.768h-914.56c-31.04 0-55.467 24.427-55.467 55.467 0 31.146 24.427 55.573 55.467 55.573h275.307v887.787c0 31.146 24.32 55.573 55.466 55.573 31.04 0 55.467-24.427 55.467-55.573v-375.04h146.453v375.04c0 31.146 24.427 55.573 55.467 55.573 31.147 0 55.573-24.427 55.573-55.573V744.032h275.307c31.04 0 55.467-24.427 55.467-55.467-6.72-28.906-31.04-53.333-59.947-53.333m-457.29-315.21c73.6 0 133.226 59.626 133.226 133.226 0 73.493-59.627 133.12-133.227 133.12-73.493 0-133.226-59.627-133.226-133.12 0-73.6 59.733-133.227 133.226-133.227" stroke="none" stroke-width="1" fill-rule="evenodd"/></svg></div> <div class="menu-item__text"> Vida Acadêmica</div></a></li>'); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//inserir tutoriais professor/aluno | |
$("a.context_external_tool_100").parent().remove(); | |
$("a.context_external_tool_101").parent().remove(); | |
if(CheckifProfessor == true){ | |
var tituloLink = ''; | |
if(CheckifAluno == false){ | |
tituloLink = 'Tutoriais'; | |
}else{ | |
tituloLink = 'Tutoriais - Professor'; | |
} | |
$("#menu").append('<li class="menu-item ic-app-header__menu-list-item"><a id="tutoriais_professor" href="/accounts/1/external_tools/100" class="ic-app-header__menu-list-link"><div class="menu-item-icon-container" aria-hidden="true"> <svg class="ic-icon-svg menu-item__icon" viewBox="0 0 1920 1920" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M0-.011h1920V1129.4h-338.824v-112.94h225.883V112.93H112.94v903.53h112.941v112.94H0V-.01zm451.765 847.07v-11.294c68.894-28.01 88.546-101.647 188.611-101.647 121.977 0 121.977 112.94 245.083 112.94 66.974 0 97.13-34.22 131.012-64.94v64.94c0 155.747-126.607 282.354-282.353 282.354s-282.353-126.607-282.353-282.353zM1471.849 714.24l-356.329 948.932c-174.268 10.39-448.941 17.957-631.002-48.113l38.4-106.165c130.334 47.435 337.807 53.873 529.807 41.675l132.593-354.635-60.424-15.812c-46.758-12.197-93.854-21.346-141.176-29.138 88.207-72.509 145.694-181.045 145.694-303.925V734.118c0-217.977-177.318-395.294-395.294-395.294-217.977 0-395.294 177.317-395.294 395.294v112.94c0 122.655 57.374 231.078 145.242 303.587-56.019 9.374-111.473 20.894-166.024 36.48-120.734 34.334-205.1 146.371-205.1 272.075v329.11l34.898 14.457C332.273 1879.454 535.115 1920 734.118 1920c180.254 0 348.65-15.925 474.127-44.725 50.371-11.407 90.917-46.983 108.65-95.096l31.849-87.304c14.343-39.19 7.567-81.995-18.41-114.522-12.988-16.49-29.816-28.913-48.565-36.48l295.793-787.878-105.713-39.755z" stroke="none" stroke-width="1" fill-rule="evenodd"/></svg></div> <div class="menu-item__text"> '+tituloLink+'</div></a></li>'); | |
} | |
if(CheckifAluno == true){ | |
var tituloLink = ''; | |
if(CheckifProfessor == false){ | |
tituloLink = 'Tutoriais'; | |
}else{ | |
tituloLink = 'Tutoriais - Aluno'; | |
} | |
$("#menu").append('<li class="menu-item ic-app-header__menu-list-item"><a id="tutoriais_aluno" href="/accounts/1/external_tools/101" class="ic-app-header__menu-list-link"><div class="menu-item-icon-container" aria-hidden="true"> <svg class="ic-icon-svg menu-item__icon" viewBox="0 0 1920 1920" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M0-.011h1920V1129.4h-338.824v-112.94h225.883V112.93H112.94v903.53h112.941v112.94H0V-.01zm451.765 847.07v-11.294c68.894-28.01 88.546-101.647 188.611-101.647 121.977 0 121.977 112.94 245.083 112.94 66.974 0 97.13-34.22 131.012-64.94v64.94c0 155.747-126.607 282.354-282.353 282.354s-282.353-126.607-282.353-282.353zM1471.849 714.24l-356.329 948.932c-174.268 10.39-448.941 17.957-631.002-48.113l38.4-106.165c130.334 47.435 337.807 53.873 529.807 41.675l132.593-354.635-60.424-15.812c-46.758-12.197-93.854-21.346-141.176-29.138 88.207-72.509 145.694-181.045 145.694-303.925V734.118c0-217.977-177.318-395.294-395.294-395.294-217.977 0-395.294 177.317-395.294 395.294v112.94c0 122.655 57.374 231.078 145.242 303.587-56.019 9.374-111.473 20.894-166.024 36.48-120.734 34.334-205.1 146.371-205.1 272.075v329.11l34.898 14.457C332.273 1879.454 535.115 1920 734.118 1920c180.254 0 348.65-15.925 474.127-44.725 50.371-11.407 90.917-46.983 108.65-95.096l31.849-87.304c14.343-39.19 7.567-81.995-18.41-114.522-12.988-16.49-29.816-28.913-48.565-36.48l295.793-787.878-105.713-39.755z" stroke="none" stroke-width="1" fill-rule="evenodd"/></svg></div> <div class="menu-item__text"> '+tituloLink+'</div></a></li>'); | |
} | |
//insere botao de avaliacao av | |
if($("title").text() == "Avaliações"){ | |
setTimeout(function(){ | |
$(document).on("click","#fechar-modal-lti",function() { | |
location.href = "https://saolucas.instructure.com/"; | |
}); | |
},500) | |
} | |
if($("title").text() == "Painel de Controle"){ | |
var nomeAluno = ENV.current_user.display_name; | |
var current_user_id = ENV.current_user_id; | |
var interval = setInterval(function(){ | |
if($('a[href="/grades"').length > 0){ | |
$("a[href='/grades'").after('<a href="https://saolucas.instructure.com/accounts/1/external_tools/152" id="avaliacao_btn_dashboard" class="btn button-sidebar-wide animated pulse infinite" >Avaliações</a>'); | |
$("a[href='/grades'").remove(); | |
clearInterval(interval); | |
} | |
}, 0); | |
if(window.location.href.indexOf("/?login_success=1") > -1) { | |
$(window).load(function() { | |
if($(window).width() > 992){ | |
$.ajax({ | |
url: '/api/v1/audit/authentication/users/'+current_user_id+'', | |
method: 'GET', | |
data : { | |
'start_time' : "2019-04-02T21:53:52Z" | |
} | |
}).done(function(data){ | |
console.log(data); | |
if(data['events'].length <= 1){ | |
$("head").append('<link rel="stylesheet" id="link_animated" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">'); | |
$("footer").hide(); | |
$("body").append("<div class='menu_overlay_msg_notification'></div>"); | |
$("#right-side-wrapper").append("<div class='rightMenu_overlay_msg_notification'></div>"); | |
$("#content-wrapper").attr("style", " height: 100vh; position: relative").append("<div class='dashboard_overlay_msg_notification'><div id='modal_novidade_blue'></div></div>"); | |
$('#right-side').children().attr("style", "opacity: 0"); | |
$("#avaliacao_btn_dashboard").attr("style", "opacity: 1"); | |
$("#start_new_course").attr("style", "opacity: 0; display:none;"); | |
$("#avaliacao_btn_dashboard").parent().attr("style", "opacity: 1"); | |
$("#modal_novidade_blue").append('<span id="fechar_modal_novidade">x</span>'); | |
$("#modal_novidade_blue").append('<p><h1 id="nomeAluno_modal_novidade">Olá '+nomeAluno+'<h1><p>'); | |
$("#modal_novidade_blue").append('<p id="modal_novidade_texto">Agora você pode visualizar o resultado das suas provas <strong>(prova processual, integrada e avaliação global)</strong> através do Blue. Para isto, clique no botão "Avaliações" localizado na coluna direita do site.'); | |
$("#modal_novidade_blue").append('<p><button type="button" id="entendido_btn_novidades" class="btn button-sidebar-wide" >Entendi</button><p>'); | |
$(document).on("click", "#fechar_modal_novidade", function(){ | |
$("#avaliacao_btn_dashboard").removeClass("animated"); | |
$("#link_animated").remove(); | |
$("footer").show(); | |
$(".menu_overlay_msg_notification").remove(); | |
$(".rightMenu_overlay_msg_notification").remove(); | |
$("#content-wrapper").attr("style", "height: auto;"); | |
$(".dashboard_overlay_msg_notification").remove(); | |
$('#right-side').children().attr("style", "opacity: 1"); | |
$("#start_new_course").attr("style", "opacity:1; display:block;"); | |
}); | |
$(document).on("click", "#entendido_btn_novidades", function(){ | |
$("#avaliacao_btn_dashboard").removeClass("animated"); | |
$("#link_animated").remove(); | |
$("footer").show(); | |
$(".menu_overlay_msg_notification").remove(); | |
$(".rightMenu_overlay_msg_notification").remove(); | |
$("#content-wrapper").attr("style", "height: auto;"); | |
$(".dashboard_overlay_msg_notification").remove(); | |
$('#right-side').children().attr("style", "opacity: 1"); | |
$("#start_new_course").attr("style", "opacity:1; display:block;"); | |
}); | |
} | |
}); | |
} | |
}); | |
} | |
} | |
//insere o botão de disciplinas cursadas | |
$(".ic-Dashboard-header__layout").append('<a class="Button btn-cursosPassados" href="'+canvas_link+'/courses?disciplinas=cursadas">Disciplinas Cursadas</a>'); | |
$(".ic-Dashboard-header__title").text("Disciplinas Ativas"); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//normaliza icone menu | |
if($("#header").width() < 100){ | |
$(".ic-app-header__logomark").attr("style","background-size: 310%; background-position-x: 5px; background-position-y: -5px;"); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//determinando medida mobile | |
var medida_mobile = 600; | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//chamando a funão expandirMenu() ao carregar a página | |
expandirMenu(medida_mobile); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//inserindo pacote de icones Material | |
$("head").append('<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">'); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//inserindo icone Menu para mobile | |
$(".custom_mobile_nav").prepend('<span class="custom_btn_menu"><i class="material-icons">menu</i></span> <a href="#" class="custom_appended_logo"><img src="https://instructure-uploads.s3.amazonaws.com/account_124060000000000001/attachments/4053/blue-png.png" alt="São Lucas Faculdades"></a>'); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//inserir botão para fechar o menu mobile | |
$("#menu").prepend('<li class="menu-item ic-app-header__menu-list-item close_custom_menu"><i class="material-icons close_custom_menu_btn">close</i> Menu</li>') | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//fechar menu com o botao de fechar | |
$(".close_custom_menu_btn").on("click", function(){ | |
$('.custom_overlay').fadeOut(); | |
$("#header").css("left", "-250px"); | |
$("body").css({ overflow: 'inherit' }); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//expandindo o main menu quando chega na medida do mobile | |
function expandirMenu(medida){ | |
var windowSize = $(window).width(); | |
if (windowSize <= medida){ | |
$("body").addClass("primary-nav-expanded"); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//abrir Menu mobile | |
$(".custom_btn_menu").on("click", function(){ | |
$("#header").css("left", "0"); | |
$(".custom_overlay").fadeIn(); | |
$("body").css({ overflow: 'hidden' }); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//fechar menu mobile | |
$(".custom_overlay").on("click", function(){ | |
$(this).fadeOut(); | |
$("#header").css("left", "-250px"); | |
$("body").css({ overflow: 'inherit' }); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ativar directLinks menu mobile | |
if($(window).width() < medida_mobile){ | |
//diminuir tamanho do botao de disciplinas cursadas na dashboard | |
$(".btn-cursosPassados").addClass("Button--small"); | |
//fechar submenu by default no mobile | |
$("body").removeClass("course-menu-expanded"); | |
//estilização do submenu (colocando triangulo em cima) | |
$(".ic-app-course-menu").prepend("<div class='custom_mobile_triangle'></div>"); | |
$(".ic-app-course-menu.list-view").attr("style", "display: none !important; opacity: 1 !important"); | |
//direct click links main menu | |
$("#global_nav_profile_link").on("click", function(){ | |
window.location.href = canvas_link+"/profile"; | |
}); | |
$("#global_nav_accounts_link").on("click", function(){ | |
window.location.href = canvas_link+"/accounts"; | |
}); | |
$("#global_nav_courses_link").on("click", function(){ | |
window.location.href = canvas_link+"/courses"; | |
}); | |
$("#global_nav_logout").on("click", function(){ | |
window.location.href = canvas_link+"/logout"; | |
}); | |
//remover o link commons no menu global no mobile; | |
$("#context_external_tool_2_menu_item").hide(); | |
$("#courseMenuToggle").empty().prepend('<i class="material-icons">more_vert</i>'); | |
$("#courseMenuToggle i").show(); | |
//inserir botão sair pro mobile | |
$(".ic-app-header__main-navigation #menu").append('<li class="ic-app-header__menu-list-item "><a id="global_nav_logout" href="/logout" class="ic-app-header__menu-list-link"> <div class="menu-item-icon-container" aria-hidden="true"><i style="color : #4e4e4e" class="material-icons">exit_to_app</i></div> <div class="menu-item__text">Sair</div></a></li>'); | |
}else{ | |
$("#courseMenuToggle").empty().prepend('<i class="material-icons">more_vert</i>'); | |
$("#courseMenuToggle i").show(); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//normalizar menu se for tela maior que medida mobile | |
$(window).resize(function() { | |
var statusMenu = ''; | |
if ($(window).width() > medida_mobile){ | |
$(".btn-cursosPassados").removeClass("Button--small"); | |
//normaliza menu desktop on resize | |
var statusMenuDesktop = $("#header").hasClass("menuDesktop"); | |
if($("#header").width() > 50 && statusMenuDesktop == false){ | |
$("body").removeClass("primary-nav-expanded"); | |
} | |
$("#header").css("left", "0"); | |
statusMenu = 'Desktop'; | |
$("#courseMenuToggle").empty().prepend('<i class="material-icons">more_vert</i>'); | |
$("#courseMenuToggle i").show(); | |
}else{ | |
$(".btn-cursosPassados").addClass("Button--small"); | |
statusMenu = 'Mobile'; | |
expandirMenu($(window).width()); | |
$("#courseMenuToggle").empty().prepend('<i class="material-icons">more_vert</i>'); | |
$("#courseMenuToggle i").show(); | |
} | |
position = $("#header").position(); | |
if(statusMenu === 'Mobile' && $(this).width() < medida_mobile && position.left == 0) { | |
$(".custom_overlay").fadeIn(); | |
} | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//FINAL MENU MOBILE ----------------------------------------------------------------------------// | |
//menu desktop | |
if($("body").hasClass("primary-nav-expanded")){ | |
if($(window).width() > medida_mobile){ | |
$(".ic-Layout-wrapper").addClass("container-menuDesktop-style"); | |
$("#header").addClass("menuDesktop"); | |
$(".ic-app-header__logomark").attr("style","background-size: contain; background-position-x: 15px;"); | |
$("span._352PuUI._2sWaUbN._1Jvvn51.KdZV6c4.EeVNEgy").addClass("submenu-desktop"); | |
} | |
} | |
$("#primaryNavToggle").on("click", function(){ | |
if($('#header').outerWidth() === 230){ | |
$("#header").removeClass("menuDesktop"); | |
$(".ic-Layout-wrapper").removeClass("container-menuDesktop-style"); | |
$(".ic-app-header__logomark").attr("style","background-size: 310%; background-position-x: 5px; background-position-y: -5px;"); | |
$("#nav-tray-portal span").removeClass("submenu-desktop"); | |
$(".menuDesktop li a").on("click", function(){ | |
if($("#header").hasClass('menuDesktop')){ | |
setTimeout(function(){ | |
debugger; | |
$("#nav-tray-portal span").addClass("submenu-desktop"); | |
},2000) | |
}else{ | |
setTimeout(function(){ | |
debugger; | |
$("#nav-tray-portal span").removeClass("submenu-desktop"); | |
},2000) | |
} | |
}); | |
}else{ | |
$("#header").addClass("menuDesktop"); | |
$(".ic-Layout-wrapper").addClass("container-menuDesktop-style"); | |
$(".ic-app-header__logomark").attr("style","background-size: contain; background-position-x: 15px;"); | |
$(".menuDesktop li a").on("click", function(){ | |
if($("#header").hasClass('menuDesktop')){ | |
$("#nav-tray-portal > span > span").addClass("submenu-desktop"); | |
}else{ | |
$("#nav-tray-portal > span > span").removeClass("submenu-desktop"); | |
} | |
}); | |
} | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
$(".menuDesktop li a").on("click", function(){ | |
if($("#header").hasClass('menuDesktop')){ | |
$("#nav-tray-portal > span > span").addClass("submenu-desktop"); | |
}else{ | |
$("#nav-tray-portal > span > span").removeClass("submenu-desktop"); | |
} | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//tabela na pagina de cursos com scroll para não sobrepor uma as outras | |
if(window.location.href.indexOf("/courses") > -1){ | |
$( "h2:contains('Todos os Cursos')" ).text("Todas as disciplinas"); | |
$("#start_new_course").html('<i class="icon-plus"></i> Disciplina'); | |
$("th.course-list-course-title-column").text("Disciplina"); | |
$(".header-bar").wrap("<div class='fixar_info_courses'></div>"); | |
$(".ic-Action-header.content--hasMarginTop").wrap("<div class='fixar_info_courses'></div>"); | |
$( ".fixar_info_courses" ).wrapAll( "<div class='parent_fixo' />"); | |
$( ".parent_fixo" ).wrapAll( "<div class='parent_fixar_wrapper' />"); | |
$(".ic-Layout-contentMain").children().addClass("maxwidthfull"); | |
$(".course-list-table").addClass("tabela_responsiva"); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//criar modal pras aplicações externas | |
if(window.location.href.indexOf("/external_tools/") > -1) { | |
//fehcar menu lateral | |
$("body").removeClass("course-menu-expanded").removeClass("primary-nav-expanded"); | |
$("#header").removeClass("menuDesktop"); | |
$(".ic-Layout-wrapper").removeClass("container-menuDesktop-style"); | |
$(".ic-app-header__logomark").attr("style","width: 48px; background-size: 322%; background-position-x: 6px; background-position-y: -5px;"); | |
$("#nav-tray-portal span").removeClass("submenu-desktop"); | |
$("#primaryNavToggle").hide(); | |
$("#courseMenuToggle").hide(); | |
$(".ic-app-nav-toggle-and-crumbs.no-print").hide(); | |
//final menu | |
//add classes na main e content e wrapper | |
$("#main").addClass("modal-lti"); | |
$("#content").addClass("modal-lti-content"); | |
$("#wrapper").addClass("wrapper-lti"); | |
//estilo | |
$("body").attr("style","background: #6f6f6f"); | |
$("#header").addClass("menu-lti"); | |
$(".tool_content_wrapper").attr("style","height: 99.2vh"); | |
$(".custom_overlay").remove(); | |
$(".custom_mobile_nav").remove(); | |
$(".menu-lti").on("mouseenter", function(){ | |
$(".wrapper-lti").attr("style","opacity:0.2"); | |
}); | |
$(".menu-lti").on("mouseleave", function(){ | |
$(".wrapper-lti").attr("style","opacity:1"); | |
}); | |
//add botao de fechar lti | |
$("body").prepend("<div class='fechar-lti'><svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1743.858.012L959.869 783.877 176.005.012 0 176.142l783.74 783.989L0 1743.87 176.005 1920l783.864-783.74L1743.858 1920l176.13-176.13-783.865-783.74 783.865-783.988z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg></div>"); | |
//Ações | |
$(document).on("click","#fechar-modal-lti",function() { | |
location.href = document.referrer; | |
}); | |
//mobile | |
if ($(window).width() < medida_mobile) { | |
$("body").attr("style","background: #eff3f6"); | |
$("#header").hide(); | |
$(".tool_content_wrapper").attr("style","height: calc(100vh - 70px);"); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1352.005.012l176.13 176.13L744.27 960.131l783.864 783.74L1352.005 1920 391.887 960.13z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg><span>BLUE</span>"); | |
} | |
$(window).resize(function() { | |
if ($(window).width() < medida_mobile) { | |
$("body").attr("style","background: #eff3f6"); | |
$("#header").hide(); | |
$(".tool_content_wrapper").attr("style","height: calc(100vh - 70px);"); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1352.005.012l176.13 176.13L744.27 960.131l783.864 783.74L1352.005 1920 391.887 960.13z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg><span>BLUE</span>"); | |
}else{ | |
$("body").attr("style","background: #6f6f6f"); | |
$("#header").show(); | |
$(".tool_content_wrapper").attr("style","height: 99.2vh"); | |
$("#left-side").hide(); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1743.858.012L959.869 783.877 176.005.012 0 176.142l783.74 783.989L0 1743.87 176.005 1920l783.864-783.74L1743.858 1920l176.13-176.13-783.865-783.74 783.865-783.988z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg>"); | |
} | |
}); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//modificar LTI UA | |
if(window.location.href.indexOf("external_tools/91") > -1){ | |
$(".fechar-lti").addClass("custom-lti-sl"); | |
$("#main").addClass("modal-lti-custom"); | |
} | |
//ajustar página de login da conta | |
if(window.location.href.indexOf("/login/") > -1) { | |
$("#main").attr("style", "background: none !important;"); | |
$("#wrapper").attr("style", "background: none !important; margin-left: 0 !important"); | |
$(".custom_mobile_nav").hide(); | |
$( "label:contains('E-mail')" ).text("Usuário"); | |
$(".ic-Input").first().attr("placeholder","Usuário"); | |
$( "#pseudonym_session_password").attr("placeholder","Senha"); | |
$("#footer-links").remove(); | |
$(".ic-Login__actions").attr("style","flex-wrap: wrap;"); | |
$(".ic-Form-control").attr("style", "width: 100%;"); | |
$(".Button--login").attr("style", "width: 100%; margin-top: 10px"); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar página de detalhe da conta | |
if(window.location.href.indexOf("/users/") > -1) { | |
$("#login_information").wrap("<div class='scroller_div'></div>"); | |
$("#name_and_email").wrap("<div class='scroller_div'></div>"); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar página de vida academica | |
if(window.location.href.indexOf("/external_tools/61") > -1) { | |
$(".vida_academica_li").addClass("ic-app-header__menu-list-item--active"); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar página de cursos (INSCRIÇÕES PASSADAS / DISCIPLINAS CURSADAS) | |
if(window.location.href.indexOf("/courses?disciplinas=cursadas") > -1) { | |
$("#my_courses_table").remove(); | |
$("#my_groups_table").remove(); | |
$(".header-bar").remove(); | |
$( "h2:contains('Meus grupos')" ).remove(); | |
$( "h2:contains('Inscrições passadas')" ).text("Disciplinas cursadas"); | |
if(document.getElementById("past_enrollments_table") == null){ | |
$("#content").append('<div class="content-box pad-box-mini border border-trbl border-round"><p>Você ainda não finalizou nenhuma disciplina.</p></div>') | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar página de settings | |
if(window.location.href.indexOf("/profile/settings") > -1) { | |
$("#access_tokens_holder").wrap("<div class='scroller_div'></div>"); | |
$('.edit_settings_link').after('<a class="btn button-sidebar-wide" href="?alter=pass"><i class="icon-edit" aria-hidden="true"></i> Alterar Senha</a>'); | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na pagina avisos de curso | |
if(window.location.href.indexOf("/announcements") > -1) { | |
if ($(window).width() < medida_mobile) { | |
$("#add_announcement").css("margin", "12px"); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na pagina logout | |
if(window.location.href.indexOf("/logout") > -1) { | |
if ($(window).width() < medida_mobile) { | |
$(".custom_mobile_nav").hide(); | |
$(".ic-Login__content").attr("style","width: 80%;"); | |
$("img").attr("style","max-width: 50%; padding-left: 15px;"); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na pagina nota do aluno | |
$("#assignments").addClass('scroller_div'); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na pagina assignments do curso | |
if(window.location.href.indexOf("/assignments") > -1) { | |
if ($(window).width() < medida_mobile) { | |
$(".header-bar").addClass("flexBox_assignments"); | |
$(".assignment-search").attr("style", "width: 100%; margin-bottom: 10px;"); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na pagina assignment (dentro) | |
if(window.location.href.indexOf("/assignments/") > -1) { | |
//tirar rodape com avançar e voltar dentro da pagina de tarefa | |
var i = 0; | |
var interval = setInterval(function(){ | |
i = i+1; | |
$("#sequence_footer").attr("style","display: none !important;"); | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
//console.log(i); | |
}, 0); | |
var pathname = window.location.pathname; | |
var parametros = pathname.split("/"); | |
var id_curso = parametros[2]; | |
var id_assignment = parametros[4]; | |
if(window.location.href.indexOf("/edit?") == -1){ | |
$.getJSON("/api/v1/courses/"+id_curso+"/assignments/"+id_assignment+"", function(data) { | |
if(data['submission_types'] == 'external_tool'){ | |
//fehcar menu lateral | |
$("body").removeClass("course-menu-expanded").removeClass("primary-nav-expanded"); | |
$("#header").removeClass("menuDesktop"); | |
$(".ic-Layout-wrapper").removeClass("container-menuDesktop-style"); | |
$(".ic-app-header__logomark").attr("style","width: 48px; background-size: 322%; background-position-x: 6px; background-position-y: -5px;"); | |
$("#nav-tray-portal span").removeClass("submenu-desktop"); | |
$("#primaryNavToggle").hide(); | |
$("#courseMenuToggle").hide(); | |
$(".ic-app-nav-toggle-and-crumbs.no-print").hide(); | |
//final menu | |
//add classes na main e content e wrapper | |
$(".tool_content_wrapper").addClass("modal-lti modal-lti-assignment"); | |
$("#tool_content").addClass("modal-lti-content"); | |
$("#wrapper").addClass("wrapper-lti"); | |
//estilo | |
$("body").attr("style","background: #6f6f6f"); | |
$("#header").addClass("menu-lti"); | |
$(".tool_content_wrapper").attr("style","height: 99.2vh"); | |
$(".custom_overlay").remove(); | |
$(".custom_mobile_nav").remove(); | |
$(".menu-lti").on("mouseenter", function(){ | |
$(".wrapper-lti").attr("style","opacity:0.2"); | |
}); | |
$(".menu-lti").on("mouseleave", function(){ | |
$(".wrapper-lti").attr("style","opacity:1"); | |
}); | |
//add botao de fechar lti | |
$("body").prepend("<div class='fechar-lti'><svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1743.858.012L959.869 783.877 176.005.012 0 176.142l783.74 783.989L0 1743.87 176.005 1920l783.864-783.74L1743.858 1920l176.13-176.13-783.865-783.74 783.865-783.988z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg></div>"); | |
//acoes | |
$(document).on("click","#fechar-modal-lti",function() { | |
location.href = ""+canvas_link+"/courses"+"/"+""+id_curso+""; | |
}); | |
//mobile | |
if ($(window).width() < medida_mobile) { | |
$("body").attr("style","background: #eff3f6"); | |
$("#header").hide(); | |
$(".tool_content_wrapper").attr("style","height: calc(100vh - 70px);"); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1352.005.012l176.13 176.13L744.27 960.131l783.864 783.74L1352.005 1920 391.887 960.13z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg><span>BLUE</span>"); | |
} | |
$(window).resize(function() { | |
if ($(window).width() < medida_mobile) { | |
$("body").attr("style","background: #eff3f6"); | |
$("#header").hide(); | |
$(".tool_content_wrapper").attr("style","height: calc(100vh - 70px);"); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1352.005.012l176.13 176.13L744.27 960.131l783.864 783.74L1352.005 1920 391.887 960.13z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg><span>BLUE</span>"); | |
}else{ | |
$("body").attr("style","background: #6f6f6f"); | |
$("#header").show(); | |
$(".tool_content_wrapper").attr("style","height: 99.2vh"); | |
$("#left-side").hide(); | |
$(".fechar-lti").html("<svg id='fechar-modal-lti' viewBox='0 0 1920 1920' version='1.1' xmlns='http://www.w3.org/2000/svg'><path d='M1743.858.012L959.869 783.877 176.005.012 0 176.142l783.74 783.989L0 1743.87 176.005 1920l783.864-783.74L1743.858 1920l176.13-176.13-783.865-783.74 783.865-783.988z' stroke='none' stroke-width='1' fill-rule='evenodd'/></svg>"); | |
} | |
}); | |
} | |
}); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar tabela na pagina users do curso | |
$("div[data-view='users']").addClass('scroller_div'); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustes na nomeclatura dos menus | |
//painel | |
$("#global_nav_dashboard_link .menu-item__text").text("Página Inicial"); | |
//cursos | |
$("#global_nav_courses_link .menu-item__text").text("Disciplinas"); | |
$("#global_nav_courses_link").on("click", function(){ | |
var interval = setInterval(function(){ | |
i = i+1; | |
$("a:contains('Todos os Cursos')").text("Todas as Disciplinas"); | |
$("h2:contains('Cursos')").siblings("span").hide(); | |
$("h2:contains('Cursos')").text("Disciplinas"); | |
if(i > 2000){ | |
clearInterval(interval); | |
} | |
//console.log(i); | |
}, 0); | |
}); | |
//caixa de mensagem | |
$("#global_nav_conversations_link .menu-item__text").text("Caixa de Mensagem"); | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//ajustar as validações na pagina de settings | |
if(window.location.href.indexOf("profile/settings") > -1) { | |
if(CheckifAdmin == false){ | |
setInterval(function(){ | |
$("#user_time_zone").parent().parent().remove(); | |
$("label:contains('Fuso Horário:')").parent().parent().remove(); | |
$("#access_tokens_holder").hide(); | |
$("h2:contains('Integrações aprovadas:')").hide(); | |
$(".add_access_token_link").hide(); | |
$(".select_change_password_row").hide(); | |
}, 0); | |
}else{ | |
setInterval(function(){ | |
$(".select_change_password_row").hide(); | |
}, 0); | |
} | |
} | |
//bugs | |
$("#section-tabs .section").on("click", function(){ | |
var hreflink = $(this).find('a').attr("href"); | |
if(hreflink == window.location.pathname){ | |
$("#left-side").hide(); | |
$("body").removeClass("course-menu-expanded"); | |
} | |
}); | |
//biblioteca virtual para sala de capacitacao de preceptores | |
if(window.location.href.indexOf("/courses/1996") > -1) { | |
$("a:contains('Biblioteca Virtual')").text("Minha Biblioteca"); | |
}else{ | |
$("a:contains('Biblioteca Virtual')").parent().remove(); | |
} | |
},500) | |
});//end jquery | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment