-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquicksearchdetect.user.js
More file actions
53 lines (45 loc) · 2.34 KB
/
quicksearchdetect.user.js
File metadata and controls
53 lines (45 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// ==UserScript==
// @name Perplexity Quick Search Detection
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Modify Perplexity to enable Quick Website Search detection in iOS Safari with a visible search box
// @author Your Name
// @match https://www.perplexity.ai/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Create a visible form to help Safari detect the search functionality
const searchForm = document.createElement('form');
searchForm.setAttribute('action', 'https://www.perplexity.ai/search'); // Adjust this to the correct search URL
searchForm.setAttribute('method', 'GET');
searchForm.style.position = 'fixed'; // Make it fixed position
searchForm.style.top = '10px'; // Adjust top position
searchForm.style.right = '10px'; // Adjust right position
searchForm.style.zIndex = '1000'; // Ensure it appears above other elements
searchForm.style.backgroundColor = 'white'; // Background color for visibility
searchForm.style.padding = '10px'; // Padding for aesthetics
searchForm.style.border = '1px solid #ccc'; // Border for visibility
searchForm.style.borderRadius = '5px'; // Rounded corners
const searchInput = document.createElement('input');
searchInput.setAttribute('type', 'text');
searchInput.setAttribute('name', 'q'); // This name should match the expected query parameter for the search
searchInput.setAttribute('placeholder', 'Search Perplexity...'); // Placeholder text
searchInput.style.width = '200px'; // Set width for the input
searchInput.style.marginRight = '5px'; // Space between input and button
const searchButton = document.createElement('button');
searchButton.setAttribute('type', 'submit');
searchButton.textContent = 'Search'; // Button text
// Append the input and button to the form
searchForm.appendChild(searchInput);
searchForm.appendChild(searchButton);
// Append the form to the body
document.body.appendChild(searchForm);
// Optional: Trigger the search when the input is used
searchInput.addEventListener('input', function() {
if (searchInput.value) {
console.log('Search input detected:', searchInput.value);
}
});
console.log('Perplexity Quick Search Detection script loaded with visible search box.');
})();