All pastes #799847 Raw Edit

Something

public javascript v1 · immutable
#799847 ·published 2007-11-27 22:19 UTC
rendered paste body
String.prototype.trim = function() {	return this.replace(/^\s+|\s+$/g,"");}String.prototype.ltrim = function() {	return this.replace(/^\s+/,"");}String.prototype.rtrim = function() {	return this.replace(/\s+$/,"");}String.prototype.htmltags = function () {	return this.replace(/<\/?[^>]+(>|$)/g, "");}function digg() {	var base_url = 'http://digg.com/submit?';	var phase = 'phase=2';	var article_url = window.location;	var title = document.getElementById('story_title').innerHTML;	var bodytext = snippetwop(document.getElementById('bodytext').innerHTML, 350);	bodytext = bodytext.htmltags();		var url = base_url + phase + '&url=' + article_url + '&title=' + title		+ '&bodytext=' + bodytext;		var newwindow = window.open(url,'Digg! This Story');	if (window.focus) {newwindow.focus();}}function facebook() {	var base_url = 'http://www.facebook.com/sharer.php?';	var article_url = window.location.href;	var title = document.getElementById('story_title').innerHTML;		var url = base_url + 'u=' + article_url + '&t=' + title;		var newwindow = window.open(url,'Facebook!');}function snippetwop(text, length, tail) {	var length = typeof(length) != 'undefined' ? length : 64;	var tail = typeof(tail) != 'undefined' ? tail : '...';		text = text.trim();	var txtl = text.length;		if(txtl > length) {		for(var i=1; text[length-i]!=" "; i++) {			if(i == length) {				return text.substr(0,length) + tail;			}		}		for(; text[length-i]=="," || text[length-i]=="." || text[length-i]==" "; i++) {;}		text = text.substr(0,length-i+1) + tail;	}	return text;}