File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 98
98
function afterImport ( imageName ) {
99
99
setTimeout ( ( ) => drop . style . borderColor = "" , 500 ) ;
100
100
if ( ! imageName ) showFiles ( ) ;
101
- else runSqueak ( imageName ) ;
101
+ else {
102
+ const hash = '#' + paramsForImage ( imageName ) ;
103
+ if ( location . hash !== hash ) history . pushState ( { } , "" , hash ) ;
104
+ runSqueak ( imageName ) ;
105
+ }
102
106
}
103
107
function exportFile ( a ) {
104
108
var path = Squeak . splitFilePath ( a . innerText ) ;
108
112
} , alert ) ;
109
113
return false ;
110
114
}
115
+ function paramsForImage ( imageName ) {
116
+ var params = new URLSearchParams ( location . hash . slice ( 1 ) ) ;
117
+ params . set ( "image" , imageName ) ;
118
+ return params . toString ( ) ;
119
+ }
111
120
function showFiles ( ) {
112
121
var imgList = [ ] ,
113
122
fileList = [ ] ,
122
131
var entry = entries [ f ] ,
123
132
path = dir + '/' + f ;
124
133
if ( ! entry [ 3 ] && f . match ( / \. i m a g e $ / ) )
125
- imgList . push ( '<li><a href="#image= ' + path + '">' + path + '</a> (' + ( entry [ 4 ] / 1000000 ) . toFixed ( 1 ) + ' MB)</li>' ) ;
134
+ imgList . push ( '<li><a href="#' + paramsForImage ( path ) + '">' + path + '</a> (' + ( entry [ 4 ] / 1000000 ) . toFixed ( 1 ) + ' MB)</li>' ) ;
126
135
if ( entry [ 3 ] ) {
127
136
dirs . push ( path ) ;
128
137
nDirs ++ ;
You can’t perform that action at this time.
0 commit comments