mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-12 19:32:27 +00:00
Unify the style of the MB import button among websites
- display musicbrainz icon in it - unify css style - add a new lib/mbimportstyle.js (store functions inserting css)
This commit is contained in:
parent
42bb4890ca
commit
5a2d439d55
8 changed files with 49 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
|||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mblinks.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
|
@ -201,6 +202,7 @@ var BandcampImport = {
|
|||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
MBImportStyle();
|
||||
|
||||
var mblinks = new MBLinks('BCI_MBLINKS_CACHE', 7*24*60); // force refresh of cached links once a week
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
|
||||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
// prevent JQuery conflicts, see http://wiki.greasespot.net/@grant
|
||||
|
@ -19,6 +20,8 @@ this.$ = this.jQuery = jQuery.noConflict(true);
|
|||
if (!unsafeWindow) unsafeWindow = window;
|
||||
|
||||
$(document).ready(function(){
|
||||
MBImportStyle();
|
||||
|
||||
var release_url = window.location.href.replace('/\?.*$/', '').replace(/#.*$/, '');
|
||||
var release = retrieveReleaseInfo(release_url);
|
||||
insertLink(release, release_url);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
|
||||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
/* Import releases from http://cd1d.com to MusicBrainz */
|
||||
|
@ -250,7 +251,7 @@ var CD1DImporter = {
|
|||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
MBImportStyle();
|
||||
/* CD1D uses same page with hidden tabs for all formats */
|
||||
var formats = CD1DImporter.getFormats();
|
||||
//LOGGER.info('Formats:', formats);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mblinks.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
|
@ -40,6 +41,8 @@ var mblinks = new MBLinks('DISCOGS_MBLINKS_CACHE', 7*24*60, '1'); // force refre
|
|||
|
||||
$(document).ready(function(){
|
||||
|
||||
MBImportStyle();
|
||||
|
||||
var current_page_key = getDiscogsLinkKey(window.location.href.replace(/\?.*$/, '').replace(/#.*$/, '').replace('/master/view/', '/master/'));
|
||||
if (!current_page_key) return;
|
||||
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
|
||||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
$(document).ready(function() {
|
||||
MBImportStyle();
|
||||
|
||||
if (window.location.href.match( /encyclopedisque\.fr\/disque\/(\d+)/) ) {
|
||||
var release = parseEncyclopedisquePage();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
|
||||
// @require lib/import_functions.js
|
||||
// @require lib/logger.js
|
||||
// @require lib/mbimportstyle.js
|
||||
// ==/UserScript==
|
||||
|
||||
// prevent JQuery conflicts, see http://wiki.greasespot.net/@grant
|
||||
|
@ -18,6 +19,7 @@ this.$ = this.jQuery = jQuery.noConflict(true);
|
|||
if (!unsafeWindow) unsafeWindow = window;
|
||||
|
||||
$(document).ready(function(){
|
||||
MBImportStyle();
|
||||
var release_url = window.location.href.replace('/\?.*$/', '').replace(/#.*$/, '');
|
||||
var release = retrieveReleaseInfo(release_url);
|
||||
insertLink(release, release_url);
|
||||
|
|
|
@ -111,7 +111,7 @@ var MBReleaseImportHelper = (function() {
|
|||
innerHTML += "<input type='hidden' value='" + value.replace(/'/g,"'") + "' name='" + parameter.name + "'/>";
|
||||
});
|
||||
|
||||
innerHTML += '<button type="submit">Import into MB</button>';
|
||||
innerHTML += '<button type="submit"><img src="//musicbrainz.org/favicon.ico" /><span>Import into MB</span></button>';
|
||||
innerHTML += '</form>';
|
||||
|
||||
return innerHTML;
|
||||
|
|
34
lib/mbimportstyle.js
Normal file
34
lib/mbimportstyle.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
function _add_css(css) {
|
||||
$("<style type='text/css'>"+css.replace(/\s+/g, ' ') + "</style>").appendTo("head");
|
||||
}
|
||||
|
||||
function MBImportStyle() {
|
||||
var css_import_button = " \
|
||||
.musicbrainz_import button { \
|
||||
-moz-border-radius:5px; \
|
||||
-webkit-border-radius:5px; \
|
||||
border-radius:5px; \
|
||||
display:inline-block; \
|
||||
cursor:pointer; \
|
||||
font-family:Arial; \
|
||||
font-size:14px !important; \
|
||||
padding:3px 6px; \
|
||||
text-decoration:none; \
|
||||
border: 1px solid #888 !important; \
|
||||
background-color: rgba(240,240,240,0.8) !important; \
|
||||
color: #334 !important; \
|
||||
} \
|
||||
.musicbrainz_import button:hover { \
|
||||
background-color: rgba(250,250,250,0.9) !important; \
|
||||
} \
|
||||
.musicbrainz_import button:active { \
|
||||
position:relative; \
|
||||
top:1px; \
|
||||
} \
|
||||
.musicbrainz_import button img { \
|
||||
vertical-align: middle !important; \
|
||||
margin-right: 4px !important; \
|
||||
} \
|
||||
";
|
||||
_add_css(css_import_button);
|
||||
}
|
Loading…
Reference in a new issue