diff --git a/javascript/ImageEditor/Crop.js b/javascript/ImageEditor/Crop.js index 1c5930fa..afafd253 100644 --- a/javascript/ImageEditor/Crop.js +++ b/javascript/ImageEditor/Crop.js @@ -116,7 +116,7 @@ var Crop = { imageTransformation.crop(startTop,startLeft,newWidth,newHeight,Crop.cropCallback.bind(this)); this.disable(); } else { - alert('Crop area too small'); + statusMessageWrapper.statusMessage("Crop area too small","bad"); return false; } $('image').style.visibility = 'visible';//hack for IE for not selecting image during crop diff --git a/javascript/ImageEditor/ImageHistory.js b/javascript/ImageEditor/ImageHistory.js index 4a67d7ee..c7ae80d8 100644 --- a/javascript/ImageEditor/ImageHistory.js +++ b/javascript/ImageEditor/ImageHistory.js @@ -25,7 +25,6 @@ ImageHistory = { this.disable = ImageHistory.disable.bind(this); this.clear = ImageHistory.clear.bind(this); this.addListeners(); - statusMessage = new StatusMessage.initialize(); }, undo: function() { @@ -39,7 +38,7 @@ ImageHistory = { this.historyPointer = this.historyPointer - 1; this.image.src = this.history[this.historyPointer].fileUrl; } else { - statusMessage.statusMessage("No more undo","bad"); + statusMessageWrapper.statusMessage("No more undo","bad"); } }, @@ -51,7 +50,7 @@ ImageHistory = { this.historyPointer = this.historyPointer + 1; this.image.src = this.history[this.historyPointer].fileUrl; } else { - statusMessage.statusMessage("No more redo","bad"); + statusMessageWrapper.statusMessage("No more redo","bad"); } }, diff --git a/javascript/ImageEditor/Utils.js b/javascript/ImageEditor/Utils.js index 581af5da..e0626862 100644 --- a/javascript/ImageEditor/Utils.js +++ b/javascript/ImageEditor/Utils.js @@ -87,16 +87,18 @@ Random = { StatusMessage = { initialize: function() { this.statusMessage = StatusMessage.statusMessage.bind(this); - window.frameElement.statusMessage = statusMessage; + window.frameElement.statusMessage = window.top.statusMessage; var s1 = $('statusMessage'); var s2 = window.top.document.getElementById('statusMessage'); s1.showMessage = s2.showMessage; s1.clearMessage = s2.clearMessage; s1.fade = s2.fade; s1.afterFade = s2.afterFade; + this.statusMessageContainer = s1; }, statusMessage: function(msg, type, clearManually) { - window.frameElement.statusMessage(msg, type, clearManually); - } -} + window.frameElement.statusMessage(msg, type, clearManually,this.statusMessageContainer); + } +} +Event.observe(window,'load',function(e) {statusMessageWrapper = new StatusMessage.initialize();}); \ No newline at end of file diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 8023472f..9ca6e5d3 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -409,9 +409,11 @@ Behaviour.register({ * @param msg String * @param type String (optional) can be 'good' or 'bad' * @param clearManually boolean Don't automatically fade message. + * @param container custom #statusMessage element to show message. */ -function statusMessage(msg, type, clearManually) { +function statusMessage(msg, type, clearManually, container) { var statusMessageEl = $('statusMessage'); + if(container != null) statusMessageEl = container; if(statusMessageEl) { if(msg) { statusMessageEl.showMessage(msg, type, msg.length / 20, clearManually);