PageSourceSearch

https://geraldox.netlify.app/src/router/index.js

js geraldox.netlify.app collected 2026-10-03 10:49:30 UTC 4,456 bytes, 159 lines download raw bytes

1import cdn from '../lib/cdn.js' //this import to use cdn links
2
3const Home = httpVueLoader('/src/views/Home.vue')
4const HomeOld = httpVueLoader('/src/views/HomeOld.vue')
5const About = httpVueLoader('/src/views/About.vue')
6const Politica = httpVueLoader('./src/views/Politicaprivacidade.vue')
7const Projects = httpVueLoader('/src/views/Projects.vue')
8const Blog = httpVueLoader('/src/components/blog/Blog.vue')
9const Mapa = httpVueLoader('/src/components/blog/mapa.vue')
10const UserPost = httpVueLoader('/src/components/blog/UserPost.vue')
11const Categories = httpVueLoader('/src/components/blog/Categories.vue')
12const Routersearch = httpVueLoader('/src/components/blog/Routersearch.vue')
13const AdvancedSearch = httpVueLoader('/src/components/blog/AdvancedSearch.vue')
14
15const homeBottom = {
16  template: `<p>Powered by <i class="fa-brands fa-vuejs"></i></p>`,
17}
18
19const gdrive = {
20  template: `<p><a href="https://1drv.ms/b/s!Aol5qLKOISMzgaAfdSoD5CJOgE5sHg?e=98NxhY" target="_blank">Português - {OneDrive}</a></p>`,
21}
22const Resume = {
23  // need route name ?{{$route.name}}
24  template: `<p><a href="${cdn.dropfiles}/geraldo_resume_ptbr.pdf" target="_blank">Português</a>  - <a href="${cdn.dropfiles}/geraldo_resume_eng.pdf"  target="_blank">English</a></p>`,
25}
26
27const NotFound = {
28  template: `<h1>404</h1>`,
29}
30
31const routes = [
32  {
33    path: '/',
34    components: { default: Home, homeBottom: homeBottom },
35    name: 'Home Page',
36  },
37  {
38    path: '/homeold',
39    components: { default: HomeOld },
40    name: 'OldHome',
41  },
42  {
43    path: '/blog',
44    name: 'Blog Posts',
45    component: Blog,
46    children: [
47      {
48        path: 'mapa',
49        name: 'categoriesMap',
50        component: Mapa,
51      },
52      {
53        path: 'search', // search?name=geraldo
54        name: 'search',
55        component: Routersearch,
56      },
57      {
58        path: 'advancedsearch', // advancedsearch?name=geraldo
59        name: 'advancedsearch',
60        component: AdvancedSearch,
61      },
62      /* DYNAMIC ROUTER :anything below must be in the end */
63      /* TO SEND PARAMS IN ROUTER USE path */
64      {
65        path: ':category',
66        name: 'category',
67        component: Categories,
68      },
69      {
70        path: ':category/:slug+',
71        name: 'threads',
72        component: UserPost,
73      },
74    ],
75  },
76  {
77    path: '/projectsx',
78    component: Projects,
79    name: 'projectsx',
80  },
81  {
82    path: '/projects2',
83    component: httpVueLoader('/src/views/Projects_old.vue'),
84    name: '',
85  },
86  {
87    path: '/about',
88    component: About,
89    name: 'about',
90    children: [
91      { path: 'resume', name: 'r1', component: Resume },
92      { path: 'resume-server2', name: 'r2', component: gdrive },
93    ],
94  },
95  {
96    path: '/politica-privacidade',
97    component: Politica,
98    name: '',
99  },
100  { path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound },
101]
102
103// CHECK is deploy or production environment - by GMAP
104// if has any por like localhost:5000 / 192.168.0.1:4434 return true and apply hash
105
106const producOrDevMode = location.port != ''
107//OLD const producOrDevMode = location.hostname.includes('127.0.0.1')
108
109const router = new VueRouter({
110  mode: producOrDevMode ? '' : 'history',
111  routes,
112  scrollBehavior(to, from, savedPosition) {
113    if (to.hash) {
114      console.log(`tohash`, to.hash)
115      return {
116        selector: to.hash,
117        // offset: { x: 0, y: 10 },
118      }
119    }
120    return { x: 0, y: 0, behavior: 'smooth' } // always scroll to top - working mesmo desativado no desktop, problema ocorre no mobile
121  },
122})
123
124router.beforeResolve(async (to, from, next) => {
125  if (to) {
126    // showPinner ?
127    NProgress.configure({ showSpinner: false })
128    NProgress.start()
129  }
130  next()
131})
132
133router.afterEach((to, from) => {
134  // Complete the animation of the route progress bar.
135  NProgress.configure({ easing: 'ease', speed: 1000, showSpinner: false })
136  NProgress.done()
137
138  if (to.hash) {
139    setTimeout((() => {
140      location.href = to.hash
141    }), 1000)
142  }
143})
144
145//Pegar primeira letra da String e deixar UpperCase() by geraldoX
146/* const DEFAULT_TITLE = 'geraldoX - '
147router.afterEach((to, from) => {
148  Vue.nextTick(() => {
149    document.title =
150      DEFAULT_TITLE +
151      to.path.charAt(1).toLocaleUpperCase() +
152      to.path.substring(2)
153    //truque by geraldoX para melhorar o titulo da Home Page em vez de uma simples barra
154    if (to.path == `/`) {
155      document.title = `${DEFAULT_TITLE} Home Page`
156    }
157  })
158}) */
159export default router

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.