Use tabs consistently for indentation.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fb56898b Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fb56898b Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fb56898b Branch: refs/heads/master Commit: fb56898bc996c46c5bec99ee968ccc5beff8a0b1 Parents: 584eb79 Author: martin-g <[email protected]> Authored: Mon Jan 2 11:13:19 2012 +0200 Committer: martin-g <[email protected]> Committed: Mon Jan 2 11:13:19 2012 +0200 ---------------------------------------------------------------------- .../wicket/ajax/res/js/wicket-ajax-jquery-debug.js | 213 +++++++-------- 1 files changed, 106 insertions(+), 107 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/fb56898b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js index 9d53386..683f503 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + /*jshint evil: true, nomen: false, onevar: false, regexp: false, strict: true, boss: true, undef: true, maxlen: 160, curly: true, eqeqeq: true */ /*global document: false, jQuery:false, DOMParser: true, window: false, Wicket: true, console: true */ @@ -30,124 +30,124 @@ if (typeof(Wicket) === 'undefined') { Wicket = {}; } - + if (typeof(Wicket.Ajax) === 'undefined') { Wicket.Ajax = {}; } - - if (typeof(Wicket.Ajax.DebugWindow) === 'object') { + + if (typeof(Wicket.Ajax.DebugWindow) === 'object') { return; } - + Wicket.Ajax.DebugWindow = { - + /** * A flag indicating whether the ajax debug window is enabled. Switched on by AbstractDefaultAjaxBehavior.java */ enabled: false, - + showResponseText : false, - + scrollLock : false, - + debugWindowId : 'wicketAjaxDebugWindow', - + debugWindowScrollLockLinkId : 'wicketAjaxDebugScrollLock', - + debugWindowDragHandleId : 'wicketAjaxDebugWindowDragHandle', - + debugWindowResizeHandleId : 'wicketAjaxDebugWindowResizeHandle', - + debugWindowLogId : 'wicketAjaxDebugWindowLogId', - + wicketDebugLink: 'wicketDebugLink', - + showDebugWindow : function() { var self = Wicket.Ajax.DebugWindow; self.init(); - - jQuery('#'+self.wicketDebugLink) - .css('backgroundColor', 'white') - .css('color', 'blue'); - jQuery('#'+self.debugWindowId).slideToggle("fast", "swing"); + jQuery('#'+self.wicketDebugLink) + .css('backgroundColor', 'white') + .css('color', 'blue'); + + jQuery('#'+self.debugWindowId).slideToggle("fast", "swing"); }, - + hideDebugWindow : function() { var self = Wicket.Ajax.DebugWindow; self.init(); - jQuery('#'+self.debugWindowId).slideToggle("fast", "swing"); + jQuery('#'+self.debugWindowId).slideToggle("fast", "swing"); }, - - log : function(msg, label) { - var self = Wicket.Ajax.DebugWindow; + + log : function(msg, label) { + var self = Wicket.Ajax.DebugWindow; self.init(); - var $log = jQuery('#'+self.debugWindowLogId); - var $child = jQuery("<div>"); - + var $log = jQuery('#'+self.debugWindowLogId); + var $child = jQuery("<div>"); + msg = "" + msg; msg = msg.replace(/&/g, "&"); - msg = msg.replace(/</g, "<"); - msg = msg.replace(/>/g, ">"); - msg = msg.replace(/\n/g, "<br/>"); - msg = msg.replace(/ /g, " "); - msg = msg.replace(/\t/g, " "); - + msg = msg.replace(/</g, "<"); + msg = msg.replace(/>/g, ">"); + msg = msg.replace(/\n/g, "<br/>"); + msg = msg.replace(/ /g, " "); + msg = msg.replace(/\t/g, " "); + if (typeof(label) !== "undefined") { msg = "<b>" + label + "</b>" + msg; } - $child.html(msg); - $child - .css('fontSize','82%') - .css('margin', '0px') - .css('padding', '0px'); - $log.append($child); - - if (self.scrollLock === false) { - $log.scrollTop($log[0].scrollHeight); - } - }, - - logError : function (msg) { - var self = Wicket.Ajax.DebugWindow; + $child.html(msg); + $child + .css('fontSize','82%') + .css('margin', '0px') + .css('padding', '0px'); + $log.append($child); + + if (self.scrollLock === false) { + $log.scrollTop($log[0].scrollHeight); + } + }, + + logError : function (msg) { + var self = Wicket.Ajax.DebugWindow; self.init(); - self.log(msg, "<span style='color: red'>ERROR</span>: "); - - if (jQuery('#'+self.debugWindowId).css('display') === 'none') { - jQuery('#'+self.wicketDebugLink) - .css('backgroundColor', 'crimson') - .css('color', 'aliceBlue'); - } - - if (typeof(console) !== "undefined" && typeof(console.error) === 'function') { - console.error('Wicket.Ajax: ' + msg); - } - }, - - logInfo : function(msg) { - var self = Wicket.Ajax.DebugWindow; + self.log(msg, "<span style='color: red'>ERROR</span>: "); + + if (jQuery('#'+self.debugWindowId).css('display') === 'none') { + jQuery('#'+self.wicketDebugLink) + .css('backgroundColor', 'crimson') + .css('color', 'aliceBlue'); + } + + if (typeof(console) !== "undefined" && typeof(console.error) === 'function') { + console.error('Wicket.Ajax: ' + msg); + } + }, + + logInfo : function(msg) { + var self = Wicket.Ajax.DebugWindow; self.init(); - self.log(msg, "<span style='color: blue'>INFO</span>: "); - }, - - clearLog : function() { - var self = Wicket.Ajax.DebugWindow; + self.log(msg, "<span style='color: blue'>INFO</span>: "); + }, + + clearLog : function() { + var self = Wicket.Ajax.DebugWindow; self.init(); - jQuery('#'+self.debugWindowLogId).empty(); - }, - + jQuery('#'+self.debugWindowLogId).empty(); + }, + init : function() { - - if ( Wicket.Ajax.DebugWindow.enabled) { - var self = Wicket.Ajax.DebugWindow; - var $window = jQuery('#'+self.debugWindowId); - var dwdhid = self.debugWindowDragHandleId; - var dwrhid = self.debugWindowResizeHandleId; - + + if ( Wicket.Ajax.DebugWindow.enabled) { + var self = Wicket.Ajax.DebugWindow; + var $window = jQuery('#'+self.debugWindowId); + var dwdhid = self.debugWindowDragHandleId; + var dwrhid = self.debugWindowResizeHandleId; + if ($window.length === 0) { - - var html = + + var html = "<div style='width: 450px; display: none; position: absolute; left: 200px; top: 300px; z-index: 1000000;' id='"+self.debugWindowId+"'>"+ " <div style='border: 1px solid black; padding: 1px; background-color: #eee'>"+ " <div style='overflow: auto; width: 100%'>"+ @@ -165,12 +165,11 @@ " <div style='height: 10px; width: 10px; background-color: gray; margin:0px; padding: 0px;overflow:hidden; float:right; cursor: nw-resize' id='" + self.debugWindowResizeHandleId + "'>"+ " </div>"+ " </div>"+ - " </div>"+ + " </div>"+ " </div>" + "</div>"; - - - + + // Special style for Internet 6 and 7 in quirks mode if (Wicket.Browser.isIE() && (Wicket.Browser.isIEQuirks() || !Wicket.Browser.isIE7())) { html += @@ -181,7 +180,7 @@ html += "<a id='"+self.wicketDebugLink+"' style='position:fixed; right: 10px; bottom: 10px; z-index:1000000; padding-top: 0.3em; padding-bottom: 0.3em; line-height: normal ; _padding-top: 0em; width: 12em; border: 1px solid black; background-color: white; text-align: center; opacity: 0.7; color: blue;'"; } - + html += " href='javascript:Wicket.Ajax.DebugWindow.showDebugWindow()'>WICKET AJAX DEBUG</a>"; jQuery(html).appendTo(document.body); @@ -189,9 +188,9 @@ Wicket.Drag.init(Wicket.$(dwdhid), jQuery.noop, jQuery.noop, self.onDrag); Wicket.Drag.init(Wicket.$(dwrhid), jQuery.noop, jQuery.noop, self.onResize); } - } + } }, - + switchScrollLock: function() { var self = Wicket.Ajax.DebugWindow; self.scrollLock = !self.scrollLock; @@ -204,55 +203,55 @@ } $link.css('color', color); }, - + onResize: function(element, deltaX, deltaY) { var self = Wicket.Ajax.DebugWindow; - + var $window = jQuery('#'+self.debugWindowId), $log = jQuery('#'+self.debugWindowLogId); - + var width = parseInt($window.css('width'), 10) + deltaX; var height = parseInt($log.css('height'), 10) + deltaY; - + var res = [0, 0]; - + if (width < 300) { res[0] = 300 - width; width = 300; } - + if (height < 100) { res[1] = 100 - height; - height = 100; - } - + height = 100; + } + $window.css('width', width + "px"); - $log.css('height', height + "px"); - + $log.css('height', height + "px"); + return res; }, - + onDrag: function(element, deltaX, deltaY) { var self = Wicket.Ajax.DebugWindow; var $window = jQuery('#'+self.debugWindowId); - + var x = parseInt($window.css('left'), 10) + deltaX; var y = parseInt($window.css('top'), 10) + deltaY; - + var res = [0, 0]; - + if (x < 0) { res[0] = -deltaX; x = 0; } if (y < 0) { res[1] = -deltaY; - y = 0; - } - + y = 0; + } + $window.css('left', x + "px"); - $window.css('top', y + "px"); - + $window.css('top', y + "px"); + return res; } };
