speedtag/chrome/content/speedtag.js

31 lines
1,012 B
JavaScript
Raw Normal View History

2011-05-25 01:34:48 +05:30
var startTime = new Date();
2011-05-24 02:05:35 +05:30
$(function() {
var savePath = '';
$('#saveLocationBtn').click(function() {
2011-05-25 01:34:48 +05:30
savePath = mozillaSelectFolder().file.path;
// alert(savePath.file.path);
2011-05-24 02:05:35 +05:30
});
$('#selectAudioFile').click(function() {
2011-05-25 01:34:48 +05:30
if (savePath === '') { alert("Please select a save location first."); return false; }
2011-05-24 02:05:35 +05:30
fil = selectFile();
2011-05-25 01:34:48 +05:30
// alert(savePath);
var destName = getDateString(startTime) + ".mp3";
mozillaCopyFile(fil.file.path, savePath, destName);
});
$('#saveFormData').click(function() {
if (savePath === '') { alert("Please select a save location first."); return false; }
var arr = $('#metadataForm').serializeArray();
var s = JSON.stringify(arr);
// alert(s);
var destFilePath = savePath + "/" + getDateString(startTime) + ".json";
// alert(destFilePath);
mozillaSaveFile(destFilePath, s);
alert("saved " + destFilePath);
2011-05-24 02:05:35 +05:30
});
});
2011-05-25 01:34:48 +05:30
function getDateString(dateObj) {
return dateObj.toUTCString().replace(",", "").replace(":", ".");
}