/*
 This file is for solitary functions, that can be copied no projects,
the functions are too random to be an object.

I have manually tested each one of these, but its the type of code that unit tests poorly.

*/

// ripped from https://stackoverflow.com/questions/12241251/is-it-possible-to-get-the-width-of-the-window-in-em-units-using-javascript#
// jQUERY: $(window).width() / parseFloat($("body").css("font-size"));
function elementWidthAsEm(doc, id) {
	let bb  = null;
	if(typeof id=='string') { bb= doc.getElementById(id); }
	else { bb=doc.getElementsByTagName('body')[0]; }

	let stl = window.getComputedStyle(bb,null);
	return parseInt(stl.width) / parseInt(stl['fontSize'])
}

// jQUERY: $(document).ready(function() {...});
// ripped from https://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery
function ready(callback) {
    if (document.readyState!='loading') callback();
    else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback);
    else document.attachEvent('onreadystatechange', function(){
        if (document.readyState=='complete') callback();
    });
}

// function with jquery from a corporate repo. NOT PRESENTED HERE
// version without, mine, and OSS 
function translateFooter () {
	let footer = (document.getElementsByTagName("footer"));
	if(footer.length===0) { return false; }
	footer=footer[0];	
	let pos=footer.getBoundingClientRect();
        let height = document.documentElement.clientHeight;
        height = height - pos.top;
        height = height - footer.clientHeight;
        if (height > 0) {
        	footer.setAttribute('style', 'margin-top: '+ height + 'px');
		return true;
        }
	return false;
}



@@ -53,17 +53,19 @@
  copied 
-n
+int
 o projec
@@ -897,16 +897,18 @@
 oading')
+ %7B
  callbac
@@ -907,24 +907,25 @@
  callback();
+%7D
 %0A    else if
@@ -952,16 +952,18 @@
 istener)
+ %7B
  documen
@@ -1011,16 +1011,18 @@
 llback);
+ %7D
 %0A    els
@@ -1122,16 +1122,18 @@
 mplete')
+ %7B
  callbac
@@ -1136,16 +1136,18 @@
 lback();
+ %7D
 %0A    %7D);
@@ -1678,16 +1678,17 @@
  'px');%0A
+%09
 %09%09return

Add brackets to copied code