forked from dparnell/nxhtml
/
bm-base.js
41 lines (37 loc) · 1.42 KB
/
bm-base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This is the bookmarklet template for the bookmarklet framework.
// The js file template is in bm-base-file.js
//
// To make code for a bookmarklet fill in the values below.
// Then remove comments and new lines. This can be done for example here:
//
// http://closure-compiler.appspot.com/home
//
// (You can do all this with the command jsut-mk-bookmarklet in the
// Emacs elips package nXhtml.)
////////////////////////////////////////////////////////////////////
(function(){
////////////////////////////////////////////////////////////////////
/// Your values (you must use '' instead of ""):
var myURL='URL';
var myArgs=null;
var myNamespace = 'NAMESPACE'; // For this bookmarklet, same as in .js file!
////////////////////////////////////////////////////////////////////
window[myNamespace+'-myArgs'] = myArgs;
// Has the .js file already been loaded?
if (window[myNamespace])
window[myNamespace]();
else {
var elt=document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0];
if (elt) {
var script=document.createElement('script');
script.type='text/javascript';
script.src=myURL;
elt.appendChild(script);
} else
alert('You must be on a html page for this to work');
/* testing a
comment */
}
})();
// void(0)