Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: common.js

Issue 29445590: Issue 5255 - Advanced tab (HTML, strings and functionality) (Closed)
Patch Set: Fixed nits Created July 14, 2017, 5:43 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | firstRun.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common.js
===================================================================
--- a/common.js
+++ b/common.js
@@ -33,6 +33,31 @@
}, callback);
}
+function setLinks(id, ...args)
+ {
+ let element = E(id);
+ if (!element)
+ {
+ return;
+ }
+
+ let links = element.getElementsByTagName("a");
+
+ for (let i = 0; i < links.length; i++)
+ {
+ if (typeof args[i] == "string")
+ {
+ links[i].href = args[i];
+ links[i].setAttribute("target", "_blank");
+ }
+ else if (typeof args[i] == "function")
+ {
+ links[i].href = "javascript:void(0);";
+ links[i].addEventListener("click", args[i], false);
+ }
+ }
+ }
+
function checkShareResource(url, callback)
{
ext.backgroundPage.sendMessage({
« no previous file with comments | « no previous file | firstRun.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld