File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 5
5
if ( PAGE_TYPE ) {
6
6
initVersionSelect ( )
7
7
initSubHeaders ( )
8
+ initApiSpecLinks ( )
9
+ }
10
+
11
+ function initApiSpecLinks ( ) {
12
+ var apiContent = document . querySelector ( '.content.api' )
13
+ if ( apiContent ) {
14
+ var apiTitles = [ ] . slice . call ( apiContent . querySelectorAll ( 'h3' ) )
15
+ apiTitles . forEach ( function ( titleNode ) {
16
+ var ulNode = titleNode . parentNode . nextSibling
17
+ if ( ulNode . tagName !== 'UL' ) {
18
+ ulNode = ulNode . nextSibling
19
+ }
20
+ if ( ulNode . tagName === 'UL' ) {
21
+ var specNode = document . createElement ( 'li' )
22
+ var specLink = createSourceSearchPath ( titleNode . textContent )
23
+ specNode . innerHTML = '<a href="' + specLink + '" target="_blank">Source</a>'
24
+ ulNode . appendChild ( specNode )
25
+ }
26
+ } )
27
+ }
28
+
29
+ function createSourceSearchPath ( query ) {
30
+ return 'https://github.com/search?utf8=%E2%9C%93&q=repo%3Avuejs%2Fvue+extension%3Ajs+' + encodeURIComponent ( query ) + '+&type=Code'
31
+ }
8
32
}
9
33
10
34
/**
You can’t perform that action at this time.
0 commit comments