1function cWindowDraw() 2{ 3 // Remove any existing #cWindow. 4 jQuery('#cWindow').remove(); 5 6 // cWindow html structure. 7 var html = ''; 8 html += '<div id="cWindow">'; 9 html += ' <!-- top section -->'; 10 html += ' <div id="cwin_tl"></div>'; 11 html += ' <div id="cwin_tm"></div>'; 12 html += ' <div id="cwin_tr"></div>'; 13 html += ' <div style="clear: both;"></div>'; 14 html += ' <!-- middle section -->'; 15 html += ' <div id="cwin_ml"></div>'; 16 html += ' <div id="cWindowContentOuter">'; 17 html += ' <div id="cWindowContentTop">'; 18 html += ' <a href="javascript:void(0);" onclick="cWindowHide();" id="cwin_close_btn">Close</a>'; 19 html += ' <div id="cwin_logo"></div>'; 20 html += ' <div class="clr"></div>'; 21 html += ' </div>'; 22 html += ' <div id="cWindowContentWrap"><div id="cWindowContent">'; 23 html += ' </div></div>'; 24 html += ' </div>'; 25 html += ' <div id="cwin_mr"></div>'; 26 html += ' <div style="clear: both;"></div>'; 27 html += ' <!-- bottom section -->'; 28 html += ' <div id="cwin_bl"></div>'; 29 html += ' <div id="cwin_bm"></div>'; 30 html += ' <div id="cwin_br"></div>'; 31 html += ' <div style="clear: both;"></div>'; 32 html += '</div>'; 33 34 var cWindow = jQuery(html).addClass('new').prependTo('body'); 35 36 return cWindow; 37} 38 39function cWindowShow(windowCall, winTitle, winContentWidth, winContentHeight, winType) 40{ 41 // Get cWindow 42 var cWindow = jQuery('#cWindow'); 43 if (cWindow.length<1) cWindow = cWindowDraw(); 44 45 // Fix inconsistencies in arguments 46 winType = (winType=='' || winType==null) ? 'dialog' : winType; 47 winContentWidth = parseInt(winContentWidth); 48 winContentHeight = parseInt(winContentHeight); 49 50 // Set up dimensions 51 if (cWindow.hasClass('new')) 52 { 53 var cWindowSize = cWindowGetSize(winContentWidth, winContentHeight); 54 cWindowResizeAddTask('#cWindow', {'width' : cWindowSize.width(), 55 'height' : cWindowSize.height(), 56 'left' : cWindowSize.left(), 57 'margin-top' : cWindowSize.top(), 58 'z-index' : cGetZIndexMax() + 1 59 }, {'animate': false}); 60 cWindowResizeAddTask('#cWindowContentOuter, #cwin_tm, #cwin_bm', {'width' : cWindowSize.contentOuterWidth() }, {'animate': false}); 61 cWindowResizeAddTask('#cWindowContentOuter, #cwin_ml, #cwin_mr', {'height': cWindowSize.contentOuterHeight() }, {'animate': false}); 62 cWindowResizeAddTask('#cWindowContentWrap', {'height': cWindowSize.contentWrapHeight() }, {'animate': false}); 63 64 cWindowResizeExecuteTask(function() 65 { 66 cWindow.removeClass('new'); 67 }); 68 } 69 70 // Assign window type 71 jQuery('#cWindow').attr('class', winType); 72 73 // Set up content 74 jQuery('#cwin_logo').html(winTitle); 75 jQuery('#cWindowContent').empty(); 76 jQuery('#cWindowAction').remove(); 77 78 // Set up behaviour 79 jax.loadingFunction = function() { jQuery('#cWindowContentWrap').addClass('loading'); }; 80 jax.doneLoadingFunction = function() { jQuery('#cWindowContentWrap').removeClass('loading'); }; 81 82 // IE6: Rebuild alpha transparent border 83 if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7 && typeof(jomsIE6)!="undefined" && jomsIE6==true) 84 { 85 jQuery('#cwin_tm, #cwin_bm, #cwin_ml, #cwin_mr').each(function() 86 { 87 jQuery(this)[0].filters(0).sizingMethod="crop"; 88 }) 89 } 90 91 // Resize cWindow 92 cWindowResize2(winContentWidth, winContentHeight, windowCall); 93} 94 95function cWindowHide() 96{ 97 if (jQuery('#cWindowAction').size()>0) 98 { 99 jQuery('#cWindowAction').animate({bottom: -30}, function() 100 { 101 jQuery('#cWindow').fadeOut('fast', function(){ 102 jQuery('#cWindowAction').remove(); 103 jQuery(this).addClass('new'); 104 }); 105 }); 106 } else { 107 jQuery('#cWindow').fadeOut('fast', function(){ 108 jQuery(this).addClass('new'); 109 }); 110 } 111} 112 113function cWindowGetSize(winContentWidth, winContentHeight) 114{ 115 var cWindowSize = {contentWrapHeight : function() { return winContentHeight }, 116 contentOuterWidth : function() { return winContentWidth }, 117 contentOuterHeight : function() { return winContentHeight + 30 }, 118 width : function() { return this.contentOuterWidth() + 40 }, 119 height : function() { return this.contentOuterHeight() + 40 }, 120 left : function() { return (jQuery(window).width() - this.width()) / 2 }, 121 top : function() { return jQuery(document).scrollTop() + (document.documentElement["clientHeight"] - this.height()) / 2 } 122 }; 123 return cWindowSize; 124} 125 126// Legacy code. Forwards to cWindowResize2(). 127function cWindowResize(newHeight, callback, action) 128{ 129 newHeight = parseInt(newHeight); 130 cWindowResize2(jQuery('#cWindowContentOuter').width(), newHeight, callback); 131 if (action!=undefined) cWindowActions(action); 132} 133 134function cWindowResize2(winContentWidth, winContentHeight, callback) 135{ 136 var cWindowSize = cWindowGetSize(winContentWidth, winContentHeight); 137 138 // Legacy code. If there's a difference in width, do not resize (pre-1.5 behaviour).
139 var options = {'animate': (jQuery('#cWindow').width()==cWindowSize.width())}; 140 141 cWindowResizeAddTask('#cWindow', {'width' : cWindowSize.width(), 142 'height' : cWindowSize.height(), 143 'left' : cWindowSize.left(), 144 'marginTop' : cWindowSize.top() 145 }, options); 146 cWindowResizeAddTask('#cWindowContentOuter, #cwin_tm, #cwin_bm', {'width' : cWindowSize.contentOuterWidth() }, options); 147 cWindowResizeAddTask('#cWindowContentOuter, #cwin_ml, #cwin_mr', {'height': cWindowSize.contentOuterHeight() }, options); 148 cWindowResizeAddTask('#cWindowContentWrap', {'height': cWindowSize.contentWrapHeight() }, options); 149 150 // Reverse task if cWindow is shrinking 151 if (jQuery('#cWindow').width() > cWindowSize.width() || jQuery('#cWindow').height() > cWindowSize.height()) 152 cWindowResizeTask.reverse(); 153 154 cWindowResizeExecuteTask(callback); 155} 156 157var cWindowResizeTask = new Array(); 158function cWindowResizeAddTask(target, props, options) 159{ 160 // Set up animation properties 161 var defaultProps = {}; 162 jQuery.extend(defaultProps, props); 163 164 // Set up animation options 165 var defaultOptions = {'animate' : true, 166 'queue' : false, 167 'duration': 400, 168 'easing' : 'swing', 169 'complete': function() { jQuery(this).removeClass('resizing'); } 170 }; 171 jQuery.extend(defaultOptions, options); 172 173 if (defaultOptions.animate) 174 { 175 cWindowResizeTask.push(function(){ jQuery(target).addClass('resizing').animate(defaultProps, defaultOptions); }); 176 } else { 177 cWindowResizeTask.push(function(){ jQuery(target).css(defaultProps); }); 178 } 179} 180 181function cWindowResizeExecuteTask(callback) 182{ 183 do 184 { 185 cWindowResizeTask[0](); 186 cWindowResizeTask.splice(0,1); 187 } 188 while(cWindowResizeTask.length>0); 189 190 if (callback!=undefined && typeof(callback)=="string") eval(callback); 191 if (typeof(callback)=="function") callback(); 192} 193 194var cWindowActionsPoll; 195function cWindowActions(action) 196{ 197 // Remove any existing cWindowActionsPoll 198 // Reason why is removed multiple times because cWindowActions 199 // could be called at any point of entry! 200 clearInterval(cWindowActionsPoll); 201 202 setTimeout(function(){ 203 // Remove any existing cWindowActionsPoll 204 clearInterval(cWindowActionsPoll); 205 206 // Create new cWindowActionsPoll 207 cWindowActionsPoll = setInterval(function() 208 { 209 var n = jQuery('.resizing').length; 210 if (n < 1) 211 { 212 _cWindowActions(action); 213 clearInterval(cWindowActionsPoll); 214 } 215 }, 300); 216 }, 300); 217} 218 219function _cWindowActions(action) 220{ 221 // Remove any existing cWindowAction 222 jQuery('#cWindowAction').remove(); 223 224 // Create new cWindowAction 225 cWindowAction = jQuery('<div>').attr('id', 'cWindowAction') 226 .html(action) 227 .css('bottom', '-30px') 228 .appendTo('#cWindowContentOuter'); 229 230 // Resize cWindow 231 cWindowResizeAddTask('#cWindow', {height: '+=30px'}, {'duration': 200}); 232 cWindowResizeAddTask('#cWindow', {marginTop: '-=15px'}, {'duration': 200}); 233 234 cWindowResizeAddTask('#cWindowContentOuter, #cwin_mr, #cwin_ml', {height: '+=30px'}, {'duration': 200}); 235 cWindowResizeExecuteTask(); 236 237 setTimeout(function(){jQuery("#cWindowAction").animate({bottom: '0px'})}, 200); 238 239 // Set up behavior when actions are invoked 240 jax.loadingFunction = function() { 241 jQuery('#cWindowAction').addClass('loading'); 242 jQuery('#cWindowContent').find('input, textarea, button') 243 .attr('disabled', true); 244 } 245 jax.doneLoadingFunction = function() { 246 jQuery('#cWindowAction').removeClass('loading'); 247 jQuery('#cWindowContent').find('input, textarea, button') 248 .attr('disabled', false); 249 }; 250} 251 252function cGetZIndexMax() 253{ 254 var allElems = document.getElementsByTagName? 255 document.getElementsByTagName("*"): 256 document.all; // or test for that too 257 var maxZIndex = 0; 258 259 for(var i=0;i<allElems.length;i++) { 260 var elem = allElems[i]; 261 var cStyle = null; 262 if (elem.currentStyle) {cStyle = elem.currentStyle;} 263 else if (document.defaultView && document.defaultView.getComputedStyle) { 264 cStyle = document.defaultView.getComputedStyle(elem,""); 265 } 266 267 var sNum; 268 if (cStyle) { 269 sNum = Number(cStyle.zIndex); 270 } else { 271 sNum = Number(elem.style.zIndex); 272 } 273 if (!isNaN(sNum)) { 274 maxZIndex = Math.max(maxZIndex,sNum); 275 } 276 } 277 return maxZIndex; 278}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.