File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ window.onload = () => {
66 sharedData = JSON . parse ( localStorage . viewScriptSource_sharedData ) ;
77 const { name, source, description, id } = sharedData ;
88 if ( name && source ) {
9- document . title = "Useful-script / " + name + " / " + description ;
10- document . querySelector ( "code" ) . innerHTML = source . replace (
11- "function " ,
12- "function " + ( id || "_" )
13- ) ;
9+ let title = "Useful-script / " + name + " / " + description ;
10+ let comment = `// ${ name } \n// ${ description } \n\n` ;
11+ let sourceCode = source . replace ( "function " , "function " + ( id || "_" ) ) ;
12+
13+ document . title = title ;
14+ document . querySelector ( "code" ) . innerHTML = comment + sourceCode ;
15+
1416 hljs . highlightAll ( ) ;
1517 }
1618 } catch ( e ) { }
You can’t perform that action at this time.
0 commit comments