Created
August 18, 2013 19:04
-
-
Save danilopopeye/6263361 to your computer and use it in GitHub Desktop.
fix [Visa Vale](http://www.cartoesbeneficio.com.br/) table to use on [ofxGen](http://www.andersonwilson.com/br/ofxgen/index.php)
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
| // getScript() | |
| // more or less stolen form jquery core and adapted by paul irish | |
| function getScript(url,success){ | |
| var head = document.getElementsByTagName("head")[0], done = false; | |
| var script = document.createElement("script"); | |
| script.src = url; | |
| // Attach handlers for all browsers | |
| script.onload = script.onreadystatechange = function(){ | |
| if ( !done && (!this.readyState || | |
| this.readyState == "loaded" || this.readyState == "complete") ) { | |
| done = true; | |
| success(); | |
| } | |
| }; | |
| head.appendChild(script); | |
| } | |
| getScript('https://code.jquery.com/jquery.min.js',function(){ | |
| jQuery('table').eq(2) | |
| .find('td:first-child').each(function(){ | |
| this.innerHTML += '/' + (new Date().getFullYear()); | |
| }) | |
| .end() | |
| .find('td:last-child').each(function(){ | |
| var value = ''; | |
| if(!~jQuery(this).parent().text().indexOf('Benefício')){ | |
| value += '-'; | |
| } | |
| this.innerHTML = value + this.innerHTML.substr(8); | |
| }) | |
| .end() | |
| .prepend('<textarea style="height:100px;width:500px;" />') | |
| .find('textarea').val( jQuery('table:eq(2) tbody').html() ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment