Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use og:image as favicon on Gitlab pages
// ==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);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.