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

Increase Firefox supported version to 22.0 #1085

Merged
merged 1 commit into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
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
45 changes: 4 additions & 41 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<script type="text/javascript" src="scripts/codechecker-api/codeCheckerProductService.js"></script>

<script type="text/javascript" src="scripts/version.js"></script>
<script type="text/javascript" src="scripts/browsersupport.js"></script>

<!-- Configure Dojo -->

Expand All @@ -67,52 +68,14 @@
</head>
<body class="claro">
<script>
// http://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser
var browserVersion = (function(){
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];

if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
}

if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}

M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
return M.join(' ');
})();

var pos = browserVersion.indexOf(' ');
var browser = browserVersion.substr(0, pos);
var version = parseInt(browserVersion.substr(pos + 1));

var browserCompatible
= browser === 'Firefox'
? version >= 4
: browser === 'IE'
? version >= 9
: true;

if (browserCompatible) {
if (!browserCompatible)
setNonCompatibleBrowserMessage();
else
require([
'codechecker/codecheckerviewer'],
function (codecheckerviewer) {
codecheckerviewer();
});
} else {
document.body.innerHTML =
'<h2 style="margin-left: 20px;">Your browser is not compatible with CodeChecker Viewer!</h2> \
<p style="margin-left: 20px;">The version required for the following browsers are:</p> \
<ul style="margin-left: 20px;"> \
<li>Internet Explorer: version 9 or newer</li> \
<li>Firefox: version 4 or newer</li> \
</ul>';
}
</script>
</body>
</html>
45 changes: 4 additions & 41 deletions www/products.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<script type="text/javascript" src="scripts/codechecker-api/codeCheckerAuthentication.js"></script>

<script type="text/javascript" src="scripts/version.js"></script>
<script type="text/javascript" src="scripts/browsersupport.js"></script>

<!-- Configure Dojo -->

Expand All @@ -54,52 +55,14 @@
</head>
<body class="claro">
<script>
// http://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser
var browserVersion = (function(){
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];

if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
}

if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}

M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
return M.join(' ');
})();

var pos = browserVersion.indexOf(' ');
var browser = browserVersion.substr(0, pos);
var version = parseInt(browserVersion.substr(pos + 1));

var browserCompatible
= browser === 'Firefox'
? version >= 4
: browser === 'IE'
? version >= 9
: true;

if (browserCompatible) {
if (!browserCompatible)
setNonCompatibleBrowserMessage();
else
require([
'products/productlist'],
function (productlist) {
productlist();
});
} else {
document.body.innerHTML =
'<h2 style="margin-left: 20px;">Your browser is not compatible with CodeChecker Viewer!</h2> \
<p style="margin-left: 20px;">The version required for the following browsers are:</p> \
<ul style="margin-left: 20px;"> \
<li>Internet Explorer: version 9 or newer</li> \
<li>Firefox: version 4 or newer</li> \
</ul>';
}
</script>
</body>
</html>
40 changes: 40 additions & 0 deletions www/scripts/browsersupport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function setNonCompatibleBrowserMessage() {
document.body.innerHTML =
'<h2 style="margin-left: 20px;">Your browser is not compatible with CodeChecker Viewer!</h2> \
<p style="margin-left: 20px;">The version required for the following browsers are:</p> \
<ul style="margin-left: 20px;"> \
<li>Internet Explorer: version 9 or newer</li> \
<li>Firefox: version 22.0 or newer</li> \
</ul>';
}

// http://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser
var browserVersion = (function(){
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];

if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
}

if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}

M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
return M.join(' ');
})();

var pos = browserVersion.indexOf(' ');
var browser = browserVersion.substr(0, pos);
var version = parseInt(browserVersion.substr(pos + 1));

var browserCompatible
= browser === 'Firefox'
? version >= 22
: browser === 'IE'
? version >= 9
: true;
41 changes: 29 additions & 12 deletions www/scripts/codecheckerviewer/BugFilterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
* will be the filter class name and the value will be the selected item
* values. If no filter item is selected the value will be null.
*/
getState : function () { return { [this.class] : null }; },
getState : function () {
var state = {};
state[this.class] = null;

return state;
},

