From afc62c1ffa71669465a91197a21cabd8e4648cef Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Tue, 28 May 2013 07:37:58 +0200 Subject: [PATCH] enhanced $ function to accept the window handler too --- web/commons.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/commons.js b/web/commons.js index 7ba8b31..e6b5cb3 100644 --- a/web/commons.js +++ b/web/commons.js @@ -52,9 +52,12 @@ var mlang_commons = { 'imgload_a' : { 'it' : 'Immagine caricate ', 'en' : '(isolation)' } } }; -function $(id) { return document.getElementById(id); } - -function $$(win, id) { return win.document.getElementById(id); } +function $() { + if (arguments.length == 1) + return document.getElementById(arguments[0]); + else + return (arguments[0]).document.getElementById((arguments[1])); +} function dec2hex(d, padding) { -- 2.17.1