Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
441de0a5
Commit
441de0a5
authored
Dec 03, 2013
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js format
use strict;
parent
d41c6b0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
42 deletions
+30
-42
app/assets/javascripts/application.js
+30
-42
No files found.
app/assets/javascripts/application.js
View file @
441de0a5
...
...
@@ -20,84 +20,72 @@
// Automaticaly change textarea height.
$
(
document
).
ready
(
function
(){
$
(
function
(){
'use strict'
;
$
(
'textarea.autosize'
).
autosize
();
});
// Preview post.
$
(
document
).
ready
(
function
(){
// Preview post.
var
load_preview
=
function
(){
var
text
=
$
(
'#post_body'
).
val
();
var
csrfToken
=
$
(
'meta[name="csrf-token"]'
).
attr
(
'content'
);
var
csrfToken
=
$
(
"meta[name='csrf-token']"
).
attr
(
'content'
);
$
.
post
(
'/posts/preview.api'
,
{
"text"
:
text
,
"authenticity_token"
:
csrfToken
})
.
done
(
function
(
data
){
$
(
'#post_preview'
).
html
(
data
);
})
'text'
:
text
,
'authenticity_token'
:
csrfToken
})
.
done
(
function
(
data
){
$
(
'#post_preview'
).
html
(
data
);
});
};
$
(
'#post_body'
).
on
(
'keyup mouseup'
,
load_preview
);
load_preview
();
});
// post list
$
(
document
).
ready
(
function
(){
// post list
$
(
'.post-list'
).
on
(
'click'
,
function
(
e
){
e
.
preventDefault
();
$this
=
$
(
this
);
var
$this
=
$
(
this
);
$this
.
siblings
().
removeClass
(
'active'
);
$this
.
addClass
(
'active'
);
var
id
=
$this
.
data
(
'postId'
);
$
.
get
(
'/posts/show_fragment'
,
{
"id"
:
id
,
})
.
done
(
function
(
data
){
$
(
'#list_post'
).
html
(
data
);
})
})
});
'id'
:
id
,
})
.
done
(
function
(
data
){
$
(
'#list_post'
).
html
(
data
);
});
});
// search form
$
(
document
).
ready
(
function
(){
$
(
'#app-search-form input'
).
on
(
'focus'
,
function
(
e
){
// search form
$
(
'#app-search-form input'
).
on
(
'focus'
,
function
(){
$
(
this
).
parents
(
'#app-search-form'
).
animate
({
width
:
'600px'
});
}).
on
(
'blur'
,
function
(
e
){
}).
on
(
'blur'
,
function
(){
$
(
this
).
parents
(
'#app-search-form'
).
animate
({
width
:
'200px'
});
})
});
});
// disable tab key
$
(
document
).
ready
(
function
(){
// disable tab key
$
(
'.disable-tab'
).
on
(
'keydown'
,
function
(
e
)
{
var
keyCode
=
e
.
keyCode
||
e
.
which
;
if
(
keyCode
==
9
)
{
if
(
keyCode
==
=
9
)
{
e
.
preventDefault
();
var
start
=
$
(
this
).
get
(
0
).
selectionStart
;
var
end
=
$
(
this
).
get
(
0
).
selectionEnd
;
// set textarea value to: text before caret + tab + text after caret
$
(
this
).
val
(
$
(
this
).
val
().
substring
(
0
,
start
)
+
"
\
t"
+
$
(
this
).
val
().
substring
(
end
));
$
(
this
).
val
(
$
(
this
).
val
().
substring
(
0
,
start
)
+
'
\
t'
+
$
(
this
).
val
().
substring
(
end
));
// put caret at right position again
$
(
this
).
get
(
0
).
selectionStart
=
$
(
this
).
get
(
0
).
selectionEnd
=
start
+
1
;
}
});
});
// new post tags
$
(
document
).
ready
(
function
(){
$
(
"#post_tags"
).
select2
();
// new post tags
$
(
'#post_tags'
).
select2
();
});
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