Last active
May 14, 2022 13:15
-
-
Save popstas/9d17c1b0e1772a84581b3af8a342ad73 to your computer and use it in GitHub Desktop.
Use og:image as favicon on Gitlab pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gitlab project favicon | |
// @author Stanislav Popov | |
// @version 0.1 | |
// @namespace popstas.ru | |
// @description Use og:image as favicon on Gitlab pages | |
// @unwrap | |
// @noframes | |
// @run-at document-end | |
// @updateURL https://gist.github.com/popstas/9d17c1b0e1772a84581b3af8a342ad73/raw/1f2c562a128568e1b220457bdab1e9d60dc1467d/gitlab-project-favicon.user.js | |
// @include https://git.viasite.ru/* | |
// @match https://git.viasite.ru/* | |
// ==/UserScript== | |
(function(){ | |
'use strict'; | |
var u ='undefined', win = typeof unsafeWindow !=u ? unsafeWindow: window; | |
var $ = win.$; | |
win.onerror = function(error, file, line){ | |
console.log(error +' (line '+line+')'); | |
}; | |
if(win.top != win.self){ | |
return false; // ignore iframes | |
} | |
$(function(){ | |
var project_img = $('meta[property="og:image"]').attr('content'); | |
if(project_img){ | |
$('#favicon').attr('href', project_img); | |
} | |
}); | |
})(); |
Safari uses tab icons from mask-icon
. I've tried to add the following:
$('link[rel="mask-icon"]').attr('href', project_img);
But it doesn't help.
Hello, thanks for reminding me about this script ) Just checked, it works same as in 2018. I don't have Mac, so can't fix it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like it doesn't work in Tampermonkey for Safari