Skip to content

Instantly share code, notes, and snippets.

@webdados
Created October 11, 2017 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdados/8ad7d1048672deeb8b17bdc6801b51e1 to your computer and use it in GitHub Desktop.
Save webdados/8ad7d1048672deeb8b17bdc6801b51e1 to your computer and use it in GitHub Desktop.
Paste Multibanco reference into BPINet
var pagServField1 = "LT_BPINet_wt43_block_wtMainContent_CS_CartoesDebito_wt7_block_WebPatterns_wt122_block_wtContent_LT_BPI_Patterns_wt292_block_wtForm_LT_BPI_Patterns_wt57_block_wtRow_LT_BPI_Patterns_wt691_block_wtInput_wttxtRef1";
var pagServField2 = "LT_BPINet_wt43_block_wtMainContent_CS_CartoesDebito_wt7_block_WebPatterns_wt122_block_wtContent_LT_BPI_Patterns_wt292_block_wtForm_LT_BPI_Patterns_wt57_block_wtRow_LT_BPI_Patterns_wt691_block_wtInput_wttxtRef2";
var pagServField3 = "LT_BPINet_wt43_block_wtMainContent_CS_CartoesDebito_wt7_block_WebPatterns_wt122_block_wtContent_LT_BPI_Patterns_wt292_block_wtForm_LT_BPI_Patterns_wt57_block_wtRow_LT_BPI_Patterns_wt691_block_wtInput_wttxtRef3";
if ( el=document.getElementById(pagServField1) ) el.addEventListener('paste', pasteRef);
function pasteRef(e) {
e.stopPropagation();
e.preventDefault();
var clipboardData = e.clipboardData || window.clipboardData;
var ref = clipboardData.getData('Text');
ref = ref.replace(/\s/g,'');
ref = ref.match(/.{1,3}/g);
document.getElementById(pagServField1).value = ref[0];
document.getElementById(pagServField2).value = ref[1];
document.getElementById(pagServField3).value = ref[2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment