Wikipedia Preview User Script

Shows article preview popup on hovering Wikipedia links, using Wikipedia Preview (https://www.mediawiki.org/wiki/Wikipedia_Preview)

  1. // ==UserScript==
  2. // @name Wikipedia Preview User Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.0
  5. // @description Shows article preview popup on hovering Wikipedia links, using Wikipedia Preview (https://www.mediawiki.org/wiki/Wikipedia_Preview)
  6. // @author Diego de la Hera
  7. // @match *://*/*
  8. // @exclude *://*.wikipedia.org/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. let scriptElem = document.createElement("script");
  17. scriptElem.setAttribute("src", "https://unpkg.com/wikipedia-preview/dist/wikipedia-preview.production.js");
  18. document.body.appendChild(scriptElem);
  19. scriptElem.onload = () => {
  20. wikipediaPreview.init({
  21. root: document,
  22. detectLinks: true
  23. });
  24. };
  25.  
  26. })();