Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,711
Issues
1,711
List
Boards
Labels
Service Desk
Milestones
Merge Requests
86
Merge Requests
86
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
7f137333
Commit
7f137333
authored
Jul 15, 2019
by
Mikaël Salson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
browser/js: Refactoring of sendTo buttons
We use a common function to create them to avoir code duplication.
parent
bb72c63b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
49 deletions
+47
-49
browser/js/crossDomain.js
browser/js/crossDomain.js
+27
-0
browser/js/segmenter.js
browser/js/segmenter.js
+20
-49
No files found.
browser/js/crossDomain.js
View file @
7f137333
...
...
@@ -418,3 +418,30 @@ function blastPost(species, data, system) {
form
.
submit
();
}
/**
* Creates and returns a sendTo button (in a span)
* @param {id}: id of the span
* @param {name}: name of the sendTo function ({name}Post) [useless if
* {onclick} is provided
* @param {label}: Label of the button
* @param {title}: Title when hovering the button
* @param {onclick}: (optional) Function to be called when clicking the button.
* By default will call {name}Post()
*
*/
function
createSendToButton
(
id
,
name
,
label
,
title
,
segmenter
,
onclick
)
{
var
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
id
;
span
.
setAttribute
(
'
title
'
,
'
title
'
)
span
.
className
=
"
button
"
;
if
(
typeof
onclick
!==
"
undefined
"
)
{
span
.
onclick
=
onclick
;
}
else
{
span
.
onclick
=
function
()
{
segmenter
.
sendTo
(
name
);
};
}
span
.
appendChild
(
document
.
createTextNode
(
label
));
return
span
;
}
browser/js/segmenter.js
View file @
7f137333
...
...
@@ -187,70 +187,41 @@ Segment.prototype = {
div_menu
.
appendChild
(
span
)
//toIMGT button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toIMGT
"
span
.
setAttribute
(
'
title
'
,
'
Send sequences to IMGT/V-QUEST and see the results in a new tab
'
)
span
.
className
=
"
button
"
span
.
onclick
=
function
()
{
self
.
sendTo
(
'
imgt
'
)
}
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to IMGT/V-QUEST
"
));
span
=
createSendToButton
(
"
toIMGT
"
,
'
imgt
'
,
"
❯ to IMGT/V-QUEST
"
,
'
Send sequences to IMGT/V-QUEST and see the results in a new tab
'
,
this
);
div_menu
.
appendChild
(
span
)
//toIMGTSeg button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toIMGTSeg
"
;
span
.
setAttribute
(
'
title
'
,
'
Send sequences to IMGT/V-QUEST and loads the results in the sequence panel
'
)
span
.
className
=
"
button button_next
"
;
span
.
onclick
=
function
()
{
self
.
sendTo
(
'
IMGTSeg
'
)
};
span
.
appendChild
(
document
.
createTextNode
(
"
▼
"
));
span
=
createSendToButton
(
"
toIMGTSeg
"
,
"
IMGTSeg
"
,
"
▼
"
,
'
Send sequences to IMGT/V-QUEST and loads the results in the sequence panel
'
,
this
);
span
.
className
+=
"
button_next
"
;
div_menu
.
appendChild
(
span
);
//toIgBlast button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toIgBlast
"
;
span
.
setAttribute
(
'
title
'
,
'
Send sequences to NCBI IgBlast and see the results in a new tab
'
)
span
.
className
=
"
button
"
;
span
.
onclick
=
function
()
{
self
.
sendTo
(
'
igBlast
'
)
};
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to IgBlast
"
));
span
=
createSendToButton
(
"
toIgBlast
"
,
'
igBlast
'
,
"
❯ to IgBlast
"
,
'
Send sequences to NCBI IgBlast and see the results in a new tab
'
,
this
);
div_menu
.
appendChild
(
span
);
//toARResT button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toARResT
"
;
span
.
setAttribute
(
'
title
'
,
'
Send sequences to ARResT/CompileJunctions and see the results in a new tab
'
)
span
.
className
=
"
button devel-mode
"
;
span
.
onclick
=
function
()
{
self
.
sendTo
(
'
arrest
'
)
};
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to ARResT/CJ
"
));
span
=
createSendToButton
(
"
toARResT
"
,
"
arrest
"
,
"
❯ to ARResT/CJ
"
,
'
Send sequences to ARResT/CompileJunctions and see the results in a new tab
'
,
this
);
span
.
className
+=
"
devel-mode
"
;
div_menu
.
appendChild
(
span
);
//toCloneDB button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toCloneDB
"
;
span
.
setAttribute
(
'
title
'
,
'
Send sequences to EC-NGS/CloneDB in the background
'
)
span
.
className
=
"
button
"
;
span
.
className
+=
(
typeof
config
!==
'
undefined
'
&&
config
.
clonedb
)
?
""
:
"
devel-mode
"
;
span
.
onclick
=
function
()
{
self
.
db
.
callCloneDB
(
self
.
m
.
getSelected
());
};
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to CloneDB
"
));
span
=
createSendToButton
(
'
toCloneDB
'
,
''
,
"
❯ to CloneDB
"
,
'
Send sequences to EC-NGS/CloneDB in the background
'
,
this
,
function
()
{
self
.
db
.
callCloneDB
(
self
.
m
.
getSelected
());
});
span
.
className
+=
(
typeof
config
!==
'
undefined
'
&&
config
.
clonedb
)
?
""
:
"
devel-mode
"
;
div_menu
.
appendChild
(
span
);
//toBlast button
span
=
document
.
createElement
(
'
span
'
);
span
.
id
=
"
toBlast
"
;
span
.
setAttribute
(
'
title
'
,
'
Send sequences to Ensembl Blast and see the results in a new tab
'
)
span
.
className
=
"
button
"
;
span
.
onclick
=
function
()
{
self
.
sendTo
(
'
blast
'
);
};
span
.
appendChild
(
document
.
createTextNode
(
"
❯ to Blast
"
));
span
=
createSendToButton
(
"
toBlast
"
,
"
blast
"
,
"
❯ to Blast
"
,
'
Send sequences to Ensembl Blast and see the results in a new tab
'
,
this
);
div_menu
.
appendChild
(
span
);
//toClipBoard button
...
...
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