├── screenshot.png ├── orphus-ru.js ├── original ├── orphus-orig.css ├── README.md ├── orphus-orig-min.js ├── orphus.js ├── orphus-orig.js └── orphus-orig-renamed.js ├── orphus.php ├── README.md ├── orphus-min.js ├── orphus-min.js.map ├── LICENSE └── orphus.js /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgerXP/Orphus/HEAD/screenshot.png -------------------------------------------------------------------------------- /orphus-ru.js: -------------------------------------------------------------------------------- 1 | orphus.strings = { 2 | alt: 'Выделите орфографическую ошибку мышью и нажмите Ctrl+Enter. Сделаем наши тексты чище!', 3 | badbrowser: 'Ваш браузер не поддерживает возможность перехвата выделенного текста или IFRAME. Возможно, он слишком старый, а, может быть, произошла какая-нибудь другая ошибка.', 4 | toobig: 'Вы выбрали слишком большой фрагмент текста.', 5 | subject: 'Сообщение от Orphus', 6 | intextmsg: 'Орфографическая ошибка в этом фрагменте:', 7 | ifsendmsg: 'Послать сообщение об ошибке авторам? Ваш браузер останется на этой же странице.', 8 | gohome: 'Или, может, вы хотите посетить домашнюю страницу Orphus (в новой вкладке)?', 9 | author: 'Дмитрий Котеров и Proger_XP', 10 | send: 'Отправить', 11 | cancel: 'Отмена', 12 | entercmnt: 'Ваш комментарий (необязательно):', 13 | submitex: 'Проблема при отправке сообщения:' 14 | } 15 | -------------------------------------------------------------------------------- /original/orphus-orig.css: -------------------------------------------------------------------------------- 1 | #orphusp { 2 | background: #D4D0C8; 3 | z-index: 10001; 4 | border: 1px solid #555; 5 | padding: 1em; 6 | font-family: Arial; 7 | font-size: 90%; 8 | color: black; 9 | } 10 | 11 | #orphusp img, 12 | #orphusp .logo { /* now .logo */ 13 | float: right; 14 | margin: 0 0 1em 1em; 15 | border: 0; 16 | } 17 | 18 | #orphusp > a + div { /* now .legend */ 19 | font-weight: bold; 20 | padding-bottom: 0.2em; 21 | } 22 | 23 | #orphusp > a + div + div { /*now .fragment */ 24 | padding: 0 0 1em 1em; 25 | } 26 | 27 | #orphusp u, 28 | #orphusp mark { /* now */ 29 | color: red; 30 | } 31 | 32 | #orphusp > a + div + div + div { /* now .hint */ 33 | padding: 0 0 1em 0; 34 | } 35 | 36 | #orphusp form { 37 | padding: 0; 38 | margin: 0; 39 | border: 0; 40 | } 41 | 42 | #orphusp [type="text"] { 43 | width: 100%; 44 | margin: 0.2em 0; 45 | } 46 | 47 | #orphusp form input + div { /* now .buttons */ 48 | text-align: right; 49 | font-family: Tahoma; 50 | } 51 | 52 | #orphusp [type="submit"] { 53 | width: 9em; 54 | font-weight: bold; 55 | } 56 | 57 | #orphusp [type="button"] { 58 | width: 9em; 59 | } 60 | -------------------------------------------------------------------------------- /original/README.md: -------------------------------------------------------------------------------- 1 | These are the original files and their light adaptations: 2 | 3 | - `orphus-orig-min.js` - the latest author's version as obtained from [this page](http://www.orphus.ru/en/orphus.js?nodownload&email=!rohpsud@lkbar.u), verbatim 4 | - `orphus-orig.js` - ...pretty-printed version using Chrome, no other changes 5 | - `orphus-orig-renamed.js` - ...with obfuscated identifiers renamed to match `orphus.js` 6 | - `orphus-orig.css` - original styles extracted from `self.css()` 7 | - `orphus.js` - my adaptation (see below for differences) 8 | 9 | ## Differences 10 | 11 | - added `/*!...*/` on top 12 | - version changed from `5.01` to `6.0` 13 | - all option variables wrapped into `opt` (object) 14 | - added options: `action` (for `
`), `width` (for `
`) 15 | - rewritten English `strings`, removed `thanks`, `docmsg`, `newwin` (appended directly to `gohome`, removed from `run()`) 16 | - renamed `css()` to `showMethod()` 17 | - removed unused variables: `_a`, `_53` 18 | - removed dependency on the logo image: `setTimeout()` in `run()`, `_15()`, `_16()` (moved to `show()`), `` in `#orphusp`, checks in `show()` 19 | - removed `_18()` used to update `window.status` ([no longer works](https://developer.mozilla.org/en-US/docs/Web/API/Window/status)) 20 | - removed unused `_10.confirm()` (probably was meant for calling by changing `showMethod` from `"css"` to `"confirm"`) 21 | - removed hardcoded CSS styles (`style="..."`, except for `width`, `left`, `top`), instead added a single `id="orphusp"` to the main `
` 22 | - added CSS classes: `logo`, `legend`, `fragment`, `hint`, `buttons` 23 | - replaced `` with a more semantic `` 24 | - made tags HTML5 rather than XHTML 25 | - moved wrapping `try`/`catch` from `getSelection()` to its call in `show()` 26 | - removed checks for `!email` (blankness) and `Netscape < 5` 27 | - removed `with { ... }` 28 | - added `"use strict";` 29 | - minor stylistic changes 30 | -------------------------------------------------------------------------------- /orphus.php: -------------------------------------------------------------------------------- 1 | . 13 | 14 | If ./orphus.log exists and is writable then reports are appended there 15 | in addition to using $mail(). 16 | 17 | POST: 18 | - c_pos = -1 19 | - c_pre = text - required 20 | - c_sel = text - required 21 | - c_suf = text - required 22 | - c_tag1 = 23 | - c_tag2 = 24 | - charset = UTF-8 - required 25 | - comment = user-supplied 26 | - email = web@master - required but ignored by default 27 | - ref = https://url - required 28 | - subject = Mail subject 29 | - to = Webmaster - ignored by default 30 | - version = 5.01 - 6.0 for this adaptation 31 | */ 32 | 33 | function errorFinish($e = null) { 34 | global $strings; 35 | headers_sent() or http_response_code(400); 36 | echo '-->'; 124 | exit; 125 | } 126 | } 127 | 128 | errorFinish(); 129 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Orphus.js - A Tiny Typo Reporter 2 | 3 | Orphus is a tiny zero-configuration typo reporter for web pages. 4 | 5 | - 6K minified, 2K gzipped, no dependencies 6 | - invoked by Ctrl+Enter 7 | - reports arriving by e-mail (by default) 8 | - CORS-friendly (no AJAX, using `',d.addOffScreen(t)},d.submit=function(e,t,n){var o="orphus_ifr";d.iframe=d.iframe||d.createIFrame(o);var r=document.createElement("FORM");r.action=d.opt.action,r.method="post",r.target=o;var i={version:d.opt.version,email:d.deobfuscate(d.opt.email),to:d.opt.strings.to,subject:d.opt.strings.subject,ref:e,c_pre:t.pre,c_sel:t.text,c_suf:t.suf,c_pos:t.pos,c_tag1:d.opt.c_tag1,c_tag2:d.opt.c_tag2,charset:document.charset||document.characterSet||"",comment:n};for(var o in i){var s=document.createElement("INPUT");s.type="hidden",s.name=o,s.value=i[o],r.appendChild(s)}d.addOffScreen(r),r.submit(),r.parentNode.removeChild(r)},d.windowInfo=function(){var e=0,t=0;"number"==typeof window.innerWidth?(e=window.innerWidth,t=window.innerHeight):r&&(r.clientWidth||r.clientHeight)?(e=r.clientWidth,t=r.clientHeight):m&&(m.clientWidth||m.clientHeight)&&(e=m.clientWidth,t=m.clientHeight);var n=0,o=0;return"number"==typeof window.pageYOffset?(o=window.pageYOffset,n=window.pageXOffset):m&&(m.scrollLeft||m.scrollTop)?(o=m.scrollTop,n=m.scrollLeft):r&&(r.scrollLeft||r.scrollTop)&&(o=r.scrollTop,n=r.scrollLeft),{width:e,height:t,scrollLeft:n,scrollTop:o}},d.showFor=function(e,i){if(!d.submitted){d.submitted=!0;var s=document.createElement("DIV"),t=Math.min(d.opt.maxWidth,m.clientWidth);s.innerHTML='
'+d.opt.strings.intextmsg+'
'+e.replace(d.opt.c_tag1,"").replace(d.opt.c_tag2,"")+'
'+d.opt.strings.ifsendmsg.replace(/\r?\n/,"
")+'
'+d.opt.strings.entercmnt+'
 
