async loadContext() { const res = await fetch('/playground/context'); const result = await res.json(); return { cubejsToken: result.cubejsToken, apiUrl: result.apiUrl || window.location.href.split('#')[0].replace(/\/$/, ''), }; }
/** * Gets page URL including hash. */ async _getPageUrl() { return this.executeScript(() => window.location.href); }
function triggerPageChange(name) { try { var onPageChange = window.parent.onWhistlePageChange; if (typeof onPageChange === 'function' && curPageName !== name) { curPageName = name; onPageChange(name, location.href); } } catch (e) {} }
/** * Whether the current URL can potentially contain personally identifiable info. * * @returns {boolean} true if the current URL can potentially contain personally identifiable info. */ export default function isPiiUrl() { const href = document.location.href; const match = ( pattern ) => href.indexOf( pattern ) !== -1; const result = forbiddenPiiPatterns.some( match ) || forbiddenPiiPatternsEnc.some( match ); debug( `Is PII URL: ${ result }` ); return result; }
export default function makeContentLinksSafe( post, dom ) { const links = toArray( dom.querySelectorAll( 'a[href]' ) ); forEach( links, ( link ) => { // only accept links that are to http or https sites if ( ! safeLinkRe.test( link.href ) ) { link.removeAttribute( 'href' ); } } ); return post; }
const ItemElement = props => { if (props.to) return <Link {...props} />; if (props.href) return <a {...props} />; return <button type="button" {...props} />; }
export default function buildUrl(...paths) { const url = new URL( paths .map(p => p && (p + '').trim()) // Trim each string .filter(Boolean) // Remove empty strings or other falsy paths .join('/') ); // Replace 2+ consecutive slashes with 1. (e.g. `///` --> `/`) url.set('pathname', url.pathname.replace(/\/{2,}/g, '/')); return url.href; }
osmosis.parse(html, { baseUrl: 'test.com' }) .then(function (document) { assert.ok(document.location.href); }) .done(function () { assert.done(); });
const ItemElement = ({ as: Tag, isSelected, mouseIsOverNav, ...props }) => { if (Tag) return <Tag {...props} />; if (props.to) return <Link {...props} />; if (props.href) return <a {...props} />; return <button type="button" {...props} />; }
async componentDidMount() { const res = await fetch('/playground/context'); const result = await res.json(); this.setState({ cubejsToken: result.cubejsToken, apiUrl: result.apiUrl || window.location.href.split('#')[0].replace(/\/$/, ''), }); }
async function makePayPalExpressRequest( data ) { window.console.log( 'Processing paypal transaction with data', data ); // This simulates the transaction and provisioning time await asyncTimeout( 2000 ); return window.location.href; }
/** * Gets page URL including hash. */ async _getPageUrl() { return this.executeScript(() => window.location.href); }
export default function buildUrl(...paths) { const url = new URL( paths .map(p => p && (p + '').trim()) // Trim each string .filter(Boolean) // Remove empty strings or other falsy paths .join('/') ); // Replace 2+ consecutive slashes with 1. (e.g. `///` --> `/`) url.set('pathname', url.pathname.replace(/\/{2,}/g, '/')); return url.href; }