Skip to content

Instantly share code, notes, and snippets.

@uahim
Last active January 22, 2022 20:07
Show Gist options
  • Select an option

  • Save uahim/f86add83a628c0f591c64c1bae1137e8 to your computer and use it in GitHub Desktop.

Select an option

Save uahim/f86add83a628c0f591c64c1bae1137e8 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name deezertitlefix
// @namespace deezer
// @description deezer!
// @include https://www.deezer.com/*
// @exclude https://www.deezer.com/*/playlist/*
// @version 1
// @run-at load
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
var proper_title = "Deezer: ";
var orig_url = location.href;
if (location.href.indexOf("/search/") == -1) {
// artist
var deezatttl = "music.album";
if (document.querySelector('meta[property="og:type"]').getAttribute("content").indexOf(deezatttl) != -1 ) {
proper_title += document.querySelector('meta[name="twitter:description"]').getAttribute("content") + " - " + document.querySelector('meta[property="og:title"]').getAttribute("content");
}
// title/album
var deezalbttl = "music.musician";
if (document.querySelector('meta[property="og:type"]').getAttribute("content").indexOf(deezalbttl) != -1 ) {
proper_title += document.querySelector('meta[property="og:title"]').getAttribute("content");
}
} else {
var search_query = location.href.split("/");
proper_title = "Deezer " + search_query[5] + " search: " + search_query[4].replace(/\+/g, " ").replace(/\%20/g, " ");
}
setInterval(function(){
if (document.title != proper_title) {
document.title = proper_title.replace(" (new album)", "");
}
if ( location.href != orig_url ) {
window.location.reload(false);
// var fuck_javascript=true;
}
},10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment