Notion.so - App Deeplink Injector

Add a 'Open in App' button to the sign in page

  1. // ==UserScript==
  2. // @name Notion.so - App Deeplink Injector
  3. // @name:en Notion.so - App Deeplink Injector
  4. // @description Add a 'Open in App' button to the sign in page
  5. // @namespace https://github.com/CDeLeon94/NotionAppLink/
  6. // @match https://www.notion.so/*
  7. // @run-at document-start
  8. // @version 0.0.1
  9. // @grant GM.setValue
  10. // @grant GM.getValue
  11. // ==/UserScript==
  12.  
  13. function open_app() {
  14. pageid = window.location.href.match(/https:\/\/www\.notion\.so\/(.*)/)[1];
  15. window.open("notion:/".concat(pageid));
  16. window.close()
  17. }
  18.  
  19. function get_button_root()
  20. {
  21. return document.querySelector('.notion-login')
  22. }
  23.  
  24. function button_setup(){
  25. console.log('button_setup')
  26. if (get_button_root() == null) {
  27. window.requestAnimationFrame(button_setup)
  28. } else {
  29. newButton = document.createElement("div");
  30. newButton.innerText = "Open In App";
  31. newButton.style="user-select: none; transition: background 20ms ease-in 0s; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; height: 36px; border-radius: 3px; color: white; font-size: 14px; line-height: 1; padding-left: 12px; padding-right: 12px; font-weight: 500; background: rgb(54, 53, 47); border: 1px solid rgb(190, 86, 67); box-shadow: rgba(15, 15, 15, 0.1) 0px 1px 2px; margin-bottom: 14px; width: 100%;";
  32. newButton.addEventListener('click', open_app);
  33. get_button_root().insertAdjacentElement('afterbegin', newButton);
  34. }
  35. }
  36.  
  37. button_setup()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址