MrYaz / CO on Steroids

// ==UserScript==
// @name       CO on Steroids
// @namespace  http://coord.info/PR5GVQ5
// @version    0.88
// @grant      none
// @description  Makes it a lot more effective for cache owners to submit multiple geocache listings. Please change settings directly in the script below. Works best with Chrome and Tampermonkey.
// @match     https://www.geocaching.com/play/hide
// @include     https://www.geocaching.com/play/hide

// @match      https://www.geocaching.com/hide/createcache.aspx
// @include    https://www.geocaching.com/hide/createcache.aspx

// @match     https://www.geocaching.com/hide/cachemaintenance.aspx
// @include     https://www.geocaching.com/hide/cachemaintenance.aspx

// @match      https://www.geocaching.com/hide/typelocation.aspx
// @include    https://www.geocaching.com/hide/typelocation.aspx

// @match      https://www.geocaching.com/hide/waypoints.aspx
// @include    https://www.geocaching.com/hide/waypoints.aspx

// @match      https://www.geocaching.com/hide/description.aspx
// @include    https://www.geocaching.com/hide/description.aspx

// @match      https://www.geocaching.com/hide/sizeratings.aspx
// @include    https://www.geocaching.com/hide/sizeratings.aspx

// @updateURL https://openuserjs.org/meta/MrYaz/CO_on_Steroids.meta.js
// @downloadURL https://openuserjs.org/install/MrYaz/CO_on_Steroids.user.js

// @copyright  2019, MrYaz
// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// ==/UserScript==

// ############## PERSONAL SETTINGS BEGINS HERE ####################
var cacheName = "Power Trail #"; //Enter the name of the cache series here
var cachePlacedBy = "CacheOwner"; //Enter the names of the cache owners here. If left empty, your own geocaching.com username will be used
var cacheCountry = "Sweden"; //Enter the country name here. Use exactly the same spelling as on gc.com
var cacheState = "Norrbotten"; //Enter the state name here. Use exactly the same spelling as on gc.com
var cacheDescription = "<p>This text is shown in the description.</p><p>Second paragraph in the description.</p>"; //Enter the descripiton here. Be sure to place all of the HTML code on one single row.
var cacheHint = "Gran?"; //You can enter a hint here if you like
var cachePremiumOnly = "True"; //Leave empty if you want the cache to be available to Basic members as well
var cacheContainerSize = "Micro"; //Enter the desired cache size of the following:Other, Micro, Small, Regular or Large
var cacheDiffRating = "2.5"; //Enter the desired Difficulty rating here from 1.0 to 5.0
var cacheTerrRating = "2.5"; //Enter the desired Terrain rating here from 1.0 to 5.0
// ############### PERSONAL SETTINGS ENDS HERE #####################
// ############### SET ATTRIBUTES FURTHER DOWN #####################

if (window.location.pathname === "/play/hide") {
  window.location = "https://www.geocaching.com/hide/typelocation.aspx";
}

if (window.location.pathname === "/hide/cachemaintenance.aspx") {
  $("#btnNext").trigger("click");
}

if (window.location.pathname === "/hide/typelocation.aspx") {
  var intervalId_0 = setInterval(setTypeAndFocus, 500);

  function setTypeAndFocus() {
    $("#ct_Traditional").trigger("click");
    $("#btnUnderstand").trigger("click");
    $("#uxCoordParse").focus();
    if ($("#uxCoordParse").is(":focus")) {
      clearInterval(intervalId_0);
    }
  }
}

if (window.location.pathname === "/hide/waypoints.aspx") {
  $(document).ready(function () {
    function clickContinueButton() {
      $("#btnContinue").trigger("click");
    }
    var intervalId_1 = setInterval(clickContinueButton, 2000);
  });
}

if (window.location.pathname === "/hide/description.aspx") {
  $(document).ready(function () {
    function changeCountry() {
      $("#ddCountry").change();
    }
    if ($("#ddCountry option:selected").val() == "-1") {
      $("#ddCountry option").filter(function () {
        return $(this).text() == cacheCountry;
      }).prop("selected", true);
      var intervalId_2 = setInterval(changeCountry, 500);
    }
    if ($("#ddCountry option:selected").text() == cacheCountry) {
      $("#ddState option").filter(function () {
        return $(this).text() == cacheState;
      }).prop("selected", true);
    }
    var intervalId_3 = setInterval(setDescription, 500);

    function setDescription() {
      descrEditor.setData(cacheDescription);
      var checkDescription = descrEditor.getData();
      if (cacheDescription.length === 0 || checkDescription === cacheDescription) {
        clearInterval(intervalId_3);
      }
    }

    $("#tbHint").val(cacheHint);
    var intervalId_4 = setInterval(setPremium, 500);

    function setPremium() {
      if (cachePremiumOnly.length !== 0) {
        $("#ctl00_ContentBody_rblMemberLevel_1").trigger("click");
        if ($("#ctl00_ContentBody_rblMemberLevel_1").is(":checked")) {
          clearInterval(intervalId_4);
        }
      }
    }
    $("#ctl00_ContentBody_cbAgreement").attr("checked", true);
    if (cachePlacedBy.length !== 0) {
      $("#ctl00_ContentBody_tbPlacedBy").val(cachePlacedBy);
    }
    $("#ctl00_ContentBody_tbGeocacheName").focus();
    $("#ctl00_ContentBody_tbGeocacheName").val(cacheName);
  });
}

if (window.location.pathname === "/hide/sizeratings.aspx") {
  $(document).ready(function () {
    if (cacheContainerSize == "Regular") {
      cacheContainerSize = "Medium";
    }
    var cacheContainerSizeID = "#ctl00_ContentBody_imgExample" + cacheContainerSize;
    $(cacheContainerSizeID).trigger("click");
    var arrD = cacheDiffRating.split(".");
    var cacheDiffRatingSpan = "span.d" + arrD[0];
    if (arrD[1] == "0") {
      $(cacheDiffRatingSpan).trigger("click");
    }
    else {
      $(cacheDiffRatingSpan).parent().next().trigger("click");
    }
    var arrT = cacheTerrRating.split(".");
    var cacheTerrRatingSpan = "span.t" + arrT[0];
    if (arrT[1] == "0") {
      $(cacheTerrRatingSpan).trigger("click");
    }
    else {
      $(cacheTerrRatingSpan).parent().next().trigger("click");
    }

    // ################# SET ATTRIBUTES HERE ##############################       
    //set each attributes you want by uncommenting the row, i.e. removing the "//" at the start of the row. Like this:
    $("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl00_imgAttribute").trigger("click"); //Uncomment row if Scenic view
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl00_imgAttribute").trigger("click");      //Uncomment this row too if *NO* Scenic view

    //if you need to set an attribute to a negative state like NO dogs allowed, remove the "//" at the start of both rows. Like this:
    $("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl01_imgAttribute").trigger("click"); //Uncomment row if Dogs allowed
    $("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl01_imgAttribute").trigger("click"); //Uncomment this row too if *NO* Dogs allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl02_imgAttribute").trigger("click");      //Uncomment row if Parking or access fee
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl03_imgAttribute").trigger("click");      //Uncomment row if Climbing gear is needed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl04_imgAttribute").trigger("click");      //Uncomment row if Boat is needed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl05_imgAttribute").trigger("click");      //Uncomment row if Scuba gear is neaded

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl06_imgAttribute").trigger("click");      //Uncomment row if suitable for kids
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl06_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* suitable for kids

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl07_imgAttribute").trigger("click");      //Uncomment row if takes less then an hour
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl07_imgAttribute").trigger("click");      //Uncomment row if does *NOT* take less then an hour

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl08_imgAttribute").trigger("click");      //Uncomment row if difficult climbing is needed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl08_imgAttribute").trigger("click");      //Uncomment this row too if difficult climbing is *NOT* needed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl09_imgAttribute").trigger("click");      //Uncomment row if wading may be required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl10_imgAttribute").trigger("click");      //Uncomment row if swimming may be required

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl11_imgAttribute").trigger("click");      //Uncomment this row too if available all time
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl11_imgAttribute").trigger("click");      /Uncomment too if *NOT* available all time

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl12_imgAttribute").trigger("click");      //Uncomment row if available at night
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl12_imgAttribute").trigger("click");      //Uncomment row if *NOT* available at night

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl13_imgAttribute").trigger("click");      //Uncomment row if available in winter
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl13_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* available in winter

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl14_imgAttribute").trigger("click");      //Uncomment row if danger of falling rocks
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl15_imgAttribute").trigger("click");      //Uncomment row if Hunting 
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl16_imgAttribute").trigger("click");      //Uncomment row if Dangerous area

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl17_imgAttribute").trigger("click");      //Uncomment row if Wheelchair accessible
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl17_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Wheelchair accessible

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl18_imgAttribute").trigger("click");      //Uncomment row if camping available
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl18_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* camping available

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl19_imgAttribute").trigger("click");      //Uncomment row if bicycles are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl19_imgAttribute").trigger("click");      //Uncomment this row too if bicycles are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl20_imgAttribute").trigger("click");      //Uncomment row if motorcycles are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl20_imgAttribute").trigger("click");      //Uncomment this row too if motorcycles are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl21_imgAttribute").trigger("click");      //Uncomment row if quads Off-road vehicles
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl21_imgAttribute").trigger("click");      //Uncomment this row too if quads are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl22_imgAttribute").trigger("click");      //Uncomment row if Off-road vehicles are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl22_imgAttribute").trigger("click");      //Uncomment this row too if Off-road vehicles are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl23_imgAttribute").trigger("click");      //Uncomment row if snowmobiles are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl23_imgAttribute").trigger("click");      //Uncomment this row too if snowmobiles are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl24_imgAttribute").trigger("click");      //Uncomment row if camp fires are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl24_imgAttribute").trigger("click");      //Uncomment this row too if camp fires are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl25_imgAttribute").trigger("click");      //Uncomment row if Poison plants are present
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl25_imgAttribute").trigger("click");      //Uncomment this row too if Poison plants are *NOT* present

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl26_imgAttribute").trigger("click");      //Uncomment row if thorns are present
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl27_imgAttribute").trigger("click");      //Uncomment row if dangerous animals is present
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl28_imgAttribute").trigger("click");      //Uncomment row if ticks are present
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl29_imgAttribute").trigger("click");      //Uncomment row if abandoned mine is nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl30_imgAttribute").trigger("click");      //Uncomment row if parking is available
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl30_imgAttribute").trigger("click");      //Uncomment this row too if parking is *NOT* available

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl31_imgAttribute").trigger("click");      //Uncomment row if public transportation is available

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl32_imgAttribute").trigger("click");      //Uncomment row if picnic table is available
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl32_imgAttribute").trigger("click");      //Uncomment this row too if picnic table is *NOT* available

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl33_imgAttribute").trigger("click");      //Uncomment row if horses are allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl33_imgAttribute").trigger("click");      //Uncomment this row too if horses are *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl34_imgAttribute").trigger("click");      //Uncomment row if drinking water nearby
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl34_imgAttribute").trigger("click");      //Uncomment this row too if drinking water is *NOT* nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl35_imgAttribute").trigger("click");      //Uncomment row if public restrooms is nearby
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl35_imgAttribute").trigger("click");      //Uncomment this row too if public restrooms is *NOT* nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl36_imgAttribute").trigger("click");      //Uncomment row if telephone nearby
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl36_imgAttribute").trigger("click");      //Uncomment this row too if telephone *NOT* nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl37_imgAttribute").trigger("click");      //Uncomment row if stroller accessible
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl37_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* stroller accessible

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl38_imgAttribute").trigger("click");      //Uncomment row if livestock nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl39_imgAttribute").trigger("click");      //Uncomment row if stealth mode required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl39_imgAttribute").trigger("click");      //Uncomment this row too if *NO* stealth mode required

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl40_imgAttribute").trigger("click");      //Uncomment row if flashlight required

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl41_imgAttribute").trigger("click");      //Uncomment row if truck driver/RV allowed
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl41_imgAttribute").trigger("click");      //Uncomment this row too if truck driver/RV *NOT* allowed

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl42_imgAttribute").trigger("click");      //Uncomment row if UV light required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl43_imgAttribute").trigger("click");      //Uncomment row if snow shoes required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl44_imgAttribute").trigger("click");      //Uncomment row if skis required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl45_imgAttribute").trigger("click");      //Uncomment row if special tools required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl46_imgAttribute").trigger("click");      //Uncomment row if available at night
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl47_imgAttribute").trigger("click");      //Uncomment row if park and grab

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl48_imgAttribute").trigger("click");      //Uncomment row if Abandoned Structure
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl48_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Abandoned Structure

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl49_imgAttribute").trigger("click");      //Uncomment row if Short hike(<1km)
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl49_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Short hike(<1km)

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl50_imgAttribute").trigger("click");      //Uncomment row if Medium hike(1-10km)
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl50_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Medium hike(1-10km)

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl51_imgAttribute").trigger("click");      //Uncomment row if Long hike(+10km)
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl51_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Long hike(+10km)

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl52_imgAttribute").trigger("click");      //Uncomment row if fuel nearby
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl52_imgAttribute").trigger("click");      //Uncomment this row too if *NO* fuel nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl53_imgAttribute").trigger("click");      //Uncomment row if food nearby
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl53_imgAttribute").trigger("click");      //Uncomment this row too if *NO* food nearby

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl54_imgAttribute").trigger("click");      //Uncomment row if wireless beakon

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl55_imgAttribute").trigger("click");      //Uncomment row if field puzzle
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl55_imgAttribute").trigger("click");      //Uncomment this row too if *NO* field puzzle

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl56_imgAttribute").trigger("click");      //Uncomment row if significant hike
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl56_imgAttribute").trigger("click");      //Uncomment this row too if *NO* if significant hike

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl57_imgAttribute").trigger("click");      //Uncomment row if Seasonal access
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl57_imgAttribute").trigger("click");      //Uncomment this row too if *NO* Seasonal access

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl58_imgAttribute").trigger("click");      //Uncomment row if tourist friendly
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl58_imgAttribute").trigger("click");      //Uncomment row if *NOT* tourist friendly

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl59_imgAttribute").trigger("click");      //Uncomment row if tree climbing required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl59_imgAttribute").trigger("click");      //Uncomment this row too if *NO* tree climbing required

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl60_imgAttribute").trigger("click");      //Uncomment row if Front Yard (Private Residence)
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl60_imgAttribute").trigger("click");      //Uncomment this row too if *NOT* Front Yard (Private Residence)

    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl61_imgAttribute").trigger("click");      //Uncomment row if teamwork required
    //$("#ctl00_ContentBody_ctlAttributes_dtlAttributeIcons_ctl61_imgAttribute").trigger("click");    //Uncomment this row too if *NO* teamwork required
    // ####################################################################

    var intervalId_5 = setInterval(clickContinueButton, 5000);

    function clickContinueButton() {
      //            $("#btnSubmit").trigger("click");
    }
  });
}