This file contains 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
(function($){ | |
$.widget("ui.mywidget", { | |
options: { | |
autoOpen: true | |
}, | |
_create: function(){ | |
// by default, consider this thing closed. |
This file contains 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
<div class="coa"> | |
<form name="${formName}"> | |
<div class="chartFields"> | |
<div id="messages"> | |
{{if messages && messages.length > 0}} | |
<ul class="messages"> | |
{{each messages}} | |
<li>${$value}</li> | |
{{/each}} | |
</ul> |
This file contains 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
// | |
// This polls a function at max $max_attempts until true, | |
// then executes a function. | |
// The scope is likely this, but ya never know. | |
// | |
// TODO: add failure mechanism | |
$.pollingWait = function(max_attempts, delay, condFunc, condScope, func, scope /*, arguments */ ) { | |
var worker = function(attempts, max_attempts, delay, flagFunc, flagScope, func, scope, args) { | |
if (attempts >= max_attempts) { | |
return false; |
This file contains 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
// | |
// This is a cache implemenation | |
// You can synchronously put(), contains() and markAsLoading(). | |
// You can asynchronously get() and getput() and putget(). | |
// | |
// get() is asynchronous because it might wait until a put() is called if | |
// the key is marked as loading. | |
// key is whatever you want it to be, required. | |
// callback is an optional function that takes 2 arguments: | |
// success/boolean and the value/? |
This file contains 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
// | |
// This is a wrapper around the jquery template library. | |
// | |
// The function to notice is: | |
// applyTemplate(data/{}, target/DOMNode, | |
// callback/function, keepPreviousTemplate/boolean) | |
// Once a template is instanced, calling this function will apply | |
// the template with the given data, then call the callback with | |
// no arguments. | |
// |
This file contains 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
$.fn.sureSubmit = function(func) { | |
this.bind("submit", func).each(function(i, d) { | |
if (!d._origSubmit) { | |
d._origSubmit = d.submit; | |
d.submit = function() { | |
func(); | |
this._origSubmit(); | |
}; | |
} else { | |
var f2 = d.submit; |
This file contains 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
(function () { | |
"use strict"; | |
var browserClass = null; | |
if (navigator.appName === 'Microsoft Internet Explorer') { | |
if (navigator.appVersion.indexOf('MSIE 6', 0) !== -1) { | |
browserClass = "ie6"; | |
} else if (navigator.appVersion.indexOf('MSIE 7', 0) !== -1) { | |
browserClass = "ie7"; | |
} else if (navigator.appVersion.indexOf('MSIE 8', 0) !== -1) { | |
browserClass = "ie8"; |
This file contains 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 { |
This file contains 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 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) { |
OlderNewer