-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { useState } from 'uland-isomorphic' | ||
import { useWindow } from './useWindow.js' | ||
|
||
export function useQuery () { | ||
const window = useWindow() | ||
const [query] = useState(new URLSearchParams(window?.document?.location?.search)) | ||
|
||
return query | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env browser */ | ||
import { html, render, useEffect } from 'uland-isomorphic' | ||
import { useUser } from '../hooks/useUser.js' | ||
|
||
export function addBookmarkPage () { | ||
const { user, loading } = useUser() | ||
|
||
useEffect(() => { | ||
if (!user && !loading) window.location.replace('/login') | ||
}, [user, loading]) | ||
|
||
return html` | ||
<li> | ||
<a class="bookmarklet" href="javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('https://breadcrum.net/bookmarks/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'🥖 Bredcrum','toolbar=no,scrollbars=yes,width=750,height=700'));"> | ||
add bookmark popup | ||
</a> is a slightly larger bookmarklet that shows a clickable tag cloud. | ||
</li> | ||
<li> | ||
<a class="bookmarklet" href="javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('http://localhost:3000/bookmarks/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'🥖 Bredcrum','toolbar=no,scrollbars=yes,width=750,height=700'));"> | ||
locahost add bookmark popup | ||
</a> is a slightly larger bookmarklet that shows a clickable tag cloud. | ||
</li> | ||
` | ||
} | ||
|
||
if (typeof window !== 'undefined') { | ||
render(document.querySelector('.bc-main'), addBookmarkPage) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { html } from 'uland-isomorphic' | ||
import { addBookmarkPage } from './client.js' | ||
|
||
export default async function () { | ||
return html` | ||
${addBookmarkPage()} | ||
` | ||
} |