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 2
2
< html >
3
3
4
4
< head >
5
- < title > Ideas </ title >
5
+ < title > Dan Tao </ title >
6
6
< link rel ="stylesheet/less " type ="text/css " href ="/common.less " />
7
7
< link rel ="stylesheet/less " type ="text/css " href ="/ideas.less " />
8
8
< 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) {
5
5
function displayIdea ( response ) {
6
6
var html = markdown . toHTML ( response ) ;
7
7
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
+ }
8
13
}
9
14
10
15
function makeAjaxRequest ( url , callback ) {
@@ -21,11 +26,23 @@ function makeAjaxRequest(url, callback) {
21
26
request . send ( ) ;
22
27
}
23
28
24
- window . addEventListener ( 'load' , function ( ) {
29
+ function loadIdeaForLocation ( ) {
25
30
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
+
26
36
if ( ideaName ) {
27
37
makeAjaxRequest ( '/ideas/' + ideaName [ 1 ] + '.md' , displayIdea ) ;
28
38
}
39
+ }
29
40
41
+ function displayPathInFooter ( ) {
30
42
document . getElementById ( 'path' ) . textContent = window . location . pathname ;
43
+ }
44
+
45
+ window . addEventListener ( 'load' , function ( ) {
46
+ loadIdeaForLocation ( ) ;
47
+ displayPathInFooter ( ) ;
31
48
} ) ;
Original file line number Diff line number Diff line change 2
2
< html >
3
3
4
4
< head >
5
- < title > Ideas</ title >
5
+ < title > Dan Tao - Ideas</ title >
6
6
< link rel ="stylesheet/less " type ="text/css " href ="/common.less " />
7
7
< link rel ="stylesheet/less " type ="text/css " href ="/ideas.less " />
8
8
< script type ="text/javascript " src ="http://lesscss.org/js/less.js "> </ script >
Original file line number Diff line number Diff line change 2
2
< html >
3
3
4
4
< head >
5
- < title > Daniel Tao</ title >
5
+ < title > Dan Tao</ title >
6
6
< link rel ="stylesheet/less " type ="text/css " href ="common.less " />
7
7
< link rel ="stylesheet/less " type ="text/css " href ="index.less " />
8
8
< script type ="text/javascript " src ="http://lesscss.org/js/less.js "> </ script >
You can’t perform that action at this time.
0 commit comments