Skip to content

Commit

Permalink
add github-rss
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-armour committed Mar 31, 2016
1 parent f2dc825 commit 980c311
Show file tree
Hide file tree
Showing 18 changed files with 542 additions and 210 deletions.
114 changes: 114 additions & 0 deletions cookbook-html/snippets/github-api-rss/github-rss/github-rss-r1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!doctype html>
<html lang=en >
<head>
<meta charset=utf-8 >
<title>GitHub RSS</title>
<!--
<meta name = viewport content = 'width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0' />
<meta name=viewport content='initial-scale=1, minimal-ui, minimum-scale=1, maximum-scale=1, user-scalable=no, width=device-width' >
-->
<meta name=viewport content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui' >
<meta name=description content='read GitHub Atom feeds' >
<meta name=keywords content='WebGL,Three.js,Tween.js,JavaScript,GitHub,FOSS,3D,STEM' >
<meta name=date content='2016-03-30' >
</head>
<body>
<script>

var rss = 'http://github.com/ladybug-analysis-tools/ladybug-web/commits/gh-pages.atom';

init();

function init() {

var css, contents;
var css = document.body.appendChild( document.createElement( 'style' ) );
css.innerHTML =

'body { font: 12pt monospace; }' +
// 'h2 { margin: 0; }' +
'h2 a { text-decoration: none; }' +

'button, input[type=button] { background-color: #eee; border: 2px #eee solid; color: #888; }' +

'input[type=range] { -webkit-appearance: none; -moz-appearance: none; background-color: silver; width: 160px; }' +
'input[type=range]::-moz-range-thumb { background-color: #888; border-radius: 0; width: 10px; }' +
'input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; background-color: #888; height: 20px; width: 10px; }' +

// '#menu { margin: 0 20px; max-width: 300px; position: absolute; }' +

'';

contents = document.body.appendChild( document.createElement( 'div' ) );
contents.id = 'contents';
contents.innerHTML =

'<h2>' +
'<a href="" >' + document.title + '</a>' +
'<a href=http://jaanga.github.io/ > &#x24D8; </a>' +
'</h2>' +

'<p>lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?</p>' +
'<p>Zoom: <input type=range id=inp min=0 max=10 step=1 value=5 oninput=out.value=inp.value; title="0 to 10: OK" > <output id=out >5</output></p>' +
'<p>Pretty colors: <input type=checkbox id=inpPretty checked ></p>' +
'<p>Overlay: <select id=selList title="Select the 2D overlay" >select option<select></p>' +
'<p><button onclick=saveIt(); value="Save as PNG" >Save</button></p>' +
'<p>' +
'<input type=radio name=field id=but1 />button 1' +
'<input type=radio name=field id=but2 checked />button 2' +
'<input type=radio name=field id=but3 />button 3' +
'</p>' +

'<div id=info ></div>' +

'';

/*
var xhr = new XMLHttpRequest();
xhr.onload = function() {
console.log(xhr.responseXML.documentElement.nodeName);
}
xhr.onerror = function() {
console.log("Error while getting XML.");
}
xhr.open("GET", rss );
xhr.responseType = "document";
xhr.send();
*/


requestFile( rss );

}


function requestFile( fileName ) {

var xhr = new XMLHttpRequest();
xhr.crossOrigin = "Anonymous";
xhr.open( 'GET', fileName, true );
xhr.onreadystatechange = callback;
xhr.send( null );

function callback() {

if ( xhr.readyState != 4 ) { return; }
text = xhr.responseText;
var lines = text.split(/\r\n|\n/);

console.log( text );

}

}

</script>
</body>
</html>
9 changes: 9 additions & 0 deletions cookbook-html/snippets/github-api-rss/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
github api
===


http://ladybug-analysis-tools.github.io/ladybug-web/index.html#github-api/api-explorer/readme.md

http://ladybug-analysis-tools.github.io/ladybug-web/github-api/api-explorer/ladybug-github-api-explorer-r1.html

http://jaanga.github.io/demo/pm/index.html
19 changes: 10 additions & 9 deletions cookbook-html/templates/basic-html/basic-html.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,31 @@

function init() {

var css, contents;
var css = document.body.appendChild( document.createElement( 'style' ) );
css.innerHTML =

'body { font: 12pt monospace; margin: 0; }' +
'h2 { margin: 0; }' +
'a { text-decoration: none; }' +
'body { font: 12pt monospace; }' +
// 'h2 { margin: 0; }' +
'h2 a { text-decoration: none; }' +

'button, input[type=button] { background-color: #eee; border: 2px #eee solid; color: #888; }' +

'input[type=range] { -webkit-appearance: none; -moz-appearance: none; background-color: silver; width: 160px; }' +
'input[type=range]::-moz-range-thumb { background-color: #888; border-radius: 0; width: 10px; }' +
'input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; background-color: #888; height: 20px; width: 10px; }' +

'#menu { margin: 0 20px; max-width: 300px; position: absolute; }' +
// '#menu { margin: 0 20px; max-width: 300px; position: absolute; }' +

'';

var menu = document.body.appendChild( document.createElement( 'div' ) );
menu.id = 'menu';
menu.innerHTML =
contents = document.body.appendChild( document.createElement( 'div' ) );
contents.id = 'contents';
contents.innerHTML =

'<h2>' +
' <a href="" >' + document.title + '</a>' +
' <a href=http://jaanga.github.io/ >&#x24D8;</a>' +
'<a href="" >' + document.title + '</a>' +
'<a href=http://jaanga.github.io/ > &#x24D8; </a>' +
'</h2>' +

'<p>lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?</p>' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

function init() {

var css = document.body.appendChild( document.createElement('style') );
var css, hamburger, menu, contents;

css = document.body.appendChild( document.createElement('style') );
css.innerHTML =

'body { font: 12pt monospace; margin: 0; }' +
Expand All @@ -36,18 +38,18 @@

'';

var hamburger = document.body.appendChild( document.createElement( 'div' ) );
hamburger = document.body.appendChild( document.createElement( 'div' ) );
hamburger.id = 'hamburger';
hamburger.innerHTML = '<div id=bars >☰</div>';
bars.onclick = function() { hamburger.style.left = hamburger.style.left === "0px" ? "325px" : 0; };

var menu = hamburger.appendChild( document.createElement( 'div' ) );
menu = hamburger.appendChild( document.createElement( 'div' ) );
menu.id = 'menu';
menu.innerHTML =

'<h2>' +
' <a href="" >' + document.title + '</a>' +
' <a href=http://jaanga.github.io/ >❦</a>' +
'<a href="" >' + document.title + '</a>' +
'<a href=http://jaanga.github.io/ >❦</a>' +
'</h2>' +
'<p>lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?</p>' +
'<p>Zoom: <input type=range id=inp min=0 max=10 step=1 value=5 title="0 to 10: OK" ></p>' +
Expand All @@ -60,9 +62,11 @@
'<div id=info ></div>' +
'';

}

contents = document.body.appendChild( document.createElement( 'div' ) );
contents.id = 'contents';
contents.innerHTML = '<h1>Stuff</h1>'

}
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!doctype html>
<html lang=en >
<head>
<meta charset=utf-8 >
<title>Hamburger Child Menu R5</title>
<meta name=viewport content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui' >
<meta name=description content='Basic slide in and slide out menu with three bar icon that adjusts for small screen size.' >
<meta name=keywords content='CSS, HTML,JavaScript,GitHub,FOSS,3D,STEM' >
<meta name=date content='2016-02-28' >
</head>
<body>
<script>

// 2016-02-28 ~ http://jaanga.github.io/cookbook-html/snippets/hamburger-menu/hamburger-child-menu-r4.html

init();

