⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.js

📁 The Shift Log is a database entry and display system that is built off of PHP and MySQL. The log use
💻 JS
📖 第 1 页 / 共 5 页
字号:
    }else{
        this._display_textarea();
        this._load_content();
    }
}

/**
*   WYSIWYG_Editor::_display_textarea
*
*   Used to display a substitute for the wysiwyg editor HTML interface to non-supported browsers
**/
WYSIWYG_Editor.prototype._display_textarea = function (){
    document.write('<p style="background-color: yellow; color: red; padding: 3px;"><b>WARNING:</b> Your browser does not support the WYSIWYG_Editor class. The script you are posting to may expect HTML code.</p>');
    document.write('<textarea name="'+this.wysiwyg_hidden+'" id="'+this.wysiwyg_hidden+'" rows="'+this.ta_rows+'" cols="'+this.ta_cols+'"></textarea><br>');
}

/**
*   WYSIWYG_Editor::_display_editor
*
*   Used to display the actual wysiwyg editor HTML interface to supported browsers
**/
WYSIWYG_Editor.prototype._display_editor = function (){
    document.write('   <textarea name="'+this.wysiwyg_hidden+'" id="'+this.wysiwyg_hidden+'" style="visibility:hidden;display:none;"></textarea>');
    document.write('   <table width="58%" cellpadding="5" cellspacing="0" border="2" id="'+this.instance_name+'_table" bgcolor="#dfdfdf">');
    document.write('    <tr>');
    document.write('     <td>');
    document.write('      <table width="100%" border="0" cellspacing="0" cellpadding="0">');
    document.write('       <tr>');
    document.write('        <td valign="top" colspan="2">');
    document.write('         <div id="'+this.instance_name+'_toolbars">');
    if(this.font_format_toolbar1){
        document.write('          <select onChange="'+this.instance_name+'.doTextFormat(\'fontname\',this.options[this.selectedIndex].value)">');
        document.write('           <option value="">- Font -</option>');
        document.write('           <option value="cursive">Cursive</option>');
        document.write('           <option value="fantasy">Fantasy</option>');
        document.write('           <option value="sans-serif">Sans Serif</option>');
        document.write('           <option value="serif">Serif</option>');
        document.write('           <option value="monospace">Typewriter</option>');
        document.write('          </select>');
        document.write('          <select onChange="'+this.instance_name+'.doTextFormat(\'fontSize\',this.options[this.selectedIndex].value)">');
        document.write('           <option value="">- Size -</option>');
        document.write('           <option value="-2">X Small</option>');
        document.write('           <option value="-1">Small</option>');
        document.write('           <option value="+0">Medium</option>');
        document.write('           <option value="+1">Large</option>');
        document.write('           <option value="+2">X Large</option>');
        document.write('          </select>');
        document.write('          <select onChange="'+this.instance_name+'.doTextFormat(\'formatblock\',this.options[this.selectedIndex].value)">');
        document.write('           <option value="<p>">Normal</option>');
        document.write('           <option value="<h1>">Heading 1</option>');
        document.write('           <option value="<h2>">Heading 2</option>');
        document.write('           <option value="<h3>">Heading 3</option>');
        document.write('           <option value="<h4>">Heading 4</option>');
        document.write('           <option value="<h5>">Heading 5</option>');
        document.write('           <option value="<h6>">Heading 6</option>');
        document.write('           <option value="<address>">Address</option>');
        document.write('          </select>');
        if(this.font_format_toolbar1_after=='br'){
            document.write('         <br>');
        }else if(this.font_format_toolbar1_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.font_format_toolbar2){
        document.write('           <img alt="Font Color" title="Font Color" class="butClass" src="'+this.wysiwyg_path+'/editor/images/forecol.png" onClick="'+this.instance_name+'.doTextFormat(\'forecolor\',\'\',event)" id="'+this.instance_name+'_forecolor">');
        document.write('           <img alt="Background Color" title="Background Color" class="butClass" src="'+this.wysiwyg_path+'/editor/images/bgcol.png" onClick="'+this.instance_name+'.doTextFormat(\'hilitecolor\',\'\',event)" id="'+this.instance_name+'_hilitecolor">');
        if(this.font_format_toolbar2_after=='br'){
            document.write('         <br>');
        }else if(this.font_format_toolbar2_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.font_format_toolbar3){
        document.write('          <img alt="Bold" title="Bold" class="butClass" src="'+this.wysiwyg_path+'/editor/images/bold.png" onClick="'+this.instance_name+'.doTextFormat(\'bold\',\'\')">');
        document.write('          <img alt="Italic" title="Italic" class="butClass" src="'+this.wysiwyg_path+'/editor/images/italic.png" onClick="'+this.instance_name+'.doTextFormat(\'italic\',\'\')">');
        document.write('          <img alt="Underline" title="Underline" class="butClass" src="'+this.wysiwyg_path+'/editor/images/underline.png" onClick="'+this.instance_name+'.doTextFormat(\'underline\',\'\')">');
        if(this.font_format_toolbar3_after=='br'){
            document.write('         <br>');
        }else if(this.font_format_toolbar3_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.font_format_toolbar4){
        document.write('          <img alt="Superscript" title="Superscript" class="butClass" src="'+this.wysiwyg_path+'/editor/images/sup.png" onClick="'+this.instance_name+'.doTextFormat(\'superscript\',\'\')">');
        document.write('          <img alt="Subscript" title="Subscript" class="butClass" src="'+this.wysiwyg_path+'/editor/images/sub.png" onClick="'+this.instance_name+'.doTextFormat(\'subscript\',\'\')">');
        if(this.font_format_toolbar4_after=='br'){
            document.write('         <br>');
        }else if(this.font_format_toolbar4_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.alignment_toolbar1){
        document.write('          <img alt="Left" title="Left" class="butClass" src="'+this.wysiwyg_path+'/editor/images/left.png" onClick="'+this.instance_name+'.doTextFormat(\'justifyleft\',\'\')">');
        document.write('          <img alt="Center" title="Center" class="butClass" src="'+this.wysiwyg_path+'/editor/images/center.png" onClick="'+this.instance_name+'.doTextFormat(\'justifycenter\',\'\')">');
        document.write('          <img alt="Right" title="Right" class="butClass" src="'+this.wysiwyg_path+'/editor/images/right.png" onClick="'+this.instance_name+'.doTextFormat(\'justifyright\',\'\')">');
        document.write('          <img alt="Full" title="Full" class="butClass" src="'+this.wysiwyg_path+'/editor/images/full.png" onClick="'+this.instance_name+'.doTextFormat(\'justifyfull\',\'\')">');
        if(this.alignment_toolbar1_after=='br'){
            document.write('         <br>');
        }else if(this.alignment_toolbar1_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.alignment_toolbar2){
        document.write('          <img alt="Indent" title="Indent" src="'+this.wysiwyg_path+'/editor/images/indent.png" class=butClass onClick="'+this.instance_name+'.doTextFormat(\'indent\',\'\')">');
        document.write('          <img alt="Outdent" title="Outdent" src="'+this.wysiwyg_path+'/editor/images/outdent.png" class=butClass onClick="'+this.instance_name+'.doTextFormat(\'outdent\',\'\')">');
        if(this.alignment_toolbar2_after=='br'){
            document.write('         <br>');
        }else if(this.alignment_toolbar2_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.web_toolbar1){
        document.write('          <img alt="Hyperlink" title="Hyperlink" class="butClass" src="'+this.wysiwyg_path+'/editor/images/link.png" onClick="'+this.instance_name+'.doTextFormat(\'createlink\',\'\')">');
        document.write('          <img alt="Remove Link" title="Remove Link" class="butClass" src="'+this.wysiwyg_path+'/editor/images/unlink.png" onClick="'+this.instance_name+'.doTextFormat(\'unlink\',\'\')">');
        if(this.web_toolbar1_after=='br'){
            document.write('         <br>');
        }else if(this.web_toolbar1_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.web_toolbar2){
        document.write('          <img alt="Ordered List" title="Ordered List" class="butClass" src="'+this.wysiwyg_path+'/editor/images/ordlist.png"  onClick="'+this.instance_name+'.doTextFormat(\'insertorderedlist\',\'\')">');
        document.write('          <img alt="Bulleted List" title="Bulleted List" class="butClass" src="'+this.wysiwyg_path+'/editor/images/bullist.png" onClick="'+this.instance_name+'.doTextFormat(\'insertunorderedlist\',\'\')">');
        if(this.web_toolbar2_after=='br'){
            document.write('         <br>');
        }else if(this.web_toolbar2_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.web_toolbar3){
        document.write('          <img alt="Horizontal Rule" title="Horizontal Rule" class="butClass" src="'+this.wysiwyg_path+'/editor/images/rule.png" onClick="'+this.instance_name+'.doTextFormat(\'inserthorizontalrule\',\'\')">');
        document.write('          <img alt="Insert Table" title="Insert Table" class="butClass" src="'+this.wysiwyg_path+'/editor/images/table.png" onClick="'+this.instance_name+'.insertTable()">');
        if(this.web_toolbar3_after=='br'){
            document.write('         <br>');
        }else if(this.web_toolbar3_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.web_toolbar4){
        if(this.image_button)
            document.write('          <img alt="Insert Image" title="Insert Image" class="butClass" src="'+this.wysiwyg_path+'/editor/images/image.png" onClick="'+this.instance_name+'.insertImage()">');
        if(this.spell_path.length > 0)
            document.write('          <img alt="Check Spelling" title="Check Spelling" class="butClass" src="'+this.wysiwyg_path+'/editor/images/spelling.png" onclick="'+this.instance_name+'.checkSpelling()">');
        if(this.save_button)
            document.write('          <input type="image" alt="Save" title="Save" class="butClass" src="'+this.wysiwyg_path+'/editor/images/save.png" name="'+this.instance_name+'_save">');
        if(this.web_toolbar4_after=='br'){
            document.write('         <br>');
        }else if(this.web_toolbar4_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    if(this.misc_format_toolbar){
        document.write('         <br>');
        document.write('          <img alt="Remove Formatting" title="Remove Formatting" class="butClass" src="'+this.wysiwyg_path+'/editor/images/unformat.png" onClick="'+this.instance_name+'.doTextFormat(\'removeformat\',\'\')">');
        document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        document.write('          <img alt="Undo" title="Undo" class="butClass" src="'+this.wysiwyg_path+'/editor/images/undo.png" onClick="'+this.instance_name+'.doTextFormat(\'undo\',\'\')">');
        document.write('          <img alt="Redo" title="Redo" class="butClass" src="'+this.wysiwyg_path+'/editor/images/redo.png" onClick="'+this.instance_name+'.doTextFormat(\'redo\',\'\')">');
        document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        document.write('          <img alt="Cut" title="Cut" class="butClass" src="'+this.wysiwyg_path+'/editor/images/cut.png" onClick="'+this.instance_name+'.doTextFormat(\'cut\',\'\')">');
        document.write('          <img alt="Copy" title="Copy" class="butClass" src="'+this.wysiwyg_path+'/editor/images/copy.png" onClick="'+this.instance_name+'.doTextFormat(\'copy\',\'\')">');
        document.write('          <img alt="Paste" title="Paste" class="butClass" src="'+this.wysiwyg_path+'/editor/images/paste.png" onClick="'+this.instance_name+'.doTextFormat(\'paste\',\'\')">');
        if(this.misc_format_toolbar=='br'){
            document.write('         <br>');
        }else if(this.misc_format_toolbar_after=='|'){
            document.write('         <img alt="|" src="'+this.wysiwyg_path+'/editor/images/separator.png">');
        }
    }
    document.write('         </div>');
    document.write('        </td>');
    document.write('       </tr>');
    document.write('      </table>');
//    document.write('      <iframe id="'+this.wysiwyg_content+'" style="margin-left: 3px; background-color: white; color: black; width:'+this.frame_width+'px; height:'+this.frame_height+'px;" src="' + window.location.protocol + '//' + location.host + this.wysiwyg_path+'/blank.html"></iframe>');
    document.write('      <iframe id="'+this.wysiwyg_content+'" style="margin-left: 3px; background-color: white; color: black; width:'+this.frame_width+'px; height:'+this.frame_height+'px;"></iframe>');
    document.write('      <table width="'+this.frame_width+'" border="0" cellspacing="0" cellpadding="0" bgcolor="#dfdfdf">');
    document.write('       <tr>');
    document.write('        <td>');
    document.write('        </td>');
    document.write('        <td align="right">');
    if(this.allow_mode_toggle){
        document.write('         <img alt="Toggle Mode" title="Toggle Mode" class="butClass" src="'+this.wysiwyg_path+'/editor/images/mode.png" onClick="'+this.instance_name+'.toggleMode()">');
    }
    document.write('        </td>');
    document.write('       </tr>');
    document.write('      </table>');
    document.write('     </td>');
    document.write('    </tr>');
    document.write('   </table>');
    document.write('   <br>');
}

/**
*   WYSIWYG_Editor::doTextFormat
*
*   Apply a text formatting command to the selected text in the editor (or starting at the current cursor position)
*
*   @param  command string  Which of the editor/browser text formatting commands to apply
**/
WYSIWYG_Editor.prototype.doTextFormat = function (command, optn, evnt){
    if((command=='forecolor') || (command=='hilitecolor')){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -