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
@helper DynamicDropDowns() { | |
<script type="text/javascript"> | |
function listChanged($list, $target, url) { | |
var listId = $list.val(); | |
if (listId == "") { // User selected first option, so clear and disable the list | |
$target.empty(); | |
enableList($target, false); | |
return; | |
} | |
$.getJSON(url, { id: listId }, function (data) { |
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
public class MaximumWeightAttribute : ValidationAttribute, IClientValidatable { | |
private const string ERRORMSG = "Weight must not exceed {0} lbs."; | |
public string DependentProperty { get; set; } | |
public string DependentValue { get; set; } | |
public int MaximumWeight { get; set; } | |
public MaximumWeightAttribute(string dependentProperty, string dependentValue, int maximumWeight) { | |
this.DependentProperty = dependentProperty; |
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
<script type="text/javascript"> | |
$.validator.addMethod("maximumweight", | |
function (value, element, parameters) { | |
var carrier = $("#" + parameters["dependentproperty"]).val(); | |
var carriervalue = parameters["dependentvalue"].toString(); | |
var weightvalue = Number(parameters["weightvalue"]); | |
if (carrier == carriervalue && value > weightvalue) { | |
return false; | |
} | |
return true; |
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
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
/// <summary> | |
/// See http://stackoverflow.com/questions/1171035/asp-net-mvc-custom-error-handling-application-error-global-asax/5952774#5952774 | |
/// for implementation details | |
/// </summary> | |
public class AjaxRedirectResult : RedirectResult { |
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
/** | |
* 3D Text plugin for jQuery | |
* v1.0 | |
* Creates 3D text using CSS3 text-shadows | |
* | |
* By Craig Buckler, @craigbuckler, http://optimalworks.net | |
* | |
* As featured on SitePoint.com: | |
* http://www.sitepoint.com/css3-3d-text-jquery-plugin/ | |
* |
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 ($) { | |
$.validator.addMethod("notequal", function (value, element, param) { | |
if (param.indexOf("#") == -1) return value != param; | |
return value != $(param).val(); | |
}, $.validator.messages.notequal); | |
$.validator.unobtrusive.adapters.add("notequal", ["field"], function (options) { | |
options.rules["notequal"] = options.params.field; | |
if (options.message) options.messages["notequal"] = options.message; | |
}); |
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
window.Em = window.Em || {}; | |
Em = { | |
setFocusOutValidation: function (form) { | |
var s = $.data(form, "validator").settings; | |
s.onfocusout = function (element) { | |
if ($(element).val().length > 0) { | |
$(element).valid(); | |
} | |
}; |
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
///<remarks> | |
/// Turns out this wasn't needed - and far less elegant than the existing extension method. | |
/// However, it is still an example of a generic way to match a given property with a value | |
/// and how to select that property by name (string) and compare its value to the value | |
/// that is passed in. It works... | |
///</remarks> | |
public static IList<T> ApplyFilter<T>(this IList<T> list, FilterDescriptor filter) { | |
// We wont allow filtering on anything but string type properties | |
if (filter.MemberType != typeof(string)) throw new ArgumentException("Filtering is only allowed for properties with a type of 'string'."); |
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
var d = $("input[data-toggle-class]"); | |
$.each(d, function (idx, data) { | |
console.log(idx, data); | |
}); |
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
javascript: (function () { | |
var trolls = [ | |
'troll', // <-- add troll names here | |
]; | |
var el = document.createElement('div'), | |
b = document.getElementsByTagName('body')[0]; | |
otherlib = false, msg = ''; | |
el.style.position = 'fixed'; | |
el.style.height = '32px'; |
OlderNewer