aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib/queries.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/lib/queries.js')
-rw-r--r--data/lib/queries.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/data/lib/queries.js b/data/lib/queries.js
index b6e3661..0c00792 100644
--- a/data/lib/queries.js
+++ b/data/lib/queries.js
@@ -11,7 +11,6 @@ function getSelection () {
return text;
}
-
/**
* Opens a new tab with a query for the given text in the selected component
*
@@ -73,3 +72,36 @@ function queryForSelection() {
}
}
}
+
+/**
+ *
+ */
+function queryUpstreamCallback(text, queryUpBug) {
+ var searchData = filterByRegexp(queryUpBug, getComponent());
+ var urlBase = searchData.url;
+ text = searchData.searchBy+":"+searchData.fillIn+" "+text.trim();
+ if (searchData.fillIn == "$$$") {
+ text = text.replace("$$$", getComponent());
+ }
+ text = encodeURIComponent(text).replace("%20","+");
+ postMessage(new Message("OpenURLinTab", urlBase + text));
+}
+
+/**
+ * Search simple query in the upstream bugzilla appropriate for the component
+ *
+ * @return none
+ */
+function queryUpstream(qUpBug) {
+ if (!qUpBug) {
+ alert("We don't have constantData.queryUpstreamBug set up!");
+ return null;
+ }
+ var text = getSelection();
+ if (!text) {
+ postMessage(new Message("GetClipboard", "queryUpstream"));
+ }
+ else {
+ queryUpstreamCallback(text, qUpBug);
+ }
+}