',d.addOffScreen(s);var a=s.getElementsByTagName("input"),c=s.getElementsByTagName("form"),l=a[0],u=null,p=function(){document.onkeydown=u,u=null,s.parentNode.removeChild(s),d.submitted=!1,d.lastComment=l.value};setTimeout(function(){var e=s.clientWidth,t=s.clientHeight,n=d.windowInfo(),o=(n.width-e)/2+n.scrollLeft,r=(n.height-t)/2+n.scrollTop;s.style.left=o+"px",s.style.top=r+"px",l.value=d.lastComment,l.focus(),l.select(),u=document.onkeydown,document.onkeydown=function(e){27==(e=e||window.event).keyCode&&p()},c[0].onsubmit=function(){try{i(l.value)}catch(e){alert(d.opt.strings.submitex+"\n\n"+e)}return p(),d.lastComment="",!1},a[2].onclick=p},10)}},d.cleanString=function(e){return(""+e).replace(/[\r\n]+/g," ").replace(/^\s+|\s+$/g,"")},d.getSelection=function(){var e=null;if(null==(e=window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection))throw"null getSelection()";var t,n="",o=null,r="";if(e.getRangeAt){if(!e.rangeCount)return;o=(i=e.getRangeAt(0)).toString(),(s=document.createRange()).setStartBefore(i.startContainer.ownerDocument.body),s.setEnd(i.startContainer,i.startOffset),n=s.toString(),(s=i.cloneRange()).setStart(i.endContainer,i.endOffset),s.setEndAfter(i.endContainer.ownerDocument.body),r=s.toString()}else if(e.createRange){var i,s;o=(i=e.createRange()).text,(s=e.createRange()).moveStart("character",-d.opt.contextLength),s.moveEnd("character",-o.length),n=s.text,(s=e.createRange()).moveEnd("character",d.opt.contextLength),s.moveStart("character",o.length),r=s.text}else o=""+e;var a=(t=o.match(/^(\s*)/))&&t[0].length,c=(t=o.match(/(\s*)$/))&&t[0].length;if(n+=o.substring(0,a),r=o.substring(o.length-c,o.length)+r,""!=(o=o.substring(a,o.length-c)))return{pre:n,text:o,suf:r,pos:-1}},d.show=function(){try{var t=d.getSelection()}catch(e){return void alert(d.opt.strings.badbrowser)}if(t){t.pre=t.pre.substring(t.pre.length-d.opt.contextLength,t.pre.length).replace(/^\S{1,10}\s+/,""),t.suf=t.suf.substring(0,d.opt.contextLength).replace(/\s+\S{1,10}$/,"");var e=d.cleanString(t.pre+d.opt.c_tag1+t.text+d.opt.c_tag2+t.suf);e.length>d.opt.maxSelection?alert(d.opt.strings.toobig):d.showFor(e,function(e){d.submit(document.location.href,t,e)})}else{var n=[d.opt.strings.name+" v"+d.opt.version,d.opt.strings.author,"",d.opt.strings.alt,"",d.opt.strings.gohome];confirm(n.join("\n"))&&window.open(d.opt.homepage,"_blank")}},d.onkeypress=function(e){var t=!1,n=window.event;if(n?t=10==n.keyCode||13==n.keyCode&&n.ctrlKey:e&&(t=10==e.which&&2==e.modifiers||0==e.keyCode&&106==e.charCode&&e.ctrlKey||13==e.keyCode&&e.ctrlKey),t)return d.show(),!1},d.run()}(); -------------------------------------------------------------------------------- /orphus-min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["orphus.js"],"names":["user","window","orphus","self","opt","version","email","homepage","c_tag1","c_tag2","contextLength","maxSelection","action","maxWidth","strings","alt","badbrowser","toobig","subject","intextmsg","ifsendmsg","gohome","name","author","to","send","cancel","entercmnt","submitex","assign","dest","src","k","docEl","document","documentElement","body","iframe","submitted","lastComment","deobfuscate","s","substr","replace","run","onkeypress","addOffScreen","node","style","position","top","lastChild","insertBefore","appendChild","createIFrame","div","createElement","innerHTML","submit","refURL","sel","comment","form","method","target","query","ref","c_pre","pre","c_sel","text","c_suf","suf","c_pos","pos","charset","characterSet","input","type","value","parentNode","removeChild","windowInfo","width","height","innerWidth","innerHeight","clientWidth","clientHeight","scrollLeft","scrollTop","pageYOffset","pageXOffset","showFor","context","Math","min","inputs","getElementsByTagName","forms","commentInput","origOnKeyDown","end","onkeydown","setTimeout","divWidth","divHeight","win","x","y","left","focus","select","e","event","keyCode","onsubmit","alert","onclick","cleanString","getSelection","docSel","selection","p","getRangeAt","rangeCount","range","toString","newRange","createRange","setStartBefore","startContainer","ownerDocument","setEnd","startOffset","cloneRange","setStart","endContainer","endOffset","setEndAfter","moveStart","moveEnd","length","match","substring","show","location","href","msg","confirm","join","open","handle","we","ctrlKey","which","modifiers","charCode"],"mappings":";CAEC,WACC,aAEA,IAAIA,EAAOC,OAAOC,QAAU,GACxBC,EAAOF,OAAOC,OAAS,GAE3BC,EAAKC,IAAM,CACTC,QAAgB,MAGhBC,MAAgB,GAChBC,SAAgB,qCAChBC,OAAgB,QAChBC,OAAgB,QAChBC,cAAgB,GAChBC,aAAgB,IAChBC,OAAgB,cAChBC,SAAgB,IAChBC,QAAgB,CACdC,IAAc,yEACdC,WAAc,+GACdC,OAAc,gEACdC,QAAc,gBACdC,UAAc,kCACdC,UAAc,6DACdC,OAAc,oEACdC,KAAc,SACdC,OAAc,gCACdC,GAAc,YACdC,KAAc,SACdC,OAAc,SACdC,UAAc,2BACdC,SAAc,+BAIlB,IAAIC,EAAS,SAAUC,EAAMC,GAC3B,IAAK,IAAIC,KAAKD,EACH,WAALC,EACFH,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GC,QAC5CzC,IACTuC,EAAqB,IAAXvC,EAAE0C,OAA8B,GAAf1C,EAAE2C,WACN,GAAb3C,EAAEE,SAA8B,KAAdF,EAAE4C,UAAmB5C,EAAEyC,SAC5B,IAAbzC,EAAEE,SAAiBF,EAAEyC,SAG7BF,EAEF,OADArJ,EAAK8I,QACE,GAIX9I,EAAKyC,MArWN"} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /original/orphus-orig-min.js: -------------------------------------------------------------------------------- 1 | (function(){var _1="5.01"; 2 | var _2="!rohpsud@lkbar.u"; 3 | var hq="//www.orphus.ru/en/"; 4 | var _4=""; 5 | var _5=""; 6 | var _6=60; 7 | var _7=256; 8 | var _8={// English (English) 9 | alt: "Select spelling error with mouse and press Ctrl+Enter. Let's make the language clean!", 10 | badbrowser: "Your browser does not support selection handling or IFRAMEs. Probably, you use an obsolete browser.", 11 | toobig: "You have selected too large text block!", 12 | thanks: "Thank you for your co-operation!", 13 | subject: "Spelling error", 14 | docmsg: "Document:", 15 | intextmsg: "Spelling error in text:", 16 | ifsendmsg: "Do you want to send a notice to a webmaster?\nYour browser will NOT be redirected.", 17 | gohome: "Do you want to visit Orphus homepage now?", 18 | newwin: "Page will be opened in a new window.", 19 | name: "Orphus system", 20 | author: "Author: Dmitry Koterov.", 21 | to: "Orphus user", 22 | // 5.0 23 | send: "Send", 24 | cancel: "Cancel", 25 | entercmnt: "A comment for a webmaster (optional):" 26 | // Dmitry Koterov 27 | 28 | }; 29 | var _9="css"; 30 | var _a=0; 31 | var w=window; 32 | var d=w.document; 33 | var de=d.documentElement; 34 | var b=d.body; 35 | var _f=null; 36 | var _10={}; 37 | var _11=false; 38 | var _12=""; 39 | var _13=function(){if(_2.substr(0,1)=="!"){_2=_2.substr(1).replace(/(.)(.)/g,"$2$1");}setTimeout(function(){var _14=_15(); 40 | if(_14){_14.onclick=_16; 41 | _14.title=_14.childNodes[0]&&_14.childNodes[0].alt;}},100); 42 | d.onkeypress=_17; 43 | _8.gohome+=" "+_8.newwin;}; 44 | var _15=function(){return d.getElementById("orphus");}; 45 | var _16=function(){with(_8){if(confirm(name+" v"+_1+".\n"+author+"\n\n"+alt+"\n\n"+gohome)){w.open(hq,"_blank");}return false;}}; 46 | var _18=function(){var n=0; 47 | var _1a=function(){if(++n>20){return;}w.status=(n%5)?_8.thanks:" "; 48 | setTimeout(_1a,100);}; 49 | _1a();}; 50 | var _1b=function(e){e.style.position="absolute"; 51 | e.style.top="-10000px"; 52 | if(b.lastChild){b.insertBefore(e,b.lastChild);}else{b.appendChild(e);}}; 53 | var _1d=function(_1e){var div=d.createElement("DIV"); 54 | div.innerHTML=""; 55 | _1b(div); 56 | return d.childNodes[0];}; 57 | var _20=function(url,_22,_23){var _24="orphus_ifr"; 58 | if(!_f){_f=_1d(_24);}var f=d.createElement("FORM"); 59 | f.style.position="absolute"; 60 | f.style.top="-10000px"; 61 | f.action=hq; 62 | f.method="post"; 63 | f.target=_24; 64 | var _26={version:_1,email:_2,to:_8.to,subject:_8.subject,ref:url,c_pre:_22.pre,c_sel:_22.text,c_suf:_22.suf,c_pos:_22.pos,c_tag1:_4,c_tag2:_5,charset:d.charset||d.characterSet||"",comment:_23}; 65 | for(var k in _26){var h=d.createElement("INPUT"); 66 | h.type="hidden"; 67 | h.name=k; 68 | h.value=_26[k]; 69 | f.appendChild(h);}_1b(f); 70 | f.submit(); 71 | f.parentNode.removeChild(f);}; 72 | var _29=function(){var _2a=0,_2b=0; 73 | if(typeof (w.innerWidth)=="number"){_2a=w.innerWidth; 74 | _2b=w.innerHeight;}else{if(de&&(de.clientWidth||de.clientHeight)){_2a=de.clientWidth; 75 | _2b=de.clientHeight;}else{if(b&&(b.clientWidth||b.clientHeight)){_2a=b.clientWidth; 76 | _2b=b.clientHeight;}}}var _2c=0,_2d=0; 77 | if(typeof (w.pageYOffset)=="number"){_2d=w.pageYOffset; 78 | _2c=w.pageXOffset;}else{if(b&&(b.scrollLeft||b.scrollTop)){_2d=b.scrollTop; 79 | _2c=b.scrollLeft;}else{if(de&&(de.scrollLeft||de.scrollTop)){_2d=de.scrollTop; 80 | _2c=de.scrollLeft;}}}return {w:_2a,h:_2b,x:_2c,y:_2d};}; 81 | _10.confirm=function(_2e,_2f,_30){var ts=new Date().getTime(); 82 | var _32=confirm(_8.docmsg+"\n "+d.location.href+"\n"+_8.intextmsg+"\n \""+_2e+"\"\n\n"+_8.ifsendmsg); 83 | var dt=new Date().getTime()-ts; 84 | if(_32){_2f("");}else{if(!_30&&dt<50){var sv=d.onkeyup; 85 | d.onkeyup=function(e){if(!e){e=window.event;}if(e.keyCode==17){d.onkeyup=sv; 86 | _10.confirm(_2e,_2f,true);}};}}}; 87 | _10.css=function(_36,_37){if(_11){return;}_11=true; 88 | var div=d.createElement("DIV"); 89 | var w=550; 90 | if(w>b.clientWidth-10){w=b.clientWidth-10;}div.style.zIndex="10001"; 91 | div.innerHTML=""+"
"+""+"
"+_8.intextmsg+"
"+"
"+_36.replace(_4,"").replace(_5,"")+"
"+"
"+_8.ifsendmsg.replace(/\n/,"
")+"
"+"
"+"
"+_8.entercmnt+"
"+""+"
"+" "+""+"
"+"
"+"
"+""; 92 | _1b(div); 93 | var _3a=div.getElementsByTagName("input"); 94 | var _3b=div.getElementsByTagName("form"); 95 | var t=_3a[0]; 96 | var _3d=null; 97 | var _3e=[]; 98 | var _3f=function(){d.onkeydown=_3d; 99 | _3d=null; 100 | div.parentNode.removeChild(div); 101 | for(var i=0;i<_3e.length;i++){_3e[i][0].style.visibility=_3e[i][1];}_11=false; 102 | _12=t.value;}; 103 | var pos=function(p){var s={x:0,y:0}; 104 | while(p.offsetParent){s.x+=p.offsetLeft; 105 | s.y+=p.offsetTop; 106 | p=p.offsetParent;}return s;}; 107 | setTimeout(function(){var w=div.clientWidth; 108 | var h=div.clientHeight; 109 | var dim=_29(); 110 | var x=(dim.w-w)/2+dim.x; 111 | if(x<10){x=10;}var y=(dim.h-h)/2+dim.y-10; 112 | if(y<10){y=10;}div.style.left=x+"px"; 113 | div.style.top=y+"px"; 114 | if(navigator.userAgent.match(/MSIE (\d+)/)&&RegExp.$1<7){var _49=d.getElementsByTagName("SELECT"); 115 | for(var i=0;i<_49.length;i++){var s=_49[i]; 116 | var p=pos(s); 117 | if(p.x>x+w||p.y>y+h||p.x+s.offsetWidth_7){alert(_8.toobig); 174 | return;}_10[_9](_64,function(_65){_20(d.location.href,_63,_65); 175 | _18();});}; 176 | var _17=function(e){var _67=0; 177 | var we=w.event; 178 | if(we){_67=we.keyCode==10||(we.keyCode==13&&we.ctrlKey);}else{if(e){_67=(e.which==10&&e.modifiers==2)||(e.keyCode==0&&e.charCode==106&&e.ctrlKey)||(e.keyCode==13&&e.ctrlKey);}}if(_67){_5d(); 179 | return false;}}; 180 | _13();})(); 181 | -------------------------------------------------------------------------------- /orphus.js: -------------------------------------------------------------------------------- 1 | /*! Orphus.js | by Dmitry Koterov & Proger_XP | orphus.ru | proger.me */ 2 | // uglifyjs -c -m --comments '/^!/' --source-map --warn orphus.js -o orphus-min.js 3 | ;(function () { 4 | "use strict"; 5 | 6 | var user = window.orphus || {} 7 | var self = window.orphus = {} 8 | 9 | self.opt = { 10 | version: '6.0', 11 | // If prefixed with '!', the value is obfuscated by swapping every second 12 | // character, e.g. 'foo@bar.com' == '!of@oab.rocm'. 13 | email: '', 14 | homepage: 'https://github.com/ProgerXP/Orphus', 15 | c_tag1: '', 16 | c_tag2: '', 17 | contextLength: 60, // max length of ?c_pre and ?c_suf. 18 | maxSelection: 256, // max ?c_sel. 19 | action: '/orphus.php', 20 | maxWidth: 650, // of
. 21 | strings: { // localizable. 22 | alt: 'Select the fragment with a typo using your mouse and press Ctrl+Enter.', 23 | badbrowser: "Your browser doesn't support selection or IFRAME. Perhaps it's too old, or perhaps there's some other error.", 24 | toobig: 'Your selection is too long. Please select a smaller fragment.', 25 | subject: 'Orphus Report', 26 | intextmsg: 'A mistake or typo in this text:', 27 | ifsendmsg: 'Send a message to the authors? You will stay on this page.', 28 | gohome: 'Or perhaps you want to visit the Orphus\' homepage (in a new tab)?', 29 | name: 'Orphus', 30 | author: 'by Dmitry Koterov & Proger_XP', 31 | to: 'Proger_XP', 32 | send: 'Submit', 33 | cancel: 'Cancel', 34 | entercmnt: 'Your comment (optional):', 35 | submitex: 'Unable to send the report:' 36 | } 37 | } 38 | 39 | var assign = function (dest, src) { 40 | for (var k in src) { 41 | if (k == 'strings') { 42 | assign(dest[k], src[k]) 43 | } else { 44 | dest[k] = src[k] 45 | } 46 | } 47 | } 48 | 49 | assign(self.opt, user) 50 | 51 | var docEl = document.documentElement 52 | var body = document.body 53 | 54 | self.iframe = null 55 | self.submitted = false 56 | self.lastComment = '' 57 | 58 | self.deobfuscate = function (s) { 59 | if (s.substr(0, 1) == '!') { 60 | s = s.substr(1).replace(/(.)(.)/g, '$2$1') 61 | } 62 | return s 63 | } 64 | 65 | self.run = function () { 66 | document.onkeypress = self.onkeypress 67 | } 68 | 69 | self.addOffScreen = function (node) { 70 | node.style.position = 'absolute' 71 | node.style.top = '-10000px' 72 | body.lastChild 73 | ? body.insertBefore(node, body.lastChild) 74 | : body.appendChild(node) 75 | return node 76 | } 77 | 78 | self.createIFrame = function (name) { 79 | var div = document.createElement('DIV') 80 | div.innerHTML = '' 81 | return self.addOffScreen(div) 82 | } 83 | 84 | self.submit = function (refURL, sel, comment) { 85 | var name = 'orphus_ifr' 86 | self.iframe = self.iframe || self.createIFrame(name) 87 | 88 | var form = document.createElement('FORM') 89 | form.action = self.opt.action 90 | form.method = 'post' 91 | form.target = name 92 | 93 | var query = { 94 | version: self.opt.version, 95 | email: self.deobfuscate(self.opt.email), 96 | to: self.opt.strings.to, 97 | subject: self.opt.strings.subject, 98 | ref: refURL, 99 | c_pre: sel.pre, 100 | c_sel: sel.text, 101 | c_suf: sel.suf, 102 | c_pos: sel.pos, 103 | c_tag1: self.opt.c_tag1, 104 | c_tag2: self.opt.c_tag2, 105 | charset: document.charset || document.characterSet || '', 106 | comment: comment 107 | } 108 | 109 | for (var name in query) { 110 | var input = document.createElement('INPUT') 111 | input.type = 'hidden' 112 | input.name = name 113 | input.value = query[name] 114 | form.appendChild(input) 115 | } 116 | 117 | self.addOffScreen(form) 118 | form.submit() 119 | form.parentNode.removeChild(form) 120 | } 121 | 122 | self.windowInfo = function () { 123 | var width = 0 124 | var height = 0 125 | 126 | if (typeof window.innerWidth == 'number') { 127 | width = window.innerWidth 128 | height = window.innerHeight 129 | } else if (docEl && (docEl.clientWidth || docEl.clientHeight)) { 130 | width = docEl.clientWidth 131 | height = docEl.clientHeight 132 | } else if (body && (body.clientWidth || body.clientHeight)) { 133 | width = body.clientWidth 134 | height = body.clientHeight 135 | } 136 | 137 | var scrollLeft = 0 138 | var scrollTop = 0 139 | 140 | if (typeof window.pageYOffset == 'number') { 141 | scrollTop = window.pageYOffset 142 | scrollLeft = window.pageXOffset 143 | } else if (body && (body.scrollLeft || body.scrollTop)) { 144 | scrollTop = body.scrollTop 145 | scrollLeft = body.scrollLeft 146 | } else if (docEl && (docEl.scrollLeft || docEl.scrollTop)) { 147 | scrollTop = docEl.scrollTop 148 | scrollLeft = docEl.scrollLeft 149 | } 150 | 151 | return { 152 | width: width, 153 | height: height, 154 | scrollLeft: scrollLeft, 155 | scrollTop: scrollTop 156 | } 157 | } 158 | 159 | self.showFor = function (context, submit) { 160 | if (self.submitted) { return } 161 | 162 | self.submitted = true 163 | var div = document.createElement('DIV') 164 | var width = Math.min(self.opt.maxWidth, body.clientWidth) 165 | 166 | div.innerHTML = 167 | '
' + 168 | '' + 169 | '
' + self.opt.strings.intextmsg + '
' + 170 | '
' + 171 | context 172 | .replace(self.opt.c_tag1, '') 173 | .replace(self.opt.c_tag2, '') + 174 | '
' + 175 | '
' + 176 | self.opt.strings.ifsendmsg.replace(/\r?\n/, '
') + 177 | '
' + 178 | '
' + 179 | '
' + self.opt.strings.entercmnt + '
' + 180 | '' + 181 | '
' + 182 | '' + 183 | ' ' + 184 | '' + 185 | '
' + 186 | '
' + 187 | '
' 188 | 189 | self.addOffScreen(div) 190 | var inputs = div.getElementsByTagName('input') 191 | var forms = div.getElementsByTagName('form') 192 | var commentInput = inputs[0] 193 | var origOnKeyDown = null 194 | 195 | var end = function () { 196 | document.onkeydown = origOnKeyDown 197 | origOnKeyDown = null 198 | div.parentNode.removeChild(div) 199 | self.submitted = false 200 | self.lastComment = commentInput.value 201 | } 202 | 203 | setTimeout(function () { 204 | var divWidth = div.clientWidth 205 | var divHeight = div.clientHeight 206 | var win = self.windowInfo() 207 | 208 | var x = (win.width - divWidth) / 2 + win.scrollLeft 209 | var y = (win.height - divHeight) / 2 + win.scrollTop 210 | div.style.left = x + 'px' 211 | div.style.top = y + 'px' 212 | 213 | commentInput.value = self.lastComment 214 | commentInput.focus() 215 | commentInput.select() 216 | origOnKeyDown = document.onkeydown 217 | 218 | document.onkeydown = function (e) { 219 | e = e || window.event 220 | if (e.keyCode == 27) { end() } 221 | } 222 | 223 | forms[0].onsubmit = function () { 224 | try { 225 | submit(commentInput.value) 226 | } catch (e) { 227 | alert(self.opt.strings.submitex + '\n\n' + e) 228 | } 229 | end() 230 | self.lastComment = '' 231 | return false 232 | } 233 | 234 | inputs[2].onclick = end 235 | }, 10) 236 | } 237 | 238 | self.cleanString = function (s) { 239 | return ('' + s).replace(/[\r\n]+/g, ' ').replace(/^\s+|\s+$/g, '') 240 | } 241 | 242 | self.getSelection = function () { 243 | var docSel = null 244 | 245 | if (window.getSelection) { 246 | docSel = window.getSelection() 247 | } else if (document.getSelection) { 248 | docSel = document.getSelection() 249 | } else { 250 | docSel = document.selection 251 | } 252 | 253 | if (docSel == null) { throw 'null getSelection()' } 254 | 255 | var pre = '' 256 | var text = null 257 | var suf = '' 258 | var pos = -1 259 | 260 | if (docSel.getRangeAt) { 261 | if (!docSel.rangeCount) { return } 262 | var range = docSel.getRangeAt(0) 263 | text = range.toString() 264 | var newRange = document.createRange() 265 | newRange.setStartBefore(range.startContainer.ownerDocument.body) 266 | newRange.setEnd(range.startContainer, range.startOffset) 267 | pre = newRange.toString() 268 | var newRange = range.cloneRange() 269 | newRange.setStart(range.endContainer, range.endOffset) 270 | newRange.setEndAfter(range.endContainer.ownerDocument.body) 271 | suf = newRange.toString() 272 | } else if (docSel.createRange) { 273 | var range = docSel.createRange() 274 | text = range.text 275 | var newRange = docSel.createRange() 276 | newRange.moveStart('character', -self.opt.contextLength) 277 | newRange.moveEnd('character', -text.length) 278 | pre = newRange.text 279 | var newRange = docSel.createRange() 280 | newRange.moveEnd('character', self.opt.contextLength) 281 | newRange.moveStart('character', text.length) 282 | suf = newRange.text 283 | } else { 284 | text = '' + docSel 285 | } 286 | 287 | var p 288 | var s = (p = text.match(/^(\s*)/)) && p[0].length 289 | var e = (p = text.match(/(\s*)$/)) && p[0].length 290 | pre = pre + text.substring(0, s) 291 | suf = text.substring(text.length - e, text.length) + suf 292 | text = text.substring(s, text.length - e) 293 | 294 | if (text != '') { 295 | return { 296 | pre: pre, 297 | text: text, 298 | suf: suf, 299 | pos: pos 300 | } 301 | } 302 | } 303 | 304 | self.show = function () { 305 | try { 306 | var sel = self.getSelection() 307 | } catch (e) { 308 | alert(self.opt.strings.badbrowser) 309 | return 310 | } 311 | 312 | if (!sel) { 313 | var msg = [ 314 | self.opt.strings.name + ' v' + self.opt.version, 315 | self.opt.strings.author, 316 | '', 317 | self.opt.strings.alt, 318 | '', 319 | self.opt.strings.gohome, 320 | ] 321 | 322 | if (confirm(msg.join('\n'))) { 323 | window.open(self.opt.homepage, '_blank') 324 | } 325 | 326 | return 327 | } 328 | 329 | sel.pre = sel.pre.substring(sel.pre.length - self.opt.contextLength, sel.pre.length).replace(/^\S{1,10}\s+/, '') 330 | sel.suf = sel.suf.substring(0, self.opt.contextLength).replace(/\s+\S{1,10}$/, '') 331 | var context = self.cleanString(sel.pre + self.opt.c_tag1 + sel.text + self.opt.c_tag2 + sel.suf) 332 | 333 | if (context.length > self.opt.maxSelection) { 334 | alert(self.opt.strings.toobig) 335 | } else { 336 | self.showFor(context, function (comment) { 337 | self.submit(document.location.href, sel, comment) 338 | }) 339 | } 340 | } 341 | 342 | self.onkeypress = function (e) { 343 | var handle = false 344 | var we = window.event 345 | 346 | if (we) { 347 | handle = we.keyCode == 10 || (we.keyCode == 13 && we.ctrlKey) 348 | } else if (e) { 349 | handle = (e.which == 10 && e.modifiers == 2) || 350 | (e.keyCode == 0 && e.charCode == 106 && e.ctrlKey) || 351 | (e.keyCode == 13 && e.ctrlKey) 352 | } 353 | 354 | if (handle) { 355 | self.show() 356 | return false 357 | } 358 | } 359 | 360 | self.run() 361 | })(); 362 | -------------------------------------------------------------------------------- /original/orphus.js: -------------------------------------------------------------------------------- 1 | /*! Orphus.js | by Dmitry Koterov & Proger_XP | orphus.ru | proger.me */ 2 | ;(function () { 3 | "use strict"; 4 | 5 | var opt = { 6 | version: '6.0', 7 | // If prefixed with '!', the value is obfuscated by swapping every second 8 | // character, e.g. 'foo@bar.com' == '!of@oab.rocm'. 9 | email: 'hidden', 10 | homepage: 'http://www.orphus.ru/ru/', 11 | c_tag1: '', 12 | c_tag2: '', 13 | contextLength: 60, 14 | maxSelection: 256, 15 | action: '/orphus.php', // new 16 | width: 550, // new 17 | strings: { 18 | alt: 'Select the fragment with a typo using your mouse and press Ctrl+Enter.', 19 | badbrowser: "Your browser doesn't support selection or IFRAME. Perhaps it's too old, or perhaps there's some other error.", 20 | toobig: 'Your selection is too long. Please select a smaller fragment.', 21 | subject: 'Orphus Report', 22 | intextmsg: 'A mistake or typo in this text:', 23 | ifsendmsg: 'Send a message to the authors? You will stay on this page.', 24 | gohome: 'Visit the Orphus\' homepage (in a new tab)?', 25 | name: 'Orphus', 26 | author: 'Author: Dmitry Koterov.', 27 | to: 'Proger_XP', 28 | send: 'Submit', 29 | cancel: 'Cancel', 30 | entercmnt: 'Your comment (optional):', 31 | }, 32 | } 33 | 34 | var showMethod = 'showMethod' 35 | var _a = 0 //? 36 | var docEl = document.documentElement 37 | var body = document.body 38 | var iframe = null 39 | var self = {} 40 | var submitted = false 41 | var lastComment = '' 42 | 43 | var run = function () { 44 | if (opt.email.substr(0, 1) == '!') { 45 | opt.email = opt.email.substr(1).replace(/(.)(.)/g, '$2$1') 46 | } 47 | document.onkeypress = onkeypress 48 | } 49 | 50 | // The _18() function which updated widnow.status was removed because 51 | // this property no longer works in modern browsers: 52 | // https://developer.mozilla.org/en-US/docs/Web/API/Window/status 53 | // "However, the HTML standard now requires setting window.status to have 54 | // no effect on the text displayed in the status bar." 55 | 56 | var addOffScreen = function (node) { 57 | node.style.position = 'absolute' 58 | node.style.top = '-10000px' 59 | if (body.lastChild) { 60 | body.insertBefore(node, body.lastChild) 61 | } else { 62 | body.appendChild(node) 63 | } 64 | return node 65 | } 66 | var createIFrame = function (name) { 67 | var div = document.createElement('DIV') 68 | div.innerHTML = '' 69 | return addOffScreen(div) 70 | } 71 | 72 | var submit = function (url, sel, comment) { 73 | var name = 'orphus_ifr' 74 | if (!iframe) { 75 | iframe = createIFrame(name) 76 | } 77 | var form = document.createElement('FORM') 78 | form.action = opt.action 79 | form.method = 'post' 80 | form.target = name 81 | var query = { 82 | version: opt.version, 83 | email: opt.email, 84 | to: opt.strings.to, 85 | subject: opt.strings.subject, 86 | ref: url, 87 | c_pre: sel.pre, 88 | c_sel: sel.text, 89 | c_suf: sel.suf, 90 | c_pos: sel.pos, 91 | c_tag1: opt.c_tag1, 92 | c_tag2: opt.c_tag2, 93 | charset: document.charset || document.characterSet || '', 94 | comment: comment, 95 | } 96 | for (var name in query) { 97 | var input = document.createElement('INPUT') 98 | input.type = 'hidden' 99 | input.name = name 100 | input.value = query[name] 101 | form.appendChild(input) 102 | } 103 | addOffScreen(form) 104 | form.submit() 105 | form.parentNode.removeChild(form) 106 | } 107 | 108 | var windowInfo = function () { 109 | var width = 0 110 | var height = 0 111 | 112 | if (typeof window.innerWidth == 'number') { 113 | width = window.innerWidth 114 | height = window.innerHeight 115 | } else if (docEl && (docEl.clientWidth || docEl.clientHeight)) { 116 | width = docEl.clientWidth 117 | height = docEl.clientHeight 118 | } else { 119 | if (body && (body.clientWidth || body.clientHeight)) { 120 | width = body.clientWidth 121 | height = body.clientHeight 122 | } 123 | } 124 | 125 | var scrollLeft = 0 126 | var scrollTop = 0 127 | 128 | if (typeof window.pageYOffset == 'number') { 129 | scrollTop = window.pageYOffset 130 | scrollLeft = window.pageXOffset 131 | } else if (body && (body.scrollLeft || body.scrollTop)) { 132 | scrollTop = body.scrollTop 133 | scrollLeft = body.scrollLeft 134 | } else { 135 | if (docEl && (docEl.scrollLeft || docEl.scrollTop)) { 136 | scrollTop = docEl.scrollTop 137 | scrollLeft = docEl.scrollLeft 138 | } 139 | } 140 | 141 | return { 142 | width: width, 143 | height: height, 144 | scrollLeft: scrollLeft, 145 | scrollTop: scrollTop, 146 | } 147 | } 148 | 149 | // The _10.confirm() function was removed because it was not used. 150 | // It seems it was meant to show the confirmation avoiding overlaying the 151 | // content with
. 152 | 153 | self.showMethod = function (context, submit) { 154 | if (submitted) { 155 | return 156 | } 157 | 158 | submitted = true 159 | var div = document.createElement('DIV') 160 | 161 | var width = opt.width 162 | if (width > body.clientWidth - 10) { 163 | width = body.clientWidth - 10 164 | } 165 | 166 | div.style.zIndex = 10001 167 | 168 | div.innerHTML = 169 | '
' + 170 | '' + 171 | '
' + opt.strings.intextmsg + '
' + 172 | '
' + 173 | context.replace(opt.c_tag1, '').replace(opt.c_tag2, '') + 174 | '
' + 175 | '
' + 176 | opt.strings.ifsendmsg.replace(/\n/, '
') + 177 | '
' + 178 | '
' + 179 | '
' + opt.strings.entercmnt + '
' + 180 | '' + 181 | '
' + 182 | '' + 183 | ' ' + 184 | '' + 185 | '
' + 186 | '
' + 187 | '
' 188 | 189 | addOffScreen(div) 190 | var inputs = div.getElementsByTagName('input') 191 | var forms = div.getElementsByTagName('form') 192 | var commentInput = inputs[0] 193 | var onkeydown = null 194 | var hiddenSelects = [] 195 | 196 | var end = function () { 197 | document.onkeydown = onkeydown 198 | onkeydown = null 199 | div.parentNode.removeChild(div) 200 | for (var i = 0; i < hiddenSelects.length; i++) { 201 | hiddenSelects[i][0].style.visibility = hiddenSelects[i][1] 202 | } 203 | submitted = false 204 | lastComment = commentInput.value 205 | } 206 | 207 | var pos = function (p) { 208 | var s = { 209 | x: 0, 210 | y: 0, 211 | } 212 | while (p.offsetParent) { 213 | s.x += p.offsetLeft 214 | s.y += p.offsetTop 215 | p = p.offsetParent 216 | } 217 | return s 218 | } 219 | 220 | setTimeout(function () { 221 | var divWidth = div.clientWidth 222 | var divHeight = div.clientHeight 223 | var dim = windowInfo() 224 | 225 | var x = (dim.width - divWidth) / 2 + dim.scrollLeft 226 | if (x < 10) { 227 | x = 10 228 | } 229 | 230 | var y = (dim.height - divHeight) / 2 + dim.scrollTop - 10 231 | if (y < 10) { 232 | y = 10 233 | } 234 | 235 | div.style.left = x + 'px' 236 | div.style.top = y + 'px' 237 | 238 | if (navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1 < 7) { 239 | // This seems to be addressing the ancient issue with IE 6- which 240 | // " + "
" + " " + "" + "
" + "" + "
" + ""; 203 | _1b(div); 204 | var _3a = div.getElementsByTagName("input"); 205 | var _3b = div.getElementsByTagName("form"); 206 | var t = _3a[0]; 207 | var _3d = null; 208 | var _3e = []; 209 | var _3f = function() { 210 | d.onkeydown = _3d; 211 | _3d = null; 212 | div.parentNode.removeChild(div); 213 | for (var i = 0; i < _3e.length; i++) { 214 | _3e[i][0].style.visibility = _3e[i][1]; 215 | } 216 | _11 = false; 217 | _12 = t.value; 218 | }; 219 | var pos = function(p) { 220 | var s = { 221 | x: 0, 222 | y: 0 223 | }; 224 | while (p.offsetParent) { 225 | s.x += p.offsetLeft; 226 | s.y += p.offsetTop; 227 | p = p.offsetParent; 228 | } 229 | return s; 230 | }; 231 | setTimeout(function() { 232 | var w = div.clientWidth; 233 | var h = div.clientHeight; 234 | var dim = _29(); 235 | var x = (dim.w - w) / 2 + dim.x; 236 | if (x < 10) { 237 | x = 10; 238 | } 239 | var y = (dim.h - h) / 2 + dim.y - 10; 240 | if (y < 10) { 241 | y = 10; 242 | } 243 | div.style.left = x + "px"; 244 | div.style.top = y + "px"; 245 | if (navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1 < 7) { 246 | var _49 = d.getElementsByTagName("SELECT"); 247 | for (var i = 0; i < _49.length; i++) { 248 | var s = _49[i]; 249 | var p = pos(s); 250 | if (p.x > x + w || p.y > y + h || p.x + s.offsetWidth < x || p.y + s.offsetHeight < y) { 251 | continue; 252 | } 253 | _3e[_3e.length] = [s, s.style.visibility]; 254 | s.style.visibility = "hidden"; 255 | } 256 | } 257 | t.value = _12; 258 | t.focus(); 259 | t.select(); 260 | _3d = d.onkeydown; 261 | d.onkeydown = function(e) { 262 | if (!e) { 263 | e = window.event; 264 | } 265 | if (e.keyCode == 27) { 266 | _3f(); 267 | } 268 | } 269 | ; 270 | _3b[0].onsubmit = function() { 271 | _37(t.value); 272 | _3f(); 273 | _12 = ""; 274 | return false; 275 | } 276 | ; 277 | _3a[2].onclick = function() { 278 | _3f(); 279 | } 280 | ; 281 | }, 10); 282 | } 283 | ; 284 | var _4e = function(_4f) { 285 | return ("" + _4f).replace(/[\r\n]+/g, " ").replace(/^\s+|\s+$/g, ""); 286 | }; 287 | var _50 = function() { 288 | try { 289 | var _51 = null; 290 | var _52 = null; 291 | if (w.getSelection) { 292 | _52 = w.getSelection(); 293 | } else { 294 | if (d.getSelection) { 295 | _52 = d.getSelection(); 296 | } else { 297 | _52 = d.selection; 298 | } 299 | } 300 | var _53 = null; 301 | if (_52 != null) { 302 | var pre = "" 303 | , _51 = null 304 | , suf = "" 305 | , pos = -1; 306 | if (_52.getRangeAt) { 307 | var r = _52.getRangeAt(0); 308 | _51 = r.toString(); 309 | var _58 = d.createRange(); 310 | _58.setStartBefore(r.startContainer.ownerDocument.body); 311 | _58.setEnd(r.startContainer, r.startOffset); 312 | pre = _58.toString(); 313 | var _59 = r.cloneRange(); 314 | _59.setStart(r.endContainer, r.endOffset); 315 | _59.setEndAfter(r.endContainer.ownerDocument.body); 316 | suf = _59.toString(); 317 | } else { 318 | if (_52.createRange) { 319 | var r = _52.createRange(); 320 | _51 = r.text; 321 | var _58 = _52.createRange(); 322 | _58.moveStart("character", -_6); 323 | _58.moveEnd("character", -_51.length); 324 | pre = _58.text; 325 | var _59 = _52.createRange(); 326 | _59.moveEnd("character", _6); 327 | _59.moveStart("character", _51.length); 328 | suf = _59.text; 329 | } else { 330 | _51 = "" + _52; 331 | } 332 | } 333 | var p; 334 | var s = (p = _51.match(/^(\s*)/)) && p[0].length; 335 | var e = (p = _51.match(/(\s*)$/)) && p[0].length; 336 | pre = pre + _51.substring(0, s); 337 | suf = _51.substring(_51.length - e, _51.length) + suf; 338 | _51 = _51.substring(s, _51.length - e); 339 | if (_51 == "") { 340 | return null; 341 | } 342 | return { 343 | pre: pre, 344 | text: _51, 345 | suf: suf, 346 | pos: pos 347 | }; 348 | } else { 349 | alert(_8.badbrowser); 350 | return; 351 | } 352 | } catch (e) { 353 | return null; 354 | } 355 | }; 356 | var _5d = function() { 357 | if (!_2 || navigator.appName.indexOf("Netscape") != -1 && eval(navigator.appVersion.substring(0, 1)) < 5) { 358 | alert(_8.badbrowser); 359 | return; 360 | } 361 | var _5e = function(_5f) { 362 | alert("Wrong installation (code " + _5f + "). Please reinstall Orphus."); 363 | }; 364 | var _60 = _15(); 365 | if (!_60) { 366 | _5e(1); 367 | return; 368 | } 369 | if (_60.href.replace(/.*\/\/|\/.*/g, "") != hq.replace(/.*\/\/|\/.*/g, "")) { 370 | _5e(2); 371 | return; 372 | } 373 | var i = null; 374 | for (var n = 0; n < _60.childNodes.length; n++) { 375 | if (_60.childNodes[n].tagName == "IMG") { 376 | i = _60.childNodes[n]; 377 | break; 378 | } 379 | } 380 | if (!i) { 381 | _5e(3); 382 | return; 383 | } 384 | if (!i.alt.match(/orphus/i)) { 385 | _5e(4); 386 | return; 387 | } 388 | if (i.width < 30 && i.height < 10) { 389 | _5e(5); 390 | return; 391 | } 392 | if (_60.style.display == "none" || i.style.display == "none" || _60.style.visibility == "hidden" || i.style.visibility == "hidden") { 393 | _5e(6); 394 | return; 395 | } 396 | var _63 = _50(); 397 | if (!_63) { 398 | return; 399 | } 400 | with (_63) { 401 | pre = pre.substring(pre.length - _6, pre.length).replace(/^\S{1,10}\s+/, ""); 402 | suf = suf.substring(0, _6).replace(/\s+\S{1,10}$/, ""); 403 | } 404 | var _64 = _4e(_63.pre + _4 + _63.text + _5 + _63.suf); 405 | if (_64.length > _7) { 406 | alert(_8.toobig); 407 | return; 408 | } 409 | _10[_9](_64, function(_65) { 410 | _20(d.location.href, _63, _65); 411 | _18(); 412 | }); 413 | }; 414 | var _17 = function(e) { 415 | var _67 = 0; 416 | var we = w.event; 417 | if (we) { 418 | _67 = we.keyCode == 10 || (we.keyCode == 13 && we.ctrlKey); 419 | } else { 420 | if (e) { 421 | _67 = (e.which == 10 && e.modifiers == 2) || (e.keyCode == 0 && e.charCode == 106 && e.ctrlKey) || (e.keyCode == 13 && e.ctrlKey); 422 | } 423 | } 424 | if (_67) { 425 | _5d(); 426 | return false; 427 | } 428 | }; 429 | _13(); 430 | } 431 | )(); 432 | -------------------------------------------------------------------------------- /original/orphus-orig-renamed.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var version = "5.01"; 3 | var email = "!rohpsud@lkbar.u"; 4 | var homepage = "//www.orphus.ru/en/"; 5 | var c_tag1 = ""; 6 | var c_tag2 = ""; 7 | var contextLength = 60; 8 | var maxSelection = 256; 9 | var strings = { 10 | // English (English) 11 | alt: "Select spelling error with mouse and press Ctrl+Enter. Let's make the language clean!", 12 | badbrowser: "Your browser does not support selection handling or IFRAMEs. Probably, you use an obsolete browser.", 13 | toobig: "You have selected too large text block!", 14 | thanks: "Thank you for your co-operation!", 15 | subject: "Spelling error", 16 | docmsg: "Document:", 17 | intextmsg: "Spelling error in text:", 18 | ifsendmsg: "Do you want to send a notice to a webmaster?\nYour browser will NOT be redirected.", 19 | gohome: "Do you want to visit Orphus homepage now?", 20 | newwin: "Page will be opened in a new window.", 21 | name: "Orphus system", 22 | author: "Author: Dmitry Koterov.", 23 | to: "Orphus user", 24 | // 5.0 25 | send: "Send", 26 | cancel: "Cancel", 27 | entercmnt: "A comment for a webmaster (optional):"// Dmitry Koterov 28 | 29 | }; 30 | var showMethod = "css"; 31 | var _a = 0; 32 | var w = window; 33 | var d = w.document; 34 | var docEl = d.documentElement; 35 | var body = d.body; 36 | var iframe = null; 37 | var self = {}; 38 | var submitted = false; 39 | var lastComment = ""; 40 | var run = function() { 41 | if (email.substr(0, 1) == "!") { 42 | email = email.substr(1).replace(/(.)(.)/g, "$2$1"); 43 | } 44 | setTimeout(function() { 45 | var _14 = _15(); 46 | if (_14) { 47 | _14.onclick = _16; 48 | _14.title = _14.childNodes[0] && _14.childNodes[0].alt; 49 | } 50 | }, 100); 51 | d.onkeypress = onkeypress; 52 | strings.gohome += " " + strings.newwin; 53 | }; 54 | var _15 = function() { 55 | return d.getElementById("orphus"); 56 | }; 57 | var _16 = function() { 58 | with (strings) { 59 | if (confirm(name + " v" + version + ".\n" + author + "\n\n" + alt + "\n\n" + gohome)) { 60 | w.open(homepage, "_blank"); 61 | } 62 | return false; 63 | } 64 | }; 65 | var _18 = function() { 66 | var n = 0; 67 | var _1a = function() { 68 | if (++n > 20) { 69 | return; 70 | } 71 | w.status = (n % 5) ? strings.thanks : " "; 72 | setTimeout(_1a, 100); 73 | }; 74 | _1a(); 75 | }; 76 | var addOffScreen = function(node) { 77 | node.style.position = "absolute"; 78 | node.style.top = "-10000px"; 79 | if (body.lastChild) { 80 | body.insertBefore(node, body.lastChild); 81 | } else { 82 | body.appendChild(node); 83 | } 84 | }; 85 | var createIFrame = function(name) { 86 | var div = d.createElement("DIV"); 87 | div.innerHTML = ""; 88 | addOffScreen(div); 89 | return d.childNodes[0]; 90 | }; 91 | var submit = function(url, sel, comment) { 92 | var name = "orphus_ifr"; 93 | if (!iframe) { 94 | iframe = createIFrame(name); 95 | } 96 | var form = d.createElement("FORM"); 97 | form.style.position = "absolute"; 98 | form.style.top = "-10000px"; 99 | form.action = homepage; 100 | form.method = "post"; 101 | form.target = name; 102 | var query = { 103 | version: version, 104 | email: email, 105 | to: strings.to, 106 | subject: strings.subject, 107 | ref: url, 108 | c_pre: sel.pre, 109 | c_sel: sel.text, 110 | c_suf: sel.suf, 111 | c_pos: sel.pos, 112 | c_tag1: c_tag1, 113 | c_tag2: c_tag2, 114 | charset: d.charset || d.characterSet || "", 115 | comment: comment 116 | }; 117 | for (var name in query) { 118 | var input = d.createElement("INPUT"); 119 | input.type = "hidden"; 120 | input.name = name; 121 | input.value = query[name]; 122 | form.appendChild(input); 123 | } 124 | addOffScreen(form); 125 | form.submit(); 126 | form.parentNode.removeChild(form); 127 | }; 128 | var windowInfo = function() { 129 | var width = 0 130 | var height = 0; 131 | if (typeof (w.innerWidth) == "number") { 132 | width = w.innerWidth; 133 | height = w.innerHeight; 134 | } else { 135 | if (docEl && (docEl.clientWidth || docEl.clientHeight)) { 136 | width = docEl.clientWidth; 137 | height = docEl.clientHeight; 138 | } else { 139 | if (body && (body.clientWidth || body.clientHeight)) { 140 | width = body.clientWidth; 141 | height = body.clientHeight; 142 | } 143 | } 144 | } 145 | var scrollLeft = 0 146 | var scrollRight = 0; 147 | if (typeof (w.pageYOffset) == "number") { 148 | scrollRight = w.pageYOffset; 149 | scrollLeft = w.pageXOffset; 150 | } else { 151 | if (body && (body.scrollLeft || body.scrollTop)) { 152 | scrollRight = body.scrollTop; 153 | scrollLeft = body.scrollLeft; 154 | } else { 155 | if (docEl && (docEl.scrollLeft || docEl.scrollTop)) { 156 | scrollRight = docEl.scrollTop; 157 | scrollLeft = docEl.scrollLeft; 158 | } 159 | } 160 | } 161 | return { 162 | w: width, 163 | h: height, 164 | x: scrollLeft, 165 | y: scrollRight 166 | }; 167 | }; 168 | self.confirm = function(_2e, _2f, _30) { 169 | var ts = new Date().getTime(); 170 | var _32 = confirm(strings.docmsg + "\n " + d.location.href + "\n" + strings.intextmsg + "\n \"" + _2e + "\"\n\n" + strings.ifsendmsg); 171 | var dt = new Date().getTime() - ts; 172 | if (_32) { 173 | _2f(""); 174 | } else { 175 | if (!_30 && dt < 50) { 176 | var sv = d.onkeyup; 177 | d.onkeyup = function(e) { 178 | if (!e) { 179 | e = window.event; 180 | } 181 | if (e.keyCode == 17) { 182 | d.onkeyup = sv; 183 | self.confirm(_2e, _2f, true); 184 | } 185 | } 186 | ; 187 | } 188 | } 189 | } 190 | ; 191 | self.css = function(context, submit) { 192 | if (submitted) { 193 | return; 194 | } 195 | submitted = true; 196 | var div = d.createElement("DIV"); 197 | var w = 550; 198 | if (w > body.clientWidth - 10) { 199 | w = body.clientWidth - 10; 200 | } 201 | div.style.zIndex = "10001"; 202 | div.innerHTML = 203 | "" + 204 | "
" + 205 | "" + 206 | "" + 207 | "" + 208 | "
" + 209 | strings.intextmsg + 210 | "
" + 211 | "
" + 212 | context.replace(c_tag1, "").replace(c_tag2, "") + 213 | "
" + 214 | "
" + 215 | strings.ifsendmsg.replace(/\n/, "
") + 216 | "
" + 217 | "
" + 218 | "
" + strings.entercmnt + "
" + 219 | "" + 220 | "
" + 221 | " " + 222 | "" + 223 | "
" + 224 | "
" + 225 | "
" + 226 | ""; 227 | addOffScreen(div); 228 | var inputs = div.getElementsByTagName("input"); 229 | var forms = div.getElementsByTagName("form"); 230 | var commentInput = inputs[0]; 231 | var onkeydown = null; 232 | var hiddenSelects = []; 233 | var end = function() { 234 | d.onkeydown = onkeydown; 235 | onkeydown = null; 236 | div.parentNode.removeChild(div); 237 | for (var i = 0; i < hiddenSelects.length; i++) { 238 | hiddenSelects[i][0].style.visibility = hiddenSelects[i][1]; 239 | } 240 | submitted = false; 241 | lastComment = commentInput.value; 242 | }; 243 | var pos = function(p) { 244 | var s = { 245 | x: 0, 246 | y: 0 247 | }; 248 | while (p.offsetParent) { 249 | s.x += p.offsetLeft; 250 | s.y += p.offsetTop; 251 | p = p.offsetParent; 252 | } 253 | return s; 254 | }; 255 | setTimeout(function() { 256 | var w = div.clientWidth; 257 | var h = div.clientHeight; 258 | var dim = windowInfo(); 259 | var x = (dim.w - w) / 2 + dim.x; 260 | if (x < 10) { 261 | x = 10; 262 | } 263 | var y = (dim.h - h) / 2 + dim.y - 10; 264 | if (y < 10) { 265 | y = 10; 266 | } 267 | div.style.left = x + "px"; 268 | div.style.top = y + "px"; 269 | if (navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1 < 7) { 270 | var select = d.getElementsByTagName("SELECT"); 271 | for (var i = 0; i < select.length; i++) { 272 | var s = select[i]; 273 | var p = pos(s); 274 | if (p.x > x + w || p.y > y + h || p.x + s.offsetWidth < x || p.y + s.offsetHeight < y) { 275 | continue; 276 | } 277 | hiddenSelects[hiddenSelects.length] = [s, s.style.visibility]; 278 | s.style.visibility = "hidden"; 279 | } 280 | } 281 | commentInput.value = lastComment; 282 | commentInput.focus(); 283 | commentInput.select(); 284 | onkeydown = d.onkeydown; 285 | d.onkeydown = function(e) { 286 | if (!e) { 287 | e = window.event; 288 | } 289 | if (e.keyCode == 27) { 290 | end(); 291 | } 292 | } 293 | ; 294 | forms[0].onsubmit = function() { 295 | submit(commentInput.value); 296 | end(); 297 | lastComment = ""; 298 | return false; 299 | } 300 | ; 301 | inputs[2].onclick = function() { 302 | end(); 303 | } 304 | ; 305 | }, 10); 306 | } 307 | ; 308 | var cleanString = function(s) { 309 | return ("" + s).replace(/[\r\n]+/g, " ").replace(/^\s+|\s+$/g, ""); 310 | }; 311 | var getSelection = function() { 312 | try { 313 | var text = null; 314 | var docSel = null; 315 | if (w.getSelection) { 316 | docSel = w.getSelection(); 317 | } else { 318 | if (d.getSelection) { 319 | docSel = d.getSelection(); 320 | } else { 321 | docSel = d.selection; 322 | } 323 | } 324 | var _53 = null; 325 | if (docSel != null) { 326 | var pre = "" 327 | var text = null 328 | var suf = "" 329 | var pos = -1; 330 | if (docSel.getRangeAt) { 331 | var range = docSel.getRangeAt(0); 332 | text = range.toString(); 333 | var newRange = d.createRange(); 334 | newRange.setStartBefore(range.startContainer.ownerDocument.body); 335 | newRange.setEnd(range.startContainer, range.startOffset); 336 | pre = newRange.toString(); 337 | var newRange = range.cloneRange(); 338 | newRange.setStart(range.endContainer, range.endOffset); 339 | newRange.setEndAfter(range.endContainer.ownerDocument.body); 340 | suf = newRange.toString(); 341 | } else { 342 | if (docSel.createRange) { 343 | var range = docSel.createRange(); 344 | text = range.text; 345 | var newRange = docSel.createRange(); 346 | newRange.moveStart("character", -contextLength); 347 | newRange.moveEnd("character", -text.length); 348 | pre = newRange.text; 349 | var newRange = docSel.createRange(); 350 | newRange.moveEnd("character", contextLength); 351 | newRange.moveStart("character", text.length); 352 | suf = newRange.text; 353 | } else { 354 | text = "" + docSel; 355 | } 356 | } 357 | var p; 358 | var s = (p = text.match(/^(\s*)/)) && p[0].length; 359 | var e = (p = text.match(/(\s*)$/)) && p[0].length; 360 | pre = pre + text.substring(0, s); 361 | suf = text.substring(text.length - e, text.length) + suf; 362 | text = text.substring(s, text.length - e); 363 | if (text == "") { 364 | return null; 365 | } 366 | return { 367 | pre: pre, 368 | text: text, 369 | suf: suf, 370 | pos: pos 371 | }; 372 | } else { 373 | alert(strings.badbrowser); 374 | return; 375 | } 376 | } catch (e) { 377 | return null; 378 | } 379 | }; 380 | var show = function() { 381 | if (!email || navigator.appName.indexOf("Netscape") != -1 && eval(navigator.appVersion.substring(0, 1)) < 5) { 382 | alert(strings.badbrowser); 383 | return; 384 | } 385 | var _5e = function(_5f) { 386 | alert("Wrong installation (code " + _5f + "). Please reinstall Orphus."); 387 | }; 388 | var _60 = _15(); 389 | if (!_60) { 390 | _5e(1); 391 | return; 392 | } 393 | if (_60.href.replace(/.*\/\/|\/.*/g, "") != homepage.replace(/.*\/\/|\/.*/g, "")) { 394 | _5e(2); 395 | return; 396 | } 397 | var i = null; 398 | for (var n = 0; n < _60.childNodes.length; n++) { 399 | if (_60.childNodes[n].tagName == "IMG") { 400 | i = _60.childNodes[n]; 401 | break; 402 | } 403 | } 404 | if (!i) { 405 | _5e(3); 406 | return; 407 | } 408 | if (!i.alt.match(/orphus/i)) { 409 | _5e(4); 410 | return; 411 | } 412 | if (i.width < 30 && i.height < 10) { 413 | _5e(5); 414 | return; 415 | } 416 | if (_60.style.display == "none" || i.style.display == "none" || _60.style.visibility == "hidden" || i.style.visibility == "hidden") { 417 | _5e(6); 418 | return; 419 | } 420 | var sel = getSelection(); 421 | if (!sel) { 422 | return; 423 | } 424 | with (sel) { 425 | pre = pre.substring(pre.length - contextLength, pre.length).replace(/^\S{1,10}\s+/, ""); 426 | suf = suf.substring(0, contextLength).replace(/\s+\S{1,10}$/, ""); 427 | } 428 | var context = cleanString(sel.pre + c_tag1 + sel.text + c_tag2 + sel.suf); 429 | if (context.length > maxSelection) { 430 | alert(strings.toobig); 431 | return; 432 | } 433 | self[showMethod](context, function(comment) { 434 | submit(d.location.href, sel, comment); 435 | _18(); 436 | }); 437 | }; 438 | var onkeypress = function(e) { 439 | var handle = 0; 440 | var we = w.event; 441 | if (we) { 442 | handle = we.keyCode == 10 || (we.keyCode == 13 && we.ctrlKey); 443 | } else { 444 | if (e) { 445 | handle = (e.which == 10 && e.modifiers == 2) || (e.keyCode == 0 && e.charCode == 106 && e.ctrlKey) || (e.keyCode == 13 && e.ctrlKey); 446 | } 447 | } 448 | if (handle) { 449 | show(); 450 | return false; 451 | } 452 | }; 453 | run(); 454 | } 455 | )(); 456 | --------------------------------------------------------------------------------