Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-webclient
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-webclient
Commits
78c3d39b
Commit
78c3d39b
authored
Apr 30, 2012
by
Владислав Большаков
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
barbass: поправки стилей/офрмлений, переименование функций
parent
df61ad83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
47 deletions
+49
-47
default.php
default.php
+5
-5
etersoft_typos.js
etersoft_typos.js
+44
-42
No files found.
default.php
View file @
78c3d39b
...
...
@@ -13,7 +13,7 @@
font-size
:
15px
;
background-color
:
#DDDDDD
;
padding
:
0px
2px
2px
2px
;
width
:
3
0
0px
;
width
:
3
5
0px
;
border-radius
:
10px
;
box-shadow
:
0px
0px
10px
rgba
(
0
,
0
,
0
,
0.5
);
text-align
:
center
;
...
...
@@ -57,14 +57,14 @@
<div
id=
"e_typos_div"
>
<p>
Выделите текст и нажмите кнопку "Отправить"
</p>
<p>
<nobr>
email:
<input
type=
"email"
id=
"e_typos_email"
name=
"e_typos_email"
class=
"idle"
onblur=
"this.className='idle'"
onfocus=
"this.className='activeField'"
size=
'19'
maxlength=
"50"
placeholder=
"my@email.com"
/></nobr>
<nobr>
e
-
mail:
<input
type=
"email"
id=
"e_typos_email"
name=
"e_typos_email"
class=
"idle"
onblur=
"this.className='idle'"
onfocus=
"this.className='activeField'"
size=
'19'
maxlength=
"50"
placeholder=
"my@email.com"
/></nobr>
<nobr>
Комментарий:
<input
type=
"text"
id=
"e_typos_comment"
name=
"e_typos_comment"
class=
"idle"
onblur=
"this.className='idle'"
onfocus=
"this.className='activeField'"
size=
'19'
maxlength=
"50"
placeholder=
"Должна быть буква..."
/></nobr>
</p>
<p
id=
"e_typos_error"
class=
"e_typos_error"
></p>
<p
id=
"e_typos_error"
class=
"e_typos_error"
style=
"border:1px solid"
></p>
<input
type=
"button"
value=
"Отправить"
class=
"idle"
onblur=
"this.className='idle'"
onmouseup=
"this.className='idle'"
onmousedown=
"this.className='activeButton'"
onclick=
"
e_typos
_post_data();"
/>
<input
type=
"button"
value=
"Закрыть"
class=
"idle"
onblur=
"this.className='idle'"
onmouseup=
"this.className='idle'"
onmousedown=
"this.className='activeButton'"
onclick=
"
e_typos
_close();"
/>
<input
type=
"button"
value=
"Отправить"
class=
"idle"
onblur=
"this.className='idle'"
onmouseup=
"this.className='idle'"
onmousedown=
"this.className='activeButton'"
onclick=
"
ETY
_post_data();"
/>
<input
type=
"button"
value=
"Закрыть"
class=
"idle"
onblur=
"this.className='idle'"
onmouseup=
"this.className='idle'"
onmousedown=
"this.className='activeButton'"
onclick=
"
ETY
_close();"
/>
</div>
<div
style=
'white-space: pre;'
>
...
...
etersoft_typos.js
View file @
78c3d39b
...
...
@@ -5,23 +5,23 @@
*/
//////////////////////////////////////////////////////
var
et
ersoft_typos
_time
=
0
;
//время последнего запроса
var
et
y
_time
=
0
;
//время последнего запроса
window
.
document
.
onkeydown
=
function
(
e
)
{
if
(
e
.
ctrlKey
==
1
&&
e
.
keyCode
==
13
)
{
e_typos
_control_panel
();
ETY
_control_panel
();
}
}
function
e_typos
_control_panel
()
{
function
ETY
_control_panel
()
{
if
(
document
.
getElementById
(
"e_typos_div"
).
style
.
display
==
"block"
)
{
e_typos
_close
();
ETY
_close
();
}
else
{
e_typos
_div
();
ETY
_div
();
}
}
function
e_typos
_div
()
{
function
ETY
_div
()
{
//Определяем на какой позиции X, Y всплывет элемент
var
top
=
window
.
pageYOffset
+
window
.
innerHeight
/
3
;
var
left
=
window
.
pageXOffset
+
window
.
innerWidth
/
3
;
...
...
@@ -34,11 +34,11 @@ function e_typos_div() {
document
.
getElementById
(
"e_typos_div"
).
style
.
display
=
"block"
;
}
function
e_typos
_close
()
{
function
ETY
_close
()
{
document
.
getElementById
(
"e_typos_div"
).
style
.
display
=
"none"
;
}
function
e_typos
_post_data
()
{
function
ETY
_post_data
()
{
var
this_url
=
window
.
location
.
href
;
//Текущая страница
var
select_text
=
String
(
window
.
getSelection
()).
trim
();
//Выделенный текст
var
user_email
=
document
.
getElementById
(
"e_typos_email"
).
value
.
trim
().
substr
(
0
,
50
);
...
...
@@ -46,7 +46,7 @@ function e_typos_post_data() {
user_email
=
""
;
}
else
{
if
(
!
/^
([
a-z0-9_-
]
+
\.)
*
[
a-z0-9_-
]
+@
[
a-z0-9_-
]
+
(\.[
a-z0-9_-
]
+
)
*
\.[
a-z
]{2,4}
$/
.
test
(
user_email
))
{
e_typos_error
(
"red"
,
"e
mail некорректен"
);
ETY_error
(
"red"
,
"e-
mail некорректен"
);
return
false
;
}
}
...
...
@@ -56,37 +56,37 @@ function e_typos_post_data() {
}
if
(
select_text
.
length
==
0
)
{
e_typos
_error
(
"red"
,
"Вы ничего не выделили"
);
ETY
_error
(
"red"
,
"Вы ничего не выделили"
);
}
else
if
(
select_text
.
length
<
5
)
{
e_typos
_error
(
"red"
,
"Выделенный текст слишком короток"
);
ETY
_error
(
"red"
,
"Выделенный текст слишком короток"
);
}
else
if
(
select_text
.
length
>
30
)
{
e_typos
_error
(
"red"
,
"Выделенный текст слишком длинный"
);
ETY
_error
(
"red"
,
"Выделенный текст слишком длинный"
);
}
else
{
//Ajax-запрос
ajax_query
(
"http://barbass.pubsandbox.eterhost.ru/typos/server.php"
+
"?url="
+
this_url
+
"&email="
+
user_email
+
"&comment="
+
user_comment
+
"&error_text="
+
select_text
);
ETY_
ajax_query
(
"http://barbass.pubsandbox.eterhost.ru/typos/server.php"
+
"?url="
+
this_url
+
"&email="
+
user_email
+
"&comment="
+
user_comment
+
"&error_text="
+
select_text
);
}
}
//Отправка запроса
function
ajax_query
(
url
)
{
e_typos
_error
(
"black"
,
"Идет отправка данных..."
);
function
ETY_
ajax_query
(
url
)
{
ETY
_error
(
"black"
,
"Идет отправка данных..."
);
var
XHR
=
window
.
XDomainRequest
||
window
.
XMLHttpRequest
;
request
=
new
XHR
;
//new XMLHttpRequest();
request
=
new
XHR
;
//Если не поддерживаются кроссдоменные запросы
if
(
request
.
withCredentials
==
undefined
)
{
e_typos
_error
(
"red"
,
"Ваш браузер не может отправить данные"
);
ETY
_error
(
"red"
,
"Ваш браузер не может отправить данные"
);
return
false
;
}
var
result
=
timer
();
var
result
=
ETY_
timer
();
if
(
result
==
0
)
{
e_typos
_error
(
"red"
,
"Не отправляйте данные часто"
);
ETY
_error
(
"red"
,
"Не отправляйте данные часто"
);
return
false
;
}
else
{
et
ersoft_typos_time
=
this_time
();
set_storage
(
"etersoft_typos/"
+
window
.
location
.
hostname
+
""
,
etersoft_typos
_time
);
et
y_time
=
ETY_
this_time
();
ETY_set_storage
(
"etersoft_typos/"
+
window
.
location
.
hostname
+
""
,
ety
_time
);
}
request
.
open
(
"POST"
,
url
,
true
);
...
...
@@ -94,66 +94,68 @@ function ajax_query(url) {
var
data
=
request
.
responseText
;
switch
(
data
)
{
case
'10robot'
:
e_typos
_error
(
"red"
,
"Есть подозрения что вы робот"
);
ETY
_error
(
"red"
,
"Есть подозрения что вы робот"
);
break
;
case
'10dataerror'
:
e_typos
_error
(
"red"
,
"Данные некорректны"
);
ETY
_error
(
"red"
,
"Данные некорректны"
);
break
;
case
'10siteerror'
:
e_typos
_error
(
"red"
,
"Данный сайт не поддерживается"
);
ETY
_error
(
"red"
,
"Данный сайт не поддерживается"
);
break
;
case
'10emailerror'
:
e_typos
_error
(
"red"
,
"Сервер не смог отправить письмо"
);
ETY
_error
(
"red"
,
"Сервер не смог отправить письмо"
);
break
;
case
'10win'
:
e_typos
_error
(
"green"
,
"Спасибо за ваше внимание"
);
window
.
setTimeout
(
'
e_typos
_close()'
,
2000
);
ETY
_error
(
"green"
,
"Спасибо за ваше внимание"
);
window
.
setTimeout
(
'
ETY
_close()'
,
2000
);
break
;
case
'10inserterror'
:
e_typos
_error
(
"red"
,
"Ошибка добавления данных"
);
ETY
_error
(
"red"
,
"Ошибка добавления данных"
);
break
;
case
'10servererror'
:
e_typos
_error
(
"red"
,
"На сервере произошла ошибка"
);
ETY
_error
(
"red"
,
"На сервере произошла ошибка"
);
break
;
default
:
e_typos
_error
(
"red"
,
"На сервере произошла ошибка"
);
ETY
_error
(
"red"
,
"На сервере произошла ошибка"
);
break
;
}
}
request
.
onerror
=
function
()
{
e_typos
_error
(
"red"
,
"Ошибка отправки данных. Повторите позже"
);
etersoft_typos
_time
=
0
;
ETY
_error
(
"red"
,
"Ошибка отправки данных. Повторите позже"
);
ETY
_time
=
0
;
}
request
.
send
();
}
function
e_typos_error
(
err
or
,
text
)
{
function
ETY_error
(
col
or
,
text
)
{
document
.
getElementById
(
"e_typos_error"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"e_typos_error"
).
innerHTML
=
text
;
document
.
getElementById
(
"e_typos_error"
).
style
.
color
=
error
;
document
.
getElementById
(
"e_typos_error"
).
style
.
color
=
color
;
document
.
getElementById
(
"e_typos_error"
).
style
.
borderColor
=
color
;
}
function
timer
()
{
var
sec
=
this_time
();
var
time_s
=
get_storage
(
"etersoft_typos/"
+
window
.
location
.
hostname
+
""
);
function
ETY_
timer
()
{
var
sec
=
ETY_
this_time
();
var
time_s
=
ETY_
get_storage
(
"etersoft_typos/"
+
window
.
location
.
hostname
+
""
);
if
(
time_s
!=
0
)
{
et
ersoft_typos
_time
=
time_s
;
et
y
_time
=
time_s
;
}
if
(
this_time
()
-
parseFloat
(
etersoft_typos
_time
)
<
60000
)
{
if
(
ETY_this_time
()
-
parseFloat
(
ety
_time
)
<
60000
)
{
return
0
;
}
else
{
return
1
;
}
}
function
this_time
()
{
function
ETY_
this_time
()
{
var
day
=
new
Date
();
var
sec
=
day
.
getTime
();
return
sec
;
}
function
get_storage
(
key
)
{
function
ETY_
get_storage
(
key
)
{
if
(
window
[
'localStorage'
]
!=
null
)
{
if
(
!
localStorage
.
getItem
(
key
+
""
))
{
return
0
;
...
...
@@ -166,7 +168,7 @@ function get_storage(key) {
}
}
function
set_storage
(
key
,
data
)
{
function
ETY_
set_storage
(
key
,
data
)
{
if
(
window
[
'localStorage'
]
!=
null
)
{
localStorage
.
setItem
(
key
+
""
,
data
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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