Domanda

This is maybe a weird request but hear me out:

I have a huge database at my shop containing product codes, like 87 445 G 6 which I need to check for availability on a supplier's website. The problem is, the supplier's website consists of a web form in which I have to enter the code without spaces, so imagine that I have to manually delete spaces every time I paste a code or write it manually without. I can't edit the database from which I copy the codes.

I wonder if some sort of plugin, script, or trick can be used directly in browser on the supplier's web form, or some software to modify how the windows clipboard works, maybe some option to copy text without spaces. Using Windows XP.

È stato utile?

Soluzione

The OP has probably moved on, but for anyone else looking here, my approach was to tackle this from the windows clipboard side.

For background: I keep a list of my credit card info in Keepass. Sometimes (poorly coded) shopping cart checkout forms don't like spaces in between card numbers. I like storing them with spaces since it's easier to read off that way.

There's various Windows clipboard utilites out there, but it took me a while to find one that could do some processing on the clipboard contents and pasting it out - Clipboard Help and Spell

The program has a way to "save" a bunch of text transformations, and even assign the action to a hotkey.

For reference, my "Find and Replace" action is to find "\s" (without quotes) and leave the Replace textbox empty. "\s" will match whitespace character.

Altri suggerimenti

Use the javascript console

You could use the javascript console for your browser to edit the textarea after you paste.

Using Google Chrome (or Firefox)

Paste your text in the text area.

Right click the text area and click Inspect Element

Inspect Element

Look at the id for the element

id

Now switch to the console view

console

then run these lines (making sure to replace with 'the-id' with your id)

var my_text_area = document.getElementById('the-id'); // Put your id in here
my_text_area.value = my_text_area.value.replace(/ /g,"") // Deletes just spaces

It's even simpler if you have access to jQuery:

$('#the-id').val($('#the-id').val().replace(/ /g, ""))

The replace function is simply using regular expressions to convert spaces to nothing. If you want to replace all whitespace (including newlines) you would use .replace(/\s/g,"").

For firefox, the names are the same but the UI is a little bit different.

Firefox inspect element

Use greasemonkey

You can either write a greasemonkey plugin or try to find one that fits your needs.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top