Update browser detection with new Edge

Don't show Twitter + Discord notification at the same time
This commit is contained in:
JannisX11 2020-07-24 21:13:25 +02:00
parent e1d183b76c
commit d79fa38c10
2 changed files with 24 additions and 18 deletions

View File

@ -18,13 +18,17 @@ if (isApp === false) {
Blockbench.browser = 'safari'
} else if (!!document.documentMode) {
Blockbench.browser = 'internet_explorer'
} else if (!!window.StyleMedia) {
} else if (!!window.chrome && window.navigator.userAgent.toLowerCase().includes('edg')) {
Blockbench.browser = 'edge'
} else if (!!window.StyleMedia) {
Blockbench.browser = 'proprietary_edge'
} else if (!!window.chrome && !window.chrome.webstore) {
Blockbench.browser = 'chromium'
}
if (navigator.appVersion.indexOf("Win") != -1) OSName = 'Windows';
if (navigator.appVersion.indexOf("Mac") != -1) OSName = 'MacOS';
if (navigator.appVersion.indexOf("Linux") != -1)OSName = 'Linux';
if (['edge', 'internet_explorer'].includes(Blockbench.browser)) {
if (navigator.appVersion.indexOf("Win") != -1) Blockbench.operating_system = 'Windows';
if (navigator.appVersion.indexOf("Mac") != -1) Blockbench.operating_system = 'MacOS';
if (navigator.appVersion.indexOf("Linux") != -1) Blockbench.operating_system = 'Linux';
if (['proprietary_edge', 'internet_explorer'].includes(Blockbench.browser)) {
alert(capitalizeFirstLetter(Blockbench.browser)+' does not support Blockbench')
}
$('.local_only').remove()

View File

@ -628,21 +628,10 @@ function addStartScreenSection(id, data) {
]
})
}
//Discord
if (Blockbench.startup_count < 6) {
addStartScreenSection({
color: '#7289da',
text_color: '#ffffff',
graphic: {type: 'icon', icon: 'fab.fa-discord'},
text: [
{type: 'h1', text: 'Discord Server'},
{text: 'You need help with modeling or you want to chat about Blockbench? Join the [Modeling Discord](https://discord.gg/WVHg5kH)!'}
],
last: true
})
}
//Twitter
let twitter_ad;
if (Blockbench.startup_count < 20 && Blockbench.startup_count % 5 === 4) {
twitter_ad = true;
addStartScreenSection({
color: '#1da1f2',
text_color: '#ffffff',
@ -654,6 +643,19 @@ function addStartScreenSection(id, data) {
last: true
})
}
//Discord
if (Blockbench.startup_count < 6 && !twitter_ad) {
addStartScreenSection({
color: '#7289da',
text_color: '#ffffff',
graphic: {type: 'icon', icon: 'fab.fa-discord'},
text: [
{type: 'h1', text: 'Discord Server'},
{text: 'You need help with modeling or you want to chat about Blockbench? Join the [Modeling Discord](https://discord.gg/WVHg5kH)!'}
],
last: true
})
}
})
})()