FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
documentcloud/public/javascripts/model/notes.js at content-types · documentcloud/documentcloud · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Mar 11, 2021. It is now read-only.
documentcloud
/
documentcloud
Public archive
Notifications
You must be signed in to change notification settings
Fork
157
Star
425
Code
Issues
194
Pull requests
16
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
documentcloud
/
public
/
javascripts
/
model
/
notes.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (46 loc) · 1.47 KB
Breadcrumbs
documentcloud
/
public
/
javascripts
/
model
/
notes.js
Copy path
File metadata and controls
59 lines (46 loc) · 1.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Note Model
dc
.
model
.
Note
=
Backbone
.
Model
.
extend
(
{
document
:
function
(
)
{
return
this
.
_document
=
this
.
_document
||
Documents
.
get
(
this
.
get
(
'document_id'
)
)
;
}
,
checkAllowedToEdit
:
function
(
)
{
if
(
!
dc
.
account
)
return
false
;
if
(
this
.
document
(
)
.
viewerEditable
)
return
true
;
return
Accounts
.
current
(
)
.
allowedToEdit
(
this
)
;
}
,
resourceUrl
:
function
(
opts
)
{
var
options
=
opts
||
{
}
;
var
url
=
this
.
get
(
'resource_url'
)
;
if
(
options
.
agnostic
)
{
url
=
url
.
replace
(
/
^
\S
+
:
/
,
''
)
;
}
return
url
;
}
,
imageUrl
:
function
(
)
{
return
this
.
_imageUrl
=
this
.
_imageUrl
||
this
.
document
(
)
.
get
(
'page_image_url'
)
.
replace
(
'{size}'
,
'normal'
)
.
replace
(
'{page}'
,
this
.
get
(
'page'
)
)
;
}
,
coordinates
:
function
(
)
{
if
(
this
.
_coordinates
)
return
this
.
_coordinates
;
var
loc
=
this
.
get
(
'location'
)
;
if
(
!
loc
)
return
null
;
var
css
=
_
.
map
(
loc
.
image
.
split
(
','
)
,
function
(
num
)
{
return
parseInt
(
num
,
10
)
;
}
)
;
return
this
.
_coordinates
=
{
top
:
css
[
0
]
,
left
:
css
[
3
]
,
right
:
css
[
1
]
,
height
:
css
[
2
]
-
css
[
0
]
,
width
:
css
[
1
]
-
css
[
3
]
}
;
}
}
)
;
// Note Set
dc
.
model
.
NoteSet
=
Backbone
.
Collection
.
extend
(
{
model
:
dc
.
model
.
Note
,
url
:
'/notes'
,
comparator
:
function
(
note
)
{
var
coords
=
note
.
coordinates
(
)
;
return
note
.
get
(
'page'
)
*
10000
+
(
coords
?
coords
.
top
:
0
)
;
}
,
unrestricted
:
function
(
)
{
return
this
.
filter
(
function
(
note
)
{
return
note
.
get
(
'access'
)
!=
'private'
;
}
)
;
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL