aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2008-12-11 15:14:27 +0000
committeranekos2008-12-11 15:14:27 +0000
commit6d7e9e8b65741ef29e01f5d4d05d42c9f3b705c5 (patch)
tree61658fc9e1cd22bab49709206857a11e33dc0432
parentc7ab122c30ac83db4d18d77314c55ac4ec2301d5 (diff)
downloadvimperator-plugins-6d7e9e8b65741ef29e01f5d4d05d42c9f3b705c5.tar.bz2
見えなくなる問題について、対処。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26421 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--clock.js38
1 files changed, 10 insertions, 28 deletions
diff --git a/clock.js b/clock.js
index 12b26e1..358829a 100644
--- a/clock.js
+++ b/clock.js
@@ -4,7 +4,7 @@
* @description clock.
* @description-ja とけい。
* @author janus_wel <janus_wel@fb3.so-net.ne.jp>
- * @version 0.13
+ * @version 0.14
* @minversion 2.0pre
* @maxversion 2.0pre
* ==/VimperatorPlugin==
@@ -52,8 +52,6 @@
// definitions ---
// default settings
const format = liberator.globalVariables.clock_format || '[%t]';
-const position = liberator.globalVariables.clock_position || 'liberator-commandline-command';
-const after = stringToBoolean(liberator.globalVariables.clock_after, true);
// class definitions
function Clock() {
@@ -212,21 +210,19 @@ Clock.prototype = {
};
-// main ---
-let insertBase = window.document.getElementById(position);
-if (!insertBase) {
- let errmsg = 'clock.js: not found the element that id is "' + position + '". check variable clock_position.';
- liberator.log(errmsg, 0);
- liberator.echoerr(errmsg, 0);
-}
-
let clock = new Clock(format);
clock.generate();
// insert
-after
- ? insertNodeAfterSpecified(clock.instance, insertBase)
- : insertNodeBeforeSpecified(clock.instance, insertBase);
+{
+ let msg = window.document.getElementById('liberator-message');
+ let stack = msg.parentNode;
+ let box = window.document.createElement('hbox');
+ stack.replaceChild(box, msg);
+ box.appendChild(msg);
+ box.appendChild(clock.instance);
+ msg.inputField.QueryInterface(Components.interfaces.nsIDOMNSEditableElement);
+}
// register command
[
@@ -264,20 +260,6 @@ function year() {
return new Date().getFullYear().toString(10);
}
-// node control
-function insertNodeBeforeSpecified(inserted, specified) {
- return specified.parentNode.insertBefore(inserted, specified);
-}
-function insertNodeAfterSpecified(inserted, specified) {
- var next = specified.nextSibling;
- if(next) {
- return specified.parentNode.insertBefore(inserted, next);
- }
- else {
- return specified.parentNode.appendChild(inserted);
- }
-}
-
// type conversion
function stringToBoolean(str, defaultValue) {
return !str ? (defaultValue ? true : false)