Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions settings/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,7 @@ span.version {
padding-right: 10px;
width: 80px;
height: 80px;
}
.app-image img {
max-width: 80px;
max-height: 80px;
}
.app-image-icon img {
background-color: #ccc;
width: 60px;
padding: 10px;
border-radius: 3px;
opacity: 0.8;
}
.app-name,
.app-version,
Expand Down
29 changes: 23 additions & 6 deletions settings/js/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ OC.Settings.Apps = OC.Settings.Apps || {
if (app.preview && !OC.Util.isIE()) {
var currentImage = new Image();
currentImage.src = app.preview;

currentImage.onload = function() {
page.find('.app-image')
.append(this)
.fadeIn();
};
}

currentImage.onload = function() {
page.find('.app-image')
.append(OC.Settings.Apps.imageUrl(app.preview, app.detailpage))
.fadeIn();
};

// set group select properly
if(OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging') ||
Expand All @@ -226,6 +226,23 @@ OC.Settings.Apps = OC.Settings.Apps || {
}
},

/**
* Returns the image for apps listing
* url : the url of the image
* appfromstore: bool to check whether the app is fetched from store or not.
*/

imageUrl : function (url, appfromstore) {
var img = '<svg width="72" height="72" viewBox="0 0 72 72">';
if (appfromstore) {
img += '<image x="0" y="0" width="72" height="72" preserveAspectRatio="xMinYMin meet" xlink:href="' + url + '" class="app-icon" /></svg>';
} else {
img += '<defs><filter id="invert"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0" /></filter></defs>';
img += '<image x="0" y="0" width="72" height="72" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + url + '" class="app-icon" /></svg>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/image cough cough ... this breaks the app managment in all browsers except chrome (where it only works by luck). I will revert it and we better load the SVG directly into the DOM which is even supported in IE9 and makes CSS styling easier too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah just noticed that this is wrapped inside an SVG ... then I will try to fix this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
return img;
},

isType: function(app, type){
return app.types && app.types.indexOf(type) !== -1;
},
Expand Down