Pop-up window

Open current page or links to a standalone window without UI elements

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Pop-up window
// @namespace   Open current page or links to a standalone window without UI elements
// @match       *://*/*
// @grant       none
// @version     Alpha-v1
// @description Open current page or links to a standalone window without UI elements
// @author      JesusisLord
// @license     MIT
// ==/UserScript==
(function() {
  "use strict";

  function createStandaloneWindow(url, targetWindow = window) {
    const win = targetWindow.open(url, "_blank", "width=800,height=600,toolbar=no,location=no,menubar=no,scrollbars=no");
    win.focus();
    return win;
  }

  const openLinkHandler = (event) => {
    // Prevent default link behavior (needed):
    event.preventDefault();
    const url = event.target.href || event.target.parentNode.href;
    createStandaloneWindow(url);
  };

  const movePageHandler = () => {
    createStandaloneWindow(window.location.href);
  };

  document.addEventListener("click", (event) => {
    if (event.ctrlKey) {
      if (event.target.nodeName === "A") {
        openLinkHandler(event);
      } else if (!event.target.isContentEditable && !event.target.matches('input, textarea, button, select')) {
        event.preventDefault(); // Optional: Prevent default actions on empty space
        movePageHandler();
      }
    }
  });
})();