Created
January 9, 2012 17:17
-
-
Save t0d0r/1583957 to your computer and use it in GitHub Desktop.
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 remote.bank.allianz.bg | |
| // @author Todor Dragnev aka t0d0r http://twitter.com/t0d0r | |
| // @namespace allianz.usersript.org.bstconsult.com | |
| // @description fix forms in web interface, just click on left or right side on the page to increase/decrease input widht | |
| // @include https://remote.bank.allianz.bg/* | |
| // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js | |
| // ==/UserScript== | |
| $(document).dblclick(function(event) { | |
| var windowWidth = $(window).width(); | |
| GM_log( "clientX/Y: " + event.clientX + ", " + event.clientY); | |
| GM_log( "pageX/Y: " + event.pageX + ", " + event.pageY); | |
| GM_log($("input:text").size()); | |
| var increase = (event.pageX > (windowWidth / 2)) | |
| GM_log("tagName: " + event.target.tagName + ", windowHalf:" + windowWidth / 2 + ", increase: " + increase ); | |
| //var lastClick = parseInt( GM_getValue("lastClick", 0) ); | |
| //var currentClick = (new Date).getTime(); | |
| //var timeDiff = currentClick - lastClick; | |
| //GM_log("timeDiff: " + timeDiff); | |
| //GM_setValue("lastClick", "" + currentClick); | |
| if ( event.target.tagName != "INPUT") { | |
| $("input:text").each( function(index) { | |
| var oldWidth = parseInt( $(this).css("width")); | |
| var newWidth; | |
| if ( increase ) { // 1 second | |
| newWidth = oldWidth * 1.20; // 30% more | |
| $(this).css("background-color", "#fecdce"); | |
| } else { | |
| newWidth = oldWidth / 1.20; // 30% less | |
| $(this).css("background-color", "#ebf8c0"); | |
| } | |
| $(this).css("width", newWidth + "px"); | |
| //GM_log("old width: " + oldWidth + ", new width: " + newWidth); | |
| var myObj = this; | |
| setTimeout(function() { $(myObj).css("background-color", "#fff") }, 1000); | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment