add license infrastructure

This commit is contained in:
rolux 2015-04-17 16:42:52 +01:00
commit baaae8ac5c
3 changed files with 49 additions and 1 deletions

View file

@ -1954,6 +1954,10 @@ pandora.isEmbedURL = function(url) {
return /^#embed(\?.*?)?$/.test(hash);
};
pandora.isLicensed = function() {
return pandora.site.license && pandora.site.license < +new Date();
};
pandora.isPrintURL = function(url) {
url = url || document.location.href;
var hash = Ox.parseURL(url).hash;
@ -2015,6 +2019,22 @@ pandora.logEvent = function(data, event, element) {
}
};
pandora.openLicenseDialog = function() {
if (!pandora.hasDialogOrScreen()) {
pandora.ui.licenseDialog().open().bindEvent({
close: function() {
setTimeout(function() {
!pandora.isLicensed() && pandora.openLicenseDialog();
}, 900000); // 15 minutes
}
});
} else {
setTimeout(function() {
!pandora.isLicensed() && pandora.openLicenseDialog();
}, 60000); // 1 minute
}
};
pandora.openLink = function(url) {
if (Ox.startsWith(url, 'mailto:')) {
window.open(url);