Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
fac4e3f2
Commit
fac4e3f2
authored
Nov 22, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat notes JS
parent
d9b15fc1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
177 additions
and
189 deletions
+177
-189
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+177
-189
No files found.
app/assets/javascripts/notes.js
View file @
fac4e3f2
...
...
@@ -9,8 +9,7 @@ var NoteList = {
loading_more_disabled
:
false
,
reversed
:
false
,
init
:
function
(
tid
,
tt
,
path
)
{
init
:
function
(
tid
,
tt
,
path
)
{
this
.
notes_path
=
path
+
"
.js
"
;
this
.
target_id
=
tid
;
this
.
target_type
=
tt
;
...
...
@@ -232,8 +231,7 @@ var NoteList = {
/**
* Gets an inital set of notes.
*/
getContent
:
function
()
{
getContent
:
function
()
{
$
.
ajax
({
url
:
this
.
notes_path
,
data
:
this
.
target_params
,
...
...
@@ -247,8 +245,7 @@ var NoteList = {
* Called in response to getContent().
* Replaces the content of #notes-list with the given html.
*/
setContent
:
function
(
newNoteIds
,
html
)
{
setContent
:
function
(
newNoteIds
,
html
)
{
this
.
top_id
=
newNoteIds
.
first
();
this
.
bottom_id
=
newNoteIds
.
last
();
$
(
"
#notes-list
"
).
html
(
html
);
...
...
@@ -274,8 +271,7 @@ var NoteList = {
/**
* Initializes loading more notes when scrolling to the bottom of the page.
*/
initLoadMore
:
function
()
{
initLoadMore
:
function
()
{
$
(
document
).
endlessScroll
({
bottomPixels
:
400
,
fireDelay
:
1000
,
...
...
@@ -292,8 +288,7 @@ var NoteList = {
/**
* Gets an additional set of notes.
*/
getMore
:
function
()
{
getMore
:
function
()
{
// only load more notes if there are no "new" notes
$
(
'
.loading
'
).
show
();
$
.
ajax
({
...
...
@@ -309,8 +304,7 @@ var NoteList = {
* Called in response to getMore().
* Append notes to #notes-list.
*/
appendMoreNotes
:
function
(
newNoteIds
,
html
)
{
appendMoreNotes
:
function
(
newNoteIds
,
html
)
{
var
lastNewNoteId
=
newNoteIds
.
last
();
if
(
lastNewNoteId
!=
this
.
bottom_id
)
{
this
.
bottom_id
=
lastNewNoteId
;
...
...
@@ -323,8 +317,7 @@ var NoteList = {
* Disables loading more notes when scrolling to the bottom of the page.
* Initalizes refreshing new notes.
*/
finishedLoadingMore
:
function
()
{
finishedLoadingMore
:
function
()
{
this
.
loading_more_disabled
=
true
;
// from now on only get new notes
...
...
@@ -348,16 +341,14 @@ var NoteList = {
/**
* Initializes getting new notes every n seconds.
*/
initRefreshNew
:
function
()
{
initRefreshNew
:
function
()
{
setInterval
(
"
NoteList.getNew()
"
,
10000
);
},
/**
* Gets the new set of notes.
*/
getNew
:
function
()
{
getNew
:
function
()
{
$
.
ajax
({
url
:
this
.
notes_path
,
data
:
this
.
target_params
+
"
&loading_new=1&after_id=
"
+
(
this
.
reversed
?
this
.
top_id
:
this
.
bottom_id
),
...
...
@@ -369,8 +360,7 @@ var NoteList = {
* Called in response to getNew().
* Replaces the content of #new-notes-list with the given html.
*/
replaceNewNotes
:
function
(
newNoteIds
,
html
)
{
replaceNewNotes
:
function
(
newNoteIds
,
html
)
{
$
(
"
#new-notes-list
"
).
html
(
html
);
this
.
updateVotes
();
},
...
...
@@ -378,8 +368,7 @@ var NoteList = {
/**
* Adds a single note to #new-notes-list.
*/
appendNewNote
:
function
(
id
,
html
)
{
appendNewNote
:
function
(
id
,
html
)
{
if
(
this
.
reversed
)
{
$
(
"
#notes-list
"
).
prepend
(
html
);
}
else
{
...
...
@@ -396,10 +385,9 @@ var NoteList = {
* Might produce inaccurate results when not all notes have been loaded and a
* recalculation is triggered (e.g. when deleting a note).
*/
updateVotes
:
function
()
{
updateVotes
:
function
()
{
var
votes
=
$
(
"
#votes .votes
"
);
var
notes
=
$
(
"
#notes-list, #new-
notes-list
"
).
find
(
"
.note .vote
"
);
var
notes
=
$
(
"
#
notes-list
"
).
find
(
"
.note .vote
"
);
// only update if there is a vote display
if
(
votes
.
size
())
{
...
...
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