Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #1862 Tip of the day close #1902

Merged
merged 2 commits into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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