Skip to content

Commit

Permalink
patches for embed
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarciabriseno committed Feb 26, 2024
1 parent 539fcc4 commit 54131fb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
9 changes: 8 additions & 1 deletion resources/js/HelioviewerClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ var HelioviewerClient = Class.extend(
* @description Checks browser support for various features used in Helioviewer
*/
_checkBrowser: function () {
let localStorageSupport = true;
try {
localStorageSupport = ('localStorage' in window) && window['localStorage'] !== null;
} catch (e) {
localStorageSupport = false;
}

// Base support
$.extend($.support, {
"localStorage" : ('localStorage' in window) && window['localStorage'] !== null,
"localStorage" : localStorageSupport,
"nativeJSON" : typeof (JSON) !== "undefined",
"video" : !!document.createElement('video').canPlayType,
"h264" : false,
Expand Down
31 changes: 23 additions & 8 deletions resources/js/UI/ImageScale.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,24 @@ var ImageScale = Class.extend(
Helioviewer.userSettings.get("state.containerY") <= ( $('#hv-header').height() || 0 ) ||
Helioviewer.userSettings.get("state.containerY") >= this.container.parent().height()-this.container.height()
) {
this.containerX = this.container.parent().width()*0.66 - this.container.width()/2; //center the earth container
this.containerY = $('#earth-button').position().top + $('#scale').position().top + this.container.height();
this.container.css({
'position' : 'absolute',
'top' : this.containerY+'px',
'left' : this.containerX+'px'
});
if (outputType == 'embed') {
this.containerX = 15;
this.containerY = this.container.parent().height() - this.container.height() - 15;
this.container.css({
'position' : 'absolute',
'top' : this.containerY+'px',
'left' : this.containerX+'px'
});
} else {
this.containerX = this.container.parent().width()*0.66 - this.container.width()/2; //center the earth container
this.containerY = $('#earth-button').position().top + $('#scale').position().top + this.container.height();
this.container.css({
'position' : 'absolute',
'top' : this.containerY+'px',
'left' : this.containerX+'px'
});
}

}
}else{// minimal helioviewer
var dm = $('#date-manager-container');
Expand Down Expand Up @@ -319,12 +330,16 @@ var ImageScale = Class.extend(

switch(outputType) {
case "minimal":
case "embed":
var sc = $('#scale');
this.containerX = sc.position().left + (sc.outerWidth()/2) - this.container.width()/2; //center the earth container
this.containerY = sc.position().top - this.container.height() - 3;
this.scale = true;
break;
case "embed":
this.scale = false;
this.containerX = 15;
this.containerY = this.container.parent().height() - this.container.height() - 15;
break;
default:
this.containerX = this.container.parent().width()*0.66 - this.container.width()/2; //center the earth container
this.containerY = $('#earth-button').position().top + $('#scale').position().top + this.container.height();
Expand Down

0 comments on commit 54131fb

Please sign in to comment.