Sha256: a1bbbc47fc94b3683571a94526d3d474c309004bb47e11ad2efc5f1cf85fe4fc

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

function trim(str) 
{ 
	return str.replace(/^\s+/,'').replace(/\s+$/,'');
}

function editSelected()
{
	if (window.getSelection)
	{
		txt = window.getSelection();
	}
	else if (document.getSelection)
	{
		txt = document.getSelection();
	}
	else if (document.selection)
	{
		txt = document.selection.createRange().text;
	}
	if(!txt){
	void(txt=prompt('Please enter the title of the page you wish to create',''))
	}
	if(txt){
		window.location = '/edit/'+escape(trim(txt))
	}
}

function hotkey( event )
{
 	event = (event) ? event : ((window.event) ? event : null);
	if (event)
	{
	if (event.ctrlKey ) 
	{
		var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode);
		if (charCode == 14 ) { 
			editSelected();
		}
	}
	}
}

function validateTitle( proposed_title ) 
{
	var illegalcharacters = /[\\\[\]\?<>&\^\/]/;
	if (illegalcharacters.test( proposed_title ) == true ) 
	{
		alert( 'Unfortunately the characters \ / [ ] ? < > & ^ in titles cause problems with Soks. Please try not to use them.');
	}
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Soks-0.0.7 templates/default/attachment/newpage.js