/pigeoncms/Plugins/fckeditor/editor/filemanager/browser/default/js/common.js

http://pigeoncms.googlecode.com/ · JavaScript · 88 lines · 48 code · 14 blank · 26 comment · 5 complexity · 87efb83af512ed2236f1ad6521297863 MD5 · raw file

  1. /*
  2. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  3. * Copyright (C) 2003-2009 Frederico Caldeira Knabben
  4. *
  5. * == BEGIN LICENSE ==
  6. *
  7. * Licensed under the terms of any of the following licenses at your
  8. * choice:
  9. *
  10. * - GNU General Public License Version 2 or later (the "GPL")
  11. * http://www.gnu.org/licenses/gpl.html
  12. *
  13. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  14. * http://www.gnu.org/licenses/lgpl.html
  15. *
  16. * - Mozilla Public License Version 1.1 or later (the "MPL")
  17. * http://www.mozilla.org/MPL/MPL-1.1.html
  18. *
  19. * == END LICENSE ==
  20. *
  21. * Common objects and functions shared by all pages that compose the
  22. * File Browser dialog window.
  23. */
  24. // Automatically detect the correct document.domain (#1919).
  25. (function()
  26. {
  27. var d = document.domain ;
  28. while ( true )
  29. {
  30. // Test if we can access a parent property.
  31. try
  32. {
  33. var test = window.top.opener.document.domain ;
  34. break ;
  35. }
  36. catch( e )
  37. {}
  38. // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
  39. d = d.replace( /.*?(?:\.|$)/, '' ) ;
  40. if ( d.length == 0 )
  41. break ; // It was not able to detect the domain.
  42. try
  43. {
  44. document.domain = d ;
  45. }
  46. catch (e)
  47. {
  48. break ;
  49. }
  50. }
  51. })() ;
  52. function AddSelectOption( selectElement, optionText, optionValue )
  53. {
  54. var oOption = document.createElement("OPTION") ;
  55. oOption.text = optionText ;
  56. oOption.value = optionValue ;
  57. selectElement.options.add(oOption) ;
  58. return oOption ;
  59. }
  60. var oConnector = window.parent.oConnector ;
  61. var oIcons = window.parent.oIcons ;
  62. function StringBuilder( value )
  63. {
  64. this._Strings = new Array( value || '' ) ;
  65. }
  66. StringBuilder.prototype.Append = function( value )
  67. {
  68. if ( value )
  69. this._Strings.push( value ) ;
  70. }
  71. StringBuilder.prototype.ToString = function()
  72. {
  73. return this._Strings.join( '' ) ;
  74. }