-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalFunctions.js
47 lines (37 loc) · 1.1 KB
/
localFunctions.js
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
function googleLinks() {
var gooRegEx = /.+?(https?:\/\/.+?)&.+/i;
$('a').each(function() {
// Match on all of google's modified links
var match = gooRegEx.exec(this.href);
// If we found a modified link, change it back.
if(match) {
$(this).attr('href', decodeURIComponent(match[1]));
}
// Add _blank to all links, as we want them to open in a new window.
var a = new RegExp('/' + window.location.host + '/');
if(!a.test(this.href)) {
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});
}
});
}
function indentationClass() {
$('h3').each(function() {
$(this).removeClass();
$(this).addClass('indent')
});
}
function getPage (link) {
$.get(link, function(data) {
var tmpPage = $(data);
// Remove meta && style from load of google docs
tmpPage.splice(0, 2);
// Add to page
$("#body").append(tmpPage);
indentationClass();
googleLinks();
});
}