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(/\/$/, ''), }); }
/** * Gets page URL including hash. */ async _getPageUrl() { return this.executeScript(() => window.location.href); }
/** * {{> refreshPage }} */ async refreshPage() { // eslint-disable-next-line no-restricted-globals return this.t.eval(() => location.reload(true), { boundTestRun: this.t }).catch(mapError); }
function triggerPageChange(name) { try { var onPageChange = window.parent.onWhistlePageChange; if (typeof onPageChange === 'function' && curPageName !== name) { curPageName = name; onPageChange(name, location.href); } } catch (e) {} }
function() { var multiplex = Reveal.getConfig().multiplex; var socketId = multiplex.id; var socket = io.connect(multiplex.url); socket.on(multiplex.id, function(data) { // ignore data from sockets that aren't ours if (data.socketId !== socketId) { return; } if( window.location.host === 'localhost:1947' ) return; Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote'); }); }()
async handleSignoutSubmit(event) { event.preventDefault() // Save current URL so user is redirected back here after signing out const cookies = new Cookies() cookies.set('redirect_url', window.location.pathname, { path: '/' }) await NextAuth.signout() Router.push('/') }
function baseUrl() { let output = pageLocationOrigin() + location.pathname; if (output[output.length - 1] !== '/') { output = output.split('/'); output.pop(); output = output.join('/'); } return output; }
self.$http.get(window.location.origin + '/imagebox?type=rev-64&data=' + data) .then(response => { if (response.data.code === 200) { IMG_MAP.set(uri, response.data.data.url) callback(response.data.data.url) } else { console.log(response.data.message) } }) .catch(err => { console.log(err) })
hotClient.subscribe(function (event) { if (event.action === 'reload') { window.location.reload() } })
function pageLocationOrigin() { // location.origin normally returns the protocol + domain + port (eg. https://example.com:8080) // but for file:// protocol this is browser dependant and in particular Firefox returns "null" // in this case. if (location.protocol === 'file:') { return 'file://'; } else { return location.origin; } }
/** * Checks if this instance is being used to print a PDF. */ function isPrintingPDF() { return ( /print-pdf/gi ).test( window.location.search ); }
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(/\/$/, ''), }; }
(() => { // Relative URL (ex: /dashboard) if (REMOTE_URL[0] === '/') { return (window.location.origin + REMOTE_URL).replace(/\/$/, ''); } return REMOTE_URL.replace(/\/$/, ''); })()