Changeset 1369
- Timestamp:
- 2008-01-19 16:27:03 (2 years ago)
- Location:
- FCKeditor/branches/features/floating_dialog/editor
- Files:
-
- 4 modified
-
fckdialog.html (modified) (25 diffs)
-
skins/default/fck_dialog.css (modified) (2 diffs)
-
skins/office2003/fck_dialog.css (modified) (1 diff)
-
skins/silver/fck_dialog.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/features/floating_dialog/editor/fckdialog.html
r1332 r1369 28 28 <meta name="robots" content="noindex, nofollow" /> 29 29 <script type="text/javascript"> 30 30 31 // It seems referencing to frameElement._DialogArguments directly would lead to memory leaks in IE. 31 32 // So let's use functions to access its members instead. … … 37 38 function Editor() 38 39 { 39 return Args().Editor ;40 return frameElement._DialogArguments.Editor ; 40 41 } 41 42 42 43 function ParentDialog( dialog ) 43 44 { 44 if ( !dialog ) 45 return frameElement._ParentDialog ; 46 else 47 return dialog._ParentDialog ; 45 return dialog ? dialog._ParentDialog : frameElement._ParentDialog ; 48 46 } 49 47 … … 58 56 try 59 57 { 60 var parentDomain = Args().TopWindow ? Args().TopWindow.document.domain : Editor().document.domain ;58 var parentDomain = ( Args().TopWindow || Editor() ).document.domain ; 61 59 62 60 if ( document.domain != parentDomain ) 63 61 document.domain = parentDomain ; 62 64 63 break ; 65 64 } … … 76 75 })() ; 77 76 78 var FCK = Editor().FCK ;77 var FCK = Editor().FCK ; 79 78 var FCKTools = Editor().FCKTools ; 80 79 var FCKDomTools = Editor().FCKDomTools ; … … 90 89 91 90 // Sets the language direction. 92 window.document.dir = Editor().FCKLang.Dir ; 93 94 if ( FCKBrowserInfo.IsIE ) 95 { 96 // IE does not set the window name in showModalDialog(), let's set it here. 97 window.name = Args().DialogName ; 98 99 // For IE6-, the fck_dialog_ie6.js is loaded, used to fix limitations in the browser. 100 if ( !FCKBrowserInfo.IsIE7 ) 101 document.write( '<' + 'script type="text/javascript" src="' + FCKConfig.SkinPath + 'fck_dialog_ie6.js"><' + '\/script>' ) ; 102 } 91 var langDir = window.document.dir = Editor().FCKLang.Dir ; 92 93 // For IE6-, the fck_dialog_ie6.js is loaded, used to fix limitations in the browser. 94 if ( FCKBrowserInfo.IsIE && !FCKBrowserInfo.IsIE7 ) 95 document.write( '<' + 'script type="text/javascript" src="' + FCKConfig.SkinPath + 'fck_dialog_ie6.js"><' + '\/script>' ) ; 103 96 104 97 FCKTools.RegisterDollarFunction( window ) ; … … 108 101 { 109 102 var bAutoSize = false ; 103 110 104 var retval = { 111 105 // Sets whether the dialog should auto-resize according to its content's height. … … 120 114 { 121 115 var frmMain = $( 'frmMain' ) ; 122 116 123 117 if ( frmMain ) 124 118 { 125 119 // Get the container size. 126 120 var height = $( 'contents' ).offsetHeight ; 127 121 128 122 // Subtract the size of other elements. 129 123 height -= $( 'TitleArea' ).offsetHeight ; 130 124 height -= $( 'TabsRow' ).offsetHeight ; 131 125 height -= $( 'DialogButtons' ).offsetHeight ; 132 126 133 127 frmMain.style.height = Math.max( height, 0 ) + 'px' ; 134 128 } … … 168 162 // Get the current frame size. 169 163 var frameSize = FCKTools.GetViewPaneSize( frmMain.contentWindow ) ; 170 164 171 165 var deltaWidth = innerWidth - frameSize.Width ; 172 166 var deltaHeight = innerHeight - frameSize.Height ; 173 167 174 // If the contents fits the current size. 168 // If the contents fits the current size. 175 169 if ( deltaWidth <= 0 && deltaHeight <= 0 ) 176 170 return ; 177 171 178 172 var dialogWidth = frameElement.offsetWidth + Math.max( deltaWidth, 0 ) ; 179 173 var dialogHeight = frameElement.offsetHeight + Math.max( deltaHeight, 0 ) ; … … 185 179 } 186 180 187 /** 181 /** 188 182 * Safari seems to have a bug with the time when RefreshSize() is executed - it 189 183 * thinks frmMain's innerHeight is 0 if we query the value too soon after the … … 207 201 208 202 window.SetAutoSize = FCKTools.Bind( retval, retval.SetAutoSize ) ; 203 209 204 return retval ; 210 205 }() ; … … 213 208 var Throbber = function() 214 209 { 215 var timer = null;216 var baseIndex = 0 ; 210 var timer ; 211 217 212 var updateThrobber = function() 218 213 { 219 214 var throbberParent = $( 'throbberBlock' ) ; 220 215 var throbberBlocks = throbberParent.childNodes ; 221 for ( var i = 0 ; i < throbberBlocks.length ; i++ ) 222 { 223 var classes = throbberBlocks[i].className.split( ' ' ) ; 224 classes.pop() ; 225 classes.push( 'throbber_' + ( baseIndex + i ) % 10 ) ; 226 throbberBlocks[i].className = classes.join( ' ' ) ; 227 } 228 baseIndex-- ; 229 if ( baseIndex < 0 ) 230 baseIndex += 10 ; 231 timer = FCKTools.SetTimeout( arguments.callee, 100, this, null, window ) ; 232 } 233 234 FCKTools.AddEventListener( window, 'beforeunload', function() 235 { 236 if ( timer ) 237 clearTimeout( timer ) ; 238 } ) ; 216 var lastClass = throbberParent.lastChild.className ; 217 218 // From the last to the second one, copy the class from the previous one. 219 for ( var i = throbberBlocks.length - 1 ; i > 0 ; i-- ) 220 throbberBlocks[i].className = throbberBlocks[i-1].className ; 221 222 // For the first one, copy the last class (rotation). 223 throbberBlocks[0].className = lastClass ; 224 } 239 225 240 226 return { 241 227 Show : function( waitMilliseconds ) 242 228 { 229 // Auto-setup the Show function to be called again after the 230 // requested amount of time. 243 231 if ( waitMilliseconds && waitMilliseconds > 0 ) 244 232 { … … 248 236 249 237 var throbberParent = $( 'throbberBlock' ) ; 250 for ( var i = 0 ; i < 10 ; i++) 251 throbberParent.appendChild( document.createElement( 'div' ) ).className = 'throbber_' + ( i > 0 ? 'right' : 'left' ) 252 + ' throbber_' + i ; 253 baseIndex = 9 ; 254 238 239 // Create the throbber blocks. 240 var classIds = [ 1,2,3,4,5,4,3,2 ] ; 241 while ( classIds.length > 0 ) 242 throbberParent.appendChild( document.createElement( 'div' ) ).className = ' throbber_' + classIds.shift() ; 243 244 // Center the throbber. 255 245 var frm = $( 'contents' ) ; 256 246 var frmCoords = FCKTools.GetDocumentPosition( window, frm ) ; … … 260 250 throbberParent.style.top = parseInt( y, 10 ) + 'px' ; 261 251 262 timer = FCKTools.SetTimeout( updateThrobber, 100, this, null, window ) ; 252 // Show it. 253 throbberParent.style.visibility = '' ; 254 255 // Setup the animation interval. 256 timer = setInterval( updateThrobber, 100 ) ; 263 257 }, 264 258 … … 267 261 if ( timer ) 268 262 { 269 clear Timeout( timer ) ;263 clearInterval( timer ) ; 270 264 timer = null ; 271 265 } … … 284 278 var lastCoords ; 285 279 var currentPos ; 286 280 287 281 var cleanUpHandlers = function() 288 282 { … … 353 347 return ; 354 348 355 lastCoords = 356 { 357 x : evt.screenX, 349 lastCoords = 350 { 351 x : evt.screenX, 358 352 y : evt.screenY 359 353 } ; 360 354 361 355 // Save the current IFRAME position. 362 currentPos = 356 currentPos = 363 357 { 364 358 x : parseInt( FCKDomTools.GetCurrentElementStyle( Args().TopWindow, frameElement, 'left' ) ), … … 507 501 }() ; 508 502 509 // readystatechange handler for registering drag and drop handlers in cover iframes, defined out here to avoid memory leak. 510 // Do NOT put this function as a private function as it will induce memory leak in IE and it's not detectable with Drip or 511 // sIEve and undetectable leaks are really nasty (sigh). 503 // readystatechange handler for registering drag and drop handlers in cover 504 // iframes, defined out here to avoid memory leak. 505 // Do NOT put this function as a private function as it will induce memory leak 506 // in IE and it's not detectable with Drip or sIEve and undetectable leaks are 507 // really nasty (sigh). 512 508 var onReadyRegister = function() 513 509 { … … 517 513 } ; 518 514 519 // The business logic of the dialog, dealing with operational things like dialog open/dialog close/enable/disable/etc. 515 // The business logic of the dialog, dealing with operational things like 516 // dialog open/dialog close/enable/disable/etc. 520 517 (function() 521 518 { … … 632 629 // First of all, translate the dialog box contents. 633 630 Editor().FCKLanguageManager.TranslatePage( document ) ; 634 631 635 632 // Create the IFRAME that holds the dialog contents. 636 633 $( 'innerContents' ).innerHTML = '<iframe id="frmMain" src="' + Args().Page + '" name="frmMain" frameborder="0" width="100%" height="100%" scrolling="auto" style="visibility: hidden;" allowtransparency="true"></iframe>' ; 637 634 } ; 638 635 639 636 window.InnerDialogLoaded = function() 640 637 { … … 653 650 654 651 // Set the language direction. 655 innerDoc.dir = Editor().FCKLang.Dir ;652 innerDoc.dir = langDir ; 656 653 657 654 // Sets the Skin CSS. … … 664 661 665 662 DragAndDrop.RegisterHandlers( innerWindow ) ; 666 663 667 664 innerWindow.focus() ; 668 665 … … 678 675 { 679 676 Selection.EnsureSelection() ; 680 677 681 678 var frmMain = window.frames["frmMain"] ; 682 679 … … 694 691 window.CloseDialog = function( dontFireChange ) 695 692 { 693 Throbber.Hide() ; 694 696 695 Selection.EnsureSelection() ; 697 696 … … 761 760 <td width="100%"> </td> 762 761 <td nowrap="nowrap"> 763 <input id="btnOk" style=" VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />762 <input id="btnOk" style="visibility: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" /> 764 763 765 764 <input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" /> … … 778 777 <div class="br"></div> 779 778 <div class="cover" id="cover" style="display:none"></div> 780 <div id="throbberBlock" style="position: absolute; z-index: 10; text-align: center; font-size: 9px;"></div>779 <div id="throbberBlock" style="position: absolute; visibility: hidden"></div> 781 780 <script type="text/javascript"> 782 781 // Set the class name for language direction. 783 document.body.className += ' ' + Editor().FCKLang.Dir ;782 document.body.className += ' ' + langDir ; 784 783 785 784 var cover = $( 'cover' ) ; -
FCKeditor/branches/features/floating_dialog/editor/skins/default/fck_dialog.css
r1358 r1369 166 166 right: 16px; 167 167 bottom: 20px; 168 background-color: # e3e3c7;168 background-color: #f1f1e3; 169 169 overflow: hidden; 170 170 z-index: 1; … … 355 355 } 356 356 357 .throbber_left, .throbber_right 358 { 359 position: relative; 357 #throbberBlock 358 { 359 z-index: 10; 360 } 361 362 #throbberBlock div 363 { 364 float: left; 360 365 width: 8px; 361 height: 10px; 362 float: left; 363 } 364 365 .throbber_right 366 { 367 margin-left: 3px; 368 } 369 370 .throbber_0 371 { 372 background-color: #555; 373 } 366 height: 9px; 367 margin-left: 2px; 368 margin-right: 2px; 369 font-size: 1px; /* IE6 */ 370 } 371 372 /* 373 Color Gradient Generator: 374 http://www.herethere.net/~samson/php/color_gradient/?cbegin=737357&cend=E3E3C7&steps=4 375 */ 374 376 375 377 .throbber_1 376 378 { 377 background-color: # 666;379 background-color: #737357; 378 380 } 379 381 380 382 .throbber_2 381 383 { 382 background-color: # 777;384 background-color: #8f8f73; 383 385 } 384 386 385 387 .throbber_3 386 388 { 387 background-color: # 888;389 background-color: #abab8f; 388 390 } 389 391 390 392 .throbber_4 391 393 { 392 background-color: # 999;394 background-color: #c7c7ab; 393 395 } 394 396 395 397 .throbber_5 396 398 { 397 background-color: #AAA; 398 } 399 400 .throbber_6 401 { 402 background-color: #999; 403 } 404 405 .throbber_7 406 { 407 background-color: #888; 408 } 409 410 .throbber_8 411 { 412 background-color: #777; 413 } 414 415 .throbber_9 416 { 417 background-color: #666; 418 } 399 background-color: #e3e3c7; 400 } -
FCKeditor/branches/features/floating_dialog/editor/skins/office2003/fck_dialog.css
r1358 r1369 355 355 } 356 356 357 .throbber_left, .throbber_right 358 { 359 position: relative; 357 #throbberBlock 358 { 359 z-index: 10; 360 } 361 362 #throbberBlock div 363 { 364 float: left; 360 365 width: 8px; 361 height: 10px; 362 float: left; 363 } 364 365 .throbber_right 366 { 367 margin-left: 3px; 368 } 369 370 .throbber_0 371 { 372 background-color: #555; 373 } 366 height: 9px; 367 margin-left: 2px; 368 margin-right: 2px; 369 font-size: 1px; /* IE6 */ 370 } 371 372 /* 373 Color Gradient Generator: 374 http://www.herethere.net/~samson/php/color_gradient/?cbegin=0E3460&cend=8cb2fd&steps=4 375 */ 374 376 375 377 .throbber_1 376 378 { 377 background-color: # 666;379 background-color: #0E3460; 378 380 } 379 381 380 382 .throbber_2 381 383 { 382 background-color: # 777;384 background-color: #2D5387; 383 385 } 384 386 385 387 .throbber_3 386 388 { 387 background-color: # 888;389 background-color: #4D73AE; 388 390 } 389 391 390 392 .throbber_4 391 393 { 392 background-color: # 999;394 background-color: #6C92D5; 393 395 } 394 396 395 397 .throbber_5 396 398 { 397 background-color: #AAA; 398 } 399 400 .throbber_6 401 { 402 background-color: #999; 403 } 404 405 .throbber_7 406 { 407 background-color: #888; 408 } 409 410 .throbber_8 411 { 412 background-color: #777; 413 } 414 415 .throbber_9 416 { 417 background-color: #666; 418 } 399 background-color: #8CB2FD; 400 } -
FCKeditor/branches/features/floating_dialog/editor/skins/silver/fck_dialog.css
r1358 r1369 355 355 } 356 356 357 .throbber_left, .throbber_right 358 { 359 position: relative; 357 #throbberBlock 358 { 359 z-index: 10; 360 } 361 362 #throbberBlock div 363 { 364 float: left; 360 365 width: 8px; 361 height: 10px; 362 float: left; 363 } 364 365 .throbber_right 366 { 367 margin-left: 3px; 368 } 369 370 .throbber_0 371 { 372 background-color: #555; 373 } 366 height: 9px; 367 margin-left: 2px; 368 margin-right: 2px; 369 font-size: 1px; /* IE6 */ 370 } 371 372 /* 373 Color Gradient Generator: 374 http://www.herethere.net/~samson/php/color_gradient/?cbegin=504845&cend=DEDEDE&steps=4 375 */ 374 376 375 377 .throbber_1 376 378 { 377 background-color: # 666;379 background-color: #504845; 378 380 } 379 381 380 382 .throbber_2 381 383 { 382 background-color: #7 77;384 background-color: #736D6B; 383 385 } 384 386 385 387 .throbber_3 386 388 { 387 background-color: # 888;389 background-color: #979391; 388 390 } 389 391 390 392 .throbber_4 391 393 { 392 background-color: # 999;394 background-color: #BAB8B7; 393 395 } 394 396 395 397 .throbber_5 396 398 { 397 background-color: #AAA; 398 } 399 400 .throbber_6 401 { 402 background-color: #999; 403 } 404 405 .throbber_7 406 { 407 background-color: #888; 408 } 409 410 .throbber_8 411 { 412 background-color: #777; 413 } 414 415 .throbber_9 416 { 417 background-color: #666; 418 } 399 background-color: #DEDEDE; 400 }