Sha256: 1b9e0f09e5a05cd245f44092041beec98f343752339540d467b877abaa861396

Contents?: true

Size: 780 Bytes

Versions: 5

Compression:

Stored size: 780 Bytes

Contents

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

function editSelected(web_root)
{
	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 = web_root+escape(txt)
	}
}

function hotkey( event, web_root )
{
 	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(web_root);
		}
	}
	}
}

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
gf-Soks-1.0.4 templates/default/attachment/newpage.js
Soks-1.0.0 templates/default/attachment/newpage.js
Soks-1.0.1 templates/default/attachment/newpage.js
Soks-1.0.2 templates/default/attachment/newpage.js
Soks-1.0.3 templates/default/attachment/newpage.js