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"

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/

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.

§
Создано: 18.02.2017
Изменено: 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

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.

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

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

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

Ответить

Войдите, чтобы ответить.

长期地址
遇到问题?请前往 GitHub 提 Issues。