loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove hacky patch for "safari emoji glitch fix" (#25208)

According to my test, the UI (emoji) is fine in Safari

And actually the code is just dead code, because the "resize" event is
never fired on page loading. So for most cases users just view the pages
without this hacky patch, nobody ever complains.

authored by

wxiaoguang and committed by
GitHub
d8e45608 eaf551b3

-40
-13
web_src/css/base.css
··· 2199 2199 vertical-align: -0.075em; 2200 2200 } 2201 2201 2202 - @supports (-webkit-hyphens:none) { 2203 - body:not(.safari-above125) .emoji, 2204 - body:not(.safari-above125) .reaction { 2205 - font-size: inherit; 2206 - vertical-align: inherit; 2207 - } 2208 - body:not(.safari-above125) .emoji img, 2209 - body:not(.safari-above125) .reaction img { 2210 - font-size: 1.25em; 2211 - vertical-align: -0.225em !important; 2212 - } 2213 - } 2214 - 2215 2202 .emoji img, 2216 2203 .reaction img { 2217 2204 border-width: 0 !important;
-14
web_src/js/features/common-global.js
··· 1 1 import $ from 'jquery'; 2 2 import 'jquery.are-you-sure'; 3 - import {mqBinarySearch} from '../utils.js'; 4 3 import {createDropzone} from './dropzone.js'; 5 4 import {initCompColorPicker} from './comp/ColorPicker.js'; 6 5 import {showGlobalErrorMessage} from '../bootstrap.js'; ··· 62 61 } 63 62 64 63 export function initGlobalCommon() { 65 - // Undo Safari emoji glitch fix at high enough zoom levels 66 - if (navigator.userAgent.match('Safari')) { 67 - $(window).on('resize', () => { 68 - const px = mqBinarySearch('width', 0, 4096, 1, 'px'); 69 - const em = mqBinarySearch('width', 0, 1024, 0.01, 'em'); 70 - if (em * 16 * 1.25 - px <= -1) { 71 - $('body').addClass('safari-above125'); 72 - } else { 73 - $('body').removeClass('safari-above125'); 74 - } 75 - }); 76 - } 77 - 78 64 // Semantic UI modules. 79 65 const $uiDropdowns = $('.ui.dropdown'); 80 66
-13
web_src/js/utils.js
··· 37 37 return text.replace(/<[^>]*>?/g, ''); 38 38 } 39 39 40 - // searches the inclusive range [minValue, maxValue]. 41 - // credits: https://matthiasott.com/notes/write-your-media-queries-in-pixels-not-ems 42 - export function mqBinarySearch(feature, minValue, maxValue, step, unit) { 43 - if (maxValue - minValue < step) { 44 - return minValue; 45 - } 46 - const mid = Math.ceil((minValue + maxValue) / 2 / step) * step; 47 - if (matchMedia(`screen and (min-${feature}:${mid}${unit})`).matches) { 48 - return mqBinarySearch(feature, mid, maxValue, step, unit); // feature is >= mid 49 - } 50 - return mqBinarySearch(feature, minValue, mid - step, step, unit); // feature is < mid 51 - } 52 - 53 40 export function parseIssueHref(href) { 54 41 const path = (href || '').replace(/[#?].*$/, ''); 55 42 const [_, owner, repo, type, index] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || [];