[Pkg-mozext-commits] [wot] 02/05: Imported Upstream version 20151126
David Prévot
taffit at moszumanska.debian.org
Tue Dec 1 23:23:04 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 11f0309fdfcc77692d3109def1b700b4145031c2
Author: David Prévot <david at tilapin.org>
Date: Tue Dec 1 18:15:15 2015 -0400
Imported Upstream version 20151126
---
META-INF/manifest.mf | 44 ++--
META-INF/mozilla.rsa | Bin 4196 -> 4196 bytes
META-INF/mozilla.sf | 4 +-
content/config.js | 2 +-
content/injections/surveys.widgets.js | 22 +-
content/popup.js | 7 +-
content/rw/proxies.js | 6 +-
content/rw/ratingwindow.js | 40 ++--
content/search.js | 13 +-
content/settings.js | 3 +-
content/surveys.js | 5 +-
content/util.js | 13 +-
content/warning.js | 420 +++++++++++++++++++++++++---------
install.rdf | 4 +-
14 files changed, 404 insertions(+), 179 deletions(-)
diff --git a/META-INF/manifest.mf b/META-INF/manifest.mf
index 69d1fe1..b850486 100644
--- a/META-INF/manifest.mf
+++ b/META-INF/manifest.mf
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
Name: install.rdf
Digest-Algorithms: MD5 SHA1
-MD5-Digest: OJivXlhTAUVGz7Aarj5emg==
-SHA1-Digest: bt51cWqp4WF2ACZ7mBXPsODibyE=
+MD5-Digest: RZ8A6zB3oApm0vAUN50jzQ==
+SHA1-Digest: 6WLpiwQO6Ypd1RC0eJNeJ/JQieY=
Name: chrome.manifest
Digest-Algorithms: MD5 SHA1
@@ -37,8 +37,8 @@ SHA1-Digest: OMv6gcw52lyxTbuzuQfEwvJnnwU=
Name: content/config.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: +A4Ql4mFR2f74nwcqGn31g==
-SHA1-Digest: vS0CGMqsWXoEi4I3x7mMTWN7bn8=
+MD5-Digest: tB2vkxf410b3JyaEkth+dg==
+SHA1-Digest: r1+mOHZSEawSX0ObHQbMEs3cLDI=
Name: content/cookies.js
Digest-Algorithms: MD5 SHA1
@@ -72,8 +72,8 @@ SHA1-Digest: Arv3ldjsVePdbiRfoyXGvvdjDfg=
Name: content/popup.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: sg8PveXzMF+VlzjQqjPgWw==
-SHA1-Digest: E3zCl1L1wTMY/o9iuFdMYyCGX24=
+MD5-Digest: ngWmLa53Y6TltDKvI9mnZg==
+SHA1-Digest: E7dX+QNHX6Px6/4FnbNTzWoA9cw=
Name: content/prefs.js
Digest-Algorithms: MD5 SHA1
@@ -87,13 +87,13 @@ SHA1-Digest: GlY/vjP6nE1+7Aj24LjTKuVu5lA=
Name: content/search.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: sXH47xP2TEThBEFnfHJpVA==
-SHA1-Digest: 2U5dFPIB9u2zuhwSnDx+OYGam/A=
+MD5-Digest: H2jT9fD/bGdTROJhhTfqNA==
+SHA1-Digest: BsjMsAlDIJ/ZrLdgDgmFAnfa/D4=
Name: content/settings.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: jq/Bf87XjqY2kmwfV291WA==
-SHA1-Digest: kZjp+xcNa6cPHcJiT8krBpgB7Zc=
+MD5-Digest: Q5I8DycAEHSsd8RHy9q7qw==
+SHA1-Digest: T2rD8dXYclNVykmk7v9jdAqJysg=
Name: content/settings.xul
Digest-Algorithms: MD5 SHA1
@@ -117,8 +117,8 @@ SHA1-Digest: YyHvcM68UtQ16UHIh6U6INGYn/g=
Name: content/surveys.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: vFYX1IEOJNuiELMNUimPMQ==
-SHA1-Digest: 436xC+MvKxLjgzAjuSXwJwMBWks=
+MD5-Digest: qAHoCAq5JB0lYimcyQNJXA==
+SHA1-Digest: ISOqSwdidSiiP02ooK4k/DOxuaM=
Name: content/tools.js
Digest-Algorithms: MD5 SHA1
@@ -132,13 +132,13 @@ SHA1-Digest: ZdDTkT5meR/xyAlMHlQO/GaeYMk=
Name: content/util.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: HV3rCzkBcBR+HItCbKmCOQ==
-SHA1-Digest: uHYxRBJ4ecp+UNt6q1HVpJpUQyQ=
+MD5-Digest: 1NHo+47ZiZEvcRtLqvrH3g==
+SHA1-Digest: I/FWmvbZvlVWCxda2KxvNbHR5GQ=
Name: content/warning.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: f0PNHm2EKXW8+cFhLZZj7g==
-SHA1-Digest: 4ucCsmpEFdlpmyL5n472bknqooU=
+MD5-Digest: 65CBjYK1uhdW9Bj+nHR73g==
+SHA1-Digest: LTw6a1QJd8aM5308SD8XhrOAR+k=
Name: content/wg.js
Digest-Algorithms: MD5 SHA1
@@ -147,8 +147,8 @@ SHA1-Digest: CUe94YZCPmlQisoAsgXoMRHW9kg=
Name: content/injections/surveys.widgets.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: 2z1YwQkkap+5vEKL8xx2OA==
-SHA1-Digest: UMNVS+OY3H5I30bCz1W6E7kY3Sg=
+MD5-Digest: mX4/2dQ9fI+V8BNcEx1STg==
+SHA1-Digest: nTACYs30Al8ZdEEWqfBbeaFijr8=
Name: content/injections/wot_proxy.js
Digest-Algorithms: MD5 SHA1
@@ -177,8 +177,8 @@ SHA1-Digest: FEfEp9rE/RneZv+aFM06S7dncgU=
Name: content/rw/proxies.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: D6lUkwOb4C2GbhGJn0ahrQ==
-SHA1-Digest: vBy9eqZ7Lo6e1zJiHlitFYmft/Y=
+MD5-Digest: HU+g1kXR6Wm9vZZnilMjIA==
+SHA1-Digest: QRUaXI++yCrkYgZTFbVcjWCvBm8=
Name: content/rw/ratingwindow.html
Digest-Algorithms: MD5 SHA1
@@ -187,8 +187,8 @@ SHA1-Digest: 4XzbnObxvJFWTua8TaXgHqLwIjM=
Name: content/rw/ratingwindow.js
Digest-Algorithms: MD5 SHA1
-MD5-Digest: Io97XQfM8zdHbtIqx1uc4w==
-SHA1-Digest: 5eTmSRYCEs7LgvJTcw9KfczuI3U=
+MD5-Digest: djur8qanZxXyaS6HOjDeIg==
+SHA1-Digest: s0W3dyNO9tvEicPsA5q+gja8fEA=
Name: content/rw/wot.js
Digest-Algorithms: MD5 SHA1
diff --git a/META-INF/mozilla.rsa b/META-INF/mozilla.rsa
index 4ddd9eb..c4660f6 100644
Binary files a/META-INF/mozilla.rsa and b/META-INF/mozilla.rsa differ
diff --git a/META-INF/mozilla.sf b/META-INF/mozilla.sf
index d768590..530a425 100644
--- a/META-INF/mozilla.sf
+++ b/META-INF/mozilla.sf
@@ -1,4 +1,4 @@
Signature-Version: 1.0
-MD5-Digest-Manifest: 8C91c0WwHEUWtk/kpP28hA==
-SHA1-Digest-Manifest: 8WHeoubFaNAFXY/laXLa0TVmghI=
+MD5-Digest-Manifest: be+sLGAxGE6yLlUuByLLKA==
+SHA1-Digest-Manifest: ftdF7qEziMBzn1LG4DMfbl0hwkA=
diff --git a/content/config.js b/content/config.js
index 008cf89..deaf287 100644
--- a/content/config.js
+++ b/content/config.js
@@ -21,7 +21,7 @@
"use strict";
const WOT_PLATFORM = "firefox";
-const WOT_VERSION = "20151113";
+const WOT_VERSION = "20151126";
/*
* Constants
diff --git a/content/injections/surveys.widgets.js b/content/injections/surveys.widgets.js
index 8552c7f..b57e8e2 100644
--- a/content/injections/surveys.widgets.js
+++ b/content/injections/surveys.widgets.js
@@ -135,7 +135,7 @@ var surveys = {
on_slide_stop: function(event, ui) {
var _this = surveys;
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_slidered, _this.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_slidered, _this.target);
},
update_hover_status: function(idx, is_hovered) {
@@ -169,7 +169,7 @@ var surveys = {
on_click: function (event) {
var _this = surveys.slider;
_this.$slider.slider("value", _this.get_idx(event.currentTarget));
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_directclick, _this.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_directclick, _this.target);
},
build_slider: function() {
@@ -274,7 +274,7 @@ var surveys = {
on_close: function (e) {
var _this = surveys;
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_closed, _this.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_closed, _this.target);
// give small time for GA to send event
surveys.report("close", {});
},
@@ -296,18 +296,18 @@ var surveys = {
$tab.show();
$(".button-yes", $tab).click(function () {
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_yes, surveys.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_yes, surveys.target);
surveys.report("optout", {});
});
$(".button-no", $tab).click(function () {
_this.hide_optout();
_this.hide_bottom_section();
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_no, surveys.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_no, surveys.target);
});
_this.is_optout_shown = true;
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_shown, surveys.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_optout_shown, surveys.target);
}
},
@@ -325,7 +325,7 @@ var surveys = {
_this.show_bottom_section();
$btab.show();
_this.is_whatisthis_shown = true;
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_whatisthis, surveys.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_whatisthis, surveys.target);
}
},
@@ -335,7 +335,7 @@ var surveys = {
_this.report("submit", { answer: _this.answer_value });
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_submit, _this.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_submit, _this.target);
_this.ui.hide_bottom_section();
_this.ui.switch_tab("final");
@@ -344,7 +344,7 @@ var surveys = {
on_dismiss: function (e) {
var _this = surveys;
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_dismiss, _this.stats.get_impressions());
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_dismiss, _this.stats.get_impressions());
surveys.report("close", {});
},
@@ -396,7 +396,7 @@ var surveys = {
// report after short delay to make sure GA code is inited
setTimeout(function () {
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_shown, _this.target);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_shown, _this.target);
}, 500);
} else {
@@ -413,7 +413,7 @@ var surveys = {
$(".close-button-secondary").click(function (event) {
_this.ui.hide_bottom_section();
- wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_bottom_close);
+ // wot.ga.fire_event(wot.ga.categories.FBL, wot.ga.actions.FBL_bottom_close);
});
}
};
diff --git a/content/popup.js b/content/popup.js
index 918406e..f40e0b1 100644
--- a/content/popup.js
+++ b/content/popup.js
@@ -138,18 +138,17 @@ var wot_popup =
if (elem.isContentEditable) return false;
- var layer = content.createElement("div");
+ // var layer = content.createElement("div");
+ var layer = wot_util.parse_string_to_html_dom(this.layer);
var accessible_cls = wot_prefs.accessible ? " wot-popup-layer-accessible" : "";
layer.setAttribute("id", this.id);
layer.setAttribute("class", "wot-popup-layer" + accessible_cls);
layer.setAttribute("style", "visibility: hidden;");
- layer.innerHTML = this.layer;
var style = content.createElement("style");
style.setAttribute("type", "text/css");
- style.innerHTML = WOT_POPUP_STYLE;
-
+ style.appendChild(content.createTextNode(WOT_POPUP_STYLE));
var head = content.getElementsByTagName("head");
diff --git a/content/rw/proxies.js b/content/rw/proxies.js
index e27386a..873f796 100644
--- a/content/rw/proxies.js
+++ b/content/rw/proxies.js
@@ -303,9 +303,9 @@ $.extend(wot, { prefs: wot_bg.wot.prefs });
var chrome = {
extension: {
getBackgroundPage: function () {
- if (wot.ga) {
- wot_bg.wot.ga = wot.ga; // init/update the GA object
- }
+ // if (wot.ga) {
+ // wot_bg.wot.ga = wot.ga; // init/update the GA object
+ // }
return wot_bg;
}
},
diff --git a/content/rw/ratingwindow.js b/content/rw/ratingwindow.js
index 40acbed..a2d7b05 100644
--- a/content/rw/ratingwindow.js
+++ b/content/rw/ratingwindow.js
@@ -279,10 +279,10 @@ $.extend(wot, { ratingwindow: {
// count testimony event
if (is_rated) {
- bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_TESTIMONY, submission_mode);
- bgwot.core.last_testimony = Date.now(); // remember when user rated last time
+ // bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_TESTIMONY, submission_mode);
+ // bgwot.core.last_testimony = Date.now(); // remember when user rated last time
} else {
- bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_TESTIMONY_DEL, submission_mode);
+ // bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_TESTIMONY_DEL, submission_mode);
}
} else {
@@ -294,7 +294,7 @@ $.extend(wot, { ratingwindow: {
if (comment_changed) {
// when comment body is changed, we might want to store it locally
bgwot.keeper.save_comment(target, user_comment, user_comment_id, votes, wot.keeper.STATUSES.LOCAL);
- bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTKEPT);
+ // bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTKEPT);
}
} else { // User clicked Save
@@ -309,7 +309,7 @@ $.extend(wot, { ratingwindow: {
if (rw.comments.allow_commenting && rw.is_registered) {
bgwot.api.comments.submit(target, user_comment, user_comment_id, rw._make_votes(votes));
- bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTADDED);
+ // bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTADDED);
}
} else {
@@ -318,7 +318,7 @@ $.extend(wot, { ratingwindow: {
bgwot.keeper.remove_comment(target);
if (rw.is_registered) {
bgwot.api.comments.remove(target);
- bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTREMOVED);
+ // bgwot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_COMMENTREMOVED);
}
}
}
@@ -639,7 +639,7 @@ $.extend(wot, { ratingwindow: {
}
if (!data.target) {
- bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_NOTARGET);
+ // bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_NOTARGET);
}
} catch (e) {
console.log("ratingwindow.update: failed with ", e);
@@ -777,7 +777,7 @@ $.extend(wot, { ratingwindow: {
// fire the event to GA, providing amount of minutes from installation to opening rating window
var bg = chrome.extension.getBackgroundPage();
var timesincefirstrun = Math.round((bg.wot.time_sincefirstrun() + 0.5) / wot.DT.MINUTE);
- wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_SHOWN, String(timesincefirstrun));
+ // wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_SHOWN, String(timesincefirstrun));
}, 500);
},
@@ -1062,8 +1062,8 @@ $.extend(wot, { ratingwindow: {
});
$("#wot-header-link-profile").bind("click", function() {
- bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_PROFILELNK,
- _rw.is_registered ? "registered" : "unregistered");
+ // bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_PROFILELNK,
+ // _rw.is_registered ? "registered" : "unregistered");
wot.ratingwindow.navigate(wurls.geturl(wurls.profile), wurls.contexts.rwprofile);
});
@@ -1076,7 +1076,7 @@ $.extend(wot, { ratingwindow: {
});
$("#wot-header-close").bind("click", function() {
- bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_BTN_CLOSE);
+ // bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_BTN_CLOSE);
_rw.hide();
});
@@ -1099,7 +1099,7 @@ $.extend(wot, { ratingwindow: {
var url = $("#wot-message-text").attr("url");
if (url) {
var label = wot.i18n("locale") + "__" + $(this).attr("msg_id");
- bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_MSG_CLICKED, label);
+ // bg.wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_MSG_CLICKED, label);
wot.ratingwindow.navigate(url, wurls.contexts.rwmsg);
}
});
@@ -1202,13 +1202,13 @@ $.extend(wot, { ratingwindow: {
wt.save_setting("rw_ok");
var time_before_click = Math.round(wot.time_since(wot.ratingwindow.opened_time));
- wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_OK, String(time_before_click));
+ // wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_OK, String(time_before_click));
});
// Welcome Tip "learn more" link handler
$("#wt-learnmore-link").bind("click", function (){
var time_before_click = Math.round(wot.time_since(wot.ratingwindow.opened_time));
- wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_LEARN, String(time_before_click));
+ // wot.ga.fire_event(wot.ga.categories.WT, wot.ga.actions.WT_RW_LEARN, String(time_before_click));
bg.wot.core.open_mywot(wot.urls.tour_rw, wot.urls.contexts.wt_rw_lm); // FIXME
});
@@ -1272,14 +1272,14 @@ $.extend(wot, { ratingwindow: {
// do some stats collection
if (_rw.comments.is_commented()) {
- wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_EDITCOMMENT);
+ // wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_EDITCOMMENT);
} else {
- wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_ADDCOMMENT);
+ // wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_ADDCOMMENT);
}
break;
case "comment":
_rw.modes.rate.activate();
- wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_PICKACAT);
+ // wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_PICKACAT);
break;
}
},
@@ -1328,7 +1328,7 @@ $.extend(wot, { ratingwindow: {
bg.wot.keeper.remove_comment(_rw.state.target); // remove locally saved comment
_rw.update_comment(cached, null); // restore comment to server-side version
- wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_BTNCANCEL);
+ // wot.ga.fire_event(wot.ga.categories.RW, wot.ga.actions.RW_BTNCANCEL);
_rw.modes.auto(); // switch RW mode according to current state
},
@@ -2506,9 +2506,9 @@ $.extend(wot, { ratingwindow: {
caret_bottom: null,
AUTOCOMPLETE_OFFSET_X: -20,
- get_comment_value: function (need_html) {
+ get_comment_value: function () {
var elem = $("#user-comment")[0],
- s = need_html ? elem.innerHTML : elem.textContent; // different in Firefox
+ s = elem.textContent; // different in Firefox
s = typeof(s) == "string" ? s.trim() : "";
diff --git a/content/search.js b/content/search.js
index 382134f..bc04fc7 100644
--- a/content/search.js
+++ b/content/search.js
@@ -590,7 +590,7 @@ var wot_search =
"height: 16px;" +
"display: inline-block;");
- elem.innerHTML = " ";
+ elem.appendChild(document.createTextNode("\u00A0"));
elem.addEventListener("click", this.onclick, false);
if(is_ninja) {
@@ -676,7 +676,7 @@ var wot_search =
/* Match by content */
if (match.value && match.value.length) {
- if (!elem.innerHTML) {
+ if (!elem.hasChildNodes) {
return false;
}
@@ -1152,11 +1152,12 @@ var wot_search =
if (!sandbox) {
var wnd = new XPCNativeWrapper(content.defaultView);
- var sandbox = new Components.utils.Sandbox(wnd);
+ var sandbox = new Components.utils.Sandbox(wnd, {
+ sandboxPrototype: wnd
+ });
sandbox.window = wnd;
sandbox.document = sandbox.window.document;
- sandbox.__proto__ = sandbox.window;
sandbox.wot_loadscript =
this.getsandboxfunc(sandbox, "loadscript");
@@ -1198,7 +1199,9 @@ var wot_search =
if (id) {
style.setAttribute("id", id);
}
- style.innerHTML = css;
+
+ var text_node = content.createTextNode(css);
+ style.appendChild(text_node);
var head = content.getElementsByTagName("head");
diff --git a/content/settings.js b/content/settings.js
index e78c9f9..1d27c13 100644
--- a/content/settings.js
+++ b/content/settings.js
@@ -184,7 +184,8 @@ var wot_settings =
var script = content.createElement("script");
script.setAttribute("type", "text/javascript");
- script.innerHTML = js;
+ var text_node = content.createTextNode(js);
+ script.appendChild(text_node);
var body = content.getElementsByTagName("body");
diff --git a/content/surveys.js b/content/surveys.js
index f0784cd..57f8306 100644
--- a/content/surveys.js
+++ b/content/surveys.js
@@ -134,11 +134,12 @@ var wot_surveys = {
if (!sandbox) {
var wnd = new XPCNativeWrapper(content.defaultView);
- sandbox = new Components.utils.Sandbox(wnd);
+ sandbox = new Components.utils.Sandbox(wnd, {
+ sandboxPrototype: wnd
+ });
sandbox.window = wnd;
sandbox.document = sandbox.window.document;
- sandbox.__proto__ = sandbox.window;
sandbox.wot_post = wot_search.getsandboxfunc(sandbox, "wot_post", wot_surveys.sandboxapi);
diff --git a/content/util.js b/content/util.js
index 98c896d..25be6ca 100644
--- a/content/util.js
+++ b/content/util.js
@@ -201,7 +201,18 @@ var wot_util =
return str.replace(/[&<>]/g, function(symb) {
return tagsToReplace[symb] || symb;
});
- }
+ },
+ parse_string_to_html_dom: function(str, wrapping_element) {
+ wrapping_element = wrapping_element ? wrapping_element : "div";
+ str = "<" + wrapping_element + ">" + str + "</" + wrapping_element + ">";
+
+ var parserUtils = Components.classes["@mozilla.org/parserutils;1"]
+ .getService(Components.interfaces.nsIParserUtils);
+ var dummy_element = document.createElementNS("http://www.w3.org/1999/xhtml","div");
+ var html_dom = parserUtils.parseFragment(str, 0, false, null, dummy_element).lastChild;
+
+ return html_dom;
+ }
};
var wot_url =
diff --git a/content/warning.js b/content/warning.js
index bc9becb..ad6af66 100644
--- a/content/warning.js
+++ b/content/warning.js
@@ -31,46 +31,61 @@ var wot_warning =
warned: {},
current_tab: null, // hostname + tabIndex to understand, whether the warning already updated for the tab
- make_categories_block: function (categories, options) {
-
- var tmpl = '';
-// console.log("make_categories_block", categories);
+ make_categories_block: function (categories, options, replaces_keywords, doc) {
+ var tmpl = false;
if (!wot_util.isEmpty(categories)) {
+ tmpl = {};
var lst = [],
ordered_cats = wot_categories.rearrange_categories(categories).all;
for (var k in ordered_cats) {
var cat = ordered_cats[k], cid = cat.id,
cconf = wot_util.get_level(WOT_CONFIDENCELEVELS, cat.c).name,
css = wot_categories.get_category_css(cid),
- cat_name = wot_categories.get_category_name(cid),
- li = "<li class='cat-item " + css + " " + cconf + "'>" + cat_name + "</li>";
+ cat_name = wot_categories.get_category_name(cid);
+ var li = doc.createElement("li");
+ li.className = "cat-item " + css + " " + cconf;
+ li.appendChild(doc.createTextNode(cat_name));
if (cat_name) {
lst.push(li);
}
}
- tmpl = "<div class='ws-categories-title'>{REASONTITLE}</div>" +
- "<ul id='ws-categories-list'>" +
- lst.join("") +
- "</ul>";
+ tmpl["div"] = doc.createElement("div");
+ tmpl["div"].className = "ws-categories-title";
+ tmpl["div"].appendChild(doc.createTextNode(replaces_keywords.get("REASONTITLE")));
+
+ tmpl["ul"] = doc.createElement("ul");
+ tmpl["ul"].id = "ws-categories-list";
+ for (var i in lst) {
+ tmpl["ul"].appendChild(lst[i]);
+ }
}
return tmpl;
-
},
- make_blacklists: function(blacklists, options) {
+ make_blacklists: function(blacklists, options, replaces_keywords, doc) {
- var bl = blacklists || [],
- tmpl = "";
+ var bl = blacklists || [];
+ var tmpl = false, div_1, div_2, div_3;
if (bl && bl.length > 0) {
- tmpl = "<div class='wot-blacklisting-info'>" +
- "<div class='wot-blacklist'>" +
- "<div class='wot-bl-decoration'>" +
- "<div class='wot-comp-icon wot-bl-decoration-donut' r='{RATING0}'></div>" +
- "</div>";
+ var tmpl = doc.createElement("div");
+ tmpl.className = "wot-blacklisting-info";
+
+ var div_1 = doc.createElement("div");
+ div_1.className = "wot-blacklist";
+ tmpl.appendChild(div_1);
+
+ var div_2 = doc.createElement("div");
+ div_2.className = "wot-bl-decoration";
+ div_1.appendChild(div_2);
+
+ var div_3 = doc.createElement("div");
+ div_3.setAttribute("r", replaces_keywords.get("RATING0"));
+ div_3.className = "wot-comp-icon wot-bl-decoration-donut";
+ div_2.appendChild(div_3);
// the blacklist is unordered. We can order it in later versions by time or by risk level.
for (var i = 0, bl_type=""; i < 5; i++) {
@@ -78,87 +93,272 @@ var wot_warning =
bl_type = wot_util.getstring("bl_" + bl[i].type);
bl_type = bl_type ? bl_type : wot_util.getstring("bl_other");
- tmpl += "<div class='wot-bl-verdict'>" + bl_type + "</div>"
+ var div_4 = doc.createElement("div");
+ div_4.className = "wot-bl-verdict";
+ div_4.appendChild(doc.createTextNode(bl_type));
} else {
- tmpl += "<div class='wot-bl-verdict empty'></div>";
+ div_4.className += " empty";
}
}
- tmpl += "</div></div>";
+ div_1.appendChild(div_4);
}
return tmpl;
},
- make_warning: function(categories, blacklists, options)
+ make_warning: function(categories, blacklists, options, replaces, doc)
{
- var wot_warning =
- "<div id='wotcontainer' class='wotcontainer {CLASS} {ACCESSIBLE} {BL_OR_REP} notranslate'>" +
- "<div class='wot-logo'></div>" +
- "<div class='wot-warning'>{WARNING}</div>" +
- "<div class='wot-title'>{TITLE}</div>" +
- "<div id='wot-wt-warning-wrapper' style='display: none;'>" +
- "<div class='wot-wt-warning-content'>" +
- "<div id='wt-logo' class='wot-wt-logo'> </div>" +
- "<div>{WT_CONTENT}</div>" +
- "<div><label><input id='wt-warn-turnoff' type='checkbox' class='wot-checkbox' /> {WT_WARN_TURNOFF}</label></div>" +
- "<div class='wot-wt-warn-footer'>" +
- "<div id='wt-warn-ok' class='wot-wt-button wot-wt-warn-button'>{WT_BUTTON}</div>" +
- "</div>" +
- "</div>" +
- "</div>" +
- "<div class='wot-desc'>{DESC}</div>" +
-
- this.make_blacklists(blacklists, options) +
-
- "<div class='wot-rep-components-wrapper'>" +
- "<div class='wot-rep-components'>" +
- "<div class='wot-component'>" +
- "<div class='wot-comp-name'>{RATINGDESC0}</div>" +
- "<div class='wot-rep-data'>" +
- "<div class='wot-comp-icon' r='{RATING0}'></div>" +
- "<div class='wot-comp-conf' c='{CONFIDENCE0}'></div>" +
- "<div class='rating-legend-wrapper'>" +
- "<div class='rating-legend' r='{RATING0}'>{RATINGEXPL0}</div>" +
- "</div>" +
- "</div>" +
- "</div>" +
- "<div class='wot-component'>" +
- "<div class='wot-comp-name'>{RATINGDESC4}</div>" +
- "<div class='wot-rep-data'>" +
- "<div class='wot-comp-icon' r='{RATING4}'></div>" +
- "<div class='wot-comp-conf' c='{CONFIDENCE4}'></div>" +
- "<div class='rating-legend-wrapper'>" +
- "<div class='rating-legend' r='{RATING4}'>{RATINGEXPL4}</div>" +
- "</div>" +
- "</div>" +
- "</div>" +
- "</div>" +
- "</div>" +
- "<div class='ws-categories-area'>" +
-
- this.make_categories_block(categories, options) +
-
- "</div>"+
- "<div class='wot-openscorecard-wrap'>" +
- "<span class='wot-openscorecard'>{INFO}</span>" +
- "</div>" +
- "<div id='wot-warn-ratings'></div>" +
- "<div class='wot-rateit-wrap'>" +
- "<span>{RATETEXT}</span>" +
- "</div>" +
- "<div class='wot-buttons'>";
-
- if(!this.is_blocked) {
- // don't show "Goto the site" button in "Blocked" mode
- wot_warning += "<div id='wot-btn-hide' class='wot-button'>{GOTOSITE}</div>";
- }
+ var generate_keywords = function(replaces) {
+ var keywords = {};
+ for (var i in replaces) {
+ var key = replaces[i][0];
+ var value = replaces[i][1];
+ keywords[key] = value;
+ }
+
+ return keywords;
+ };
+
+ var set_class = function(element, class_names) {
+ if (class_names instanceof Array) {
+ for (var i in class_names) {
+ element.className += " " + class_names[i];
+ }
+ } else { element.className = class_names; }
+ };
+
+ var keywords = generate_keywords(replaces);
+ keywords.get = function(keyword) {
+ if (this[keyword] === undefined) {
+ return "";
+ }
+ return this[keyword];
+ };
+
+ var div_wotcontainer = doc.createElement('div');
+ set_class(div_wotcontainer, ["wotcontainer", keywords.get("CLASS"), keywords.get("ACCESSIBLE"), keywords.get("BL_OR_REP"), "notranslate"]);
+ div_wotcontainer.id = "wotcontainer";
+
+ var div_0 = doc.createElement('div');
+ div_0.className = "wot-logo";
+ div_wotcontainer.appendChild(div_0);
+
+
+ var div_1 = doc.createElement('div');
+ div_1.className = "wot-warning";
+ div_1.appendChild(doc.createTextNode(keywords.get("WARNING")));
+ div_wotcontainer.appendChild(div_1);
+
+
+ var div_2 = doc.createElement('div');
+ div_2.className = "wot-title";
+ div_2.appendChild(doc.createTextNode(keywords.get("TITLE")));
+ div_wotcontainer.appendChild(div_2);
+
+
+ var div_wotWtWarningWrapper = doc.createElement('div');
+ div_wotWtWarningWrapper.style.display = "none";
+ div_wotWtWarningWrapper.id = "wot-wt-warning-wrapper";
+
+ var div_3 = doc.createElement('div');
+ div_3.className = "wot-wt-warning-content";
+
+ var div_wtLogo = doc.createElement('div');
+ div_wtLogo.className = "wot-wt-logo";
+ div_wtLogo.id = "wt-logo";
+ div_wtLogo.appendChild(doc.createTextNode("\u00a0"));
+ div_3.appendChild(div_wtLogo);
+
+ var div_4 = keywords.get("WT_CONTENT");
+ div_3.appendChild(div_4);
+
+
+ var div_5 = doc.createElement('div');
+
+ var label_0 = doc.createElement('label');
+
+ var input_wtWarnTurnoff = doc.createElement('input');
+ input_wtWarnTurnoff.id = "wt-warn-turnoff";
+ input_wtWarnTurnoff.className = "wot-checkbox";
+ input_wtWarnTurnoff.type = "checkbox";
+ label_0.appendChild(input_wtWarnTurnoff);
+
+ label_0.appendChild(doc.createTextNode(" " + keywords.get("WT_WARN_TURNOFF")));
+ div_5.appendChild(label_0);
+
+ div_3.appendChild(div_5);
+
+
+ var div_6 = doc.createElement('div');
+ div_6.className = "wot-wt-warn-footer";
+
+ var div_wtWarnOk = doc.createElement('div');
+ div_wtWarnOk.className = "wot-wt-button wot-wt-warn-button";
+ div_wtWarnOk.id = "wt-warn-ok";
+ div_wtWarnOk.appendChild(doc.createTextNode(keywords.get("WT_BUTTON")));
+ div_6.appendChild(div_wtWarnOk);
+
+ div_3.appendChild(div_6);
+
+ div_wotWtWarningWrapper.appendChild(div_3);
+
+ div_wotcontainer.appendChild(div_wotWtWarningWrapper);
+
+
+ var div_7 = keywords.get("DESC");
+ div_7.className = "wot-desc";
+ div_wotcontainer.appendChild(div_7);
+
+ var blacklists = this.make_blacklists(blacklists, options, keywords, doc);
+ if (blacklists) {
+ div_wotcontainer.appendChild(blacklists);
+ }
+
+ var div_8 = doc.createElement('div');
+ div_8.className = "wot-rep-components-wrapper";
+
+ var div_9 = doc.createElement('div');
+ div_9.className = "wot-rep-components";
+
+ var div_10 = doc.createElement('div');
+ div_10.className = "wot-component";
+
+ var div_11 = doc.createElement('div');
+ div_11.className = "wot-comp-name";
+ div_11.appendChild(doc.createTextNode(keywords.get("RATINGDESC0")));
+ div_10.appendChild(div_11);
+
+
+ var div_12 = doc.createElement('div');
+ div_12.className = "wot-rep-data";
+
+ var div_13 = doc.createElement('div');
+ div_13.setAttribute("r", keywords.get("RATING0"));
+ div_13.className = "wot-comp-icon";
+ div_12.appendChild(div_13);
+
+
+ var div_14 = doc.createElement('div');
+ div_14.setAttribute("c", keywords.get("CONFIDENCE0"));
+ div_14.className = "wot-comp-conf";
+ div_12.appendChild(div_14);
- wot_warning += "<div id='wot-btn-leave' class='wot-button'>{LEAVESITE}</div>" +
- "</div>" +
- "</div>";
- return wot_warning;
+ var div_15 = doc.createElement('div');
+ div_15.className = "rating-legend-wrapper";
+
+ var div_16 = doc.createElement('div');
+ div_16.setAttribute("r", keywords.get("RATING0"));
+ div_16.className = "rating-legend";
+ div_16.appendChild(doc.createTextNode(keywords.get("RATINGEXPL0")));
+ div_15.appendChild(div_16);
+
+ div_12.appendChild(div_15);
+
+ div_10.appendChild(div_12);
+
+ div_9.appendChild(div_10);
+
+
+ var div_17 = doc.createElement('div');
+ div_17.className = "wot-component";
+
+ var div_18 = doc.createElement('div');
+ div_18.className = "wot-comp-name";
+ div_18.appendChild(doc.createTextNode(keywords.get("RATINGDESC4")));
+ div_17.appendChild(div_18);
+
+
+ var div_19 = doc.createElement('div');
+ div_19.className = "wot-rep-data";
+
+ var div_20 = doc.createElement('div');
+ div_20.setAttribute("r", keywords.get("RATING4"));
+ div_20.className = "wot-comp-icon";
+ div_19.appendChild(div_20);
+
+
+ var div_21 = doc.createElement('div');
+ div_21.setAttribute("c", keywords.get("CONFIDENCE4"));
+ div_21.className = "wot-comp-conf";
+ div_19.appendChild(div_21);
+
+
+ var div_22 = doc.createElement('div');
+ div_22.className = "rating-legend-wrapper";
+
+ var div_23 = doc.createElement('div');
+ div_23.setAttribute("r", keywords.get("RATING4"));
+ div_23.className = "rating-legend";
+ div_23.appendChild(doc.createTextNode(keywords.get("RATINGEXPL4")));
+ div_22.appendChild(div_23);
+
+ div_19.appendChild(div_22);
+
+ div_17.appendChild(div_19);
+
+ div_9.appendChild(div_17);
+
+ div_8.appendChild(div_9);
+
+ div_wotcontainer.appendChild(div_8);
+
+
+ var div_24 = doc.createElement('div');
+ div_24.className = "ws-categories-area";
+ div_wotcontainer.appendChild(div_24);
+
+ var categories_block = this.make_categories_block(categories, options, keywords, doc);
+ if (categories_block) {
+ div_24.appendChild(categories_block["div"]);
+ div_24.appendChild(categories_block["ul"]);
+ }
+
+ var div_25 = doc.createElement('div');
+ div_25.className = "wot-openscorecard-wrap";
+
+ var span_0 = keywords.get("INFO");
+ span_0.className = "wot-openscorecard";
+ div_25.appendChild(span_0);
+
+ div_wotcontainer.appendChild(div_25);
+
+
+ var div_wotWarnRatings = doc.createElement('div');
+ div_wotWarnRatings.id = "wot-warn-ratings";
+ div_wotcontainer.appendChild(div_wotWarnRatings);
+
+
+ var div_26 = doc.createElement('div');
+ div_26.className = "wot-rateit-wrap";
+
+ var span_1 = keywords.get("RATETEXT");
+ div_26.appendChild(span_1);
+
+ div_wotcontainer.appendChild(div_26);
+
+
+ var div_27 = doc.createElement('div');
+ div_27.className = "wot-buttons";
+
+ if(!this.is_blocked) {
+ var div_wotBtnHide = doc.createElement('div');
+ div_wotBtnHide.className = "wot-button";
+ div_wotBtnHide.id = "wot-btn-hide";
+ div_wotBtnHide.appendChild(doc.createTextNode(keywords.get("GOTOSITE")));
+ div_27.appendChild(div_wotBtnHide);
+ }
+
+ var div_wotBtnLeave = doc.createElement('div');
+ div_wotBtnLeave.className = "wot-button";
+ div_wotBtnLeave.id = "wot-btn-leave";
+ div_wotBtnLeave.appendChild(doc.createTextNode(keywords.get("LEAVESITE")));
+ div_27.appendChild(div_wotBtnLeave);
+
+ div_wotcontainer.appendChild(div_27);
+
+ return div_wotcontainer;
},
load_delayed: function(blocked)
@@ -574,6 +774,7 @@ var wot_warning =
// preprocess link "Rate the site"
var rate_site = wot_util.getstring("warnings_ratesite").replace("<a>", "<a id='wotrate-link' class='wot-link'>"),
wt_text = wot_util.getstring("wt_warning_text") || "";
+ wt_text = this.processhtml(wt_text, [ "WT_LEARNMORE", wot_util.getstring("wt_learnmore_link") ]);
var info_link = is_blacklisted ? wot_util.getstring("bl_information") : wot_util.getstring("warnings_information");
if (info_link.indexOf("<a>") < 0) {
@@ -583,14 +784,14 @@ var wot_warning =
var replaces = [
/* Static strings */
- [ "INFO", info_link ],
+ [ "INFO", wot_util.parse_string_to_html_dom(info_link, "span") ],
[ "BL_OR_REP", is_blacklisted ? "blacklist": "reputation" ],
[ "RATINGDESC0", wot_util.getstring("components_0") ],
[ "RATINGDESC4", wot_util.getstring("components_4") ],
[ "GOTOSITE", wot_util.getstring("warnings_goto") ],
[ "WARNING", blocking_mode ? wot_util.getstring("warnings_blocked") : wot_util.getstring("warnings_warning") ],
- [ "RATETEXT", rate_site ],
- [ "WT_CONTENT", this.processhtml(wt_text, [ "WT_LEARNMORE", wot_util.getstring("wt_learnmore_link") ])],
+ [ "RATETEXT", wot_util.parse_string_to_html_dom(rate_site, "span") ],
+ [ "WT_CONTENT", wot_util.parse_string_to_html_dom(wt_text)],
[ "REASONTITLE", wot_util.getstring("warnings_reasontitle") ],
[ "NOREASONTITLE", wot_util.getstring("warnings_noreasontitle") ],
@@ -600,8 +801,6 @@ var wot_warning =
[ "ACCESSIBLE", accessible ]
];
- var warning_template = this.make_warning(wot_categories.select_identified(categories), blacklists, warning_options);
-
for (var j = 0; j < WOT_COMPONENTS.length; ++j) {
var i = WOT_COMPONENTS[j];
@@ -657,16 +856,19 @@ var wot_warning =
if (reason == WOT_REASON_RATING) {
notification = wot_util.getstring("warnings_message_reputation");
+ var warnings_reputation = wot_util.getstring("warnings_reputation");
replaces.push([ "CLASS", warnclass ]);
- replaces.push([ "DESC", wot_util.getstring("warnings_reputation") ]);
+ replaces.push([ "DESC", wot_util.parse_string_to_html_dom(warnings_reputation)]);
} else if (reason == WOT_REASON_TESTIMONY) {
notification = wot_util.getstring("warnings_message_rating");
- replaces.push([ "CLASS", "wotnoratings" ]);
- replaces.push([ "DESC", wot_util.getstring("warnings_rating") ]);
+ var warnings_rating = wot_util.getstring("warnings_rating");
+ replaces.push([ "CLASS", "wotnoratings"]);
+ replaces.push([ "DESC", wot_util.parse_string_to_html_dom(warnings_rating)]);
} else {
notification = wot_util.getstring("warnings_unknown");
+ var warnings_unknown = wot_util.getstring("warnings_unknown");
replaces.push([ "CLASS", warnclass ]);
- replaces.push([ "DESC", wot_util.getstring("warnings_unknown") ]);
+ replaces.push([ "DESC", wot_util.parse_string_to_html_dom(warnings_unknown)]);
}
}
@@ -707,22 +909,30 @@ var wot_warning =
style.setAttribute("type", "text/css");
style.setAttribute("id", "warning-style");
- style.innerHTML = WOT_WARNING_CSS;
+ var text_node = warning_content.createTextNode(WOT_WARNING_CSS);
+ style.appendChild(text_node);
head[0].appendChild(style);
}
+ var warning_template = null;
var wrapper = warning_content.getElementById("wotwrapper");
+ if (wrapper) {
+ warning_template = wrapper.childNodes[0];
+ wrapper.parentNode.removeChild(wrapper);
+ }
+ wrapper = warning_content.createElement("div");
if (!wrapper) {
- wrapper = warning_content.createElement("div");
- if (!wrapper) {
- return false;
- }
- wrapper.setAttribute("id", "wotwrapper");
- body[0].appendChild(wrapper);
+ return false;
+ }
+ wrapper.setAttribute("id", "wotwrapper");
+ body[0].appendChild(wrapper);
+
+ if (!warning_template) {
+ warning_template = this.make_warning(wot_categories.select_identified(categories), blacklists, warning_options, replaces, warning_content);
}
- wrapper.innerHTML = this.processhtml(warning_template, replaces);
+ wrapper.appendChild(warning_template);
// setup listeners
var lmap = [
diff --git a/install.rdf b/install.rdf
index 01dd720..0c242bb 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>20151113</em:version>
+ <em:version>20151126</em:version>
<em:description>Web of trust.</em:description>
<em:creator>WOT Services Oy</em:creator>
<em:homepageURL>http://www.mywot.com/</em:homepageURL>
@@ -16,7 +16,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>14.0</em:minVersion>
- <em:maxVersion>41.*</em:maxVersion>
+ <em:maxVersion>43.*</em:maxVersion>
</Description>
</em:targetApplication>
--
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