<html>
<head>
<title>Linked Sentence Creator - RJM Programming - March, 2024</title>
<style>
a {
text-decoration: none;
cursor: pointer;
}
.red {
background-color: rgba(255,0,0,0.3);
}
.yellow {
background-color: rgba(255,255,0,0.3);
}
.green {
background-color: rgba(0,255,0,0.3);
}
</style>
<script type='text/javascript'>
var wo=null;
var lasta=null, lastahref='';
var curlspan=0, currspan=0, snum='';
var inspan=('' + location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'')).split('span=')[1] ? (decodeURIComponent(('' + location.search + ('' + location.hash).replace(/^null/g,'').replace(/^undefined/g,'')).split('span=')[1].split('&')[0])) : '';
var thirdparam='';
var firstparam='';
var athisih='';
function putback() {
if (lasta && lastahref != '') {
lasta.href=lastahref;
lasta=null;
lastahref='';
}
}
function analyze(athis) {
var retval=true, wincont='';
if (('' + athis.href + '#').substring(0,1) != '#') {
athisih=athis.innerHTML;
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && ('' + location.hash).indexOf('=') != -1) {
var arect=athis.getBoundingClientRect();
if (wo) {
if (!wo.closed) {
wo.close();
wo=null;
}
}
var proposedw=eval(eval('' + screen.width) - eval('' + arect.right));
var proposedh=eval(eval('' + screen.height) - eval('' + arect.bottom));
//alert('' + proposedw + ',' + proposedh + ' for ' + athis.href + ' ... ' + ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0]);
//try {
if (proposedw > 0 && proposedh > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0] + (',height=' + proposedh).split('.')[0];
} else if (proposedw > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',width=' + proposedw).split('.')[0];
} else if (proposedh > 0 && 5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',height=' + proposedh).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0] + (',height=' + proposedh).split('.')[0];
} else if (5 == 5) {
//wo=window.open(athis.href,'_blank', ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0]);
thirdparam=('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0];
}
//alert(('' + athis.href) + ' in ' + athis.outerHTML);
if (document.URL.split('//')[1].split('/')[0].toLowerCase().indexOf('rjmprogramming.com.au') != -1 && ('' + athis.href).indexOf('youtube.com/watch?v=') != -1) {
var athishref=document.URL.split(':')[0] + '://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '&youtube_duration=11202.221&email=&email=&emoji=on&c0=on&i0=0&j0=11202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=';
wincont='<html><body><iframe width="420" height="315" src="https://www.youtube.com/embed/' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '" frameborder="0" allowfullscreen></iframe><br><iframe src="' + athishref + '" style="width:100%;height:800px;"></iframe></body></html>';
athis.href=document.URL.split(':')[0] + '://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?youtubeid=' + ('' + athis.href).split('youtube.com/watch?v=')[1].split('&')[0].split('#')[0] + '&youtube_duration=11202.221&email=&email=&emoji=on&c0=on&i0=0&j0=11202.221&i1=&j1=&i2=&j2=&i3=&j3=&i4=&j4=&i5=&j5=&i6=&j6=&i7=&j7=&i8=&j8=&i9=&j9=&i10=&j10=&i11=&j11=&i12=&j12=&i13=&j13=&i14=&j14=&i15=&j15=&i16=&j16=&i17=&j17=&i18=&j18=&i19=&j19=&i20=&j20=&i21=&j21=&i22=&j22=&i23=&j23=&i24=&j24=&i25=&j25=&i26=&j26=&i27=&j27=&i28=&j28=&i29=&j29=';
} // 202.221
//alert(thirdparam + ' ... ' + wincont);
if (athis.href.indexOf('wikipedia.org') == -1 && athis.href.indexOf(document.URL.split('//')[1].split('/')[0].replace(/^www\./g, '')) == -1) {
thirdparam='';
}
//alert(thirdparam + ' .+. ' + athis.href);
//} catch(reytre) {
//alert(0);
//}
// if (wo) {
// alert(1);
// if (wo.closed) {
// alert(11);
// wo=null;
// } else {
// alert(111);
// }
// }
if (!wo) {
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && ('' + location.hash).indexOf('=') != -1 && thirdparam != '') {
if (wincont != '') {
wo=window.open('','_blank', thirdparam);
wo.document.write(wincont);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
} else {
wo=window.open(athis.href,'_blank', thirdparam); //, ('top=' + arect.bottom).split('.')[0] + (',left=' + arect.right).split('.')[0]);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
}
} else {
if (wincont != '') {
wo=window.open('','_blank');
wo.document.write(wincont);
setTimeout(function(){ wo.document.title=athisih; }, 3000);
} else {
wo=window.open(athis.href,'_blank');
setTimeout(function(){ wo.document.title=athisih; }, 3000);
}
}
}
lastahref=athis.href;
lasta=athis;
athis.href='#';
setTimeout(putback, 2000);
retval=false;
}
}
return retval;
}
function lfidea(proposedihw) { // thanks to https://stackoverflow.com/questions/14217101/what-character-represents-a-new-line-in-a-text-area
var wasline='', isline='', brdelim='';
//alert(proposedihw);
if (proposedihw.indexOf(String.fromCharCode(10) + String.fromCharCode(13)) != -1) {
//alert('Here');
while (proposedihw.indexOf(String.fromCharCode(10) + String.fromCharCode(13)) != -1) {
proposedihw=proposedihw.replace(String.fromCharCode(10) + String.fromCharCode(13), '<br>');
}
}
if (proposedihw.indexOf(String.fromCharCode(13) + String.fromCharCode(10)) != -1) {
//alert('Here2');
while (proposedihw.indexOf(String.fromCharCode(13) + String.fromCharCode(10)) != -1) {
proposedihw=proposedihw.replace(String.fromCharCode(13) + String.fromCharCode(10), '<br>');
}
}
if (proposedihw.indexOf(String.fromCharCode(13)) != -1) {
//alert('Here3');
while (proposedihw.indexOf(String.fromCharCode(13)) != -1) {
proposedihw=proposedihw.replace(String.fromCharCode(13), '<br>');
}
}
if (proposedihw.indexOf(String.fromCharCode(10)) != -1) {
//alert('Here4');
while (proposedihw.indexOf(String.fromCharCode(10)) != -1) {
proposedihw=proposedihw.replace(String.fromCharCode(10), '<br>');
}
}
var multilines=proposedihw.split('<br>');
for (var im=0; im<multilines.length; im++) {
if (multilines[im].indexOf(' ') == 0) {
wasline=brdelim + multilines[im];
isline=brdelim + multilines[im];
while (multilines[im].indexOf(' ') == 0) {
multilines[im]=multilines[im].replace(' ',' ');
isline=isline.replace(' ',' ');
}
proposedihw=proposedihw.replace(wasline, isline);
}
brdelim='<br>';
}
return proposedihw; //.replace(/\~\~/g, '<br>');
}
function nuance(proposedlinkw) {
if (proposedlinkw.indexOf('//') == 0) { return document.URL.split(':')[0] + ':' + proposedlinkw; }
return proposedlinkw;
}
function fleshout(proposedl) {
var wasv=document.getElementById(proposedl).value;
if (document.getElementById(proposedl).value.trim() != '') {
if (document.getElementById(proposedl).value.substring(0,1) != '#') {
if (document.getElementById(proposedl).value.toLowerCase().indexOf('http:') != -1 || document.getElementById(proposedl).value.toLowerCase().indexOf('https:') != -1) {
return proposedl;
} else if (document.getElementById(proposedl).value.toLowerCase().indexOf('www.') == 0) {
document.getElementById(proposedl).value='//' + wasv;
return proposedl;
} else if (document.getElementById(proposedl).value.indexOf('//') == 0) {
return proposedl;
} else if (document.getElementById(proposedl).value.indexOf('/') == 0) {
document.getElementById(proposedl).value=document.URL.split('//')[0] + '//' + document.URL.split('//')[1].split('/')[0] + wasv;
return proposedl;
} else if (document.getElementById(proposedl).value.indexOf('..') == 0) {
document.getElementById(proposedl).value=document.URL.split('linked_sentence_creator.htm')[0] + '' + wasv;
return proposedl;
} else if (document.getElementById(proposedl).value.indexOf('./') == 0) {
document.getElementById(proposedl).value=document.URL.split('linked_sentence_creator.htm')[0] + '/' + wasv.substring(2);
return proposedl;
} else if (document.getElementById(proposedl).value.indexOf('.') == 0) {
document.getElementById(proposedl).value=document.URL.split('linked_sentence_creator.htm')[0] + '/' + wasv.substring(1);
return proposedl;
} else {
document.getElementById(proposedl).value='//' + wasv;
return proposedl;
}
}
}
return proposedl;
}
function modifydothis(forwhat) {
if (document.getElementById('ilmodify').value == '' && document.getElementById('iwmodify').value == '') {
return '';
}
if (document.getElementById(fleshout('ilmodify')).value != '') {
document.getElementById(forwhat.id).innerHTML=lfidea(document.getElementById('iwmodify').value);
document.getElementById(forwhat.id).href=document.getElementById('ilmodify').value;
} else {
document.getElementById(forwhat.id).innerHTML=lfidea(document.getElementById('iwmodify').value);
document.getElementById(forwhat.id).href='#';
}
if (document.getElementById(forwhat.id).href.substring(0,1) == '#') {
document.getElementById(forwhat.id).target='_self';
document.getElementById(forwhat.id).title='';
} else {
document.getElementById(forwhat.id).target='_blank';
document.getElementById(forwhat.id).title='Linking to ' + nuance(document.getElementById('ilmodify').value);
}
document.getElementById('ilmodify').value='';
document.getElementById('iwmodify').value='';
document.getElementById('ibmodify').disabled=true;
document.getElementById('instruction').innerHTML='';
return '';
}
function enabling(forwhat) {
if (forwhat.value != '') {
document.getElementById(('' + forwhat.id).replace('iw', 'ib')).disabled=false;
if (forwhat.id.indexOf('append') != -1) {
document.getElementById('ilmodify').value='';
document.getElementById('iwmodify').value='';
document.getElementById('ibmodify').disabled=true;
document.getElementById('ilprepend').value='';
document.getElementById('iwprepend').value='';
document.getElementById('ibprepend').disabled=true;
} else if (forwhat.id.indexOf('prepend') != -1) {
document.getElementById('ilmodify').value='';
document.getElementById('iwmodify').value='';
document.getElementById('ibmodify').disabled=true;
document.getElementById('ilappend').value='';
document.getElementById('iwappend').value='';
document.getElementById('ibappend').disabled=true;
} else if (forwhat.id.indexOf('modify') != -1) {
document.getElementById('ilprepend').value='';
document.getElementById('iwprepend').value='';
document.getElementById('ibprepend').disabled=true;
document.getElementById('ilappend').value='';
document.getElementById('iwappend').value='';
document.getElementById('ibappend').disabled=true;
}
} else {
document.getElementById(('' + forwhat.id).replace('iw', 'ib')).disabled=true;
}
}
function doit(forwhat) {
var curis=document.getElementById('a' + curlspan).innerHTML;
var ao=null;
var tb=' target=_blank ';
if (document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value != '') {
if (('' + forwhat.id).indexOf('modify') != -1) {
var ahuhs=document.getElementsByTagName('a');
for (var ihuhs=0; ihuhs<ahuhs.length; ihuhs++) {
//alert('*' + document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value + '*vs*' + ahuhs[ihuhs].innerHTML + '*');
if (document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value == ahuhs[ihuhs].innerHTML) {
ao=ahuhs[ihuhs];
}
}
if (ao) {
modifydothis(ao);
} else {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('instruction').innerHTML='Shape to spread sentence part to modify.';
} else {
document.getElementById('instruction').innerHTML='Right click sentence part to modify.';
}
}
} else if (('' + forwhat.id).indexOf('append') != -1) {
if (document.getElementById(fleshout(('' + forwhat.id).replace('ib', 'il'))).value != '') {
if (document.getElementById(('' + forwhat.id).replace('ib', 'il')).value.substring(0,1) == '#') { tb=''; }
document.getElementById('a' + currspan).innerHTML+='</a> <a onclick="return analyze(this);" id=a' + eval(1 + currspan) + tb + ' ontouchstart="event.stopPropagation(); event.preventDefault(); modifydothis(this); " oncontextmenu="event.stopPropagation(); modifydothis(this); " title="Linking to ' + nuance(document.getElementById(('' + forwhat.id).replace('ib', 'il')).value) + '" href="' + document.getElementById(('' + forwhat.id).replace('ib', 'il')).value + '">' + lfidea(document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value);
} else {
document.getElementById('a' + currspan).innerHTML+='</a> <a onclick="return analyze(this);" id=a' + eval(1 + currspan) + ' ontouchstart="event.stopPropagation(); event.preventDefault(); modifydothis(this); " oncontextmenu="event.stopPropagation(); modifydothis(this); " title="" href=#>' + lfidea(document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value);
}
currspan++;
document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value='';
document.getElementById(('' + forwhat.id).replace('ib', 'il')).value='';
forwhat.disabled=true;
} else if (('' + forwhat.id).indexOf('prepend') != -1) {
if (document.getElementById(fleshout(('' + forwhat.id).replace('ib', 'il'))).value.substring(0,1) == '#') { tb=''; }
if (document.getElementById(('' + forwhat.id).replace('ib', 'il')).value != '') {
document.getElementById('a' + curlspan).innerHTML='<a onclick="return analyze(this);" id=a' + eval(-1 + curlspan) + tb + ' ontouchstart="event.stopPropagation(); event.preventDefault(); modifydothis(this); " oncontextmenu="event.stopPropagation(); modifydothis(this); " title="Linking to ' + nuance(document.getElementById(('' + forwhat.id).replace('ib', 'il')).value) + '" href="' + document.getElementById(('' + forwhat.id).replace('ib', 'il')).value + '">' + lfidea(document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value) + ' ' + curis;
} else {
document.getElementById('a' + curlspan).innerHTML='<a onclick="return analyze(this);" id=a' + eval(-1 + curlspan) + ' ontouchstart="event.stopPropagation(); event.preventDefault(); modifydothis(this); " oncontextmenu="event.stopPropagation(); modifydothis(this); " title="" href=#>' + lfidea(document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value) + ' ' + curis;
}
curlspan--;
document.getElementById(('' + forwhat.id).replace('ib', 'iw')).value='';
document.getElementById(('' + forwhat.id).replace('ib', 'il')).value='';
forwhat.disabled=true;
}
} else {
document.getElementById('instruction').innerHTML='';
}
}
function process(inlook) {
if (inlook == '') { return ''; }
if (inlook.indexOf('<span') == 0) {
document.getElementById('span0').innerHTML=inlook.split('</span>')[0].replace(inlook.split('>')[0] + '>', '').replace(/\ ontouchstart\=/g, ' data-ontouchstart=');
} else {
document.getElementById('span0').innerHTML=inlook.replace(/\ ontouchstart\=/g, ' data-ontouchstart=');
}
var kasl=0;
var asl=document.getElementsByTagName('a');
for (var iasl=0; iasl<asl.length; iasl++) {
if (('' + asl[iasl].id + ' ').substring(0,1) == 'a') {
if (asl[iasl].outerHTML.indexOf(' onclick=') == -1) {
asl[iasl].onclick=function(event){ analyze(event.target); };
}
kasl=eval(('' + asl[iasl].id + '').substring(1));
if (kasl < curlspan) { curlspan=kasl; }
if (kasl > currspan) { currspan=kasl; }
}
}
}
function doemail(inidea) {
var azx=document.getElementById('aemail');
if (!azx) { azx=document.createElement("a"); }
document.body.appendChild(azx);
azx.style = "display: none";
azx.id = 'aemail';
azx.href = 'mailto:' + inidea + '?subject=' + encodeURIComponent('My Linked Sentence Story') + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#span=' + encodeURIComponent(document.getElementById('span0').innerHTML));
azx.click();
return '';
}
function dosms() {
snum=('' + prompt('Please enter SMS number to send to.', snum)).replace(/^null/g,'');
if (snum.indexOf('@') != -1) {
return doemail(snum);
} else if (snum.trim() != '') {
var azx=document.getElementById('asms');
if (!azx) { azx=document.createElement("a"); }
document.body.appendChild(azx);
azx.id = 'asms';
azx.style = "display: none";
azx.href = 'sms:' + snum + '&body=' + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + '#span=' + encodeURIComponent(document.getElementById('span0').innerHTML));
azx.click();
}
return '';
}
</script>
</head>
<body onload="process(inspan); if (window.parent == window.self) { if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { document.getElementById('ilmodify').focus(); } }">
<h1>Linked Sentence Creator <button title='Share via Email' id=semail onclick="doemail('');">📧</button> <button title='Share via SMS' id=ssms onclick=dosms();>📟</button></h1>
<h3>RJM Programming - March, 2024</h3><br><br>
<span title='Each sentence part is linked, even if a boring (default) hashtagged arrangement, but you can Modify and add a link arrangement at any time, anywhere.' id='span0' style='margin:2 5 5 2;padding:1 1 1 1;line-height:38px;font-size:28px;border:3px dotted pink;background-color:rgb(240,240,240);'><a onclick="return analyze(this);" ontouchstart="event.stopPropagation(); event.preventDefault(); modifydothis(this); " oncontextmenu="event.stopPropagation(); modifydothis(this); " data-title="" id="a0" href='#'>Once upon a time</a> </span>
<br><br><br>
<table cellpadding=8 cellspacing=8 style='width:95%;' border=5>
<tr><th style="background-color:white;" colspan=3>Regarding Sentence above ... <span id=instruction></span></th></tr>
<colgroup>
<col class="red" />
<col class="yellow" />
<col class="green" />
</colgroup>
<tr><th style='text-align:left;'>Prepend ...</th><th style='text-align:center;'>Modify</th><th style='text-align:right;'>... Append</th></tr>
<tr><td id=tdprepend style='text-align:left;'>
<textarea rows=1 data-usedtobe='input type=text' style='width:80%;text-align:left;' placeholder='Sentence part goes here' value='' id=iwprepend onblur=enabling(this);></textarea><br>
<input style='width:80%;text-align:left;' type=url placeholder='Optional link goes here' value='' id=ilprepend></input><br><br>
<input style='width:80%;text-align:left;' type=button value='Prepend' id=ibprepend onclick=doit(this); disabled></input><br>
</td>
<td id=tdmodify style='text-align:center;'>
<textarea rows=1 data-usedtobe='input type=text' style='width:80%;text-align:center;' title='Sentence part replacement goes here' data-usedtobeblurb=' ... please note that anywhere ~~ can be used for a line feed' placeholder='Sentence part replacement goes here' value='Once upon a time' id=iwmodify onblur=enabling(this);>Once upon a time</textarea><br>
<input style='width:80%;text-align:center;' type=url title='Optional link goes here' placeholder='Optional link goes here' value='#' id=ilmodify></input><br><br>
<input style='width:80%;text-align:center;' type=button value='Modify' id=ibmodify onclick=doit(this);></input><br>
</td>
<td id=tdappend style='text-align:right;'>
<textarea rows=1 data-usedtobe='input type=text' style='width:80%;text-align:right;' placeholder='Sentence part goes here' value='' id=iwappend onblur=enabling(this);></textarea><br>
<input style='width:80%;text-align:right;' type=url placeholder='Optional link goes here' value='' id=ilappend></input><br><br>
<input style='width:80%;text-align:right;' type=button value='Append' id=ibappend onclick=doit(this); disabled></input><br>
</td></tr>
</table>
</body>
</html>