[Pkg-mozext-commits] [wot] 93/226: Links on RW are alive now; RW is updated correctly.
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:38 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 3e759d4eefd14f55f0724df04fdc671facec08f7
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Thu Aug 1 17:33:13 2013 +0300
Links on RW are alive now; RW is updated correctly.
---
content/commands.js | 143 ++++++++--------
content/config.js | 3 +
content/overlay.xul | 35 ++--
content/ratingwindow.js | 50 +++---
content/rw/ratingwindow.js | 15 +-
content/ui.js | 414 ++++++++++++++++++++++-----------------------
content/util.js | 47 ++---
7 files changed, 352 insertions(+), 355 deletions(-)
diff --git a/content/commands.js b/content/commands.js
index e52e91d..1ebad9d 100644
--- a/content/commands.js
+++ b/content/commands.js
@@ -118,14 +118,14 @@ var wot_commands =
setAttribute("disabled", !wot_util.isenabled() || !cached);
/* Quick testimonies */
- var quicks = [];
+ var i, quicks = [];
- for (var i = 0; i < 5; ++i) {
+ for (i = 0; i < 5; ++i) {
quicks[i] = document.getElementById("wot-" + what +
"-testify-" + (i + 1));
}
- for (var i = 0; i < quicks.length; ++i) {
+ for (i = 0; i < quicks.length; ++i) {
quicks[i].setAttribute("disabled",
!wot_prefs.enabled || !cached);
quicks[i].setAttribute("checked", false);
@@ -158,7 +158,7 @@ var wot_commands =
wot_prefs.setBool("enabled", wot_prefs.enabled);
wot_core.update();
} catch (e) {
- dump("wot_commands.enabled: failed with " + e + "\n");
+ wdump("wot_commands.enabled: failed with " + e);
}
},
@@ -166,12 +166,11 @@ var wot_commands =
{
try {
if (wot_cache.iscached(wot_core.hostname)) {
- wot_cache.set(wot_core.hostname, "status",
- WOT_QUERY_RETRY);
+ wot_cache.set(wot_core.hostname, "status", WOT_QUERY_RETRY);
wot_core.update();
}
} catch (e) {
- dump("wot_commands.refresh: failed with " + e + "\n");
+ wdump("wot_commands.refresh: failed with " + e);
}
},
@@ -220,11 +219,11 @@ var wot_commands =
}
},
- openlinkscorecard: function(event)
+ open_scorecard_link: function()
{
+ // Opens scorecard in a new tab for the URL selected via context menu
try {
- wot_browser.openscorecard(wot_commands.getcontexthostname(),
- null, WOT_URL_CTX);
+ wot_browser.openscorecard(wot_commands.getcontexthostname(), null, WOT_URL_CTX);
} catch (e) {
}
}
@@ -271,68 +270,68 @@ var wot_events =
return pos;
},
- /* Handles testimony slider events and updates the new pending testimony to
- query cache */
- slider_down: function(event, testimony)
- {
- try {
- if (!wot_cache.isok(wot_core.hostname)) {
- return false;
- }
-
- this.testimonydown = testimony;
-
- var pos = this.get_slider_pos(event, testimony);
- if (pos < 0) {
- return false;
- }
-
- /* Insert into cache */
- if (wot_cache.get(wot_core.hostname, "testimony_" +
- testimony) != pos) {
- wot_cache.set(wot_core.hostname, "testimony_" +
- testimony, Number(pos));
- wot_cache.set(wot_core.hostname, "pending", true);
- wot_core.pending[wot_core.hostname] = true;
-
- /* Update testimony window */
- wot_ui.update_testimonies();
- }
-
- /* Any pending testimonies will be stored in wot_core.update,
- which is called when the popup window is closed */
- return true;
- } catch (e) {
- dump("wot_events.slider: failed with " + e + "\n");
- }
- return false;
- },
-
- slider_up: function(event, testimony)
- {
- this.testimonydown = -1;
- return true;
- },
-
- slider_move: function(event, testimony)
- {
- /* Apparently, there is no way to detect if the mouse button is
- down besides counting clicks. This means that if the mouse
- button is released while outside the window, we won't be able
- to detect it and the slider keeps moving... */
- if (this.testimonydown == testimony) {
- this.slider_down(event, testimony);
- } else {
- this.testimonydown = -1;
- if (wot_cache.isok(wot_core.hostname)) {
- var pos = this.get_slider_pos(event, testimony);
- if (pos >= 0) {
- wot_ui.update_testimonies(testimony, pos);
- }
- }
- }
- return true;
- },
+// /* Handles testimony slider events and updates the new pending testimony to
+// query cache */
+// slider_down: function(event, testimony)
+// {
+// try {
+// if (!wot_cache.isok(wot_core.hostname)) {
+// return false;
+// }
+//
+// this.testimonydown = testimony;
+//
+// var pos = this.get_slider_pos(event, testimony);
+// if (pos < 0) {
+// return false;
+// }
+//
+// /* Insert into cache */
+// if (wot_cache.get(wot_core.hostname, "testimony_" +
+// testimony) != pos) {
+// wot_cache.set(wot_core.hostname, "testimony_" +
+// testimony, Number(pos));
+// wot_cache.set(wot_core.hostname, "pending", true);
+// wot_core.pending[wot_core.hostname] = true;
+//
+//// /* Update testimony window */
+//// wot_ui.update_testimonies();
+// }
+//
+// /* Any pending testimonies will be stored in wot_core.update,
+// which is called when the popup window is closed */
+// return true;
+// } catch (e) {
+// dump("wot_events.slider: failed with " + e + "\n");
+// }
+// return false;
+// },
+
+// slider_up: function(event, testimony)
+// {
+// this.testimonydown = -1;
+// return true;
+// },
+
+// slider_move: function(event, testimony)
+// {
+// /* Apparently, there is no way to detect if the mouse button is
+// down besides counting clicks. This means that if the mouse
+// button is released while outside the window, we won't be able
+// to detect it and the slider keeps moving... */
+// if (this.testimonydown == testimony) {
+// this.slider_down(event, testimony);
+// } else {
+// this.testimonydown = -1;
+// if (wot_cache.isok(wot_core.hostname)) {
+// var pos = this.get_slider_pos(event, testimony);
+// if (pos >= 0) {
+// wot_ui.update_testimonies(testimony, pos);
+// }
+// }
+// }
+// return true;
+// },
click_button: function(event)
{
diff --git a/content/config.js b/content/config.js
index 63ffa7a..7050632 100644
--- a/content/config.js
+++ b/content/config.js
@@ -288,6 +288,7 @@ const wot_prefs_bool = [
// [ "warning_unknown_5", false ],
[ "feedback_enabled", true ],
[ "feedback_optedout", false ],
+ [ "show_fulllist", false ],
[ "super_showtestimonies", false ] // show my rating on the search popup at bottom corners of the popup
];
@@ -312,6 +313,8 @@ const wot_prefs_int = [
[ "min_confidence_level", WOT_DEFAULT_MIN_CONFIDENCE_LEVEL ],
[ "popup_hide_delay", 1000 ],
[ "popup_show_delay", 200 ],
+ [ "ratingwindow_shown", 0 ],
+ [ "activity_score", 0 ],
[ "search_level", WOT_MIN_REPUTATION_4 ],
[ "search_type", WOT_SEARCH_TYPE_OPTIMIZED ],
[ "update_interval", WOT_INTERVAL_UPDATE_CHECK ],
diff --git a/content/overlay.xul b/content/overlay.xul
index 411f370..1a0a84b 100644
--- a/content/overlay.xul
+++ b/content/overlay.xul
@@ -52,35 +52,24 @@
</stringbundleset>
<commandset id="mainCommandSet">
- <command id="wot-command-enabled"
- oncommand="wot_commands.enabled();"/>
- <command id="wot-command-refresh"
- oncommand="wot_commands.refresh();"/>
- <command id="wot-command-preferences"
- oncommand="wot_commands.preferences();"/>
- <command id="wot-command-checkupdates"
- oncommand="wot_commands.checkupdates();"/>
- <command id="wot-command-testify-5"
- oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_5);"/>
- <command id="wot-command-testify-4"
- oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_4);"/>
- <command id="wot-command-testify-3"
- oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_3);"/>
- <command id="wot-command-testify-2"
- oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_2);"/>
- <command id="wot-command-testify-1"
- oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_1);"/>
- <command id="wot-command-my"
- oncommand="wot_commands.my();"/>
- <command id="wot-command-openlinkscorecard"
- oncommand="wot_commands.openlinkscorecard();"/>
+ <command id="wot-command-enabled" oncommand="wot_commands.enabled();"/>
+ <command id="wot-command-refresh" oncommand="wot_commands.refresh();"/>
+ <command id="wot-command-preferences" oncommand="wot_commands.preferences();"/>
+ <command id="wot-command-checkupdates" oncommand="wot_commands.checkupdates();"/>
+ <command id="wot-command-testify-5" oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_5);"/>
+ <command id="wot-command-testify-4" oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_4);"/>
+ <command id="wot-command-testify-3" oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_3);"/>
+ <command id="wot-command-testify-2" oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_2);"/>
+ <command id="wot-command-testify-1" oncommand="wot_commands.quicktestify(WOT_TESTIMONY_QUICK_1);"/>
+ <command id="wot-command-my" oncommand="wot_commands.my();"/>
+ <command id="wot-command-openlinkscorecard" oncommand="wot_commands.open_scorecard_link();"/>
</commandset>
<popupset id="mainPopupSet">
<!-- Testimony window -->
<menupopup id="wot-popup" noautohide="true" position="after_start"
onpopupshowing="wot_rw.on_rw_open(event);"
- onpopuphiding="wot_rw.hide_popup();">
+ onpopuphiding="wot_rw.on_hide_popup();">
<iframe id="wot-rwframe" src="chrome://wot/content/rw/ratingwindow.html" type="content-primary"
transparent="false" showcaret="true" width="100%" height="418px"/>
diff --git a/content/ratingwindow.js b/content/ratingwindow.js
index ba2ea91..ab367cd 100644
--- a/content/ratingwindow.js
+++ b/content/ratingwindow.js
@@ -53,8 +53,15 @@ var wot_rw = {
}
},
+ hide_ratingwindow: function () {
+ var popup = document.getElementById("wot-popup");
+ if (popup) {
+ popup.hidePopup();
+ }
+ },
+
/* Called when the popup window is hidden */
- hide_popup: function()
+ on_hide_popup: function()
{
try {
wot_rw.unseenmessage();
@@ -78,12 +85,12 @@ var wot_rw = {
this.initialize(rw, rw_doc, rw_wot);
// RW will ask BG to update it, so no need to update it here
} else {
- // RW is already loaded so we need to just update it
- wot_rw.update();
+ wot_rw.update(); // RW is already loaded so we need to just update it
}
},
update: function () {
+ // Updates content of Rating Window. RW must be already initialized (locales, categories info, etc).
wdump("RW.update()");
var rw = this.get_rw_window(),
@@ -96,10 +103,10 @@ var wot_rw = {
if (!rw || !rw_doc || !rw_wot) return;
- if (wot_cache.isok(target)) {
- wdump("target " + target + " is cached. Good.");
+ if (target && wot_cache.isok(target)) {
var normalized_target = wot_cache.get(target, "normalized") || target;
+ // prepare data for the RW
data = {
target: target,
normalized: wot_shared.decodehostname(normalized_target),
@@ -110,6 +117,7 @@ var wot_rw = {
}
};
+ // fill it with reputation data
for (var i = 0; i < WOT_COMPONENTS.length; i++) {
var app = WOT_COMPONENTS[i];
var rep = wot_cache.get(target, "reputation_" + app),
@@ -149,7 +157,10 @@ var wot_rw = {
get_preferences: function () {
var prefs = {
- accessible: wot_prefs.accessible
+ accessible: wot_prefs.accessible,
+ show_fulllist: wot_prefs.show_fulllist,
+ ratingwindow_shown: wot_prefs.ratingwindow_shown,
+ activity_score: wot_prefs.activity_score
};
return prefs;
@@ -176,6 +187,7 @@ var wot_rw = {
wot_rw.update();
}
// TODO: do other updates (e.g. toolbar icon, etc)
+ wot_commands.update(); // Update button's context menu
break;
case "update_ratingwindow_comment":
@@ -185,6 +197,11 @@ var wot_rw = {
case "unseenmessage":
wot_rw.unseenmessage();
break;
+
+ case "navigate":
+ wot_browser.open_wotsite(data.url, "", "", data.context, true, true);
+ wot_rw.hide_ratingwindow();
+ break;
}
},
@@ -229,27 +246,6 @@ var wot_rw = {
rw_wot.ratingwindow.onload(); // this runs only once in FF
this.is_inited = true;
- },
-
- update_title: function(description) {
- try {
- var title_elem = this.getElem("wot-title-text"),
- hostname_elem = this.getElem("wot-hostname-text");
-
- if (title_elem && hostname_elem) {
- if (wot_cache.isok(wot_core.hostname)) {
- title_elem.value = wot_util.getstring("description_reputation");
- title_elem.setAttribute("status", "target");
- hostname_elem.value = wot_shared.decodehostname(wot_core.hostname);
- } else {
- title_elem.value = description;
- title_elem.setAttribute("status", "information");
- hostname_elem.value = "";
- }
- }
- } catch (e) {
- wdump("wot_ui.update_title: failed with " + e);
- }
}
};
diff --git a/content/rw/ratingwindow.js b/content/rw/ratingwindow.js
index d4ee122..c4638b0 100644
--- a/content/rw/ratingwindow.js
+++ b/content/rw/ratingwindow.js
@@ -310,13 +310,14 @@ $.extend(wot, { ratingwindow: {
{
try {
fragment = fragment ? "#" + fragment : "";
- var contextedurl = wot.contextedurl(url, context) + fragment;
- chrome.tabs.create({ url: contextedurl, active:!keep_opened },
- function(tab) {
- if (!keep_opened) wot.ratingwindow.hide();
- }
- );
- if (!keep_opened) wot.ratingwindow.hide();
+
+ var bg = wot.ratingwindow.get_bg();
+ bg.wot.core.moz_send("navigate", {
+ url: url,
+ context: context,
+ fragment: fragment
+ });
+
} catch (e) {
console.error("ratingwindow.navigate: failed with ", e);
}
diff --git a/content/ui.js b/content/ui.js
index 3abcace..9d6fc0e 100644
--- a/content/ui.js
+++ b/content/ui.js
@@ -136,23 +136,23 @@ 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_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 {
@@ -209,7 +209,7 @@ var wot_ui = {
// !wot_prefs.show_application_4;
/* Partner */
- this.show_partner();
+// this.show_partner();
} catch (e) {
dump("wot_ui.show_elements: failed with " + e + "\n");
}
@@ -221,138 +221,138 @@ var wot_ui = {
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();
+// 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("help_5");
- } else if (testimony >= WOT_MIN_REPUTATION_4) {
- help.value = wot_util.getstring("help_4");
- } else if (testimony >= WOT_MIN_REPUTATION_3) {
- help.value = wot_util.getstring("help_3");
- } else if (testimony >= WOT_MIN_REPUTATION_2) {
- help.value = wot_util.getstring("help_2");
- } else if (testimony >= 0) {
- help.value = wot_util.getstring("help_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_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("help_5");
+// } else if (testimony >= WOT_MIN_REPUTATION_4) {
+// help.value = wot_util.getstring("help_4");
+// } else if (testimony >= WOT_MIN_REPUTATION_3) {
+// help.value = wot_util.getstring("help_3");
+// } else if (testimony >= WOT_MIN_REPUTATION_2) {
+// help.value = wot_util.getstring("help_2");
+// } else if (testimony >= 0) {
+// help.value = wot_util.getstring("help_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()
{
@@ -381,68 +381,68 @@ var wot_ui = {
}
},
- 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");
- }
- },
+// 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)
{
diff --git a/content/util.js b/content/util.js
index c35a9a4..a41f7d1 100644
--- a/content/util.js
+++ b/content/util.js
@@ -304,13 +304,13 @@ var wot_url =
return false;
},
- getwoturl: function(path, context)
+ getwoturl: function(path, context, has_base)
{
try {
var new_path = path;
new_path += ( (path.indexOf("?") > 0) ? "&" : "?" );
new_path += "utm_source=addon" + (context ? "&utm_content=" + context : "");
- return WOT_MY_URL + new_path;
+ return has_base ? new_path : WOT_MY_URL + new_path;
} catch (e) {
dump("wot_url.getwoturl: failed with " + e + "\n");
}
@@ -525,26 +525,35 @@ var wot_browser =
}
},
- openscorecard: function(hostname, action, context)
- {
- try {
- if (!hostname) {
- return false;
- }
-
- var path = WOT_SCORECARD_PATH + encodeURIComponent(hostname);
+ open_wotsite: function (page, target, action, context, new_tab, has_base) {
+ try {
+ new_tab = new_tab === null ? true : new_tab;
+ var browser = getBrowser(),
+ path = page + encodeURIComponent(target);
- if (action) {
- path += action;
- }
+ if (action) {
+ path += action;
+ }
- var browser = getBrowser();
- var url = wot_url.getwoturl(path, context);
+ var url = wot_url.getwoturl(path, context, has_base);
+
+ if (browser && url) {
+ browser.selectedTab = browser.addTab(url);
+ return true;
+ }
+
+ } catch (e) {
+ wdump("ERROR: wot_util.wot_browser.open_wotsite() raised an exception. " + e);
+ }
+
+ },
+
+ openscorecard: function (hostname, action, context)
+ {
+ try {
+ if (!hostname) return false;
+ return this.open_wotsite(WOT_SCORECARD_PATH, hostname, action, context, true, false);
- if (browser && url) {
- browser.selectedTab = browser.addTab(url);
- return true;
- }
} catch (e) {
dump("wot_browser.openscorecard: failed with " + e + "\n");
}
--
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