mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2024-12-13 11:52:27 +00:00
commit
0e597ddb87
7 changed files with 77 additions and 81 deletions
|
@ -10,7 +10,6 @@
|
|||
"prettier/prettier": "error",
|
||||
"prefer-template": "error",
|
||||
"no-console": "off",
|
||||
"no-empty": "warn",
|
||||
"no-inner-declarations": "warn",
|
||||
"no-global-assign": "warn",
|
||||
"no-redeclare": "warn",
|
||||
|
@ -19,7 +18,6 @@
|
|||
"no-useless-concat": "warn",
|
||||
"no-useless-escape": "warn",
|
||||
"no-unused-vars": "warn",
|
||||
"no-var": "warn",
|
||||
"use-isnan": "warn"
|
||||
"no-var": "warn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,10 +453,11 @@ function batch_recording_rels() {
|
|||
|
||||
let parsedDate = parseDate(this.value);
|
||||
if (
|
||||
(parsedDate.year || parsedDate.month || parsedDate.day) &&
|
||||
isDateValid(parsedDate.year, parsedDate.month, parsedDate.day)
|
||||
!(
|
||||
(parsedDate.year || parsedDate.month || parsedDate.day) &&
|
||||
isDateValid(parsedDate.year, parsedDate.month, parsedDate.day)
|
||||
)
|
||||
) {
|
||||
} else {
|
||||
$input.css('border-color', '#f00');
|
||||
parsedDate = null;
|
||||
}
|
||||
|
@ -532,7 +533,7 @@ function batch_recording_rels() {
|
|||
get_filtered_page(0);
|
||||
} else {
|
||||
queue_recordings_request(
|
||||
`/ws/2/recording?artist=${ARTIST_MBID}&inc=work-rels` + `&limit=100` + `&offset=${(CURRENT_PAGE - 1) * 100}&fmt=json`
|
||||
`/ws/2/recording?artist=${ARTIST_MBID}&inc=work-rels&limit=100&offset=${(CURRENT_PAGE - 1) * 100}&fmt=json`
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -599,10 +600,9 @@ function batch_recording_rels() {
|
|||
}
|
||||
|
||||
function get_filtered_page(page) {
|
||||
let url =
|
||||
`/ws/2/recording?query=${NAME_FILTER ? `${encodeURIComponent(NAME_FILTER)}%20AND%20` : ''}${
|
||||
ARTIST_FILTER ? `creditname:${encodeURIComponent(ARTIST_FILTER)}%20AND%20` : ''
|
||||
} arid:${ARTIST_MBID}&limit=100` + `&offset=${page * 100}&fmt=json`;
|
||||
let url = `/ws/2/recording?query=${NAME_FILTER ? `${encodeURIComponent(NAME_FILTER)}%20AND%20` : ''}${
|
||||
ARTIST_FILTER ? `creditname:${encodeURIComponent(ARTIST_FILTER)}%20AND%20` : ''
|
||||
} arid:${ARTIST_MBID}&limit=100&offset=${page * 100}&fmt=json`;
|
||||
|
||||
ws_requests.push_get(url, function(data) {
|
||||
_.each(data.recordings, function(r) {
|
||||
|
|
|
@ -53,7 +53,7 @@ var labels = {
|
|||
}
|
||||
};
|
||||
|
||||
var editNote = `Imported from ${document.URL}\n —\n` + `GM script: "${meta.name}" (${meta.version})\n\n`;
|
||||
var editNote = `Imported from ${document.URL}\n —\nGM script: "${meta.name}" (${meta.version})\n\n`;
|
||||
|
||||
function _clean(s) {
|
||||
return s
|
||||
|
|
|
@ -37,7 +37,9 @@ var LOGGER = (function() {
|
|||
if (console && console.log && console.log.apply) {
|
||||
try {
|
||||
console.log.apply(this, args);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ var MBImport = (function() {
|
|||
|
||||
// convert HH:MM:SS or MM:SS to milliseconds
|
||||
function hmsToMilliSeconds(str) {
|
||||
if (typeof str == 'undefined' || str === null || str === NaN || str === '') return NaN;
|
||||
if (typeof str == 'undefined' || str === null || isNaN(str) || str === '') return NaN;
|
||||
if (typeof str == 'number') return str;
|
||||
let t = str.split(':');
|
||||
let s = 0;
|
||||
|
|
|
@ -3,73 +3,71 @@ function _add_css(css) {
|
|||
}
|
||||
|
||||
function MBImportStyle() {
|
||||
let 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:12px !important; \
|
||||
padding:3px 6px; \
|
||||
text-decoration:none; \
|
||||
border: 1px solid rgba(180,180,180,0.8) !important; \
|
||||
background-color: rgba(240,240,240,0.8) !important; \
|
||||
color: #334 !important; \
|
||||
height: 26px ;\
|
||||
} \
|
||||
.musicbrainz_import button:hover { \
|
||||
background-color: rgba(250,250,250,0.9) !important; \
|
||||
} \
|
||||
.musicbrainz_import button:active { \
|
||||
background-color: rgba(170,170,170,0.8) !important; \
|
||||
} \
|
||||
.musicbrainz_import button img { \
|
||||
vertical-align: middle !important; \
|
||||
margin-right: 4px !important; \
|
||||
height: 16px; \
|
||||
} \
|
||||
.musicbrainz_import button span { \
|
||||
min-height: 16px; \
|
||||
display: inline-block; \
|
||||
} \
|
||||
';
|
||||
let 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:12px !important;
|
||||
padding:3px 6px;
|
||||
text-decoration:none;
|
||||
border: 1px solid rgba(180,180,180,0.8) !important;
|
||||
background-color: rgba(240,240,240,0.8) !important;
|
||||
color: #334 !important;
|
||||
height: 26px ;
|
||||
}
|
||||
.musicbrainz_import button:hover {
|
||||
background-color: rgba(250,250,250,0.9) !important;
|
||||
}
|
||||
.musicbrainz_import button:active {
|
||||
background-color: rgba(170,170,170,0.8) !important;
|
||||
}
|
||||
.musicbrainz_import button img {
|
||||
vertical-align: middle !important;
|
||||
margin-right: 4px !important;
|
||||
height: 16px;
|
||||
}
|
||||
.musicbrainz_import button span {
|
||||
min-height: 16px;
|
||||
display: inline-block;
|
||||
}
|
||||
`;
|
||||
_add_css(css_import_button);
|
||||
}
|
||||
|
||||
function MBSearchItStyle() {
|
||||
let css_search_it =
|
||||
' \
|
||||
.mb_valign { \
|
||||
display: inline-block; \
|
||||
vertical-align: top; \
|
||||
} \
|
||||
.mb_searchit { \
|
||||
width: 16px; \
|
||||
height: 16px; \
|
||||
margin: 0; \
|
||||
padding: 0; \
|
||||
background-color: #FFF7BE; \
|
||||
border: 0px; \
|
||||
vertical-align: top; \
|
||||
font-size: 11px; \
|
||||
text-align: center; \
|
||||
} \
|
||||
a.mb_search_link { \
|
||||
color: #888; \
|
||||
text-decoration: none; \
|
||||
} \
|
||||
a.mb_search_link small { \
|
||||
font-size: 8px; \
|
||||
} \
|
||||
.mb_searchit a.mb_search_link:hover { \
|
||||
color: darkblue; \
|
||||
} \
|
||||
.mb_wrapper { \
|
||||
display: inline-block; \
|
||||
} \
|
||||
';
|
||||
let css_search_it = `
|
||||
.mb_valign {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
.mb_searchit {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #FFF7BE;
|
||||
border: 0px;
|
||||
vertical-align: top;
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
}
|
||||
a.mb_search_link {
|
||||
color: #888;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.mb_search_link small {
|
||||
font-size: 8px;
|
||||
}
|
||||
.mb_searchit a.mb_search_link:hover {
|
||||
color: darkblue;
|
||||
}
|
||||
.mb_wrapper {
|
||||
display: inline-block;
|
||||
}
|
||||
`;
|
||||
_add_css(css_search_it);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ function gazellePageHandler() {
|
|||
// Common functions
|
||||
|
||||
function computeAttachURL(mb_toc_numbers, artistName, releaseName) {
|
||||
let url = `${'http://musicbrainz.org/cdtoc/attach' + '?toc='}${mb_toc_numbers.join('%20')}&artist-name=${encodeURIComponent(
|
||||
let url = `${'http://musicbrainz.org/cdtoc/attach?toc='}${mb_toc_numbers.join('%20')}&artist-name=${encodeURIComponent(
|
||||
artistName
|
||||
)}&release-name=${encodeURIComponent(releaseName)}`;
|
||||
return url;
|
||||
|
@ -377,12 +377,10 @@ var MBDiscid = (function() {
|
|||
while (input.length < totalChars) {
|
||||
input = padWith + input;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (input.length > totalChars) {
|
||||
//if padWith was a multiple character string and num was overpadded
|
||||
input = input.substring(input.length - totalChars, totalChars);
|
||||
} else {
|
||||
}
|
||||
|
||||
return input;
|
||||
|
|
Loading…
Reference in a new issue