<!doctype html>
<html>
<head>
<title>Random Emoji Slideshow - RJM Programming - October, 2016 ... Thanks to http://stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript and http://xahlee.info/js/js_unicode_code_point.html</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.25, maximum-scale=8, user-scalable=yes">
<meta charset="utf-8" />
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
// Thanks to http://stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript
var firstbytes=['\ud83c', '\ud83d', '\ud83d'];
var srangebytes=['\udf00', '\udc00', '\ude80'];
var rsize=[0x00ff, 0x024f, 0x007f];
var erangebytes=['\udfff', '\ude4f', '\udeff'];
var limiting_range=[-1,-1];
var emoticon=[128512,128591];
var transport_map=[128640,128767];
var miscellaneous=[9728,9983];
var dingbats=[9984,10175];
var pictographs=[127744,128511];
var supplementary=[129280,129535];
var variation_selectors=[65024,65039]; // 65039]; // //65024,65039]; // combining_diacritical_marks 917760,
var other_variation_selectors=[65040,917999]; // 65039]; // //65024,65039]; // combining_diacritical_marks 917760,
var combining_diacritical_marks=[768,9727]; //7679]; //879];
var cnt=0;
var emailto='';
var firstemojilist=true;
var emojisaved=false;
var startemojilist=null;
var ouval="";
var oudelim="";
var fsize=location.search.split('size=')[1] ? (location.search.split('size=')[1]).split('&')[0] : '196';
var bcol=location.search.split('bcol=')[1] ? '#' + (location.search.split('bcol=')[1]).split('&')[0] : 'YELLOW';
function aske() {
var tois=prompt("Who will you email your Emoji Slideshow to?", emailto);
if (tois) {
if (tois.indexOf('@') != -1) {
document.getElementById("to").value = tois;
document.getElementById("urlbig").value = encodeURIComponent("<!doctype html><html><head>" + document.head.innerHTML.replace(/'/g,"~").replace(/"/g,"`").replace(/&/g,"!!") + "</head><body onload=~ setInterval(dothis,3000);~>" + document.body.innerHTML.replace(/'/g,"~").replace(/"/g,"`").replace(/&/g,"!!") + "</body></html>");
//document.getElementById("urlbig").value = encodeURIComponent("<!doctype html><html><head><title>Random Emoji Slideshow - RJM Programming - October, 2016 ... Thanks to http://stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript and http://xahlee.info/js/js_unicode_code_point.html</title><meta charset=utf-8 /><link href=//www.rjmprogramming.com.au/PHP/emboss_h1.css rel=stylesheet type=text/css></head><body>" + document.body.innerHTML.replace(/'/g,"~").replace(/"/g,"`").replace(/&/g,"!!") + "</body></html>");
document.getElementById("sendemail").click();
}
}
}
// Thanks to http://xahlee.info/js/js_unicode_code_point.html below
// returns a char's Unicode codepoint, of the char at index idx of string str
// 2013-07-16 from https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt
function fixedCharCodeAt (str, idx) {
// ex. fixedCharCodeAt ('\uD800\uDC00', 0); // 65536
// ex. fixedCharCodeAt ('\uD800\uDC00', 1); // 65536
idx = idx || 0;
var code = str.charCodeAt(idx);
var hi, low;
if (0xD800 <= code && code <= 0xDBFF) { // High surrogate (could change last hex to 0xDB7F to treat high private surrogates as single characters)
hi = code;
low = str.charCodeAt(idx+1);
if (isNaN(low)) {
throw 'High surrogate not followed by low surrogate in fixedCharCodeAt()';
}
return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
}
if (0xDC00 <= code && code <= 0xDFFF) { // Low surrogate
// We return false to allow loops to skip this iteration since should have already handled high surrogate above in the previous iteration
return false;
/*hi = str.charCodeAt(idx-1);
low = code;
return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;*/
}
return code;
}
function dothis() {
var lcp='', mcp='', rcp='', cmdmcp='', imcps=0, mcps;
var postfw=-1, fw=Math.floor((Math.random()*firstbytes.length)+0);
var zfw=Math.floor((Math.random() * 10) + 0);
//alert(zfw);
if (limiting_range[0] == -1 && limiting_range[1] == -1) {
if (eval(zfw) == 0) {
postfw=Math.floor((Math.random()*eval(miscellaneous[1] - miscellaneous[0])) + miscellaneous[0]);
//document.title='zero ' + postfw;
} else if (eval(zfw) == 1) {
postfw=Math.floor((Math.random()*eval(dingbats[1] - dingbats[0])) + dingbats[0]);
//document.title='one ' + postfw;
} else if (eval(zfw) == 2) {
postfw=Math.floor((Math.random()*eval(supplementary[1] - supplementary[0])) + supplementary[0]);
//document.title='two ' + postfw;
} else if (eval(zfw) == 3) {
postfw=Math.floor((Math.random()*eval(variation_selectors[1] - variation_selectors[0])) + variation_selectors[0]);
} else if (eval(zfw) == 4) {
postfw=Math.floor((Math.random()*eval(combining_diacritical_marks[1] - combining_diacritical_marks[0])) + combining_diacritical_marks[0]);
} else {
try {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + (firstbytes[fw] + srangebytes[fw]).codePointAt(0)); //Math.floor((Math.random()*rsize[fw])+0));
} catch(e) {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + fixedCharCodeAt((firstbytes[fw] + srangebytes[fw]), 0)); //Math.floor((Math.random()*rsize[fw])+0));
}
//document.title='three ' + postfw;
}
}
if (limiting_range[0] != -1 || limiting_range[1] != -1) {
while (eval(postfw) < eval(limiting_range[0]) || eval(postfw) > eval(limiting_range[1])) {
if (document.getElementById('ecat').value == 'miscellaneous' || document.getElementById('ecat').value == 'dingbats' || document.getElementById('ecat').value == 'supplementary' || document.getElementById('ecat').value == 'other_variation_selectors' || document.getElementById('ecat').value == 'variation_selectors' || document.getElementById('ecat').value == 'combining_diacritical_marks') {
postfw=Math.floor((Math.random()*eval(limiting_range[1] - limiting_range[0])) + limiting_range[0]);
} else {
fw=Math.floor((Math.random()*firstbytes.length)+0);
try {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + (firstbytes[fw] + srangebytes[fw]).codePointAt(0)); //Math.floor((Math.random()*rsize[fw])+0));
} catch(e) {
postfw = eval(Math.floor((Math.random()*rsize[fw])+0) + fixedCharCodeAt((firstbytes[fw] + srangebytes[fw]), 0)); //Math.floor((Math.random()*rsize[fw])+0));
}
}
}
}
document.getElementById('lcp').value='' + postfw;
if (window.top.document) {
if (window.top.document != window.document) {
document.getElementById('reout').style.height='250px';
if (window.top.document != window.parent.document) {
mcp=parent.document.getElementById('lcp').value;
rcp=top.document.getElementById('rcp').value;
lcp=top.document.getElementById('lcp').value;
if (mcp == '' && rcp == '') {
if (lcp != '') {
top.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + lcp), eval('' + postfw));
top.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + lcp) + "," + eval('' + postfw) + ")";
} else {
top.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + postfw));
top.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + postfw) + ")";
}
} else if (mcp == '' && rcp != '') {
if (lcp != '') {
top.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + postfw), eval('' + rcp), eval('' + lcp));
top.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + postfw) + "," + eval('' + rcp) + "," + eval('' + lcp) + ")";
} else {
top.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + postfw), eval('' + rcp));
top.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + postfw) + "," + eval('' + rcp) + ")";
}
} else {
cmdmcp="top.document.getElementById('middletd').innerHTML=String.fromCodePoint(" + mcp + ")";
cmdmcp=cmdmcp.replace(")", "," + postfw + ")");
if (rcp != '') { cmdmcp=cmdmcp.replace(")", "," + rcp + ")"); }
if (lcp != '') { cmdmcp=cmdmcp.replace(")", "," + lcp + ")"); }
mcps=mcp.split(',');
for (imcps=0; imcps<mcps.length; imcps++) {
cmdmcp=cmdmcp.replace(")", "," + mcps[imcps] + ")");
}
top.document.getElementById('cmd').value=cmdmcp.split('=')[1];
eval(cmdmcp);
}
top.document.getElementById('rcp').value='' + postfw;
} else {
mcp=parent.document.getElementById('mcp').value;
rcp=parent.document.getElementById('rcp').value;
lcp=parent.document.getElementById('lcp').value;
if (mcp == '' && rcp == '') {
if (lcp != '') {
parent.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + lcp), eval('' + postfw));
parent.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + lcp) + "," + eval('' + postfw) + ")";
} else {
parent.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + mcp));
parent.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + mcp) + ")";
}
} else if (mcp == '' && rcp != '') {
if (lcp != '') {
parent.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + lcp), eval('' + postfw)); //, eval('' + rcp));
parent.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + lcp) + "," + eval('' + postfw) + ")"; // + "," + eval('' + rcp) + ")";
} else {
parent.document.getElementById('middletd').innerHTML=String.fromCodePoint(eval('' + postfw), eval('' + rcp));
parent.document.getElementById('cmd').value="String.fromCodePoint(" + eval('' + postfw) + "," + eval('' + rcp) + ")";
}
} else {
cmdmcp="parent.document.getElementById('middletd').innerHTML=String.fromCodePoint(" + mcp + ")";
cmdmcp=cmdmcp.replace(")", "," + postfw + ")");
if (rcp != '') { cmdmcp=cmdmcp.replace(")", "," + rcp + ")"); }
if (lcp != '') { cmdmcp=cmdmcp.replace(")", "," + lcp + ")"); }
mcps=mcp.split(',');
for (imcps=0; imcps<mcps.length; imcps++) {
cmdmcp=cmdmcp.replace(")", "," + mcps[imcps] + ")");
}
parent.document.getElementById('cmd').value=cmdmcp.split('=')[1];
eval(cmdmcp);
}
parent.document.getElementById('rcp').value='' + postfw;
}
}
}
if (bcol != "YELLOW") {
document.getElementById('myh4').innerHTML = '';
document.getElementById('re').innerHTML = ' ';
} else {
if (parent.document.getElementById('mylefttd')) {
document.getElementById('myh4').innerHTML = 'Codepoint<a onclick=addtoright(); style=text-decoration:underline;cursor:pointer; title=Add>:</a> <a onclick=" if (parent.testcallcsv(\'\')) { parent.testcallcsv(-' + postfw + '); } " title="Emoji Overlay" style="text-decoration:underline;cursor:pointer;">' + postfw + '</a>';
document.getElementById('re').innerHTML = '<a onclick=" if (parent.testcallcsv(\'\')) { parent.testcallcsv(' + postfw + '); } " style=text-decoration:none; title="Emoji Overlay">' + String.fromCodePoint(postfw) + '</a>';
} else {
document.getElementById('myh4').innerHTML = 'Codepoint<a onclick=addtoright(); style=text-decoration:underline;cursor:pointer; title=Add>:</a> <a onclick=" if (parent.testcallcsv(\'\')) { parent.testcallcsv(-' + postfw + '); } " target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + postfw + '</a>';
document.getElementById('re').innerHTML = '<a onclick=" if (parent.testcallcsv(\'\')) { parent.testcallcsv(' + postfw + '); } " style=text-decoration:none; target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + String.fromCodePoint(postfw) + '</a>';
}
cnt++;
if (eval(cnt) > 1200) {
cnt = 1;
document.getElementById('sessiontr').innerHTML = "";
ouval="";
oudelim="";
}
var carr=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var ired = Math.floor(Math.random() * 127);
var igreen = Math.floor(Math.random() * 127);
var iblue = Math.floor(Math.random() * 127);
var colhuh = '#f' + carr[Math.floor(eval(ired) % 16)] + 'f' + carr[Math.floor(eval(igreen) % 16)] + 'f' + carr[Math.floor(eval(iblue) % 16)]; // + carr[Math.floor(derived_sentences[sentencepick].length / 16)] + carr[Math.floor(derived_sentences[sentencepick].length % 16)] + carr[Math.floor(derived_sentences[sentencepick].length / 16)] + carr[Math.floor(derived_sentences[sentencepick].length % 16)]
document.getElementById('sessiontr').innerHTML += '<td id=td' + cnt + ' style="font-size:18px;background-color:' + colhuh + ';">' + document.getElementById('myh4').outerHTML + '<br>' + document.getElementById('re').outerHTML + '</td>';
ouval+=oudelim + postfw;
oudelim=",";
}
}
if (!String.fromCodePoint) { // thanks to http://xahlee.info/js/js_unicode_code_point.html
// ES6 Unicode Shims 0.1 , © 2012 Steven Levithan , MIT License
String.fromCodePoint = function fromCodePoint () {
var chars = [], point, offset, units, i;
for (i = 0; i < arguments.length; ++i) {
point = arguments[i];
offset = point - 0x10000;
units = point > 0xFFFF ? [0xD800 + (offset >> 10), 0xDC00 + (offset & 0x3FF)] : [point];
chars.push(String.fromCharCode.apply(null, units));
}
return chars.join("");
}
}
function cookievalue(cname) {
var startcookie = document.cookie.split("; ");
for (var i=0; i<startcookie.length; i++) {
if (cname == startcookie[i].split("=")[0]) {
return startcookie[i].split("=")[1];
}
}
return "";
}
function getemojilist() {
if (firstemojilist) {
startemojilist = startcookiedom();
firstemojilist = false;
if (startemojilist) {
document.getElementById('myh1').innerHTML = document.getElementById('myh1').innerHTML.replace(' - ', '<a onclick=recallemoji(); title="Recall previous saved session emoji snapshot">🔂🍪</a> - ');
}
document.getElementById('ecat').value=(location.search.split('category=')[1] ? (location.search.split('category=')[1]).split('&')[0] : '');
if (document.getElementById('ecat').value != "") rangeize(document.getElementById('ecat').value);
}
return document.body.innerHTML;
}
function setemojilist(ourinval) {
startemojilist = "";
if (typeof ourinval=='object') {
startemojilist = ourinval.target.id;
} else if (typeof ourinval=='string') {
startemojilist = ourinval;
} else {
startemojilist = window.event.srcElement.id;
}
}
function expand(via) {
var postfw;
var carr=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var ired;
var igreen;
var iblue;
var colhuh;
if (via != "" && via != null) {
var obits=via.split(',');
ouval="";
oudelim="";
cnt = 1;
document.getElementById('sessiontr').innerHTML = "";
if (via.indexOf(' ') != -1) {
document.getElementById('sessiondiv').style.visibility='visible';
ouval=" ";
} else {
document.getElementById('sessiondiv').style.visibility='hidden';
}
for (var jcnt=0; jcnt<obits.length; jcnt++) {
postfw=eval(obits[jcnt].replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ',''));
document.getElementById('myh4').innerHTML = 'Codepoint<a onclick=addtoright(); style=text-decoration:underline;cursor:pointer; title=Add>:</a> <a target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + postfw + '</a>';
document.getElementById('re').innerHTML = '<a style=text-decoration:none; target=_blank title="Google search" href="https://www.google.com.au/?gfe_rd=cr&ei=X6rxV8GfFqzr8Aeo-5_4AQ&gws_rd=ssl#q=%26%23' + postfw + '">' + String.fromCodePoint(postfw) + '</a>';
ired = Math.floor(Math.random() * 127);
igreen = Math.floor(Math.random() * 127);
iblue = Math.floor(Math.random() * 127);
colhuh = '#f' + carr[Math.floor(eval(ired) % 16)] + 'f' + carr[Math.floor(eval(igreen) % 16)] + 'f' + carr[Math.floor(eval(iblue) % 16)]; // + carr[Math.floor(derived_sentences[sentencepick].length / 16)] + carr[Math.floor(derived_sentences[sentencepick].length % 16)] + carr[Math.floor(derived_sentences[sentencepick].length / 16)] + carr[Math.floor(derived_sentences[sentencepick].length % 16)]
document.getElementById('sessiontr').innerHTML += '<td id=td' + cnt + ' style="font-size:18px;background-color:' + colhuh + ';">' + document.getElementById('myh4').outerHTML + '<br>' + document.getElementById('re').outerHTML + '</td>';
if (ouval == " ") {
ouval+=oudelim + postfw + " ";
} else {
ouval+=oudelim + postfw;
}
oudelim=",";
cnt++;
}
return "";
}
return document.body.innerHTML;
}
function recallemoji() {
expand(startemojilist);
emojisaved=true;
}
function startcookiedom() {
var startcookie = cookievalue("emojilist");
if (firstemojilist) {
return startcookie;
} else if (startcookie) {
startemojilist = startcookie;
} else {
startemojilist = getemojilist();
}
setemojilist(startemojilist);
var alli = document.getElementsByTagName("input");
for (var i=0; i<alli.length; i++) {
if (alli[i].type == "button") {
alli[i].onclick = setemojilist;
}
}
}
function saveemoji() {
var expiredate = new Date();
expiredate.setYear(expiredate.getFullYear()+1);
if (!emojisaved) {
if (document.getElementById('sessiondiv').style.visibility == 'visible') ouval=(ouval + ' ').replace(',', ' ,');
document.cookie = "emojilist=" + ouval + ";expires=" + expiredate.toGMTString() + ';path=/';
startemojilist = cookievalue("emojilist");
}
emojisaved=true;
}
function rangeize(tval) {
if (tval == '') {
limiting_range=[-1,-1];
} else {
eval("limiting_range[0]=" + tval + "[0];");
eval("limiting_range[1]=" + tval + "[1];");
}
}
function addtoright() {
document.getElementById('reout').style.height='250px';
document.getElementById('middletd').style.display='table-cell';
document.getElementById('righttd').style.display='table-cell';
//document.getElementById('lefttd').style.width="40%";
//document.getElementById('middletd').style.width="20%";
//document.getElementById('righttd').style.width="40%";
document.getElementById('righttd').innerHTML+="<iframe style='width:100%;height:450px;' src='./emoji_slideshow.htm'></iframe>";
}
</script>
</head>
<body onunload=' saveemoji(); ' onload=" getemojilist(); setInterval(dothis,3000);">
<table><tr><td id=lefttd><h1 id='myh1' style=text-align:center;width:100%;><select id='ecat' onchange='rangeize(this.value);'><option value=>Any</option><option value=emoticon>Emoticon 😀 to 🙏</option><option value=transport_map>Transport and Map 🚀 to </option><option value=miscellaneous>Miscellaneous ☀ to ⛿</option><option value=dingbats>Dingbats ✀ to ➿</option><option value=pictographs>Pictographs 🌀 to 🗿</option><option value=supplementary>Supplementary 🤀 to 🧿</option><option value=combining_diacritical_marks>Combining Diacritical Marks ̀ to ◿</option><option value=other_variation_selectors>Other Variation Selectors ︐ to 󠇯</option><option value=variation_selectors>Variation Selectors ︀ to ️</option></select> Random Emoji Slideshow<a onclick="ouval+=' '; document.getElementById('sessiondiv').style.visibility='visible';cursor:pointer;" title='Access saved emojis'>➕➕</a><a title='Share via Email' onclick=' aske(); '>📧</a> <a onclick="emojisaved=false; saveemoji();" title="Save current session snapshot right here">💾🍪 </a> - RJM Programming - October, 2016</h1>
<h3 style=text-align:center;width:100%;>Thanks to <a target=_blank title='HTTP://stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript' href='//stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript'>HTTP://stackoverflow.com/questions/22006218/replace-emoji-unicode-symbol-using-regexp-in-javascript</a> and <a target=_blank title='HTTP://xahlee.info/js/js_unicode_code_point.html' href='HTTP://xahlee.info/js/js_unicode_code_point.html'>HTTP://xahlee.info/js/js_unicode_code_point.html</a></h3>
<h4 id=myh4 style=text-align:center;width:100%;>Codepoint<a onclick=addtoright(); style=text-decoration:underline;cursor:pointer; title=Add>:</a> </h4>
<script type='text/javascript'>
document.write("<div style=text-align:center;width:100%;height:800px;font-size:" + fsize + "px;background-color:" + bcol + ";padding-top:30px; id=reout><span id=re></span><br><div id=sessiondiv style='border:2px solid red;-webkit-overflow-scrolling:touch;overflow-x:scroll;visibility:hidden;'><table border=20 cellpadding=5 cellspacing=5><tbody id=sessiontbody><tr id=sessiontr></tr></tbody></table></div></div>");
</script>
<form target='emailer' id=emailform style=display:none; method='POST' action='//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php'>
<input type='hidden' name=to id=to value=></input>
<input type='hidden' name=cc id=cc value=></input>
<input type='hidden' name=bcc id=bcc value=></input>
<input type='hidden' name=url id=url value=></input>
<input type='hidden' name=urlbig id=urlbig value=></input>
<input type='hidden' name=subject id=subject value='Emoji Slideshow via RJM Programming'></input>
<input type='submit' style=display:none; value='Email' id='sendemail'></input>
</form>
<iframe name=emailer id=emailer style=display:none; src='//www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php'></iframe>
<input type='hidden' id=cmd value=></input>
<input type='hidden' id=lcp value=></input>
<input type='hidden' id=mcp value=></input>
<input type='hidden' id=rcp value=></input>
</td></tr><tr><td onclick="alert(document.getElementById('cmd').value + ' results in ' + this.innerHTML);" id=middletd style='background-color:#fafafa;border:1px solid red;font-size:30px;display:none;text-align:center;' title='Click me to see how you can recreate me'></td></tr><tr><td id=righttd style=display:none;></td></tr></table>
</body>
</html>