-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
95 lines (64 loc) · 3.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<title>jExtLink</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
////////////////////////////////////
// open external links in new windows?
// y or n
//var opennew = y;
// our own domain
var domain = window.location.hostname;
// This will add rel="external" to all external links
//comment this line out to add rel="external" manually
$("a[href^='http:']").not("[href*='" + domain + "']").attr('rel','external');
// for each rel=external link
$('a[rel="external"]').each(function() {
// Get the href attribute
var url = $(this).attr("href");
// Strip http:// & www. from url
var url = url.replace("http://", "");
var url = url.replace("www.", "");
// Strip trailing slash
var url = url.replace(/\/$/,"");
// Set length of url before trimming
var limit = 30;
// Get length of url
var length = url.length;
if(length > limit){
var url = url.substring(0,limit);
var url = url + "...";
}
// Add the new title
$(this).attr('title', "Visit " + url + "");
}); // end for each
//new windows
//if(opennew == y){
$('a[rel="external"]').click(function(){
window.open($(this).attr('href'));return false;
});
//}; // end if
////////////////////////////////////
});
</script>
<style type="text/css">
<!--
body {font-size:62.5%;font-family:"Lucida Grande", Lucida, Arial, sans-serif;margin:30px 60% 150px 50px}
h1 {font-family: Georgia;font-weight:normal;font-size:1.5em;}
p {font-size:1.2em;line-height:160%;}
a {color:#C00;text-decoration: none;}
a:hover {color:#F00}
-->
</style>
</head>
<body>
<h1>Enhancing external href titles, automatically</h1>
<p>Ten years ago a crack commando unit was sent to <a title="Title is already here" href="http://www.google.co.uk/search?q=prison+by+a+military+court">prison by a military court</a> for a crime they didn't commit. These men promptly escaped from a maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune. <a rel="external" href="http://www.cloudflare.com/">If you have a problem</a> and no one else can help, and if you can find them, maybe you can hire the A-team.</p>
<p>Hey there where ya goin', not exactly knowin', who says you have to call just one place home. He's goin' everywhere, B.J. McKay and his best friend Bear. <a rel="external" href="http://wegraphics.net/">He just keeps on movin'</a>, ladies keep improvin', every day is better than the last. New dreams and better scenes, and best of all I don't pay property tax. Rollin' down to Dallas, who's providin' my palace, <a href="http://www.premiumpixels.com/">off to New Orleans or who knows where</a>. Places new and ladies, too, I'm B.J. McKay and this is my best friend Bear.</p>
<p><a href="http://dl.dropbox.com/u/154803/jExtLink/index.html#link">Same domain link here</a>.</p>
<p style="margin-top:100px"><a href="https://github.com/paulburgess/jExtLink">Source on Github</a></p>
</body>
</html>