summaryrefslogtreecommitdiffstats
path: root/static/functions
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-04-30 18:18:07 +0000
committerGit <git@what.cd>2013-04-30 18:18:07 +0000
commitb055e9c6f1189ea4f2b9649de1ce63548d2d1b2b (patch)
treecf5b4d9bf8b985adfb6923b737dc3929c0f66727 /static/functions
parent0a565870d9727b0913e9ec0775380d786fde418d (diff)
downloadGazelle-b055e9c6f1189ea4f2b9649de1ce63548d2d1b2b.zip
Gazelle-b055e9c6f1189ea4f2b9649de1ce63548d2d1b2b.tar.gz
Gazelle-b055e9c6f1189ea4f2b9649de1ce63548d2d1b2b.tar.bz2
Empty commit
Diffstat (limited to 'static/functions')
-rw-r--r--static/functions/bbcode.js2
-rw-r--r--static/functions/browse.js6
-rw-r--r--static/functions/class_ajax.js2
-rw-r--r--static/functions/iphone.js30
-rw-r--r--static/functions/push_settings.js8
-rw-r--r--static/functions/recommend.js2
-rw-r--r--static/functions/reportsv2.js54
-rw-r--r--static/functions/subscriptions.js8
-rw-r--r--static/functions/torrent.js8
-rw-r--r--static/functions/upload.js54
-rw-r--r--static/functions/user.js4
-rw-r--r--static/functions/valid_tags.js2
-rw-r--r--static/functions/validate.js112
-rw-r--r--static/functions/validate_upload.js13
14 files changed, 169 insertions, 136 deletions
diff --git a/static/functions/bbcode.js b/static/functions/bbcode.js
index bf9e985..4014e13 100644
--- a/static/functions/bbcode.js
+++ b/static/functions/bbcode.js
@@ -1,6 +1,6 @@
var BBCode = {
spoiler: function(link) {
- if($(link.nextSibling).has_class('hidden')) {
+ if ($(link.nextSibling).has_class('hidden')) {
$(link.nextSibling).show();
$(link).html('Hide');
} else {
diff --git a/static/functions/browse.js b/static/functions/browse.js
index 8db5822..b210f06 100644
--- a/static/functions/browse.js
+++ b/static/functions/browse.js
@@ -1,5 +1,5 @@
function show_peers (TorrentID, Page) {
- if(Page>0) {
+ if (Page > 0) {
ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#peers_' + TorrentID).show().raw().innerHTML=response;
});
@@ -20,7 +20,7 @@ function show_peers (TorrentID, Page) {
}
function show_snatches (TorrentID, Page){
- if(Page>0) {
+ if (Page > 0) {
ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#snatches_' + TorrentID).show().raw().innerHTML=response;
});
@@ -41,7 +41,7 @@ function show_snatches (TorrentID, Page){
}
function show_downloads (TorrentID, Page){
- if(Page>0) {
+ if (Page > 0) {
ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#downloads_' + TorrentID).show().raw().innerHTML=response;
});
diff --git a/static/functions/class_ajax.js b/static/functions/class_ajax.js
index f283fe3..86d5c97 100644
--- a/static/functions/class_ajax.js
+++ b/static/functions/class_ajax.js
@@ -139,7 +139,7 @@ function Bookmark(type, id, newName) {
}
function Unbookmark(type, id, newName) {
- if(window.location.pathname.indexOf('bookmarks.php') != -1) {
+ if (window.location.pathname.indexOf('bookmarks.php') != -1) {
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
$('#group_' + id).remove();
$('.groupid_' + id).remove();
diff --git a/static/functions/iphone.js b/static/functions/iphone.js
index ba992da..b454e74 100644
--- a/static/functions/iphone.js
+++ b/static/functions/iphone.js
@@ -56,7 +56,7 @@ function main () {
get_headers(response);
elements.titles[0].innerHTML = title;
elements.pages[0].innerHTML = response;
- if(back_name){
+ if (back_name) {
elements.buttons[0].textContent = back_name;
}
});
@@ -78,7 +78,7 @@ function go_back() {
// Get data from comments
function get_headers(response) {
title = response.match(/\<\!\-\-Title\:(.+?)\-\-\>/i)[1];
- if(response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) {
+ if (response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) {
back_name = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[1];
back_url = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[2];
} else {
@@ -89,10 +89,16 @@ function get_headers(response) {
// Load content
function load(url,forward,formid) {
- if(forward===undefined) { forward=true; }
- if (transitions_in_progress && document.createTouch) { return; } //OS 2
- if (moved_after_touch) { return; }
- if(formid===undefined){
+ if (forward === undefined) {
+ forward = true;
+ }
+ if (transitions_in_progress && document.createTouch) { // OS 2
+ return;
+ }
+ if (moved_after_touch) {
+ return;
+ }
+ if (formid === undefined){
ajax.get(url, function (response) {
get_headers(response);
transition_to_new_element(response, forward);
@@ -105,12 +111,18 @@ function load(url,forward,formid) {
// Moves
var moved_after_touch = false;
-function touch_started () { moved_after_touch = false; };
-function touch_moved () { moved_after_touch = true; };
+function touch_started () {
+ moved_after_touch = false;
+};
+function touch_moved () {
+ moved_after_touch = true;
+};
// Transitions
var transitions_in_progress = false;
-function transition_ended () { transitions_in_progress = false; };
+function transition_ended () {
+ transitions_in_progress = false;
+};
function transition_to_new_element (data, going_forward) {
transitions_in_progress = true;
diff --git a/static/functions/push_settings.js b/static/functions/push_settings.js
index 218270f..685971c 100644
--- a/static/functions/push_settings.js
+++ b/static/functions/push_settings.js
@@ -2,16 +2,16 @@
var PUSHOVER = 5;
var TOASTY = 4;
$(document).ready(function() {
- if($("#pushservice").val() > 0) {
+ if ($("#pushservice").val() > 0) {
$('#pushsettings').show();
}
$("#pushservice").change(function() {
- if($(this).val() > 0) {
+ if ($(this).val() > 0) {
$('#pushsettings').show(500);
- if($(this).val() == TOASTY) {
+ if ($(this).val() == TOASTY) {
$('#pushservice_title').text("Device ID");
- } else if($(this).val() == PUSHOVER) {
+ } else if ($(this).val() == PUSHOVER) {
$('#pushservice_title').text("User Key");
} else {
$('#pushservice_title').text("API Key");
diff --git a/static/functions/recommend.js b/static/functions/recommend.js
index 1d1afcd..16172d5 100644
--- a/static/functions/recommend.js
+++ b/static/functions/recommend.js
@@ -8,7 +8,7 @@
id = $("#recommendation_div").data('id');
$("#recommend").click(function() {
$("#recommendation_div").slideToggle(150);
- if(!loaded) {
+ if (!loaded) {
$("#recommendation_status").html("Loading...");
$.ajax({
type : "POST",
diff --git a/static/functions/reportsv2.js b/static/functions/reportsv2.js
index 982d000..9919c48 100644
--- a/static/functions/reportsv2.js
+++ b/static/functions/reportsv2.js
@@ -8,7 +8,7 @@ function ChangeResolve(reportid) {
ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) {
var x = json.decode(response);
$('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false);
- if($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
+ if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
$('#warning' + reportid).raw().selectedIndex = 0;
$('#upload' + reportid).raw().checked = false;
} else {
@@ -23,7 +23,7 @@ function ChangeResolve(reportid) {
function Load(reportid) {
var t = $('#type' + reportid).raw().value;
for (var i = 0; i<$('#resolve_type' + reportid).raw().options.length; i++) {
- if($('#resolve_type' + reportid).raw().options[i].value == t) {
+ if ($('#resolve_type' + reportid).raw().options[i].value == t) {
$('#resolve_type' + reportid).raw().selectedIndex = i;
break;
}
@@ -32,7 +32,7 @@ function Load(reportid) {
ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) {
var x = json.decode(response);
$('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false);
- if($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
+ if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
$('#warning' + reportid).raw().selectedIndex = 0;
$('#upload' + reportid).raw().checked = false;
} else {
@@ -52,7 +52,7 @@ function ErrorBox(reportid, message) {
}
function HideErrors() {
- if($('#error_box')) {
+ if ($('#error_box')) {
$('#error_box').remove();
}
}
@@ -60,14 +60,14 @@ function HideErrors() {
function TakeResolve(reportid) {
$('#submit_' + reportid).disable();
ajax.post("reportsv2.php?action=takeresolve","reportform_" + reportid, function (response) {
- if(response) {
+ if (response) {
ErrorBox(reportid, response);
} else {
- if($('#from_delete' + reportid).results()) {
+ if ($('#from_delete' + reportid).results()) {
window.location = location.protocol + '//' + location.host + location.pathname + "?id=" + $('#from_delete' + reportid).raw().value;
} else {
$('#report' + reportid).remove();
- if($('#dynamic').raw().checked) {
+ if ($('#dynamic').raw().checked) {
NewReport(1);
}
}
@@ -76,17 +76,17 @@ function TakeResolve(reportid) {
}
function NewReport(q, view, id) {
- for(var i = 0; i < q; i++) {
+ for (var i = 0; i < q; i++) {
var url = "reportsv2.php?action=ajax_new_report";
- if(view) {
+ if (view) {
url += "&view=" + view;
}
- if(id) {
+ if (id) {
url += "&id=" + id;
}
ajax.get(url, function (response) {
- if(response) {
+ if (response) {
var div = document.createElement("div");
div.id = "report";
div.innerHTML = response;
@@ -94,12 +94,12 @@ function NewReport(q, view, id) {
var id = $('#newreportid').raw().value;
Load(id);
$('#newreportid').remove();
- if($('#no_reports').results()) {
+ if ($('#no_reports').results()) {
$('#all_reports').raw().removeChild($('#no_reports').raw());
}
} else {
//No new reports at this time
- if(!$('#report').results() && !$('#no_reports').results()) {
+ if (!$('#report').results() && !$('#no_reports').results()) {
var div = document.createElement("div");
div.id = "no_reports";
div.innerHTML = "<table class='layout'><tr><td class='center'><strong>No new reports! \\o/</strong></td></tr></table>";
@@ -114,13 +114,13 @@ function AddMore(view, id) {
//Function will add the amount of reports in the input box unless that will take it over 50
var x = 10;
var a = $('#repop_amount').raw().value;
- if(a) {
- if(!isNaN(a) && a <= 50) {
+ if (a) {
+ if (!isNaN(a) && a <= 50) {
x = a;
}
}
- if(document.getElementsByName("reportid").length + x <= 50) {
+ if (document.getElementsByName("reportid").length + x <= 50) {
NewReport(x, view, id);
} else {
NewReport(50 - document.getElementsByName("reportid").length, view, id);
@@ -129,7 +129,7 @@ function AddMore(view, id) {
function SendPM(reportid) {
ajax.post("reportsv2.php?action=ajax_take_pm", "reportform_" + reportid, function (response) {
- if(response) {
+ if (response) {
$('#uploader_pm' + reportid).raw().value = response;
} else {
$('#uploader_pm' + reportid).raw().value = "";
@@ -139,18 +139,18 @@ function SendPM(reportid) {
function UpdateComment(reportid) {
ajax.post("reportsv2.php?action=ajax_update_comment", "reportform_" + reportid, function (response) {
- if(response) {
+ if (response) {
alert(response);
}
});
}
function GiveBack(id) {
- if(!id) {
+ if (!id) {
var x = document.getElementsByName("reportid");
- for(i = 0; i < x.length; i++) {
+ for (i = 0; i < x.length; i++) {
/*ajax.get("ajax.php?action=giveback_report&id=" + x[i].value, function (response) {
- if(response) {
+ if (response) {
alert(response);
}
});*/
@@ -158,7 +158,7 @@ function GiveBack(id) {
}
} else {
ajax.get("ajax.php?action=giveback_report&id=" + id, function (response) {
- if(response) {
+ if (response) {
alert(response);
}
});
@@ -189,9 +189,9 @@ function ClearReport(reportid) {
}
function Grab(reportid) {
- if(reportid) {
+ if (reportid) {
ajax.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function (response) {
- if(response == '1') {
+ if (response == '1') {
$('#grab' + reportid).raw().disabled = true;
} else {
alert('Grab failed for some reason :/');
@@ -199,9 +199,9 @@ function Grab(reportid) {
});
} else {
var x = document.getElementsByName("reportid");
- for(i = 0; i < x.length; i++) {
+ for (i = 0; i < x.length; i++) {
ajax.get("reportsv2.php?action=ajax_grab_report&id=" + x[i].value, function (response) {
- if(response != '1') {
+ if (response != '1') {
alert("One of those grabs failed, sorry I can't be more useful :P");
}
});
@@ -241,7 +241,7 @@ function Switch(reportid, torrentid, otherid) {
ajax.post('reportsv2.php?action=ajax_create_report', report, function (response) {
//Returns new report ID.
- if(isNaN(response)) {
+ if (isNaN(response)) {
alert(response);
} else {
window.location = 'reportsv2.php?view=report&id=' + response;
diff --git a/static/functions/subscriptions.js b/static/functions/subscriptions.js
index f215810..9f7749a 100644
--- a/static/functions/subscriptions.js
+++ b/static/functions/subscriptions.js
@@ -1,8 +1,8 @@
function Subscribe(topicid) {
ajax.get("userhistory.php?action=thread_subscribe&topicid=" + topicid + "&auth=" + authkey, function() {
var subscribeLink = $("#subscribelink" + topicid).raw();
- if(subscribeLink) {
- if(subscribeLink.firstChild.nodeValue.charAt(0) == '[') {
+ if (subscribeLink) {
+ if (subscribeLink.firstChild.nodeValue.charAt(0) == '[') {
subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(1) == 'U'
? '[Subscribe]'
: '[Unsubscribe]';
@@ -19,10 +19,10 @@ function Subscribe(topicid) {
function Collapse() {
var collapseLink = $('#collapselink').raw();
var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0);
- if($('.row').results() > 0) {
+ if ($('.row').results() > 0) {
$('.row').toggle();
}
- if(hide) {
+ if (hide) {
collapseLink.innerHTML = 'Show post bodies';
} else {
collapseLink.innerHTML = 'Hide post bodies';
diff --git a/static/functions/torrent.js b/static/functions/torrent.js
index 2e30943..0db1539 100644
--- a/static/functions/torrent.js
+++ b/static/functions/torrent.js
@@ -34,7 +34,7 @@ function ArtistManager() {
var elArtistList = ArtistList.cloneNode(true);
elArtistList.id = 'artistmanager_list';
- for(var i=0; i<elArtistList.children.length; i++) {
+ for (var i = 0; i < elArtistList.children.length; i++) {
switch (elArtistList.children[i].className) {
case 'artist_main':
importance = 1;
@@ -170,9 +170,9 @@ function SelectArtist(e,obj) {
}
Dir = (EndBox > StartBox ? 1 : -1);
var checked = obj.checked;
- for(var i = StartBox; i != EndBox; i += Dir) {
+ for (var i = StartBox; i != EndBox; i += Dir) {
var key, importance = obj.value.substr(0,1), id = obj.value.substr(2);
- $('#artistmanager_box'+i).raw().checked = checked;
+ $('#artistmanager_box' + i).raw().checked = checked;
}
StartBox = Number(obj.id.substr(17));
}
@@ -180,7 +180,7 @@ function SelectArtist(e,obj) {
function ArtistManagerSubmit() {
var Selection = new Array();
var MainSelectionCount = 0;
- for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) {
+ for (var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) {
if (boxes.raw(i).checked) {
Selection.push(boxes.raw(i).value);
if (boxes.raw(i).value.substr(0,1) == '1') {
diff --git a/static/functions/upload.js b/static/functions/upload.js
index 8ffa231..78bf87e 100644
--- a/static/functions/upload.js
+++ b/static/functions/upload.js
@@ -7,7 +7,7 @@ function Categories() {
}
function Remaster() {
- if($('#remaster').raw().checked) {
+ if ($('#remaster').raw().checked) {
$('#remaster_true').show();
} else {
$('#remaster_true').hide();
@@ -16,9 +16,9 @@ function Remaster() {
}
function Format() {
- if($('#format').raw().options[$('#format').raw().selectedIndex].value == 'FLAC') {
+ if ($('#format').raw().options[$('#format').raw().selectedIndex].value == 'FLAC') {
for (var i = 0; i<$('#bitrate').raw().options.length; i++) {
- if($('#bitrate').raw().options[i].value == 'Lossless') {
+ if ($('#bitrate').raw().options[i].value == 'Lossless') {
$('#bitrate').raw()[i].selected = true;
}
}
@@ -29,7 +29,7 @@ function Format() {
$('#upload_logs').hide();
}
- if($('#format').raw().options[$('#format').raw().selectedIndex].value == 'AAC') {
+ if ($('#format').raw().options[$('#format').raw().selectedIndex].value == 'AAC') {
$('#format_warning').raw().innerHTML = 'Lossy AAC torrents may only be uploaded when they represent exclusive content not currently available in any other format. <a href="rules.php?p=upload#r2.1.24">(2.1.24)</a>';
} else {
$('#format_warning').raw().innerHTML = '';
@@ -38,7 +38,7 @@ function Format() {
function Bitrate() {
$('#other_bitrate').raw().value = '';
- if($('#bitrate').raw().options[$('#bitrate').raw().selectedIndex].value == 'Other') {
+ if ($('#bitrate').raw().options[$('#bitrate').raw().selectedIndex].value == 'Other') {
$('#other_bitrate_span').show();
} else {
$('#other_bitrate_span').hide();
@@ -46,7 +46,7 @@ function Bitrate() {
}
function AltBitrate() {
- if($('#other_bitrate').raw().value >= 320) {
+ if ($('#other_bitrate').raw().value >= 320) {
$('#vbr').raw().disabled = true;
$('#vbr').raw().checked = false;
} else {
@@ -55,9 +55,9 @@ function AltBitrate() {
}
function add_tag() {
- if($('#tags').raw().value == "") {
+ if ($('#tags').raw().value == "") {
$('#tags').raw().value = $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value;
- } else if($('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value == '---') {
+ } else if ($('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value == '---') {
} else {
$('#tags').raw().value = $('#tags').raw().value + ', ' + $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value;
}
@@ -66,7 +66,7 @@ function add_tag() {
var LogCount = 1;
function AddLogField() {
- if(LogCount >= 200) {
+ if (LogCount >= 200) {
return;
}
var LogField = document.createElement("input");
@@ -81,7 +81,7 @@ function AddLogField() {
}
function RemoveLogField() {
- if(LogCount == 1) {
+ if (LogCount == 1) {
return;
}
var x = $('#logfields').raw();
@@ -94,7 +94,7 @@ function RemoveLogField() {
var ExtraLogCount = 1;
function AddExtraLogField(id) {
- if(LogCount >= 200) {
+ if (LogCount >= 200) {
return;
}
var LogField = document.createElement("input");
@@ -109,7 +109,7 @@ function AddExtraLogField(id) {
}
function RemoveLogField() {
- if(LogCount == 1) {
+ if (LogCount == 1) {
return;
}
var x = $('#logfields').raw();
@@ -122,7 +122,7 @@ function RemoveLogField() {
var FormatCount = 0;
function AddFormat() {
- if(FormatCount >= 10) {
+ if (FormatCount >= 10) {
return;
}
FormatCount++;
@@ -157,14 +157,14 @@ function AddFormat() {
NewCell2 = document.createElement("td");
tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
var formats=["Saab","Volvo","BMW"];
- for(var i in formats) {
- tmp += "<option value='"+formats[i]+"'>"+formats[i]+"</option>\n";
+ for (var i in formats) {
+ tmp += '<option value="'+formats[i]+'">'+formats[i]+"</option>\n";
}
tmp += "</select>";
var bitrates=["1","2","3"];
tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
- for(var i in bitrates) {
- tmp += "<option value='"+bitrates[i]+"'>"+bitrates[i]+"</option>\n";
+ for (var i in bitrates) {
+ tmp += '<option value="'+bitrates[i]+'">'+bitrates[i]+"</option>\n";
}
tmp += "</select>";
@@ -188,7 +188,7 @@ function AddFormat() {
}
function RemoveFormat() {
- if(FormatCount == 0) {
+ if (FormatCount == 0) {
return;
}
$('#extras').raw().value = FormatCount;
@@ -209,7 +209,7 @@ function RemoveFormat() {
var ArtistCount = 1;
function AddArtistField() {
- if(ArtistCount >= 200) {
+ if (ArtistCount >= 200) {
return;
}
var ArtistField = document.createElement("input");
@@ -238,7 +238,7 @@ function AddArtistField() {
}
function RemoveArtistField() {
- if(ArtistCount == 1) {
+ if (ArtistCount == 1) {
return;
}
var x = $('#artistfields').raw();
@@ -259,15 +259,15 @@ function CheckVA () {
function CheckYear() {
var media = $('#media').raw().options[$('#media').raw().selectedIndex].text;
- if(media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette") {
+ if (media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette") {
media = "old";
}
var x = $('#year').raw();
- if(x.value < 1982 && x.value != '' && media != "old" && !$('#unknown').raw().checked) {
+ if (x.value < 1982 && x.value != '' && media != "old" && !$('#unknown').raw().checked) {
$('#yearwarning').show();
$('#remaster').raw().checked = true;
$('#remaster_true').show();
- } else if($('#unknown').raw().checked) {
+ } else if ($('#unknown').raw().checked) {
$('#remaster').raw().checked = true;
$('#yearwarning').hide();
$('#remaster_true').show();
@@ -277,13 +277,13 @@ function CheckYear() {
}
function ToggleUnknown() {
- if($('#unknown').raw().checked) {
+ if ($('#unknown').raw().checked) {
$('#remaster_year').raw().value = "";
$('#remaster_title').raw().value = "";
$('#remaster_record_label').raw().value = "";
$('#remaster_catalogue_number').raw().value = "";
- if($('#groupremasters').raw()) {
+ if ($('#groupremasters').raw()) {
$('#groupremasters').raw().selectedIndex = 0;
$('#groupremasters').raw().disabled = true;
}
@@ -298,7 +298,7 @@ function ToggleUnknown() {
$('#remaster_record_label').raw().disabled = false;
$('#remaster_catalogue_number').raw().disabled = false;
- if($('#groupremasters').raw()) {
+ if ($('#groupremasters').raw()) {
$('#groupremasters').raw().disabled = false;
}
}
@@ -307,7 +307,7 @@ function ToggleUnknown() {
function GroupRemaster() {
var remasters = json.decode($('#json_remasters').raw().value);
var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value;
- if(index != "") {
+ if (index != "") {
$('#remaster_year').raw().value = remasters[index][1];
$('#remaster_title').raw().value = remasters[index][2];
$('#remaster_record_label').raw().value = remasters[index][3];
diff --git a/static/functions/user.js b/static/functions/user.js
index f5a2856..b9013f1 100644
--- a/static/functions/user.js
+++ b/static/functions/user.js
@@ -4,7 +4,7 @@ function ChangeTo(to) {
$('#admincomment').show();
resize('admincomment');
var buttons = document.getElementsByName('admincommentbutton');
- for(var i = 0; i < buttons.length; i++) {
+ for (var i = 0; i < buttons.length; i++) {
buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;");
}
} else if (to == "links") {
@@ -13,7 +13,7 @@ function ChangeTo(to) {
$('#admincomment').hide();
$('#admincommentlinks').show();
var buttons = document.getElementsByName('admincommentbutton');
- for(var i = 0; i < buttons.length; i++) {
+ for (var i = 0; i < buttons.length; i++) {
buttons[i].setAttribute('onclick',"ChangeTo('text'); return false;");
}
})
diff --git a/static/functions/valid_tags.js b/static/functions/valid_tags.js
index e36a870..f752d6e 100644
--- a/static/functions/valid_tags.js
+++ b/static/functions/valid_tags.js
@@ -9,7 +9,7 @@ var tags = new Object();
function isValidTag(value) {
var toReturn = false;
- if(tags[value] == true) {
+ if (tags[value] == true) {
toReturn = true;
}
return toReturn;
diff --git a/static/functions/validate.js b/static/functions/validate.js
index dbfb514..eb872ff 100644
--- a/static/functions/validate.js
+++ b/static/functions/validate.js
@@ -1,5 +1,5 @@
-var elemStyles=Array();
-var errorElems=Array();
+var elemStyles = Array();
+var errorElems = Array();
function validEmail(str) {
if (str.match(/^[_a-z0-9-]+([.+][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i)) {
@@ -12,60 +12,80 @@ function validEmail(str) {
function validLink(str) {
if (str.match(/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i)) {
return true;
- } else { return false; }
+ } else {
+ return false;
+ }
}
function isNumeric(str,usePeriod) {
- matchStr='/[^0-9';
+ matchStr = '/[^0-9';
if (usePeriod) {
- matchStr+='\.';
+ matchStr += '\.';
}
- matchStr=']/';
+ matchStr = ']/';
- if (str.match(matchStr)) { return false; }
+ if (str.match(matchStr)) {
+ return false;
+ }
return true;
}
function validDate(theDate) {
- days=0;
+ days = 0;
- theDate=theDate.split("/");
- month=theDate[0];
- day=theDate[1];
- year=theDate[2];
+ theDate = theDate.split("/");
+ month = theDate[0];
+ day = theDate[1];
+ year = theDate[2];
if (!isNumeric(month) || !isNumeric(day) || !isNumeric(year)) { return false; }
- if (month==1) { days=31; }
- else if (month==2) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { days=29; } else { days=28; }}
- else if (month==3) { days=31; }
- else if (month==4) { days=30; }
- else if (month==5) { days=31; }
- else if (month==6) { days=30; }
- else if (month==7) { days=31; }
- else if (month==8) { days=31; }
- else if (month==9) { days=30; }
- else if (month==10) { days=31; }
- else if (month==11) { days=30; }
- else if (month==12) { days=31; }
-
- if (day>days || day==undefined || days==undefined || month==undefined || year==undefined || year.length<4) { return false; } else { return true; }
+ if (month == 1) { days = 31; }
+ else if (month == 2) {
+ if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
+ days = 29;
+ } else {
+ days = 28;
+ }}
+ else if (month == 3) { days = 31; }
+ else if (month == 4) { days = 30; }
+ else if (month == 5) { days = 31; }
+ else if (month == 6) { days = 30; }
+ else if (month == 7) { days = 31; }
+ else if (month == 8) { days = 31; }
+ else if (month == 9) { days = 30; }
+ else if (month == 10) { days = 31; }
+ else if (month == 11) { days = 30; }
+ else if (month == 12) { days = 31; }
+
+ if (day > days || day == undefined || days == undefined || month == undefined || year == undefined || year.length < 4) {
+ return false;
+ } else {
+ return true;
+ }
}
function showError(fields,alertStr) {
var tField=Array();
- if (typeof(fields)=='object') { tField[0]=fields; } else { tField=fields.split(','); }
- for(s=0; s<=tField.length-1; s++) {
+ if (typeof(fields) == 'object') {
+ tField[0] = fields;
+ } else {
+ tField = fields.split(',');
+ }
+ for (s = 0; s <= tField.length - 1; s++) {
if ($('#'+tField[s])) {
$('#'+tField[s]).className=$('#'+tField[s]).className+" elem_error";
- if (s==0) {
+ if (s == 0) {
$('#'+tField[s]).focus();
- try { $('#'+tField[s]).select(); } catch (error) { }
+ try {
+ $('#'+tField[s]).select();
+ } catch (error) {
+ }
}
- errorElems[errorElems.length]=tField[s];
- if ($('#'+tField[s]).type!="select-one") {
+ errorElems[errorElems.length] = tField[s];
+ if ($('#'+tField[s]).type != "select-one") {
$('#'+tField[s]).onkeypress=function() { clearElemError(); };
} else {
$('#'+tField[s]).onchange=function() { clearElemError(); };
@@ -73,34 +93,36 @@ function showError(fields,alertStr) {
}
}
- if (alertStr!="") { alert(alertStr); }
+ if (alertStr != "") {
+ alert(alertStr);
+ }
return false;
}
function clearErrors(theForm) {
- elementList=document.forms[theForm].elements;
- for(x=0; x<=elementList.length-1; x++) {
- if (elementList[x].type!="submit" && elementList[x].type!="button") {
+ elementList = document.forms[theForm].elements;
+ for (x = 0; x <= elementList.length - 1; x++) {
+ if (elementList[x].type != "submit" && elementList[x].type != "button") {
if (!elemStyles[elementList[x].id]) {
- elemStyles[elementList[x].id]=elementList[x].className;
+ elemStyles[elementList[x].id] = elementList[x].className;
}
try {
- elementList[x].className=elemStyles[elementList[x].id];
+ elementList[x].className = elemStyles[elementList[x].id];
} catch (error) { }
}
}
}
function clearElemError(evt) {
- for(x=0; x<=errorElems.length-1; x++) {
- elem=$('#'+errorElems[x]);
- if ($('#'+elem).type!="select-one") {
- $('#'+elem).onkeypress="";
+ for (x = 0; x <= errorElems.length - 1; x++) {
+ elem = $('#'+errorElems[x]);
+ if ($('#'+elem).type != "select-one") {
+ $('#'+elem).onkeypress = "";
} else {
- $('#'+elem).onchange="";
+ $('#'+elem).onchange = "";
}
- elem.className=elemStyles[elem.id];
+ elem.className = elemStyles[elem.id];
}
- errorElems=Array();
+ errorElems = Array();
}
diff --git a/static/functions/validate_upload.js b/static/functions/validate_upload.js
index e464bd7..0694b04 100644
--- a/static/functions/validate_upload.js
+++ b/static/functions/validate_upload.js
@@ -2,9 +2,9 @@
$(document).ready(function () {
// Upload button is clicked
$("#post").click(function(e) {
- // Make sure "Music" category is selected.
- if($("#categories").find(":selected").val() == 0) {
- checkHasMainArtist(e);
+ // Make sure "Music" category is selected.
+ if ($("#categories").find(":selected").val() == 0) {
+ checkHasMainArtist(e);
}
});
@@ -14,16 +14,15 @@
function checkHasMainArtist(e) {
var has_main = false;
$("select[id^=importance]").each(function() {
- if($(this).find(":selected").val() == 1) {
+ if ($(this).find(":selected").val() == 1) {
has_main = true;
}
});
- if(!has_main) {
+ if (!has_main) {
alert('A "Main" artist is required');
// Don't POST the form.
e.preventDefault();
}
}
});
-
-})(jQuery); \ No newline at end of file
+})(jQuery);