File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 22< html >
33
44< head >
5- < title > Ideas </ title >
5+ < title > Dan Tao </ title >
66 < link rel ="stylesheet/less " type ="text/css " href ="/common.less " />
77 < link rel ="stylesheet/less " type ="text/css " href ="/ideas.less " />
88 < script type ="text/javascript " src ="http://lesscss.org/js/less.js "> </ script >
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ function isMarkdownFile(file) {
55function displayIdea ( response ) {
66 var html = markdown . toHTML ( response ) ;
77 document . getElementById ( 'idea' ) . innerHTML = html ;
8+
9+ var headings = document . getElementsByTagName ( 'h1' ) ;
10+ if ( headings . length > 0 ) {
11+ document . title = 'Dan Tao - ' + headings [ 0 ] . textContent ;
12+ }
813}
914
1015function makeAjaxRequest ( url , callback ) {
@@ -21,11 +26,23 @@ function makeAjaxRequest(url, callback) {
2126 request . send ( ) ;
2227}
2328
24- window . addEventListener ( 'load' , function ( ) {
29+ function loadIdeaForLocation ( ) {
2530 var ideaName = window . location . pathname . match ( / i d e a s \/ ( .* ) $ / ) ;
31+
32+ if ( ! ideaName ) {
33+ ideaName = window . location . search . match ( / \b i d e a = ( [ ^ & ] * ) / ) ;
34+ }
35+
2636 if ( ideaName ) {
2737 makeAjaxRequest ( '/ideas/' + ideaName [ 1 ] + '.md' , displayIdea ) ;
2838 }
39+ }
2940
41+ function displayPathInFooter ( ) {
3042 document . getElementById ( 'path' ) . textContent = window . location . pathname ;
43+ }
44+
45+ window . addEventListener ( 'load' , function ( ) {
46+ loadIdeaForLocation ( ) ;
47+ displayPathInFooter ( ) ;
3148} ) ;
Original file line number Diff line number Diff line change 22< html >
33
44< head >
5- < title > Ideas</ title >
5+ < title > Dan Tao - Ideas</ title >
66 < link rel ="stylesheet/less " type ="text/css " href ="/common.less " />
77 < link rel ="stylesheet/less " type ="text/css " href ="/ideas.less " />
88 < script type ="text/javascript " src ="http://lesscss.org/js/less.js "> </ script >
Original file line number Diff line number Diff line change 22< html >
33
44< head >
5- < title > Daniel Tao</ title >
5+ < title > Dan Tao</ title >
66 < link rel ="stylesheet/less " type ="text/css " href ="common.less " />
77 < link rel ="stylesheet/less " type ="text/css " href ="index.less " />
88 < script type ="text/javascript " src ="http://lesscss.org/js/less.js "> </ script >
You can’t perform that action at this time.
0 commit comments