Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
a0400d53
Commit
a0400d53
authored
Oct 04, 2017
by
Samuel Padgett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SVG icons
parent
63afba8b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
1 deletions
+147
-1
origin-web-common-ui.js
dist/origin-web-common-ui.js
+44
-0
origin-web-common.js
dist/origin-web-common.js
+44
-0
origin-web-common.min.js
dist/origin-web-common.min.js
+15
-1
imageForIconClass.js
src/filters/imageForIconClass.js
+31
-0
isAbsoluteURL.js
src/filters/isAbsoluteURL.js
+13
-0
No files found.
dist/origin-web-common-ui.js
View file @
a0400d53
...
...
@@ -1533,6 +1533,50 @@ angular.module('openshiftCommonUI')
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
// Returns an image URL for an icon class if available. Some icons we have
// color SVG images for. Depends on window.OPENSHIFT_CONSTANTS.LOGOS and
// window.OPENSHIFT_CONSTANTS.LOGO_BASE_URL, which is set by origin-web-console
// (or an extension).
.
filter
(
'imageForIconClass'
,
function
(
isAbsoluteURLFilter
)
{
return
function
(
iconClass
)
{
if
(
!
iconClass
)
{
return
''
;
}
var
logoImage
=
_
.
get
(
window
,
[
'OPENSHIFT_CONSTANTS'
,
'LOGOS'
,
iconClass
]);
if
(
!
logoImage
)
{
return
''
;
}
// Make sure the logo base has a trailing slash.
var
logoBaseUrl
=
_
.
get
(
window
,
'OPENSHIFT_CONSTANTS.LOGO_BASE_URL'
);
if
(
!
logoBaseUrl
||
isAbsoluteURLFilter
(
logoImage
))
{
return
logoImage
;
}
if
(
!
logoBaseUrl
.
endsWith
(
'/'
))
{
logoBaseUrl
+=
'/'
;
}
return
logoBaseUrl
+
logoImage
;
};
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'isAbsoluteURL'
,
function
()
{
return
function
(
url
)
{
if
(
!
url
)
{
return
false
;
}
var
uri
=
new
URI
(
url
);
var
protocol
=
uri
.
protocol
();
return
uri
.
is
(
'absolute'
)
&&
(
protocol
===
'http'
||
protocol
===
'https'
);
};
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
// Usage: <span ng-bind-html="text | linkify : '_blank'"></span>
//
// Prefer this to the AngularJS `linky` filter since it only matches http and
...
...
dist/origin-web-common.js
View file @
a0400d53
...
...
@@ -1743,6 +1743,50 @@ angular.module('openshiftCommonUI')
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
// Returns an image URL for an icon class if available. Some icons we have
// color SVG images for. Depends on window.OPENSHIFT_CONSTANTS.LOGOS and
// window.OPENSHIFT_CONSTANTS.LOGO_BASE_URL, which is set by origin-web-console
// (or an extension).
.
filter
(
'imageForIconClass'
,
[
"isAbsoluteURLFilter"
,
function
(
isAbsoluteURLFilter
)
{
return
function
(
iconClass
)
{
if
(
!
iconClass
)
{
return
''
;
}
var
logoImage
=
_
.
get
(
window
,
[
'OPENSHIFT_CONSTANTS'
,
'LOGOS'
,
iconClass
]);
if
(
!
logoImage
)
{
return
''
;
}
// Make sure the logo base has a trailing slash.
var
logoBaseUrl
=
_
.
get
(
window
,
'OPENSHIFT_CONSTANTS.LOGO_BASE_URL'
);
if
(
!
logoBaseUrl
||
isAbsoluteURLFilter
(
logoImage
))
{
return
logoImage
;
}
if
(
!
logoBaseUrl
.
endsWith
(
'/'
))
{
logoBaseUrl
+=
'/'
;
}
return
logoBaseUrl
+
logoImage
;
};
}]);
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'isAbsoluteURL'
,
function
()
{
return
function
(
url
)
{
if
(
!
url
)
{
return
false
;
}
var
uri
=
new
URI
(
url
);
var
protocol
=
uri
.
protocol
();
return
uri
.
is
(
'absolute'
)
&&
(
protocol
===
'http'
||
protocol
===
'https'
);
};
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
// Usage: <span ng-bind-html="text | linkify : '_blank'"></span>
//
// Prefer this to the AngularJS `linky` filter since it only matches http and
...
...
dist/origin-web-common.min.js
View file @
a0400d53
...
...
@@ -780,7 +780,21 @@ return _.isRegExp(keyword) ? keyword.source :_.escapeRegExp(keyword);
}).
join
(
"|"
),
result
=
""
,
lastIndex
=
0
,
flags
=
caseSensitive
?
"g"
:
"ig"
,
regex
=
new
RegExp
(
source
,
flags
);
null
!==
(
match
=
regex
.
exec
(
str
));
)
lastIndex
<
match
.
index
&&
(
result
+=
_
.
escape
(
str
.
substring
(
lastIndex
,
match
.
index
))),
result
+=
"<mark>"
+
_
.
escape
(
match
[
0
])
+
"</mark>"
,
lastIndex
=
regex
.
lastIndex
;
return
lastIndex
<
str
.
length
&&
(
result
+=
_
.
escape
(
str
.
substring
(
lastIndex
))),
result
;
};
}
]),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"linkify"
,
[
"HTMLService"
,
function
(
HTMLService
)
{
}
]),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"imageForIconClass"
,
[
"isAbsoluteURLFilter"
,
function
(
isAbsoluteURLFilter
)
{
return
function
(
iconClass
)
{
if
(
!
iconClass
)
return
""
;
var
logoImage
=
_
.
get
(
window
,
[
"OPENSHIFT_CONSTANTS"
,
"LOGOS"
,
iconClass
]);
if
(
!
logoImage
)
return
""
;
var
logoBaseUrl
=
_
.
get
(
window
,
"OPENSHIFT_CONSTANTS.LOGO_BASE_URL"
);
return
!
logoBaseUrl
||
isAbsoluteURLFilter
(
logoImage
)
?
logoImage
:(
logoBaseUrl
.
endsWith
(
"/"
)
||
(
logoBaseUrl
+=
"/"
),
logoBaseUrl
+
logoImage
);
};
}
]),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"isAbsoluteURL"
,
function
()
{
return
function
(
url
)
{
if
(
!
url
)
return
!
1
;
var
uri
=
new
URI
(
url
),
protocol
=
uri
.
protocol
();
return
uri
.
is
(
"absolute"
)
&&
(
"http"
===
protocol
||
"https"
===
protocol
);
};
}),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"linkify"
,
[
"HTMLService"
,
function
(
HTMLService
)
{
return
function
(
text
,
target
,
alreadyEscaped
)
{
return
HTMLService
.
linkify
(
text
,
target
,
alreadyEscaped
);
};
...
...
src/filters/imageForIconClass.js
0 → 100644
View file @
a0400d53
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
// Returns an image URL for an icon class if available. Some icons we have
// color SVG images for. Depends on window.OPENSHIFT_CONSTANTS.LOGOS and
// window.OPENSHIFT_CONSTANTS.LOGO_BASE_URL, which is set by origin-web-console
// (or an extension).
.
filter
(
'imageForIconClass'
,
function
(
isAbsoluteURLFilter
)
{
return
function
(
iconClass
)
{
if
(
!
iconClass
)
{
return
''
;
}
var
logoImage
=
_
.
get
(
window
,
[
'OPENSHIFT_CONSTANTS'
,
'LOGOS'
,
iconClass
]);
if
(
!
logoImage
)
{
return
''
;
}
// Make sure the logo base has a trailing slash.
var
logoBaseUrl
=
_
.
get
(
window
,
'OPENSHIFT_CONSTANTS.LOGO_BASE_URL'
);
if
(
!
logoBaseUrl
||
isAbsoluteURLFilter
(
logoImage
))
{
return
logoImage
;
}
if
(
!
logoBaseUrl
.
endsWith
(
'/'
))
{
logoBaseUrl
+=
'/'
;
}
return
logoBaseUrl
+
logoImage
;
};
});
src/filters/isAbsoluteURL.js
0 → 100644
View file @
a0400d53
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'isAbsoluteURL'
,
function
()
{
return
function
(
url
)
{
if
(
!
url
)
{
return
false
;
}
var
uri
=
new
URI
(
url
);
var
protocol
=
uri
.
protocol
();
return
uri
.
is
(
'absolute'
)
&&
(
protocol
===
'http'
||
protocol
===
'https'
);
};
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment