Improve ajax for dynamic load of snippets

This commit is contained in:
JoseluCross
2018-10-17 17:02:55 +02:00
parent b57cf63426
commit c116289e13
2 changed files with 8 additions and 15 deletions

View File

@@ -29,7 +29,9 @@ function reHightlight(){
var codebox = document.getElementsByClassName("toHightlight"); var codebox = document.getElementsByClassName("toHightlight");
for(var i=0;i<codebox.length;++i){ for(var i=0;i<codebox.length;++i){
hljs.highlightBlock(codebox[i]); hljs.highlightBlock(codebox[i]);
codebox.classList.remove('toHightlight'); }
for(var i=0;i<codebox.length;++i){
codebox[i].classList.remove('toHightlight');
} }
} }
@@ -101,13 +103,6 @@ function borrarCookie(clave){
crearCookie(clave,"",-1); crearCookie(clave,"",-1);
} }
function desloguearse(){
borrarCookie("logueado");
borrarCookie("usuario");
borrarCookie("token");
location.reload(true);
}
function unselectAll() { function unselectAll() {
var checkboxes = document.getElementsByClassName("codeFilterCheckBoxInput"); var checkboxes = document.getElementsByClassName("codeFilterCheckBoxInput");
var i; var i;
@@ -145,10 +140,10 @@ function resetFilter(){
resetOffset(); resetOffset();
} }
resetOffset(); o=1;
$(window).scroll(function () { $(window).scroll(function () {
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) { if (Math.ceil($(window).scrollTop() + $(window).height())== Math.ceil($(document).height())) {
getAjax(); getAjax();
} }
}); });

File diff suppressed because one or more lines are too long