MediaWiki:Vector.js

From Abiotic Factor Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* All JavaScript here will be loaded for users of the Vector skin */

$.getScript("https://unpkg.com/@popperjs/core@2", function() {
  $.getScript("https://unpkg.com/tippy.js@6", function() {
  	tippy('.tippy-from-template', {
  	  duration: 0,
  	  // followCursor: true,
  	  arrow: false,
  	  showOnCreate: true,
  	  theme: 'af-item',
  	  appendTo: function() { return document.body },
	  content: function(reference) {
	    const id = reference.getAttribute('data-template')
	    const container = document.createElement('div')
	    
	    const linkedTemplate = document.getElementById(id)
	    container.appendChild(linkedTemplate)
	    
	    linkedTemplate.classList.remove("tippy-template")
	    
	    return container
	  }
	})
  });
});