Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cribjs-editor
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
cribjs-editor
Commits
4c24764f
Commit
4c24764f
authored
Sep 30, 2020
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editor and URL List Page now take advantage of getScope Function
parent
279cbb16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
gadget/gadget_cribjs_page_editor.js
gadget/gadget_cribjs_page_editor.js
+8
-3
gadget/gadget_cribjs_page_url_list.js
gadget/gadget_cribjs_page_url_list.js
+12
-5
No files found.
gadget/gadget_cribjs_page_editor.js
View file @
4c24764f
...
...
@@ -153,6 +153,7 @@
.
allowPublicAcquisition
(
"
notifyChange
"
,
function
()
{
return
;
})
.
declareAcquiredMethod
(
"
crib_sw_getScope
"
,
"
crib_sw_getScope
"
)
.
declareAcquiredMethod
(
"
crib_sw_get
"
,
"
crib_sw_get
"
)
.
declareAcquiredMethod
(
"
crib_sw_put
"
,
"
crib_sw_put
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
...
...
@@ -177,10 +178,14 @@
.
push
(
function
()
{
if
(
options
.
url
!==
undefined
)
{
gadget
.
props
.
element
.
querySelector
(
"
form.crib-editor-get .url
"
).
value
=
options
.
url
;
return
getUrlTextContent
(
gadget
,
undefined
,
options
.
url
);
return
RSVP
.
all
([
getUrlTextContent
(
gadget
,
undefined
,
options
.
url
),
gadget
.
crib_sw_getScope
()
]);
}
})
.
push
(
function
()
{
.
push
(
function
(
result_list
)
{
gadget
.
props
.
scope
=
result_list
[
1
];
return
gadget
.
props
.
start_deferred
.
resolve
();
});
})
...
...
@@ -201,7 +206,7 @@
var
url
=
gadget
.
props
.
element
.
querySelector
(
"
form.crib-editor-get .url
"
).
value
;
if
(
event
.
submitter
.
name
===
"
go
"
)
{
return
gadget
.
redirect
({
url
:
window
.
location
.
origin
+
window
.
location
.
pathnam
e
+
url
,
url
:
gadget
.
props
.
scop
e
+
url
,
newTab
:
true
});
}
...
...
gadget/gadget_cribjs_page_url_list.js
View file @
4c24764f
...
...
@@ -5,15 +5,21 @@
function
displayURLList
(
gadget
,
event
)
{
var
url_list
=
{},
pattern
=
gadget
.
props
.
element
.
querySelector
(
"
.search-pattern
"
).
value
;
pattern
=
gadget
.
props
.
element
.
querySelector
(
"
.search-pattern
"
).
value
,
scope
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
crib_sw_allDocs
();
return
RSVP
.
all
([
gadget
.
crib_sw_allDocs
(),
gadget
.
crib_sw_getScope
()
]);
})
.
push
(
function
(
data
)
{
var
promise_list
=
[],
.
push
(
function
(
result_list
)
{
var
data
=
result_list
[
0
],
promise_list
=
[],
tmp_url_list
=
[],
url
;
scope
=
result_list
[
1
];
if
(
data
.
hasOwnProperty
(
"
urls
"
))
{
tmp_url_list
=
data
.
urls
;
}
else
{
...
...
@@ -70,7 +76,7 @@
tdElement
=
document
.
createElement
(
'
td
'
);
element
=
document
.
createElement
(
'
a
'
);
element
.
textContent
=
"
Go
"
;
element
.
setAttribute
(
'
href
'
,
url
);
element
.
setAttribute
(
'
href
'
,
scope
+
url
);
element
.
setAttribute
(
'
target
'
,
"
_blank
"
);
element
.
setAttribute
(
"
class
"
,
"
btn btn-primary btn-xs
"
);
tdElement
.
appendChild
(
element
);
...
...
@@ -106,6 +112,7 @@
});
})
.
declareAcquiredMethod
(
"
crib_sw_allDocs
"
,
"
crib_sw_allDocs
"
)
.
declareAcquiredMethod
(
"
crib_sw_getScope
"
,
"
crib_sw_getScope
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
...
...
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