From f328752fb9049afac0e77f2f280437aea4358767 Mon Sep 17 00:00:00 2001 From: Git Date: Sun, 23 Jun 2013 08:00:54 +0000 Subject: [PATCH] Empty commit --- classes/script_start.php | 1 + classes/textarea_preview.class.php | 2 +- classes/torrent_form.class.php | 9 +- classes/validate.class.php | 109 ++++++++++--------- design/views/generic/textarea/buttons.phtml | 2 +- design/views/generic/textarea/textarea.phtml | 2 +- docs/CodingStandards.txt | 13 ++- sections/register/index.php | 6 +- sections/reports/array.php | 4 +- sections/reportsv2/array.php | 12 +- sections/requests/request.php | 34 +++--- sections/torrents/details.php | 1 + sections/user/edit.php | 90 ++++++++++----- sections/user/takeedit.php | 39 +++---- static/functions/jquery.validate.js | 66 +++++------ static/functions/musicbrainz.js | 14 ++- 16 files changed, 232 insertions(+), 172 deletions(-) diff --git a/classes/script_start.php b/classes/script_start.php index 66e1210a..355ef2e4 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -152,6 +152,7 @@ case 'Tags': $FileName = 'tags.class'; break; + case 'TEXTAREA_PREVIEW': $FileName = 'textarea_preview.class'; break; diff --git a/classes/textarea_preview.class.php b/classes/textarea_preview.class.php index b7c0f543..a26c6db7 100644 --- a/classes/textarea_preview.class.php +++ b/classes/textarea_preview.class.php @@ -121,7 +121,7 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER { * Flag for preview output * @var bool $preview */ - private $preview = false; + private $preview = false; /** * String table diff --git a/classes/torrent_form.class.php b/classes/torrent_form.class.php index ff21e839..8b15df9e 100644 --- a/classes/torrent_form.class.php +++ b/classes/torrent_form.class.php @@ -290,10 +290,10 @@ function show() { - + - + Disabled?> onblur="CheckYear();" /> This is the year of the original release. @@ -305,7 +305,8 @@ function show() { Catalogue number (optional): Disabled?> /> - Please double check the record label and catalogue number when using MusicBrainz. See this guide for more details. +
+ Please double-check the record label and catalogue number when using MusicBrainz. See this guide for more details. @@ -324,7 +325,7 @@ function show() { echo ">$Val\n"; } ?> - Please take the time to fill this out properly. Need help? Try reading this wiki article or searching MusicBrainz. + Please take the time to fill this out properly. Need help? Try reading this wiki article or searching MusicBrainz. diff --git a/classes/validate.class.php b/classes/validate.class.php index 1e907280..54ae771a 100644 --- a/classes/validate.class.php +++ b/classes/validate.class.php @@ -73,10 +73,10 @@ function ValidateForm($ValidateArray) { $Match = '0-9'; if (isset($Field['AllowPeriod'])) { - $Match.='.'; + $Match .= '.'; } if (isset($Field['AllowComma'])) { - $Match.=','; + $Match .= ','; } if (preg_match('/[^'.$Match.']/', $ValidateVar) || strlen($ValidateVar) < 1) { @@ -172,124 +172,127 @@ function ValidateForm($ValidateArray) { } // function function GenerateJS($FormID) { - $ReturnJS="\r\n"; + $ReturnJS .= "}\r\n"; + $ReturnJS .= "//]]>\r\n"; + $ReturnJS .= "\r\n"; return $ReturnJS; } } diff --git a/design/views/generic/textarea/buttons.phtml b/design/views/generic/textarea/buttons.phtml index a0b46aa9..3bcedebb 100644 --- a/design/views/generic/textarea/buttons.phtml +++ b/design/views/generic/textarea/buttons.phtml @@ -1,4 +1,4 @@ -
+
diff --git a/design/views/generic/textarea/textarea.phtml b/design/views/generic/textarea/textarea.phtml index c8959969..cdd938fe 100644 --- a/design/views/generic/textarea/textarea.phtml +++ b/design/views/generic/textarea/textarea.phtml @@ -1,4 +1,4 @@ -
+
diff --git a/docs/CodingStandards.txt b/docs/CodingStandards.txt index 00e902a0..c7dfba47 100644 --- a/docs/CodingStandards.txt +++ b/docs/CodingStandards.txt @@ -165,11 +165,20 @@ Use C99-style "// ..." comments for single-line comments. 5. USER INTERFACE -All buttons shall use sentence case. +All button labels shall use sentence case. All table headings shall use sentence case. -All text-based buttons shall use the "brackets" CSS class +All text-based buttons shall use the "brackets" CSS class. + +Use common sense for design-related code. Microsoft's UI design guidelines +explain when certain form input controls should be used over others to +provide a familiar and intuitive interface. Refer to the following links +for the most likely issues to encounter in web design: +http://msdn.microsoft.com/en-us/library/windows/desktop/aa511452.aspx +http://msdn.microsoft.com/en-us/library/windows/desktop/aa511453.aspx +http://msdn.microsoft.com/en-us/library/windows/desktop/aa511488.aspx +http://msdn.microsoft.com/en-us/library/windows/desktop/aa511494.aspx 6. EXAMPLES diff --git a/sections/register/index.php b/sections/register/index.php index a1975bfc..83bf39b2 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -36,9 +36,9 @@ $Val->SetFields('email', true, 'email', 'You did not enter a valid email address.'); $Val->SetFields('password', true, 'regex', 'A strong password is between 8 and 40 characters long, contains at least 1 lowercase and uppercase letter, and contains at least a number or symbol', array('regex'=>'/(?=^.{8,}$)(?=.*[^a-zA-Z])(?=.*[A-Z])(?=.*[a-z]).*$/')); $Val->SetFields('confirm_password', true, 'compare', 'Your passwords do not match.', array('comparefield'=>'password')); - $Val->SetFields('readrules', true, 'checkbox', 'You did not check the box that says you will read the rules.'); - $Val->SetFields('readwiki', true, 'checkbox', 'You did not check the box that says you will read the wiki.'); - $Val->SetFields('agereq', true, 'checkbox', 'You did not check the box that says you are 13 years of age or older.'); + $Val->SetFields('readrules', true, 'checkbox', 'You did not select the box that says you will read the rules.'); + $Val->SetFields('readwiki', true, 'checkbox', 'You did not select the box that says you will read the wiki.'); + $Val->SetFields('agereq', true, 'checkbox', 'You did not select the box that says you are 13 years of age or older.'); //$Val->SetFields('captcha', true, 'string', 'You did not enter a captcha code.', array('minlength' => 6, 'maxlength' => 6)); if (!empty($_POST['submit'])) { diff --git a/sections/reports/array.php b/sections/reports/array.php index a6e3f3f1..ff75b7f4 100644 --- a/sections/reports/array.php +++ b/sections/reports/array.php @@ -25,7 +25,7 @@ "guidelines" => array( "This option is for asking the moderators to update your request to the new system.", "If your request has no other votes, you can just edit it yourself!", - "If possible, please include a Discogs or MusicBrainz link in the comments field." + "If possible, please include a Discogs or MusicBrainz link in the comments field." ) ), "request" => array( @@ -33,7 +33,7 @@ "guidelines" => array( "The report request option is for reporting a request which breaks any of the rules found here and for making minor, generally cosmetic, changes to a request (e.g. adding album art, revising a to-be-announced release title, etc.).", "We encourage all users to use this feature whenever possible. This will get quicker action than PMing a staff member will.", - "In your report description below, please be specific and include as much information as possible that will help our staff resolve the issue. Links to reliable, external sources of information are extremely useful when resolving reports. Examples of such sources include the artist's official web site, Discogs, and MusicBrainz.", + "In your report description below, please be specific and include as much information as possible that will help our staff resolve the issue. Links to reliable, external sources of information are extremely useful when resolving reports. Examples of such sources include the artist's official web site, Discogs, and MusicBrainz.", "Do not report requests simply because they are unfillable. Requests for currently unfillable releases are allowed because the request may become fillable in the future. An example of such a scenario would be a request for a physical media rip of a currently iTunes-only release because a physical media release could occur at some future date. The probability of such a physical release is not relevant.", "If you are reporting this request to get it updated to the new requests system, please go back and click '[Request update]'." ) diff --git a/sections/reportsv2/array.php b/sections/reportsv2/array.php index 7b5e4a1f..759f9499 100644 --- a/sections/reportsv2/array.php +++ b/sections/reportsv2/array.php @@ -1,16 +1,16 @@ " class="brackets">Delete - Remove bookmark + Remove bookmark - Bookmark + Bookmark Report request @@ -107,15 +107,15 @@ Find in library Find in stores @@ -128,7 +128,7 @@ -

<?=$FullName?>

+

<?=$FullName?>

<?=$CategoryName?>

@@ -333,9 +333,9 @@ $OCLCs = explode(',', $OCLC); for ($i = 0; $i < count($OCLCs); $i++) { if (!empty($Worldcat)) { - $Worldcat .= ', '.$OCLCs[$i].''; + $Worldcat .= ', '.$OCLCs[$i].''; } else { - $Worldcat = ''.$OCLCs[$i].''; + $Worldcat = ''.$OCLCs[$i].''; } } } @@ -354,7 +354,7 @@ ?> Torrent group - torrents.php?id= + torrents.php?id= @@ -381,8 +381,8 @@ % of this is deducted as tax by the system. @@ -421,7 +421,7 @@ Filled - Yes, + Yes, by user Unfill Unfilling a request without a valid, nontrivial reason will result in a warning. @@ -437,7 +437,7 @@ - /> + /> Should be the permalink (PL) to the torrent (e.g. https:///torrents.php?torrentid=xxxx).

@@ -464,7 +464,11 @@ $Results = Requests::get_comment_count($RequestID); if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) { - $DB->query("SELECT COUNT(ID) FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_GET[postid]"); + $DB->query(" + SELECT COUNT(ID) + FROM requests_comments + WHERE RequestID = $RequestID + AND ID <= $_GET[postid]"); list($PostNum) = $DB->next_record(); list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum); } else { @@ -508,7 +512,7 @@ by - Quote - - Edit + - Edit - Delete diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 0ffcb3a6..ddaca967 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -218,6 +218,7 @@ function compare($X, $Y) {
diff --git a/sections/user/edit.php b/sections/user/edit.php index ff515076..d13941f9 100644 --- a/sections/user/edit.php +++ b/sections/user/edit.php @@ -22,7 +22,7 @@ p.Level AS Class FROM users_main AS m JOIN users_info AS i ON i.UserID = m.ID - LEFT JOIN permissions AS p ON p.ID=m.PermissionID + LEFT JOIN permissions AS p ON p.ID = m.PermissionID WHERE m.ID = '".db_string($UserID)."'"); list($Username, $Email, $IRCKey, $Paranoia, $Info, $Avatar, $Country, $StyleID, $StyleURL, $SiteOptions, $UnseededAlerts, $Class) = $DB->next_record(MYSQLI_NUM, array(3, 9)); @@ -58,7 +58,7 @@ function checked($Checked) { $SiteOptions = array(); } -View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia,bbcode'); +View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery,preview_paranoia,bbcode'); @@ -121,7 +121,7 @@ function checked($Checked) { Profile stats @@ -136,33 +136,60 @@ function checked($Checked) { Default search type - + Torrent grouping -   - + - Discography view + Default discography view - + @@ -229,17 +256,28 @@ function checked($Checked) { + + + + TehConnection integration + + /> + + + + + Torrent search @@ -337,7 +375,7 @@ function checked($Checked) { Quote notifications checked="checked" /> - + @@ -368,7 +406,7 @@ function checked($Checked) { Last.fm username -

Your Last.fm username. Will be used to display Last.fm information on your profile which can be seen by other users.

+

Used to display Last.fm information on your profile which can be seen by other users.

@@ -581,7 +619,7 @@ function checked($Checked) { - + diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php index 319a16ac..43bac60f 100644 --- a/sections/user/takeedit.php +++ b/sections/user/takeedit.php @@ -15,30 +15,30 @@ $Permissions = Permissions::get_permissions($U['PermissionID']); if ($UserID != $LoggedUser['ID'] && !check_perms('users_edit_profiles', $Permissions['Class'])) { - send_irc("PRIVMSG ".ADMIN_CHAN." :User ".$LoggedUser['Username']." (https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID'].") just tried to edit the profile of https://".SSL_SITE_URL."/user.php?id=".$_REQUEST['userid']); + send_irc('PRIVMSG '.ADMIN_CHAN.' :User '.$LoggedUser['Username'].' (https://'.SSL_SITE_URL.'/user.php?id='.$LoggedUser['ID'].') just tried to edit the profile of https://'.SSL_SITE_URL.'/user.php?id='.$_REQUEST['userid']); error(403); } -$Val->SetFields('stylesheet',1,"number","You forgot to select a stylesheet."); -$Val->SetFields('styleurl',0,"regex","You did not enter a valid stylesheet url.",array('regex'=>'/^https?:\/\/(localhost(:[0-9]{2,5})?|[0-9]{1,3}(\.[0-9]{1,3}){3}|([a-zA-Z0-9\-\_]+\.)+([a-zA-Z]{1,5}[^\.]))(:[0-9]{2,5})?(\/[^<>]+)+\.css$/i')); -$Val->SetFields('disablegrouping',1,"number","You forgot to select your torrent grouping option.",array('minlength'=>0,'maxlength'=>1)); -$Val->SetFields('torrentgrouping',1,"number","You forgot to select your torrent grouping option.",array('minlength'=>0,'maxlength'=>1)); -$Val->SetFields('discogview',1,"number","You forgot to select your discography view option.",array('minlength'=>0,'maxlength'=>1)); -$Val->SetFields('postsperpage',1,"number","You forgot to select your posts per page option.",array('inarray'=>array(25,50,100))); -//$Val->SetFields('hidecollage',1,"number","You forgot to select your collage option.",array('minlength'=>0,'maxlength'=>1)); -$Val->SetFields('collagecovers',1,"number","You forgot to select your collage option."); -$Val->SetFields('avatar',0,"regex","You did not enter a valid avatar url.",array('regex'=>"/^".IMAGE_REGEX."$/i")); -$Val->SetFields('email',1,"email","You did not enter a valid email address."); -$Val->SetFields('irckey',0,"string","You did not enter a valid IRCKey, must be between 6 and 32 characters long.",array('minlength'=>6,'maxlength'=>32)); -$Val->SetFields('cur_pass',0,"string","You did not enter a valid password, must be at least 6 characters long.",array('minlength'=>6,'maxlength'=>150)); -$Val->SetFields('new_pass_1',0,"regex","You did not enter a valid password. A strong password is between 8 and 40 characters long contains at least 1 lowercase and uppercase letter, contains at least a number or symbol",array('regex'=>'/(?=^.{8,}$)(?=.*[^a-zA-Z])(?=.*[A-Z])(?=.*[a-z]).*$/')); -$Val->SetFields('new_pass_2',1,"compare","Your passwords do not match.",array('comparefield'=>'new_pass_1')); +$Val->SetFields('stylesheet', 1, "number", "You forgot to select a stylesheet."); +$Val->SetFields('styleurl', 0, "regex", "You did not enter a valid stylesheet URL.", array('regex' => '/^https?:\/\/(localhost(:[0-9]{2,5})?|[0-9]{1,3}(\.[0-9]{1,3}){3}|([a-zA-Z0-9\-\_]+\.)+([a-zA-Z]{1,5}[^\.]))(:[0-9]{2,5})?(\/[^<>]+)+\.css$/i')); +// The next two are commented out because the drop-down menus were replaced with a check box and radio buttons +//$Val->SetFields('disablegrouping', 0, "number", "You forgot to select your torrent grouping option."); +//$Val->SetFields('torrentgrouping', 0, "number", "You forgot to select your torrent grouping option."); +$Val->SetFields('discogview', 1, "number", "You forgot to select your discography view option.", array('minlength' => 0, 'maxlength' => 1)); +$Val->SetFields('postsperpage', 1, "number", "You forgot to select your posts per page option.", array('inarray' => array(25, 50, 100))); +//$Val->SetFields('hidecollage', 1, "number", "You forgot to select your collage option.", array('minlength' => 0, 'maxlength' => 1)); +$Val->SetFields('collagecovers', 1, "number", "You forgot to select your collage option."); +$Val->SetFields('avatar', 0, "regex", "You did not enter a valid avatar URL.", array('regex' => "/^".IMAGE_REGEX."$/i")); +$Val->SetFields('email', 1, "email", "You did not enter a valid email address."); +$Val->SetFields('irckey', 0, "string", "You did not enter a valid IRCKey. An IRCKey must be between 6 and 32 characters long.", array('minlength' => 6, 'maxlength' => 32)); +$Val->SetFields('cur_pass', 0, "string", "You did not enter a valid password. Passwords must be at least 6 characters long.", array('minlength' => 6, 'maxlength' => 150)); +$Val->SetFields('new_pass_1', 0, "regex", "You did not enter a valid password. A strong password is between 8 and 40 characters long contains at least 1 lowercase and uppercase letter, contains at least a number or symbol", array('regex' => '/(?=^.{8,}$)(?=.*[^a-zA-Z])(?=.*[A-Z])(?=.*[a-z]).*$/')); +$Val->SetFields('new_pass_2', 1, "compare", "Your passwords do not match.", array('comparefield' => 'new_pass_1')); if (check_perms('site_advanced_search')) { - $Val->SetFields('searchtype',1,"number","You forgot to select your default search preference.",array('minlength'=>0,'maxlength'=>1)); + $Val->SetFields('searchtype', 1, "number", "You forgot to select your default search preference.", array('minlength' => 0, 'maxlength' => 1)); } $Err = $Val->ValidateForm($_POST); - if ($Err) { error($Err); header('Location: user.php?action=edit&userid='.$UserID); @@ -183,7 +183,7 @@ } if ($LoggedUser['DisableAvatar'] && $_POST['avatar'] != $U['Avatar']) { - $Err = 'Your avatar rights have been removed.'; + $Err = 'Your avatar privileges have been revoked.'; } if ($Err) { @@ -195,7 +195,7 @@ if (!empty($LoggedUser['DefaultSearch'])) { $Options['DefaultSearch'] = $LoggedUser['DefaultSearch']; } -$Options['DisableGrouping2'] = (!empty($_POST['disablegrouping']) ? 1 : 0); +$Options['DisableGrouping2'] = (!empty($_POST['disablegrouping']) ? 0 : 1); $Options['TorrentGrouping'] = (!empty($_POST['torrentgrouping']) ? 1 : 0); $Options['DiscogView'] = (!empty($_POST['discogview']) ? 1 : 0); $Options['PostsPerPage'] = (int) $_POST['postsperpage']; @@ -216,6 +216,7 @@ $Options['ShowSnatched'] = (!empty($_POST['showsnatched']) ? 1 : 0); $Options['DisableAutoSave'] = (!empty($_POST['disableautosave']) ? 1 : 0); $Options['NoVoteLinks'] = (!empty($_POST['novotelinks']) ? 1 : 0); + $Options['CoverArt'] = (int) !empty($_POST['coverart']); $Options['ShowExtraCovers'] = (int) !empty($_POST['show_extra_covers']); diff --git a/static/functions/jquery.validate.js b/static/functions/jquery.validate.js index 95a279f6..0f62354e 100644 --- a/static/functions/jquery.validate.js +++ b/static/functions/jquery.validate.js @@ -1,8 +1,8 @@ /*! * jQuery Validation Plugin 1.12.0pre * - * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ - * http://docs.jquery.com/Plugins/Validation + * http://jqueryvalidation.org/ + * http://jqueryvalidation.org/documentation/ * * Copyright 2013 Jörn Zaefferer * Released under the MIT license: @@ -12,7 +12,7 @@ (function($) { $.extend($.fn, { - // http://docs.jquery.com/Plugins/Validation/validate + // http://jqueryvalidation.org/validate/ validate: function( options ) { // if nothing is selected, return nothing; can't chain anyway if ( !this.length ) { @@ -94,7 +94,7 @@ $.extend($.fn, { return validator; }, - // http://docs.jquery.com/Plugins/Validation/valid + // http://jqueryvalidation.org/valid/ valid: function() { if ( $(this[0]).is("form")) { return this.validate().form(); @@ -117,7 +117,7 @@ $.extend($.fn, { }); return result; }, - // http://docs.jquery.com/Plugins/Validation/rules + // http://jqueryvalidation.org/rules/ rules: function( command, argument ) { var element = this[0]; @@ -171,11 +171,11 @@ $.extend($.fn, { // Custom selectors $.extend($.expr[":"], { - // http://docs.jquery.com/Plugins/Validation/blank + // http://jqueryvalidation.org/blank-selector/ blank: function( a ) { return !$.trim("" + $(a).val()); }, - // http://docs.jquery.com/Plugins/Validation/filled + // http://jqueryvalidation.org/filled-selector/ filled: function( a ) { return !!$.trim("" + $(a).val()); }, - // http://docs.jquery.com/Plugins/Validation/unchecked + // http://jqueryvalidation.org/unchecked-selector/ unchecked: function( a ) { return !$(a).prop("checked"); } }); @@ -194,7 +194,7 @@ $.validator.format = function( source, params ) { return $.validator.format.apply( this, args ); }; } - if ( arguments.length > 2 && params.constructor !== Array ) { + if ( arguments.length > 2 && params.constructor !== Array ) { params = $.makeArray(arguments).slice(1); } if ( params.constructor !== Array ) { @@ -272,7 +272,7 @@ $.extend($.validator, { } }, - // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults + // http://jqueryvalidation.org/jQuery.validator.setDefaults/ setDefaults: function( settings ) { $.extend( $.validator.defaults, settings ); }, @@ -346,7 +346,7 @@ $.extend($.validator, { } }, - // http://docs.jquery.com/Plugins/Validation/Validator/form + // http://jqueryvalidation.org/Validator.form/ form: function() { this.checkForm(); $.extend(this.submitted, this.errorMap); @@ -366,7 +366,7 @@ $.extend($.validator, { return this.valid(); }, - // http://docs.jquery.com/Plugins/Validation/Validator/element + // http://jqueryvalidation.org/Validator.element/ element: function( element ) { element = this.validationTargetFor( this.clean( element ) ); this.lastElement = element; @@ -386,7 +386,7 @@ $.extend($.validator, { return result; }, - // http://docs.jquery.com/Plugins/Validation/Validator/showErrors + // http://jqueryvalidation.org/Validator.showErrors/ showErrors: function( errors ) { if ( errors ) { // add items to error list and map @@ -410,7 +410,7 @@ $.extend($.validator, { } }, - // http://docs.jquery.com/Plugins/Validation/Validator/resetForm + // http://jqueryvalidation.org/Validator.resetForm/ resetForm: function() { if ( $.fn.resetForm ) { $(this.currentForm).resetForm(); @@ -980,7 +980,7 @@ $.extend($.validator, { return data; }, - // http://docs.jquery.com/Plugins/Validation/Validator/addMethod + // http://jqueryvalidation.org/jQuery.validator.addMethod/ addMethod: function( name, method, message ) { $.validator.methods[name] = method; $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; @@ -991,7 +991,7 @@ $.extend($.validator, { methods: { - // http://docs.jquery.com/Plugins/Validation/Methods/required + // http://jqueryvalidation.org/required-method/ required: function( value, element, param ) { // check if dependency is met if ( !this.depend(param, element) ) { @@ -1008,40 +1008,40 @@ $.extend($.validator, { return $.trim(value).length > 0; }, - // http://docs.jquery.com/Plugins/Validation/Methods/email + // http://jqueryvalidation.org/email-method/ email: function( value, element ) { // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); }, - // http://docs.jquery.com/Plugins/Validation/Methods/url + // http://jqueryvalidation.org/url-method/ url: function( value, element ) { // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); }, - // http://docs.jquery.com/Plugins/Validation/Methods/date + // http://jqueryvalidation.org/date-method/ date: function( value, element ) { return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString()); }, - // http://docs.jquery.com/Plugins/Validation/Methods/dateISO + // http://jqueryvalidation.org/dateISO-method/ dateISO: function( value, element ) { return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); }, - // http://docs.jquery.com/Plugins/Validation/Methods/number + // http://jqueryvalidation.org/number-method/ number: function( value, element ) { return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); }, - // http://docs.jquery.com/Plugins/Validation/Methods/digits + // http://jqueryvalidation.org/digits-method/ digits: function( value, element ) { return this.optional(element) || /^\d+$/.test(value); }, - // http://docs.jquery.com/Plugins/Validation/Methods/creditcard - // based on http://en.wikipedia.org/wiki/Luhn + // http://jqueryvalidation.org/creditcard-method/ + // based on https://en.wikipedia.org/wiki/Luhn_algorithm creditcard: function( value, element ) { if ( this.optional(element) ) { return "dependency-mismatch"; @@ -1069,42 +1069,42 @@ $.extend($.validator, { } return (nCheck % 10) === 0; - }, + } , - // http://docs.jquery.com/Plugins/Validation/Methods/minlength + // http://jqueryvalidation.org/minlength-method/ minlength: function( value, element, param ) { var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); return this.optional(element) || length >= param; }, - // http://docs.jquery.com/Plugins/Validation/Methods/maxlength + // http://jqueryvalidation.org/maxlength-method/ maxlength: function( value, element, param ) { var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); return this.optional(element) || length <= param; }, - // http://docs.jquery.com/Plugins/Validation/Methods/rangelength + // http://jqueryvalidation.org/rangelength-method/ rangelength: function( value, element, param ) { var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); return this.optional(element) || ( length >= param[0] && length <= param[1] ); }, - // http://docs.jquery.com/Plugins/Validation/Methods/min + // http://jqueryvalidation.org/min-method/ min: function( value, element, param ) { return this.optional(element) || value >= param; }, - // http://docs.jquery.com/Plugins/Validation/Methods/max + // http://jqueryvalidation.org/max-method/ max: function( value, element, param ) { return this.optional(element) || value <= param; }, - // http://docs.jquery.com/Plugins/Validation/Methods/range + // http://jqueryvalidation.org/range-method/ range: function( value, element, param ) { return this.optional(element) || ( value >= param[0] && value <= param[1] ); }, - // http://docs.jquery.com/Plugins/Validation/Methods/equalTo + // http://jqueryvalidation.org/equalTo-method/ equalTo: function( value, element, param ) { // bind to the blur event of the target in order to revalidate whenever the target field is updated // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead @@ -1117,7 +1117,7 @@ $.extend($.validator, { return value === target.val(); }, - // http://docs.jquery.com/Plugins/Validation/Methods/remote + // http://jqueryvalidation.org/remote-method/ remote: function( value, element, param ) { if ( this.optional(element) ) { return "dependency-mismatch"; diff --git a/static/functions/musicbrainz.js b/static/functions/musicbrainz.js index 13ff49b0..0a4e34cf 100644 --- a/static/functions/musicbrainz.js +++ b/static/functions/musicbrainz.js @@ -1,5 +1,5 @@ /** - * Allows the user to populate upload form using musicbrainz. + * Allows the user to populate upload form using MusicBrainz. * Popup display code based on example found here http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-using-jquery/ * * @author Gwindow @@ -40,12 +40,14 @@ $(document).ready(function() { var $album_encoded = encodeURIComponent($album); $.ajax({ type: "GET", - url : "http://www.musicbrainz.org/ws/2/release-group/?query=artist:%22" + $artist_encoded + "%22%20AND%20releasegroup:%22" + $album_encoded + "%22", + url : "https://musicbrainz.org/ws/2/release-group/?query=artist:%22" + $artist_encoded + "%22%20AND%20releasegroup:%22" + $album_encoded + "%22", dataType: "xml", success: showReleaseGroups }); - } else { alert("Please fill out artist and/or album fields.");} + } else { + alert("Please fill out artist and/or album fields."); + } }); $("#results1").click(function(event) { @@ -109,7 +111,7 @@ function showReleaseGroups(xml) { if ($count == 0 ) { alert("Could not find on MusicBrainz"); } else { - jQuery('#popup_title').text("Choose Release Group"); + jQuery('#popup_title').text("Choose release group"); openPopup(); } @@ -133,7 +135,7 @@ function showReleases(xml) { $year_original = $date_release_group.substring(0,4); $release_type = $(xml).find("release-group").attr("type"); $release_group_id = $(xml).find("release-group").attr("id"); - jQuery('#popup_title').html("Choose Release " + 'View on MusicBrainz'); jQuery('#popup_back').html('Go back'); @@ -221,7 +223,7 @@ function populateForm(xml) { var $amazon_link = ""; if ($asin.length > 0) { - $amazin_link = "[url=http://amazon.com/exec/obidos/ASIN/" + $asin + "]Amazon[/url]" + "\n"; + $amazon_link = "[url=http://www.amazon.com/exec/obidos/ASIN/" + $asin + "]Amazon[/url]" + "\n"; } var $country_text = ""; if ($country.length > 0) {