Last active
December 14, 2015 06:29
-
-
Save jwcobb/5043199 to your computer and use it in GitHub Desktop.
Removes unwanted spaces from barcode input fields on EventInventory.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name EI Barcode De-Spacer | |
// @namespace TeamOneTickets | |
// @include https://www.eventinventory.com//Basic/AirBillManager/Barcode.aspx* | |
// @description Removes unwanted spaces from barcode input fields because EI doesn't know how to RegEx | |
// @copyright Team One Tickets & Sports Tours, Inc. | |
// @version 1.0 | |
// @license BSD | |
// ==/UserScript== | |
// Install this into Chrome using Tampermonkey (https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) | |
// Shoudl also work with Greasemonkey on FireFix (not tested) | |
function strip(e) { | |
e.value = e.value.replace(/[\n\t]*/g,"").replace(/[ ]+/g,""); | |
} | |
var boxes = document.evaluate("//input[@type='text']",document,null,6,null); | |
for(var i=boxes.snapshotLength-1; (item=boxes.snapshotItem(i)); i--) { | |
item.addEventListener('blur', function(e){strip(e.currentTarget);}, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment