// ==UserScript== // @name Perplexity helper // @namespace Tiartyos // @match https://www.perplexity.ai/* // @grant none // @version 3.8 // @author Tiartyos, monnef // @description Simple script that adds buttons to Perplexity website for repeating request using Copilot. // @require https://code.jquery.com/jquery-3.6.0.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/lodash-fp/0.10.4/lodash-fp.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.8/clipboard.min.js // @require https://cdn.jsdelivr.net/npm/color2k@2.0.2/dist/index.unpkg.umd.js // @require https://cdn.jsdelivr.net/npm/showdown@2.1.0/dist/showdown.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/jsondiffpatch/0.4.1/jsondiffpatch.umd.min.js // @homepageURL https://www.perplexity.ai/ // @license GPL-3.0-or-later // @downloadURL none // ==/UserScript== const jq = $.noConflict(); const $c = (cls, parent) => jq(`.${cls}`, parent); const $i = (id, parent) => jq(`#${id}`, parent); const takeStr = n => str => str.slice(0, n); const dropStr = n => str => str.slice(n); const filter = pred => xs => xs.filter(pred); const nl = '\n'; const markdownConverter = new showdown.Converter(); let debugMode = false; const enableDebugMode = () => { debugMode = true; }; const logPrefix = '[Perplexity helper]'; const debugLog = (...args) => { if (debugMode) { console.debug(logPrefix, ...args); } } let debugTags = false; const debugLogTags = (...args) => { if (debugTags) { console.debug(logPrefix, '[tags]', ...args); } } const enableTagsDebugging = () => { debugTags = true; } ($ => { $.fn.nthParent = function (n) { let $p = $(this); if (!(n > -0)) { return $() } let p = 1 + n; while (p--) { $p = $p.parent(); } return $p; }; })(jq); const button = (id, icoName, title, extraClass) => ` ${icoName} `; const upperButton = (id, icoName, title) => `