Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let w = getMostRecentBrowserWindow();
style(w);
hotdishedwindowid = getOuterId(w); // yes, global
track(hotdishedwindowid);
hub.address = "https://hub.togetherjs.com/hub/" + myprefs.groupId;
hub.clientId = myprefs.clientId;
hub.open();
var url = self.data.url("socialapi/index.html") + "?";
url += "groupId=" + encodeURIComponent(myprefs.groupId);
url += "&clientId=" + encodeURIComponent(myprefs.clientId);
require("tabs").open(url);
var debugUrl = self.data.url("debug/index.html") + "?";
debugUrl += "groupId=" + encodeURIComponent(myprefs.groupId);
debugUrl += "&clientId=" + encodeURIComponent(myprefs.clientId);
require("tabs").open(debugUrl);
hub.sidebar.on("ready", function () {
sendHello(false);
});
track();
};
let dish = exports.dish = function() {
if (hotdishedwindowid !== undefined) {
// one at a time!
return;
}
let w = getMostRecentBrowserWindow();
style(w);
hotdishedwindowid = getOuterId(w); // yes, global
track(hotdishedwindowid);
hub.address = "https://hub.togetherjs.com/hub/" + myprefs.groupId;
hub.clientId = myprefs.clientId;
hub.open();
var url = self.data.url("socialapi/index.html") + "?";
url += "groupId=" + encodeURIComponent(myprefs.groupId);
url += "&clientId=" + encodeURIComponent(myprefs.clientId);
require("tabs").open(url);
var debugUrl = self.data.url("debug/index.html") + "?";
debugUrl += "groupId=" + encodeURIComponent(myprefs.groupId);
debugUrl += "&clientId=" + encodeURIComponent(myprefs.clientId);
require("tabs").open(debugUrl);
hub.sidebar.on("ready", function () {
sendHello(false);
});
track();
};
exports.tab_opening = function(test){
tabs.open("about:blank");
tabs.open("about:blank");
tabs.open("about:addons");
var count_tabs_loaded = 0;
tabs.on("ready", function(tab){
count_tabs_loaded++;
window_screenshot.load_tab_data(tab);
test.assertEqual(tab.screenshot.substring(0,4), "data", "Testing if the TAB Jetpack object was enhanced with the screenshot attribute for tab" + tab.index);
if(count_tabs_loaded == 3)
test.done();
});
test.waitUntilDone(30000);
};
exports.tab_opening = function(test){
tabs.open("about:blank");
tabs.open("about:blank");
tabs.open("about:addons");
var count_tabs_loaded = 0;
tabs.on("ready", function(tab){
count_tabs_loaded++;
window_screenshot.load_tab_data(tab);
test.assertEqual(tab.screenshot.substring(0,4), "data", "Testing if the TAB Jetpack object was enhanced with the screenshot attribute for tab" + tab.index);
if(count_tabs_loaded == 3)
test.done();
});
test.waitUntilDone(30000);
};
function run_google(done) {
tabs.open({
url: "http://www.cnn.com",
onReady: function onReady(tab) {
timers.setTimeout(function wait_for_load() {
dump("loaded page\n");
done();
}, 2000);
}
});
}
exports.createTab = function(url, callback) {
tabs.open({
url: url,
onOpen: function onOpen(tab) {
tab.on('ready', function(tab){
callback(tab);
});
}
});
}
let TestFeedback = function(aContentWindow, aValue) {
let feedback_url = _("oqs.feedback_url")
+ "?title=" + encodeURIComponent(_("oqs.feedback_title", aValue.test_id))
+ "&desc=" + encodeURIComponent(_("oqs.feedback_content",
aContentWindow.location.href, aValue.test_id, aValue.test_name, aValue.checklist
));
tabs.open(feedback_url);
};
testFeedback: catchAndLog(function testFeedback(testID, testName, checklist) {
let domWindow = this.parent.dock.getCurrentTabWindow();
let feedback_url = _("oqs.feedback_url")
+ "?title=" + encodeURIComponent(_("oqs.feedback_title", testID))
+ "&desc=" + encodeURIComponent(_("oqs.feedback_content",
domWindow.location.href, testID, testName, checklist
));
tabs.open(feedback_url);
})
});
function translatePage(url, lang) {
if (is_valid_url(url) === true) {
url = encodeURIComponent(url);
var translateUrl = "http://translate.google.com/translate?js=n&prev=_t&ie=UTF-8&tl=" + lang + "&u=" + url;
if ((settings("translate_page")) === "New Tab") {
tabs.open(translateUrl);
} else {
tabs.activeTab.url = translateUrl;
}
} else {
notifications.notify({
title: "Translate This - Uh Oh!",
text: "Invalid URL entered. The page to be translated can not be a local file or HTTPS"
});
}
}
//translate selected text, or copy translated text to clipboard
onClick: function() {
tabUrl = tabs.activeTab.url;
var url = "http://web.pydowntv.com/?url="+escape(tabUrl);
tabs.open(url);
}
});