Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfnuesse <felix.nuesse@t-online.de>2018-12-30 22:53:18 +0300
committerfnuesse <felix.nuesse@t-online.de>2018-12-30 22:53:18 +0300
commit07c9e199f65aaf0ad3d2aedcbe7a1bd28a66e9e3 (patch)
tree9864ce541cabdd637256ea7039044d46cff6f149 /js/app/directives/iconpicker.js
parentc86e4f87b5d066b88fe6bc93587d077cf55e968a (diff)
Added button to refetch the icon from the target url
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
Diffstat (limited to 'js/app/directives/iconpicker.js')
-rw-r--r--js/app/directives/iconpicker.js40
1 files changed, 27 insertions, 13 deletions
diff --git a/js/app/directives/iconpicker.js b/js/app/directives/iconpicker.js
index fafb1136..195ee35e 100644
--- a/js/app/directives/iconpicker.js
+++ b/js/app/directives/iconpicker.js
@@ -115,26 +115,40 @@
$('#iconPicker').dialog('close');
};
+ scope.refreshUrlIcon = function(){
+ var queryUrl = OC.generateUrl('apps/passman/api/v2/geticon/'+btoa(scope.credential.url));
+ $http.get(queryUrl).then(function (response) {
+
+ scope.customIcon = {};
+ scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content;
+ console.log(scope.customIcon.data);
+
+ if (response.data) {
+ return response.data;
+ } else {
+ return response;
+ }
+ });
+ };
+
scope.useIcon = function() {
if(scope.customIcon){
var data = scope.customIcon.data;
scope.credential.icon.type = data.substring(data.lastIndexOf(":")+1,data.lastIndexOf(";"));
scope.credential.icon.content = data.substring(data.lastIndexOf(",")+1, data.length);
- $('#iconPicker').dialog('close');
- return;
+ }else{
+ $http.get(scope.selectedIcon.url).then(function(result) {
+ var base64Data = window.btoa(result.data);
+ var mimeType = 'svg+xml';
+ if(!scope.credential.icon){
+ scope.credential.icon = {};
+ }
+ scope.credential.icon.type = mimeType;
+ scope.credential.icon.content = base64Data;
+ });
}
-
- $http.get(scope.selectedIcon.url).then(function(result) {
- var base64Data = window.btoa(result.data);
- var mimeType = 'svg+xml';
- if(!scope.credential.icon){
- scope.credential.icon = {};
- }
- scope.credential.icon.type = mimeType;
- scope.credential.icon.content = base64Data;
- $('#iconPicker').dialog('close');
- });
+ $('#iconPicker').dialog('close');
};
$(element).click(function() {