Safari/Chrome: Uploading files now works reliably instead of just once. Apparently WebKit caches iframe src URLs!
This commit is contained in:
parent
122ef0cc27
commit
489cc08783
3
NEWS
3
NEWS
|
@ -4,7 +4,8 @@
|
||||||
* Underline and strikethrough now work.
|
* Underline and strikethrough now work.
|
||||||
* Pulldowns for search suggestions, importing, and exporting show up.
|
* Pulldowns for search suggestions, importing, and exporting show up.
|
||||||
* Pulldowns on inline images are now positioned correctly.
|
* Pulldowns on inline images are now positioned correctly.
|
||||||
* Note resizing (growing and shrinking) works as expected.
|
* Uploading files now works reliably instead of just once.
|
||||||
|
* Note resizing (growing and shrinking) works (mostly) as expected.
|
||||||
* Improved page loading speed and fixed a rare session locking timeout bug
|
* Improved page loading speed and fixed a rare session locking timeout bug
|
||||||
by removing all implicit session locking.
|
by removing all implicit session locking.
|
||||||
* Fixed a bug that broke that Luminotes Desktop product download page if
|
* Fixed a bug that broke that Luminotes Desktop product download page if
|
||||||
|
|
|
@ -3271,14 +3271,17 @@ function Upload_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral )
|
||||||
Pulldown.call( this, wiki, notebook_id, "upload_" + editor.id, this.link, editor.iframe, ephemeral );
|
Pulldown.call( this, wiki, notebook_id, "upload_" + editor.id, this.link, editor.iframe, ephemeral );
|
||||||
wiki.down_image_button( "attachFile" );
|
wiki.down_image_button( "attachFile" );
|
||||||
|
|
||||||
|
var vaguely_random = new Date().getTime();
|
||||||
this.invoker = invoker;
|
this.invoker = invoker;
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.iframe = createDOM( "iframe", {
|
this.iframe = createDOM( "iframe", {
|
||||||
"src": "/files/upload_page?notebook_id=" + notebook_id + "¬e_id=" + editor.id,
|
"src": "/files/upload_page?notebook_id=" + notebook_id + "¬e_id=" + editor.id,
|
||||||
"frameBorder": "0",
|
"frameBorder": "0",
|
||||||
"scrolling": "no",
|
"scrolling": "no",
|
||||||
"id": "upload_frame",
|
// if a new iframe has an id/name that WebKit has already seen, then it will just use its
|
||||||
"name": "upload_frame",
|
// previous src value and ignore our new src value here. workaround: don't use the same id!
|
||||||
|
"id": "upload_frame_" + vaguely_random,
|
||||||
|
"name": "upload_frame_" + vaguely_random,
|
||||||
"class": "upload_frame"
|
"class": "upload_frame"
|
||||||
} );
|
} );
|
||||||
this.iframe.pulldown = this;
|
this.iframe.pulldown = this;
|
||||||
|
@ -3293,8 +3296,8 @@ function Upload_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral )
|
||||||
this.progress_iframe = createDOM( "iframe", {
|
this.progress_iframe = createDOM( "iframe", {
|
||||||
"frameBorder": "0",
|
"frameBorder": "0",
|
||||||
"scrolling": "no",
|
"scrolling": "no",
|
||||||
"id": "progress_frame",
|
"id": "progress_frame_" + vaguely_random,
|
||||||
"name": "progress_frame",
|
"name": "progress_frame_" + vaguely_random,
|
||||||
"class": "upload_frame"
|
"class": "upload_frame"
|
||||||
} );
|
} );
|
||||||
addElementClass( this.progress_iframe, "undisplayed" );
|
addElementClass( this.progress_iframe, "undisplayed" );
|
||||||
|
@ -3339,9 +3342,6 @@ Upload_pulldown.prototype.upload_started = function ( file_id ) {
|
||||||
removeElementClass( this.progress_iframe, "undisplayed" );
|
removeElementClass( this.progress_iframe, "undisplayed" );
|
||||||
var progress_url = "/files/progress?file_id=" + file_id + "&filename=" + escape( filename );
|
var progress_url = "/files/progress?file_id=" + file_id + "&filename=" + escape( filename );
|
||||||
|
|
||||||
if ( frames[ "progress_frames" ] )
|
|
||||||
frames[ "progress_frame" ].location.href = progress_url;
|
|
||||||
else
|
|
||||||
this.progress_iframe.src = progress_url;
|
this.progress_iframe.src = progress_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3439,13 +3439,16 @@ function Import_pulldown( wiki, notebook_id, invoker, anchor ) {
|
||||||
|
|
||||||
Pulldown.call( this, wiki, notebook_id, "import_pulldown", anchor, null, false );
|
Pulldown.call( this, wiki, notebook_id, "import_pulldown", anchor, null, false );
|
||||||
|
|
||||||
|
var vaguely_random = new Date().getTime();
|
||||||
this.invoker = invoker;
|
this.invoker = invoker;
|
||||||
this.iframe = createDOM( "iframe", {
|
this.iframe = createDOM( "iframe", {
|
||||||
"src": "/files/import_page?notebook_id=" + notebook_id,
|
"src": "/files/import_page?notebook_id=" + notebook_id,
|
||||||
"frameBorder": "0",
|
"frameBorder": "0",
|
||||||
"scrolling": "no",
|
"scrolling": "no",
|
||||||
"id": "upload_frame",
|
// if a new iframe has an id/name that WebKit has already seen, then it will just use its
|
||||||
"name": "upload_frame",
|
// previous src value and ignore our new src value here. workaround: don't use the same id!
|
||||||
|
"id": "upload_frame_" + vaguely_random,
|
||||||
|
"name": "upload_frame_" + vaguely_random,
|
||||||
"class": "upload_frame"
|
"class": "upload_frame"
|
||||||
} );
|
} );
|
||||||
this.iframe.pulldown = this;
|
this.iframe.pulldown = this;
|
||||||
|
@ -3460,8 +3463,8 @@ function Import_pulldown( wiki, notebook_id, invoker, anchor ) {
|
||||||
this.progress_iframe = createDOM( "iframe", {
|
this.progress_iframe = createDOM( "iframe", {
|
||||||
"frameBorder": "0",
|
"frameBorder": "0",
|
||||||
"scrolling": "no",
|
"scrolling": "no",
|
||||||
"id": "progress_frame",
|
"id": "progress_frame_" + vaguely_random,
|
||||||
"name": "progress_frame",
|
"name": "progress_frame_" + vaguely_random,
|
||||||
"class": "upload_frame"
|
"class": "upload_frame"
|
||||||
} );
|
} );
|
||||||
addElementClass( this.progress_iframe, "undisplayed" );
|
addElementClass( this.progress_iframe, "undisplayed" );
|
||||||
|
@ -3497,9 +3500,6 @@ Import_pulldown.prototype.upload_started = function ( file_id ) {
|
||||||
removeElementClass( this.progress_iframe, "undisplayed" );
|
removeElementClass( this.progress_iframe, "undisplayed" );
|
||||||
var progress_url = "/files/progress?file_id=" + file_id + "&filename=" + escape( filename );
|
var progress_url = "/files/progress?file_id=" + file_id + "&filename=" + escape( filename );
|
||||||
|
|
||||||
if ( frames[ "progress_frames" ] )
|
|
||||||
frames[ "progress_frame" ].location.href = progress_url;
|
|
||||||
else
|
|
||||||
this.progress_iframe.src = progress_url;
|
this.progress_iframe.src = progress_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ def stream_progress( uploading_file, filename, fraction_reported ):
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><span id="status">0%%</span></td>
|
<td><span id="status">0%%</span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><input type="submit" id="cancel_button" class="button" value="cancel" onclick="withDocument( window.parent.document, function () { getElement( 'upload_frame' ).pulldown.cancel_due_to_click(); } );" /></td>
|
<td><input type="submit" id="cancel_button" class="button" value="cancel" onclick="withDocument( window.parent.document, function () { getFirstElementByTagAndClassName( "iframe", "upload_frame" ).pulldown.cancel_due_to_click(); } );" /></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function tick( fraction ) {
|
function tick( fraction ) {
|
||||||
|
@ -74,7 +74,7 @@ def stream_progress( uploading_file, filename, fraction_reported ):
|
||||||
yield \
|
yield \
|
||||||
u"""
|
u"""
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
withDocument( window.parent.document, function () { var frame = getElement( 'upload_frame' ); if ( frame && frame.pulldown ) frame.pulldown.upload_complete(); } );
|
withDocument( window.parent.document, function () { var frame = getFirstElementByTagAndClassName( "iframe", "upload_frame" ); if ( frame && frame.pulldown ) frame.pulldown.upload_complete(); } );
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -83,13 +83,13 @@ def stream_progress( uploading_file, filename, fraction_reported ):
|
||||||
|
|
||||||
general_error_script = \
|
general_error_script = \
|
||||||
"""
|
"""
|
||||||
withDocument( window.parent.document, function () { var frame = getElement( 'upload_frame' ); if ( frame && frame.pulldown ) frame.pulldown.cancel_due_to_error( "%s" ); } );
|
withDocument( window.parent.document, function () { var frame = getFirstElementByTagAndClassName( "iframe", "upload_frame" ); if ( frame && frame.pulldown ) frame.pulldown.cancel_due_to_error( "%s" ); } );
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
quota_error_script = \
|
quota_error_script = \
|
||||||
"""
|
"""
|
||||||
withDocument( window.parent.document, function () { var frame = getElement( 'upload_frame' ); if ( frame && frame.pulldown ) frame.pulldown.cancel_due_to_quota(); } );
|
withDocument( window.parent.document, function () { var frame = getFirstElementByTagAndClassName( "iframe", "upload_frame" ); if ( frame && frame.pulldown ) frame.pulldown.cancel_due_to_quota(); } );
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue