diff --git a/portfolio-nuxt/components/IconButton.vue b/portfolio-nuxt/components/IconButton.vue
index 3581dea..dbc5cc9 100644
--- a/portfolio-nuxt/components/IconButton.vue
+++ b/portfolio-nuxt/components/IconButton.vue
@@ -2,12 +2,16 @@
-
-
+
+
-
-
+
+
+
+
+
+
+
@@ -67,11 +74,25 @@
const groupBy = (x,f)=>x.reduce((a,b,i)=>((a[f(b,i,x)]||=[]).push(b),a),{});
+ const isValidUrl = urlString => {
+ var urlPattern = new RegExp('^(https?:\\/\\/)?'+ // validate protocol
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // validate domain name
+ '((\\d{1,3}\\.){3}\\d{1,3}))'+ // validate OR ip (v4) address
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // validate port and path
+ '(\\?[;&a-z\\d%_.~+=-]*)?'+ // validate query string
+ '(\\#[-a-z\\d_]*)?$','i'); // validate fragment locator
+ return !!urlPattern.test(urlString);
+ }
+
+
const { data: images } = await useFetch('https://unboundedpress.org/api/images.files?pagesize=200')
const { data: works } = await useFetch('https://unboundedpress.org/api/works?pagesize=200', {
transform: (works) => {
for (const work of works) {
+ if(work.score){
+ work.score = "/scores/" + work.score
+ }
if(work.images){
let image_ids = [];
for (const image of work.images){
@@ -96,7 +117,18 @@
//const { data: pubs } = await useFetch('https://unboundedpress.org/api/publications?sort=-entryTags.year&pagesize=200')
const { data: pubs } = await useFetch('https://unboundedpress.org/api/publications?pagesize=200', {
transform: (pubs) => {
- return pubs.sort((a,b) => b.entryTags.year - a.entryTags.year)
+ for (const pub of pubs) {
+ if(pub.entryTags.howpublished && !(isValidUrl(pub.entryTags.howpublished))){
+ pub.entryTags.howpublished = "/pubs/" + pub.entryTags.howpublished
+ }
+ }
+ return pubs.sort((a,b) => {
+ let aPrime = 5000
+ let bPrime = 5000
+ if(a.entryTags.year === 'forthcoming'){aPrime = 5000} else {aPrime = a.entryTags.year}
+ if(b.entryTags.year === 'forthcoming'){bPrime = 5000} else {bPrime = b.entryTags.year}
+ return bPrime - aPrime
+ })
}
})
@@ -130,12 +162,3 @@
*/
-
\ No newline at end of file