[Pkg-mozext-commits] [wot] 139/226: Cleaned code from debug output and outdated code

David Prévot taffit at moszumanska.debian.org
Fri May 1 00:35:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository wot.

commit 2588f79631517250cb2ee0beab7afb081f68019e
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Mon Sep 2 16:05:22 2013 +0300

    Cleaned code from debug output and outdated code
---
 content/api.js          |  16 ++--
 content/ratingwindow.js |  14 +--
 content/ui.js           | 247 +-----------------------------------------------
 3 files changed, 17 insertions(+), 260 deletions(-)

diff --git a/content/api.js b/content/api.js
index 15a2b66..605446e 100644
--- a/content/api.js
+++ b/content/api.js
@@ -729,7 +729,7 @@ var wot_api_submit =
 			if (!request) return;
 
             var url = wot_core.wot_service_url() + wot_crypto.authenticate_query(qs);
-            wdump("API Submit: " + url);
+//            wdump("API Submit: " + url);
 
 			request.open("GET", url);
 
@@ -1038,7 +1038,7 @@ var wot_pending =
 //                }
 //            }
 
-			wdump("wot_pending.parse: " + pref + ": " + rv.target);
+//			wdump("wot_pending.parse: " + pref + ": " + rv.target);
 			return rv;
 
 		} catch (e) {
@@ -1096,7 +1096,7 @@ var wot_pending =
 
 				if (!parsed) continue;
 
-                wdump("API Submits Parsed: " + JSON.stringify(parsed));
+//                wdump("API Submits Parsed: " + JSON.stringify(parsed));
 
                 wot_api_submit.send(pref, parsed.target, parsed.testimonies, parsed.votes);
 
@@ -1293,7 +1293,7 @@ var wot_api_comments = {
                     return;
                 }
 
-                wdump("api.comments.call.success: url = " + url + ", status = " + event.target.status);
+//                wdump("api.comments.call.success: url = " + url + ", status = " + event.target.status);
 
                 var data = JSON.parse(event.target.responseText);
 
@@ -1492,7 +1492,7 @@ var wot_api_comments = {
     },
 
     is_error: function (error) {
-        wdump("wot_api_comments.is_error(error)" + error);
+//        wdump("wot_api_comments.is_error(error)" + error);
 
         var error_code = 0,
             error_debug = "it is raining outside :(";
@@ -1512,7 +1512,7 @@ var wot_api_comments = {
     },
 
     on_get_comment_response: function (data) {
-        wdump("wot_api_comments.on_get_comment_response(data)" + JSON.stringify(data));
+//        wdump("wot_api_comments.on_get_comment_response(data)" + JSON.stringify(data));
         // check whether error occured or data arrived
         var _this = wot_api_comments,
             nonce = data ? data.nonce : null, // to recover target from response
@@ -1538,7 +1538,7 @@ var wot_api_comments = {
     on_submit_comment_response: function (data) {
         /* Handler for "Submit" responses. On success it updates the local cache  */
 
-        wdump("wot_api_comments.on_submit_comment_response(data) " + data);
+//        wdump("wot_api_comments.on_submit_comment_response(data) " + data);
         var _this = wot_api_comments,
             nonce = data.nonce, // to recover target from response
             target = _this.pull_nonce(nonce),
@@ -1570,7 +1570,7 @@ var wot_api_comments = {
     },
 
     on_remove_comment_response: function (data) {
-        wdump("wot_api_comments.on_remove_comment_response(data) " + data);
+//        wdump("wot_api_comments.on_remove_comment_response(data) " + data);
 
         var _this = wot_api_comments,
             nonce = data.nonce, // to recover target from response
diff --git a/content/ratingwindow.js b/content/ratingwindow.js
index 9d7dd25..5d00259 100644
--- a/content/ratingwindow.js
+++ b/content/ratingwindow.js
@@ -186,7 +186,7 @@ var wot_rw = {
 
     update: function () {
         // Updates content of Rating Window. RW must be already initialized (locales, categories info, etc).
-        wdump("RW.update()");
+//        wdump("RW.update()");
 
         if (!this.is_visible) return;
 
@@ -195,7 +195,7 @@ var wot_rw = {
             rw_wot = this.get_rw_wot(),
             target = wot_core.hostname;
 
-        wdump("\tTarget: " + target);
+//        wdump("\tTarget: " + target);
 
         if (!rw || !rw_doc || !rw_wot) return;
 
@@ -222,7 +222,7 @@ var wot_rw = {
             }
         }
 
-        wdump("\tdata: " + JSON.stringify(data));
+//        wdump("\tdata: " + JSON.stringify(data));
 
         rw_wot.ratingwindow.update(target, JSON.stringify(data));
     },
@@ -255,7 +255,7 @@ var wot_rw = {
             wdump("ERROR: wot_rw.get_preferences() raised an exception: " + e);
         }
 
-        wdump("prefs: " + JSON.stringify(prefs));
+//        wdump("prefs: " + JSON.stringify(prefs));
 
         return prefs;
     },
@@ -270,7 +270,7 @@ var wot_rw = {
     },
 
     on_submit: function (data) {
-        wdump("RW: on_submit() " + JSON.stringify(data));
+//        wdump("RW: on_submit() " + JSON.stringify(data));
 
         if (!data || !data.params) {
             wdump("on_submit() received empty data to submit.");
@@ -313,7 +313,7 @@ var wot_rw = {
             var details = event.detail;
             if (!details) return false;
 
-            wdump("on_ratingwindow_event() " + JSON.stringify(details));
+//            wdump("on_ratingwindow_event() " + JSON.stringify(details));
 
             var message_id = details.message_id,
                 data = details.data;
@@ -411,7 +411,7 @@ var wot_rw = {
 
             var prefs = this.get_preferences();
             this.push_preferences(rw, prefs);
-            wdump(JSON.stringify(prefs));
+//            wdump(JSON.stringify(prefs));
 
             // setup categories data in the RW
             rw_wot.categories = wot_categories.categories;
diff --git a/content/ui.js b/content/ui.js
index 0b4b3de..95d7a7b 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -42,7 +42,7 @@ var wot_status = {
 
 			/* Update display */
 			if (wot_prefs.updateui) {
-				wot_ui.update(description);
+				wot_ui.update();
 			}
 		} catch (e) {
 			dump("wot_status.set: failed with " + e + "\n");
@@ -140,24 +140,6 @@ var wot_ui = {
 		}
 	},
 
-//	show_partner: function()
-//	{
-//		try {
-//			var mainwnd = this.getElem("main-window");
-//			if (mainwnd) {
-//				var partner = wot_partner.getpartner() || "";
-//
-//				if (mainwnd.getAttribute("wot-partner") != partner) {
-//					mainwnd.setAttribute("wot-partner", partner);
-//				}
-//
-////				this.getElem("wot-partner").hidden = !partner.length;
-//			}
-//		} catch (e) {
-//			wdump("wot_ui.show_partner: failed with " + e);
-//		}
-//	},
-
 	show_toolbar_button: function(id, after) {
 		try {
 			var nbr = this.getElem("nav-bar");
@@ -208,246 +190,21 @@ var wot_ui = {
 			/* Accessibility */
 			this.show_accessible();
 
-			/* Rating components */
-//			document.getElementById("wot-rating-4").hidden =
-//				!wot_prefs.show_application_4;
-
-			/* Partner */
-//			this.show_partner();
 		} catch (e) {
 			dump("wot_ui.show_elements: failed with " + e + "\n");
 		}
 	},
 
-	update: function(description)
+	update: function()
 	{
 		try {
 			wot_commands.update();
 			this.show_elements();
-//			this.update_title(description);
-//			this.update_rating();
-//			this.update_testimonies();
-//			this.update_scorecard();
-//			this.update_users();
-//			this.update_message();
 		} catch (e) {
 			dump("wot_ui.update: failed with " + e + "\n");
 		}
 	},
 
-//	update_rating: function()
-//	{
-//		try {
-//			var cached = wot_cache.isok(wot_core.hostname);
-//
-//			for (var i = 0; i < WOT_COMPONENTS.length; ++i) {
-//                var a = WOT_COMPONENTS[i],
-//				    rep_elem = this.getElem("wot-rating-" + a + "-reputation"),
-//				    conf_elem = this.getElem("wot-rating-" + a + "-confidence"),
-//                    rep = -1,
-//                    cnf = -1,
-//                    exl,
-//                    level;
-//
-//				if (cached) {
-//					rep = wot_cache.get(wot_core.hostname, "reputation_" + a);
-//					cnf = wot_cache.get(wot_core.hostname, "confidence_" + a);
-//					exl = wot_cache.get(wot_core.hostname, "excluded_" + a);
-//				}
-//
-//				if (rep_elem) {
-//					if (exl) {
-//						rep_elem.setAttribute("reputation", "excluded");
-//					} else if (rep >= 0) {
-//						rep_elem.setAttribute("reputation", wot_util.get_level(WOT_REPUTATIONLEVELS, rep).level);
-//					} else if (cached) {
-//						rep_elem.setAttribute("reputation", 0);
-//					} else {
-//						rep_elem.removeAttribute("reputation");
-//					}
-//				}
-//
-//				if (conf_elem) {
-//                    level = exl ? 0 : wot_util.get_level(WOT_CONFIDENCELEVELS, cnf).level;
-//                    conf_elem.setAttribute("confidence", level);
-//				}
-//			}
-//		} catch (e) {
-//			wdump("wot_ui.update_rating: failed with " + e);
-//		}
-//	},
-
-//	/* Updates the testimony element */
-//	update_testimonies: function(hover, pos)
-//	{
-//		try {
-//			var cached = wot_cache.isok(wot_core.hostname);
-//
-//			/* Sliders for components */
-//			for (var i = 0, a = 0; i < WOT_COMPONENTS.length; ++i) {
-//                a = WOT_COMPONENTS[i];
-//				/* Slider elements */
-//				var stack     = this.getElem("wot-rating-" +	a + "-stack");
-//				var indicator = this.getElem("wot-rating-" +	a + "-indicator");
-//
-//				if (!stack || !indicator) {
-//					continue;
-//				}
-//
-//				var testimony = -1;
-//				if (cached) {
-//					testimony = wot_cache.get(wot_core.hostname, "testimony_" + a);
-//				}
-//
-//				if (testimony >= 0) {
-//					indicator.left = testimony * this.SLIDER_WIDTH / WOT_MAX_REPUTATION;
-//					if (testimony == WOT_MAX_REPUTATION) {
-//						--indicator.left;
-//					}
-//					stack.setAttribute("testimony", "true");
-//				} else if (hover != null && a == hover) {
-//					indicator.left = pos * this.SLIDER_WIDTH / WOT_MAX_REPUTATION;
-//					if (pos == WOT_MAX_REPUTATION) {
-//						--indicator.left;
-//					}
-//					stack.setAttribute("testimony", "hover");
-//				} else {
-//					stack.setAttribute("testimony", "false");
-//				}
-//
-//				var help = this.getElem("wot-rating-" + a + "-help-text"),
-//				    link = this.getElem("wot-rating-" + a + "-help-link");
-//
-//				if (help && link) {
-//					if (testimony >= WOT_MIN_REPUTATION_5) {
-//						help.value = wot_util.getstring("reputationlevels_5");
-//					} else if (testimony >= WOT_MIN_REPUTATION_4) {
-//						help.value = wot_util.getstring("reputationlevels_4");
-//					} else if (testimony >= WOT_MIN_REPUTATION_3) {
-//						help.value = wot_util.getstring("reputationlevels_3");
-//					} else if (testimony >= WOT_MIN_REPUTATION_2) {
-//						help.value = wot_util.getstring("reputationlevels_2");
-//					} else if (testimony >= 0) {
-//						help.value = wot_util.getstring("reputationlevels_1");
-//					} else {
-//						help.value = "";
-//					}
-//
-//					link.removeAttribute("comment");
-//					link.value = "";
-//
-//					if (cached && testimony >= 0) {
-//						var r = wot_cache.get(wot_core.hostname, "reputation_" + a);
-//						if (r != null && r >= 0 &&
-//							Math.abs(r - testimony) > WOT_MIN_COMMENT_DIFF) {
-//							help.value = wot_util.getstring("help_comment");
-//							link.value = wot_util.getstring("help_comment_link");
-//							link.setAttribute("comment", "true");
-//						}
-//					}
-//
-//					help.hidden = (!help.value || !help.value.length);
-//				}
-//			}
-//		} catch (e) {
-//			dump("wot_ui.update_testimonies: failed with " + e + "\n");
-//		}
-//	},
-
-//	update_scorecard: function()
-//	{
-//	},
-
-//	update_message: function()
-//	{
-//		try {
-//			var msg = this.getElem("wot-message");
-//			var txt = this.getElem("wot-message-text");
-//
-//			if (!msg || !txt || !txt.firstChild) {
-//				return;
-//			}
-//
-//			if (wot_api_query.message.length == 0 ||
-//					wot_api_query.message_type.length == 0) {
-//				msg.hidden = true;
-//				txt.firstChild.nodeValue = "";
-//				return;
-//			}
-//
-//			txt.firstChild.nodeValue = wot_api_query.message;
-//			txt.setAttribute("url-type",
-//				wot_api_query.message_url.substring(0,4));
-//			msg.setAttribute("message-status", wot_api_query.message_type);
-//			msg.hidden = false;
-//		} catch (e) {
-//			dump("wot_ui.update_message: failed with " + e + "\n");
-//		}
-//	},
-
-//	update_users: function()
-//	{
-//		try {
-//			if (!wot_api_query.users) {
-//				return;
-//			}
-//
-//			var i, j = 0;
-//
-//			for (i = 0; i < wot_api_query.users.length; ++i) {
-//				var user    = this.getElem("wot-user-" + j);
-//				var content = this.getElem("wot-user-" + j + "-content");
-//				var stack   = this.getElem("wot-user-" + j + "-stack");
-//				var header  = this.getElem("wot-user-" + j + "-header");
-//				var bar     = this.getElem("wot-user-" + j + "-bar-image");
-//				var label   = this.getElem("wot-user-" + j + "-bar-text");
-//				var text    = this.getElem("wot-user-" + j + "-text");
-//				var notice  = this.getElem("wot-user-" + j + "-notice");
-//
-//				if (!user || !header || !bar || !label || !text || !notice) {
-//					return;
-//				}
-//
-//				if (wot_api_query.users[i].bar &&
-//						wot_api_query.users[i].length != null &&
-//						wot_api_query.users[i].label) {
-//					header.value = wot_api_query.users[i].bar;
-//					label.value = wot_api_query.users[i].label;
-//					bar.setAttribute("length", wot_api_query.users[i].length);
-//					bar.hidden = false;
-//				} else {
-//					header.value = "";
-//					label.value = "";
-//					bar.hidden = true;
-//				}
-//
-//				if (wot_api_query.users[i].url) {
-//					content.setAttribute("url", wot_api_query.users[i].url);
-//				} else {
-//					content.removeAttribute("url");
-//				}
-//
-//				if (wot_api_query.users[i].notice) {
-//					notice.value = wot_api_query.users[i].notice;
-//					notice.hidden = false;
-//				} else {
-//					notice.hidden = true;
-//				}
-//
-//				if (wot_api_query.users[i].text) {
-//					text.value = wot_api_query.users[i].text;
-//					user.hidden = false;
-//					++j;
-//				} else {
-//					text.value = "";
-//					user.hidden = true;
-//				}
-//			}
-//		} catch (e) {
-//			dump("wot_ui.update_users: failed with " + e + "\n");
-//		}
-//	},
-
 	geticonurl: function(r, size, plain)
 	{
         var image = wot_util.get_level(WOT_REPUTATIONLEVELS, r).name,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git



More information about the Pkg-mozext-commits mailing list