Sitevision profiling

Sitevision has a feature which lets you view the rendering times of all the modules on the page. This feature is toggled by the query parameter profiling with the values true or false. The state is stored in your session, so you'll have to turn it off by yourself.

This bookmarklet toggles the query parameter for you.

Created
2016-09-10
Updated
2023-01-09
Bookmarklet size
480 B

Drag this link to your bookmarks to save it.

Sitevision profiling

Bookmarklet code

profiling.js

((location, document) => {
const params = (new URL(location)).searchParams;
const currentState = getCurrentState(params);

// Toggle state.
params.set('profiling', currentState ? 'false' : 'true');
// Update query string.
location.search = '?' + params.toString();

/**
* Gets the current state of profiling. Returns true if profiling is active, false otherwise.
*
* @param {URLSearchParams} params
* @returns {boolean}
*/

function getCurrentState (params) {
// Check if search param is already present and use that.
if (params.has('profiling')) {
return params.get('profiling').toLowerCase() === 'true';
}

// Fallback to searching for the most likely table.
return [...document.getElementsByTagName('table')].filter(table => table.textContent.search(/Profiling results/i) !== -1).length > 0;
}
})(location, document)