From bertius at sympatico.ca Sun Jan 9 02:04:26 2005 From: bertius at sympatico.ca (bert) Date: Sun, 09 Jan 2005 05:04:26 -0500 Subject: [gutvol-p] Bookmark Message-ID: <41E101AA.4010100@sympatico.ca> Hi, I don't know if it as been done before but I have made a couple of bookmarking tools for my personal use: - A javascript for html books that enable bookmarking of paragraph. It adds a bookmark link at the top of the page. Bookmarking is done by doublecliking a paragraph. The script use a cookie to remember the bookmarked paragraph. Currently only works in Mozilla/Firebird. - A Perl script for txt books. It convert the txt book into html and then works the same way as the javascript solution. This one can bookmark either lines or paragraphs and works with Internet Explorer also. Since I have made them for my personal use they are not polished but work great for me. If anyone is interested in them I will post the code and will be happy to work on them more. From bertius at sympatico.ca Sun Jan 9 19:51:43 2005 From: bertius at sympatico.ca (bert) Date: Sun, 09 Jan 2005 22:51:43 -0500 Subject: [gutvol-p] Bookmark (javascript) Message-ID: <41E1FBCF.9040508@sympatico.ca> This is the javascript version. Doubleclick on a paragraph to bookmark. After that reload the page and click the bookmark link to return to that paragraph. The bookmark is stored in a cookie so the script only works if cookie are not disabled. The script only works with HTML books that contains paragraph (as far as i know all of the HTML books do). Currently only works with Mozilla-powered browsers. Add the following script just before the end of the body section (): From bertius at sympatico.ca Sun Jan 9 20:02:37 2005 From: bertius at sympatico.ca (bert) Date: Sun, 09 Jan 2005 23:02:37 -0500 Subject: [gutvol-p] Bookmark (bookmarklet) Message-ID: <41E1FE5D.6090405@sympatico.ca> This is a bookmarklet version of the javascript tool. The main advantage is that you don't have to alter the HTML file in order to use a bookmark. Once installed, use the bookmarlet to return to a bookmarked paragraph. Since my script is a bit long it cannot be installed as a regular bookmarklet. So, to install: 1- create a new bookmark (this can be done by bookmarking any html page) 2- go to Bookmarks -> Manage bookmarks... 3- right-click on your new bookmark -> Properties 4- change the name (optional) 5- replace the location with the following: javascript:(function(){function init(){var bookmark=getCookie('bookmark');if(bookmark==null){bookmark=0;}var p=document.getElementsByTagName('p');var b=document.getElementsByTagName('body');var mark=document.getElementById('mark');if(mark!=null){b[0].removeChild(mark);}mark=document.createElement('a');mark.name='bookmark';mark.id='mark';mark.innerHTML='
';b[0].insertBefore(mark,p[bookmark]);p[bookmark].style.backgroundColor='lavender';for(var i=0;i0){var begin=document.cookie.indexOf(NameOfCookie+'=');if(begin!=-1){begin+=NameOfCookie.length+1;var end=document.cookie.indexOf(';',begin);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(begin,end));}}return null;}function setCookie(NameOfCookie,value,expiredays){var ExpireDate=new Date();ExpireDate.setTime(ExpireDate.getTime()+(expiredays*24*3600*1000));document.cookie=NameOfCookie+%22=%22+escape(value)+((expiredays==null)?'':'; expires='+ExpireDate.toGMTString());}init();})(); From bertius at sympatico.ca Sun Jan 9 20:44:31 2005 From: bertius at sympatico.ca (bert) Date: Sun, 09 Jan 2005 23:44:31 -0500 Subject: [gutvol-p] Bookmark (perl) Message-ID: <41E2082F.5070206@sympatico.ca> This Perl script transforms a txt into html and ads the javscript for bookmarking lines. The script takes one argument as parameter, the name of the txt file (ex.: 8946-8.txt) and outputs a html file (ex.: 8946-8.html). This is not a program and so requires a Perl interpretor to be installed. $file = $ARGV[0]; open(IN, $file); @lines = ; close(IN); $ARGV[0] =~ /(.*)\.(.*)/; $file = $1 . '.html'; open(OUT, ">$file"); print OUT ''; print OUT ""; print OUT ''; print OUT '
bookmark

'; $i = 0; foreach $line (@lines) { if ($line eq "\n") { print OUT '

'; } else { print OUT '' . $line . ''; } } print OUT '

'; close(OUT); From bertius at sympatico.ca Sun Jan 9 21:20:32 2005 From: bertius at sympatico.ca (bert) Date: Mon, 10 Jan 2005 00:20:32 -0500 Subject: [gutvol-p] Bookmark (bookmarklet) Message-ID: <41E210A0.1010304@sympatico.ca> This is an easier to install version of the bookmarklet: http://jove.prohosting.com/~l3ert/ Just drag and drop the link named bookmarklet onto the bookmark bar of your browser or right-click the link and choose bookmark this link.