source: contrib/davical/htdocs/js/browse.js @ 3733

Revision 3733, 1.6 KB checked in by gabriel.malheiros, 13 years ago (diff)

Ticket #1541 - <Davical customizado para o Expresso.Utiliza Caldav e CardDav?>

Line 
1/**
2* Simple function to send the browser to a given URL
3*/
4function Go( url ) {
5  window.location=url;
6  return true;
7}
8
9/**
10* Make this tag into a Link to a given URL
11*/
12function LinkTo( tag, url ) {
13  tag.style.cursor = "pointer";
14  tag.setAttribute('onClick', "Go('" + url.replace(/&amp;/g,'&') + "')");
15  tag.setAttribute('onMouseOut', "window.status='';return true;");
16  window.status = window.location.protocol + '//' + document.domain + url;
17  tag.setAttribute('onMouseover', "window.status = window.location.protocol + '//' + document.domain + '" + url + "';return true;");
18  tag.setAttribute('href', url);
19  return true;
20}
21
22/**
23* Make this tag and all of it's contents into a clickable link, using the link target from an
24* existing link target somewhere within the tag.  Setting 'which1' to '1' will make the target
25* match the 1st href target within the HTML of the tag.
26* @param objectref tag A reference to the object which will become clickable.
27* @param int which1 A one-based index to select which internal href attribute will become the target.
28*/
29function LinkHref( tag, which1 ) {
30  var urls = tag.innerHTML.match( / href="([^"]*)"/ig );
31//  alert(show_props(urls,'urls', 1));
32  try {
33    var url = urls[which1 - 1];
34    urls = url.match( /="([^"]*)"/ );
35  }
36  catch (e) {
37    //alert("Here are the URLs found:\nYou appear to need to choose a different index for your LinkHref call (the second parameter).  Add 1 to the index below for the correct URL shown and use that.\n\n" + show_props(urls,'urls', 0));
38    return false;
39  }
40//  alert(show_props(urls,'urls', 1));
41  url = urls[1];
42//  alert("Linking to >>>" + url + "<<<");
43  LinkTo(tag,url);
44  return true;
45}
46
Note: See TracBrowser for help on using the repository browser.