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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2649023007: DevTools: implement release note behind an experiment (Closed)
Patch Set: finalize Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 Foreground: 1 << 0, 1920 Foreground: 1 << 0,
1921 Background: 1 << 1, 1921 Background: 1 << 1,
1922 Selection: 1 << 2, 1922 Selection: 1 << 2,
1923 }; 1923 };
1924 1924
1925 /** 1925 /**
1926 * @param {string} url 1926 * @param {string} url
1927 * @param {string=} linkText 1927 * @param {string=} linkText
1928 * @param {string=} className 1928 * @param {string=} className
1929 * @param {boolean=} preventClick 1929 * @param {boolean=} preventClick
1930 * @param {boolean=} unstyled
einbinder 2017/02/15 20:10:45 What is the styling you are trying to remove? Can
luoe 2017/02/15 22:32:31 +1
chenwilliam 2017/02/16 21:32:43 Done.
1930 * @return {!Element} 1931 * @return {!Element}
1931 */ 1932 */
1932 UI.createExternalLink = function(url, linkText, className, preventClick) { 1933 UI.createExternalLink = function(url, linkText, className, preventClick, unstyle d) {
1933 if (!linkText) 1934 if (!linkText)
1934 linkText = url; 1935 linkText = url;
1935 1936
1936 var a = createElementWithClass('span', className); 1937 var a = createElementWithClass('span', className);
1937 var href = url; 1938 var href = url;
1938 if (url.trim().toLowerCase().startsWith('javascript:')) 1939 if (url.trim().toLowerCase().startsWith('javascript:'))
1939 href = null; 1940 href = null;
1940 if (Common.ParsedURL.isRelativeURL(url)) 1941 if (Common.ParsedURL.isRelativeURL(url))
1941 href = null; 1942 href = null;
1942 if (href !== null) { 1943 if (href !== null) {
1943 a.href = href; 1944 a.href = href;
1944 a.classList.add('devtools-link'); 1945 a.classList.add('devtools-link');
1945 if (!preventClick) { 1946 if (!preventClick) {
1946 a.addEventListener('click', (event) => { 1947 a.addEventListener('click', (event) => {
1947 event.consume(true); 1948 event.consume(true);
1948 InspectorFrontendHost.openInNewTab(/** @type {string} */ (href)); 1949 InspectorFrontendHost.openInNewTab(/** @type {string} */ (href));
1949 }, false); 1950 }, false);
1950 } else { 1951 } else {
1951 a.classList.add('devtools-link-prevent-click'); 1952 a.classList.add('devtools-link-prevent-click');
1952 } 1953 }
1953 a[UI._externalLinkSymbol] = true; 1954 a[UI._externalLinkSymbol] = true;
1954 } 1955 }
1955 if (linkText !== url) 1956 if (linkText !== url)
1956 a.title = url; 1957 a.title = url;
1957 a.textContent = linkText.trimMiddle(UI.MaxLengthForDisplayedURLs); 1958 a.textContent = linkText.trimMiddle(UI.MaxLengthForDisplayedURLs);
1958 a.setAttribute('target', '_blank'); 1959 a.setAttribute('target', '_blank');
1959 1960 if (unstyled)
1961 a.className = className;
1960 return a; 1962 return a;
1961 }; 1963 };
1962 1964
1963 UI._externalLinkSymbol = Symbol('UI._externalLink'); 1965 UI._externalLinkSymbol = Symbol('UI._externalLink');
1964 1966
1965 /** 1967 /**
1966 * @implements {UI.ContextMenu.Provider} 1968 * @implements {UI.ContextMenu.Provider}
1967 * @unrestricted 1969 * @unrestricted
1968 */ 1970 */
1969 UI.ExternaLinkContextMenuProvider = class { 1971 UI.ExternaLinkContextMenuProvider = class {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 */ 2066 */
2065 constructor(message, okCallback, cancelCallback) { 2067 constructor(message, okCallback, cancelCallback) {
2066 super(true); 2068 super(true);
2067 this.registerRequiredCSS('ui/confirmDialog.css'); 2069 this.registerRequiredCSS('ui/confirmDialog.css');
2068 this.contentElement.createChild('div', 'message').createChild('span').textCo ntent = message; 2070 this.contentElement.createChild('div', 'message').createChild('span').textCo ntent = message;
2069 var buttonsBar = this.contentElement.createChild('div', 'button'); 2071 var buttonsBar = this.contentElement.createChild('div', 'button');
2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback )); 2072 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback ));
2071 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel Callback)); 2073 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel Callback));
2072 } 2074 }
2073 }; 2075 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698