You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.2 KiB

function App_Scan(id) {
var obj = api.require('scanner');
obj.open(function(ret,err) {
if(typeof ret.msg == 'undefined') return;
$(id).val(ret.msg);
});
}
function App_Jump(url) {
if(api.systemType == 'ios') {
api.openApp({
iosUrl:url
});
} else {
api.openApp({
androidPkg:'android.intent.action.VIEW',
mimeType:'text/html',
uri:url
});
}
}
function App_Save(url) {
if(url.indexOf('://') != -1) {
api.saveMediaToAlbum({
path: url
}, function(ret, err) {
if(ret && ret.status) {
Dtoast(js_pageid, L['save_success']);
} else {
Dtoast(js_pageid, L['save_failure']);
}
});
} else if(url.indexOf('data:') != -1) {
var trans = api.require('trans');
var arr = url.split('base64,');
trans.saveImage({
base64Str: arr[1],
imgPath:'fs://icon/',
imgName:'share.png'
}, function(ret, err) {
if(ret.status) {
api.saveMediaToAlbum({
path: 'fs://icon/share.png'
}, function(ret, err) {
if(ret && ret.status) {
Dtoast(js_pageid, L['save_success']);
} else {
Dtoast(js_pageid, L['save_failure']);
}
});
} else {
Dtoast(js_pageid, L['save_failure']);
}
});
}
}