From 6d7e9e8b65741ef29e01f5d4d05d42c9f3b705c5 Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 11 Dec 2008 15:14:27 +0000 Subject: 見えなくなる問題について、対処。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26421 d0d07461-0603-4401-acd4-de1884942a52 --- clock.js | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'clock.js') 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 - * @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) -- cgit v1.2.3