summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/libtoaster.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/libtoaster.js39
1 files changed, 34 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
index 15815b333e..a2a0abd45b 100644
--- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
@@ -81,14 +81,14 @@ var libtoaster = (function (){
81 headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, 81 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
82 success: function (_data) { 82 success: function (_data) {
83 if (_data.error != "ok") { 83 if (_data.error != "ok") {
84 console.log(_data.error); 84 console.warn(_data.error);
85 } else { 85 } else {
86 if (onsuccess != undefined) onsuccess(_data); 86 if (onsuccess != undefined) onsuccess(_data);
87 } 87 }
88 }, 88 },
89 error: function (_data) { 89 error: function (_data) {
90 console.log("Call failed"); 90 console.warn("Call failed");
91 console.log(_data); 91 console.warn(_data);
92 if (onfail) onfail(data); 92 if (onfail) onfail(data);
93 } }); 93 } });
94 }; 94 };
@@ -102,13 +102,13 @@ var libtoaster = (function (){
102 headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, 102 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
103 success: function (_data) { 103 success: function (_data) {
104 if (_data.error != "ok") { 104 if (_data.error != "ok") {
105 console.log(_data.error); 105 console.warn(_data.error);
106 } else { 106 } else {
107 if (onsuccess != undefined) onsuccess(_data); 107 if (onsuccess != undefined) onsuccess(_data);
108 } 108 }
109 }, 109 },
110 error: function (_data) { 110 error: function (_data) {
111 console.log(_data); 111 console.warn(_data);
112 if (onfail) onfail(data); 112 if (onfail) onfail(data);
113 } 113 }
114 }); 114 });
@@ -168,6 +168,7 @@ var libtoaster = (function (){
168 getProjectInfo: _getProjectInfo, 168 getProjectInfo: _getProjectInfo,
169 getLayerDepsForProject : _getLayerDepsForProject, 169 getLayerDepsForProject : _getLayerDepsForProject,
170 editProject : _editProject, 170 editProject : _editProject,
171 debug: false,
171 } 172 }
172})(); 173})();
173 174
@@ -203,6 +204,15 @@ function reload_params(params) {
203/* Things that happen for all pages */ 204/* Things that happen for all pages */
204$(document).ready(function() { 205$(document).ready(function() {
205 206
207 /* If we don't have a console object which might be the case in some
208 * browsers, no-op it to avoid undefined errors.
209 */
210 if (!window.console) {
211 window.console = {};
212 window.console.warn = function() {};
213 window.console.error = function() {};
214 }
215
206 /* 216 /*
207 * PrettyPrint plugin. 217 * PrettyPrint plugin.
208 * 218 *
@@ -320,4 +330,23 @@ $(document).ready(function() {
320 if (location.href.search('#warnings') > -1) { 330 if (location.href.search('#warnings') > -1) {
321 $('#collapse-warnings').addClass('in'); 331 $('#collapse-warnings').addClass('in');
322 } 332 }
333
334 function check_for_duplicate_ids () {
335 /* warn about duplicate element ids */
336 var ids = {};
337 $("[id]").each(function() {
338 if (this.id && ids[this.id]) {
339 console.warn('Duplicate element id #'+this.id);
340 }
341 ids[this.id] = true;
342 });
343 }
344
345 if (libtoaster.debug) {
346 check_for_duplicate_ids();
347 } else {
348 /* Debug is false so supress warnings by overriding the functions */
349 window.console.warn = function () {};
350 window.console.error = function () {};
351 }
323}); 352});