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); }
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('/') }
// Content-Scroll on Navigation click. $('.sidenav').find('a').on('click', function(e) { e.preventDefault(); var id = $(this).attr('href'); if ($(id).length > 0) $('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400); window.location.hash = $(this).attr('href'); });
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() } })
(() => { // Relative URL (ex: /dashboard) if (REMOTE_URL[0] === '/') { return (window.location.origin + REMOTE_URL).replace(/\/$/, ''); } return REMOTE_URL.replace(/\/$/, ''); })()
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(/\/$/, ''), }; }
/** * Checks if this instance is being used to print a PDF. */ function isPrintingPDF() { return ( /print-pdf/gi ).test( window.location.search ); }
handleLogoutClick() { AuthActions.logout().then(() => { window.location.reload(); }); }