Skip to content

Instantly share code, notes, and snippets.

(function($) {
if (!$.cursorDefault) {
$.extend({ // here is the "key" to it all. This command will "add" your function to the jQuery library
cursorDefault: function() {
document.body.style.cursor = 'default';
}
});
};
})(jQuery);
(function($) {
if (!$.cursorDefault && !$.cursorWait) {
$.extend({
cursorDefault: function() {
document.body.style.cursor = 'default';
},
cursorWait: function() {
document.body.style.cursor = 'wait';
}
});
document.body.style.cursor = 'wait';
document.body.style.cursor = 'default';
// Makes the initial jQuery ready call for ya and then proceeds
// to look at what you're wanting to do with the jQuery library
(function($) {
/* do work*/
})(jQuery); // This closure ensure that your "plug-in" doesn't interfere with other plugins or libraries
if (!$.cursorDefault) {
// This if statement simply check the jQuery library ($) to if .cursorDefault is an already existing namespace.
}
(function($) {
if ( !$.cursorWait ) {
$.extend({
cursorWait: function(bool_value) { // this boolean value can now be set to gives us more functionality to this call
switch (bool_value) {
case true: // if set to true then we do want it to make waiting icon
document.body.style.cursor = 'wait';
break;
case false: // if set to false then we want it to have default style
document.body.style.cursor = 'default';
// to make the cursor begin waiting
$.cursorWait();
// and when you're ready to revert it to normal
$.cursorWait(false);
(function($) {
if ( !$.cursorWait ) {
$.extend({
cursorWait: function(bool_value) {
document.body.style.cursor = bool_value ? 'wait' : 'false';
}
});
};
})(jQuery);
$.myURL("index", "someDir", "someContent.xx") // = http://spyk3lc.blogspot.com/index.php/someDir/someContent.xx
// Notice I have no need to include the .php tag as the extension already includes it via the keyword "index"!