function init() {

var css, hamburger, menu, contents;

css = document.body.appendChild( document.createElement('style') );
css.innerHTML =

'body { font: 12pt monospace; margin: 0; }' +
'h2 { margin: 0; }' +
'a { text-decoration: none; }' +
'button, input[type=button] { background-color: #eee; border: 2px #eee solid; color: #888; }' +

'input[type=range] { -webkit-appearance: none; -moz-appearance: none; background-color: silver; width: 160px; }' +
'input[type=range]::-moz-range-thumb { background-color: #888; border-radius: 0; width: 10px; }' +
'input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; background-color: #888; height: 20px; width: 10px; }' +

'#bars { color: pink; cursor: pointer; font-size: 24pt; text-decoration: none; }' +
'#hamburger { left: 325px; position: absolute; top: 20px; transition: left 1s; }' +
'#menu { background-color: #eee; border: 1px #ccc solid; left: -324px; max-height: ' + ( window.innerHeight - 10 ) + 'px; ' +
'opacity: 0.85; overflow: auto; padding: 0 10px; position: absolute; top: -20px; transition: left 1s; width: 300px; }' +
'#contents { text-align: center; }' +

'';

hamburger = document.body.appendChild( document.createElement( 'div' ) );
hamburger.id = 'hamburger';
hamburger.innerHTML = '<div id=bars >☰</div>';
bars.onclick = function() { hamburger.style.left = hamburger.style.left === "0px" ? "325px" : 0; };

menu = hamburger.appendChild( document.createElement( 'div' ) );
menu.id = 'menu';
menu.innerHTML =

'<h2>' +
'<a href="" >' + document.title + '</a>' +
'<a href=http://jaanga.github.io/ >❦</a>' +
'</h2>' +
'<p>lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?</p>' +
'<p>Zoom: <input type=range id=inp min=0 max=10 step=1 value=5 title="0 to 10: OK" ></p>' +
'<p>Pretty colors: <input id=inpPretty type=checkbox ></p>' +
'<p>Overlay: <select id=selList title="Select the 2D overlay" >select option<select></p>' +
'<p><button onclick=saveIt(); value="Save as PNG" >Save</button></p>' +
'<p><button onclick=setControlsFirstPerson(); >First Person Controls</button> ' +
'<button onclick=setControlsOrbit(); >Orbit Controls</button></p>' +
'<p>Freeze camera: <input type=checkbox id=chkFreeze ></p>' +
'<div id=info ></div>' +
'';

contents = document.body.appendChild( document.createElement( 'div' ) );
contents.id = 'contents';
contents.innerHTML = '<h1>Stuff</h1>'

}
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!doctype html>
<html lang=en >
<head>
<meta charset=utf-8 >
<title>Reader Iframes HTML R2</title>
<meta name=viewport content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui' >
<meta name=description content='' >
<meta name=keywords content='HTML,CSS,JavaScript,GitHub,FOSS' >
<meta name=date content='2016-02-28' >
</head>
<body>
<script src=http://cdnjs.cloudflare.com/ajax/libs/showdown/1.3.0/showdown.min.js ></script>
<script>

init();

function init() {

var css, menu;

css = document.head.appendChild( document.createElement( 'style' ) );
css.innerHTML =

'body { font: 12pt monospace; left: 0; margin: 0 auto; max-width: 800px; overflow-x: hidden; right: 0; }' +
'h1 { margin: 0; }' +
'h1 a { text-decoration: none; }' +
'iframe { border: 0px solid green; height: 360px; margin-left: ' + ( - 0.5 * window.innerWidth + 400 ) + 'px; width: ' + window.innerWidth + 'px; }' +

'';

menu = document.body.appendChild( document.createElement( 'div' ) );
// menu.id = 'menu';
menu.innerHTML =

'<div id=contents ></div>' +

'';

var fileName = location.hash ? location.hash.substr( 1 ) : 'readme.md';

getMarkdown( fileName, contents );

}


function getMarkdown( fileName, target ) {

var converter = new showdown.Converter( { strikethrough: true, literalMidWordUnderscores: true, simplifiedAutoLink: true, tables: true });

var xhr = new XMLHttpRequest();
xhr.open( 'GET', fileName, true );
xhr.onreadystatechange = callback;
xhr.send( null );

function callback() {

if ( xhr.readyState != 4 ) { return; }

target.innerHTML = converter.makeHtml( xhr.responseText );

}

}

</script>
</body>
</html>
2 changes: 1 addition & 1 deletion cookbook-html/templates/reader-iframes-html/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Read Me
[Read Me]( reader-iframes-html-r2.html )
===

# Thing 1
Expand Down
Loading

0 comments on commit 980c311

Please sign in to comment.