From 2257511008ee6d3e54b122db65c2afa5761f52fb Mon Sep 17 00:00:00 2001 From: janus_wel Date: Thu, 11 Dec 2008 18:20:35 +0000 Subject: bugfix: clock position is out of alignment when resize window. delete non-use function. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26438 d0d07461-0603-4401-acd4-de1884942a52 --- clock.js | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'clock.js') diff --git a/clock.js b/clock.js index 3f8b246..b12fe56 100644 --- a/clock.js +++ b/clock.js @@ -35,7 +35,7 @@ refer: :clockstart start clock :clockjustify - justify clock position. this has bug. + justify clock position == EXAMPLE == in .vimperatorrc @@ -46,10 +46,6 @@ this exapmple show clock like below (20:34 12/12) -== KNOWN BUGS == -clock position is out of alignment when window was resized. -use :clockjustify to fix alignment, but the ex-command may not work. - ]]> ; @@ -282,8 +274,7 @@ clock.generate(); // insert commandlineStack.appendChild(clock.instance); // why double? -clock.justify(commandlineStack.boxObject.width); -clock.justify(commandlineStack.boxObject.width); +clock.justify(window.innerWidth); // register command [ @@ -291,9 +282,16 @@ clock.justify(commandlineStack.boxObject.width); [['clockappear'], 'clock appear', function () clock.appear() ], [['clockstart'], 'start clock', function () clock.start() ], [['clockstop'], 'stop clock', function () clock.stop() ], - [['clockjustify'], 'justify', function () clock.justify(getCommandlineStack().boxObject.width) ], + [['clockjustify'], 'justify', function () clock.justify(window.innerWidth) ], ].forEach( function ([n, d, f]) commands.addUserCommand(n, d, f, {}) ); +window.addEventListener( + 'resize', + function () { + clock.justify(window.innerWidth); + }, + false +); // stuff functions --- function time() { @@ -329,13 +327,6 @@ function getCommandlineStack() { return commandlineStack.localName === 'stack' ? commandlineStack : null; } -// type conversion -function stringToBoolean(str, defaultValue) { -return !str ? (defaultValue ? true : false) - : str.toLowerCase() === 'false' ? false - : /^\d+$/.test(str) ? (parseInt(str) ? true : false) - : true; -} } )(); // vim: set sw=4 ts=4 et; -- cgit v1.2.3