Advertise the userscripts homepage in the edit note.

This commit is contained in:
Laurent Monin 2015-06-17 11:51:51 +02:00
parent 979c4fce13
commit 49eef81c43
8 changed files with 13 additions and 7 deletions

View file

@ -178,7 +178,7 @@ var BandcampImport = {
return false; return false;
} }
// Form parameters // Form parameters
var edit_note = 'Imported from ' + release.url; var edit_note = MBReleaseImportHelper.makeEditNote(release.url, 'Bandcamp');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
// Build form // Build form
var mbUI = $('<div id="mb_buttons">' var mbUI = $('<div id="mb_buttons">'

View file

@ -121,7 +121,7 @@ function retrieveReleaseInfo(release_url) {
// Insert button into page under label information // Insert button into page under label information
function insertLink(release, release_url) { function insertLink(release, release_url) {
var edit_note = 'Imported from ' + release_url; var edit_note = MBReleaseImportHelper.makeEditNote(release_url, 'BeatPort Pro');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
var mbUI = $('<li class="interior-release-chart-content-item musicbrainz-import">' var mbUI = $('<li class="interior-release-chart-content-item musicbrainz-import">'

View file

@ -240,7 +240,7 @@ var CD1DImporter = {
// Insert links in page // Insert links in page
// Form parameters // Form parameters
var edit_note = 'Imported from ' + this.currentURL() + ' (' + formatname + ')'; var edit_note = MBReleaseImportHelper.makeEditNote(this.currentURL(), 'CD1D', formatname);
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
// Build form // Build form

View file

@ -384,7 +384,7 @@ function insertLink(release, current_page_key) {
} }
// Form parameters // Form parameters
var edit_note = 'Imported from ' + current_page_info.clean_url; var edit_note = MBReleaseImportHelper.makeEditNote(current_page_info.clean_url, 'Discogs');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
// Build form + search button // Build form + search button

View file

@ -35,7 +35,7 @@ $(document).ready(function() {
function setupImportUI(release) { function setupImportUI(release) {
// Form parameters // Form parameters
var edit_note = 'Imported from ' + window.location.href; var edit_note = MBReleaseImportHelper.makeEditNote(window.location.href, 'Encyclopedisque');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
// Build form // Build form

View file

@ -130,7 +130,7 @@ function retrieveReleaseInfo(release_url) {
// Insert button into page under label information // Insert button into page under label information
function insertLink(release, release_url) { function insertLink(release, release_url) {
var edit_note = 'Imported from ' + release_url; var edit_note = MBReleaseImportHelper.makeEditNote(release_url, 'Juno Download');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
var mbUI = $('<div id="mb_buttons">' var mbUI = $('<div id="mb_buttons">'

View file

@ -99,7 +99,7 @@ function retrieveReleaseInfo(release_url) {
// Insert button into page under label information // Insert button into page under label information
function insertLink(release, release_url) { function insertLink(release, release_url) {
var edit_note = 'Imported from ' + release_url; var edit_note = MBReleaseImportHelper.makeEditNote(release_url, 'Last.fm');
var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note); var parameters = MBReleaseImportHelper.buildFormParameters(release, edit_note);
var innerHTML = MBReleaseImportHelper.buildFormHTML(parameters); var innerHTML = MBReleaseImportHelper.buildFormHTML(parameters);

View file

@ -315,6 +315,11 @@ var MBReleaseImportHelper = (function() {
return (3600 * parseFloat(m[1] || 0) + 60 * parseFloat(m[2] || 0) + parseFloat(m[3] || 0)) * 1000; return (3600 * parseFloat(m[1] || 0) + 60 * parseFloat(m[2] || 0) + parseFloat(m[3] || 0)) * 1000;
} }
function fnMakeEditNote(release_url, importer_name, format) {
var home = 'https://github.com/murdos/musicbrainz-userscripts';
return 'Imported from ' + release_url + (format ? '(' + format + ')' : '') +' using ' + importer_name + ' import script from ' + home;
}
// --------------------------------------- privates ----------------------------------------- // // --------------------------------------- privates ----------------------------------------- //
function appendParameter(parameters, paramName, paramValue) { function appendParameter(parameters, paramName, paramValue) {
@ -380,6 +385,7 @@ var MBReleaseImportHelper = (function() {
guessReleaseType: fnGuessReleaseType, guessReleaseType: fnGuessReleaseType,
hmsToMilliSeconds: hmsToMilliSeconds, hmsToMilliSeconds: hmsToMilliSeconds,
ISO8601toMilliSeconds: fnISO8601toMilliSeconds, ISO8601toMilliSeconds: fnISO8601toMilliSeconds,
makeEditNote: fnMakeEditNote,
searchUrlFor: fnSearchUrlFor, searchUrlFor: fnSearchUrlFor,
URL_TYPES: url_types URL_TYPES: url_types
}; };