Fixed page hash handling
This commit is contained in:
parent
aa45f6c2eb
commit
e2bed255f1
51
js/main.js
51
js/main.js
@ -70,16 +70,29 @@ function setPage(path){
|
|||||||
const len = $("#article-container > article").length;
|
const len = $("#article-container > article").length;
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
$("#article-container > article").each((i, elmt) => {
|
$("#article-container > article").each((i, elmt) => {
|
||||||
$(elmt).html(marked($(elmt).html(), markedOpt, (err, res) => {
|
|
||||||
|
marked($(elmt).html(), markedOpt, (err, res) => {
|
||||||
|
$(elmt).html(res);
|
||||||
|
|
||||||
cnt++;
|
cnt++;
|
||||||
if(cnt === len){
|
if(cnt === len){
|
||||||
if(path == "/skills"){
|
if(path == "/skills"){
|
||||||
// wow such ugly hack... any it works (and when it fails only the graph title disappear, so no big deal)
|
skillsPageSetup();
|
||||||
setTimeout(skillsPageSetup, 500);
|
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
if(window.location.hash != ""){
|
||||||
|
target = $(window.location.hash);
|
||||||
|
if(target.length > 0){
|
||||||
|
target = target[0];
|
||||||
|
$('html,body').animate({
|
||||||
|
scrollTop: (target.offsetTop)
|
||||||
|
}, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, 500);// I'm lazy to search a way to wait for the view engine to be updated, 500ms should be fine
|
||||||
}
|
}
|
||||||
return res;
|
});
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.fail((err) => {
|
.fail((err) => {
|
||||||
@ -254,21 +267,21 @@ function skillsPageSetup(){
|
|||||||
{
|
{
|
||||||
var ctx = document.getElementById("tools").getContext("2d");
|
var ctx = document.getElementById("tools").getContext("2d");
|
||||||
var data = {
|
var data = {
|
||||||
labels : ["Git", "Gitlab / Github / Gitea", "GitlabCI / TravisCI / CircleCI"],
|
labels : ["Git", "Gitlab / Github / Gitea", "GitlabCI / TravisCI / CircleCI"],
|
||||||
datasets : [{
|
datasets : [{
|
||||||
fillColor : "rgba(83, 142, 193, 0.5)",
|
fillColor : "rgba(83, 142, 193, 0.5)",
|
||||||
strokeColor : "rgb(96, 145, 255)",
|
strokeColor : "rgb(96, 145, 255)",
|
||||||
pointColor : "rgb(26, 118, 226)",
|
pointColor : "rgb(26, 118, 226)",
|
||||||
pointStrokeColor : "#fff",
|
pointStrokeColor : "#fff",
|
||||||
data : [100, 90, 80]
|
data : [100, 90, 80]
|
||||||
},{
|
},{
|
||||||
strokeColor : "rgba(0,0,0,0)",
|
strokeColor : "rgba(0,0,0,0)",
|
||||||
pointColor : "rgba(0,0,0,0)",
|
pointColor : "rgba(0,0,0,0)",
|
||||||
data : [0, 100]
|
data : [0, 100]
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
graphoptions["graphTitle"] = "Tools";
|
graphoptions["graphTitle"] = "Tools";
|
||||||
new Chart(ctx).Radar(data,graphoptions);
|
new Chart(ctx).Radar(data,graphoptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user