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

📄 xquared-min.js

📁 软件的主要特点: 1.专门针对有"验证码"要求的论坛. 2.可以完成如下功能: 自动发布新帖,自动回复指定帖,自动注册论坛帐号 (所有操作不能同时针对一个网站,因为有"验证码"要求的网站是每次打开一个
💻 JS
📖 第 1 页 / 共 5 页
字号:
var xq={majorVersion:"0.2",minorVersion:"20071205"};xq.Class=function(){var D=null,C=xq.$A(arguments);if(typeof C[0]=="function"){D=C.shift()}function A(){this.initialize.apply(this,arguments)}if(D){for(var B in D.prototype){A.prototype[B]=D.prototype[B]}}for(var B in C[0]){A.prototype[B]=C[0][B]}if(!A.prototype.initialize){A.prototype.initialize=function(){}}A.prototype.constructor=A;return A};xq.observe=function(B,A,C){if(B.addEventListener){B.addEventListener(A,C,false)}else{B.attachEvent("on"+A,C)}B=null};xq.stopObserving=function(B,A,C){if(B.removeEventListener){B.removeEventListener(A,C,false)}else{B.detachEvent("on"+A,C)}B=null};xq.cancelHandler=function(A){xq.stopEvent(A);return false};xq.stopEvent=function(A){if(A.preventDefault){A.preventDefault()}if(A.stopPropagation){A.stopPropagation()}A.returnValue=false;A.cancelBubble=true;A.stopped=true};xq.isButton=function(B,A){return B.which?(B.which===A+1):(B.button===A)};xq.isLeftClick=function(A){return isButton(A,0)};xq.isMiddleClick=function(A){return isButton(A,1)};xq.isRightClick=function(A){return isButton(A,2)};xq.getEventPoint=function(A){return{x:A.pageX||(A.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:A.pageY||(A.clientY+(document.documentElement.scrollTop||document.body.scrollTop))}};xq.getCumulativeOffset=function(A){var C=0,B=0;do{C+=A.offsetTop||0;B+=A.offsetLeft||0;A=A.offsetParent}while(A);return{top:C,left:B}};xq.$=function(A){return document.getElementById(A)};xq.isEmptyHash=function(B){for(var A in B){return false}return true};xq.$A=function(C){var A=C.length,B=new Array(A);while(A--){B[A]=C[A]}return B};xq.hasClassName=function(A,B){var C=A.className;return(C.length>0&&(C==B||new RegExp("(^|\\s)"+B+"(\\s|$)").test(C)))};xq.serializeForm=function(F){try{var J={hash:true};var C={};var A=F.getElementsByTagName("*");for(var D=0;D<A.length;D++){var E=A[D];var B=E.tagName.toLowerCase();if(E.disabled||!E.name||["input","textarea","option","select"].indexOf(B)==-1){continue}var I=E.name;var H=xq.getValueOfElement(E);if(H===undefined){continue}if(I in C){if(C[I].constructor==Array){C[I]=[C[I]]}C[I].push(H)}else{C[I]=H}}return C}catch(G){alert(G)}};xq.getValueOfElement=function(B){var A=B.type.toLowerCase();if(A=="checkbox"||A=="radio"){return B.checked?B.value:undefined}return B.value};xq.getElementsByClassName=function(D,E){if(D.getElementsByClassName){return D.getElementsByClassName(E)}var F=D.getElementsByTagName("*");var B=F.length;var A=[];var G=new RegExp("(^|\\s)"+E+"($|\\s)");for(var C=0;C<B;C++){var H=F[C];if(G.test(H.className)){A.push(H)}}return A};try{Prototype.version;__prototype=true}catch(ignored){__prototype=false}if(!__prototype){if(!Function.prototype.bind){Function.prototype.bind=function(){var B=this,A=xq.$A(arguments),C=A.shift();return function(){return B.apply(C,A.concat(xq.$A(arguments)))}}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(){var B=this,A=xq.$A(arguments),C=A.shift();return function(D){return B.apply(C,[D||window.event].concat(A))}}}Array.prototype.find=function(B){for(var A=0;A<this.length;A++){if(B(this[A])){return this[A]}}};Array.prototype.findAll=function(C){var A=[];for(var B=0;B<this.length;B++){if(C(this[B])){A.push(this[B])}}return A};Array.prototype.first=function(){return this[0]};Array.prototype.last=function(){return this[this.length-1]};Array.prototype.include=function(C){if(this.indexOf(C)!=-1){return true}var B=false;for(var A=0;A<this.length;A++){if(this[A]==C){return true}}return false};Array.prototype.flatten=function(){var A=[];var B=function(D){for(var C=0;C<D.length;C++){if(D[C].constructor===Array){B(D[C])}else{A.push(D[C])}}};B(this);return A};String.prototype.blank=function(){return/^\s*$/.test(this)};String.prototype.stripTags=function(){return this.replace(/<\/?[^>]+>/gi,"")};String.prototype.escapeHTML=function(){xq._text.data=this;return xq._div.innerHTML};xq._text=document.createTextNode("");xq._div=document.createElement("div");xq._div.appendChild(xq._text);String.prototype.strip=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")};Array.prototype.indexOf=function(B){for(var A=0;A<this.length;A++){if(this[A]==B){return A}}return -1}}xq.asEventSource=function(A,D,C){A._listeners=[];A._registerEventFirer=function(F,E){this["_fireOn"+E]=function(){for(var G=0;G<this._listeners.length;G++){var I=this._listeners[G];var H=I["on"+F+E];if(H){H.apply(I,xq.$A(arguments))}}}};A.addListener=function(E){this._listeners.push(E)};for(var B=0;B<C.length;B++){A._registerEventFirer(D,C[B])}};Date.preset=null;Date.pass=function(A){if(Date.preset==null){return }Date.preset=new Date(Date.preset.getTime()+A)};Date.get=function(){return Date.preset==null?new Date():Date.preset};Date.prototype.elapsed=function(A){return Date.get().getTime()-this.getTime()>=A};String.prototype.merge=function(B){var A=this;for(k in B){A=A.replace("{"+k+"}",B[k])}return A};String.prototype.parseURL=function(){var E=this.match(/((((\w+):\/\/(((([^@:]+)(:([^@]+))?)@)?([^:\/\?#]+)?(:(\d+))?))?([^\?#]+)?)(\?([^#]+))?)(#(.+))?/);var D=E[0];var B=E[1]||undefined;var M=E[2]||undefined;var L=E[3]||undefined;var A=null;var N=E[4]||undefined;var G=E[8]||undefined;var K=E[10]||undefined;var F=E[11]||undefined;var C=E[13]||undefined;var O=E[14]||undefined;var J=E[16]||undefined;var H=E[18]||undefined;if(!O||O=="/"){A=L+"/"}else{var I=O.lastIndexOf("/");A=L+O.substring(0,I+1)}return{includeAnchor:D,includeQuery:B,includePath:M,includeBase:A,includeHost:L,protocol:N,user:G,password:K,domain:F,port:C,path:O,query:J,anchor:H}};xq.autoFinalizeQueue=[];xq.addToFinalizeQueue=function(A){xq.autoFinalizeQueue.push(A)};xq.finalize=function(B){if(typeof B.finalize=="function"){try{B.finalize()}catch(A){}}for(key in B){B[key]=null}};xq.observe(window,"unload",function(){for(var A=0;A<xq.autoFinalizeQueue.length;A++){xq.finalize(xq.autoFinalizeQueue[A])}xq=null});xq.findXquaredScript=function(){return xq.$A(document.getElementsByTagName("script")).find(function(A){return A.src&&A.src.match(/xquared\.js/i)})};xq.shouldLoadOthers=function(){var A=xq.findXquaredScript();return A&&!!A.src.match(/xquared\.js\?load_others=1/i)};xq.loadScript=function(A){document.write("<script type=\"text/javascript\" src=\""+A+"\"></script>")};xq.loadOthers=function(){var A=xq.findXquaredScript();var D=A.src.match(/(.*\/)xquared\.js.*/i)[1];var C=["Editor.js","Browser.js","Shortcut.js","DomTree.js","RichDom.js","RichDomW3.js","RichDomGecko.js","RichDomWebkit.js","RichDomTrident.js","RichTable.js","Validator.js","ValidatorW3.js","ValidatorGecko.js","ValidatorWebkit.js","ValidatorTrident.js","EditHistory.js","Controls.js","_ui_templates.js"];for(var B=0;B<C.length;B++){xq.loadScript(D+C[B])}};if(xq.shouldLoadOthers()){xq.loadOthers()}xq.Editor=xq.Class({initialize:function(B,A){xq.addToFinalizeQueue(this);if(typeof B=="string"){B=xq.$(B)}if(!B){throw"[contentElement] is null"}if(B.nodeType!=1){throw"[contentElement] is not an element"}if(typeof A=="string"){A=xq.$(A)}xq.asEventSource(this,"Editor",["ElementChanged","BeforeEvent","AfterEvent","CurrentContentChanged","StaticContentChanged","CurrentEditModeChanged"]);this.config={};this.config.enableLinkClick=false;this.config.changeCursorOnLink=false;this.config.generateDefaultToolbar=true;this.config.defaultToolbarButtonMap=[[{className:"foregroundColor",title:"Foreground color",handler:"xed.handleForegroundColor()"},{className:"backgroundColor",title:"Background color",handler:"xed.handleBackgroundColor()"}],[{className:"link",title:"Link",handler:"xed.handleLink()"},{className:"strongEmphasis",title:"Strong emphasis",handler:"xed.handleStrongEmphasis()"},{className:"emphasis",title:"Emphasis",handler:"xed.handleEmphasis()"},{className:"underline",title:"Underline",handler:"xed.handleUnderline()"},{className:"strike",title:"Strike",handler:"xed.handleStrike()"},{className:"superscription",title:"Superscription",handler:"xed.handleSuperscription()"},{className:"subscription",title:"Subscription",handler:"xed.handleSubscription()"}],[{className:"removeFormat",title:"Remove format",handler:"xed.handleRemoveFormat()"}],[{className:"justifyLeft",title:"Justify left",handler:"xed.handleJustify('left')"},{className:"justifyCenter",title:"Justify center",handler:"xed.handleJustify('center')"},{className:"justifyRight",title:"Justify right",handler:"xed.handleJustify('right')"},{className:"justifyBoth",title:"Justify both",handler:"xed.handleJustify('both')"}],[{className:"indent",title:"Indent",handler:"xed.handleIndent()"},{className:"outdent",title:"Outdent",handler:"xed.handleOutdent()"}],[{className:"unorderedList",title:"Unordered list",handler:"xed.handleList('UL')"},{className:"orderedList",title:"Ordered list",handler:"xed.handleList('OL')"}],[{className:"paragraph",title:"Paragraph",handler:"xed.handleApplyBlock('P')"},{className:"heading1",title:"Heading 1",handler:"xed.handleApplyBlock('H1')"},{className:"blockquote",title:"Blockquote",handler:"xed.handleApplyBlock('BLOCKQUOTE')"},{className:"code",title:"Code",handler:"xed.handleList('CODE')"},{className:"division",title:"Division",handler:"xed.handleApplyBlock('DIV')"}],[{className:"table",title:"Table",handler:"xed.handleTable(3,3,'tl')"},{className:"separator",title:"Separator",handler:"xed.handleSeparator()"}],[{className:"html",title:"Edit source",handler:"xed.toggleSourceAndWysiwygMode()"}],[{className:"undo",title:"Undo",handler:"xed.handleUndo()"},{className:"redo",title:"Redo",handler:"xed.handleRedo()"}]];this.config.imagePathForDefaultToobar="img/toolbar/";this.config.imagePathForContent="img/content/";this.config.urlValidationMode="absolute";this.config.automaticallyHookSubmitEvent=true;this.config.allowedTags=["a","abbr","acronym","address","blockquote","br","caption","cite","code","dd","dfn","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","img","kbd","li","ol","p","pre","q","samp","span","sup","sub","strong","table","thead","tbody","td","th","tr","ul","var"];this.config.allowedAttributes=["alt","cite","class","datetime","height","href","id","rel","rev","src","style","title","width"];this.config.shortcuts={};this.config.autocorrections={};this.config.autocompletions={};this.config.templateProcessors={};this.config.contextMenuHandlers={};this.contentElement=B;this.doc=this.contentElement.ownerDocument;this.body=this.doc.body;this.currentEditMode="readonly";this.rdom=xq.RichDom.createInstance();this.validator=null;this.outmostWrapper=null;this.sourceEditorDiv=null;this.sourceEditorTextarea=null;this.wysiwygEditorDiv=null;this.editorFrame=null;this.editorWin=null;this.editorDoc=null;this.editorBody=null;this.toolbarContainer=A;this.toolbarButtons=null;this._toolbarAnchorsCache=[];this.editHistory=null;this._contextMenuContainer=null;this._contextMenuItems=null;this._validContentCache=null;this._lastModified=null;this.addShortcuts(this._getDefaultShortcuts());this.addTemplateProcessors(this._getDefaultTemplateProcessors());this.addListener({onEditorCurrentContentChanged:function(D){var C=D.rdom.getCurrentElement();if(!C){return }if(D._lastFocusElement!=C){if(!D.rdom.tree.isBlockOnlyContainer(D._lastFocusElement)&&D.rdom.tree.isBlock(D._lastFocusElement)){D.rdom.removeTrailingWhitespace(D._lastFocusElement)}D._fireOnElementChanged(D._lastFocusElement,C);D._lastFocusElement=C}D.updateAllToolbarButtonsStatus(C)}})},finalize:function(){for(var A=0;A<this._toolbarAnchorsCache.length;A++){this._toolbarAnchorsCache[A].xed=null;this._toolbarAnchorsCache[A].handler=null;this._toolbarAnchorsCache[A]=null}this._toolbarAnchorsCache=null},_getDefaultShortcuts:function(){if(xq.Browser.isMac){return[{event:"Ctrl+Shift+SPACE",handler:"this.handleAutocompletion(); stop = true;"},{event:"ENTER",handler:"this.handleEnter(false, false)"},{event:"Ctrl+ENTER",handler:"this.handleEnter(true, false)"},{event:"Ctrl+Shift+ENTER",handler:"this.handleEnter(true, true)"},{event:"TAB",handler:"this.handleTab()"},{event:"Shift+TAB",handler:"this.handleShiftTab()"},{event:"DELETE",handler:"this.handleDelete()"},{event:"BACKSPACE",handler:"this.handleBackspace()"},{event:"Ctrl+B",handler:"this.handleStrongEmphasis()"},{event:"Ctrl+I",handler:"this.handleEmphasis()"},{event:"Ctrl+U",handler:"this.handleUnderline()"},{event:"Ctrl+K",handler:"this.handleStrike()"},{event:"Meta+Z",handler:"this.handleUndo()"},{event:"Meta+Shift+Z",handler:"this.handleRedo()"},{event:"Meta+Y",handler:"this.handleRedo()"}]}else{if(xq.Browser.isUbuntu){return[{event:"Ctrl+SPACE",handler:"this.handleAutocompletion(); stop = true;"},{event:"ENTER",handler:"this.handleEnter(false, false)"},{event:"Ctrl+ENTER",handler:"this.handleEnter(true, false)"},{event:"Ctrl+Shift+ENTER",handler:"this.handleEnter(true, true)"},{event:"TAB",handler:"this.handleTab()"},{event:"Shift+TAB",handler:"this.handleShiftTab()"},{event:"DELETE",handler:"this.handleDelete()"},{event:"BACKSPACE",handler:"this.handleBackspace()"},{event:"Ctrl+B",handler:"this.handleStrongEmphasis()"},{event:"Ctrl+I",handler:"this.handleEmphasis()"},{event:"Ctrl+U",handler:"this.handleUnderline()"},{event:"Ctrl+K",handler:"this.handleStrike()"},{event:"Ctrl+Z",handler:"this.handleUndo()"},{event:"Ctrl+Y",handler:"this.handleRedo()"}]}else{return[{event:"Ctrl+SPACE",handler:"this.handleAutocompletion(); stop = true;"},{event:"ENTER",handler:"this.handleEnter(false, false)"},{event:"Ctrl+ENTER",handler:"this.handleEnter(true, false)"},{event:"Ctrl+Shift+ENTER",handler:"this.handleEnter(true, true)"},{event:"TAB",handler:"this.handleTab()"},{event:"Shift+TAB",handler:"this.handleShiftTab()"},{event:"DELETE",handler:"this.handleDelete()"},{event:"BACKSPACE",handler:"this.handleBackspace()"},{event:"Ctrl+B",handler:"this.handleStrongEmphasis()"},{event:"Ctrl+I",handler:"this.handleEmphasis()"},{event:"Ctrl+U",handler:"this.handleUnderline()"},{event:"Ctrl+K",handler:"this.handleStrike()"},{event:"Ctrl+Z",handler:"this.handleUndo()"},{event:"Ctrl+Y",handler:"this.handleRedo()"}]

⌨️ 快捷键说明

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