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



// Upload the HTML associated with the selection to a CGI script.
// This doesn't work.  The only difference between this and post_html2 is that it contains the about:blank below.  It's not the about:blank that does
// it because if the about:blank is added but other code is taken away, it will still executing the rest of the code.

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('about:blank', '').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();
}