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