style(legacy): format (#2039)
This commit is contained in:
parent
7082c9693d
commit
1550d44ac5
122 changed files with 18369 additions and 15819 deletions
|
@ -2,149 +2,165 @@
|
|||
* Get the tooltip message to be displayed
|
||||
*/
|
||||
function getContent() {
|
||||
var link = getLatestLink();
|
||||
var hasPatch = getHasPatch();
|
||||
var hasMinor = getHasMinor();
|
||||
var hasMajor = getHasMajor();
|
||||
var hasMultiMajor = getHasMultiMajor();
|
||||
var isPreRelease = getIsPreRelease();
|
||||
var link = getLatestLink();
|
||||
var hasPatch = getHasPatch();
|
||||
var hasMinor = getHasMinor();
|
||||
var hasMajor = getHasMajor();
|
||||
var hasMultiMajor = getHasMultiMajor();
|
||||
var isPreRelease = getIsPreRelease();
|
||||
|
||||
var msg = "";
|
||||
// See file legacy/application/views/helpers/VersionNotify.php for more info
|
||||
if(isUpToDate()) {
|
||||
msg = $.i18n._("You are running the latest version");
|
||||
} else {
|
||||
msg = $.i18n._("New version available: ") + link + '<ul>';
|
||||
if (isPreRelease) {
|
||||
msg += '<li>'+$.i18n._("You have a pre-release version of LibreTime intalled.");
|
||||
}
|
||||
if (hasPatch) {
|
||||
msg += '<li>'+$.i18n._("A patch update for your LibreTime installation is available.");
|
||||
}
|
||||
if (hasMinor) {
|
||||
msg += '<li>'+$.i18n._("A feature update for your LibreTime installation is available.");
|
||||
}
|
||||
if (hasMajor && !hasMultiMajor) {
|
||||
msg += '<li>'+$.i18n._("A major update for your LibreTime installation is available.");
|
||||
}
|
||||
if (hasMultiMajor) {
|
||||
msg += '<li>'+$.i18n._("Multiple major updates for LibreTime installation are available. Please upgrade as soon as possible.");
|
||||
}
|
||||
msg += '</ul>';
|
||||
var msg = "";
|
||||
// See file legacy/application/views/helpers/VersionNotify.php for more info
|
||||
if (isUpToDate()) {
|
||||
msg = $.i18n._("You are running the latest version");
|
||||
} else {
|
||||
msg = $.i18n._("New version available: ") + link + "<ul>";
|
||||
if (isPreRelease) {
|
||||
msg +=
|
||||
"<li>" +
|
||||
$.i18n._("You have a pre-release version of LibreTime intalled.");
|
||||
}
|
||||
if (hasPatch) {
|
||||
msg +=
|
||||
"<li>" +
|
||||
$.i18n._(
|
||||
"A patch update for your LibreTime installation is available."
|
||||
);
|
||||
}
|
||||
if (hasMinor) {
|
||||
msg +=
|
||||
"<li>" +
|
||||
$.i18n._(
|
||||
"A feature update for your LibreTime installation is available."
|
||||
);
|
||||
}
|
||||
if (hasMajor && !hasMultiMajor) {
|
||||
msg +=
|
||||
"<li>" +
|
||||
$.i18n._(
|
||||
"A major update for your LibreTime installation is available."
|
||||
);
|
||||
}
|
||||
if (hasMultiMajor) {
|
||||
msg +=
|
||||
"<li>" +
|
||||
$.i18n._(
|
||||
"Multiple major updates for LibreTime installation are available. Please upgrade as soon as possible."
|
||||
);
|
||||
}
|
||||
msg += "</ul>";
|
||||
}
|
||||
|
||||
return msg;
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if patch is available
|
||||
*/
|
||||
function getHasPatch() {
|
||||
return versionNotifyInfo.hasPatch;
|
||||
|
||||
return versionNotifyInfo.hasPatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if minor update is available
|
||||
*/
|
||||
function getHasMinor() {
|
||||
return versionNotifyInfo.hasMinor;
|
||||
return versionNotifyInfo.hasMinor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if major update is available
|
||||
*/
|
||||
function getHasMajor() {
|
||||
return versionNotifyInfo.hasMajor;
|
||||
return versionNotifyInfo.hasMajor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if multiple major updates are available
|
||||
*/
|
||||
function getHasMultiMajor() {
|
||||
return versionNotifyInfo.hasMultiMajor;
|
||||
return versionNotifyInfo.hasMultiMajor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if pre-release was installed
|
||||
*/
|
||||
function getIsPreRelease() {
|
||||
return versionNotifyInfo.isPreRelease;
|
||||
return versionNotifyInfo.isPreRelease;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the current version
|
||||
*/
|
||||
function getCurrentVersion() {
|
||||
return versionNotifyInfo.current;
|
||||
return versionNotifyInfo.current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest version
|
||||
*/
|
||||
function getLatestVersion() {
|
||||
return versionNotifyInfo.latest;
|
||||
return versionNotifyInfo.latest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the download link to latest release in HTML
|
||||
*/
|
||||
function getLatestLink() {
|
||||
return "<a href='' onclick='openLatestLink();'>" + getLatestVersion() + "</a>";
|
||||
return (
|
||||
"<a href='' onclick='openLatestLink();'>" + getLatestVersion() + "</a>"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if current version is up to date
|
||||
*/
|
||||
function isUpToDate() {
|
||||
return !getHasPatch() && !getHasMinor() && !getHasMajor();
|
||||
return !getHasPatch() && !getHasMinor() && !getHasMajor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the link in a new window
|
||||
*/
|
||||
function openLatestLink() {
|
||||
window.open(versionNotifyInfo.link);
|
||||
window.open(versionNotifyInfo.link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the tooltip for version notification
|
||||
*/
|
||||
function setupVersionQtip(){
|
||||
var qtipElem = $('#version-icon');
|
||||
if (qtipElem.length > 0){
|
||||
qtipElem.qtip({
|
||||
id: 'version',
|
||||
content: {
|
||||
text: getContent(),
|
||||
title: {
|
||||
text: getCurrentVersion(),
|
||||
button: isUpToDate() ? false : true
|
||||
}
|
||||
},
|
||||
hide: {
|
||||
event: isUpToDate() ? 'mouseleave' : 'unfocus'
|
||||
},
|
||||
position: {
|
||||
my: "top right",
|
||||
at: "bottom left"
|
||||
},
|
||||
style: {
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 4
|
||||
},
|
||||
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||
}
|
||||
});
|
||||
}
|
||||
function setupVersionQtip() {
|
||||
var qtipElem = $("#version-icon");
|
||||
if (qtipElem.length > 0) {
|
||||
qtipElem.qtip({
|
||||
id: "version",
|
||||
content: {
|
||||
text: getContent(),
|
||||
title: {
|
||||
text: getCurrentVersion(),
|
||||
button: isUpToDate() ? false : true,
|
||||
},
|
||||
},
|
||||
hide: {
|
||||
event: isUpToDate() ? "mouseleave" : "unfocus",
|
||||
},
|
||||
position: {
|
||||
my: "top right",
|
||||
at: "bottom left",
|
||||
},
|
||||
style: {
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 4,
|
||||
},
|
||||
classes: "ui-tooltip-dark ui-tooltip-rounded",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if($('#version-icon').length > 0) {
|
||||
setupVersionQtip();
|
||||
}
|
||||
$(document).ready(function () {
|
||||
if ($("#version-icon").length > 0) {
|
||||
setupVersionQtip();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue