Skip to content

I wanna open the repository page of GitHub in new tab #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Shineeeee opened this issue May 10, 2019 · 4 comments · Fixed by #842
Closed

I wanna open the repository page of GitHub in new tab #843

Shineeeee opened this issue May 10, 2019 · 4 comments · Fixed by #842

Comments

@Shineeeee
Copy link

Feature request

Open in new tab when set true to openNewTab key of window.$docsify

What problem does this feature solve?

Currently, open in currently tab when we click SVG of GitHub Corners.
But I wanna open the repository page of GitHub when at that time.

What does the proposed API look like?

We'll be able to open the repository page of GitHub in new tab by using this API.

How should this be implemented in your opinion?

I think you should be able to open the repository page of GitHub in new tab when we set true to openNewTab key of window.$docsify.

Are you willing to work on this yourself?

No. Sorry, I'm so busy now,,,

@Koooooo-7
Copy link
Member

Hi,
the issues seems like #835 .
and I tried to fix it #842 .

if you just wanna change the corner, I think it would work for you 😃

Just import your own docsify.js instead of
<script src="//unpkg.com/docsify"></script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

change the docsify.js like this

add the target=\"_blank\" into this function corner

function corner(data) {
    ...

  return (
    "<a href=\"" + data + "\"   target=\"_blank\"   class=\"github-corner\" 
  ...

@Shineeeee
Copy link
Author

Hi

THKU !!
I'll try it.

@quentinneyraud
Copy link

Hi,

I had the same issue an found an other solution maybe less restrictive:

// after all docsify scripts
<script type="text/javascript">
    window.addEventListener('click', function(e) {
      if (e.target.parentNode.closest('.github-corner')) {
        e.preventDefault()
        window.open(document.querySelector('.github-corner').href, '_blank')
      }
    })
 </script>

@anikethsaha
Copy link
Member

Hi,

I had the same issue an found an other solution maybe less restrictive:

// after all docsify scripts
<script type="text/javascript">
    window.addEventListener('click', function(e) {
      if (e.target.parentNode.closest('.github-corner')) {
        e.preventDefault()
        window.open(document.querySelector('.github-corner').href, '_blank')
      }
    })
 </script>

You can create a plugin as well with this script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants