| 1 |
// $Id:
|
| 2 |
/**
|
| 3 |
* Bookmark Us - Drupal Add to Bookmarks Module.
|
| 4 |
* @ Released under GNU/GPL License - http://www.gnu.org/copyleft/gpl.html
|
| 5 |
* @ copyright (C) 2005 by Michael Carico - All rights reserved
|
| 6 |
**/
|
| 7 |
|
| 8 |
|
| 9 |
function displayLink(p_type, p_url, p_title, p_link_text) {
|
| 10 |
|
| 11 |
var agt = navigator.userAgent.toLowerCase();
|
| 12 |
var p_here = top.location.href
|
| 13 |
|
| 14 |
if (p_type == 3)
|
| 15 |
{
|
| 16 |
if ((agt.indexOf("opera") != -1)) // || (agt.indexOf("firefox") != -1))
|
| 17 |
{
|
| 18 |
document.write("<a href=\""+p_here+"\" title=\"" + p_title + "\" rel=\"sidebar\">" + p_link_text + "</a>");
|
| 19 |
} else
|
| 20 |
{
|
| 21 |
document.write("<a href=\"javascript:addBookmark('"+p_title+"',top.location.href);\" title=\"" + p_title + "\" >" + p_link_text + "</a>");
|
| 22 |
}
|
| 23 |
} else
|
| 24 |
{
|
| 25 |
if (agt.indexOf("opera") != -1)
|
| 26 |
{
|
| 27 |
document.write("<a href=\"" + p_url + "\" title=\"" + p_title + "\" rel=\"sidebar\">" + p_link_text + "</a>");
|
| 28 |
} else
|
| 29 |
{
|
| 30 |
document.write("<a href=\"javascript:addBookmark('"+p_title+"','"+p_url+"');\" title=\"" + p_title + "\" >" + p_link_text + "</a>");
|
| 31 |
}
|
| 32 |
}
|
| 33 |
}
|
| 34 |
|
| 35 |
|
| 36 |
function addBookmark(title,url) {
|
| 37 |
|
| 38 |
var msg_netscape = "NetScape message";
|
| 39 |
var msg_opera = "This function does not work with this version of Opera. Please bookmark us manually.";
|
| 40 |
var msg_other = "Your browser does not support automatic bookmarks. Please bookmark us manually.";
|
| 41 |
var agt = navigator.userAgent.toLowerCase();
|
| 42 |
|
| 43 |
|
| 44 |
if (agt.indexOf("opera") != -1)
|
| 45 |
{
|
| 46 |
if (window.opera && window.print)
|
| 47 |
{
|
| 48 |
return true;
|
| 49 |
} else
|
| 50 |
{
|
| 51 |
alert(msg_other);
|
| 52 |
}
|
| 53 |
}
|
| 54 |
else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
|
| 55 |
else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title);
|
| 56 |
else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"")
|
| 57 |
else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,"");
|
| 58 |
else alert(msg_other);
|
| 59 |
|
| 60 |
}
|