Skip to content

Commit

Permalink
Merge pull request #1902 from umple/issue1862
Browse files Browse the repository at this point in the history
Fixes #1862 Tip of the day close
  • Loading branch information
TimLethbridge committed Nov 22, 2021
2 parents 43ebc1a + 41a373a commit ff29122
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions umpleonline/scripts/tipDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function firstTipPopulate() {
var t=[];
t.push(allInfo[i].substring(0, allInfo[i].indexOf("</h2>")));
var link="https://cruise.umple.org/umple/"+htmlNames[files];
var navbar='<div style="padding-right: 10px; padding-left: 10px; display:flex; justify-content:space-between;"><button class="lowerBarBtn" id="goLeft" onclick="onButtonPrevious()">&laquo <em>Previous</em></button><a href="'+link+'" class="bottomNav"><em> View All </em></a><button class="lowerBarBtn" id="goRight" onclick="onButtonNext()"><em>Next</em> &raquo</button></div>';
var navbar='<div style="padding-right: 10px; padding-left: 10px; display:flex; justify-content:space-between;"><button class="lowerBarBtn" id="goLeft" onclick="onButtonPrevious()">&laquo <em>Previous</em></button><a href="'+link+'" class="bottomNav"><em> View All </em></a><button class="bottomNav" onclick="hideTip()"><em>X Close</em></button><button class="lowerBarBtn" id="goRight" onclick="onButtonNext()"><em>Next</em> &raquo</button></div>';
if (i==allInfo.length-1){
t.push(allInfo[i].substring(allInfo[i].indexOf("</h2>")+6, allInfo[i].length)+navbar);
}
Expand Down Expand Up @@ -61,7 +61,7 @@ function allocateMessage() { // put text into intended HTML sections
if (tip[loop]!=null){
if (tip[loop][num]!=null){
if (tip[loop][num][0]!=null && tip[loop][num][1]!=null){
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more<br/></span>';
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more</span> <span onclick="hideTip()" style=" cursor: pointer; color: blue; text-decoration: underline;">X Close<br/></span>';
jQuery('#styleTip a').attr('target', 'helppage');
document.getElementById('extraInfo').innerHTML = tip[loop][num][1];
jQuery('#extraInfo a').attr('target', 'helppage');
Expand Down Expand Up @@ -109,6 +109,15 @@ function hideExtra(){
document.getElementById('extraInfo').classList.add("fade-outInst");
}

function hideTip(){
clearTimeout(hideWithDelay);
document.getElementById('extraInfo').classList.remove("fade-in");
document.getElementById('extraInfo').classList.remove("fade-outInst");
jQuery('#extraInfo a').attr('target', 'helppage');
document.getElementById('styleTip').innerHTML = "";
jQuery('#styleTip a').attr('target', 'helppage');
}

function calculateDelay(){ // 5s + 1s/3words + 5s (iff link exists)
sectionHtml=document.getElementById('extraInfo').innerHTML;
sectionText=document.getElementById('extraInfo').textContent;
Expand Down Expand Up @@ -166,7 +175,7 @@ function setForNext(num, priority, tip, loop){
var t=[];
t.push(allInfo[i].substring(0, allInfo[i].indexOf("</h2>")));
var link="https://cruise.umple.org/umple/"+htmlNames[files];
var navbar='<div style="padding-right: 10px; padding-left: 10px; display:flex; justify-content:space-between;"><button class="lowerBarBtn" id="goLeft" onclick="onButtonPrevious()">&laquo <em>Previous</em></button><a href="'+link+'" class="bottomNav"><em> View All </em></a><button class="lowerBarBtn" id="goRight" onclick="onButtonNext()"><em>Next</em> &raquo</button></div>';
var navbar='<div style="padding-right: 10px; padding-left: 10px; display:flex; justify-content:space-between;"><button class="lowerBarBtn" id="goLeft" onclick="onButtonPrevious()">&laquo <em>Previous</em></button><a href="'+link+'" class="bottomNav"><em> View All </em></a><button class="bottomNav" onclick="hideTip()"><em>X Close</em></button><button class="lowerBarBtn" id="goRight" onclick="onButtonNext()"><em>Next</em> &raquo</button></div>';
if (i==allInfo.length-1){
t.push(allInfo[i].substring(allInfo[i].indexOf("</h2>")+6, allInfo[i].length)+navbar);
}
Expand Down Expand Up @@ -248,7 +257,7 @@ function showPrevious(){
}
window.localStorage.setItem('tipCount',num);

document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more<br/></span>';
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more</span> <span onclick="hideTip()" style=" cursor: pointer; color: blue; text-decoration: underline;">X Close<br/></span>';
jQuery('#styleTip a').attr('target', 'helppage');
document.getElementById('extraInfo').innerHTML = tip[loop][num][1];
jQuery('#extraInfo a').attr('target', 'helppage');
Expand All @@ -270,7 +279,7 @@ function showPrevious(){
}
window.localStorage.setItem('tipCount',num);

document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more<br/></span>';
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more</span> <span onclick="hideTip()" style=" cursor: pointer; color: blue; text-decoration: underline;">X Close<br/></span>';
jQuery('#styleTip a').attr('target', 'helppage');
document.getElementById('extraInfo').innerHTML = tip[loop][num][1];
jQuery('#extraInfo a').attr('target', 'helppage');
Expand All @@ -280,7 +289,7 @@ function showPrevious(){
}
else{
document.getElementById('extraInfo').style.visibility = 'hidden';
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num-2][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more<br/></span>';
document.getElementById('styleTip').innerHTML = "Tip: "+tip[loop][num-2][0] + ' <span onclick="showExtra()" style=" cursor: pointer; color: blue; text-decoration: underline;">Click for more</span> <span onclick="hideTip()" style=" cursor: pointer; color: blue; text-decoration: underline;">X Close<br/></span>';
jQuery('#styleTip a').attr('target', 'helppage');
document.getElementById('extraInfo').innerHTML = tip[loop][num-2][1];
jQuery('#extraInfo a').attr('target', 'helppage');
Expand Down

0 comments on commit ff29122

Please sign in to comment.