All of the major open-source editors and most of the others hava a scripting facility of some description - some (Emacs in particular) are famous for it. The only ones that don't tend to be very lightweight ones like pico.
vim has a native scripting language and can also be built with embedded Python, Tcl or Perl interepreters that can operate on selections, buffers etc through the plugin mechanism. Emacs is all about scripting - it's has a LISP interpreter built right into the core of the system and most of the editor is written in LISP. There is a running joke about emacs describing it as a LISP interpreter that someone just happened to use to write a text editor.
Vim's user interface is descended from vi, which is somewhat quirky but very powerful once you get used to it. It also does recorded keyboard macros particularly well and has a very nice regular expression search/replace facility.
Emacs is regarded as a bit of a baroque monstrosity and is very large and complex. However, its scripting capability is second to none and there is an enormous variety of macro packages that do many things. It has a very loyal following of people who swear by it; once you've gotten over the learning curve (there is an enormous body of resources on the web to help with this) it's a very powerful system indeed. You can customise emacs into a whole IDE and there are people around who claim to spend the majority of their tube time in it.
Both of these editors can work in text mode or with a GUI and are highly portable, running on a wide variety of platforms. They are both open-source.
I've used both; I used to use XEmacs (a major code-fork of emacs that goes back a number of years) back in the 1990s but went to vim later on. I even use vim on Windows.
If you find the user interface of Vim or Emacs a bit too much, there are a variety of other text editors available, many of which offer scripting. Examples of these are SciTE, which has a built in Lua interpreter, NEdit, which has a homebrew macro language of its own or GEdit, which is substantially written in Python (which can also be used for scripting it) and has a plugin API.
EDIT: Outside of a few specific projects (e.g. Mozilla) Javascript never got much traction as a stand-alone or embedded scripting language in open-source circles. Historically there wasn't a popular open-source Javascript interpreter that got widespread acceptance in the way that Python or Tcl/Tk did. Javascript is more widely used in closed source systems such as UltraEdit or InDesign (to name a couple) whereas other languages were more popular on open-source projects.
None of the open-source text editors that I am aware of feature javascript as an option for a scripting language (feel free to step in and comment or edit this if you know of one). You will probably have to move off Javascript to another language such as Python or LISP. However, now that QT comes with a Javascript interpreter (QTScript) you may find some of the KDE-based ones offering this as a scripting option, but I am not specifically aware of any off the top of my head.