CC: Split the profile history link into 2 links
Before there was a single link which pointed to the post history in all
forums. As this sometimes takes a long time to load, this commit splits
it into 2 links:
* A link to the post history in the current forum (loads faster)
* A link to the post history in all forums (loads slower)
Change-Id: Ifa3ed2340c5af2e87d75118eb6a66aba4f395e3c
diff --git a/src/common/content_scripts.js b/src/common/content_scripts.js
new file mode 100644
index 0000000..7186037
--- /dev/null
+++ b/src/common/content_scripts.js
@@ -0,0 +1,22 @@
+function injectStylesheet(stylesheetName) {
+ var link = document.createElement('link');
+ link.setAttribute('rel', 'stylesheet');
+ link.setAttribute('href', stylesheetName);
+ document.head.appendChild(link);
+}
+
+function injectStyles(css) {
+ injectStylesheet('data:text/css;charset=UTF-8,' + encodeURIComponent(css));
+}
+
+function injectScript(scriptName) {
+ var script = document.createElement('script');
+ script.src = scriptName;
+ document.head.appendChild(script);
+}
+
+function escapeUsername(username) {
+ var quoteRegex = /"/g;
+ var commentRegex = /<!---->/g;
+ return username.replace(quoteRegex, '\\"').replace(commentRegex, '');
+}