Skip to content

Commit

Permalink
Safari: fix popup size
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 committed Sep 14, 2022
1 parent 1d24f8e commit feced0b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
Binary file added public/assets/images/IITC-black-horizontally.webp
Binary file not shown.
45 changes: 42 additions & 3 deletions src/popup/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3 -->
<template>
<div id="app">
<div id="app" :class="{ is_safari: is_safari }">
<section class="section main-menu">
<SectionMainMenu
v-bind:categories="categories"
Expand Down Expand Up @@ -39,15 +39,27 @@ export default {
categories: {},
plugins: {},
plugins_flat: {},
category_name: ""
category_name: "",
is_safari: this.detect_safari()
};
},
components: { SectionMainMenu, SectionOptions, SectionPlugins, Message },
async mounted() {
beforeCreate() {
document.body.id = "main-menu";
},
async mounted() {
await data.init(this);
await data.onChangedListener(this);
await data.onMessageListener(this);
},
methods: {
detect_safari: function() {
let userAgentString = navigator.userAgent;
let chromeAgent = userAgentString.indexOf("Chrome") > -1;
let safariAgent = userAgentString.indexOf("Safari") > -1;

return safariAgent && !chromeAgent;
}
}
};
</script>
Expand All @@ -70,6 +82,13 @@ body {
font-size: 20px;
}

#app {
width: 315px;
height: 513px;
overflow: hidden;
/*transform: translateZ(0); * hack of popup size in safari *!*/
}

object {
pointer-events: none;
}
Expand All @@ -92,11 +111,13 @@ object {
*/
.section {
display: block;
background: #fff;
position: absolute;
top: 0;
margin-left: 100vw;
transition: margin-left 0.15s ease-in-out;
width: 100vw;
height: 100vh;
}
.section.main-menu {
margin-left: -100vw;
Expand All @@ -110,6 +131,24 @@ body#plugins .section.plugins {
margin-left: 0;
}

#app.is_safari .section {
display: none;
width: 100vw;
}

#app.is_safari .section.main-menu {
display: none;
}

body#main-menu #app.is_safari .section.main-menu {
display: block;
}

body#options #app.is_safari .section.options,
body#plugins #app.is_safari .section.plugins {
display: block;
}

:root {
--color-white: #fff;
--color-blue: #0074d9;
Expand Down
11 changes: 11 additions & 0 deletions src/popup/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,15 @@ export default {
.message.opened {
bottom: 0;
}

#app.is_safari .message {
display: none;
left: 0;
bottom: 0;
right: 0;
}

#app.is_safari .message.opened {
display: block;
}
</style>
10 changes: 5 additions & 5 deletions src/popup/components/Title.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
class="title__logo-wrapper title__button"
v-on:click.prevent="openIITC"
>
<object
<img
class="title__logo"
type="image/svg+xml"
data="/assets/images/IITC-black-horizontally.svg"
></object>
src="/assets/images/IITC-black-horizontally.webp"
/>
<ProgressBar></ProgressBar>
</div>
<div class="title__button" v-on:click="openOptions">
Expand Down Expand Up @@ -53,9 +52,10 @@ export default {
}
.title__logo {
height: 50px;
width: 100%;
width: 106px;
z-index: 3;
position: relative;
left: calc(50% - 106px / 2);
}
.title__button {
color: var(--color-white);
Expand Down

0 comments on commit feced0b

Please sign in to comment.