All pastes #592422 Raw Edit

Miscellany

public text v1 · immutable
#592422 ·published 2007-06-27 19:18 UTC
rendered paste body
// Author: Dewayne Debbs
// Date 6/13/2007
// If a #content div is longer than x pixels, create a "back to top" link.
function backToTops() {
  var c=document.getElementById("content");
  var s=document.getElementById("smallcontent");
  if (c && c.offsetHeight>400 && !s) {
  	var link = document.createElement('a');
		link.setAttribute('href', '#top');
		link.setAttribute('class', 'toplink');
		link.setAttribute('className', 'toplink');
		link.innerHTML = 'Back to top';
		c.appendChild(link);
  }
}


// Author: Dewayne Debbs
// Date: 06/25/2007
// Changes all links with rel="external" to use javascript
function modifyPopups() {
	var a=document.getElementsByTagName("a");
	for(var i=0;i<a.length;i++){
	  if (a[i].rel=="external") {
		  a[i].onclick = popUp;
	  }
	}
}

function popUp() {
	var newWindow = window.open(this.getAttribute('href'), '', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,left = 20,top = 20');
	newWindow.focus();
	return false;
}