Using javascript vars created in the page?

37 views
Skip to first unread message

webm...@phpecono.com

unread,
Mar 23, 2012, 10:43:02 AM3/23/12
to greasemon...@googlegroups.com
Hey guys i am integrating my userscript inside a page that has a script that looks like this posted in his header:

		<script type="text/javascript">
		var user = {"userName":"CyberSee","countryCode":null,"kabamId":"37810825","firstName":"Patrick","lastName":"Simard","birthday":"1985-7-29","gender":null,"isGuest":null,"joinDate":"2012-03-12 12:03","additionalNetworks":[{"gnuid":"AItOawkt8ukesL0yhTTlyLJxE5fHRjpi1F2AqSw","network":"google"}],"emailAddress":"webmaster@***.com","returnCode":1}; 
	var fbInviteIncentive = null; 
	var urlSlug = "edgeworld"; 
	var playPage = "\/edgeworld\/play"; 
	var clientId = 10; 
	var incentiveData = {"promoIcon":"https:\/\/kabam1-a.akamaihd.net\/wwwkabam\/cdn\/features\/invite\/img\/promo_ico.jpg","promoHeader":"Invite friends to play on Kabam.com","promoMsg":"Invite your friends and play games together. Import people from your address book or invite them directly."}; 
	var tracking = {"gameId":10,"entryPath":"page","world":"","username":"Your friend","short_name":"ew","invite-controller":"edgeworld","invite-action":"play","invite-module":"default"}; 
	var cdnHost = "https:\/\/kabam1-a.akamaihd.net\/wwwkabam"; 
	var HOST_URL = "https:\/\/www.kabam.com"; 
	var identity = {"kabamId":"37810825","userId":"31657138788802955","naid":"37810825","fbuid":"","email":"webmaster@***.com","userName":"CyberSee","isVerified":false,"source":"google"}; 
	var user = {"userName":"CyberSee","countryCode":null,"kabamId":"37810825","firstName":"Patrick","lastName":"Simard","birthday":"1985-7-29","gender":null,"isGuest":null,"joinDate":"2012-03-12 12:03","additionalNetworks":[{"gnuid":"AItOawkt8ukesL0yhTTlyLJxE5fHRjpi1F2AqSw","network":"google"}],"emailAddress":"webmaster@***.com","returnCode":1}; 
	var nextUrl = null; 
	var logoutUrl = "\/edgeworld"; 
</script>

I need to retrieve the userName and the emailAddress as a usable var inside my GM script ... how would i do that?

Anthony Lieuallen

unread,
Mar 23, 2012, 1:16:13 PM3/23/12
to greasemon...@googlegroups.com
Basically you don't.  Probably by running your script in the page.

http://wiki.greasespot.net/Category:Coding_Tips:Interacting_With_The_Page
Reply all
Reply to author
Forward
0 new messages