Index: branches/5.1.x/core/admin_templates/js/toolbar.js =================================================================== diff -u -N -r13113 -r13545 --- branches/5.1.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 13113) +++ branches/5.1.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 13545) @@ -6,7 +6,7 @@ this.Alt = RemoveTranslationLink(alt || ''); if (this.Alt != alt) { this.TranslateLink = alt || ''; - this.TranslateLink = this.TranslateLink.replace(/<a href="(.*?)">(.*?)<\/a>/g, '$1'); + this.TranslateLink = this.TranslateLink.replace(/<a href="(.*?)".*>(.*?)<\/a>/g, '$1'); } if (this.Alt.match(/(.*)::(.*)/)) { @@ -35,6 +35,9 @@ this.ToolBar = null; this.Prefix = prefix ? prefix : ''; this.Separator = false; + + // all buttons are read-only until page is fully loaded! + this.ReadOnly = true; } ToolBarButton.prototype.CheckTitleModule = function() @@ -104,7 +107,7 @@ } ToolBarButton.prototype.EditTitle = function() { - if (this.TranslateLink !== false) { + if (this.TranslateLink !== false && !this.ReadOnly) { var $links = this.TranslateLink; $links = $links.split('::'); @@ -152,19 +155,23 @@ /*this.Container.onmouseout = function() { this.btn.imgObject.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif'; };*/ + this.Container.inClick = false; if (typeof(this.onClick) != 'function') { this.Container.onclick = function() { - if (this.inClick) return; + if (this.inClick || this.btn.ReadOnly) return; this.inClick = true; - if (eval('typeof('+this.btn.Title+')') == 'function') + + if (eval('typeof('+this.btn.Title+')') == 'function') { eval(this.btn.Title + '()'); + } + this.inClick = false; } } else { this.Container.onclick = function() { - if (this.inClick) return; + if (this.inClick || this.btn.ReadOnly) return; this.inClick = true; this.btn.onClick(); this.inClick = false; @@ -339,6 +346,16 @@ btn.Init(); } } + + var $me = this; + + $(document).ready( + function () { + for (var $button_name in $me.Buttons) { + $me.Buttons[$button_name].ReadOnly = false; + } + } + ); } ToolBar.prototype.EnableButton = function(button_id) {