The problem with usercripts and jQuery-UI is that jQI uses CSS with a lot of background images loaded with relative paths. EG:
... url("images/ui-bg_dots-small_35_35414f_2x2.png") ...
For security reasons, this relative path will rarely work for the user.
This means that to use jQUI in a user document, you can:
- Download the required CSS from the server. (Dynamically without using
@resource)
or - CSS, .
(. ) Google Hosted Libraries. Google jQuon , ..
jQUI , - . @require, JS ( ), jquery-ui.min.js .
jQUI CSS, .
Greasemonkey/Tampermonkey script, , jQUI . , CSS <link> node, :
$("head").append (
'<link '
+ 'href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/le-frog/jquery-ui.min.css" '
+ 'rel="stylesheet" type="text/css">'
);
$("body").append ('<div id="gmOverlayDialog"><h1>Sample Dialog added using jQuery-UI</h1></div>');
$("#gmOverlayDialog").dialog ( {
modal: false,
title: "Draggable, sizeable dialog",
position: {
my: "top",
at: "top",
of: document
, collision: "none"
},
width: "auto",
minWidth: 400,
minHeight: 200,
zIndex: 3666
} )
.dialog ("widget").draggable ("option", "containment", "none");
$("#gmOverlayDialog").parent ().css ( {
position: "fixed",
top: 0,
left: "4em",
width: "75ex"
} );
GM_addStyle() !important.