Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mutalyzer
mutalyzer2
Commits
5009b7ec
Commit
5009b7ec
authored
Nov 03, 2015
by
Vermaat
Browse files
Merge pull request #107 from mutalyzer/mailcheck
Use Mailcheck in the batch jobs form
parents
25fa9bd9
15e5ce70
Changes
5
Hide whitespace changes
Inline
Side-by-side
mutalyzer/website/templates/base.html
View file @
5009b7ec
...
...
@@ -7,6 +7,7 @@
<script
src=
"{{ url_for('static', filename='js/jquery.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/bootstrap.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/mailcheck.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/interface.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/generator.js') }}"
></script>
...
...
mutalyzer/website/templates/batch-jobs.html
View file @
5009b7ec
...
...
@@ -38,7 +38,9 @@
<div
class=
"form-group"
>
<label
for=
"email"
>
Email address
</label>
<input
name=
"email"
id=
"email"
type=
"email"
class=
"form-control"
placeholder=
"Email address (notification will be sent here)"
required
value=
"{{ email }}"
>
<input
name=
"email"
id=
"email"
type=
"email"
class=
"form-control with-mailcheck"
placeholder=
"Email address (notification will be sent here)"
required
value=
"{{ email }}"
>
</div>
<div
class=
"form-group"
>
...
...
mutalyzer/website/templates/homepage.html
View file @
5009b7ec
...
...
@@ -126,11 +126,12 @@ This project is sponsored by <a href = "http://www.sun.com">SUN Microsystems</a>
</p>
<script>
$
(
"
.clickbox
"
).
click
(
function
(){
$
(
document
).
on
(
'
click
'
,
"
.clickbox
"
,
function
(
e
){
window
.
location
=
$
(
this
).
find
(
"
a
"
).
attr
(
"
href
"
);
return
false
;
e
.
preventDefault
();
e
.
stopPropagation
();
});
$
(
"
.clickbox input
"
).
click
(
function
(
e
){
$
(
document
).
on
(
'
click
'
,
"
.clickbox input
"
,
function
(
e
){
e
.
stopPropagation
();
});
</script>
...
...
mutalyzer/website/templates/static/js/interface.js
View file @
5009b7ec
...
...
@@ -29,14 +29,15 @@ function clearField(form, fieldName) {
}
$
(
document
).
ready
(
function
()
{
$
(
'
.example-input
'
).
on
(
'
click
'
,
function
()
{
$
(
document
).
on
(
'
click
'
,
'
.example-input
'
,
function
(
event
)
{
var
target
=
document
.
getElementById
(
$
(
this
).
data
(
'
for
'
));
$
(
target
).
val
(
$
(
this
).
text
());
return
false
;
event
.
preventDefault
();
event
.
stopPropagation
();
});
$
(
'
.input-select
'
).
on
(
'
change
'
,
function
()
{
$
(
document
).
on
(
'
change
'
,
'
.input-select
'
,
function
(
event
)
{
var
context
=
document
.
getElementById
(
$
(
this
).
data
(
'
context
'
)).
getElementsByClassName
(
'
subform
'
),
target
=
document
.
getElementById
(
$
(
this
).
data
(
'
for
'
)),
...
...
@@ -47,6 +48,31 @@ $(document).ready(function() {
}
target
.
style
.
display
=
''
;
return
false
;
event
.
preventDefault
();
event
.
stopPropagation
();
});
// Remove mailcheck suggestion for form element.
var
clearSuggestion
=
function
(
element
)
{
$
(
element
).
siblings
(
'
.suggestion
'
).
remove
();
};
// Attach mailcheck functionality to all .with-mailcheck form elements.
$
(
document
).
on
(
'
blur
'
,
'
.with-mailcheck
'
,
function
()
{
$
(
this
).
mailcheck
({
suggested
:
function
(
element
,
suggestion
)
{
clearSuggestion
(
element
);
$
(
element
).
after
(
// Sorry, DOM construction by string concatenation is ugly.
$
(
'
<p class="suggestion">Did you mean <a class="example-input"
'
+
'
data-for="email">
'
+
suggestion
.
full
+
'
</a>?</p>
'
).
on
(
'
click
'
,
function
()
{
clearSuggestion
(
element
);
})
);
},
empty
:
function
(
element
)
{
clearSuggestion
(
element
);
}
});
});
});
mutalyzer/website/templates/static/js/mailcheck.min.js
0 → 100644
View file @
5009b7ec
/*1.1.0*/
var
Mailcheck
=
{
domainThreshold
:
4
,
topLevelThreshold
:
3
,
defaultDomains
:
"
yahoo.com google.com hotmail.com gmail.com me.com aol.com mac.com live.com comcast.net googlemail.com msn.com hotmail.co.uk yahoo.co.uk facebook.com verizon.net sbcglobal.net att.net gmx.com mail.com outlook.com icloud.com
"
.
split
(
"
"
),
defaultTopLevelDomains
:
"
co.jp co.uk com net org info edu gov mil ca
"
.
split
(
"
"
),
run
:
function
(
a
){
a
.
domains
=
a
.
domains
||
Mailcheck
.
defaultDomains
;
a
.
topLevelDomains
=
a
.
topLevelDomains
||
Mailcheck
.
defaultTopLevelDomains
;
a
.
distanceFunction
=
a
.
distanceFunction
||
Mailcheck
.
sift3Distance
;
var
b
=
function
(
a
){
return
a
},
c
=
a
.
suggested
||
b
,
b
=
a
.
empty
||
b
;
return
(
a
=
Mailcheck
.
suggest
(
Mailcheck
.
encodeEmail
(
a
.
email
),
a
.
domains
,
a
.
topLevelDomains
,
a
.
distanceFunction
))?
c
(
a
):
b
()},
suggest
:
function
(
a
,
b
,
c
,
d
){
a
=
a
.
toLowerCase
();
a
=
this
.
splitEmail
(
a
);
if
(
b
=
this
.
findClosestDomain
(
a
.
domain
,
b
,
d
,
this
.
domainThreshold
)){
if
(
b
!=
a
.
domain
)
return
{
address
:
a
.
address
,
domain
:
b
,
full
:
a
.
address
+
"
@
"
+
b
}}
else
if
(
c
=
this
.
findClosestDomain
(
a
.
topLevelDomain
,
c
,
d
,
this
.
topLevelThreshold
),
a
.
domain
&&
c
&&
c
!=
a
.
topLevelDomain
)
return
d
=
a
.
domain
,
b
=
d
.
substring
(
0
,
d
.
lastIndexOf
(
a
.
topLevelDomain
))
+
c
,{
address
:
a
.
address
,
domain
:
b
,
full
:
a
.
address
+
"
@
"
+
b
};
return
!
1
},
findClosestDomain
:
function
(
a
,
b
,
c
,
d
){
d
=
d
||
this
.
topLevelThreshold
;
var
e
,
g
=
99
,
f
=
null
;
if
(
!
a
||!
b
)
return
!
1
;
c
||
(
c
=
this
.
sift3Distance
);
for
(
var
h
=
0
;
h
<
b
.
length
;
h
++
){
if
(
a
===
b
[
h
])
return
a
;
e
=
c
(
a
,
b
[
h
]);
e
<
g
&&
(
g
=
e
,
f
=
b
[
h
])}
return
g
<=
d
&&
null
!==
f
?
f
:
!
1
},
sift3Distance
:
function
(
a
,
b
){
if
(
null
==
a
||
0
===
a
.
length
)
return
null
==
b
||
0
===
b
.
length
?
0
:
b
.
length
;
if
(
null
==
b
||
0
===
b
.
length
)
return
a
.
length
;
for
(
var
c
=
0
,
d
=
0
,
e
=
0
,
g
=
0
;
c
+
d
<
a
.
length
&&
c
+
e
<
b
.
length
;){
if
(
a
.
charAt
(
c
+
d
)
==
b
.
charAt
(
c
+
e
))
g
++
;
else
for
(
var
f
=
e
=
d
=
0
;
5
>
f
;
f
++
){
if
(
c
+
f
<
a
.
length
&&
a
.
charAt
(
c
+
f
)
==
b
.
charAt
(
c
)){
d
=
f
;
break
}
if
(
c
+
f
<
b
.
length
&&
a
.
charAt
(
c
)
==
b
.
charAt
(
c
+
f
)){
e
=
f
;
break
}}
c
++
}
return
(
a
.
length
+
b
.
length
)
/
2
-
g
},
splitEmail
:
function
(
a
){
a
=
a
.
trim
().
split
(
"
@
"
);
if
(
2
>
a
.
length
)
return
!
1
;
for
(
var
b
=
0
;
b
<
a
.
length
;
b
++
)
if
(
""
===
a
[
b
])
return
!
1
;
var
c
=
a
.
pop
(),
d
=
c
.
split
(
"
.
"
),
e
=
""
;
if
(
0
==
d
.
length
)
return
!
1
;
if
(
1
==
d
.
length
)
e
=
d
[
0
];
else
{
for
(
b
=
1
;
b
<
d
.
length
;
b
++
)
e
+=
d
[
b
]
+
"
.
"
;
2
<=
d
.
length
&&
(
e
=
e
.
substring
(
0
,
e
.
length
-
1
))}
return
{
topLevelDomain
:
e
,
domain
:
c
,
address
:
a
.
join
(
"
@
"
)}},
encodeEmail
:
function
(
a
){
a
=
encodeURI
(
a
);
return
a
=
a
.
replace
(
"
%20
"
,
"
"
).
replace
(
"
%25
"
,
"
%
"
).
replace
(
"
%5E
"
,
"
^
"
).
replace
(
"
%60
"
,
"
`
"
).
replace
(
"
%7B
"
,
"
{
"
).
replace
(
"
%7C
"
,
"
|
"
).
replace
(
"
%7D
"
,
"
}
"
)}};
"
undefined
"
!==
typeof
module
&&
module
.
exports
&&
(
module
.
exports
=
Mailcheck
);
"
undefined
"
!==
typeof
window
&&
window
.
jQuery
&&
function
(
a
){
a
.
fn
.
mailcheck
=
function
(
a
){
var
c
=
this
;
if
(
a
.
suggested
){
var
d
=
a
.
suggested
;
a
.
suggested
=
function
(
a
){
d
(
c
,
a
)}}
if
(
a
.
empty
){
var
e
=
a
.
empty
;
a
.
empty
=
function
(){
e
.
call
(
null
,
c
)}}
a
.
email
=
this
.
val
();
Mailcheck
.
run
(
a
)}}(
jQuery
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment