<!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'>
<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 cnt=0;
var emailto='';
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 postfw, 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));
}
if (bcol != "YELLOW") {
document.getElementById('myh4').innerHTML = '';
document.getElementById('re').innerHTML = ' ';
} else {
document.getElementById('myh4').innerHTML = 'Codepoint: <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>';
cnt++;
if (eval(cnt) > 1200) {
cnt = 1;
document.getElementById('sessiontr').innerHTML = "";
}
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>';
}
}
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("");
}
}
</script>
</head>
<body onload=' setInterval(dothis,3000);'>
<h1 style=text-align:center;width:100%;>Random Emoji Slideshow<a onclick="document.getElementById('sessiondiv').style.visibility='visible';cursor:pointer;" title='Access saved emojis'>➕➕</a><a title='Share via Email' onclick=' aske(); '>📧</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='http://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: <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='http://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='http://www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php'></iframe>
</body>
</html>