MediaWiki:UploadScript.js: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
 
(18 intermediate revisions by the same user not shown)
Line 4: Line 4:


var summary_input;
var summary_input;
var nonhalo_input;
var type_select;
var type_select;
var mediatype_select;
var mediatype_select;
Line 28: Line 29:


var summary_tr;
var summary_tr;
var nonhalo_tr;
var type_tr;
var type_tr;
var mediatype_tr;
var mediatype_tr;
Line 53: Line 55:
var final_toggler_a;
var final_toggler_a;


var has_nonhalo = false;
var has_game = false;
var has_game = false;
var has_subgame = false;
var has_subgame = false;
Line 81: Line 84:
     table = document.getElementById("mw-htmlform-description").firstChild;
     table = document.getElementById("mw-htmlform-description").firstChild;
    
    
   if (document.getElementById("wpUploadDescription") && document.getElementById("wpUploadDescription").value.length > 0) {
   if (document.getElementById("wpUploadDescription") &&
     //Hold on, there's already text here! Chances are this is the warning page.
      document.getElementById("wpUploadDescription").value != "{{file info\n|summary = \n|game = \n|type = \n|source = \n}}") {
     //Hold on, there's already custom text here! Chances are this is the warning page.
     //Let's just hide the license box and quit.
     //Let's just hide the license box and quit.
     hide_license(table);
     hide_license(table);
Line 92: Line 96:


   create_mediatype_list(table);
   create_mediatype_list(table);
  create_nonhalo_input(table);
   create_media_list(table);
   create_media_list(table);
   create_game_list(table);
   create_game_list(table);
Line 112: Line 117:
    
    
   handle_type_choice();
   handle_type_choice();
}
function create_nonhalo_input(table) {
  nonhalo_input = document.createElement("input");
  nonhalo_input.size = "60";
  nonhalo_input.onchange = create_final_result;
  nonhalo_tr = add_field("Non-<i>Halo</i> title:", nonhalo_input, table);
}
}


Line 146: Line 158:
   add_option("logo", "Logo", type_select);
   add_option("logo", "Logo", type_select);
   add_option("asset", "Raw asset", type_select);
   add_option("asset", "Raw asset", type_select);
   add_option("page", "Page scan", type_select);
   add_option("page", "Book/comic page", type_select);
  add_option("document", "Document", type_select);
   add_option("designdoc", "Design documentation", type_select);
   add_option("designdoc", "Design documentation", type_select);
  add_option("document", "PDF document", type_select);
   add_option("audio", "Audio file", type_select);
   add_option("audio", "Audio file", type_select);
   add_option("real", "Real-world image", type_select);
   add_option("real", "Real-world image", type_select);
Line 195: Line 207:
   specific_media_text.size = "46";
   specific_media_text.size = "46";
   specific_media_text.onchange = update_fields;
   specific_media_text.onchange = update_fields;
  specific_media_text.value = "Halo Encyclopedia (2022 edition)"; // recent big release
   specific_media_span.appendChild(document.createTextNode(" Please enter the book title exactly: "));
   specific_media_span.appendChild(document.createTextNode(" Please enter the book title exactly: "));
   specific_media_span.appendChild(specific_media_text);
   specific_media_span.appendChild(specific_media_text);
Line 218: Line 231:
   add_media("Halo 4", game_select);
   add_media("Halo 4", game_select);
   add_media("Halo 5: Guardians", game_select);
   add_media("Halo 5: Guardians", game_select);
   add_media("Halo Infinite", game_select);
   add_media("Halo Infinite", game_select, 'selected');
   add_media("Halo: The Master Chief Collection", game_select);
   add_media("Halo: The Master Chief Collection", game_select);
   add_media("Halo Wars", game_select);
   add_media("Halo Wars", game_select);
Line 269: Line 282:
   add_media("Halo 4: Forward Unto Dawn", film_select);
   add_media("Halo 4: Forward Unto Dawn", film_select);
   add_media("Halo: Nightfall", film_select);
   add_media("Halo: Nightfall", film_select);
  add_media("Halo: The Television Series", film_select);
   add_media("Halo: The Fall of Reach - The Animated Series", film_select);
   add_media("Halo: The Fall of Reach - The Animated Series", film_select);
   add_media("Halo: The Complete Video Collection", film_select);
   add_media("Halo: The Television Series", film_select, 'selected');
   add_media("Other Halo film/series", film_select);
   add_media("Other Halo film/series", film_select);
    
    
Line 303: Line 315:
   add_media("Halo: Collateral Damage", comic_select);
   add_media("Halo: Collateral Damage", comic_select);
   add_media("Halo: Lone Wolf", comic_select);
   add_media("Halo: Lone Wolf", comic_select);
   add_media("Halo Graphic Novel", comic_select);
   add_media("Halo Graphic Novel", comic_select, 'selected');
   add_media("Halo: Tales from Slipspace", comic_select);
   add_media("Halo: Tales from Slipspace", comic_select);
   add_media("Other Halo comic/graphic novel", comic_select);
   add_media("Other Halo comic/graphic novel", comic_select);
Line 324: Line 336:
   screenshot_select.onchange = update_fields;
   screenshot_select.onchange = update_fields;
    
    
   add_option("character", "Character or AI unit", screenshot_select);
   add_option("character", "Character or AI", screenshot_select);
  add_option("multiplayer", "Multiplayer content", screenshot_select);
   add_option("weapon", "Weapon", screenshot_select);
   add_option("weapon", "Weapon", screenshot_select);
   add_option("vehicle", "Vehicle", screenshot_select);
   add_option("vehicle", "Vehicle", screenshot_select);
  add_option("multiplayer", "Multiplayer content", screenshot_select);
   add_option("menu", "Menu", screenshot_select);
   add_option("menu", "Menu", screenshot_select);
   add_option("other", "Other", screenshot_select);
   add_option("other", "Other", screenshot_select);
Line 341: Line 353:
   add_option("achievement", "Achievement", icon_select);
   add_option("achievement", "Achievement", icon_select);
   add_option("medal", "Multiplayer medal", icon_select);
   add_option("medal", "Multiplayer medal", icon_select);
   add_option("rank", "Rank image", icon_select);
   add_option("rank", "Rank insignia", icon_select);
   add_option("skull", "Skull image", icon_select);
   add_option("skull", "Skull icon", icon_select);
   add_option("menuicon", "Menu icon", icon_select);
   add_option("menuicon", "Menu icon", icon_select);
   add_option("other", "Other", icon_select);
   add_option("other", "Other", icon_select);
Line 591: Line 603:
   has_media = false;
   has_media = false;
   has_game = false;
   has_game = false;
  has_nonhalo = false;
   has_subgame = false;
   has_subgame = false;
   has_film = false;
   has_film = false;
Line 627: Line 640:
     }
     }


     if (cur_media == "game" && cur_type == "screenshot") {
     if ((cur_media == "game" || cur_media == "film") && cur_type == "screenshot") {
       has_screenshot = true;
       has_screenshot = true;
     }
     }
Line 634: Line 647:
       has_icon = true;
       has_icon = true;
     }
     }
  } else if (cur_mediatype == "nonhalo") {
    has_nonhalo = true;
   }
   }


Line 644: Line 659:
     cur_type == "render" || cur_type == "logo" ||
     cur_type == "render" || cur_type == "logo" ||
     cur_type == "asset" || cur_type == "page" ||
     cur_type == "asset" || cur_type == "page" ||
     cur_type == "document" || cur_type == "designdoc" ||
     cur_type == "designdoc" || cur_type == "document" ||
     cur_type == "audio" || cur_type == "wiki"
     cur_type == "audio" || cur_type == "wiki"
   ) {
   ) {
Line 669: Line 684:
   media_tr.style.display =
   media_tr.style.display =
     has_media ? show : "none";
     has_media ? show : "none";
  nonhalo_tr.style.display =
    has_nonhalo ? show : "none";
   game_tr.style.display =
   game_tr.style.display =
     has_game ? show : "none";
     has_game ? show : "none";
Line 757: Line 774:
   } else if (cur_mediatype == "nonhalo") {
   } else if (cur_mediatype == "nonhalo") {
       t += "|media = " + cur_mediatype + "\n";
       t += "|media = " + cur_mediatype + "\n";
      if (nonhalo_input.value != "")
        t += "|title = " + nonhalo_input.value + "\n";
  }
  }