PubMed Research

Adds a "Research" button that searches the current query on PubMed

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        PubMed Research
// @namespace   http://tampermonkey.net/
// @version     1.0
// @description Adds a "Research" button that searches the current query on PubMed
// @author      UnitedPenguin
// @git         https://github.com/UnitedPenguin/PubMed-Automatic-Research
// @include     http://*
// @include     https://*
// @license     MIT
// @grant       none
// ==/UserScript==

(function() {
    'use strict';

    // create the "Research" button and style it
    let btn = document.createElement("button");
    btn.innerHTML = "Research";
    btn.style.position = "fixed";
    btn.style.bottom = "10px";
    btn.style.right = "10px";
    btn.style.zIndex = 9999;

    // add the button to the page
    document.body.appendChild(btn);

    // when clicked, search the current query on PubMed
    btn.onclick = function() {
        // get the current search query from the search bar
        let input = document.querySelector('input[name=q]');

        if (input && input.value) {
            // redirect to PubMed with the search query
            window.location.href = `https://pubmed.ncbi.nlm.nih.gov/?term=${encodeURIComponent(input.value)}`;
        }
    };

})();