1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

MDL-50812 core_useragent: <body> classes for Chrome and Edge

This commit is contained in:
Tim Hunt 2018-04-16 16:32:30 +07:00 committed by KietChan
parent 6b2e04676a
commit a266ae30fa
6 changed files with 37 additions and 22 deletions
lib
theme
boost/scss/moodle
bootstrapbase
less/moodle
style
upgrade.txt

@ -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';

@ -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',
),

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

@ -1,6 +1,19 @@
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