Discussions » Creation Requests

Textarea input

§
Posted: 16.02.2017

Textarea input

I was wondering if it is possible to get a generic script that on pages I select it will automatically add information to the text area. There are sites where on just about each reply I need to add some specific text and going to a txt file or using a macro can be a pain when it is needed each time.

textarea id="description"

§
Posted: 18.02.2017

Maybe, but also consider something like Clippings which integrates with the right-click context menu and has an editor interface that would take a long time to build in a script (if you need to edit your text insertions from time to time): https://addons.mozilla.org/firefox/addon/clippings/

§
Posted: 18.02.2017

I use clippings as well. It works but, like I mentioned before, doing the same thing 30-50 times a day it gets a bit old even with it. I was thinking with a GM script it would just be there. For on this site that I am on it is always the same text that I am using before I add something else to it under that pasted text.

§
Posted: 18.02.2017
Edited: 19.02.2017

maybe something like this?

 var ta=document.querySelectorAll('textarea');
  for (var i=0;i<ta.length;i++){
   ta[i].value="some information\n"+
   "one\ntwo\n 3\n\4\nfive";
  }

EDIT: multi-line text

§
Posted: 19.02.2017

That almost works. I suppose I should have said that what I am posting is six lines. That worked perfectly but only for the first line.

q1k
§
Posted: 19.02.2017

New line character is \n, on Windows you might need to use \r\n

§
Posted: 19.02.2017

and, of course, you may append your text to textarea ta.value = "some text\n added by\nmy script" + ta.value

§
Posted: 21.02.2017

Works great guys, thanks for the help as this will save me a great deal of time.

Post reply

Sign in to post a reply.