[Pkg-mozext-commits] [wot] 01/05: Imported Upstream version 20131030

David Prévot taffit at alioth.debian.org
Wed Nov 6 14:56:34 UTC 2013


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

taffit pushed a commit to branch master
in repository wot.

commit 0f0c1b5bb5a8b7303acc0240f445c21068e9cc48
Author: David Prévot <taffit at debian.org>
Date:   Wed Nov 6 10:11:42 2013 -0400

    Imported Upstream version 20131030
---
 META-INF/manifest.mf                            |    8 ++--
 META-INF/zigbert.rsa                            |  Bin 2772 -> 2772 bytes
 META-INF/zigbert.sf                             |    8 ++--
 chrome/wot.jar!/content/api.js                  |   26 ++++++------
 chrome/wot.jar!/content/config.js               |    2 +-
 chrome/wot.jar!/content/core.js                 |   22 ++++++++--
 chrome/wot.jar!/content/injections/wot_proxy.js |    2 +-
 chrome/wot.jar!/content/rw/proxies.js           |    2 +
 chrome/wot.jar!/content/rw/ratingwindow.js      |   51 +++++++++++++++--------
 chrome/wot.jar!/content/rw/wot.js               |   14 +++----
 chrome/wot.jar!/content/search.js               |   38 +++++++++++++----
 chrome/wot.jar!/skin/ratingwindow.css           |   31 +++++++++++---
 install.rdf                                     |    2 +-
 13 files changed, 139 insertions(+), 67 deletions(-)

diff --git a/META-INF/manifest.mf b/META-INF/manifest.mf
index c468d28..6d6adaa 100644
--- a/META-INF/manifest.mf
+++ b/META-INF/manifest.mf
@@ -9,13 +9,13 @@ SHA1-Digest: ch4/JCA8aIe9wP1UNNoF0mbHk40=
 
 Name: chrome/wot.jar
 Digest-Algorithms: MD5 SHA1
-MD5-Digest: 2K7mVNWXFM10P7aK5cVtjg==
-SHA1-Digest: Ny8M2C70bRcyELo3OD7d8VDO61U=
+MD5-Digest: q/zIIxvE12PYt1pIfhw4xQ==
+SHA1-Digest: OFHHnVA7yjcDKvZCl+6Cyx9pfF0=
 
 Name: install.rdf
 Digest-Algorithms: MD5 SHA1
-MD5-Digest: z6IX7wTt+uLvlDay+txRrg==
-SHA1-Digest: JZI+6R1LCfEvrRIJH7b/arukoIA=
+MD5-Digest: 8Q9ZNO0jwMv0RBe7n1riCg==
+SHA1-Digest: C/Y5JEHYNukzFTumAYl/V2qlyG8=
 
 Name: COPYING
 Digest-Algorithms: MD5 SHA1
diff --git a/META-INF/zigbert.rsa b/META-INF/zigbert.rsa
index 5839b02..7f1c12e 100644
Binary files a/META-INF/zigbert.rsa and b/META-INF/zigbert.rsa differ
diff --git a/META-INF/zigbert.sf b/META-INF/zigbert.sf
index 6c49004..278f2de 100644
--- a/META-INF/zigbert.sf
+++ b/META-INF/zigbert.sf
@@ -12,13 +12,13 @@ SHA1-Digest: BnnRVkbzKBIQVW0a+wyYEddpKO4=
 
 Name: chrome/wot.jar
 Digest-Algorithms: MD5 SHA1
-MD5-Digest: bwCw2+y1/XviMzI9ndcnLw==
-SHA1-Digest: MeSqX1/AApjFQ0T4jkIy0nTkfL4=
+MD5-Digest: pqX27nwRIJKqcROyZyfNwQ==
+SHA1-Digest: E+U1yzlYZX6NLrPlvUXygYAJA9g=
 
 Name: install.rdf
 Digest-Algorithms: MD5 SHA1
