From 661b680feaf2d6651aeb42995abde985eb31c1d0 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 11 Apr 2011 13:51:24 +0200 Subject: [PATCH] LSform : Added feature to go directly in tab with #name value in URL --- public_html/includes/js/LSform.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/public_html/includes/js/LSform.js b/public_html/includes/js/LSform.js index f4adfff5..f7bafd6f 100644 --- a/public_html/includes/js/LSform.js +++ b/public_html/includes/js/LSform.js @@ -2,6 +2,7 @@ var LSform = new Class({ initialize: function(){ this._modules=[]; this._elements=[]; + this._tabBtns=[]; if ($type($('LSform_idform'))) { this.objecttype = $('LSform_objecttype').value; @@ -79,10 +80,21 @@ var LSform = new Class({ } li.getFirst('a').addEvent('click',this.onTabBtnClick.bindWithEvent(this,li)); },this); - + + $$('li.LSform_layout a').each(function(a) { + this._tabBtns[a.href]=a; + },this); + if (LIs.length != 0) { - this._currentTab = 'default_value'; - document.getElement('li.LSform_layout').getFirst('a').fireEvent('click'); + if ($type(this._tabBtns[window.location])) { + this._currentTab = 'default_value'; + this._tabBtns[window.location].fireEvent('click'); + byDefault=0; + } + else { + this._currentTab = 'default_value'; + document.getElement('li.LSform_layout').getFirst('a').fireEvent('click'); + } } },