mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
bitbake: toaster: libtoaster Fix a few warnings picked up by jshint
Fix warnings and items that do not conform to strict. Also add a fairly lenient jshintrc. usage: jshint js_file (Bitbake rev: 93a1e05a5d6bd19e689126bfef0df8caa0d8bf34) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
41ebd5105b
commit
0fa38bb8e1
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"curly" : false,
|
||||||
|
"predef" : [ "$","libtoaster", "prettyPrint" ],
|
||||||
|
"eqnull": true,
|
||||||
|
"plusplus" : false,
|
||||||
|
"browser" : true,
|
||||||
|
"jquery" : true,
|
||||||
|
"devel" : true,
|
||||||
|
"unused" : true,
|
||||||
|
"maxerr" : 60
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/* All shared functionality to go in libtoaster object.
|
/* All shared functionality to go in libtoaster object.
|
||||||
* This object really just helps readability since we can then have
|
* This object really just helps readability since we can then have
|
||||||
* a traceable namespace.
|
* a traceable namespace.
|
||||||
@@ -19,7 +20,7 @@ var libtoaster = (function (){
|
|||||||
source: function(query, process){
|
source: function(query, process){
|
||||||
xhrParams.value = query;
|
xhrParams.value = query;
|
||||||
$.getJSON(xhrUrl, this.options.xhrParams, function(data){
|
$.getJSON(xhrUrl, this.options.xhrParams, function(data){
|
||||||
if (data.error != "ok") {
|
if (data.error !== "ok") {
|
||||||
console.log("Error getting data from server "+data.error);
|
console.log("Error getting data from server "+data.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -61,7 +62,7 @@ var libtoaster = (function (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
jQElement.data('typeahead').render = customRenderFunc;
|
jQElement.data('typeahead').render = customRenderFunc;
|
||||||
};
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* url - the url of the xhr build */
|
* url - the url of the xhr build */
|
||||||
@@ -79,10 +80,10 @@ var libtoaster = (function (){
|
|||||||
data: data,
|
data: data,
|
||||||
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
||||||
success: function (_data) {
|
success: function (_data) {
|
||||||
if (_data.error != "ok") {
|
if (_data.error !== "ok") {
|
||||||
console.warn(_data.error);
|
console.warn(_data.error);
|
||||||
} else {
|
} else {
|
||||||
if (onsuccess != undefined) onsuccess(_data);
|
if (onsuccess !== undefined) onsuccess(_data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (_data) {
|
error: function (_data) {
|
||||||
@@ -90,7 +91,7 @@ var libtoaster = (function (){
|
|||||||
console.warn(_data);
|
console.warn(_data);
|
||||||
if (onfail) onfail(data);
|
if (onfail) onfail(data);
|
||||||
} });
|
} });
|
||||||
};
|
}
|
||||||
|
|
||||||
/* Get a project's configuration info */
|
/* Get a project's configuration info */
|
||||||
function _getProjectInfo(url, projectId, onsuccess, onfail){
|
function _getProjectInfo(url, projectId, onsuccess, onfail){
|
||||||
@@ -100,18 +101,18 @@ var libtoaster = (function (){
|
|||||||
data: { project_id : projectId },
|
data: { project_id : projectId },
|
||||||
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
||||||
success: function (_data) {
|
success: function (_data) {
|
||||||
if (_data.error != "ok") {
|
if (_data.error !== "ok") {
|
||||||
console.warn(_data.error);
|
console.warn(_data.error);
|
||||||
} else {
|
} else {
|
||||||
if (onsuccess != undefined) onsuccess(_data);
|
if (onsuccess !== undefined) onsuccess(_data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (_data) {
|
error: function (_data) {
|
||||||
console.warn(_data);
|
console.warn(_data);
|
||||||
if (onfail) onfail(data);
|
if (onfail) onfail(_data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/* Properties for data can be:
|
/* Properties for data can be:
|
||||||
* layerDel (csv)
|
* layerDel (csv)
|
||||||
@@ -129,10 +130,10 @@ var libtoaster = (function (){
|
|||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.error != "ok") {
|
if (data.error != "ok") {
|
||||||
console.log(data.error);
|
console.log(data.error);
|
||||||
if (onFail != undefined)
|
if (onFail !== undefined)
|
||||||
onFail(data);
|
onFail(data);
|
||||||
} else {
|
} else {
|
||||||
if (onSuccess != undefined)
|
if (onSuccess !== undefined)
|
||||||
onSuccess(data);
|
onSuccess(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -141,7 +142,7 @@ var libtoaster = (function (){
|
|||||||
console.log(data);
|
console.log(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){
|
function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){
|
||||||
/* Check for dependencies not in the current project */
|
/* Check for dependencies not in the current project */
|
||||||
@@ -150,7 +151,7 @@ var libtoaster = (function (){
|
|||||||
function(data) {
|
function(data) {
|
||||||
if (data.error != "ok") {
|
if (data.error != "ok") {
|
||||||
console.log(data.error);
|
console.log(data.error);
|
||||||
if (onFail != undefined)
|
if (onFail !== undefined)
|
||||||
onFail(data);
|
onFail(data);
|
||||||
} else {
|
} else {
|
||||||
onSuccess(data);
|
onSuccess(data);
|
||||||
@@ -158,22 +159,22 @@ var libtoaster = (function (){
|
|||||||
}, function() {
|
}, function() {
|
||||||
console.log("E: Failed to make request");
|
console.log("E: Failed to make request");
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/* parses the query string of the current window.location to an object */
|
/* parses the query string of the current window.location to an object */
|
||||||
function _parseUrlParams() {
|
function _parseUrlParams() {
|
||||||
string = window.location.search
|
var string = window.location.search;
|
||||||
string = string.substr(1);
|
string = string.substr(1);
|
||||||
stringArray = string.split ("&");
|
var stringArray = string.split ("&");
|
||||||
obj = {};
|
var obj = {};
|
||||||
|
|
||||||
for (i in stringArray) {
|
for (var i in stringArray) {
|
||||||
keyVal = stringArray[i].split ("=");
|
var keyVal = stringArray[i].split ("=");
|
||||||
obj[keyVal[0]] = keyVal[1];
|
obj[keyVal[0]] = keyVal[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
}
|
||||||
|
|
||||||
/* takes a flat object and outputs it as a query string
|
/* takes a flat object and outputs it as a query string
|
||||||
* e.g. the output of dumpsUrlParams
|
* e.g. the output of dumpsUrlParams
|
||||||
@@ -181,7 +182,7 @@ var libtoaster = (function (){
|
|||||||
function _dumpsUrlParams(obj) {
|
function _dumpsUrlParams(obj) {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
|
|
||||||
for (key in obj){
|
for (var key in obj){
|
||||||
if (!obj[key])
|
if (!obj[key])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -190,7 +191,7 @@ var libtoaster = (function (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -203,23 +204,23 @@ var libtoaster = (function (){
|
|||||||
debug: false,
|
debug: false,
|
||||||
parseUrlParams : _parseUrlParams,
|
parseUrlParams : _parseUrlParams,
|
||||||
dumpsUrlParams : _dumpsUrlParams,
|
dumpsUrlParams : _dumpsUrlParams,
|
||||||
}
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* keep this in the global scope for compatability */
|
/* keep this in the global scope for compatability */
|
||||||
function reload_params(params) {
|
function reload_params(params) {
|
||||||
uri = window.location.href;
|
var uri = window.location.href;
|
||||||
splitlist = uri.split("?");
|
var splitlist = uri.split("?");
|
||||||
url = splitlist[0], parameters=splitlist[1];
|
var url = splitlist[0];
|
||||||
|
var parameters = splitlist[1];
|
||||||
// deserialize the call parameters
|
// deserialize the call parameters
|
||||||
if(parameters){
|
var cparams = [];
|
||||||
cparams = parameters.split("&");
|
if(parameters)
|
||||||
}else{
|
cparams = parameters.split("&");
|
||||||
cparams = []
|
|
||||||
}
|
var nparams = {};
|
||||||
nparams = {}
|
for (var i = 0; i < cparams.length; i++) {
|
||||||
for (i = 0; i < cparams.length; i++) {
|
var temp = cparams[i].split("=");
|
||||||
temp = cparams[i].split("=");
|
|
||||||
nparams[temp[0]] = temp[1];
|
nparams[temp[0]] = temp[1];
|
||||||
}
|
}
|
||||||
// update parameter values
|
// update parameter values
|
||||||
@@ -227,7 +228,7 @@ function reload_params(params) {
|
|||||||
nparams[encodeURIComponent(i)] = encodeURIComponent(params[i]);
|
nparams[encodeURIComponent(i)] = encodeURIComponent(params[i]);
|
||||||
}
|
}
|
||||||
// serialize the structure
|
// serialize the structure
|
||||||
callparams = []
|
var callparams = [];
|
||||||
for (i in nparams) {
|
for (i in nparams) {
|
||||||
callparams.push(i+"="+nparams[i]);
|
callparams.push(i+"="+nparams[i]);
|
||||||
}
|
}
|
||||||
@@ -238,7 +239,7 @@ function reload_params(params) {
|
|||||||
/* Things that happen for all pages */
|
/* Things that happen for all pages */
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
/* If we don't have a console object which might be the case in some
|
/* If we don't have a console object which might be the case in some
|
||||||
* browsers, no-op it to avoid undefined errors.
|
* browsers, no-op it to avoid undefined errors.
|
||||||
*/
|
*/
|
||||||
if (!window.console) {
|
if (!window.console) {
|
||||||
@@ -271,7 +272,7 @@ $(document).ready(function() {
|
|||||||
// .btn class applied, and make sure popovers work on click, are mutually
|
// .btn class applied, and make sure popovers work on click, are mutually
|
||||||
// exclusive and they close when your click outside their area
|
// exclusive and they close when your click outside their area
|
||||||
|
|
||||||
$('html').click(function(e){
|
$('html').click(function(){
|
||||||
$('td > a.btn').popover('hide');
|
$('td > a.btn').popover('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -323,9 +324,9 @@ $(document).ready(function() {
|
|||||||
// linking directly to tabs
|
// linking directly to tabs
|
||||||
$(function(){
|
$(function(){
|
||||||
var hash = window.location.hash;
|
var hash = window.location.hash;
|
||||||
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
$('ul.nav a[href="' + hash + '"]').tab('show');
|
||||||
|
|
||||||
$('.nav-tabs a').click(function (e) {
|
$('.nav-tabs a').click(function () {
|
||||||
$(this).tab('show');
|
$(this).tab('show');
|
||||||
$('body').scrollTop();
|
$('body').scrollTop();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user