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

📄 whizzywig.js

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JS
📖 第 1 页 / 共 2 页
字号:
 else {  var newRow = paNode.insertRow(tRow+parseInt(below)); //1=below  0=above   for (i = 0; i < tCols; i++){    var newCell = newRow.insertCell(i);    newCell.innerHTML = "#";   } }}function doCol(toDo,after) { //insert or delete a column var paNode = papa; while (paNode.tagName != 'TD') paNode = paNode.parentNode; var tCol = paNode.cellIndex; while (paNode.tagName != "TABLE") paNode = paNode.parentNode; var tRows = paNode.rows.length; for (i = 0; i < tRows; i++){  if (toDo == "delete") paNode.rows[i].deleteCell(tCol);  else {   var newCell = paNode.rows[i].insertCell(tCol+parseInt(after)); //if after = 0 then before   newCell.innerHTML = "#";  } }}function makeTable() { //insert a table hideDialogs(); var rows = o('tf_rows').value; var cols = o('tf_cols').value; var border = o('tf_border').value; var head = o('tf_head').value; if ((rows > 0) && (cols > 0)) {  var table = '<table border="' + border + '">';  for (var i=1; i <= rows; i++) {   table = table + "<tr>";   for (var j=1; j <= cols; j++) {    if (i==1) {     if (head=="1") table += "<th>Title"+j+"</th>"; //Title1 Title2 etc.     else table += "<td>"+j+"</td>";    }    else if (j==1) table += "<td>"+i+"</td>";   else table += "<td>#</td>";   }   table += "</tr>";  }  table += " </table>";  insHTML(table); }}function doWin(URL) {  //popup  for browse function window.open(URL,'popWhizz','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,top=100');}function spellCheck() {  //check spelling with plugin if available if (document.all) { try {  var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");  tmpis.CheckAllLinkedDocuments(document); } catch(exception) {  if(exception.number==-2146827859) {  if (confirm("ieSpell is not installed on your computer. \n Click [OK] to go to download page."))    window.open("http://www.iespell.com/download.php","DownLoad");  } else {   alert("Error Loading ieSpell: Exception " + exception.number);  } } } else {   if (confirm("Click [OK] for instructions to download and install SpellBound on your computer. \n If you already have it, click [Cancel] then right click in the edit area and select 'Check Spelling'."))     window.open("http://spellbound.sourceforge.net/install","DownLoad"); }}function cleanUp(){  //clean up crud inserted by Micro$oft Orifice oW.document.execCommand("removeformat",false,null); whereAmI(); var h = oW.document.body.innerHTML; if (!gentleClean) {	h = h.replace(/<\/?(SPAN|DEL|INS|DIR)[^>]*>/gi, "");  h = h.replace(/\b(CLASS|STYLE)=\"?[^\"]*\"?/gi, ""); } h = h.replace(/<\/?(FONT|SHAPE|V:|O:|F:|F |PATH|LOCK|IMAGEDATA|STROKE|FORMULAS)[^>]*>/gi, ""); h = h.replace(/\bCLASS=\"?MSO\w*\"?/gi, ""); // h = h.replace(//g,'-'); //long - h = h.replace(/[]/g, "'"); //single smartquotes   h = h.replace(/[]/g, '"'); //double smartquotes  h = h.replace(/align="?justify"?/gi, ""); //justify sends some browsers mad h = h.replace(/<(TABLE|TD)(.*)WIDTH[^A-Za-z>]*/gi, "<$1$2"); //no fixed width tables h = h.replace(/<([^>]+)>\s*<\/\1>/gi, ""); //empty tag oW.document.body.innerHTML = h; syncTextarea();}function hideDialogs() { h('LINK_FORM'); h('IMAGE_FORM'); h('COLOR_FORM'); h('TABLE_FORM'); h('TABLE_CONTROLS');}function showDesign() { oW.document.body.innerHTML = tidyD(o(idTa).value); h(idTa); h('showWYSIWYG'); s('CONTROLS'); s('whizzyWig'); if(o("whizzyWig").contentDocument) o("whizzyWig").contentDocument.designMode = "on"; //FF loses it on hide oW.focus();}function showHTML() {  var t = (window.get_xhtml) ? get_xhtml(oW.document.body) : oW.document.body.innerHTML; o(idTa).value = tidyH(t); h('CONTROLS'); h('whizzyWig'); s(idTa); s('showWYSIWYG'); o(idTa).focus();}function syncTextarea() { //tidy up before we go-go var b = oW.document.body; if (o(idTa).style.display == 'block') b.innerHTML = o(idTa).value; b.innerHTML = tidyH(b.innerHTML); o(idTa).value = (window.get_xhtml) ? get_xhtml(b) : b.innerHTML;}function tidyD(h){ //FF designmode likes <B>,<I>... h = h.replace(/<(\/?)strong([^>]*)>/gi, "<$1B$2>");  h = h.replace(/<(\/?)em([^>]*)>/gi, "<$1I$2>"); return h;}function tidyH(h){ //...but <B>,<I> deprecated h = h.replace(/<([^>]+)>\s*<\/\1>/gi, ""); //empty tag h = h.replace(/(<\/?)[Bb]>/g, "$1strong>"); h = h.replace(/(<\/?)[Ii]>/g, "$1em>"); h = h.replace(/(<\/?)[Bb](\s+[^>]*)>/g, "$1strong$2>"); h = h.replace(/(<\/?)[Ii](\s+[^>]*)>/g, "$1em$2>"); var me = 'href="'+location.href+'#'; //IE anchor bug h = h.replace(me,'href="#'); return h;}function kb_handler(evt) { // keyboard controls for Mozilla var w = evt.target.id; if (evt.ctrlKey) {  var key = String.fromCharCode(evt.charCode).toLowerCase();  var cmd = '';  switch (key) {   case 'b': cmd = "bold"; break;   case 'i': cmd = "italic"; break;   case 'u': cmd = "underline"; break;   case 'l': cmd = "link"; break;   case 'm': cmd = "image"; break;  };  if (cmd) {   makeSo(cmd, true);   evt.preventDefault();  // stop the event bubble   evt.stopPropagation();  } }}function insHTML(html) { // insert arbitrary HTML at current selectionif (html.indexOf('js:') == 0) {  eval(html.replace(/^js:/,''));  return;}whereAmI(); if (!html) html = prompt("Enter some HTML to insert:", ""); if (!html) return; if (document.selection) {  rng.select(); //else IE gets lost  html = html + rng.htmlText;  try { oW.document.selection.createRange().pasteHTML(html); } //  catch (e) { }// catch error if range is bad for IE } else { //Moz  if (sel) html = html + sel;  var fragment = oW.document.createDocumentFragment();  var div = oW.document.createElement("div");  div.innerHTML = html;  while (div.firstChild) {   fragment.appendChild(div.firstChild);  }  sel.removeAllRanges();  rng.deleteContents();  var node = rng.startContainer;  var pos = rng.startOffset;  switch (node.nodeType) {   case 3: if (fragment.nodeType == 3) {    node.insertData(pos, fragment.data);    rng.setEnd(node, pos + fragment.length);    rng.setStart(node, pos + fragment.length);   } else {    node = node.splitText(pos);    node.parentNode.insertBefore(fragment, node);    rng.setEnd(node, pos + fragment.length);    rng.setStart(node, pos + fragment.length);   }   break;   case 1: node = node.childNodes[pos];    node.parentNode.insertBefore(fragment, node);    rng.setEnd(node, pos + fragment.length);    rng.setStart(node, pos + fragment.length);   break;  }  sel.addRange(rng); } oW.focus();}function whereAmI() {//get current selected range if available  oW.focus(); if (document.all) { //IE  sel = oW.document.selection;  if (sel != null) {   rng = sel.createRange();   switch (sel.type) {    case "Text":case "None":     papa = rng.parentElement(); break;    case "Control":     papa = rng.item(0); break;    default:     papa = frames['whizzyWig'].document.body;   }   var paNode = papa;   trail = papa.tagName + '>' +sel.type;   while (paNode.tagName != 'BODY') {    paNode = paNode.parentNode;    trail = paNode.tagName + '>' + trail;   }   window.status = trail;  } } else { //Moz  sel = oW.getSelection();  if (sel != null) rng = sel.getRangeAt(sel.rangeCount - 1).cloneRange(); }}function textSel() {	if (sel != "") return true; 	else {alert(t("Select some text first")); return false;}}function s(id) {o(id).style.display = 'block';} //show elementfunction h(id) {o(id).style.display = 'none';} //hide elementfunction o(id) { return document.getElementById(id); } //get element by IDfunction w(str) { return document.write(str); } //document writefunction t(key) {return (window.language && language[key]) ? language[key] :  key;} //translation

⌨️ 快捷键说明

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