add get param to load file on page load
parent
099fd75385
commit
b22bc070c0
|
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- symbol selects include icons
|
||||
[#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj
|
||||
- gpx route parsing, save it as route
|
||||
- GET param to load file on page load
|
||||
|
||||
### Changed
|
||||
- detach marker and tooltip styling option
|
||||
|
|
|
@ -736,6 +736,16 @@ function hideSaveSuccessAnimation(){
|
|||
$('#saved').fadeOut();
|
||||
}
|
||||
|
||||
function loadAction(file){
|
||||
loadFile(file);
|
||||
// set save name
|
||||
var spl = file.split('/');
|
||||
var basename = spl[spl.length-1];
|
||||
$('input#saveName').val(
|
||||
basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx')
|
||||
);
|
||||
}
|
||||
|
||||
function loadFile(file){
|
||||
var req = {
|
||||
path : file
|
||||
|
@ -1032,14 +1042,7 @@ $(document).ready(function(){
|
|||
|
||||
var treeurl = OC.generateUrl('/apps/gpxedit/getdircontent');
|
||||
$('#loadtree').fileTree({root: '/', script: treeurl, multiFolder: false }, function(file) {
|
||||
gpxedit.fileToLoad = file;
|
||||
loadFile(file);
|
||||
// set save name
|
||||
var spl = file.split('/');
|
||||
var basename = spl[spl.length-1];
|
||||
$('input#saveName').val(
|
||||
basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx')
|
||||
);
|
||||
loadAction(file);
|
||||
});
|
||||
|
||||
var savetreeurl = OC.generateUrl('/apps/gpxedit/getdircontentdir');
|
||||
|
@ -1093,6 +1096,12 @@ $(document).ready(function(){
|
|||
$(this).addClass(symbolSelectClasses[$(this).val()]);
|
||||
});
|
||||
|
||||
// load a file if 'file' GET url parameter was given
|
||||
var fileparam = getUrlParameter('file');
|
||||
if (fileparam){
|
||||
loadAction(fileparam);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, OC);
|
||||
|
|
Loading…
Reference in New Issue