Since that select is driven by jQuery, you can use jQuery to change it and trigger all the necessary javascript.
But your Greasemonkey script must use injection or @grant none
mode, because you need to trigger the page's javascript functions.
A complete script for that sample page would be like:
// ==UserScript==
// @name _Amazon-like store, auto select 50 items per page
// @include https://dl.dropboxusercontent.com/u/5546881/*
// @grant none
// ==/UserScript==
//-- $ not defined. Use jQuery
jQuery('#v_pagination_long select').val (50).trigger ('change');
Update:
Since the OP is not really using Greasemonkey, or a modern equivalent like Tampermonkey, @grant none
is not supported.
Here is the same script using script injection, that will work on almost any browser+userscript-engine combo:
// ==UserScript==
// @name _Amazon-like store, auto select 50 items per page
// @include https://dl.dropboxusercontent.com/u/5546881/*
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
function GM_main () {
jQuery('#v_pagination_long select').val (50).trigger ('change');
}
addJS_Node (null, null, GM_main);
function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
var D = document;
var scriptNode = D.createElement ('script');
if (runOnLoad) {
scriptNode.addEventListener ("load", runOnLoad, false);
}
scriptNode.type = "text/javascript";
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (scriptNode);
}
Important:
That sample page shows 9 items max, so it's impossible to be 100% sure that the script is doing everything needed. With the OP's new sample page, verified that the script works on FF+GM and Chrome+TM.
- The
<select>
is wrapped in a div with the id: v_pagination_long
. Use that to help get the correct control.
That page uses various mouse events (not click), so it may be that more stateful approaches are needed (Can't tell for sure, see item 1). Not needed in this case for the demo page. See Choosing and activating the right controls on an AJAX-driven site for other pages.