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.
/* Any JavaScript here will be loaded for all users on every page load. */
/* ======================================= Template:Notes toggle  ======================================= */
function toggleReferences() {
  var x = document.getElementById("content");
  var y = x.getElementsByClassName("reference");
  var i;
  for (i = 0; i < y.length; i++) {
    if (y[i].style.display === "none") {
      y[i].style.display = "inline";
    } else {
      y[i].style.display = "none";
    }
  }
  var z = x.getElementsByClassName("mw-references-wrap");
  for (i = 0; i < z.length; i++) {
    if (z[i].style.display === "none") {
      z[i].style.display = "inline";
    } else {
      z[i].style.display = "none";
    }
  }
}

/* ======================================= All texts  ======================================= */
function toggleListTable() {
  var x = document.getElementById("all-texts-table");
  if (x.style.display === "block") {
      x.style.display = "none";
    } else {
      x.style.display = "block";
    }
  var y = document.getElementById("all-texts-list");
  if (y.style.display === "none") {
      y.style.display = "block";
    } else {
      y.style.display = "none";
    }
}

/* ======================================= customising text in Special:Search ======================================= */
$(function searchText() {
	if (window.location.href.indexOf("search") != -1 || window.location.href.indexOf("Special:Search") != -1) {
		var x = document.getElementById("content");
		var y = x.getElementsByClassName("tagline");
		var i;
		for (i = 0; i < y.length; i++) {
			y[i].innerHTML = '<p style="line-height: 180%;">The search functionality can be considered to operate on <strong>whole words</strong>, separated by spaces or other punctuation marks.</p><p style="line-height: 180%;">The results will only include pages that contain <strong>all</strong> the words in your search.</p><p style="line-height: 180%;">You can search for a <strong>phrase</strong> using "double quotes".</p>';
		}
	}
}());

/* ======================================= template:Top ======================================= */
if (document.getElementById('custom-tooltip')) {
	document.getElementById('custom-tooltip').addEventListener('click', closeTooltip); 
}

function closeTooltip() {
  document.getElementById("custom-tooltip").style.visibility = "hidden";
}

/* ======================================= template:Print Button ======================================= */
if (document.getElementById('print-button')) {
	document.getElementById('print-button').addEventListener('click', customPrint); 
}

function customPrint() {
	window.print();
}

/* ======================================= template:Menu bar ======================================= */
function openExportOptions() {
  document.getElementById("export-options").style.display = "block";
}

function toggleExportOptions() {
	var x = document.getElementById("export-options");
	if (x.style.display === "block") {
		x.style.display = "none";
	} else {
		x.style.display = "block";
	}
}

function closeExportOptions() {
  document.getElementById("export-options").style.display = "none";
}

/* ======================================= Tractatus Logico-Philosophicus (tree-like view) ======================================= */

// Template:TLP drawer
function TLPExpandDe(x) {
  var content = document.getElementById('tlp-children-'+x); //outputs something like document.getElementById("tlp-children-1.21")
  var button = document.getElementById('tlp-button-text-'+x); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (content.style.display == "block") {
    content.style.display = "none";
    button.innerHTML = "Ausklappen";
  } else {
    content.style.display = "block";
    button.innerHTML = "Einklappen";
  }
}

function TLPExpandEn(x) {
  var content = document.getElementById('tlp-children-'+x); //outputs something like document.getElementById("tlp-children-1.21")
  var button = document.getElementById('tlp-button-text-'+x); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (content.style.display == "block") {
    content.style.display = "none";
    button.innerHTML = "Expand";
  } else {
    content.style.display = "block";
    button.innerHTML = "Collapse";
  }
}

function TLPExpandFr(x) {
  var content = document.getElementById('tlp-children-'+x); //outputs something like document.getElementById("tlp-children-1.21")
  var button = document.getElementById('tlp-button-text-'+x); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (content.style.display == "block") {
    content.style.display = "none";
    button.innerHTML = "Afficher";
  } else {
    content.style.display = "block";
    button.innerHTML = "Masquer";
  }
}


function TLPExpandIt(x) {
  var content = document.getElementById('tlp-children-'+x); //outputs something like document.getElementById("tlp-children-1.21")
  var button = document.getElementById('tlp-button-text-'+x); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (content.style.display == "block") {
    content.style.display = "none";
    button.innerHTML = "Espandi";
  } else {
    content.style.display = "block";
    button.innerHTML = "Comprimi";
  }
}

function TLPExpandEs(x) {
  var content = document.getElementById('tlp-children-'+x); //outputs something like document.getElementById("tlp-children-1.21")
  var button = document.getElementById('tlp-button-text-'+x); //outputs something like document.getElementById("tlp-button-text-1.21")
  if (content.style.display == "block") {
    content.style.display = "none";
    button.innerHTML = "Mostrar";
  } else {
    content.style.display = "block";
    button.innerHTML = "Ocultar";
  }
}

function drawerExpand(x) {
  var content = document.getElementById("drawer-content-"+x);
  var button = document.getElementById("drawer-button-"+x);
  if (content.style.display == "block") {
    content.style.display = "none";
	button.innerHTML = "Expand";
  } else {
    content.style.display = "block";
    button.innerHTML = "Collapse";
  }
}

/* ======================================= Tractatus Logico-Philosophicus (static tree-like view) ======================================= */
//change link target to tree-structured version
var numbers = document.querySelectorAll(".static-tree-like-tlp-container a");
console.log("lunghezza: "+numbers.length);
var i;
for (i = 0; i < numbers.length; i++) {
  var target = numbers[i].href;
  target = target.replace("Logisch-philosophische_Abhandlung", "Logisch-philosophische_Abhandlung_(statische_Darstellung_in_Baumstruktur)");
  numbers[i].href = target;
}

//add arrows linking to expanded child proposition
var numbersOfRemarksWithChildren = document.querySelectorAll('.tlp-pr-with-children .tlp-aside-par');
for (i = 0; i < numbersOfRemarksWithChildren.length; i++) {
    var oldNumberString = numbersOfRemarksWithChildren[i].innerHTML;
    var numberStringId = numbersOfRemarksWithChildren[i].id;
    var newNumberString = oldNumberString + ' <a href="#separator-' + numberStringId + '" class="follow-branch-arrow">→</a>';
    numbersOfRemarksWithChildren[i].innerHTML = newNumberString;
}

/* ======================================= Tractatus Logico-Philosophicus (multilingual side-by-side view) ======================================= */
function hide_show_table(col_name)
{
 var checkbox_val=document.getElementById(col_name).value;
 if(checkbox_val=="hide")
 {
  var all_col=document.getElementsByClassName(col_name);
  for(var i=0;i<all_col.length;i++)
  {
   all_col[i].style.display="none";
  }
  document.getElementById(col_name+"_head").style.display="none";
  document.getElementById(col_name).value="show";
 }
	
 else
 {
  var all_col=document.getElementsByClassName(col_name);
  for(var i=0;i<all_col.length;i++)
  {
   all_col[i].style.display="table-cell";
  }
  document.getElementById(col_name+"_head").style.display="table-cell";
  document.getElementById(col_name).value="hide";
 }
}

/* ======================================= Matomo tracking code ======================================= */
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
	var u="//wittgensteinproject.org/matomo/";
	_paq.push(['setTrackerUrl', u+'matomo.php']);
	_paq.push(['setSiteId', '1']);
	var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
	g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();