Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
f84d66a2
Commit
f84d66a2
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Moved SVGSupport call to use OC.Util.SVGSupport()
parent
d8f56e3c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/js/js.js
+3
-3
3 additions, 3 deletions
core/js/js.js
core/js/tests/specs/coreSpec.js
+3
-3
3 additions, 3 deletions
core/js/tests/specs/coreSpec.js
with
6 additions
and
6 deletions
core/js/js.js
+
3
−
3
View file @
f84d66a2
...
...
@@ -295,7 +295,7 @@ var OC={
*/
imagePath
:
function
(
app
,
file
){
if
(
file
.
indexOf
(
'
.
'
)
==-
1
){
//if no extension is given, use png or svg depending on browser support
file
+=
(
SVGSupport
())?
'
.svg
'
:
'
.png
'
;
file
+=
(
OC
.
Util
.
has
SVGSupport
())?
'
.svg
'
:
'
.png
'
;
}
return
OC
.
filePath
(
app
,
'
img
'
,
file
);
},
...
...
@@ -497,7 +497,7 @@ var OC={
throw
e
;
});
}
if
(
!
SVGSupport
())
{
if
(
!
OC
.
Util
.
has
SVGSupport
())
{
OC
.
Util
.
replaceSVG
();
}
}).
show
();
...
...
@@ -874,7 +874,7 @@ function initCore() {
initSessionHeartBeat
();
}
if
(
!
SVGSupport
()){
//replace all svg images with png images for browser that dont support svg
if
(
!
OC
.
Util
.
has
SVGSupport
()){
//replace all svg images with png images for browser that dont support svg
OC
.
Util
.
replaceSVG
();
}
else
{
SVGSupport
.
checkMimeType
();
...
...
This diff is collapsed.
Click to expand it.
core/js/tests/specs/coreSpec.js
+
3
−
3
View file @
f84d66a2
...
...
@@ -147,19 +147,19 @@ describe('Core base tests', function() {
});
describe
(
'
Images
'
,
function
()
{
it
(
'
Generates image path with given extension
'
,
function
()
{
var
svgSupportStub
=
sinon
.
stub
(
window
,
'
SVGSupport
'
,
function
()
{
return
true
;
});
var
svgSupportStub
=
sinon
.
stub
(
OC
.
Util
,
'
has
SVGSupport
'
,
function
()
{
return
true
;
});
expect
(
OC
.
imagePath
(
'
core
'
,
'
somefile.jpg
'
)).
toEqual
(
OC
.
webroot
+
'
/core/img/somefile.jpg
'
);
expect
(
OC
.
imagePath
(
TESTAPP
,
'
somefile.jpg
'
)).
toEqual
(
TESTAPP_ROOT
+
'
/img/somefile.jpg
'
);
svgSupportStub
.
restore
();
});
it
(
'
Generates image path with svg extension when svg support exists
'
,
function
()
{
var
svgSupportStub
=
sinon
.
stub
(
window
,
'
SVGSupport
'
,
function
()
{
return
true
;
});
var
svgSupportStub
=
sinon
.
stub
(
OC
.
Util
,
'
has
SVGSupport
'
,
function
()
{
return
true
;
});
expect
(
OC
.
imagePath
(
'
core
'
,
'
somefile
'
)).
toEqual
(
OC
.
webroot
+
'
/core/img/somefile.svg
'
);
expect
(
OC
.
imagePath
(
TESTAPP
,
'
somefile
'
)).
toEqual
(
TESTAPP_ROOT
+
'
/img/somefile.svg
'
);
svgSupportStub
.
restore
();
});
it
(
'
Generates image path with png ext when svg support is not available
'
,
function
()
{
var
svgSupportStub
=
sinon
.
stub
(
window
,
'
SVGSupport
'
,
function
()
{
return
false
;
});
var
svgSupportStub
=
sinon
.
stub
(
OC
.
Util
,
'
has
SVGSupport
'
,
function
()
{
return
false
;
});
expect
(
OC
.
imagePath
(
'
core
'
,
'
somefile
'
)).
toEqual
(
OC
.
webroot
+
'
/core/img/somefile.png
'
);
expect
(
OC
.
imagePath
(
TESTAPP
,
'
somefile
'
)).
toEqual
(
TESTAPP_ROOT
+
'
/img/somefile.png
'
);
svgSupportStub
.
restore
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment