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

📄 xquared-min.js

📁 软件的主要特点: 1.专门针对有"验证码"要求的论坛. 2.可以完成如下功能: 自动发布新帖,自动回复指定帖,自动注册论坛帐号 (所有操作不能同时针对一个网站,因为有"验证码"要求的网站是每次打开一个
💻 JS
📖 第 1 页 / 共 5 页
字号:
}}},_getDefaultTemplateProcessors:function(){return[{id:"predefinedKeywordProcessor",handler:function(C){var A=Date.get();var B={year:A.getFullYear(),month:A.getMonth()+1,date:A.getDate(),hour:A.getHours(),min:A.getMinutes(),sec:A.getSeconds()};return C.replace(/\{xq:(year|month|date|hour|min|sec)\}/img,function(E,D){return B[D]||D})}}]},addShortcut:function(A,B){this.config.shortcuts[A]={"event":new xq.Shortcut(A),"handler":B}},addShortcuts:function(B){for(var A=0;A<B.length;A++){this.addShortcut(B[A].event,B[A].handler)}},getShortcut:function(A){return this.config.shortcuts[A]},getShortcuts:function(){return this.config.shortcuts},removeShortcut:function(A){delete this.config.shortcuts[A]},addAutocorrection:function(D,C,A){if(C.exec){var B=C;C=function(E){return E.match(B)}}this.config.autocorrections[D]={"criteria":C,"handler":A}},addAutocorrections:function(B){for(var A=0;A<B.length;A++){this.addAutocorrection(B[A].id,B[A].criteria,B[A].handler)}},getAutocorrection:function(A){return this.config.autocorrection[A]},getAutocorrections:function(){return this.config.autocorrections},removeAutocorrection:function(A){delete this.config.autocorrections[A]},addAutocompletion:function(D,C,A){if(C.exec){var B=C;C=function(F){var E=B.exec(F);return E?E.index:-1}}this.config.autocompletions[D]={"criteria":C,"handler":A}},addAutocompletions:function(B){for(var A=0;A<B.length;A++){this.addAutocompletion(B[A].id,B[A].criteria,B[A].handler)}},getAutocompletion:function(A){return this.config.autocompletions[A]},getAutocompletions:function(){return this.config.autocompletions},removeAutocompletion:function(A){delete this.config.autocompletions[A]},addTemplateProcessor:function(B,A){this.config.templateProcessors[B]={"handler":A}},addTemplateProcessors:function(B){for(var A=0;A<B.length;A++){this.addTemplateProcessor(B[A].id,B[A].handler)}},getTemplateProcessor:function(A){return this.config.templateProcessors[A]},getTemplateProcessors:function(){return this.config.templateProcessors},removeTemplateProcessor:function(A){delete this.config.templateProcessors[A]},addContextMenuHandler:function(B,A){this.config.contextMenuHandlers[B]={"handler":A}},addContextMenuHandlers:function(B){for(var A=0;A<B.length;A++){this.addContextMenuHandler(B[A].id,B[A].handler)}},getContextMenuHandler:function(A){return this.config.contextMenuHandlers[A]},getContextMenuHandlers:function(){return this.config.contextMenuHandlers},removeContextMenuHandler:function(A){delete this.config.contextMenuHandlers[A]},getCurrentEditMode:function(){return this.currentEditMode},toggleSourceAndWysiwygMode:function(){var A=this.getCurrentEditMode();if(A=="readonly"){return }this.setEditMode(A=="wysiwyg"?"source":"wysiwyg");return true},setEditMode:function(B){if(this.currentEditMode==B){return }var A=B!=false&&B!="readonly"&&!this.outmostWrapper;if(A){this._createEditorFrame();this._registerEventHandlers();this.loadCurrentContentFromStaticContent();this.editHistory=new xq.EditHistory(this.rdom)}if(B=="wysiwyg"){if(this.currentEditMode=="source"){this.setStaticContent(this.getSourceContent())}this.loadCurrentContentFromStaticContent();this.contentElement.style.display="none";this.sourceEditorDiv.style.display="none";this.wysiwygEditorDiv.style.display="block";this.outmostWrapper.style.display="block";this.currentEditMode=B;if(!xq.Browser.isTrident){window.setTimeout(function(){if(this.getDoc().designMode=="On"){return }this.getDoc().designMode="On";try{this.getDoc().execCommand("enableInlineTableEditing",false,"false")}catch(C){}}.bind(this),0)}this.enableToolbarButtons();if(!A){this.focus()}}else{if(B=="source"){if(this.currentEditMode=="wysiwyg"){this.setStaticContent(this.getWysiwygContent())}this.loadCurrentContentFromStaticContent();this.contentElement.style.display="none";this.sourceEditorDiv.style.display="block";this.wysiwygEditorDiv.style.display="none";this.outmostWrapper.style.display="block";this.currentEditMode=B;this.disableToolbarButtons(["html"]);if(!A){this.focus()}}else{this.setStaticContent(this.getCurrentContent());this.loadCurrentContentFromStaticContent();this.outmostWrapper.style.display="none";this.contentElement.style.display="block";this.currentEditMode=B}}this._fireOnCurrentEditModeChanged(this,B)},loadStylesheet:function(C){var A=this.editorDoc.getElementsByTagName("HEAD")[0];var B=this.editorDoc.createElement("LINK");B.rel="Stylesheet";B.type="text/css";B.href=C;A.appendChild(B)},loadCurrentContentFromStaticContent:function(){var A=this.validator.invalidate(this.getStaticContentAsDOM());A=this.removeUnnecessarySpaces(A);if(A.blank()){this.rdom.clearRoot()}else{this.rdom.getRoot().innerHTML=A}this.rdom.wrapAllInlineOrTextNodesAs("P",this.rdom.getRoot(),true);var B=this.getWysiwygContent(true,true);this.sourceEditorTextarea.value=B;if(xq.Browser.isWebkit){this.sourceEditorTextarea.innerHTML=B}this._fireOnCurrentContentChanged(this)},enableToolbarButtons:function(A){if(!this.toolbarContainer){return }this._execForAllToolbarButtons(A,function(B,C){B.firstChild.className=!C?"":"disabled"});if(xq.Browser.isIE6){this.toolbarContainer.style.display="none";setTimeout(function(){this.toolbarContainer.style.display="block"}.bind(this),0)}},disableToolbarButtons:function(A){this._execForAllToolbarButtons(A,function(B,C){B.firstChild.className=C?"":"disabled"})},_execForAllToolbarButtons:function(E,A){if(!this.toolbarContainer){return }E=E||[];var B=this.toolbarContainer.getElementsByTagName("LI");for(var D=0;D<B.length;D++){var F=B[D].className.split(" ").find(function(G){return G!="xq_separator"});var C=E.indexOf(F)!=-1;A(B[D],C)}},_updateToolbarButtonStatus:function(C,B){var A=this.toolbarButtons[C];if(A){A.firstChild.firstChild.className=B?"selected":""}},updateAllToolbarButtonsStatus:function(C){if(!this.toolbarContainer){return }if(!this.toolbarButtons){var G=["emphasis","strongEmphasis","underline","strike","superscription","subscription","justifyLeft","justifyCenter","justifyRight","justifyBoth","unorderedList","orderedList","code","paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];this.toolbarButtons={};for(var B=0;B<G.length;B++){var E=xq.getElementsByClassName(this.toolbarContainer,G[B]);var A=E&&E.length>0?E[0]:null;if(A){this.toolbarButtons[G[B]]=A}}}var D=this.toolbarButtons;var F=this.rdom.collectStructureAndStyle(C);this._updateToolbarButtonStatus("emphasis",F.em);this._updateToolbarButtonStatus("strongEmphasis",F.strong);this._updateToolbarButtonStatus("underline",F.underline);this._updateToolbarButtonStatus("strike",F.strike);this._updateToolbarButtonStatus("superscription",F.superscription);this._updateToolbarButtonStatus("subscription",F.subscription);this._updateToolbarButtonStatus("justifyLeft",F.justification=="left");this._updateToolbarButtonStatus("justifyCenter",F.justification=="center");this._updateToolbarButtonStatus("justifyRight",F.justification=="right");this._updateToolbarButtonStatus("justifyBoth",F.justification=="justify");this._updateToolbarButtonStatus("orderedList",F.list=="OL");this._updateToolbarButtonStatus("unorderedList",F.list=="UL");this._updateToolbarButtonStatus("code",F.list=="CODE");this._updateToolbarButtonStatus("paragraph",F.block=="P");this._updateToolbarButtonStatus("heading1",F.block=="H1");this._updateToolbarButtonStatus("heading2",F.block=="H2");this._updateToolbarButtonStatus("heading3",F.block=="H3");this._updateToolbarButtonStatus("heading4",F.block=="H4");this._updateToolbarButtonStatus("heading5",F.block=="H5");this._updateToolbarButtonStatus("heading6",F.block=="H6")},removeUnnecessarySpaces:function(A){var C=this.rdom.tree.getBlockTags().join("|");var B=new RegExp("\\s*<(/?)("+C+")>\\s*","img");return A.replace(B,"<$1$2>")},getCurrentContent:function(A){if(this.getCurrentEditMode()=="source"){return this.getSourceContent(A)}else{return this.getWysiwygContent(A)}},getWysiwygContent:function(A,B){if(B||!A){return this.validator.validate(this.rdom.getRoot(),A)}var C=this.editHistory.getLastModifiedDate();if(this._lastModified!=C){this._validContentCache=this.validator.validate(this.rdom.getRoot(),A);this._lastModified=C}return this._validContentCache},getSourceContent:function(C){var B=this.sourceEditorTextarea[xq.Browser.isWebkit?"innerHTML":"value"];var A=document.createElement("div");A.innerHTML=this.removeUnnecessarySpaces(B);var D=xq.RichDom.createInstance();D.setRoot(document.body);D.wrapAllInlineOrTextNodesAs("P",A,true);return this.validator.validate(A,C)},setStaticContent:function(A){if(this.contentElement.nodeName=="TEXTAREA"){this.contentElement.value=A;if(xq.Browser.isWebkit){this.contentElement.innerHTML=A}}else{this.contentElement.innerHTML=A}this._fireOnStaticContentChanged(this,A)},getStaticContent:function(){var A;if(this.contentElement.nodeName=="TEXTAREA"){A=this.contentElement[xq.Browser.isWebkit?"innerHTML":"value"]}else{A=this.contentElement.innerHTML}return A},getStaticContentAsDOM:function(){if(this.contentElement.nodeName=="TEXTAREA"){var A=this.doc.createElement("DIV");A.innerHTML=this.contentElement[xq.Browser.isWebkit?"innerHTML":"value"];return A}else{return this.contentElement}},focus:function(){if(this.getCurrentEditMode()=="wysiwyg"){this.rdom.focus();window.setTimeout(function(){this.updateAllToolbarButtonsStatus(this.rdom.getCurrentElement())}.bind(this),0)}else{if(this.getCurrentEditMode()=="source"){this.sourceEditorTextarea.focus()}}},getFrame:function(){return this.editorFrame},getWin:function(){return this.editorWin},getDoc:function(){return this.editorDoc},getOutmostWrapper:function(){return this.outmostWrapper},getBody:function(){return this.editorBody},_createEditorFrame:function(){this.outmostWrapper=this.doc.createElement("div");this.outmostWrapper.className="xquared";this.contentElement.parentNode.insertBefore(this.outmostWrapper,this.contentElement);if(!this.toolbarContainer&&this.config.generateDefaultToolbar){this.toolbarContainer=this._generateDefaultToolbar();this.outmostWrapper.appendChild(this.toolbarContainer)}this.sourceEditorDiv=this.doc.createElement("div");this.sourceEditorDiv.className="editor source_editor";this.sourceEditorDiv.style.display="none";this.outmostWrapper.appendChild(this.sourceEditorDiv);this.sourceEditorTextarea=this.doc.createElement("textarea");this.sourceEditorDiv.appendChild(this.sourceEditorTextarea);this.wysiwygEditorDiv=this.doc.createElement("div");this.wysiwygEditorDiv.className="editor wysiwyg_editor";this.wysiwygEditorDiv.style.display="none";this.outmostWrapper.appendChild(this.wysiwygEditorDiv);this.editorFrame=this.doc.createElement("iframe");this.rdom.setAttributes(this.editorFrame,{"frameBorder":"0","marginWidth":"0","marginHeight":"0","leftMargin":"0","topMargin":"0","allowTransparency":"true"});this.wysiwygEditorDiv.appendChild(this.editorFrame);var B=this.editorFrame.contentWindow.document;if(xq.Browser.isTrident){B.designMode="On"}B.open();B.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">");B.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ko\">");B.write("<head>");if(!xq.Browser.isTrident){B.write("<base href=\"./\" />")}B.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />");B.write("<title>XQuared</title>");if(this.config.changeCursorOnLink){B.write("<style>.xed a {cursor: pointer !important;}</style>")}B.write("</head>");B.write("<body><p>"+this.rdom.makePlaceHolderString()+"</p></body>");B.write("</html>");B.close();this.editorWin=this.editorFrame.contentWindow;this.editorDoc=this.editorWin.document;this.editorBody=this.editorDoc.body;this.editorBody.className="xed";if(xq.Browser.isIE6){this.editorDoc.documentElement.style.overflowY="auto";this.editorDoc.documentElement.style.overflowX="hidden"}if(this.config.generateDefaultToolbar){this._addStyleRules([{selector:".xquared div.toolbar",rule:"background-image: url("+this.config.imagePathForDefaultToobar+"toolbarBg.gif)"},{selector:".xquared ul.buttons li",rule:"background-image: url("+this.config.imagePathForDefaultToobar+"toolbarButtonBg.gif)"},{selector:".xquared ul.buttons li.xq_separator",rule:"background-image: url("+this.config.imagePathForDefaultToobar+"toolbarSeparator.gif)"}])}this.rdom.setWin(this.editorWin);this.rdom.setRoot(this.editorBody);this.validator=xq.Validator.createInstance(this.doc.location.href,this.config.urlValidationMode,this.config.allowedTags,this.config.allowedAttributes);if(this.config.automaticallyHookSubmitEvent&&this.contentElement.nodeName=="TEXTAREA"&&this.contentElement.form){var A=this.contentElement.form.onsubmit;this.contentElement.form.onsubmit=function(){this.contentElement.value=this.getCurrentContent(true);if(A){return A()}else{return true}}.bind(this)}},_addStyleRules:function(D){if(!this.dynamicStyle){if(xq.Browser.isTrident){this.dynamicStyle=this.doc.createStyleSheet()}else{var B=this.doc.createElement("style");this.doc.body.appendChild(B);this.dynamicStyle=xq.$A(this.doc.styleSheets).last()}}for(var A=0;A<D.length;A++){var C=D[A];if(xq.Browser.isTrident){this.dynamicStyle.addRule(D[A].selector,D[A].rule)}else{this.dynamicStyle.insertRule(D[A].selector+" {"+D[A].rule+"}",this.dynamicStyle.cssRules.length)}}},_defaultToolbarClickHandler:function(e){var src=e.target||e.srcElement;while(src.nodeName!="A"){src=src.parentNode}if(xq.hasClassName(src.parentNode,"disabled")||xq.hasClassName(this.toolbarContainer,"disabled")){xq.stopEvent(e);return false}if(xq.Browser.isTrident){this.focus()}var handler=src.handler;var xed=this;var stop=(typeof handler=="function")?handler(this):eval(handler);if(stop){xq.stopEvent(e);return false}else{return true}},_generateDefaultToolbar:function(){var B=this.doc.createElement("div");B.className="toolbar";var G=this.doc.createElement("ul");G.className="buttons";B.appendChild(G);var A=this.config.defaultToolbarButtonMap;for(var F=0;F<A.length;F++){for(var D=0;D<A[F].length;D++){var C=A[F][D];var J=this.doc.createElement("li");G.appendChild(J);J.className=C.className;var I=this.doc.createElement("span");J.appendChild(I);var H=this.doc.createElement("a");I.appendChild(H);H.href="#";H.title=C.title;H.handler=C.handler;this._toolbarAnchorsCache.push(H);xq.observe(H,"mousedown",xq.cancelHandler);xq.observe(H,"click",this._defaultToolbarClickHandler.bindAsEventListener(this));

⌨️ 快捷键说明

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