Add messaging when archived build logs loads fail.

This code also checks for an ad blocker, and adjusts the message accordingly.

Fixes #184
This commit is contained in:
Joseph Schorr 2015-06-28 09:14:48 +03:00
parent cea4ad2d85
commit 094c94c0fb
5 changed files with 245 additions and 8 deletions

View file

@ -4,6 +4,29 @@
angular.module('quay').factory('UtilService', ['$sanitize', function($sanitize) {
var utilService = {};
var adBlockEnabled = null;
utilService.isAdBlockEnabled = function(callback) {
if (adBlockEnabled !== null) {
callback(adBlockEnabled);
return;
}
if(typeof blockAdBlock === 'undefined') {
callback(true);
return;
}
var bab = new BlockAdBlock({
checkOnLoad: false,
resetOnEnd: true
});
bab.onDetected(function() { adBlockEnabled = true; callback(true); });
bab.onNotDetected(function() { adBlockEnabled = false; callback(false); });
bab.check();
};
utilService.isEmailAddress = function(val) {
var emailRegex = /^[a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
return emailRegex.test(val);