diff --git a/js/upload-selection.js b/js/upload-selection.js new file mode 100644 index 00000000..3bd6b9ea --- /dev/null +++ b/js/upload-selection.js @@ -0,0 +1,55 @@ +$(function(){ + var enabled_file = true; + var enabled_url = $("#upload_url").length > 0; + var enabled_embed = $("#upload_embed").length > 0; + var enabled_oekaki = $("#oekaki").length > 0; + + var disable_all = function() { + $("#upload").hide(); + $("#upload_file").hide(); + $("#upload_url").hide(); + $("#upload_embed").hide(); + $("#oekaki").hide(); + }; + + enable_file = function() { + disable_all(); + $("#upload").show(); + $("#upload_file").show(); + }; + + enable_url = function() { + disable_all(); + $("#upload").show(); + $("#upload_url").show(); + + $('label[for="file_url"]').html(_("URL")); + }; + + enable_embed = function() { + disable_all(); + $("#upload_embed").show(); + }; + + enable_oekaki = function() { + disable_all(); + $("#oekaki").show(); + }; + + if (enabled_url || enabled_embed || enabled_oekaki) { + $("