This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
autoload/server/static/scripts Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 77 html = document . querySelector ( 'html' ) ;
88 mkdContainer = document . getElementById ( 'js-markdown' ) ;
99
10+ function fixAllImg ( text ) {
11+ var match , reg = / < i m g [ ^ > ] + ?( s r c = ( " | ' ) ( [ ^ \2] + ?) \2) [ ^ > ] + ?> / g;
12+ while ( ( match = reg . exec ( text ) ) !== null ) {
13+ if ( match && match . length === 4 ) {
14+ text = text . replace ( match [ 3 ] , getAbsPath ( location . search , match [ 3 ] ) ) ;
15+ }
16+ }
17+ return text ;
18+ }
19+
1020 function getAbsPath ( base , path ) {
1121 var bases = Base64 . decode ( base . slice ( 1 ) ) . split ( '/' )
1222 var paths = path . split ( '/' ) ;
6373 if ( line . indexOf ( flagSign ) !== - 1 ) {
6474 html [ i ] = line . replace ( flagSign , '' ) + aPoint ;
6575 }
76+ html [ i ] = fixAllImg ( html [ i ] ) ;
6677 }
6778 return html . join ( '\n' ) ;
6879 } ;
90101 } ;
91102
92103 renderer . paragraph = function ( text ) {
93- text = text . replace ( flagSign , aPoint ) ;
104+ text = fixAllImg ( text . replace ( flagSign , aPoint ) ) ;
94105 return '<p>' + text + '</p>\n' ;
95106 } ;
96107
118129 text = text . replace ( flagSign , '' ) ;
119130 result = aPoint ;
120131 }
121- href = getAbsPath ( location . search , href ) ;
122132 return result + rImage . call ( renderer , href , title , text ) ;
123133 } ;
124134
You can’t perform that action at this time.
0 commit comments