Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: components/security_interstitials/core/browser/resources/interstitial_common.js

Issue 2930043002: Implement V2 design for quiet safe browsing interstitial (Closed)
Patch Set: Remove extra break Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/security_interstitials/core/browser/resources/interstitial_large.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/security_interstitials/core/browser/resources/interstitial_common.js
diff --git a/components/security_interstitials/core/browser/resources/interstitial_common.js b/components/security_interstitials/core/browser/resources/interstitial_common.js
index e826a1490757fcab3ba033fed3c017dfdcd409ee..cd88b21adb1b89138f0cdfa6ca52bf42192cc289 100644
--- a/components/security_interstitials/core/browser/resources/interstitial_common.js
+++ b/components/security_interstitials/core/browser/resources/interstitial_common.js
@@ -27,6 +27,8 @@ var SecurityInterstitialCommandId = {
CMD_REPORT_PHISHING_ERROR: 12
};
+var HIDDEN_CLASS = 'hidden';
+
/**
* A convenience method for sending commands to the parent page.
* @param {string} cmd The command to send.
@@ -43,4 +45,19 @@ function sendCommand(cmd) {
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
// </if>
-}
+}
+
+/**
+ * Call this to stop clicks on <a href="#"> links from scrolling to the top of
+ * the page (and possibly showing a # in the link).
+ */
+function preventDefaultOnPoundLinkClicks() {
+ document.addEventListener('click', function(e) {
+ var anchor = findAncestor(/** @type {Node} */ (e.target), function(el) {
+ return el.tagName == 'A';
+ });
+ // Use getAttribute() to prevent URL normalization.
+ if (anchor && anchor.getAttribute('href') == '#')
+ e.preventDefault();
+ });
+}
« no previous file with comments | « no previous file | components/security_interstitials/core/browser/resources/interstitial_large.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698