diff --git a/list.js b/list.js
index 8fa2487..2d13f35 100644
--- a/list.js
+++ b/list.js
@@ -12,11 +12,7 @@ const mailer = new UltraSES({
const menu = [
- {
- 'name': 'butter chicken in silky sauce',
- 'url': 'http://www.marksdailyapple.com/butter-chicken-in-a-silky-sauce/#axzz29jTSubMo',
- 'hash': '5117109d69d399915c0959eabbc383f9'
-}, {
+ {
'name': 'steak',
'url': 'https://www.farmison.com/community/recipe/how-to-cook-your-beef-fillet-steak',
'hash': '35e244830bde1d967298fb9a585854f7'
diff --git a/live/js/readability.js b/live/js/readability.js
new file mode 100644
index 0000000..375d22b
--- /dev/null
+++ b/live/js/readability.js
@@ -0,0 +1,358 @@
+var readabilityVersion = '2';
+var readStyle = 'style-ebook';
+var readSize = 'size-medium';
+var readMargin = 'margin-wide';
+(function() {
+ // removing all existing scripts so they don't cause conflicts...
+ var docscripts = document.getElementsByTagName('script');
+ for (k = 0;k < docscripts.length; k++)
+ if (docscripts[k].src != null && ! docscripts[k].src.match(/readability|[Cc]lippability/))
+ docscripts[k].parentNode.removeChild(docscripts[k]);
+
+ // let's just load jQuery and get it over with
+ var gjs = document.createElement('SCRIPT');
+ gjs.type = 'text/javascript';
+ gjs.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js';
+ document.getElementsByTagName('head')[0].appendChild(gjs);
+ gjs.onload = gjs.onreadystatechange = function() {
+ $('script').each(function() {
+ // jQuery gets scripts inside of conditional comments far more easily than I could figure out
+ if (! this.src.match(/readability|[Cc]lippability|jquery\.min\.js$/)) $(this).remove();
+ });
+ };
+
+ var objOverlay = document.createElement('div');
+ var objinnerDiv = document.createElement('div');
+
+ objOverlay.id = 'readOverlay';
+ objinnerDiv.id = 'readInner';
+
+ // Apply user-selected styling:
+ document.body.className = readStyle;
+ objOverlay.className = readStyle;
+ objinnerDiv.className = `${readMargin } ${ readSize}`;
+
+ objinnerDiv.appendChild(grabArticle()); // Get the article and place it inside the inner Div
+ objOverlay.appendChild(objinnerDiv); // Insert the inner div into the overlay
+
+ // For totally hosed HTML, add body node that can't be found because of bad HTML or something.
+ if(document.body == null) {
+ body = document.createElement('body');
+ document.body = body;
+ }
+
+ document.body.innerHTML = '';
+
+ // Inserts the new content :
+
+ document.body.insertBefore(objOverlay, document.body.firstChild);
+ var o = document.body.firstChild;
+
+ return o.innerHTML;
+})();
+
+function getElementsByClassName(classname, node) {
+ if(!node) node = document.getElementsByTagName('body')[0];
+ var a = [];
+ var re = new RegExp(`\\b${ classname }\\b`);
+ var els = node.getElementsByTagName('*');
+ for(var i = 0, j = els.length; i < j; i++)
+ if(re.test(els[i].className))a.push(els[i]);
+
+ return a;
+}
+
+function grabArticle() {
+ var allParagraphs = document.getElementsByTagName('p');
+ var topDivCount = 0;
+ var topDiv = null;
+ var topDivParas;
+
+ var articleContent = document.createElement('DIV');
+ var articleTitle = document.createElement('H1');
+ var articleFooter = document.createElement('DIV');
+
+ // Replace all doubled-up
tags with
tags, and remove fonts.
+ var pattern = new RegExp ('
[ \r\n\s]*
', 'g');
+ document.body.innerHTML = document.body.innerHTML.replace(pattern, '
').replace(/<\/?font[^>]*>/g, ''); + + // Grab the title from the
's, commas, special classes, etc. + for (var j = 0; j < allParagraphs.length; j++) { + parentNode = allParagraphs[j].parentNode; + + // Initialize readability data + if(typeof parentNode.readability === 'undefined') { + parentNode.readability = { 'contentScore': 0 }; + + // Look for a special classname + if(parentNode.className.match(/(comment|meta|footer|footnote)/)) + parentNode.readability.contentScore -= 50; + else if(parentNode.className.match(/((^|\\s)(post|hentry|entry[-]?(content|text|body)?|article[-]?(content|text|body)?)(\\s|$))/)) + parentNode.readability.contentScore += 25; + + // Look for a special ID + if(parentNode.id.match(/(comment|meta|footer|footnote)/)) + parentNode.readability.contentScore -= 50; + else if(parentNode.id.match(/^(post|hentry|entry[-]?(content|text|body)?|article[-]?(content|text|body)?)$/)) + parentNode.readability.contentScore += 25; + } + + // Add a point for the paragraph found + if(getInnerText(allParagraphs[j]).length > 10) + parentNode.readability.contentScore++; + + // Add points for any commas within this paragraph + parentNode.readability.contentScore += getCharCount(allParagraphs[j]); + } + + // Assignment from index for performance. See http://www.peachpit.com/articles/article.aspx?p=31567&seqNum=5 + for(nodeIndex = 0; (node = document.getElementsByTagName('*')[nodeIndex]); nodeIndex++) + if(typeof node.readability !== 'undefined' && (topDiv == null || node.readability.contentScore > topDiv.readability.contentScore)) + topDiv = node; + + if(topDiv == null) { + topDiv = document.createElement('div'); + topDiv.innerHTML = 'Sorry, clippable was unable to parse this page for content. If you feel like it should have been able to, please let us know.'; + } + + // REMOVES ALL STYLESHEETS ... + for (var k = 0;k < document.styleSheets.length; k++) + if (document.styleSheets[k].href != null && document.styleSheets[k].href.lastIndexOf('readability') == -1) + document.styleSheets[k].disabled = true; + + var sh = getElementsByClassName('syntaxhighlighter'); + for (var i = 0;i < sh.length;i++) { + var bar = getElementsByClassName('toolbar', sh[i]); + if (bar.length > 0) + for (var bn = 0;bn < bar.length;bn++) + bar[bn].parentNode.removeChild(bar[bn]); + + var numbers = getElementsByClassName('number', sh[i]); + if (numbers.length > 0) + for (var num = 0;num < numbers.length;num++) + numbers[num].parentNode.removeChild(numbers[num]); + } + + var dp = getElementsByClassName('dp-highlighter'); + for (var d = 0;d < dp.length;d++) + dp[d].parentNode.removeChild(dp[d]); + + var sth = getElementsByClassName('standardLighter'); + for (d = 0;d < sth.length;d++) + sth[d].parentNode.removeChild(sth[d]); + + // Remove all style tags in head (not doing this on IE) : + var styleTags = document.getElementsByTagName('style'); + for (var l = 0;l < styleTags.length; l++) + if (navigator.appName != 'Microsoft Internet Explorer') + styleTags[l].textContent = ''; + + topDiv = killCodeSpans(topDiv); // removes span tags + cleanStyles(topDiv); // Removes all style attributes + topDiv = killDivs(topDiv); // Goes in and removes DIV's that have more non
stuff than
stuff
+ topDiv = killBreaks(topDiv); // Removes any consecutive
's into just one
+
+ // Cleans out junk from the topDiv just in case:
+ topDiv = clean(topDiv, 'form');
+ // topDiv = clean(topDiv, "object");
+ topDiv = clean(topDiv, 'table', 8);
+ topDiv = clean(topDiv, 'h1');
+ // topDiv = clean(topDiv, "h2");
+ topDiv = clean(topDiv, 'iframe');
+
+ // Add the footer and contents:
+ articleFooter.id = 'readFooter';
+ articleFooter.innerHTML = `\
+ \
+ \
+ Follow us on Twitter »\
+