-MD5-Digest: BfTk7XxMDYG3if3QtMJb1w==
-SHA1-Digest: roZM1zt/NXGTyG4pJFI1Sc9RTg0=
+MD5-Digest: M5mA/CTtZF1c7x7D5poKiw==
+SHA1-Digest: /IWiD65b4v5QRmG1o5zs++nvQ4w=
 
 Name: COPYING
 Digest-Algorithms: MD5 SHA1
diff --git a/chrome/wot.jar!/content/api.js b/chrome/wot.jar!/content/api.js
index 96b6eb9..160a1c7 100644
--- a/chrome/wot.jar!/content/api.js
+++ b/chrome/wot.jar!/content/api.js
@@ -1223,12 +1223,12 @@ var wot_api_comments = {
 
             params.id = wot_prefs.witness_id;
             params.nonce = nonce;
-            params.version = WOT_PLATFORM + "-" +WOT_VERSION;
+            params.version = WOT_PLATFORM + "-" + WOT_VERSION;
 
             options = options || { type: "GET" };
 
             if (options.encryption) {
-                params.target = wot_crypto.encrypt(params.target, nonce);
+                params.target = wot_crypto.encrypt(wot_idn.utftoidn(params.target), nonce);
             }
 
             var components = [];
@@ -1349,12 +1349,11 @@ var wot_api_comments = {
             pref_pending_name = _this.PENDING_COMMENT_SID + target;
 
         // try to restore pending submission first
-        var state_json = wot_prefs.getChar(pref_pending_name);
-        var state = state_json ? JSON.parse(state_json) : {
-            target: target,
-            comment_data: {},
-            tries: 0
-        };
+        var state = wot_prefs.getJSON(pref_pending_name, {
+	        target: target,
+	        comment_data: {},
+	        tries: 0
+        });
 
         // if params are given, it means we are on normal way of sending data (not on retrying)
         if (comment && votes) {
@@ -1370,7 +1369,7 @@ var wot_api_comments = {
             return;
         }
 
-        wot_prefs.setChar(pref_pending_name, JSON.stringify(state));    // remember the submission
+        wot_prefs.setJSON(pref_pending_name, state);    // remember the submission
 
         state.comment_data['target'] = target;
 
@@ -1408,11 +1407,10 @@ var wot_api_comments = {
             pref_pending_name = _this.PENDING_REMOVAL_SID + target;
 
         // try to restore pending submission first
-        var state_json = wot_prefs.getChar(pref_pending_name, null);
-        var state = state_json ? JSON.parse(state_json) : {
+        var state = wot_prefs.getJSON(pref_pending_name, {
             target: target,
             tries: 0
-        };
+        });
 
         if (++state.tries > _this.MAX_TRIES) {
             wdump("api.comments.submit: failed " + target + " (max tries)");
@@ -1420,7 +1418,7 @@ var wot_api_comments = {
             return;
         }
 
-        wot_prefs.setChar(pref_pending_name, JSON.stringify(state));    // remember the submission
+        wot_prefs.setJSON(pref_pending_name, state);    // remember the submission
 
         _this.call("remove",
             {
@@ -1595,4 +1593,4 @@ var wot_api_comments = {
 
         wot_rw.update_ratingwindow_comment(); // to update status "the website is commented by the user"
     }
-};
\ No newline at end of file
+};
diff --git a/chrome/wot.jar!/content/config.js b/chrome/wot.jar!/content/config.js
index d5e09bc..686a3fa 100644
--- a/chrome/wot.jar!/content/config.js
+++ b/chrome/wot.jar!/content/config.js
@@ -19,7 +19,7 @@
 */
 
 const WOT_PLATFORM = "firefox";
-const WOT_VERSION  = "20131008";
+const WOT_VERSION  = "20131030";
 
 /*
  * Constants
diff --git a/chrome/wot.jar!/content/core.js b/chrome/wot.jar!/content/core.js
index 77c5f40..08e98c4 100644
--- a/chrome/wot.jar!/content/core.js
+++ b/chrome/wot.jar!/content/core.js
@@ -133,10 +133,9 @@ var wot_core =
 			this.browser = document.getElementById("appcontent");
 
 			if (this.browser) {
-				this.browser.addEventListener("DOMContentLoaded",
-					wot_core.domcontentloaded, false);
-				this.browser.addEventListener("click",
-					wot_core.click, false);
+				this.browser.addEventListener("DOMContentLoaded", wot_core.domcontentloaded, false);
+				this.browser.addEventListener("pageshow", wot_core.pageshow, false);    // the fix for the issue with Back/Forward buttons
+				this.browser.addEventListener("click", wot_core.click, false);
 			}
 		} catch (e) {
 			dump("wot_core.init: failed with " + e + "\n");
@@ -263,6 +262,21 @@ var wot_core =
 		}
 	},
 
+	pageshow: function(event, retry)
+	{
+		if (!wot_core.loaded && !retry) {
+			window.setTimeout(function() {
+					wot_core.pageshow(event, true);
+				}, 500);
+		}
+
+		for (var i in wot_modules) {
+			if (typeof(wot_modules[i].obj.pageshow) == "function") {
+				wot_modules[i].obj.pageshow(event);
+			}
+		}
+	},
+
 	click: function(event)
 	{
 		for (var i in wot_modules) {
diff --git a/chrome/wot.jar!/content/injections/wot_proxy.js b/chrome/wot.jar!/content/injections/wot_proxy.js
index 9429664..2cd6784 100644
--- a/chrome/wot.jar!/content/injections/wot_proxy.js
+++ b/chrome/wot.jar!/content/injections/wot_proxy.js
@@ -24,7 +24,7 @@
 * */
 
 var wot = {
-	version: "20131008",    // TODO: init this value from the add-on core code
+	version: "20131030",    // TODO: init this value from the add-on core code
 	platform: "firefox",
 	debug: false,           // when changing this, don't forget to switch ga_id value also!
 	default_component: 0,
diff --git a/chrome/wot.jar!/content/rw/proxies.js b/chrome/wot.jar!/content/rw/proxies.js
index 0f2e9e7..30320f1 100644
--- a/chrome/wot.jar!/content/rw/proxies.js
+++ b/chrome/wot.jar!/content/rw/proxies.js
@@ -202,6 +202,8 @@ $.extend(wot_bg.wot, wot, {
 
         wt: {   // Welcome Tips proxy wrapper
 
+	        activity_score_max: 1500,
+
             settings: {
                 rw_ok: false,
                 rw_shown: 0,
diff --git a/chrome/wot.jar!/content/rw/ratingwindow.js b/chrome/wot.jar!/content/rw/ratingwindow.js
index 6be2a0f..149ab7b 100644
--- a/chrome/wot.jar!/content/rw/ratingwindow.js
+++ b/chrome/wot.jar!/content/rw/ratingwindow.js
@@ -30,7 +30,6 @@ $.extend(wot, { ratingwindow: {
     is_registered: false,   // whether user has an account on mywot.com
     delete_action: false,   // remembers whether user is deleting rating
     prefs: {},  // shortcut for background preferences
-    UPDATE_ROUND: 3,        // = 3 version when we launched WOT 2.0 in September 2013
 
     get_bg: function () {
         // just a shortcut
@@ -62,11 +61,14 @@ $.extend(wot, { ratingwindow: {
 
     updatestate: function(target, data)
     {
-        var _this = wot.ratingwindow;
+        var _this = wot.ratingwindow,
+	        was_target_changed = false;
         /* initialize on target change */
         if (_this.state.target != target) {
-            _this.finishstate(false);
-            _this.state = { target: target, down: -1 };
+	        _this.finishstate(false);
+	        _this.state = { target: target, down: -1 };
+	        _this.comments.set_comment("");  // reset comment field
+	        was_target_changed = true;
         }
 
         var state = {
@@ -88,7 +90,9 @@ $.extend(wot, { ratingwindow: {
         }
 
         /* remember previous state */
-        _this.state = $.extend(state, _this.state);
+	    _this.state = $.extend(state, _this.state);
+	    _this.cat_selector.init_voted(data.value.cats); // re-build user votes with new data
+	    return was_target_changed;
     },
 
     setstate: function (component, t) {
@@ -244,8 +248,7 @@ $.extend(wot, { ratingwindow: {
 
                 wot.components.forEach(function(item) {
                     if (rw.state[item.name]) {
-                        params["testimony_" + item.name] =
-                            rw.state[item.name].t;
+                        params["testimony_" + item.name] = rw.state[item.name].t;
                     }
                 });
 
@@ -558,7 +561,7 @@ $.extend(wot, { ratingwindow: {
 
             data = JSON.parse(data);    // for safety
 
-            _rw.updatestate(data.target, data.cached);
+	        var target_changed = _rw.updatestate(data.target, data.cached);
 
             _rw.current = data || {};
             _rw.is_registered = bg.wot.core.is_level("registered"); // update the state on every window update
@@ -568,14 +571,17 @@ $.extend(wot, { ratingwindow: {
 
             if (_rw.is_registered) {
                 // ask server if there is my comment for the website
-                _rw.comments.get_comment(data.target);
+	            if (target_changed) {   // no need to reask comment on every "iframe loaded" event
+                    _rw.comments.get_comment(data.target);
+	            }
             } else {
                 bg.wot.core.update_ratingwindow_comment(); // don't allow unregistered addons to comment
             }
 
-            _rw.modes.reset();
-            _rw.cat_selector.init_voted();
-            _rw.modes.auto();
+	        if (target_changed) {
+		        _rw.modes.reset();
+		        _rw.modes.auto();
+	        }
 
 			if (!data.target) {
 				bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_NOTARGET);
@@ -773,6 +779,9 @@ $.extend(wot, { ratingwindow: {
 
 	    $_cat_wrapper.addClass(vote == 1 ? "hand-up" : "hand-down");
         $_hand.addClass(vote == 1 ? "hand-up" : "hand-down");
+        if (vote == 1) {
+	        $_hand.addClass(wot.get_category_css(category.id));
+        }
         $_hand.attr("title", wot.i18n("ratingwindow", vote == 1 ? "vote_yes" : "vote_no"));
         $_cat_text.attr("title", cat_name);
         $_cat_text.text(cat_name);
@@ -1069,11 +1078,11 @@ $.extend(wot, { ratingwindow: {
             bg.wot.core.open_mywot(wot.urls.tour_rw, wot.urls.contexts.wt_rw_lm); // FIXME
         });
 
-		var tts_wtip =  (first_opening || wot.firstrunupdate == _rw.UPDATE_ROUND) &&
+		var tts_wtip =  first_opening &&
 						!(wt.settings.rw_ok || wt.settings.rw_shown > 0) &&
 						wot.is_defined(["rw_text", "rw_text_hdr"], "wt");
 
-//		tts_wtip = tts_wtip && (wot.get_activity_score() < bg.wot.wt.activity_score_max || wot.firstrunupdate == _rw.UPDATE_ROUND);
+		tts_wtip = tts_wtip && (wot.get_activity_score() < bg.wot.wt.activity_score_max);
 
         if (bg.wot.prefs.get("super_wtips")) tts_wtip = true;  // override by super-setting
 
@@ -1865,12 +1874,18 @@ $.extend(wot, { ratingwindow: {
             _this.update_categories_visibility();
         },
 
-        init_voted: function () {
+        init_voted: function (cats) {
             var _rw = wot.ratingwindow,
-                _this = _rw.cat_selector;
+                _this = _rw.cat_selector,
+	            cached = {},
+	            cats_object = {};
 
-            var cached = _rw.getcached(),
-                cats_object = (cached && cached.value && cached.value.cats) ? cached.value.cats : {};
+            if (!cats || wot.utils.isEmptyObject(cats)) {
+	            cached = _rw.getcached();
+	            cats_object = (cached && cached.value && cached.value.cats) ? cached.value.cats : {};
+            } else {
+	            cats_object = cats;
+            }
 
             _this.votes = wot.select_voted(cats_object);
             _this.markup_voted();
diff --git a/chrome/wot.jar!/content/rw/wot.js b/chrome/wot.jar!/content/rw/wot.js
index ff8611b..6cf105d 100644
--- a/chrome/wot.jar!/content/rw/wot.js
+++ b/chrome/wot.jar!/content/rw/wot.js
@@ -19,7 +19,7 @@
 */
 
 var wot = {
-	version: 20131008,
+	version: 20131030,
 	platform: "firefox",
     locale: "en",           // cached value of the locale
     lang: "en-US",          // cached value of the lang
@@ -114,7 +114,7 @@ var wot = {
 		base:		"http://www.mywot.com/",
 		scorecard:	"http://www.mywot.com/scorecard/",
 		settings:	"http://www.mywot.com/settings",
-		profile:	"http://www.mywot.com/user",
+        profile:	"http://www.mywot.com/user",
         signup:     "https://www.mywot.com/signup",
 		welcome:	"http://www.mywot.com/settings/welcome",
 		setcookies:	"http://www.mywot.com/setcookies.php",
@@ -380,13 +380,11 @@ var wot = {
 			data.message = name + ":" + message;
 			this.log("post: posting " + data.message + "\n");
 			port.postMessage(data);
+		} else {
+			console.warn("Can't find port to send message", name, message, data);
 		}
 	},
 
-	is_allowed_sender: function(sender_id) {
-		return wot.allowed_senders[sender_id] || wot.debug; // allow known senders or any in
-	},
-
 	/* i18n */
 
 	i18n: function(category, id, shorter)
@@ -631,6 +629,8 @@ var wot = {
 		if(wot.env.is_mailru) {
 			// set param to label requests
 			wot.partner = "mailru";
+		} else if (wot.env.is_yandex) {
+			wot.partner = "yandex";
 		}
 
 		if(!readonly) wot.prefs.set("partner", wot.partner);
@@ -885,7 +885,7 @@ var wot = {
                 if (!grp.omnipresent && !type) { // skip only omnipresent, and if type is not set
                     var tmin = grp.tmin !== null ? grp.tmin : -1,
                         tmax = grp.tmax !== null ? grp.tmax : -1;
-                    if ((t0 == -1 && grp.dynamic) || (t0 >= tmin && t0 <= tmax)) {
+                    if (t0 == -1 || (t0 >= tmin && t0 <= tmax)) {
                         return grp;
                     }
                 }
diff --git a/chrome/wot.jar!/content/search.js b/chrome/wot.jar!/content/search.js
index 76da492..5404b95 100644
--- a/chrome/wot.jar!/content/search.js
+++ b/chrome/wot.jar!/content/search.js
@@ -412,7 +412,7 @@ var wot_search =
 				this.rules[name][attr] = wot_prefs.getBool(pref, true);
 			}
 		} catch (e) {
-			dump("wot_search.loadrule: failed with " + e + "\n");
+			wdump("wot_search.loadrule: failed with " + e);
 		}
 	},
 
@@ -428,7 +428,7 @@ var wot_search =
 				this.loadrule(children[i]);
 			}
 		} catch (e) {
-			dump("wot_search.sync: failed with " + e + "\n");
+			wdump("wot_search.sync: failed with " + e);
 		}
 	},
 
@@ -436,15 +436,39 @@ var wot_search =
 
 	domcontentloaded: function(event)
 	{
-
         try {   // Workaround to resolve "TypeError: can't access dead object" at start of the browser
-            if (!event.originalTarget) return;
-        } catch (e) { return; } // do nothing
+            if (!event.originalTarget) {
+	            wdump("event.originalTarget is undefined");
+	            return;
+            }
+        } catch (e) {
+	        return; } // do nothing
 
 		try {
+			event.originalTarget.wot_domloaded = Date.now();
 			wot_search.watch(event.originalTarget);
 		} catch (e) {
-			dump("wot_search.domcontentloaded: failed with " + e + "\n");
+			wdump("wot_search.domcontentloaded: failed with " + e);
+		}
+	},
+
+	pageshow: function(event)
+	{
+        try {   // Workaround to resolve "TypeError: can't access dead object" at start of the browser
+            if (!event.originalTarget) {
+	            wdump("event.originalTarget is undefined");
+	            return;
+            }
+        } catch (e) {
+	        return; } // do nothing
+
+		if (event.originalTarget) {
+			var wot_domloaded = event.originalTarget.wot_domloaded || 0;
+			// check when the last domcontentloaded event was raised,
+			// and if it was long ago, force to watch the DOM again (workaround for caching issue #74)
+			if (Date.now() - wot_domloaded > 800) {
+				wot_search.watch(event.originalTarget);
+			}
 		}
 	},
 
@@ -474,7 +498,7 @@ var wot_search =
 				attributes: true, childList: true, subtree: true
 			});
 		} catch (e) {
-			dump("wot_search.watch: failed with " + e + "\n");
+			wdump("wot_search.watch: failed with " + e);
 		}
 	},
 
diff --git a/chrome/wot.jar!/skin/ratingwindow.css b/chrome/wot.jar!/skin/ratingwindow.css
index 79cc070..d097994 100644
--- a/chrome/wot.jar!/skin/ratingwindow.css
+++ b/chrome/wot.jar!/skin/ratingwindow.css
@@ -399,7 +399,7 @@ body {
     float: left;
     font-size: 11px;
     color: #515151;
-    padding-left: 5px;
+    padding-left: 7px;
     line-height: 15px;
     width: 52px;
     white-space: nowrap;
@@ -410,7 +410,7 @@ body {
 
 /* For Up votes no need to show thumbs up */
 #voted-categories-content .votedcategory.hand-up .category-text {
-    width: 72px;
+    width: 58px;
 }
 
 #voted-categories-content .more-categories {
@@ -429,15 +429,35 @@ body {
 
 .category-hand.hand-up {
     background-color: #FCFCFC;
-    display: none;
+    width: 0;
+    /*display: none;*/
+}
+
+.category-hand.hand-up.c-negative {
+    background-color: #f77448;
+}
+
+.category-hand.hand-up.c-questionable {
+    background-color: #f6cd0e;
+}
+
+.category-hand.hand-up.c-positive {
+    background-color: #6dc14a;
+}
+
+.category-hand.hand-up.c-neutral {
+    background-color: #FCFCFC;
 }
 
 .category-hand.hand-down {
-    /*background-color: #A3A3A3;*/
     background-color: #7DA6DB;
 }
 
-.hand-up .hand-icon,
+.hand-up .hand-icon {
+    width: 12px;
+    height: 14px;
+}
+
 .hand-down .hand-icon {
     background-image: url("chrome://wot/skin/b/thumbs.png");
     background-repeat: no-repeat;
@@ -445,7 +465,6 @@ body {
     height: 14px;
 }
 
-
 .hand-down .hand-icon {
     background-position: -12px 0;
 }
diff --git a/install.rdf b/install.rdf
index 58fc618..324a07b 100644
--- a/install.rdf
+++ b/install.rdf
@@ -4,7 +4,7 @@
 		<em:id>{a0d7ccb3-214d-498b-b4aa-0e8fda9a7bf7}</em:id>
 		<em:unpack>true</em:unpack>
 		<em:name>WOT</em:name>
-		<em:version>20131008</em:version>
+		<em:version>20131030</em:version>
 		<em:description>Web of trust.</em:description>
 		<em:creator>WOT Services Oy</em:creator>
 		<em:homepageURL>http://www.mywot.com/</em:homepageURL>

-- 
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