/**
* Set filter state from the parameter state object.
Expand Down Expand Up @@ -452,7 +457,9 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
return isNaN(key) ? key : parseFloat(key);
});

return { [this.class] : state.length ? state : null };
var ret = {};
ret[this.class] = state.length ? state : null;
return ret;
},

/**
Expand Down Expand Up @@ -906,15 +913,15 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
},

getUrlState : function () {
return {
[this.class] : this._isUnique ? 'on' : 'off'
};
var state = {};
state[this.class] = this._isUnique ? 'on' : 'off';
return state;
},

getState : function () {
return {
[this.class] : this._isUnique
};
var state = {};
state[this.class] = this._isUnique;
return state;
},

clearAll : function () {
Expand Down Expand Up @@ -1096,7 +1103,9 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
title : 'Diff type',
parent : this,
defaultValues : function () {
return { [this.class] : [CC_OBJECTS.DiffType.NEW] };
var state = {};
state[this.class] = [CC_OBJECTS.DiffType.NEW];
return state;
},
disableMultipleOption : true,

Expand All @@ -1118,7 +1127,9 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,

CC_SERVICE.getRunResultCount(runIds, reportFilter, cmpData,
function (res) {
d.resolve({ [key] : res});
var state = {};
state[key] = res;
d.resolve(state);
});

return d.promise;
Expand Down Expand Up @@ -1552,7 +1563,10 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
var state = {};

this._filters.forEach(function (filter) {
Object.assign(state, filter.getState());
var filterState = filter.getState();
Object.keys(filterState).forEach(function(key) {
state[key] = filterState[key];
});
});

return state;
Expand All @@ -1565,7 +1579,10 @@ function (declare, Deferred, dom, domClass, all, topic, Standby, Button,
var state = {};

this._filters.forEach(function (filter) {
Object.assign(state, filter.getUrlState());
var urlState = filter.getUrlState();
Object.keys(urlState).forEach(function(key) {
state[key] = urlState[key];
});

//--- Load default values for the first time ---//

Expand Down
2 changes: 1 addition & 1 deletion www/scripts/codecheckerviewer/CommentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function (declare, dom, style, topic, Memory, Observable, ConfirmDialog,

dom.create('span', { class : 'author', innerHTML: this.author }, vb);

var time = util.timeAgo(new Date(this.time));
var time = util.timeAgo(new Date(this.time.replace(/ /g,'T')));
dom.create('span', { class : 'time', innerHTML: time }, vb);

//--- Comment operations (edit, remove) ---//
Expand Down
4 changes: 2 additions & 2 deletions www/scripts/codecheckerviewer/RunHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function (declare, dom, topic, ContentPane, util) {

var historyGroupByDate = {};
historyData.forEach(function (data) {
var date = new Date(data.time);
var date = new Date(data.time.replace(/ /g,'T'));
var groupDate = date.getDate() + ' '
+ util.getMonthName(date.getMonth()) + ', '
+ date.getFullYear();
Expand All @@ -52,7 +52,7 @@ function (declare, dom, topic, ContentPane, util) {
var content = dom.create('div', { class : 'content' }, group);

historyGroupByDate[key].forEach(function (data) {
var date = new Date(data.time);
var date = new Date(data.time.replace(/ /g,'T'));
var time = util.formatDateAMPM(date);

var history = dom.create('div', {
Expand Down
5 changes: 4 additions & 1 deletion www/scripts/codecheckerviewer/hashHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ function (hash, ioQuery, topic, util) {
* @see setStateValues
*/
setStateValue : function (key, value, preventUpdateUrl) {
this.setStateValues({ [key] : value }, preventUpdateUrl);
var state = {};
state[key] = value;

this.setStateValues(state, preventUpdateUrl);
}
};

Expand Down