Quantcast
Channel: E-Liquid Recipes Forum - Latest topics
Viewing all articles
Browse latest Browse all 13212

Batch edit flavors in stash js script

$
0
0

@tplk wrote:

Hi, just wanted to share this little script I use to update my stash when all my flavors are gone and I order a ton of new ones. It can only update all at once and it will override yours existing values. It's easy to implement other stuff like "Update only tpa or capella", "Don't overwrite set values" etc. but I don't need it. If you want some feature please tell me and I might add it.

How to use:
1. Go to your stash
2. Open console in your browser (F12 or Ctrl+Shift+I in Chrome for example)
3. Paste code from below into the console
4. Run the function by typing in the console
batchEdit(10, 5)
where 10 is bottle size and 5 is cost

Code:

function isNumeric(n) {
	return !isNaN(parseFloat(n)) && isFinite(n);
}

function batchEdit (size, cost) {
	if (isNumeric(size) && isNumeric(cost)) {
		$("input[name^='ml']" ).each(function(){
			$(this).val(size);
		});
		$("input[name^='cost']" ).each(function(){
			$(this).val(cost);
		});
		alert("Success! Click \"Save\" to update stash.");
		return true;
	} else {
		alert("Error: input values are not numeric.");
		return false;
	}
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 13212

Trending Articles