home *** CD-ROM | disk | FTP | other *** search
- // ==UserScript==
- // @name Show Password onMouseOver
- // @namespace http://ie7pro.com/
- // @include *
- // @description Show password when mouseover on password field
- // ==/UserScript==
-
- (function() {
- function addEvent( obj, type, fn ) {
- if ( obj.attachEvent ) {
- obj["e"+type+fn] = fn;
- obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
- obj.attachEvent( "on"+type, obj[type+fn] );
- } else
- obj.addEventListener( type, fn, false );
- }
- function removeEvent( obj, type, fn ) {
- if ( obj.detachEvent ) {
- obj.detachEvent( "on"+type, obj[type+fn] );
- obj[type+fn] = null;
- } else
- obj.removeEventListener( type, fn, false );
- }
-
- var valueDiv = null;
- valueDiv = document.createElement('div');
- valueDiv.style.cssText = "background:#FFFF00;color:#000000;width:120px;height:16px;display:none;position:absolute;top:0px;left:0px;";
- document.body.appendChild(valueDiv);
-
- function input_onmouseover(e)
- {
- var elm = e.srcElement;
- if(!elm) return;
- var value = elm.value ? elm.value : '';
- if(value == '') return;
- valueDiv.innerHTML = value;
- valueDiv.style.display = "block";
- valueDiv.style.top = e.y + 'px';
- valueDiv.style.left = e.x + 'px';
- }
-
- function input_onmouseout(e)
- {
- var elm = e.srcElement;
- if(!elm) return;
- valueDiv.style.display = "none";
- }
- var inputs, input;
-
- inputs = document.getElementsByTagName('input');
- if(inputs.length == 0) return;
-
- for(var i = 0; i < inputs.length; i++) {
- input = inputs[i];
- var type = input.getAttribute('type');
- if(type && type=='password'){
- addEvent(input, 'mouseover', input_onmouseover);
- addEvent(input, 'mouseout', input_onmouseout);
- }
- }
- })();
-
-