User:Opensource Obscure/SLURLMarklet

From Second Life Wiki
Jump to navigation Jump to search

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 a Javascript bookmarklet that opens a Gmail compose-message pop, prepopulated with the first SLURL found in the webpage. The email is sent to a LSL scripted in-world object, that sends the SLURL 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