Prv8 Shell
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4
System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64
User : jackjohn ( 502)
PHP Version : 5.3.17
Disable Function : NONE
Directory :  /home/jackjohn/public_html/style/javascript/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/jackjohn/public_html/style/javascript/loadWysiwyg.js
// --------------------------------------------------------------------------
// Function    : isWysiwygSupported
// Description : check if wysiwyg editor is supported on current browser
// --------------------------------------------------------------------------

function isWysiwygSupported() {
  var userAgent          = navigator.userAgent;
  var isWysiwygSupported = 0;

  if      (userAgent.match('Safari'))     { isWysiwygSupported = 0; }
  else if (userAgent.match('Windows CE')) { isWysiwygSupported = 0; }
  else if (userAgent.match('Opera'))      { isWysiwygSupported = 0; }
  else if (userAgent.match('MSIE') && !userAgent.match('Mac')) {
    var ieVersion = parseFloat(navigator.appVersion.split("MSIE")[1]);  // returns "6.0" on "4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
    if (ieVersion >= 5.5) { isWysiwygSupported = 1; }
  }
  else if (userAgent.match('Netscape')) {
    var geckoVersion = navigator.productSub;    // Netscape 7.1 is 20030624
    if (geckoVersion >= 20030624) { isWysiwygSupported = 1; }
  }
  else if (userAgent.match('Firefox')) {
    var geckoVersion = navigator.productSub;    // firefox 1.0 is 20041107
    if (geckoVersion >= 20041107) { isWysiwygSupported = 1; }
  }
  else if (userAgent.match('Gecko')) {
    var geckoVersion = navigator.productSub;    // Moz 1.7 is 20040616
    if (geckoVersion >= 20040616) { isWysiwygSupported = 1; }
  }

  return isWysiwygSupported;
}

// -----------------------------------------------------------------------------
// Function    : showNoWysiwygMessage
// Description :
// Usage       : showNoWysiwygMessage()
// -----------------------------------------------------------------------------

function showNoWysiwygMessage(wysiwygContent, height) {

  var randomNumber = Math.floor(Math.random()*1000000);

  document.write('<div align=center style="color:red">\n');
  document.write('<b>\n');
  document.write('   Note: Your browser does not support WYSIWYG rich text editing.<br>\n');
  document.write('   The following content can be viewed but not modified.\n');
  document.write('</b>\n');
  document.write('</div>\n');
  document.write('<div id="contentPreviewForNoWysiwygSupport_' +randomNumber+ '" style="width: 100%; height: ' +height+ 'px; border: 2px inset #CCCCCC; overflow: auto"></div>\n');
  document.write('<scr' + 'ipt>\n');
  document.write("  var previewField       = document.getElementById('contentPreviewForNoWysiwygSupport_" +randomNumber+ "');\n");
  document.write('  previewField.innerHTML = wysiwygContent;\n');
  document.write('</scr' + 'ipt>\n');
}

// -----------------------------------------------------------------------------
// Function    : errorLoadingWysiwygMessage
// Description :
// Usage       : errorLoadingWysiwygMessage()
// -----------------------------------------------------------------------------

function errorLoadingWysiwygMessage(wysiwygContent, height) {

  var randomNumber = Math.floor(Math.random()*1000000);

  document.write('<div align=center style="color:red">\n');
  document.write('<b>\n');
  document.write('   Note: There was an error loading the WYSIWYG rich text editor.<br>\n');
  document.write('   The following content can be viewed but not modified.\n');
  document.write('</b>\n');
  document.write('</div>\n');
  document.write('<div id="contentPreviewForNoWysiwygSupport_' +randomNumber+ '" style="width: 100%; height: ' +height+ 'px; border: 2px inset #CCCCCC; overflow: auto"></div>\n');
  document.write('<scr' + 'ipt>\n');
  document.write("  var previewField       = document.getElementById('contentPreviewForNoWysiwygSupport_" +randomNumber+ "');\n");
  document.write('  previewField.innerHTML = wysiwygContent;\n');
  document.write('</scr' + 'ipt>\n');
}

// --------------------------------------------------------------------------
// Function    : loadWysiwygScript
// Description : load editor script for ie or mozilla or display an error
// --------------------------------------------------------------------------

function loadWysiwygScript(wysiwygWebPath) {
  if (typeof(wysiwygWebPath) == 'undefined' || wysiwygWebPath == '') { error('loadWysiwygScript: no wysiwygWebPath specified!'); }

  // get script url
  var scriptUrl;
  if (navigator.appName == 'Microsoft Internet Explorer') { scriptUrl = wysiwygWebPath + 'scripts/editor.js'; }
  else if (navigator.product == 'Gecko')                  { scriptUrl = wysiwygWebPath + 'scripts/moz/editor.js'; }
  else                                                    { alert("Can't load wysiwyg editor script, unknown browser!"); }

  // load script file
  var errorCode = "alert('Couldn\\'t load ' + this.src + '\\n\\nMake sure file exists and that domain and path correct!\\n')";
  var scriptTag = '<scr'+'ipt src="' +scriptUrl+ '" onerror="' + errorCode + '"></scr'+'ipt>';
  document.write(scriptTag);

}


