Difference between revisions of "User:Opensource Obscure/SLURLMarklet"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Overview: more details)
Line 12: Line 12:
== Doesn't work with these pages ==
== Doesn't work with these pages ==


* http://slmagic.com/about
* http://malburns.posterous.com/soundcloud-day-inworld
* http://malburns.posterous.com/soundcloud-day-inworld
* http://www.secondlifeitalia.com/community/viewtopic.php?f=3&t=28914&p=276022
* http://www.secondlifeitalia.com/community/viewtopic.php?f=3&t=28914&p=276022

Revision as of 16:09, 6 March 2011

Overview

I use this while I'm browsing websites that mention interesting Second Life locations. When I later log in, I get IM messages with a direct teleport link to those locations.

The system is based on an Email-to-IM scripted object and a Javascript bookmarklet. The bookmarklet, when clicked in the web browser, opens a Gmail compose-message pop, prepopulated with the first SLURL found in the webpage. The email is sent to the scripted in-world object, that relays it to the owner.

Code

Replace REPLACE_ME_WITH_THE_SCRIPTED_OBJECT_UUID@lsl.secondlife.com with the email address provided by a script like Email-to-IM. <lsl> javascript:(function(){var a=window,b=document,d=window,h="",i=0,p=new Array(),t="",s="";while(i<b.links.length){if(b.links[i].href.indexOf("secondlife://")==0||b.links[i].href.indexOf("http://maps.secondlife.com")==0||b.links[i].href.indexOf("http://slurl.com")==0){h=b.links[i].href;break;}i++;}if(h){if((i=h.indexOf("?"))==-1){t=h.slice(0);}else{t=h.slice(0,i);p=h.slice(i+1).split("&");}for(i in p){if(p[i].indexOf("subject")==0)s=p[i].replace(/^subject/,"&su");}d=a.open("https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=REPLACE_ME_WITH_THE_SCRIPTED_OBJECT_UUID@lsl.secondlife.com&su=SLURL&body="+escape(t)+"%20-%20"+escape(location.href),"gmail_compose_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=550px,width=650px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300);}else{alert("No links found on this page");}})(); </lsl>

Doesn't work with these pages

Caveats

  • First SLURL in the page may not be the desired one
  • IM messages can be capped