654
654
$("#filesbody").append(div);
657
/* Present an element for the given path.
658
* Gives it a title and download link.
660
function present_custom_handler(path, type, element)
662
/* Disable save button and hide the save panel */
663
using_codepress = false;
667
var url = app_url(service_app, path) + "?return=contents";
668
var download_url = app_url(download_app, path);
670
/* Fallback download link */
672
'<p>Could not play ' + tag_name + ' file. ' +
673
'Try <a>downloading it</a> instead.</p>');
674
link.find('a').attr("href", download_url);
676
/* HTML 5 media element */
677
var html5_element = $(
678
'<' + tag_name + ' controls="true" autoplay="true" />');
679
html5_element.attr("src", url);
680
var support = (html5_element[0].canPlayType &&
681
html5_element[0].canPlayType(type));
683
/* If the browser thinks it might be able to play it, use the HTML5
684
* element. Otherwise, fall back to an <object>, which might work.
686
if (support == "probably" || support == "maybe") {
687
var element = html5_element;
689
var element = $('<object />');
690
element.attr("type", type);
691
element.attr("data", url);
693
element.append(link);
696
var div = $('<div class="padding" />');
697
div.append('<h1>File preview</h1>');
699
$("#filesbody").append(div);
657
702
/* Enable or disable actions1 moreactions actions. Takes either a single
658
703
* name, or an array of them.*/
659
704
function set_action_state(names, which, allow_on_revision)