greasemonkey - Javascript aliases -
My goal is to create a "Javascript library", if you can call it I intend to use it So that I can manipulate pages, as I have browsed the web, it is dynamically loading it as a Graysmunky script Window
, " Doctor
" - > document
, " mapped to" win
code> win.loc "-> win.location
And some other Facility mapping, but you get this idea. Can you give me some examples to take the syntax, and I will extend the rest? Thank you very much.
Just assign so many variables:
var win = window; var doctor = document;
< P> You can not specify win.loc
without modifying the window
object in this code. Also, the window object is special because < After specifying code> win , you will be able to get it with win.win
or win.win.win
. > And so on (the window
is a global object.) In any case, you still specify loc
Can window
object:
win.loc = window.location; // can now be referred to as: loc; // (window is global object) win.loc; Win.location; Window space
Now to do what you are asking is most likely that you to do not do this. Generally, frameworks are defined to use only one global variable, with a suitable name:
var blixt = (function () {var localVariable = 123; return {Loc: window.location, myFunc}: function () {alerts (localized);}};}) ();
If you are not familiar with Javascript, then this is all very complicated stuff, so this is not a good project when it is new to Javascript.
Comments
Post a Comment