This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>onbeforeunload ajax test</title> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
| <script> | |
| $(function() { | |
| window.onbeforeunload = function() { | |
| console.log("saving"); | |
| $.ajax("saved", {async:false}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var exampleFunction = function(a, b, c) { | |
| $(a).append("<p>" + b + "->" + c + "</p>"); | |
| }; | |
| exampleFunction("#a", "example", 1); | |
| // | |
| // This function goes through each entry in the array values | |
| // and if it is an array, Calls func once per value in the array. | |
| // | |
| // The real use of this function is to easily allow functions that normally take | |
| // single values to be expanded without any real work. See Ruleset.addValidator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery/1.5.1/jquery", "Class", "jquery.store", "jquery.executeDeferredStack", "jquery.templater"], | |
| function($, Class, Store, executeDeferredStack, Templater) { | |
| //TODO: somehow let widget state be exposed without depending on widget internals | |
| // | |
| // This is a widget state implementation. | |
| // | |
| // args: | |
| // Recommended: | |
| // templateName/String - should map to a widget.templates[templateName] | |
| // actions/{} - map of action String to either a String or function()->String. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery", "jquery.jqote2", "jquery.deferredPipeline", "jquery.cache"], | |
| function($, jqote2, deferredPipeline, cache) { | |
| // | |
| // This is a wrapper around the jqote2 template library. | |
| // | |
| // The function to notice is: | |
| // applyTemplate(data/{}, target/DOMNode, keepPreviousTemplate/boolean) | |
| // | |
| var templateCache = null; | |
| $.template = Class.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery", "jquery.addTimeoutToDeferred"], | |
| function($, addTimeoutToDeferred) { | |
| var cache = $.cache = Class.extend({ | |
| cache: {}, | |
| ready: {}, | |
| init: function(args) { | |
| this.getput = this.putget; | |
| }, | |
| contains: function(key) { | |
| return this.ready[key] !== undefined; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery"], | |
| function($) { | |
| var addTimeout = $.addTimeoutToDeferred = function(promise, timeout) { | |
| if (promise.isResolved() || promise.isRejected()) | |
| return promise; | |
| var withTimeout = $.Deferred(); | |
| promise.then(function(){withTimeout.resolve(arguments);}, function(){withTimeout.reject(arguments);}); | |
| setTimeout(function() {withTimeout.reject();}, maxWait); | |
| return withTimeout.promise(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery/1.5.1/jquery"], function($) { | |
| // | |
| // This function executes a list of promise returning functions all given the same args | |
| // If you specify a scope, the list may contain string names instead of function references. | |
| // It returns a Promise | |
| // | |
| var executeDeferredStack = $.executeDeferredStack = function(functionStack, args, scope) { | |
| var dfd = $.Deferred(); | |
| var lastFunc = function() { | |
| dfd.resolve(arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(["jquery"], function($) { | |
| // | |
| // Given a list of functions that return a promise or an object, | |
| // Set them up to execute them in order using those promises. | |
| // and returns a promise that resolves after the last promises returned by the function pipeline resolves. | |
| // | |
| var deferredPipeline = $.deferredPipeline = function(/* [function, ]*/) { | |
| //reversed pipeline | |
| var toPipe = Array.prototype.slice.call(arguments).reverse(); | |
| if (toPipe.length == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| requireOnlyIfRequireExists = function(deps, func) { if (require) {require(deps, func);} else { func(); }}; | |
| requireOnlyIfRequireExists(["jquery.min"], function () { | |
| /* | |
| Insert normal jquery plugin logic here | |
| */ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <style type="text/css"> | |
| .readonlyField .label { | |
| display: inline; | |
| text-align: left; | |
| font-size: 12pt; | |
| font-weight: bold; | |
| } | |
| .readonlyField .label:after { |