SVN: toys/rsget.pl/rsget.pl.user.js

sparky sparky at pld-linux.org
Sat Sep 12 01:43:30 CEST 2009


Author: sparky
Date: Sat Sep 12 01:43:29 2009
New Revision: 10578

Modified:
   toys/rsget.pl/rsget.pl.user.js
Log:
- updated


Modified: toys/rsget.pl/rsget.pl.user.js
==============================================================================
--- toys/rsget.pl/rsget.pl.user.js	(original)
+++ toys/rsget.pl/rsget.pl.user.js	Sat Sep 12 01:43:29 2009
@@ -89,52 +89,27 @@
 					add_links( links, fake_text( end.nodeValue.substr( 0, range.endOffset ) ) );
 			}
 		}
-		send( "links=" + escape( links.join( "\n" ) ) );
+		window.setTimeout( send, 0, links.join( "\n" ) );
 	}
-	GM_registerMenuCommand("Add links to rsget.pl", extract_links);
+	GM_registerMenuCommand("Add links to rsget.pl", extract_links, null, null, "r");
 
-	function add_comment()
+	function send( text )
 	{
-		var range;
-		var sel;
-		try {
-			sel = window.getSelection();
-			range = sel.getRangeAt( 0 );
-		} catch ( e ) {}
-		var links = new Array;
-
-		if ( !range || range.collapsed ) {
-			alert( "Can create comments only from selection" );
-			return;
-		}
-		send( "comment=" + escape( sel ) );
-	}
-	GM_registerMenuCommand("Add comments to rsget.pl", add_comment);
-
-
-	function onload( req )
-	{
-		GM_log( req.responseText );
-	}
-
-	function onerror( req )
-	{
-	}
-
-	function send( post )
-	{
-		var server = GM_getValue( "server", "http://localhost:8080/" );
+		var server = GM_getValue( "server", "http://localhost:5666/" );
 		GM_setValue( "server", server );
 		var uri = server + "add";
 
-		GM_xmlhttpRequest( {
-			method: "POST",
-			url: uri,
-			headers: { 'Content-type': 'application/x-www-form-urlencoded' },
-			data: post,
-			onload: onload,
-			onerror: onerror
-		} );
+		var form = document.createElement( 'form' );
+		form.setAttribute( 'action', uri );
+		form.setAttribute( 'method', 'POST' );
+		form.setAttribute( 'target', '_blank' );
+
+		var ar = document.createElement( 'textarea' );
+		ar.setAttribute( 'name', 'links' );
+		ar.value = text;
+		form.appendChild( ar );
+		document.body.appendChild( form );
+		form.submit();
 	}
 }());
 


More information about the pld-cvs-commit mailing list