;--------------------------------------------------------------------------- ; URL Watcher v1.05 - By Vash@AnimeMUCK ( sizer@san.rr.com ) ; Distribute at will! Though I'd like to hear of improvements. ; ; This is formatted for 4-space tabs. ; ; This compensates for not being able to launch urls from TF. It will watch ; your worlds and write out an html file with urls it sees go by. Then you ; can point your browser at the file and launch the urls from there. Note that ; it puts the newest urls at the top. ; ; It's not very efficient or very pretty ( I don't know TF macro language, ; just used other macros as samples ) but It Works For Me (TM). ; ; --------------------------------------------------------------------------- ; -- INSTALL ; - Put this urlwatch.tf in your tf-lib directory, then in your .tfrc ; file put a '/load urlwatch.tf'. ; - If you can't do that, put it in your home directory or somewhere, ; then '/load ~/urlwatch.tf' (for example). ; - If you get complaints about 'whitespace following final '\', then ; you have the wrong CR/LF settings for this file. ; --------------------------------------------------------------------------- ; -- VERSIONS ; - V 1.05 - Sep 12 '07 - More variable substitution hell ; - V 1.04 - Sep 11 '07 - The urltarget wasn't being added correctly after 1.03 ; - V 1.03 - Sep 08 '07 - Add _urlhead, some extra quoting niceness ; - V 1.02 - Aug 24 '07 - Fix quoting issue with regmatch ; - V 1.01 - Aug 24 '07 - Add _urltitle, _urltarget, multiple urls per line ; - V 1.00 - Aug 23 '07 - Initial release ; --------------------------------------------------------------------------- ; -- CONFIGURATION ; This is the file which gets written and you need to view in your browser. ; In Firefox, File -> Open File..., in IE, File -> Open -> Browse /set _urlfile=/web/tf/tfurls.html ; comment out this line if you don't want urls opening in a new window/tab /set _urltarget=target="_blank" ; Title for the browser title bar/tab title /set _urltitle=TinyFugue URLs ; Define your own style sheet info here, note the \ after every line /set _urlcss=\ td { padding: 0.5em 1em; } \ .type0 { background: #f0fff0; } \ .type1 { background: #f0f0ff; } \ ; How many urls you want to save for the page /set _urlmax=20 ; How often you want the page to auto-reload, in seconds (or 0) /set _urltime=30 ; anything else you want before the table of urls /eval /set _urlhead=[ reload page ] ; --------------------------------------------------------------------------- ; We'll need this more than once /set _urlpattern=(http|ftp|https)://\S+[0-9A-Za-z/] ; Create the trigger /eval /def -mregexp -p9 -F -q -t%_urlpattern urlwatch = /urlw2 %PL %P0 %PR ; blank the initial urls /for i 1 %{_urlmax} /set _url%{i}= ; ; Catch the urls and write the file ; /def urlw2 = \ ; move all the old ones down one step /for i 2 %{_urlmax} /test eval("/set _url$$[ _urlmax - i + 2 ]=%%%_url$$[ _urlmax - i + 1]")%; \ ; process the line to get all the urls /let url=%;\ /let foo=1%;\ /while ( foo > 0 )\ /let url=%url%{PL}%{P0}%;\ /let remain=%PR%;\ /test foo:=regmatch( {_urlpattern}, remain )%;\ /done%;\ /set _url1=${world_name}%url%remain%; \ ; write the file /test f:=tfopen( {_urlfile}, "w" )%; \ /test tfflush( %f, "off" )%; \ /test tfwrite( %f, "%_urltitle" )%; \ /if ( %_urltime != 0 ) \ /test tfwrite( %f, "" )%; /endif %; \ /test tfwrite( %f, "" )%; \ /test tfwrite( %f, "" )%; \ /test tfwrite( %f, {_urlhead} )%; \ /test tfwrite( %f, "" )%; \ /for i 1 {_urlmax} /test tfwrite( %f, "" ), \ tfwrite( %f, %%%{_url%%i} ), \ tfwrite( %f, "" )%; \ /test tfwrite( %f, "
" )%; \ /test tfclose( %f )