-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhostroute.js
More file actions
141 lines (119 loc) · 3.73 KB
/
hostroute.js
File metadata and controls
141 lines (119 loc) · 3.73 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!--//--><![CDATA[//><!--
// hostroute.com scripts - March 2008
var Init = {
// currently disabled
preload_images : function() {
$.preloadImages("/images/site/x.png", "/images/site/y.png", "/images/site/z.png");
},
website_url : function() {
return $('link[rel=home]').attr("href");
},
domain_name : function() {
return Init.website_url().split('/')[2]; // returns e.g. www.nameroute.co.uk, geri.ultraspeed.co.uk etc.
},
external_links : function() {
$('a').not("a[href*='" + Init.domain_name() + "']").not("a[href*=order.hostroute.net]").click( function() {
window.open(this.href); return false;
});
},
table_striping : function() {
$('.zebra tbody tr:nth-child(odd)').addClass("odd");
},
table_hovering : function() {
$('tbody tr').mouseover(function() { $(this).addClass("over"); }).mouseout(function() { $(this).removeClass("over"); });
},
last_paragraph : function() {
// last paragraph in content needs less padding. Since CSS3 is not supported and does not validate as CSS2...
$('#content p:last-child').css('margin-bottom', "0.5em");
},
ie_focus_fix : function() {
if (jQuery.browser.msie) {
$("input, textarea").focus(function(){
if ( $(this).attr("id") == "search-text" ) {
$(this).css({
'background': "#FFF",
'color': "#000"
});
}
else {
$(this).css({
'border': "1px solid #000",
'border-left-width': "5px"
});
}
}).blur(function(){
// if it's the search-text, it will have a different background
if ( $(this).attr("id") == "search-text" ) {
$(this).css({
'background': "url(" + Init.website_url() + "images/site/input_bg.png)",
'color': "#777"
});
}
else {
$(this).css({
'border': "1px solid #CCC",
'color': "#333"
});
}
});
};
},
ie_submit_button_fix : function() {
$("button, .button").hover(
function() {
$(this).css('background', "#000");
},
function() {
$(this).css('background', "#3996E5");
}
);
},
prevent_empty_search_submit : function() {
// catch empty submits on search forms
// prevent our domain_check form to submit and display results here
$('#search').submit(function() {
if ( !$('#search-text').attr('value') || $('#search-text').attr('value') == "Please enter a search term" ) {
$('#search-text').attr('value', "Please enter a search term").css('color', "#000");
// so that the form won't get submitted
return false;
}
});
// when a user clicks inside input to enter a search term after tge error, clear the error text & return the input text color to the initial one
$('#search-text').focus(function() {
if ( $(this).attr('value') == "Please enter a search term" ) {
$(this).attr('value', "").css('color',"#000");
}
});
},
round_corners : function() {
$('.login').corner("10px");
},
tooltips : function() {
$('a.tooltip').tooltip({
track: true,
delay: 0,
showURL: false,
// showBody: " - ",
opacity: 0.95
});
}
}
// jQuery external function that helps with preloading images
jQuery.preloadImages = function() {
for(var i = 0; i<arguments.length; i++) {
jQuery("<img>").attr("src", arguments[i]);
}
}
$(function() {
// Init.preload_images();
Init.external_links();
Init.table_striping();
Init.table_hovering();
Init.last_paragraph();
Init.ie_focus_fix();
Init.ie_submit_button_fix();
Init.prevent_empty_search_submit();
Init.round_corners();
Init.tooltips();
});
//--><!]]>