My aim is to write a Tampermonkey script that puts the Clippy assistant from Microsoft Office on any webpage I choose. For this, I am using https://github.com/pi0/clippyjs. Here is what I've got so far:
// ==UserScript==
// @name Clippy!
// @include https://stackoverflow.com/questions/*
// @require https://unpkg.com/jquery@3.2.1/dist/jquery.js
// @require https://unpkg.com/clippyjs@0.0.3/dist/clippy.js
// @grant GM_addStyle
// ==/UserScript==
/*--- For this to work well, we must also add-in the jQuery-UI CSS.
We add the CSS this way so that the embedded, relatively linked images load correctly.
(Use //ajax... so that https or http is selected as appropriate to avoid "mixed content".)
*/
$("head").append (
'<link '
+ 'href="//gitcdn.xyz/repo/pi0/clippyjs/master/assets/clippy.css" '
+ 'rel="stylesheet" type="text/css">'
);
clippy.load('Merlin', function(agent){
// Do anything with the loaded agent
agent.show();
});
This results in:
Uncaught ReferenceError: clippy is not defined
Is there any way to make Clippyjs work as a Tampermonkey script?