-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
129 lines (118 loc) · 3.58 KB
/
functions.js
File metadata and controls
129 lines (118 loc) · 3.58 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
"use strict";
(function() {
'use strict';
function showSize() {
$('#size').html('HEIGHT : ' + $(window).height() + '<br>WIDTH : ' + $(window).width());
$('#size2').html('HEIGHT : ' + screen.height + '<br>WIDTH : ' + screen.width);
$('#size3').html('HEIGHT : ' + $('.main-content').height() + '<br>WIDTH : ' + $('.main-content').width());
}
$(window).on('resize', showSize);
showSize();
})();
$(function () {
$('A[rel="external"]').click( function() {
window.open( $(this).attr('href') );
return false;
});
});
// https://www.youtube.com/watch?v=GrycH6F-ksY
// Codecourse ajax script below
$(function() {
"use strict";
$('form#ajax').on('submit', function() {
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.find('[name]').each(function(index, value) {
var that = $(this),
name = that.attr('name'),
value = that.val();
data[name] = value;
});
$.ajax({
url: url,
type: type,
data: data,
success: function(response) {
$('#display').html(response).delay(8000).fadeOut(1000);
}
});
return false;
});
});
$(function() {
"use strict";
$('form#ajax1').on('submit', function() {
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.find('[name]').each(function(index, value) {
var that = $(this),
name = that.attr('name'),
value = that.val();
data[name] = value;
});
$.ajax({
url: url,
type: type,
data: data
});
return false;
});
});
for (var i = 0; i < document.links.length; i++) { /*this highlights the current active link*/
if (document.links[i].href == document.URL) {
document.links[i].className = 'current';
}
}
$(function() {
$("#date").datepicker();
});
$(function() {
$("#last_date").datepicker();
});
$(function() {
$(".grab").tooltip();
});
(function() {
"use strict";
$(".ancestry--ancestryContent").hide();
$('button.grab').on('click', function() {
$(this).next('div.ancestry--ancestryContent').toggle('slow');
});
})();
$('#pass').keyup(function(e) {
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
var enoughRegex = new RegExp("(?=.{6,}).*", "g");
if (false == enoughRegex.test($(this).val())) {
$('#passstrength').html('More Characters');
} else if (strongRegex.test($(this).val())) {
$('#passstrength').className = 'ok';
$('#passstrength').html('Strong!');
} else if (mediumRegex.test($(this).val())) {
$('#passstrength').className = 'alert';
$('#passstrength').html('Medium!');
} else {
$('#passstrength').className = 'error';
$('#passstrength').html('Weak!');
}
return true;
});
// example
// <input type="password" name="pass" id="pass" />
// <span id="passstrength"></span>
(function() {
$('#content').keyup(function() {
var content = $(this).val().length;
$('#feedback').html(content);
});
})();
$(function() {
$('#content').wordCount();
});
$(function() {
$("#tabs" ).tabs({orientation: "vertical" });
});