paperlined.org
apps > bookmarklets > html
document updated 19 years ago, on Nov 25, 2005
drag_and_rename (533 characters)



// Upload the HTML associated with the selection to a CGI script.
// At 506 bytes, this works.  Add 11 more bytes of anything and it breaks.
//

// Tested on IE5.5 and IE6.0

void(q = '');
void(l = '');

// When no frames
f = document.frames;
if (f.length == 0)
{
	q = document.selection.createRange().htmlText;
	l = document.location;
}

// When there are frames
for (i=0; i<f.length; i++)
{
	d = f[i].document;
	q =                           d.selection.createRange().htmlText;
	l =                           d.location;
	if (q != '')
		break;
}

// Display the results
if (q)
{
	//alert(q);
	d = window.open('', '').document;
	//d.write(q);
	d.writeln('<FORM METHOD=POST ACTION=http://68k.org/cgi-bin/cgiwrap/interiot/receive_img>'
		+ '<INPUT TYPE=HIDDEN NAME=content>'
		+ '<INPUT TYPE=HIDDEN NAME=base_href></FORM>');

	d.forms[0][0].value = q;
	d.forms[0][1].value = l;
	d.forms[0].submit();
}