uni los archivos de resources para menos transferencias

This commit is contained in:
Daniel Cortés
2019-10-16 18:37:55 -03:00
parent ec298fba05
commit 75d3a1f5ed
13 changed files with 3100 additions and 46 deletions

13
resources/js/admin.js vendored
View File

@@ -1,3 +1,5 @@
require("./app.js")
function is_admin_post_route() {
const posts_edit_regexp = new RegExp("/admin/posts/\\d+/edit");
return (
@@ -34,7 +36,7 @@ function is_admin_setups_route() {
);
}
function admin_highlight() {
function admin_highlight_route() {
if(is_admin_post_route()){
document.getElementById("posts-link").classList.add("menu-highlight");
}
@@ -49,7 +51,7 @@ function admin_highlight() {
}
}
function preview() {
function preview_md() {
const previewButton = document.getElementById("preview");
const mainButton = document.getElementById("main");
@@ -68,9 +70,6 @@ function preview() {
});
}
function main() {
admin_highlight();
preview();
}
window.onload = main;
admin_highlight_route();
preview_md();

55
resources/js/app.js vendored
View File

@@ -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();

View File

@@ -1,8 +1,8 @@
const prismjs = require("prismjs")
require("prismjs/components/prism-java.js");
require("prismjs/components/prism-php.js");
require("prismjs/components/prism-php-extras.js");
require("prismjs/components/prism-markup-templating.js");
console.log(prismjs);
prismjs.highlightAll();