// --------------------------------------------------------------------------
// Function    : insertWysiwyg
// Description : insert wysiwyg into page
// --------------------------------------------------------------------------

function insertWysiwyg(wysiwygContent, height, fieldname) {  // min height is 200

  // if no editor javascript loaded, show error message
  if (typeof(InnovaEditor) == 'undefined') {
    errorLoadingWysiwygMessage(wysiwygContent, height);
    return;
  }

  // insert wysiwyg
  // note: the editor requires we create a global var for each wysiwyg instance and pass
  // it the name of that global, so we're using eval to do that and then working with
  // a copy of that global reference in the following code for simplicity.

  var globalVar = fieldname + "_wysiwyg";
  var wysiwyg   = eval(globalVar + " = new InnovaEditor('" +globalVar+ "')");

  wysiwyg.arrStyle = [["body",false,"","font:12px verdana,arial,sans-serif;"]]; // CSS rules to apply to editor content

  // ALL AVAILABLE BUTTONS (from [webRoot]/[productDir]/wysiwyg/scripts/editor.js, search for this.buttonMap)

  // "Save","FullScreen","Preview","Print","Search","SpellCheck","|",
  // "Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|",
  // "ForeColor","BackColor","|","Bookmark","Hyperlink",
  // "Image","Flash","Media","ContentBlock","InternalLink","InternalImage","CustomObject","|",
  // "Table","Guidelines","Absolute","|","Characters","Line",
  // "Form","RemoveFormat","HTMLFullSource","HTMLSource","XHTMLFullSource",
  // "XHTMLSource","ClearAll","BRK",
  // "StyleAndFormatting","Styles","|","CustomTag","Paragraph","FontName","FontSize","|",
  // "Bold","Italic","Underline","Strikethrough","Superscript","Subscript","|",
  // "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull","|",
  // "Numbering","Bullets","|","Indent","Outdent","LTR","RTL"

  wysiwyg.features=[    // buttons to display
    "FontName","FontSize","Bold","Italic","Underline","|",
    "JustifyLeft","JustifyCenter","JustifyRight", "|","Numbering","Bullets","Indent","Outdent","|","PasteWord", "BRK",
    "ForeColor","BackColor","|","Line","Hyperlink","Image","Table","|",
    "HTMLSource","FullScreen"
  ];

  wysiwyg.useDIV=false  // Pressing enter won't insert a <div> in Internet Explorer
  wysiwyg.useBR=false   // Pressing enter won't insert a <br> in Internet Explorer

  // fonts to display
  wysiwyg.arrFontName=["Arial", "Courier New", "Georgia", "Tahoma", "Times New Roman", "Verdana", "impact", "Wingdings"];

  wysiwyg.width    = "540";
  wysiwyg.height   = height;
  wysiwyg.useTagSelector = false;

  wysiwyg.RENDER(wysiwygContent);

  // add to wysiwyg list
  if (typeof(wysiwygFieldList) == 'undefined') { wysiwygFieldList = new Array(); }
  wysiwygFieldList.push(fieldname);

}

// --------------------------------------------------------------------------
// Function    : saveWysiwygContentToHiddenFields
// Description : load the html contents from the wysiwyg fields and assign
//               it to hidden fields so it will get submitted with the form.
// Usage       : <form ... onsubmit="saveWysiwygContentToHiddenFields()">
// --------------------------------------------------------------------------

function saveWysiwygContentToHiddenFields() {

  // return if no wysiwyg editors
  if (typeof(wysiwygFieldList) == 'undefined') { return; }

  // set content for each wysiwyg
  for (var i=0; i<wysiwygFieldList.length; i++) {
    var fieldName       = wysiwygFieldList[i];
    var wysiwygObject   = eval(fieldName + "_wysiwyg");
    var hiddenElement   = document.getElementById(fieldName);
    hiddenElement.value = wysiwygObject.getXHTMLBody();
  }

}


// --------------------------------------------------------------------------
// Function    : fixDisappearedWysiwygContent
// Description : BUGFIX (May 23, 2006)
//               Internet Explorer issue: third line appears blank in editor box.
// --------------------------------------------------------------------------



function fixDisappearedWysiwygContent() {

  // if no editor(s) initialized, return
  if (typeof(oUtil) == 'undefined') { return; }

  if (navigator.appName.indexOf('Microsoft')==-1) return;
  for (var i=0;i<oUtil.arrEditor.length;i++) {
    var wysiwyg=eval("idContent"+oUtil.arrEditor[i]);
      wysiwyg.document.execCommand("SelectAll", false, null);
      wysiwyg.document.execCommand("UnSelect", false, null);
  }
}

haha - 2025