uni los archivos de resources para menos transferencias
This commit is contained in:
55
resources/js/app.js
vendored
55
resources/js/app.js
vendored
@@ -1,15 +1,44 @@
|
||||
// Highlight links if in his page
|
||||
if(window.location.pathname == "/blog" || window.location.pathname == "/blog.archive")
|
||||
document.getElementById("blog-link").classList.add("menu-highlight");
|
||||
else if(window.location.pathname == "/now")
|
||||
document.getElementById("now-link").classList.add("menu-highlight");
|
||||
else if(window.location.pathname == "/projects")
|
||||
document.getElementById("projects-link").classList.add("menu-highlight");
|
||||
else if(window.location.pathname == "/setups")
|
||||
document.getElementById("setup-link").classList.add("menu-highlight");
|
||||
require("./prism.js")
|
||||
|
||||
// Makes all images clickeable
|
||||
var images = document.getElementsByTagName("img");
|
||||
for(i = 0; i < images.length; i++) {
|
||||
images[i].onclick = (e) => { window.open(e.target.src, '_blank') }
|
||||
function is_blog_route() {
|
||||
const blog_regexp= new RegExp("/blog/\\d+");
|
||||
return (
|
||||
window.location.pathname == "/blog" ||
|
||||
window.location.pathname == "/blog/archive" ||
|
||||
window.location.pathname.match(blog_regexp)
|
||||
);
|
||||
}
|
||||
|
||||
function is_now_route() {
|
||||
return window.location.pathname == "/now";
|
||||
}
|
||||
|
||||
function is_projects_route() {
|
||||
return window.location.pathname == "/projects";
|
||||
}
|
||||
|
||||
function is_setups_route() {
|
||||
return window.location.pathname == "/setups";
|
||||
}
|
||||
|
||||
function highlight_route() {
|
||||
if(is_blog_route()){
|
||||
document.getElementById("blog-link").classList.add("menu-highlight");
|
||||
}else if(is_now_route()){
|
||||
document.getElementById("now-link").classList.add("menu-highlight");
|
||||
}else if(is_projects_route()){
|
||||
document.getElementById("projects-link").classList.add("menu-highlight");
|
||||
}else if(is_projects_route()){
|
||||
document.getElementById("setup-link").classList.add("menu-highlight");
|
||||
}
|
||||
}
|
||||
|
||||
function make_images_clickeable() {
|
||||
var images = document.getElementsByTagName("img");
|
||||
for(i = 0; i < images.length; i++) {
|
||||
images[i].onclick = (e) => { window.open(e.target.src, '_blank') }
|
||||
}
|
||||
}
|
||||
|
||||
highlight_route();
|
||||
make_images_clickeable();
|
||||
|
||||
Reference in New Issue
Block a user