Skip to content

Instantly share code, notes, and snippets.

@barnabyc
Created January 16, 2013 03:21
Show Gist options
  • Save barnabyc/4544400 to your computer and use it in GitHub Desktop.
Save barnabyc/4544400 to your computer and use it in GitHub Desktop.
using System.Html;
using System.Runtime.CompilerServices;
using jQueryApi;
[Mixin("$.fn")]
public static class TextPreviewerjQueryPlugin
{
public static jQueryObject TextPreviewerjQuery(TextPreviewerjQueryOptions options)
{
return jQuery.Current.Each(delegate(int i, Element element)
{
jQueryObject text = jQuery.FromElement(element);
jQueryObject previewer = jQuery.Select("#" + options.PreviewerId);
text.Keyup(delegate
{
previewer.Html(text.GetValue());
});
});
}
}
[Imported]
[ScriptName("Object")]
public sealed class TextPreviewerjQueryOptions
{
public string PreviewerId;
public TextPreviewerjQueryOptions()
{
}
public TextPreviewerjQueryOptions(string previewerId)
{
PreviewerId = previewerId;
}
}
#region Script# Support
[Imported]
public sealed class TextPreviewerjQueryObject : jQueryObject
{
public jQueryObject TextPreviewerjQuery(TextPreviewerjQueryOptions options)
{
return null;
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment