But here's a greasemonkey script that helps with favorite maps. There are some bugs to fix.
Issues:
1.) Changing favorite settings/maps is not user friendly. Must edit contents of script.
2.) Map select must be manually clicked at least once to activate submission of Map selections
3.) Page contents loaded by AJAX. Popup allows page to load before greasemonkey script runs. Otherwise, script runs before page is loaded and doesn't work.
4.) TODO: put in a "save settings" button on the page to allow saving by regular users.
Regarding 2. All the form elements are only submitted if they are detected as "changed". By triggering the jQuery "click" function on the checkboxes, they are "changed" and submit just fine.
But that method is not available for "select" or "option". Someone can figure out how to do this.
- Code: Select all
// ==UserScript==
// @name Conquer Club Favorite Maps
// @namespace ccscripts
// @description Save favorite maps in game finder
// @include https://www.conquerclub.com/player.php?mode=find2
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @author judgy
// @bugs Must click on map select at least once. See instructions
// @instructions Click OK on the popup. Then you unfortunately have to click on
// the map select to activate it. Hold ctrl, click a random map. Still holding
// ctrl, click it again to unselect it. Now submit will work for your maps.
// ==/UserScript==
jQuery(document).ready(function($){
// put your favorite maps here
// enclose in double quotes, unless double quotes are in name. then do single quotes
// SPELLING COUNTS, capitalization does not.
var maps = [
"13 coLoniEs",
"4 star Meats",
"Age of realMs 1: miGht"
];
// required because page loads asynchonously and document ready doesn't work
alert('Press ok when page is loaded');
// gets "value" for map (integer number)
getMapSelectValue = function(mapName,$jSelectObj) {
return getSelectOptionByValue(mapName,$jSelectObj).value();
}
// gets the jquery option object
getSelectOptionByValue = function(mapName,$jSelectObj) {
return $jSelectObj.children("option").filter(function(){
return $(this).html().toLowerCase() === mapName.toLowerCase();
});
}
// $sel is map selector
$sel = $(".finder_row").first().find("select");
var i;
for(i = 0; i < maps.length; ++i) {
$option = getSelectOptionByValue(maps[i],$sel);
//$option.attr('select',true);
$option.prop('selected','selected');
//alert(maps[i] + ' selected ');
}
// change to true to increase size
var increaseSelectSize = false;
if(increaseSelectSize === true) {
var selectHeight = '400px';
$sel.height(selectHeight);
$sel.parent().parent().css('max-height',''); // remove max-height from grandparent of select
}
// scroll back to top of maps
$sel.scrollTop(0);
$('input[ng-model="finder.options[\'RandomMap\'][\'N\']"]').click(); // no randoms
$("#GameType_S").click(); // standard
$("#GameType_P").click(); // polymorphic
// sequential
$("#PlayOrder_S").click();
var freestyle = false;
if(freestyle === true) {
$("#PlayOrder_F").click();
}
// Waiting
$('input[ng-model="finder.options[\'State\'][\'W\']"]').click();
// Public
$('input[ng-model="finder.Joinability[\'Public\']"]').click();
// No speed games
$("#SpeedGame_N").click();
var allowSpeed = false;
if(allowSpeed === true) {
$("#SpeedGame_5").click(); // 5 minute speed.
$("#SpeedGame_4").click(); // 4 minute speed.
$("#SpeedGame_3").click(); // 3
$("#SpeedGame_2").click();
$("#SpeedGame_1").click();
}
});