Skip to content

Instantly share code, notes, and snippets.

@markusdosch
Last active August 5, 2020 08:51
Show Gist options
  • Save markusdosch/3e00a2e5741390d3c1328e4050dff6fd to your computer and use it in GitHub Desktop.
Save markusdosch/3e00a2e5741390d3c1328e4050dff6fd to your computer and use it in GitHub Desktop.
Refined Confluence: Search in current Confluence space by default (and not in all spaces) & only search for pages (not all types of results)
// ==UserScript==
// @name refined-confluence
// @namespace https://markusdosch.com/
// @version 0.1
// @downloadURL https://gist.githubusercontent.com/markusdosch/3e00a2e5741390d3c1328e4050dff6fd/raw/
// @updateURL https://gist.githubusercontent.com/markusdosch/3e00a2e5741390d3c1328e4050dff6fd/raw/
// @description Refined Confluence: Search in current Confluence space by default (and not in all spaces) & only search for pages (not all types of results)
// @author Markus Dosch
// @match https://confluence.check24.de/*
// @grant none
// ==/UserScript==
// How to install via GitHub Gist:
// 1. Install Tampermonkeyvisit: https://www.tampermonkey.net/
// 2. Visit this page and and click on "Raw" (or directly visit https://gist.github.com/markusdosch/3e00a2e5741390d3c1328e4050dff6fd/raw/1c32ba8ee18ee8b329a5673c30cfd7f9164512ed/refined-confluence.user.js)
// 3. Tampermonkey dialog opens and suggests you to install the script.
// 4. If auto-updating is enabled in your Tampermonkey settings, this script will auto-update itself.
(function() {
'use strict';
document.querySelector("#quick-search-query").addEventListener("focus", () => {
window.setTimeout(() => {
// Select the last-used space as filter
document.querySelector("#content-space-search-filter-button").click();
document.querySelector("#content-space-filter-checkbox-list label").click();
// Select "Page" as result type
document.querySelector("#content-type-search-filter-button").click();
document.querySelector('#content-type-filter-dropdown label[for="content-type-page"]').click();
document.querySelector("#search-filter-input").focus();
}, 500);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment