Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
a266ae30
Commit
a266ae30
authored
Apr 16, 2018
by
Tim Hunt
Committed by
KietChan
May 31, 2018
Browse files
MDL-50812 core_useragent: <body> classes for Chrome and Edge
parent
6b2e0467
Changes
6
Hide whitespace changes
Inline
Side-by-side
lib/classes/useragent.php
View file @
a266ae30
...
...
@@ -910,7 +910,9 @@ class core_useragent {
*/
public
static
function
get_browser_version_classes
()
{
$classes
=
array
();
if
(
self
::
is_ie
())
{
if
(
self
::
is_edge
())
{
$classes
[]
=
'edge'
;
}
else
if
(
self
::
is_ie
())
{
$classes
[]
=
'ie'
;
for
(
$i
=
12
;
$i
>=
6
;
$i
--
)
{
if
(
self
::
check_ie_version
(
$i
))
{
...
...
@@ -923,12 +925,19 @@ class core_useragent {
if
(
preg_match
(
'/rv\:([1-2])\.([0-9])/'
,
self
::
get_user_agent_string
(),
$matches
))
{
$classes
[]
=
"gecko
{
$matches
[
1
]
}{
$matches
[
2
]
}
"
;
}
}
else
if
(
self
::
is_chrome
())
{
$classes
[]
=
'chrome'
;
if
(
self
::
is_webkit_android
())
{
$classes
[]
=
'android'
;
}
}
else
if
(
self
::
is_webkit
())
{
$classes
[]
=
'safari'
;
if
(
self
::
is_safari
())
{
$classes
[]
=
'safari'
;
}
if
(
self
::
is_safari_ios
())
{
$classes
[]
=
'ios'
;
}
else
if
(
self
::
is_webkit_android
())
{
$classes
[]
=
'android'
;
$classes
[]
=
'android'
;
// Old pre-Chrome android browsers.
}
}
else
if
(
self
::
is_opera
())
{
$classes
[]
=
'opera'
;
...
...
lib/tests/useragent_test.php
View file @
a266ae30
...
...
@@ -64,7 +64,7 @@ class core_useragent_testcase extends advanced_testcase {
),
'versionclasses'
=>
array
(
'
safari
'
,
'
edge
'
,
),
),
),
...
...
@@ -97,8 +97,7 @@ class core_useragent_testcase extends advanced_testcase {
),
'versionclasses'
=>
array
(
'safari'
,
'android'
,
'edge'
),
'devicetype'
=>
'mobile'
,
...
...
@@ -898,8 +897,7 @@ class core_useragent_testcase extends advanced_testcase {
'is_webkit'
=>
true
,
'versionclasses'
=>
array
(
'safari'
,
'ios'
,
'ios'
),
'devicetype'
=>
'mobile'
,
...
...
@@ -922,7 +920,6 @@ class core_useragent_testcase extends advanced_testcase {
'is_webkit'
=>
true
,
'versionclasses'
=>
array
(
'safari'
,
'ios'
,
),
...
...
@@ -944,7 +941,6 @@ class core_useragent_testcase extends advanced_testcase {
'is_webkit'
=>
true
,
'versionclasses'
=>
array
(
'safari'
,
'ios'
,
),
...
...
@@ -953,7 +949,7 @@ class core_useragent_testcase extends advanced_testcase {
),
// Android WebKit 525; G1 Phone.
array
(
'Android WebKit 525; G1 Phone'
=>
array
(
'Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2 – G1 Phone'
,
array
(
'is_webkit_android'
=>
true
,
...
...
@@ -965,7 +961,6 @@ class core_useragent_testcase extends advanced_testcase {
'versionclasses'
=>
array
(
'android'
,
'safari'
,
),
'devicetype'
=>
'mobile'
,
...
...
@@ -975,7 +970,7 @@ class core_useragent_testcase extends advanced_testcase {
),
// Android WebKit 530; Nexus.
array
(
'Android WebKit 530; Nexus'
=>
array
(
'Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 –Nexus'
,
array
(
'is_webkit_android'
=>
true
,
...
...
@@ -988,7 +983,6 @@ class core_useragent_testcase extends advanced_testcase {
'versionclasses'
=>
array
(
'android'
,
'safari'
,
),
'devicetype'
=>
'mobile'
,
...
...
@@ -1017,7 +1011,7 @@ class core_useragent_testcase extends advanced_testcase {
),
'versionclasses'
=>
array
(
'
safari
'
,
'
chrome
'
,
'android'
,
),
...
...
@@ -1045,7 +1039,7 @@ class core_useragent_testcase extends advanced_testcase {
),
'versionclasses'
=>
array
(
'
safari
'
,
'
chrome
'
,
'android'
,
),
...
...
@@ -1066,7 +1060,7 @@ class core_useragent_testcase extends advanced_testcase {
'is_webkit'
=>
true
,
'versionclasses'
=>
array
(
'
safari
'
,
'
chrome
'
,
),
),
),
...
...
@@ -1086,7 +1080,7 @@ class core_useragent_testcase extends advanced_testcase {
'is_webkit'
=>
true
,
'versionclasses'
=>
array
(
'
safari
'
,
'
chrome
'
,
),
),
),
...
...
@@ -1231,7 +1225,6 @@ class core_useragent_testcase extends advanced_testcase {
),
'versionclasses'
=>
array
(
'safari'
,
'ios'
,
),
...
...
theme/boost/scss/moodle/core.scss
View file @
a266ae30
...
...
@@ -1349,7 +1349,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
/* Fixed for safari browser on iPhone4S with ios7@mixin */
@media
(
max-height
:
639px
)
{
.ios
.safari
.choosercontainer
#chooseform
.submitbuttons
{
.ios
.choosercontainer
#chooseform
.submitbuttons
{
padding
:
45px
0
;
}
}
...
...
theme/bootstrapbase/less/moodle/core.less
View file @
a266ae30
...
...
@@ -1573,7 +1573,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
}
/* Fixed for safari browser on iPhone4S with ios7.*/
@media (max-height: 639px) {
.ios
.safari
.choosercontainer #chooseform .submitbuttons {
.ios .choosercontainer #chooseform .submitbuttons {
padding: 45px 0;
}
}
...
...
theme/bootstrapbase/style/moodle.css
View file @
a266ae30
...
...
@@ -3909,7 +3909,7 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
}
/* Fixed for safari browser on iPhone4S with ios7.*/
@media (max-height: 639px) {
.ios
.safari
.choosercontainer #chooseform .submitbuttons {
.ios .choosercontainer #chooseform .submitbuttons {
padding: 45px 0;
}
}
...
...
theme/upgrade.txt
View file @
a266ae30
This files describes API changes in /theme/* themes,
information provided here is intended especially for theme designer.
=== 3.6 ===
* The body tag has various browser-specific classes for those cases where some
browser-sniffing is unavoidable. This used not to recognised Microsoft Edge,
but now it does (class 'edge'). Also, both Safari and Chrome used to be
class 'safari', but now there are separate classes 'safari' and 'chrome'.
The body's class should change to match the browser:
- Google Chrome (Mac & Window): The body class should change from safari to chrome.
- Google Chrome (Android) : The body class should change from safari, android to chrome, android.
- Microsoft Edge: The body class should change from safari to edge.
- Mobile safari: The class ios should exist, safari class should be removed.
* Remove class .safari styling from activity chooser dialog for theme boost and bootstrapbase.
=== 3.4 ===
* There was a mustache template login.mustache in /lib/templates/ rendering the login form
...
...
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