Skip to content
Browse files

Added GreaseMonkey Script

  • Loading branch information...
1 parent d742c1b commit fd19c84cae044e3b0e360fa71527a9653afb1fd2 @davglass committed Jul 24, 2009
Showing with 85 additions and 0 deletions.
  1. +44 −0 greasemonkey/index.php
  2. +41 −0 greasemonkey/yui3.user.js
View
44 greasemonkey/index.php
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>YUI3: Loading YUI3 in a GreaseMonkey script</title>
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css">
+ <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/assets/skins/sam/skin.css">
+ <link rel="stylesheet" href="http://blog.davglass.com/wp-content/themes/davglass/style.css" type="text/css">
+ <link rel="stylesheet" type="text/css" href="http://developer.yahoo.com/yui/assets/dpSyntaxHighlighter.css">
+ <style type="text/css" media="screen">
+ p, h2 {
+ margin: 1em;
+ }
+ </style>
+</head>
+<body class="yui-skin-sam">
+<div id="davdoc" class="yui-t7">
+ <div id="hd"><h1 id="header"><a href="http://blog.davglass.com/">YUI3: Loading YUI3 in a GreaseMonkey script</a></h1></div>
+ <div id="bd">
+ <p>This GreaseMonkey User Script loads YUI 3.</p>
+
+ <h2>The Script</h2>
+ <textarea name="code" class="JScript"><?php include('yui3.user.js'); ?></textarea>
+ </div>
+ <div id="ft">&nbsp;</div>
+</div>
+<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/utilities/utilities.js"></script>
+<script src="http://developer.yahoo.com/yui/assets/dpSyntaxHighlighter.js"></script>
+<script type="text/javascript" src="../js/toolseffects-min.js"></script>
+<script type="text/javascript" src="../js/davglass.js"></script>
+<script type="text/javascript">
+
+(function() {
+ var Dom = YAHOO.util.Dom,
+ Event = YAHOO.util.Event;
+
+
+
+ dp.SyntaxHighlighter.HighlightAll('code');
+})();
+
+</script>
+</body>
+</html>
+<?php @include_once($_SERVER["DOCUMENT_ROOT"]."/wp-content/plugins/shortstat/inc.stats.php"); ?>
View
41 greasemonkey/yui3.user.js
@@ -0,0 +1,41 @@
+// ==UserScript==
+// @name YUI3 Loader
+// @namespace http://blog.davglass.com/files/yui3/greasemonkey/
+// @description Loads YUI3
+// @author Dav Glass (davglass@gmail.com)
+// @include http://*
+// @version 0.1
+// @date 2009/07/24
+// ==/UserScript==
+
+(function() {
+ var uw = unsafeWindow,
+ YUI, script, head,
+ YUILoaded = function() {
+ YUI = uw.YUI;
+ YUI.config.doc = uw.document;
+ YUI.config.win = uw;
+ YUI().use('node', 'dd-drag', function(Y) {
+ var body = Y.get('body');
+ Y.log(body);
+ body.setStyle('backgroundColor', 'red');
+ var h = Y.all('h2');
+ h.setStyle('cursor', 'move');
+ h.each(function(v) {
+ new Y.DD.Drag({
+ node: v
+ });
+ });
+ });
+ };
+
+ if (!uw.YUI) {
+ script = uw.document.createElement('script');
+ script.src = 'http:/'+'/yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js';
+ script.onload = YUILoaded;
+ head = uw.document.getElementsByTagName('head')[0];
+ head.appendChild(script);
+
+ }
+
+})();

0 comments on commit fd19c84

Please sign in to comment.
Something went wrong with that request. Please try again.