// are we in the right place? if ( location.href.indexOf( 'etsy.com/create_listing2.php' ) >- 1 ) { if ( s = prompt( 'Tags', '' ) ) { // we have tags, turn them into an array t = s.split( /, \s*/ ); // set up some short references d = document; f = d.forms[1]; y = t[ 0 ].replace( / /g, '_' ); // copy of first tag to match drop-down box's values s = f.getElementsByTagName( 'select' )[ 0 ]; x = 0; // starting index in t array for regular tags if( s.selectedIndex < 1 ) { // we don't have a first tag selected on the page // deal with it differently u = s.options; for( o = 0; o < u.length; o++ ) { if( u[ o ].value == y ) { // found it in the main categories list s.selectedIndex = o; mainCategorySelector( y ) } } x++; // start with the next tag } // loop through the tags, adding them for( a=x; a < t.length; a++ ) addTag( t[ a ] ) } }