| 1 |
|
(function () { |
| 2 |
|
var samiURL = 'http://suika.fam.cx/www/js/sami/script/sami-core.js'; |
| 3 |
|
var swSamiURL = 'http://suika.fam.cx/swe/scripts/sw-sami.js'; |
| 4 |
|
|
| 5 |
|
var script = document.createElement ('script'); |
| 6 |
|
script.src = samiURL; |
| 7 |
|
script.defer = true; |
| 8 |
|
script.async = true; |
| 9 |
|
document.body.appendChild (script); |
| 10 |
|
|
| 11 |
|
if (!self.SAMI) self.SAMI = {}; |
| 12 |
|
SAMI.onLoadFunctions = SAMI.onLoadFunctions || []; |
| 13 |
|
SAMI.onLoadFunctions.push (function () { |
| 14 |
|
SAMI.Script.loadScripts (new SAMI.List([swSamiURL]), function () { |
| 15 |
|
SW.init (); |
| 16 |
|
}); |
| 17 |
|
}); |
| 18 |
|
}) (); |
| 19 |
|
|
| 20 |
window.onload = function () { |
window.onload = function () { |
| 21 |
createToolbar (); |
createToolbar (); |
| 22 |
initializeHatenaStar(); |
initializeHatenaStar(); |
| 88 |
ta.focus (); |
ta.focus (); |
| 89 |
}; // insertText |
}; // insertText |
| 90 |
|
|
| 91 |
var addButton = function (labelHTML, onclick) { |
var addButton = function (labelHTML, title, onclick) { |
| 92 |
var button = document.createElement ('button'); |
var button = document.createElement ('button'); |
| 93 |
button.setAttribute ('type', 'button'); |
button.setAttribute ('type', 'button'); |
| 94 |
button.innerHTML = labelHTML; |
button.innerHTML = labelHTML; |
| 95 |
|
button.title = title; |
| 96 |
button.onclick = onclick; |
button.onclick = onclick; |
| 97 |
container.appendChild (button); |
container.appendChild (button); |
| 98 |
}; // addButton |
}; // addButton |
| 99 |
|
|
| 100 |
addButton ('[#]', function () { |
addButton ('[#]', 'Insert a new anchor number', function () { |
| 101 |
var added = '[' + getNextAnchorNumber (ta.value) + '] '; |
var added = '[' + getNextAnchorNumber (ta.value) + '] '; |
| 102 |
insertText (added); |
insertText (added); |
| 103 |
}); |
}); |
| 104 |
|
|
| 105 |
addButton ('Now', function () { |
addButton ('Now', 'Insert a timestamp', function () { |
| 106 |
var added = '[TIME[' + getGlobalDateAndTimeString (new Date) + ']]'; |
var added = '[TIME[' + getGlobalDateAndTimeString (new Date) + ']]'; |
| 107 |
insertText (added); |
insertText (added); |
| 108 |
}); |
}); |