Old school Easter eggs.
/* (c) Text top Bangla converter Script * Developer: sangit * http://fb.com/itz.sangit * */ function str_replace (search, replace, subject, count) { var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0, f = [].concat(search), r = [].concat(replace), s = subject, ra = Object.prototype.toString.call(r) === '[object Array]', sa = Object.prototype.toString.call(s) === '[object Array]'; s = [].concat(s); if (count) { this.window[count] = 0; } for (i = 0, sl = s.length; i < sl; i++) { if (s[i] === '') { continue; } for (j = 0, fl = f.length; j < fl; j++) { temp = s[i] + ''; repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0]; s[i] = (temp).split(f[j]).join(repl); if (count && s[i] !== temp) { this.window[count] += (temp.length - s[i].length) / f[j].length; } } } return sa ? s : s[0]; } function urlencode (str) { str = (str + '').toString(); return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'); } function htmlspecialchars (string, quote_style, charset, double_encode) { var optTemp = 0, i = 0, noquotes = false; if (typeof quote_style === 'undefined' || quote_style === null) { quote_style = 2; } string = string.toString(); if (double_encode !== false) { // Put this first to avoid double-encoding string = string.replace(/&/g, '&amp;'); } string = string.replace(/</g, '&lt;').replace(/>/g, '&gt;'); var OPTS = { 'ENT_NOQUOTES': 0, 'ENT_HTML_QUOTE_SINGLE': 1, 'ENT_HTML_QUOTE_DOUBLE': 2, 'ENT_COMPAT': 2, 'ENT_QUOTES': 3, 'ENT_IGNORE': 4 }; if (quote_style === 0) { noquotes = true; } if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags quote_style = [].concat(quote_style); for (i = 0; i < quote_style.length; i++) { // Resolve string input to bitwise e.g. 'ENT_IGNORE' becomes 4 if (OPTS[quote_style[i]] === 0) { noquotes = true; } else if (OPTS[quote_style[i]]) { optTemp = optTemp | OPTS[quote_style[i]]; } } quote_style = optTemp; } if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { string = string.replace(/'/g, '&#039;'); } if (!noquotes) { string = string.replace(/"/g, '&quot;'); } return string; } function nl2br (str, is_xhtml) { var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); } function getParam(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec(window.location.href); if(results === null) return ""; else return results[1]; } function post_action(where) { if (where=='twitter') window.location.href="https://twitter.com/intent/tweet?text="+urlencode(document.getElementById("output").value); else if (where=='google') window.location.href="http://www.google.com/m?q="+urlencode(document.getElementById("output").value); else if (where=='yahoo') window.location.href="http://search.yahoo.com/search?p="+urlencode(document.getElementById("output").value); } function initialize_page() { if(getCookie("correction")!="1"){ document.getElementById("auto_info").innerHTML=""; document.getElementById("auto_info").style.color="red"; document.getElementById("action").innerHTML='<input type="button" value="Convert" onclick="convert()"/> <input type="button" onclick="reset_all()" value="Clear">'; } if(getParam("text").length>0){ document.getElementById("text").value=decodeURIComponent((getParam("text") + '').replace(/\+/g, '%20')); convert(); } } function convert(C) { if(C==undefined) C=""; var output=""; var LastMode=".bn"; var splitted=(document.getElementById("text").value+C).split(/\B(\.[bce])(\s?)/g); for(var i=0; i<splitted.length; i=i+3){ if(splitted[i-1]=="") { str1=splitted[i].substr(0, splitted[i].indexOf(' ')); str2=splitted[i].substr(splitted[i].indexOf(' ')); } else{ str1=splitted[i]; str2=""; LastMode=splitted[i-2]; } if(splitted[i-2]==".en") output+=str1; else output+=classic_bangla(str1); if(str2.length>0 && LastMode==".en") output+=str2; else if(str2.length>0) output+=classic_bangla(str2); } document.getElementById("output").value=output; document.getElementById("preview").innerHTML="<div class='caption'> :</div>" + nl2br(htmlspecialchars(output)); document.getElementById("post_status").innerHTML="<div class='caption'>Update Status:</div><input type='submit' name='submit' value='facebook'/> <input type='button' onclick='post_action(\"twitter\")' value='twitter'/><div class='caption'>Search:</div><input type='button' onclick='post_action(\"google\")' value='google'/> <input type='button' onclick='post_action(\"yahoo\")' value='yahoo'/>"; } /* * variables holding conversion mapping * used in classic_bangla function */ var $bn5zukto=[' ',' ',' ',' ',' ']; var $bn4zukto=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']; var $bn3zukto=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']; var $bn2zukto=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']; var $en5zukto=['kShmy','NgkSh','Ngghy','Ngghr','ShThy']; var $en4zukto=['kShN','kShw','kShm','kShy','gdhy','gdhr','Ngkt','Ngky','Ngkh','Nggy','Nggh','NThy','ntry','nthr','ndhy','ndhr','rghy','rthy','rShy','rdhw','rDhy','Shkr','ShTy','ShTr','ShTh','Shpr','sthy']; var $en3zukto=['kTr','ktr','kSh','kkh','khy','khr','gdh','gny','gry','ghn','ghy','ghr','Ngk','Ngg','Ngm','cCw','cCr','jjw','jjh','Yjh','Dhy','Dhr','NTh','NDy','NDr','NDh','ttw','tty','tth','tmy','try','thw','thy','thr','dgh','ddw','ddh','dvr','dry','dhn','dhw','dhm','dhy','dhr','nTr','nTh','nDr','ntw','nty','ntr','nth','ndy','ndw','ndr','ndh','pry','bdh','mpr','mwr','mvr','rky','rgy','rcy','rjy','rNy','rty','rwy','rmy','rSy','rhy','rkh','rgr','rgh','rjh','rtr','rth','rdw','rdr','rdh','rSw','rSh','lky','Shk','ShT','ShN','Shp','Shf','Shw','Shm','Shy','skr','skh','sTy','sTr','stw','sty','str','sth','spr','spl']; var $en2zukto=['rS','Sc','SC','Sn','Sw','Sm','Sy','Sr','Sl','ng','Ng','kk','kT','kt','kw','km','ky','kr','kl','ks','gN','gn','gw','gm','gy','gr','gl','cc','cC','cY','cw','cy','jj','jY','gg','jw','jy','jr','Yc','nc','YC','nC','Yj','nj','TT','Tw','Tm','Ty','Tr','DD','Dw','Dy','Dr','NT','ND','NN','Nw','Nm','Ny','tk','tt','tn','tw','tm','ty','tr','tl','ts','dg','dd','dw','dv','dm','dy','dr','nk','nT','nD','nt','nd','nn','nw','nm','ny','pT','pt','pn','pp','py','pr','pl','ps','fy','fr','fl','bj','bd','bw','bb','by','br','bl','vw','vy','vr','mn','mp','mf','mw','mb','mv','mm','my','mr','ml','zy','rk','rg','rc','rC','rj','rT','rD','rN','rt','rd','rn','rp','rf','rb','rv','rm','rz','ry','rl','rs','rh','lk','lg','lT','lD','lp','lf','lw','lv','lm','ly','ll','sk','sT','st','sn','sp','sf','sw','sm','sy','sr','sl','hN','hn','hw','hm','hy','hr','hl','Rg','Sh']; var $cnamefrom=['chh','Chh','ch','Ch','bh','ph','x','q','sh','rri']; var $cnameto=['C','C','C','C','v','f','ks','k','S','X']; var $bn2char=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']; var $bn1char=[' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','']; var $en2char=['X','oi','ou','kh','gh','Ng','ch','Ch','jh','Th','Dh','th','dh','Rh','.t','.n','.`']; var $en1char=['o','a','i','I','u','U','e','O','k','g','c','C','j','Y','T','D','N','t','d','n','p','f','b','v','m','z','r','l','S','s','h','R','y',':','`_','w','_']; var $bnkar=[" "," "," "," "," "," "," "," "," "," ",""]; var $enkar=["`a","`i","`I","`u","`U","`X","`e","`oi","`O","`ou","`o"]; var $bn_ychar=['aa','ae','ea','ee','eo','ia','ie','io','iO','Ia','Ie','Io','IO','oa','oe','Oa','Oe','Oi','ua','ue','Ua','Ue','ii','oo','uu']; var $code_ychar=['a','aye','eya','I','eyo','iya','iye','iyo','iyO','Iya','Iye','Iyo','IyO','oya','oye','Oya','Oye','Oy','uya','uye','Uya','Uye','I','O','U']; var $insensitive=['a','e','h','k','g','j','p','f','b','v','m','l','x','w','z']; var $caps_insensitive=['A','E','H','K','G','J','P','F','B','V','M','L','X','W','Z']; var en_num=[0,1,2,3,4,5,6,7,8,9,'$']; var bn_num=[" "," "," "," "," "," "," "," "," "," "," "]; function classic_bangla($text) { $text = $text.replace(/(\b)y/g, "$1iy"); $text=$text.replace(/(\b|\.|a|e|i|o|u)wa/gi, "$1Oya"); $text=$text.replace(/([aeiou])w([^aeiou])/gi, "$1u$2"); $text=$text.replace(/\baya/g,' '); $text=$text.replace(/q/gi,'k'); $text=$text.replace(/([^aeiou])y([^aeiou]|$)/gi, "$1i$2"); $text=$text.replace(/ng([aeiou])/g, "Ngg$1"); $text=$text.replace(/\.t/g,' '); $text=$text.replace(/\.n/g,' '); $text=$text.replace(/([a-z])\.([^\.]|\b|$)/gi,"$1d $2"); $text=str_replace($bn_ychar,$code_ychar,$text); $text=str_replace($caps_insensitive,$insensitive,$text); $text=str_replace($cnamefrom,$cnameto,$text); $text=$text.replace(/([bcdfghjklmnpqrstvwyz])([aeiouX_])/gi,"$1`$2"); //To make kaar $text=str_replace($en5zukto,$bn5zukto,$text); $text=str_replace($en4zukto,$bn4zukto,$text); $text=str_replace($en3zukto,$bn3zukto,$text); $text=str_replace($en2zukto,$bn2zukto,$text); $text=str_replace($enkar,$bnkar,$text); $text=str_replace($en2char,$bn2char,$text); $text=str_replace($en1char,$bn1char,$text); $text=str_replace(en_num,bn_num,$text); return $text; } function reset_all(f) { document.getElementById("text").value=""; document.getElementById("output").value=""; document.getElementById("preview").innerHTML=""; document.getElementById("post_status").innerHTML=""; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } }