Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Caillat Michel
yafits
Commits
a5b89170
Commit
a5b89170
authored
Nov 26, 2019
by
Caillat Michel
Browse files
Material related to SAMP publishing. Publisher + Menu button
parent
4c670d06
Changes
1
Hide whitespace changes
Inline
Side-by-side
yafitsv/views/olqv_samp_publisher.ejs
0 → 100644
View file @
a5b89170
<script>
var SAMPPublisher = function ( FITSHeader, connector) {
console.log("SAMPPublisher ctor: entering");
var _FITSHeader = FITSHeader;
var _connector = connector;
var _relSlicePNGPath = "";
_isPublishable = function () {
console.log("function ( _isPublishable = function () { entering");
console.log("function ( _isPublishable = function () { exiting");
return (_FITSHeader["CTYPE3"] === "FREQ" || _FITSHeader["CTYPE3"] === "VRAD") && _FITSHeader["NAXIS3"]>1;
}
this.sendPNGSlice = function() {
//_connector.runWithConnection(_sendPNGSlice);
console.log("SAMPPublisher.sendPNGSlice: entering");
var baseUrl = window.location.origin;
var pngUrl = "<%=urlRoot%>/"+_relSlicePNGPath;
console.log("About to send this message 'load "+pngUrl+"' to the HUB" );
var msg = new samp.Message("script.aladin.send", {"script": "load "+pngUrl});
_connector.connection.notifyAll([msg]);
console.log("SAMPPublisher.sendPNGSlice: exiting");
}
this.setSliceRelPNGPath = function(relSlicePNGPath) {
console.log("SAMPPublisher.setSliceRelPNGPath: entering");
_relSlicePNGPath = relSlicePNGPath;
console.log("Slice relative PNG path set to '"+_relSlicePNGPath+"'");
console.log("SAMPPublisher.setSliceRelPNGPath: exiting");
};
console.log("SAMPPublisher ctor: exiting");
}
class PublishSAMP {
constructor(sAMPPublisher) {
this.publisher = sAMPPublisher;
this.button = document.createElement("button");
this.button.setAttribute("type","button");
this.button.setAttribute("class", "btn btn-primary btn-sm");
this.button.setAttribute("data-tooltip", "tooltip");
this.button.setAttribute("title", "Publish image via a SAMP hub");
let x = document.createElement("span");
x.setAttribute("class", "fas fa-location-arrow");
this.button.appendChild(x);
$(this.button).on("click", function(event) {sAMPPublisher.sendPNGSlice()});
}
getButton() {
return this.button;
}
}
</script>
Write
Preview
Supports
Markdown
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