display | more...
This is a request for comments. Please message me with your thoughts.

You can see a working demo at JayBonci's scratcher if you are really super special. What this will do is allow you to append text on to your scratch pad by selecting it, and clicking on a simple Scratch-It! button in the Personal Nodes section. Currently, the JavaScript implementation is not browser specific, and is known to work on Netscape and IE. Update: This seems to be broken in Konqueror. I'm looking at that now.

The code for the Scratch-It! button looks like this. Thanks go out to wharfinger for his toy:

	function addToScratch(addHow)
		var mySel;

		{mySel = document.getSelection();}
				{mySel = document.selection.createRange().text;}
				{alert("Your browser doesn't support this feature"); return; } //Sorry!

		if(mySel == "")
			alert("Nothing to add!  Select some text first");
			document.forms.scratcher.skratch.value = mySel;

                        if(addHow == 1)
                        {document.forms.scratcher.flavor.value = "append";}
                  else{document.forms.scratcher.flavor.value = "prepend";}


// -->

<form method="post" name="scratcher">
<input type="hidden" name="flavor" value="">
<input type="hidden" name="sexisgood" value="submit">
<input type="hidden" name="node_id" VALUE="1065273">
<input type="hidden" name="skratch" value="">
<input type="button" value="append it!" onClick="return addToScratch(1);">
<input type="button" value="prepend it!" onClick="return addToScratch(2);"

I think that this would fit best somewhere in the personal nodelet, just as a little button. A link next to it, like a ? could link to a "what the heck" is this node.

The code to add this functionality in to the E2 scratch pad, would be very simple. Between lines 15 and 16, we'd add this quick bit of code:

$input = $$VARS('skratch') . $input if defined $query->param('flavor'); 

As you can see, we have a "flavor" attribute to the form. It can be anything you want. "Big and Juicy", "JayBonci 0wnz j00 all", whatever. Optionally, you could tack on whitespace before and after the string.

Uses of this button:
  • A more convenient way for editors to log what they do.. rather than copying and pasting all the time, they can keep it in their scratch pad.
  • If a person is moving around a lot of text, it might be very helpful to them to use the scratch pad, so it doesn't get lost.
  • It still obeys the limit, and will not screw someone over if they try to c+p too much text.
  • It will help get this toy used a little more, I think, and helps people make up for too many nodes in the Personal Nodelet, thus the placement there.

Notes: see about unescaping text. (reversing links and the like)

It's a minor convenience feature that doesn't take away from anything in the database. Many thanks to hodgepodge, McSnarf, and N-Wing. Any questions or comments are welcome. /msg jb

Log in or register to write something here or to contact authors.