├── Hexon.MvcTrig.Sample ├── Views │ ├── _ViewStart.cshtml │ ├── Fancybox │ │ ├── Greeting.cshtml │ │ └── Edit.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _DialogLayout.cshtml │ │ └── _Layout.cshtml │ ├── Bootstrap │ │ └── Modal.cshtml │ ├── Card │ │ ├── List.cshtml │ │ └── Edit.cshtml │ └── Web.config ├── Icon.png ├── favicon.ico ├── Scripts │ ├── _references.js │ ├── hexon-mvcTrig.jquery.js │ ├── hexon-mvcTrig.bootstrap.js │ ├── site.event.js │ ├── npm.js │ ├── hexon-mvcTrig.fancybox.js │ ├── hexon-mvcTrig.message.js │ ├── jquery.mousewheel-3.0.6.pack.js │ ├── hexon-mvcTrig.js │ ├── site.js │ ├── jquery.fancybox-buttons.js │ ├── jquery.unobtrusive-ajax.min.js │ ├── respond.min.js │ ├── jquery.fancybox-thumbs.js │ ├── respond.matchmedia.addListener.min.js │ ├── jquery.validate.unobtrusive.min.js │ ├── jquery.fancybox-media.js │ ├── jquery.unobtrusive-ajax.js │ ├── respond.js │ └── respond.matchmedia.addListener.js ├── Content │ ├── fancybox │ │ ├── blank.gif │ │ ├── fancybox_buttons.png │ │ ├── fancybox_loading.gif │ │ ├── fancybox_overlay.png │ │ ├── fancybox_sprite.png │ │ ├── fancybox_sprite@2x.png │ │ └── fancybox_loading@2x.gif │ ├── Site.css │ ├── jquery.fancybox-thumbs.css │ ├── jquery.fancybox-buttons.css │ ├── jquery.fancybox.css │ └── bootstrap-theme.min.css ├── Global.asax ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── Models │ └── Card.cs ├── Controllers │ ├── BootstrapController.cs │ ├── HomeController.cs │ ├── FancyboxController.cs │ └── CardController.cs ├── App_Start │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ └── BundleConfig.cs ├── Global.asax.cs ├── Properties │ └── AssemblyInfo.cs ├── Web.Debug.config ├── Web.Release.config ├── packages.config ├── Web.config ├── Project_Readme.html └── Hexon.MvcTrig.Sample.csproj ├── Hexon.MvcTrig.Bootstrap ├── ModalPack.cs ├── scripts │ └── hexon-mvcTrig.bootstrap.js ├── BootstrapExtensions.cs ├── Properties │ └── AssemblyInfo.cs └── Hexon.MvcTrig.Bootstrap.csproj ├── Hexon.MvcTrig ├── TriggerScope.cs ├── MessageType.cs ├── scripts │ ├── hexon-mvcTrig.jquery.js │ ├── hexon-mvcTrig.message.js │ └── hexon-mvcTrig.js ├── MessagePack.cs ├── TriggerCommand.cs ├── packages.config ├── WebPageBaseExtensions.cs ├── ControllerExtensions.cs ├── HttpHeaderStringEncodeConverter.cs ├── JQueryExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── TriggerActionFilter.cs ├── MessageExtensions.cs ├── Hexon.MvcTrig.csproj └── TriggerContext.cs ├── Hexon.MvcTrig.Fancybox ├── FancyboxPack.cs ├── scripts │ └── hexon-mvcTrig.fancybox.js ├── Properties │ └── AssemblyInfo.cs ├── FancyboxExtensions.cs └── Hexon.MvcTrig.Fancybox.csproj ├── README.md ├── LICENSE.txt ├── Hexon.MvcTrig.sln ├── .gitattributes └── .gitignore /Hexon.MvcTrig.Sample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Icon.png -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/favicon.ico -------------------------------------------------------------------------------- /Hexon.MvcTrig.Bootstrap/ModalPack.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig.Bootstrap 2 | { 3 | public class ModalPack 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Scripts/_references.js -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Fancybox/Greeting.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 |

Greeting

5 | Hello Everyone. 6 | 7 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/blank.gif -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Hexon.MvcTrig.Sample.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_buttons.png -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_loading.gif -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_overlay.png -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_sprite.png -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Fancybox/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | @using (Html.BeginForm("Edit", "Fancybox", FormMethod.Post)) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_sprite@2x.png -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Hexon.MvcTrig/TriggerScope.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | internal enum TriggerScope 4 | { 5 | Self, 6 | Parent, 7 | Top 8 | } 9 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/fancybox/fancybox_loading@2x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/Content/fancybox/fancybox_loading@2x.gif -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dinowang/MvcTrig/HEAD/Hexon.MvcTrig.Sample/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | public enum MessageType 4 | { 5 | Normal = 0, 6 | Warning = 1, 7 | Error = 2, 8 | Success = 3, 9 | Info = 4 10 | } 11 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/scripts/hexon-mvcTrig.jquery.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("event", function (evt, m) { 5 | $(m.selector).trigger(m.eventName, [m.data]); 6 | }); 7 | 8 | } 9 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/hexon-mvcTrig.jquery.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("event", function (evt, m) { 5 | $(m.selector).trigger(m.eventName, [m.data]); 6 | }); 7 | 8 | } 9 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Fancybox/FancyboxPack.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig.Fancybox 2 | { 3 | public class FancyboxPack 4 | { 5 | public string url { get; set; } 6 | 7 | public string width { get; set; } 8 | 9 | public string height { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/MessagePack.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | public class MessagePack 4 | { 5 | public string title { get; set; } 6 | 7 | public string message { get; set; } 8 | 9 | public MessageType type { get; set; } 10 | 11 | public int timeout { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Models/Card.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace Hexon.MvcTrig.Sample.Models 7 | { 8 | public class Card 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | public string Phone { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/hexon-mvcTrig.bootstrap.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("modalOpen", function (evt, m, xhr) { 5 | $(m).modal(); 6 | }); 7 | 8 | window.registerTrigger("modalClose", function (evt, m, xhr) { 9 | //TODO: 10 | }); 11 | } 12 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Bootstrap/scripts/hexon-mvcTrig.bootstrap.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("modalOpen", function (evt, m, xhr) { 5 | console.log(arguments); 6 | }); 7 | 8 | window.registerTrigger("modalClose", function (evt, m, xhr) { 9 | //TODO: 10 | }); 11 | } 12 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Controllers/BootstrapController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using Hexon.MvcTrig.Bootstrap; 3 | 4 | namespace Hexon.MvcTrig.Sample.Controllers 5 | { 6 | public class BootstrapController : Controller 7 | { 8 | public ActionResult Modal() 9 | { 10 | this.Trig(x => x.ModalOpen()); 11 | 12 | return PartialView(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace Hexon.MvcTrig.Sample 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | filters.Add(new TriggerActionFilter()); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 錯誤 11 | 12 | 13 |
14 |

錯誤。

15 |

處理您的要求時發生錯誤。

16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/TriggerCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | internal class TriggerCommand 4 | { 5 | public TriggerScope Scope { get; private set; } 6 | 7 | public string Trigger { get; private set; } 8 | 9 | public object Data { get; private set; } 10 | 11 | public TriggerCommand(TriggerScope scope, string name, object data) 12 | { 13 | Scope = scope; 14 | Trigger = name; 15 | Data = data; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Bootstrap/Modal.cshtml: -------------------------------------------------------------------------------- 1 | 5 | 8 | 12 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/site.event.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | // 全站通用重新載入列表 4 | $("body") 5 | .on("reload-table", function (data) { 6 | var $lists = $("[data-table-url]"); 7 | 8 | $lists.each(function (i, el) { 9 | var $container = $(el), 10 | url = $container.data("table-url"); 11 | 12 | $.get(url, null, function (result, status, xhr) { 13 | $container.html(result); 14 | }); 15 | }); 16 | }); 17 | 18 | }); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /Hexon.MvcTrig/WebPageBaseExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.WebPages; 3 | 4 | namespace Hexon.MvcTrig 5 | { 6 | public static class WebPageBaseExtensions 7 | { 8 | public static TriggerContext Trig(this WebPageBase controller, Func invocation = null) 9 | { 10 | var trig = TriggerContext.Current; 11 | 12 | if (invocation != null) 13 | { 14 | return invocation(trig); 15 | } 16 | 17 | return trig; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/ControllerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Mvc; 4 | 5 | namespace Hexon.MvcTrig 6 | { 7 | public static class ControllerExtensions 8 | { 9 | public static TriggerContext Trig(this Controller controller, Func invocation = null) 10 | { 11 | var trig = TriggerContext.Current; 12 | 13 | if (invocation != null) 14 | { 15 | return invocation(trig); 16 | } 17 | 18 | return trig; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Bootstrap/BootstrapExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | public static class BootstrapExtensions 4 | { 5 | public static TriggerContext ModalOpen(this TriggerContext trigger, string selector = "#modal") 6 | { 7 | trigger.Add("modalOpen", selector); 8 | 9 | return trigger; 10 | } 11 | 12 | public static TriggerContext ModalClose(this TriggerContext trigger) 13 | { 14 | trigger.Add("modalClose", true, lowPiority: true); 15 | 16 | return trigger; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/hexon-mvcTrig.fancybox.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("fancyOpen", function (evt, m) { 5 | var opt = {}; 6 | if (m.width) opt.width = m.width; 7 | if (m.height) opt.height = m.height; 8 | 9 | $.fancybox(m.url, opt); 10 | }); 11 | 12 | window.registerTrigger("fancyClose", function (evt, m) { 13 | $.fancybox.close(); 14 | }); 15 | 16 | window.registerTrigger("fancyResize", function (evt, m) { 17 | $.fancybox.resize(m); 18 | }); 19 | } 20 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Shared/_DialogLayout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @ViewBag.Title - 我的 ASP.NET 應用程式 8 | @Styles.Render("~/Content/css") 9 | @Scripts.Render("~/bundles/modernizr") 10 | 11 | 12 | @RenderBody() 13 | 14 | @Scripts.Render("~/bundles/jquery") 15 | @Scripts.Render("~/bundles/bootstrap") 16 | @RenderSection("scripts", required: false) 17 | 18 | 19 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Fancybox/scripts/hexon-mvcTrig.fancybox.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | if (window.registerTrigger) { 3 | 4 | window.registerTrigger("fancyOpen", function (evt, m) { 5 | var opt = {}; 6 | if (m.width) opt.width = m.width; 7 | if (m.height) opt.height = m.height; 8 | 9 | openFancybox(m.url, opt); 10 | }); 11 | 12 | window.registerTrigger("fancyClose", function (evt, m) { 13 | $.fancybox.close(); 14 | }); 15 | 16 | window.registerTrigger("fancyResize", function (evt, m) { 17 | $.fancybox.resize(m); 18 | }); 19 | } 20 | })(jQuery); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MvcTrig 2 | 3 | ASP.NET MVC Client Trigging Framework 4 | 5 | MvcTrig can help developer write clean MVC Views/PartialViews. 6 | 7 | The goal of project is making View without to have scripts directly. 8 | 9 | Instead of send intents from Actions to browser, handle intents by generalized or customized scripts. 10 | 11 | ## Support both Page / AJAX requests 12 | 13 | MvcTrig support include intents within an AJAX call. And keep HTTP body still clear. 14 | 15 | MvcTrig attach intents in HTTP header to simplfy ViewResult and script codes. 16 | 17 | ## Examples 18 | 19 | 20 | ## License 21 | 22 | Copyright (c) 2015 Dino Wang, licensed under the MIT License (enclosed) 23 | 24 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | body.dialog { 7 | padding: 0; 8 | } 9 | 10 | /* Set padding to keep content from hitting the edges */ 11 | .body-content { 12 | padding-left: 15px; 13 | padding-right: 15px; 14 | } 15 | 16 | /* Override the default bootstrap behavior where horizontal description lists 17 | will truncate terms that are too long to fit in the left column 18 | */ 19 | .dl-horizontal dt { 20 | white-space: normal; 21 | } 22 | 23 | /* Set width on the form input elements since they're 100% wide by default */ 24 | input, 25 | select, 26 | textarea { 27 | max-width: 280px; 28 | } 29 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace Hexon.MvcTrig.Sample 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace Hexon.MvcTrig.Sample 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/HttpHeaderStringEncodeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using Newtonsoft.Json; 4 | 5 | namespace Hexon.MvcTrig 6 | { 7 | internal class HttpHeaderStringEncodeConverter : JsonConverter 8 | { 9 | public override bool CanConvert(Type objectType) 10 | { 11 | return objectType == typeof(string); 12 | } 13 | 14 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 20 | { 21 | writer.WriteValue(HttpUtility.UrlPathEncode((string)value)); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace Hexon.MvcTrig.Sample.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | TriggerContext.Current.Message("Hello"); 21 | 22 | return View(); 23 | } 24 | 25 | public ActionResult Contact() 26 | { 27 | ViewBag.Message = "Your contact page."; 28 | 29 | return View(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Controllers/FancyboxController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using Hexon.MvcTrig.Fancybox; 3 | 4 | namespace Hexon.MvcTrig.Sample.Controllers 5 | { 6 | public class FancyboxController : Controller 7 | { 8 | public ActionResult Greeting() 9 | { 10 | return View(); 11 | } 12 | 13 | public ActionResult Edit() 14 | { 15 | return View(); 16 | } 17 | 18 | [HttpPost] 19 | public ActionResult Edit(FormCollection form) 20 | { 21 | TriggerContext.Current.Parent(x => x.FancyClose()); 22 | 23 | return View(); 24 | } 25 | 26 | public ActionResult Restore() 27 | { 28 | TriggerContext.Current.Parent(x => x.FancyClose()); 29 | 30 | return View("Edit"); 31 | } 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/jquery.fancybox-thumbs.css: -------------------------------------------------------------------------------- 1 | #fancybox-thumbs { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | overflow: hidden; 6 | z-index: 8050; 7 | } 8 | 9 | #fancybox-thumbs.bottom { 10 | bottom: 2px; 11 | } 12 | 13 | #fancybox-thumbs.top { 14 | top: 2px; 15 | } 16 | 17 | #fancybox-thumbs ul { 18 | position: relative; 19 | list-style: none; 20 | margin: 0; 21 | padding: 0; 22 | } 23 | 24 | #fancybox-thumbs ul li { 25 | float: left; 26 | padding: 1px; 27 | opacity: 0.5; 28 | } 29 | 30 | #fancybox-thumbs ul li.active { 31 | opacity: 0.75; 32 | padding: 0; 33 | border: 1px solid #fff; 34 | } 35 | 36 | #fancybox-thumbs ul li:hover { 37 | opacity: 1; 38 | } 39 | 40 | #fancybox-thumbs ul li a { 41 | display: block; 42 | position: relative; 43 | overflow: hidden; 44 | border: 1px solid #222; 45 | background: #111; 46 | outline: none; 47 | } 48 | 49 | #fancybox-thumbs ul li img { 50 | display: block; 51 | position: relative; 52 | border: 0; 53 | padding: 0; 54 | max-width: none; 55 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/JQueryExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | public static class JQueryExtensions 4 | { 5 | /// 6 | /// 觸發一個 DOM 事件 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | public static TriggerContext RaiseEvent(this TriggerContext trigger, string selector, string eventName, object data) 13 | { 14 | trigger.Add("event", new FireEventPack 15 | { 16 | selector = selector, 17 | eventName = eventName, 18 | data = data 19 | }); 20 | 21 | return trigger; 22 | } 23 | 24 | internal class FireEventPack 25 | { 26 | public string selector { get; set; } 27 | 28 | public string eventName { get; set; } 29 | 30 | public object data { get; set; } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊會透過將設定 6 | // 控制。變更這些屬性值可修改與組件關聯的 7 | // 資訊。 8 | [assembly: AssemblyTitle("Hexon.MvcTrig.Sample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Hexon.MvcTrig.Sample")] 13 | [assembly: AssemblyCopyright("Copyright (C) 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible 為 false 的方式來控制,讓此組件中的類型在 18 | // COM 組件中為不可見。如果您需要從 19 | // COM 存取此組件中的型別,請在該型別上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("8fe184b4-0d7d-4652-ac33-4d59e608c1de")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本存取此組件中的類型, 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有值或預設修訂和組件數目 33 | // 指定為預設值: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊是由下列的屬性集控制。 6 | // 變更這些屬性的值即可修改組件的相關 7 | // 資訊。 8 | [assembly: AssemblyTitle("Hexon.MvcTrig")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Hexon.MvcTrig")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型 18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("60f8f505-cbbb-4110-9829-dd9864383adc")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 33 | // 指定為預設值: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Card/List.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | @{ 3 | Layout = null; 4 | } 5 |

6 | @Html.ActionLink("Create New", "Create", null, new { data_fancybox = "50%x90%" }) 7 |

8 | 9 | 10 | 13 | 16 | 17 | 18 | 19 | @foreach (var item in Model) 20 | { 21 | 22 | 25 | 28 | 33 | 34 | } 35 | 36 |
11 | @Html.DisplayNameFor(model => model.Name) 12 | 14 | @Html.DisplayNameFor(model => model.Phone) 15 |
23 | @Html.DisplayFor(modelItem => item.Name) 24 | 26 | @Html.DisplayFor(modelItem => item.Phone) 27 | 29 | @Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { data_fancybox = "50%x90%" }) | 30 | @Html.ActionLink("Details", "Details", new { id = item.Id }, new { data_fancybox = "50%x90%" }) | 31 | @Html.ActionLink("Delete", "Delete", new { id = item.Id }) 32 |
37 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Bootstrap/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊是由下列的屬性集控制。 6 | // 變更這些屬性的值即可修改組件的相關 7 | // 資訊。 8 | [assembly: AssemblyTitle("Hexon.MvcTrig.Bootstrap")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Hexon.MvcTrig.Bootstrap")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型 18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("104c42fc-1c51-4dbe-9be4-cb26b0601687")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 33 | // 指定為預設值: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Fancybox/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 組件的一般資訊是由下列的屬性集控制。 6 | // 變更這些屬性的值即可修改組件的相關 7 | // 資訊。 8 | [assembly: AssemblyTitle("Hexon.MvcTrig.Fancybox")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Hexon.MvcTrig.Fancybox")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 將 ComVisible 設定為 false 會使得這個組件中的類型 18 | // 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中 19 | // 的類型,請在該類型上將 ComVisible 屬性設定為 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID 23 | [assembly: Guid("ffba2872-f3f9-4857-8984-05bb21b6cd8f")] 24 | 25 | // 組件的版本資訊是由下列四項值構成: 26 | // 27 | // 主要版本 28 | // 次要版本 29 | // 組建編號 30 | // 修訂編號 31 | // 32 | // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 33 | // 指定為預設值: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2015 Dino Wang, https://www.facebook.com/dino.wang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/scripts/hexon-mvcTrig.message.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | 3 | if (window.registerTrigger) { 4 | var notifyTypes = ["alert", "warning", "error", "success", "information"]; 5 | 6 | window.registerTrigger("message", function(evt, m) { 7 | alert(m.message); 8 | }); 9 | 10 | window.registerTrigger("notify", function(evt, m) { 11 | alert(m.message); 12 | 13 | //$.pnotify({ 14 | // title: m.title || "通知", 15 | // text: m.message, 16 | // type: notifyTypes[m.type] 17 | //}); 18 | 19 | //var config = { 20 | // theme: "bootstrapTheme", 21 | // layout: 'topCenter', 22 | // dismissQueue: true, 23 | // type: notifyTypes[m.type], 24 | // //title: m.title || "通知", 25 | // text: m.message, 26 | // timeout: m.timeout 27 | // //animation: { 28 | // // open: 'animated bounceInLeft', 29 | // // close: 'animated bounceOutLeft' 30 | // //} 31 | // }, 32 | // n = noty(config); 33 | 34 | }); 35 | } 36 | 37 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/hexon-mvcTrig.message.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | 3 | if (window.registerTrigger) { 4 | var notifyTypes = ["alert", "warning", "error", "success", "information"]; 5 | 6 | window.registerTrigger("message", function(evt, m) { 7 | alert(m.message); 8 | }); 9 | 10 | window.registerTrigger("notify", function(evt, m) { 11 | alert(m.message); 12 | 13 | //$.pnotify({ 14 | // title: m.title || "通知", 15 | // text: m.message, 16 | // type: notifyTypes[m.type] 17 | //}); 18 | 19 | //var config = { 20 | // theme: "bootstrapTheme", 21 | // layout: 'topCenter', 22 | // dismissQueue: true, 23 | // type: notifyTypes[m.type], 24 | // //title: m.title || "通知", 25 | // text: m.message, 26 | // timeout: m.timeout 27 | // //animation: { 28 | // // open: 'animated bounceInLeft', 29 | // // close: 'animated bounceOutLeft' 30 | // //} 31 | // }, 32 | // n = noty(config); 33 | 34 | }); 35 | } 36 | 37 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.mousewheel-3.0.6.pack.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * Thanks to: Seamus Leahy for adding deltaX and deltaY 7 | * 8 | * Version: 3.0.6 9 | * 10 | * Requires: 1.2.2+ 11 | */ 12 | (function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]= 13 | d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig/TriggerActionFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace Hexon.MvcTrig 8 | { 9 | public class TriggerActionFilter : ActionFilterAttribute 10 | { 11 | private bool _flush = false; 12 | 13 | public override void OnActionExecuting(ActionExecutingContext filterContext) 14 | { 15 | _flush = !filterContext.IsChildAction; 16 | 17 | base.OnActionExecuting(filterContext); 18 | } 19 | 20 | public override void OnResultExecuted(ResultExecutedContext filterContext) 21 | { 22 | if (_flush && filterContext.ParentActionViewContext == null && TriggerContext.HasTrigger) 23 | { 24 | var httpContext = filterContext.RequestContext.HttpContext; 25 | var response = httpContext.Response; 26 | 27 | if (response.StatusCode == 302) 28 | { 29 | // HTTP Redirect 30 | httpContext.Session[TriggerContext._identifier] = TriggerContext.Current; 31 | } 32 | else 33 | { 34 | var routeData = filterContext.RouteData; 35 | 36 | TriggerContext.Current.Tag = string.Concat(routeData.Values["controller"], ".", routeData.Values["action"]); 37 | TriggerContext.Current.Flush(); 38 | } 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig/scripts/hexon-mvcTrig.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | 3 | if (!window.registerTrigger) { 4 | var triggers = { 5 | "reload": function (evt) { 6 | location.reload(); 7 | } 8 | }; 9 | 10 | window.registerTrigger = function(name, callback) { 11 | triggers[name] = callback; 12 | }; 13 | 14 | window.getTrigger = function(name) { 15 | //return triggers[name] || function () { }; 16 | return triggers[name]; 17 | }; 18 | } 19 | 20 | function takeHeaderData(xhr, key, callback) { 21 | var content = xhr.getResponseHeader(key); 22 | if (content) { 23 | callback(content); 24 | } 25 | } 26 | 27 | function executeEachDirective(m) { 28 | var targets = [ window, parent || window, top || parent || window ]; 29 | 30 | takeHeaderData(m.xhr, "X-Triggers", function (n) { 31 | for (var i = 0; i < n; i++) { 32 | takeHeaderData(m.xhr, "X-Trigger-" + i, function (data) { 33 | var pack = JSON.parse(decodeURIComponent(data)), 34 | action = window.getTrigger(pack.trigger); 35 | 36 | action.apply(targets[pack.scope].document.body, [m.evt, pack.data, m.xhr]); 37 | }); 38 | } 39 | }); 40 | 41 | targets = null; 42 | } 43 | 44 | // AJAX 透過 HTTP response header 攜帶 trigger 命令 45 | $(document) 46 | .ajaxSuccess(function (evt, xhr, options, result) { 47 | executeEachDirective({ evt: evt, xhr: xhr, options: options, result: result }); 48 | }); 49 | 50 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig/MessageExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Hexon.MvcTrig 2 | { 3 | public static class MessageExtensions 4 | { 5 | /// 6 | /// 顯示通知 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static TriggerContext Notify(this TriggerContext trigger, object message, string title = null, MessageType type = MessageType.Info, int timeout = 2000) 14 | { 15 | trigger.Add("notify", new MessagePack 16 | { 17 | title = title, 18 | message = message.ToString(), 19 | type = type, 20 | timeout = timeout 21 | }); 22 | 23 | return trigger; 24 | } 25 | 26 | /// 27 | /// 顯示訊息視窗 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | /// 34 | public static TriggerContext Message(this TriggerContext trigger, object message, string title = null, MessageType type = MessageType.Info, int timeout = 2000) 35 | { 36 | trigger.Add("message", new MessagePack 37 | { 38 | title = title, 39 | message = message.ToString(), 40 | type = type, 41 | timeout = timeout 42 | }); 43 | 44 | return trigger; 45 | } 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/hexon-mvcTrig.js: -------------------------------------------------------------------------------- 1 | ; (function ($) { 2 | 3 | if (!window.registerTrigger) { 4 | var triggers = { 5 | "changeUrl": function (evt, m) { 6 | location.href = m; 7 | }, 8 | "reload": function (evt) { 9 | location.reload(); 10 | } 11 | }; 12 | 13 | window.registerTrigger = function(name, callback) { 14 | triggers[name] = callback; 15 | }; 16 | 17 | window.getTrigger = function(name) { 18 | //return triggers[name] || function () { }; 19 | return triggers[name]; 20 | }; 21 | } 22 | 23 | function takeHeaderData(xhr, key, callback) { 24 | var content = xhr.getResponseHeader(key); 25 | if (content) { 26 | callback(content); 27 | } 28 | } 29 | 30 | function executeEachDirective(m) { 31 | var targets = [ window, parent || window, top || parent || window ]; 32 | 33 | takeHeaderData(m.xhr, "X-Triggers", function (n) { 34 | for (var i = 0; i < n; i++) { 35 | takeHeaderData(m.xhr, "X-Trigger-" + i, function (data) { 36 | var pack = JSON.parse(decodeURIComponent(data)), 37 | action = window.getTrigger(pack.trigger); 38 | 39 | action.apply(targets[pack.scope].document.body, [m.evt, pack.data]); 40 | }); 41 | } 42 | }); 43 | 44 | targets = null; 45 | } 46 | 47 | // AJAX 透過 HTTP response header 攜帶 trigger 命令 48 | $(document) 49 | .ajaxSuccess(function (evt, xhr, options, result) { 50 | executeEachDirective({ evt: evt, xhr: xhr, options: options, result: result }); 51 | }); 52 | 53 | })(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Card/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model Hexon.MvcTrig.Sample.Models.Card 2 | @{ 3 | Layout = "~/Views/Shared/_DialogLayout.cshtml"; 4 | } 5 |
6 | @using (Html.BeginForm()) 7 | { 8 | @Html.AntiForgeryToken() 9 | 10 |
11 |

Card

12 |
13 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 14 | @Html.HiddenFor(model => model.Id) 15 | 16 |
17 | @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" }) 18 |
19 | @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) 20 | @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) 21 |
22 |
23 | 24 |
25 | @Html.LabelFor(model => model.Phone, htmlAttributes: new { @class = "control-label col-md-2" }) 26 |
27 | @Html.EditorFor(model => model.Phone, new { htmlAttributes = new { @class = "form-control" } }) 28 | @Html.ValidationMessageFor(model => model.Phone, "", new { @class = "text-danger" }) 29 |
30 |
31 | 32 |
33 |
34 | 35 | Cancel 36 |
37 |
38 |
39 | } 40 |
41 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace Hexon.MvcTrig.Sample 5 | { 6 | public class BundleConfig 7 | { 8 | // 如需「搭配」的詳細資訊,請瀏覽 http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js", 13 | "~/Scripts/jquery.unobtrusive-ajax.js", 14 | "~/Scripts/jquery.fancybox.js", 15 | "~/Scripts/hexon-mvcTrig.js", 16 | "~/Scripts/hexon-mvcTrig.message.js", 17 | "~/Scripts/hexon-mvcTrig.jquery.js", 18 | "~/Scripts/hexon-mvcTrig.fancybox.js", 19 | "~/Scripts/hexon-mvcTrig.bootstrap.js", 20 | "~/Scripts/site.js")); 21 | 22 | bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( 23 | "~/Scripts/jquery.validate*")); 24 | 25 | // 使用開發版本的 Modernizr 進行開發並學習。然後,當您 26 | // 準備好實際執行時,請使用 http://modernizr.com 上的建置工具,只選擇您需要的測試。 27 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 28 | "~/Scripts/modernizr-*")); 29 | 30 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 31 | "~/Scripts/bootstrap.js", 32 | "~/Scripts/respond.js")); 33 | 34 | bundles.Add(new StyleBundle("~/Content/css").Include( 35 | "~/Content/bootstrap.css", 36 | "~/Content/site.css", 37 | "~/Content/jquery.fancybox.css", 38 | "~/Content/jquery.fancybox-buttons.css", 39 | "~/Content/jquery.fancybox-thumbs.css")); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 5 |
6 |

MvcTrig

7 |

ASP.NET MVC Client Trigging Framework

8 |

GitHub »

9 |
10 | 11 |
12 |
13 |

Integrate with Notification

14 |

15 |

@Ajax.ActionLink(HttpUtility.HtmlDecode("Learn more »"), "About", "Home", null, new AjaxOptions { }, new { @class = "btn btn-default" })

16 |
17 |
18 |

Integrate with Bootstrap

19 |

20 |

@Ajax.ActionLink(HttpUtility.HtmlDecode("See how »"), "Modal", "Bootstrap", null, new AjaxOptions { }, new { @class = "btn btn-default" })

21 |
22 |
23 |

Integrate with Fancybox

24 |

25 |

26 |

See how »

27 |
28 |
29 | 30 |
31 |
32 |

List and editing

33 |

34 |

Cards »

35 |
36 | @* 37 |
38 |

Integrate with Bootstrap

39 |

40 |

@Ajax.ActionLink(HttpUtility.HtmlDecode("See how »"), "Modal", "Bootstrap", null, new AjaxOptions { }, new { @class = "btn btn-default" })

41 |
42 |
43 |

Integrate with Fancybox

44 |

45 |

46 |

See how »

47 |
48 | *@ 49 |
-------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Controllers/CardController.cs: -------------------------------------------------------------------------------- 1 | using Hexon.MvcTrig.Sample.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | 8 | namespace Hexon.MvcTrig.Sample.Controllers 9 | { 10 | public class CardController : Controller 11 | { 12 | private static IList Cards { get; } = new List 13 | { 14 | new Card { Id = 1, Name = "Bibby Be", Phone = "0900000001" }, 15 | new Card { Id = 2, Name = "Bruce Chen", Phone = "0900000002" }, 16 | new Card { Id = 3, Name = "Demo Fan", Phone = "0900000003" }, 17 | new Card { Id = 4, Name = "Dino Wang", Phone = "0900000004" }, 18 | new Card { Id = 5, Name = "Jerry Chiang", Phone = "0900000005" }, 19 | new Card { Id = 6, Name = "Kevin Tseng", Phone = "0900000006" }, 20 | new Card { Id = 7, Name = "Wade Huang", Phone = "0900000007" }, 21 | new Card { Id = 8, Name = "阿砮", Phone = "0900000008" }, 22 | }; 23 | 24 | // GET: Card 25 | public ActionResult Index() 26 | { 27 | return View(); 28 | } 29 | 30 | public ActionResult List() 31 | { 32 | return View(Cards); 33 | } 34 | 35 | 36 | public ActionResult Create() 37 | { 38 | var entity = new Card(); 39 | 40 | return View("Edit", entity); 41 | } 42 | 43 | [HttpPost] 44 | public ActionResult Create(Card card) 45 | { 46 | var id = Cards.Max(x => x.Id); 47 | 48 | card.Id = id + 1; 49 | 50 | Cards.Add(card); 51 | 52 | TriggerContext.Current.Parent(x => x.RaiseEvent("body", "reload-table", null).FancyClose()); 53 | 54 | return View("Edit"); 55 | } 56 | 57 | public ActionResult Edit(int id) 58 | { 59 | var entity = Cards.First(x => x.Id == id); 60 | 61 | return View(entity); 62 | } 63 | 64 | [HttpPost] 65 | public ActionResult Edit(Card card) 66 | { 67 | var entity = Cards.First(x => x.Id == card.Id); 68 | 69 | entity.Name = card.Name; 70 | entity.Phone = card.Phone; 71 | 72 | TriggerContext.Current.Parent(x => x.RaiseEvent("body", "reload-table", null).FancyClose()); 73 | 74 | return View(); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Fancybox/FancyboxExtensions.cs: -------------------------------------------------------------------------------- 1 | using Hexon.MvcTrig.Fancybox; 2 | 3 | namespace Hexon.MvcTrig 4 | { 5 | public static class FancyboxExtensions 6 | { 7 | /// 8 | /// 關閉目前視窗中的 fancybox 9 | /// 10 | /// 11 | public static TriggerContext FancyClose(this TriggerContext trigger) 12 | { 13 | trigger.Add("fancyClose", true, lowPiority: true); 14 | 15 | return trigger; 16 | } 17 | 18 | /// 19 | /// 開啟一個 fancybox 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | public static TriggerContext FancyOpen(this TriggerContext trigger, string url, int? width = null, int? height = null) 26 | { 27 | trigger.Add("fancyOpen", new FancyboxPack 28 | { 29 | url = url, 30 | width = width.ToString(), 31 | height = height.ToString() 32 | }, 33 | lowPiority: true); 34 | 35 | return trigger; 36 | } 37 | 38 | /// 39 | /// 開啟一個 fancybox 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | public static TriggerContext FancyOpen(this TriggerContext trigger, string url, string width = null, string height = null) 46 | { 47 | trigger.Add("fancyOpen", new FancyboxPack 48 | { 49 | url = url, 50 | width = width, 51 | height = height 52 | }, 53 | lowPiority: true); 54 | 55 | return trigger; 56 | } 57 | 58 | /// 59 | /// 變動 fancybox 規格 60 | /// 61 | /// 62 | /// 63 | /// 64 | /// 65 | public static TriggerContext FancyResize(this TriggerContext trigger, string width = null, string height = null) 66 | { 67 | trigger.Add("fancyResize", new FancyboxPack 68 | { 69 | width = width, 70 | height = height 71 | }, 72 | lowPiority: false); 73 | 74 | return trigger; 75 | } 76 | 77 | } 78 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hexon.MvcTrig", "Hexon.MvcTrig\Hexon.MvcTrig.csproj", "{1A488C44-DCA1-49B4-BDC3-100FE7F0A737}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hexon.MvcTrig.Fancybox", "Hexon.MvcTrig.Fancybox\Hexon.MvcTrig.Fancybox.csproj", "{9A12E6E1-BE2C-485A-89D9-CD69ED5927E5}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hexon.MvcTrig.Sample", "Hexon.MvcTrig.Sample\Hexon.MvcTrig.Sample.csproj", "{2FF5FDC4-B05D-4E39-B407-EC8750B4EF81}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hexon.MvcTrig.Bootstrap", "Hexon.MvcTrig.Bootstrap\Hexon.MvcTrig.Bootstrap.csproj", "{923B365A-9314-4A74-B620-4D59B24D57FB}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {1A488C44-DCA1-49B4-BDC3-100FE7F0A737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1A488C44-DCA1-49B4-BDC3-100FE7F0A737}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1A488C44-DCA1-49B4-BDC3-100FE7F0A737}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1A488C44-DCA1-49B4-BDC3-100FE7F0A737}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {9A12E6E1-BE2C-485A-89D9-CD69ED5927E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {9A12E6E1-BE2C-485A-89D9-CD69ED5927E5}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {9A12E6E1-BE2C-485A-89D9-CD69ED5927E5}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {9A12E6E1-BE2C-485A-89D9-CD69ED5927E5}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {2FF5FDC4-B05D-4E39-B407-EC8750B4EF81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {2FF5FDC4-B05D-4E39-B407-EC8750B4EF81}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {2FF5FDC4-B05D-4E39-B407-EC8750B4EF81}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {2FF5FDC4-B05D-4E39-B407-EC8750B4EF81}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {923B365A-9314-4A74-B620-4D59B24D57FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {923B365A-9314-4A74-B620-4D59B24D57FB}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {923B365A-9314-4A74-B620-4D59B24D57FB}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {923B365A-9314-4A74-B620-4D59B24D57FB}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @ViewBag.Title - 我的 ASP.NET 應用程式 8 | @Styles.Render("~/Content/css") 9 | @Scripts.Render("~/bundles/modernizr") 10 | 11 | 12 | 31 |
32 | @RenderBody() 33 |
34 |
35 |

© @DateTime.Now.Year - 我的 ASP.NET 應用程式

36 |
37 |
38 | 39 | 55 | 56 | @Scripts.Render("~/bundles/jquery") 57 | @Scripts.Render("~/bundles/bootstrap") 58 | @RenderSection("scripts", required: false) 59 | 60 | 61 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/site.js: -------------------------------------------------------------------------------- 1 | function openFancybox(url, options) { 2 | if (!url || url.match(/^\s*javascript/)) { 3 | return; 4 | } 5 | 6 | var defaults = { 7 | type: "iframe", 8 | href: url, 9 | autoSize: true, 10 | padding: 5, 11 | scrolling: "no", 12 | helpers: { 13 | overlay: { 14 | css: { 15 | "background": "rgba(0, 0, 0, .5)", 16 | "overflow": "auto" 17 | } 18 | } 19 | } 20 | }; 21 | 22 | if (url && url.indexOf("#") > -1) { 23 | defaults.type = "inline"; 24 | } 25 | 26 | options = options || {}; 27 | 28 | if ($.isPlainObject(options)) { 29 | options.autoSize = (!options.width && !options.height); 30 | $.extend(defaults, options); 31 | } 32 | 33 | if (options.autoSize) { 34 | defaults.helpers.overlay.css.overflow = "hidden"; 35 | } 36 | if (defaults.width === "100%") { 37 | defaults.margin[1] = defaults.margin[3] = 0; 38 | } 39 | if (defaults.height === "100%") { 40 | defaults.margin[0] = defaults.margin[2] = 0; 41 | } 42 | 43 | console.log(defaults); 44 | 45 | $.fancybox(defaults); 46 | } 47 | 48 | 49 | $(document).ready(function () { 50 | 51 | // 全站通用開啟燈箱 52 | $("body") 53 | .on("click", "a[data-fancybox]", function () { 54 | var $this = $(this), 55 | sizes = $this.data("fancybox").match(/^(\d+%?)(x(\d+%?))?(\s|$)/), 56 | opts = { autoSize: true }; 57 | 58 | console.log(sizes); 59 | 60 | if (sizes) { 61 | var w = sizes[1], 62 | h = sizes[3] || w; 63 | 64 | if (w.indexOf("%") == -1) { 65 | w = parseInt(w); 66 | } 67 | if (h.indexOf("%") == -1) { 68 | h = parseInt(h); 69 | } 70 | 71 | opts.height = h; 72 | opts.width = w; 73 | opts.autoSize = false; 74 | } 75 | 76 | openFancybox(this.href, opts); 77 | 78 | return false; 79 | }); 80 | 81 | // 全站通用重新載入列表 82 | $("body") 83 | .on("reload-table", function (data) { 84 | var $lists = $("[data-table-url]"); 85 | 86 | $lists.each(function (i, el) { 87 | var $container = $(el), 88 | url = $container.data("table-url"); 89 | 90 | $.get(url, null, function (result, status, xhr) { 91 | $container.html(result); 92 | }); 93 | }); 94 | }); 95 | 96 | }); -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/jquery.fancybox-buttons.css: -------------------------------------------------------------------------------- 1 | #fancybox-buttons { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | z-index: 8050; 6 | } 7 | 8 | #fancybox-buttons.top { 9 | top: 10px; 10 | } 11 | 12 | #fancybox-buttons.bottom { 13 | bottom: 10px; 14 | } 15 | 16 | #fancybox-buttons ul { 17 | display: block; 18 | width: 166px; 19 | height: 30px; 20 | margin: 0 auto; 21 | padding: 0; 22 | list-style: none; 23 | border: 1px solid #111; 24 | border-radius: 3px; 25 | -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 26 | -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 27 | box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 28 | background: rgb(50,50,50); 29 | background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); 30 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); 31 | background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 32 | background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 33 | background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 34 | background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 35 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); 36 | } 37 | 38 | #fancybox-buttons ul li { 39 | float: left; 40 | margin: 0; 41 | padding: 0; 42 | } 43 | 44 | #fancybox-buttons a { 45 | display: block; 46 | width: 30px; 47 | height: 30px; 48 | text-indent: -9999px; 49 | background-color: transparent; 50 | background-image: url('fancybox/fancybox_buttons.png'); 51 | background-repeat: no-repeat; 52 | outline: none; 53 | opacity: 0.8; 54 | padding-left: 0; 55 | padding-right: 0; 56 | } 57 | 58 | #fancybox-buttons a:hover { 59 | opacity: 1; 60 | } 61 | 62 | #fancybox-buttons a.btnPrev { 63 | background-position: 5px 0; 64 | } 65 | 66 | #fancybox-buttons a.btnNext { 67 | background-position: -33px 0; 68 | border-right: 1px solid #3e3e3e; 69 | } 70 | 71 | #fancybox-buttons a.btnPlay { 72 | background-position: 0 -30px; 73 | } 74 | 75 | #fancybox-buttons a.btnPlayOn { 76 | background-position: -30px -30px; 77 | } 78 | 79 | #fancybox-buttons a.btnToggle { 80 | background-position: 3px -60px; 81 | border-left: 1px solid #111; 82 | border-right: 1px solid #3e3e3e; 83 | width: 35px 84 | } 85 | 86 | #fancybox-buttons a.btnToggleOn { 87 | background-position: -27px -60px; 88 | } 89 | 90 | #fancybox-buttons a.btnClose { 91 | border-left: 1px solid #111; 92 | width: 35px; 93 | background-position: -56px 0px; 94 | } 95 | 96 | #fancybox-buttons a.btnDisabled { 97 | opacity : 0.4; 98 | cursor: default; 99 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Fancybox/Hexon.MvcTrig.Fancybox.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9A12E6E1-BE2C-485A-89D9-CD69ED5927E5} 8 | Library 9 | Properties 10 | Hexon.MvcTrig 11 | Hexon.MvcTrig.Fancybox 12 | v4.5.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {1a488c44-dca1-49b4-bdc3-100fe7f0a737} 49 | Hexon.MvcTrig 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Bootstrap/Hexon.MvcTrig.Bootstrap.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {923B365A-9314-4A74-B620-4D59B24D57FB} 8 | Library 9 | Properties 10 | Hexon.MvcTrig 11 | Hexon.MvcTrig.Bootstrap 12 | v4.5.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {1a488c44-dca1-49b4-bdc3-100fe7f0a737} 49 | Hexon.MvcTrig 50 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.fancybox-buttons.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Buttons helper for fancyBox 3 | * version: 1.0.5 (Mon, 15 Oct 2012) 4 | * @requires fancyBox v2.0 or later 5 | * 6 | * Usage: 7 | * $(".fancybox").fancybox({ 8 | * helpers : { 9 | * buttons: { 10 | * position : 'top' 11 | * } 12 | * } 13 | * }); 14 | * 15 | */ 16 | (function ($) { 17 | //Shortcut for fancyBox object 18 | var F = $.fancybox; 19 | 20 | //Add helper object 21 | F.helpers.buttons = { 22 | defaults : { 23 | skipSingle : false, // disables if gallery contains single image 24 | position : 'top', // 'top' or 'bottom' 25 | tpl : '
' 26 | }, 27 | 28 | list : null, 29 | buttons: null, 30 | 31 | beforeLoad: function (opts, obj) { 32 | //Remove self if gallery do not have at least two items 33 | 34 | if (opts.skipSingle && obj.group.length < 2) { 35 | obj.helpers.buttons = false; 36 | obj.closeBtn = true; 37 | 38 | return; 39 | } 40 | 41 | //Increase top margin to give space for buttons 42 | obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; 43 | }, 44 | 45 | onPlayStart: function () { 46 | if (this.buttons) { 47 | this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); 48 | } 49 | }, 50 | 51 | onPlayEnd: function () { 52 | if (this.buttons) { 53 | this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); 54 | } 55 | }, 56 | 57 | afterShow: function (opts, obj) { 58 | var buttons = this.buttons; 59 | 60 | if (!buttons) { 61 | this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); 62 | 63 | buttons = { 64 | prev : this.list.find('.btnPrev').click( F.prev ), 65 | next : this.list.find('.btnNext').click( F.next ), 66 | play : this.list.find('.btnPlay').click( F.play ), 67 | toggle : this.list.find('.btnToggle').click( F.toggle ), 68 | close : this.list.find('.btnClose').click( F.close ) 69 | } 70 | } 71 | 72 | //Prev 73 | if (obj.index > 0 || obj.loop) { 74 | buttons.prev.removeClass('btnDisabled'); 75 | } else { 76 | buttons.prev.addClass('btnDisabled'); 77 | } 78 | 79 | //Next / Play 80 | if (obj.loop || obj.index < obj.group.length - 1) { 81 | buttons.next.removeClass('btnDisabled'); 82 | buttons.play.removeClass('btnDisabled'); 83 | 84 | } else { 85 | buttons.next.addClass('btnDisabled'); 86 | buttons.play.addClass('btnDisabled'); 87 | } 88 | 89 | this.buttons = buttons; 90 | 91 | this.onUpdate(opts, obj); 92 | }, 93 | 94 | onUpdate: function (opts, obj) { 95 | var toggle; 96 | 97 | if (!this.buttons) { 98 | return; 99 | } 100 | 101 | toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); 102 | 103 | //Size toggle button 104 | if (obj.canShrink) { 105 | toggle.addClass('btnToggleOn'); 106 | 107 | } else if (!obj.canExpand) { 108 | toggle.addClass('btnDisabled'); 109 | } 110 | }, 111 | 112 | beforeClose: function () { 113 | if (this.list) { 114 | this.list.remove(); 115 | } 116 | 117 | this.list = null; 118 | this.buttons = null; 119 | } 120 | }; 121 | 122 | }(jQuery)); 123 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # Roslyn cache directories 20 | *.ide/ 21 | 22 | # MSTest test Results 23 | [Tt]est[Rr]esult*/ 24 | [Bb]uild[Ll]og.* 25 | 26 | #NUNIT 27 | *.VisualState.xml 28 | TestResult.xml 29 | 30 | # Build Results of an ATL Project 31 | [Dd]ebugPS/ 32 | [Rr]eleasePS/ 33 | dlldata.c 34 | 35 | *_i.c 36 | *_p.c 37 | *_i.h 38 | *.ilk 39 | *.meta 40 | *.obj 41 | *.pch 42 | *.pdb 43 | *.pgc 44 | *.pgd 45 | *.rsp 46 | *.sbr 47 | *.tlb 48 | *.tli 49 | *.tlh 50 | *.tmp 51 | *.tmp_proj 52 | *.log 53 | *.vspscc 54 | *.vssscc 55 | .builds 56 | *.pidb 57 | *.svclog 58 | *.scc 59 | 60 | # Chutzpah Test files 61 | _Chutzpah* 62 | 63 | # Visual C++ cache files 64 | ipch/ 65 | *.aps 66 | *.ncb 67 | *.opensdf 68 | *.sdf 69 | *.cachefile 70 | 71 | # Visual Studio profiler 72 | *.psess 73 | *.vsp 74 | *.vspx 75 | 76 | # TFS 2012 Local Workspace 77 | $tf/ 78 | 79 | # Guidance Automation Toolkit 80 | *.gpState 81 | 82 | # ReSharper is a .NET coding add-in 83 | _ReSharper*/ 84 | *.[Rr]e[Ss]harper 85 | *.DotSettings.user 86 | 87 | # JustCode is a .NET coding addin-in 88 | .JustCode 89 | 90 | # TeamCity is a build add-in 91 | _TeamCity* 92 | 93 | # DotCover is a Code Coverage Tool 94 | *.dotCover 95 | 96 | # NCrunch 97 | _NCrunch_* 98 | .*crunch*.local.xml 99 | 100 | # MightyMoose 101 | *.mm.* 102 | AutoTest.Net/ 103 | 104 | # Web workbench (sass) 105 | .sass-cache/ 106 | 107 | # Installshield output folder 108 | [Ee]xpress/ 109 | 110 | # DocProject is a documentation generator add-in 111 | DocProject/buildhelp/ 112 | DocProject/Help/*.HxT 113 | DocProject/Help/*.HxC 114 | DocProject/Help/*.hhc 115 | DocProject/Help/*.hhk 116 | DocProject/Help/*.hhp 117 | DocProject/Help/Html2 118 | DocProject/Help/html 119 | 120 | # Click-Once directory 121 | publish/ 122 | 123 | # Publish Web Output 124 | *.[Pp]ublish.xml 125 | *.azurePubxml 126 | ## TODO: Comment the next line if you want to checkin your 127 | ## web deploy settings but do note that will include unencrypted 128 | ## passwords 129 | #*.pubxml 130 | 131 | # NuGet Packages Directory 132 | packages/* 133 | ## TODO: If the tool you use requires repositories.config 134 | ## uncomment the next line 135 | #!packages/repositories.config 136 | 137 | # Enable "build/" folder in the NuGet Packages folder since 138 | # NuGet packages use it for MSBuild targets. 139 | # This line needs to be after the ignore of the build folder 140 | # (and the packages folder if the line above has been uncommented) 141 | !packages/build/ 142 | 143 | # Windows Azure Build Output 144 | csx/ 145 | *.build.csdef 146 | 147 | # Windows Store app package directory 148 | AppPackages/ 149 | 150 | # Others 151 | sql/ 152 | *.Cache 153 | ClientBin/ 154 | [Ss]tyle[Cc]op.* 155 | ~$* 156 | *~ 157 | *.dbmdl 158 | *.dbproj.schemaview 159 | *.pfx 160 | *.publishsettings 161 | node_modules/ 162 | 163 | # RIA/Silverlight projects 164 | Generated_Code/ 165 | 166 | # Backup & report files from converting an old project file 167 | # to a newer Visual Studio version. Backup files are not needed, 168 | # because we have git ;-) 169 | _UpgradeReport_Files/ 170 | Backup*/ 171 | UpgradeLog*.XML 172 | UpgradeLog*.htm 173 | 174 | # SQL Server files 175 | *.mdf 176 | *.ldf 177 | 178 | # Business Intelligence projects 179 | *.rdl.data 180 | *.bim.layout 181 | *.bim_*.settings 182 | 183 | # Microsoft Fakes 184 | FakesAssemblies/ 185 | 186 | # LightSwitch generated files 187 | GeneratedArtifacts/ 188 | _Pvt_Extensions/ 189 | ModelManifest.xml -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.unobtrusive-ajax.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive Ajax support library for jQuery 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var b="unobtrusiveAjaxClick",d="unobtrusiveAjaxClickTarget",h="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function e(a){return a==="GET"||a==="POST"}function g(b,a){!e(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function i(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("
").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("
").html(b).contents().each(function(){c.appendChild(this)});break;case"REPLACE-WITH":a(c).replaceWith(b);break;default:a(c).html(b)}})}function f(b,d){var j,k,f,h;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));h=parseInt(b.getAttribute("data-ajax-loading-duration"),10)||0;a.extend(d,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,cache:!!b.getAttribute("data-ajax-cache"),beforeSend:function(d){var a;g(d,f);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(b,arguments);a!==false&&k.show(h);return a},complete:function(){k.hide(h);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(b,arguments)},success:function(a,e,d){i(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(b,arguments)},error:function(){c(b.getAttribute("data-ajax-failure"),["xhr","status","error"]).apply(b,arguments)}});d.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});f=d.type.toUpperCase();if(!e(f)){d.type="POST";d.data.push({name:"X-HTTP-Method-Override",value:f})}a.ajax(d)}function j(c){var b=a(c).data(h);return!b||!b.validate||b.validate()}a(document).on("click","a[data-ajax=true]",function(a){a.preventDefault();f(this,{url:this.href,type:"GET",data:[]})});a(document).on("click","form[data-ajax=true] input[type=image]",function(c){var g=c.target.name,e=a(c.target),f=a(e.parents("form")[0]),d=e.offset();f.data(b,[{name:g+".x",value:Math.round(c.pageX-d.left)},{name:g+".y",value:Math.round(c.pageY-d.top)}]);setTimeout(function(){f.removeData(b)},0)});a(document).on("click","form[data-ajax=true] :submit",function(e){var g=e.currentTarget.name,f=a(e.target),c=a(f.parents("form")[0]);c.data(b,g?[{name:g,value:e.currentTarget.value}]:[]);c.data(d,f);setTimeout(function(){c.removeData(b);c.removeData(d)},0)});a(document).on("submit","form[data-ajax=true]",function(h){var e=a(this).data(b)||[],c=a(this).data(d),g=c&&c.hasClass("cancel");h.preventDefault();if(!g&&!j(this))return;f(this,{url:this.action,type:this.method||"GET",data:e.concat(a(this).serializeArray())})})})(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b'; 58 | } 59 | 60 | this.wrap = $('
').addClass(opts.position).appendTo('body'); 61 | this.list = $('
    ' + list + '
').appendTo(this.wrap); 62 | 63 | //Load each thumbnail 64 | $.each(obj.group, function (i) { 65 | var href = thumbSource( obj.group[ i ] ); 66 | 67 | if (!href) { 68 | return; 69 | } 70 | 71 | $("").load(function () { 72 | var width = this.width, 73 | height = this.height, 74 | widthRatio, heightRatio, parent; 75 | 76 | if (!that.list || !width || !height) { 77 | return; 78 | } 79 | 80 | //Calculate thumbnail width/height and center it 81 | widthRatio = width / thumbWidth; 82 | heightRatio = height / thumbHeight; 83 | 84 | parent = that.list.children().eq(i).find('a'); 85 | 86 | if (widthRatio >= 1 && heightRatio >= 1) { 87 | if (widthRatio > heightRatio) { 88 | width = Math.floor(width / heightRatio); 89 | height = thumbHeight; 90 | 91 | } else { 92 | width = thumbWidth; 93 | height = Math.floor(height / widthRatio); 94 | } 95 | } 96 | 97 | $(this).css({ 98 | width : width, 99 | height : height, 100 | top : Math.floor(thumbHeight / 2 - height / 2), 101 | left : Math.floor(thumbWidth / 2 - width / 2) 102 | }); 103 | 104 | parent.width(thumbWidth).height(thumbHeight); 105 | 106 | $(this).hide().appendTo(parent).fadeIn(300); 107 | 108 | }).attr('src', href); 109 | }); 110 | 111 | //Set initial width 112 | this.width = this.list.children().eq(0).outerWidth(true); 113 | 114 | this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); 115 | }, 116 | 117 | beforeLoad: function (opts, obj) { 118 | //Remove self if gallery do not have at least two items 119 | if (obj.group.length < 2) { 120 | obj.helpers.thumbs = false; 121 | 122 | return; 123 | } 124 | 125 | //Increase bottom margin to give space for thumbs 126 | obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); 127 | }, 128 | 129 | afterShow: function (opts, obj) { 130 | //Check if exists and create or update list 131 | if (this.list) { 132 | this.onUpdate(opts, obj); 133 | 134 | } else { 135 | this.init(opts, obj); 136 | } 137 | 138 | //Set active element 139 | this.list.children().removeClass('active').eq(obj.index).addClass('active'); 140 | }, 141 | 142 | //Center list 143 | onUpdate: function (opts, obj) { 144 | if (this.list) { 145 | this.list.stop(true).animate({ 146 | 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) 147 | }, 150); 148 | } 149 | }, 150 | 151 | beforeClose: function () { 152 | if (this.wrap) { 153 | this.wrap.remove(); 154 | } 155 | 156 | this.wrap = null; 157 | this.list = null; 158 | this.width = 0; 159 | } 160 | } 161 | 162 | }(jQuery)); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/respond.matchmedia.addListener.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";if(a.matchMedia&&a.matchMedia("all").addListener)return!1;var b=a.matchMedia,c=b("only all").matches,d=!1,e=0,f=[],g=function(){a.clearTimeout(e),e=a.setTimeout(function(){for(var c=0,d=f.length;d>c;c++){var e=f[c].mql,g=f[c].listeners||[],h=b(e.media).matches;if(h!==e.matches){e.matches=h;for(var i=0,j=g.length;j>i;i++)g[i].call(a,e)}}},30)};a.matchMedia=function(e){var h=b(e),i=[],j=0;return h.addListener=function(b){c&&(d||(d=!0,a.addEventListener("resize",g,!0)),0===j&&(j=f.push({mql:h,listeners:i})),i.push(b))},h.removeListener=function(a){for(var b=0,c=i.length;c>b;b++)i[b]===a&&i.splice(b,1)},h}}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b 2 | 3 | 4 | 5 | 6 | 您的 ASP.NET 應用程式 7 | 96 | 97 | 98 | 99 | 103 | 104 |
105 |
106 |

此應用程式的組成項目:

107 |
    108 |
  • 範例頁面顯示首頁、關於和連絡人間的導覽。
  • 109 |
  • 使用 Bootstrap 進行佈景主題
  • 110 |
  • 驗證若已選取,顯示如何註冊並登入
  • 111 |
  • 使用 NuGet 管理 ASP.NET 功能
  • 112 |
113 |
114 | 115 | 132 | 133 |
134 |

部署

135 | 140 |
141 | 142 |
143 |

取得說明

144 | 148 |
149 |
150 | 151 | 152 | -------------------------------------------------------------------------------- /Hexon.MvcTrig/Hexon.MvcTrig.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1A488C44-DCA1-49B4-BDC3-100FE7F0A737} 8 | Library 9 | Properties 10 | Hexon.MvcTrig 11 | Hexon.MvcTrig 12 | v4.5.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 35 | True 36 | 37 | 38 | ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 39 | True 40 | 41 | 42 | 43 | 44 | 45 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll 46 | True 47 | 48 | 49 | ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll 50 | True 51 | 52 | 53 | ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll 54 | True 55 | 56 | 57 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll 58 | True 59 | 60 | 61 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll 62 | True 63 | 64 | 65 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll 66 | True 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 104 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /* 16 | ** Unobtrusive validation support library for jQuery and jQuery Validate 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | (function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,e){var b=a(this).find("[data-valmsg-for='"+f(e[0].name)+"']"),d=b.attr("data-valmsg-replace"),g=d?a.parseJSON(d)!==false:null;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(g){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
  • ").html(this.message).appendTo(b)})}}function k(d){var b=d.data("unobtrusiveContainer"),c=b.attr("data-valmsg-replace"),e=c?a.parseJSON(c):null;if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");d.removeData("unobtrusiveContainer");e&&b.empty()}}function n(){var b=a(this),c="__jquery_unobtrusive_validation_form_reset";if(b.data(c))return;b.data(c,true);try{b.data("validator").resetForm()}finally{b.removeData(c)}b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(b){var c=a(b),f=c.data(e),i=a.proxy(n,b),g=d.unobtrusive.options||{},h=function(e,d){var c=g[e];c&&a.isFunction(c)&&c.apply(b,d)};if(!f){f={options:{errorClass:g.errorClass||"input-validation-error",errorElement:g.errorElement||"span",errorPlacement:function(){m.apply(b,arguments);h("errorPlacement",arguments)},invalidHandler:function(){l.apply(b,arguments);h("invalidHandler",arguments)},messages:{},rules:{},success:function(){k.apply(b,arguments);h("success",arguments)}},attachValidation:function(){c.off("reset."+e,i).on("reset."+e,i).validate(this.options)},validate:function(){c.validate();return c.valid()}};c.data(e,f)}return f}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(c){var b=a(c),e=b.parents().addBack().filter("form").add(b.find("form")).has("[data-val=true]");b.find("[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});e.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});d.addMethod("nonalphamin",function(c,d,b){var a;if(b){a=c.match(/\W/g);a=a&&a.length>=b}return a});if(d.methods.extension){b.addSingleVal("accept","mimtype");b.addSingleVal("extension","extension")}else b.addSingleVal("extension","extension","accept");b.addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input").filter("[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){var d=a(b.form).find(":input").filter("[name='"+f(c)+"']");return d.is(":checkbox")?d.filter(":checked").val()||d.filter(":hidden").val()||"":d.is(":radio")?d.filter(":checked").val()||"":d.val()}});c(b,"remote",d)});b.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&c(a,"minlength",a.params.min);a.params.nonalphamin&&c(a,"nonalphamin",a.params.nonalphamin);a.params.regex&&c(a,"regex",a.params.regex)});a(function(){d.unobtrusive.parse(document)})})(jQuery); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.fancybox-media.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Media helper for fancyBox 3 | * version: 1.0.6 (Fri, 14 Jun 2013) 4 | * @requires fancyBox v2.0 or later 5 | * 6 | * Usage: 7 | * $(".fancybox").fancybox({ 8 | * helpers : { 9 | * media: true 10 | * } 11 | * }); 12 | * 13 | * Set custom URL parameters: 14 | * $(".fancybox").fancybox({ 15 | * helpers : { 16 | * media: { 17 | * youtube : { 18 | * params : { 19 | * autoplay : 0 20 | * } 21 | * } 22 | * } 23 | * } 24 | * }); 25 | * 26 | * Or: 27 | * $(".fancybox").fancybox({, 28 | * helpers : { 29 | * media: true 30 | * }, 31 | * youtube : { 32 | * autoplay: 0 33 | * } 34 | * }); 35 | * 36 | * Supports: 37 | * 38 | * Youtube 39 | * http://www.youtube.com/watch?v=opj24KnzrWo 40 | * http://www.youtube.com/embed/opj24KnzrWo 41 | * http://youtu.be/opj24KnzrWo 42 | * http://www.youtube-nocookie.com/embed/opj24KnzrWo 43 | * Vimeo 44 | * http://vimeo.com/40648169 45 | * http://vimeo.com/channels/staffpicks/38843628 46 | * http://vimeo.com/groups/surrealism/videos/36516384 47 | * http://player.vimeo.com/video/45074303 48 | * Metacafe 49 | * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ 50 | * http://www.metacafe.com/watch/7635964/ 51 | * Dailymotion 52 | * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people 53 | * Twitvid 54 | * http://twitvid.com/QY7MD 55 | * Twitpic 56 | * http://twitpic.com/7p93st 57 | * Instagram 58 | * http://instagr.am/p/IejkuUGxQn/ 59 | * http://instagram.com/p/IejkuUGxQn/ 60 | * Google maps 61 | * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 62 | * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 63 | * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 64 | */ 65 | (function ($) { 66 | "use strict"; 67 | 68 | //Shortcut for fancyBox object 69 | var F = $.fancybox, 70 | format = function( url, rez, params ) { 71 | params = params || ''; 72 | 73 | if ( $.type( params ) === "object" ) { 74 | params = $.param(params, true); 75 | } 76 | 77 | $.each(rez, function(key, value) { 78 | url = url.replace( '$' + key, value || '' ); 79 | }); 80 | 81 | if (params.length) { 82 | url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; 83 | } 84 | 85 | return url; 86 | }; 87 | 88 | //Add helper object 89 | F.helpers.media = { 90 | defaults : { 91 | youtube : { 92 | matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, 93 | params : { 94 | autoplay : 1, 95 | autohide : 1, 96 | fs : 1, 97 | rel : 0, 98 | hd : 1, 99 | wmode : 'opaque', 100 | enablejsapi : 1 101 | }, 102 | type : 'iframe', 103 | url : '//www.youtube.com/embed/$3' 104 | }, 105 | vimeo : { 106 | matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, 107 | params : { 108 | autoplay : 1, 109 | hd : 1, 110 | show_title : 1, 111 | show_byline : 1, 112 | show_portrait : 0, 113 | fullscreen : 1 114 | }, 115 | type : 'iframe', 116 | url : '//player.vimeo.com/video/$1' 117 | }, 118 | metacafe : { 119 | matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, 120 | params : { 121 | autoPlay : 'yes' 122 | }, 123 | type : 'swf', 124 | url : function( rez, params, obj ) { 125 | obj.swf.flashVars = 'playerVars=' + $.param( params, true ); 126 | 127 | return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; 128 | } 129 | }, 130 | dailymotion : { 131 | matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, 132 | params : { 133 | additionalInfos : 0, 134 | autoStart : 1 135 | }, 136 | type : 'swf', 137 | url : '//www.dailymotion.com/swf/video/$1' 138 | }, 139 | twitvid : { 140 | matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, 141 | params : { 142 | autoplay : 0 143 | }, 144 | type : 'iframe', 145 | url : '//www.twitvid.com/embed.php?guid=$1' 146 | }, 147 | twitpic : { 148 | matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, 149 | type : 'image', 150 | url : '//twitpic.com/show/full/$1/' 151 | }, 152 | instagram : { 153 | matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, 154 | type : 'image', 155 | url : '//$1/p/$2/media/?size=l' 156 | }, 157 | google_maps : { 158 | matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, 159 | type : 'iframe', 160 | url : function( rez ) { 161 | return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); 162 | } 163 | } 164 | }, 165 | 166 | beforeLoad : function(opts, obj) { 167 | var url = obj.href || '', 168 | type = false, 169 | what, 170 | item, 171 | rez, 172 | params; 173 | 174 | for (what in opts) { 175 | if (opts.hasOwnProperty(what)) { 176 | item = opts[ what ]; 177 | rez = url.match( item.matcher ); 178 | 179 | if (rez) { 180 | type = item.type; 181 | params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); 182 | 183 | url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); 184 | 185 | break; 186 | } 187 | } 188 | } 189 | 190 | if (type) { 191 | obj.href = url; 192 | obj.type = type; 193 | 194 | obj.autoHeight = false; 195 | } 196 | } 197 | }; 198 | 199 | }(jQuery)); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/jquery.fancybox.css: -------------------------------------------------------------------------------- 1 | /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ 2 | .fancybox-wrap, 3 | .fancybox-skin, 4 | .fancybox-outer, 5 | .fancybox-inner, 6 | .fancybox-image, 7 | .fancybox-wrap iframe, 8 | .fancybox-wrap object, 9 | .fancybox-nav, 10 | .fancybox-nav span, 11 | .fancybox-tmp 12 | { 13 | padding: 0; 14 | margin: 0; 15 | border: 0; 16 | outline: none; 17 | vertical-align: top; 18 | } 19 | 20 | .fancybox-wrap { 21 | position: absolute; 22 | top: 0; 23 | left: 0; 24 | z-index: 8020; 25 | } 26 | 27 | .fancybox-skin { 28 | position: relative; 29 | background: #f9f9f9; 30 | color: #444; 31 | text-shadow: none; 32 | -webkit-border-radius: 4px; 33 | -moz-border-radius: 4px; 34 | border-radius: 4px; 35 | } 36 | 37 | .fancybox-opened { 38 | z-index: 8030; 39 | } 40 | 41 | .fancybox-opened .fancybox-skin { 42 | -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 43 | -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 44 | box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 45 | } 46 | 47 | .fancybox-outer, .fancybox-inner { 48 | position: relative; 49 | } 50 | 51 | .fancybox-inner { 52 | overflow: hidden; 53 | } 54 | 55 | .fancybox-type-iframe .fancybox-inner { 56 | -webkit-overflow-scrolling: touch; 57 | } 58 | 59 | .fancybox-error { 60 | color: #444; 61 | font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; 62 | margin: 0; 63 | padding: 15px; 64 | white-space: nowrap; 65 | } 66 | 67 | .fancybox-image, .fancybox-iframe { 68 | display: block; 69 | width: 100%; 70 | height: 100%; 71 | } 72 | 73 | .fancybox-image { 74 | max-width: 100%; 75 | max-height: 100%; 76 | } 77 | 78 | #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { 79 | background-image: url('fancybox/fancybox_sprite.png'); 80 | } 81 | 82 | #fancybox-loading { 83 | position: fixed; 84 | top: 50%; 85 | left: 50%; 86 | margin-top: -22px; 87 | margin-left: -22px; 88 | background-position: 0 -108px; 89 | opacity: 0.8; 90 | cursor: pointer; 91 | z-index: 8060; 92 | } 93 | 94 | #fancybox-loading div { 95 | width: 44px; 96 | height: 44px; 97 | background: url('fancybox/fancybox_loading.gif') center center no-repeat; 98 | } 99 | 100 | .fancybox-close { 101 | position: absolute; 102 | top: -18px; 103 | right: -18px; 104 | width: 36px; 105 | height: 36px; 106 | cursor: pointer; 107 | z-index: 8040; 108 | } 109 | 110 | .fancybox-nav { 111 | position: absolute; 112 | top: 0; 113 | width: 40%; 114 | height: 100%; 115 | cursor: pointer; 116 | text-decoration: none; 117 | background: transparent url('fancybox/blank.gif'); /* helps IE */ 118 | -webkit-tap-highlight-color: rgba(0,0,0,0); 119 | z-index: 8040; 120 | } 121 | 122 | a.fancybox-nav:hover , a.fancybox-close:hover 123 | { 124 | background-color: transparent; 125 | } 126 | 127 | .fancybox-prev { 128 | left: 0; 129 | } 130 | 131 | .fancybox-next { 132 | right: 0; 133 | } 134 | 135 | .fancybox-nav span { 136 | position: absolute; 137 | top: 50%; 138 | width: 36px; 139 | height: 34px; 140 | margin-top: -18px; 141 | cursor: pointer; 142 | z-index: 8040; 143 | visibility: hidden; 144 | } 145 | 146 | .fancybox-prev span { 147 | left: 10px; 148 | background-position: 0 -36px; 149 | } 150 | 151 | .fancybox-next span { 152 | right: 10px; 153 | background-position: 0 -72px; 154 | } 155 | 156 | .fancybox-nav:hover span { 157 | visibility: visible; 158 | } 159 | 160 | .fancybox-tmp { 161 | position: absolute; 162 | top: -99999px; 163 | left: -99999px; 164 | visibility: hidden; 165 | max-width: 99999px; 166 | max-height: 99999px; 167 | overflow: visible !important; 168 | } 169 | 170 | /* Overlay helper */ 171 | 172 | .fancybox-lock { 173 | overflow: hidden !important; 174 | width: auto; 175 | } 176 | 177 | .fancybox-lock body { 178 | overflow: hidden !important; 179 | } 180 | 181 | .fancybox-lock-test { 182 | overflow-y: hidden !important; 183 | } 184 | 185 | .fancybox-overlay { 186 | position: absolute; 187 | top: 0; 188 | left: 0; 189 | overflow: hidden; 190 | display: none; 191 | z-index: 8010; 192 | background: url('fancybox/fancybox_overlay.png'); 193 | } 194 | 195 | .fancybox-overlay-fixed { 196 | position: fixed; 197 | bottom: 0; 198 | right: 0; 199 | } 200 | 201 | .fancybox-lock .fancybox-overlay { 202 | overflow: auto; 203 | overflow-y: scroll; 204 | } 205 | 206 | /* Title helper */ 207 | 208 | .fancybox-title { 209 | visibility: hidden; 210 | font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; 211 | position: relative; 212 | text-shadow: none; 213 | z-index: 8050; 214 | } 215 | 216 | .fancybox-opened .fancybox-title { 217 | visibility: visible; 218 | } 219 | 220 | .fancybox-title-float-wrap { 221 | position: absolute; 222 | bottom: 0; 223 | right: 50%; 224 | margin-bottom: -35px; 225 | z-index: 8050; 226 | text-align: center; 227 | } 228 | 229 | .fancybox-title-float-wrap .child { 230 | display: inline-block; 231 | margin-right: -100%; 232 | padding: 2px 20px; 233 | background: transparent; /* Fallback for web browsers that doesn't support RGBa */ 234 | background: rgba(0, 0, 0, 0.8); 235 | -webkit-border-radius: 15px; 236 | -moz-border-radius: 15px; 237 | border-radius: 15px; 238 | text-shadow: 0 1px 2px #222; 239 | color: #FFF; 240 | font-weight: bold; 241 | line-height: 24px; 242 | white-space: nowrap; 243 | } 244 | 245 | .fancybox-title-outside-wrap { 246 | position: relative; 247 | margin-top: 10px; 248 | color: #fff; 249 | } 250 | 251 | .fancybox-title-inside-wrap { 252 | padding-top: 10px; 253 | } 254 | 255 | .fancybox-title-over-wrap { 256 | position: absolute; 257 | bottom: 0; 258 | left: 0; 259 | color: #fff; 260 | padding: 10px; 261 | background: #000; 262 | background: rgba(0, 0, 0, .8); 263 | } 264 | 265 | /*Retina graphics!*/ 266 | @media only screen and (-webkit-min-device-pixel-ratio: 1.5), 267 | only screen and (min--moz-device-pixel-ratio: 1.5), 268 | only screen and (min-device-pixel-ratio: 1.5){ 269 | 270 | #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { 271 | background-image: url('fancybox/fancybox_sprite@2x.png'); 272 | background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ 273 | } 274 | 275 | #fancybox-loading div { 276 | background-image: url('fancybox/fancybox_loading@2x.gif'); 277 | background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ 278 | } 279 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/jquery.unobtrusive-ajax.js: -------------------------------------------------------------------------------- 1 | /* NUGET: BEGIN LICENSE TEXT 2 | * 3 | * Microsoft grants you the right to use these script files for the sole 4 | * purpose of either: (i) interacting through your browser with the Microsoft 5 | * website or online service, subject to the applicable licensing or use 6 | * terms; or (ii) using the files as included with a Microsoft product subject 7 | * to that product's license terms. Microsoft reserves all other rights to the 8 | * files not expressly granted by Microsoft, whether by implication, estoppel 9 | * or otherwise. Insofar as a script file is dual licensed under GPL, 10 | * Microsoft neither took the code under GPL nor distributes it thereunder but 11 | * under the terms set out in this paragraph. All notices and licenses 12 | * below are for informational purposes only. 13 | * 14 | * NUGET: END LICENSE TEXT */ 15 | /*! 16 | ** Unobtrusive Ajax support library for jQuery 17 | ** Copyright (C) Microsoft Corporation. All rights reserved. 18 | */ 19 | 20 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 21 | /*global window: false, jQuery: false */ 22 | 23 | (function ($) { 24 | var data_click = "unobtrusiveAjaxClick", 25 | data_target = "unobtrusiveAjaxClickTarget", 26 | data_validation = "unobtrusiveValidation"; 27 | 28 | function getFunction(code, argNames) { 29 | var fn = window, parts = (code || "").split("."); 30 | while (fn && parts.length) { 31 | fn = fn[parts.shift()]; 32 | } 33 | if (typeof (fn) === "function") { 34 | return fn; 35 | } 36 | argNames.push(code); 37 | return Function.constructor.apply(null, argNames); 38 | } 39 | 40 | function isMethodProxySafe(method) { 41 | return method === "GET" || method === "POST"; 42 | } 43 | 44 | function asyncOnBeforeSend(xhr, method) { 45 | if (!isMethodProxySafe(method)) { 46 | xhr.setRequestHeader("X-HTTP-Method-Override", method); 47 | } 48 | } 49 | 50 | function asyncOnSuccess(element, data, contentType) { 51 | var mode; 52 | 53 | if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 54 | return; 55 | } 56 | 57 | mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 58 | $(element.getAttribute("data-ajax-update")).each(function (i, update) { 59 | var top; 60 | 61 | switch (mode) { 62 | case "BEFORE": 63 | top = update.firstChild; 64 | $("
    ").html(data).contents().each(function () { 65 | update.insertBefore(this, top); 66 | }); 67 | break; 68 | case "AFTER": 69 | $("
    ").html(data).contents().each(function () { 70 | update.appendChild(this); 71 | }); 72 | break; 73 | case "REPLACE-WITH": 74 | $(update).replaceWith(data); 75 | break; 76 | default: 77 | $(update).html(data); 78 | break; 79 | } 80 | }); 81 | } 82 | 83 | function asyncRequest(element, options) { 84 | var confirm, loading, method, duration; 85 | 86 | confirm = element.getAttribute("data-ajax-confirm"); 87 | if (confirm && !window.confirm(confirm)) { 88 | return; 89 | } 90 | 91 | loading = $(element.getAttribute("data-ajax-loading")); 92 | duration = parseInt(element.getAttribute("data-ajax-loading-duration"), 10) || 0; 93 | 94 | $.extend(options, { 95 | type: element.getAttribute("data-ajax-method") || undefined, 96 | url: element.getAttribute("data-ajax-url") || undefined, 97 | cache: !!element.getAttribute("data-ajax-cache"), 98 | beforeSend: function (xhr) { 99 | var result; 100 | asyncOnBeforeSend(xhr, method); 101 | result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(element, arguments); 102 | if (result !== false) { 103 | loading.show(duration); 104 | } 105 | return result; 106 | }, 107 | complete: function () { 108 | loading.hide(duration); 109 | getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(element, arguments); 110 | }, 111 | success: function (data, status, xhr) { 112 | asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 113 | getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(element, arguments); 114 | }, 115 | error: function () { 116 | getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]).apply(element, arguments); 117 | } 118 | }); 119 | 120 | options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 121 | 122 | method = options.type.toUpperCase(); 123 | if (!isMethodProxySafe(method)) { 124 | options.type = "POST"; 125 | options.data.push({ name: "X-HTTP-Method-Override", value: method }); 126 | } 127 | 128 | $.ajax(options); 129 | } 130 | 131 | function validate(form) { 132 | var validationInfo = $(form).data(data_validation); 133 | return !validationInfo || !validationInfo.validate || validationInfo.validate(); 134 | } 135 | 136 | $(document).on("click", "a[data-ajax=true]", function (evt) { 137 | evt.preventDefault(); 138 | asyncRequest(this, { 139 | url: this.href, 140 | type: "GET", 141 | data: [] 142 | }); 143 | }); 144 | 145 | $(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) { 146 | var name = evt.target.name, 147 | target = $(evt.target), 148 | form = $(target.parents("form")[0]), 149 | offset = target.offset(); 150 | 151 | form.data(data_click, [ 152 | { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 153 | { name: name + ".y", value: Math.round(evt.pageY - offset.top) } 154 | ]); 155 | 156 | setTimeout(function () { 157 | form.removeData(data_click); 158 | }, 0); 159 | }); 160 | 161 | $(document).on("click", "form[data-ajax=true] :submit", function (evt) { 162 | var name = evt.currentTarget.name, 163 | target = $(evt.target), 164 | form = $(target.parents("form")[0]); 165 | 166 | form.data(data_click, name ? [{ name: name, value: evt.currentTarget.value }] : []); 167 | form.data(data_target, target); 168 | 169 | setTimeout(function () { 170 | form.removeData(data_click); 171 | form.removeData(data_target); 172 | }, 0); 173 | }); 174 | 175 | $(document).on("submit", "form[data-ajax=true]", function (evt) { 176 | var clickInfo = $(this).data(data_click) || [], 177 | clickTarget = $(this).data(data_target), 178 | isCancel = clickTarget && clickTarget.hasClass("cancel"); 179 | evt.preventDefault(); 180 | if (!isCancel && !validate(this)) { 181 | return; 182 | } 183 | asyncRequest(this, { 184 | url: this.action, 185 | type: this.method || "GET", 186 | data: clickInfo.concat($(this).serializeArray()) 187 | }); 188 | }); 189 | }(jQuery)); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/respond.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | (function(w) { 4 | "use strict"; 5 | w.matchMedia = w.matchMedia || function(doc, undefined) { 6 | var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); 7 | div.id = "mq-test-1"; 8 | div.style.cssText = "position:absolute;top:-100em"; 9 | fakeBody.style.background = "none"; 10 | fakeBody.appendChild(div); 11 | return function(q) { 12 | div.innerHTML = '­'; 13 | docElem.insertBefore(fakeBody, refNode); 14 | bool = div.offsetWidth === 42; 15 | docElem.removeChild(fakeBody); 16 | return { 17 | matches: bool, 18 | media: q 19 | }; 20 | }; 21 | }(w.document); 22 | })(this); 23 | 24 | /*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ 25 | (function(w) { 26 | "use strict"; 27 | var respond = {}; 28 | w.respond = respond; 29 | respond.update = function() {}; 30 | var requestQueue = [], xmlHttp = function() { 31 | var xmlhttpmethod = false; 32 | try { 33 | xmlhttpmethod = new w.XMLHttpRequest(); 34 | } catch (e) { 35 | xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); 36 | } 37 | return function() { 38 | return xmlhttpmethod; 39 | }; 40 | }(), ajax = function(url, callback) { 41 | var req = xmlHttp(); 42 | if (!req) { 43 | return; 44 | } 45 | req.open("GET", url, true); 46 | req.onreadystatechange = function() { 47 | if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { 48 | return; 49 | } 50 | callback(req.responseText); 51 | }; 52 | if (req.readyState === 4) { 53 | return; 54 | } 55 | req.send(null); 56 | }; 57 | respond.ajax = ajax; 58 | respond.queue = requestQueue; 59 | respond.regex = { 60 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, 61 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, 62 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, 63 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, 64 | only: /(only\s+)?([a-zA-Z]+)\s?/, 65 | minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, 66 | maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ 67 | }; 68 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; 69 | if (respond.mediaQueriesSupported) { 70 | return; 71 | } 72 | var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() { 73 | var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; 74 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 75 | if (!body) { 76 | body = fakeUsed = doc.createElement("body"); 77 | body.style.background = "none"; 78 | } 79 | docElem.style.fontSize = "100%"; 80 | body.style.fontSize = "100%"; 81 | body.appendChild(div); 82 | if (fakeUsed) { 83 | docElem.insertBefore(body, docElem.firstChild); 84 | } 85 | ret = div.offsetWidth; 86 | if (fakeUsed) { 87 | docElem.removeChild(body); 88 | } else { 89 | body.removeChild(div); 90 | } 91 | docElem.style.fontSize = originalHTMLFontSize; 92 | if (originalBodyFontSize) { 93 | body.style.fontSize = originalBodyFontSize; 94 | } 95 | ret = eminpx = parseFloat(ret); 96 | return ret; 97 | }, applyMedia = function(fromResize) { 98 | var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime(); 99 | if (fromResize && lastCall && now - lastCall < resizeThrottle) { 100 | w.clearTimeout(resizeDefer); 101 | resizeDefer = w.setTimeout(applyMedia, resizeThrottle); 102 | return; 103 | } else { 104 | lastCall = now; 105 | } 106 | for (var i in mediastyles) { 107 | if (mediastyles.hasOwnProperty(i)) { 108 | var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; 109 | if (!!min) { 110 | min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 111 | } 112 | if (!!max) { 113 | max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 114 | } 115 | if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { 116 | if (!styleBlocks[thisstyle.media]) { 117 | styleBlocks[thisstyle.media] = []; 118 | } 119 | styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); 120 | } 121 | } 122 | } 123 | for (var j in appendedEls) { 124 | if (appendedEls.hasOwnProperty(j)) { 125 | if (appendedEls[j] && appendedEls[j].parentNode === head) { 126 | head.removeChild(appendedEls[j]); 127 | } 128 | } 129 | } 130 | appendedEls.length = 0; 131 | for (var k in styleBlocks) { 132 | if (styleBlocks.hasOwnProperty(k)) { 133 | var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); 134 | ss.type = "text/css"; 135 | ss.media = k; 136 | head.insertBefore(ss, lastLink.nextSibling); 137 | if (ss.styleSheet) { 138 | ss.styleSheet.cssText = css; 139 | } else { 140 | ss.appendChild(doc.createTextNode(css)); 141 | } 142 | appendedEls.push(ss); 143 | } 144 | } 145 | }, translate = function(styles, href, media) { 146 | var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; 147 | href = href.substring(0, href.lastIndexOf("/")); 148 | var repUrls = function(css) { 149 | return css.replace(respond.regex.urls, "$1" + href + "$2$3"); 150 | }, useMedia = !ql && media; 151 | if (href.length) { 152 | href += "/"; 153 | } 154 | if (useMedia) { 155 | ql = 1; 156 | } 157 | for (var i = 0; i < ql; i++) { 158 | var fullq, thisq, eachq, eql; 159 | if (useMedia) { 160 | fullq = media; 161 | rules.push(repUrls(styles)); 162 | } else { 163 | fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; 164 | rules.push(RegExp.$2 && repUrls(RegExp.$2)); 165 | } 166 | eachq = fullq.split(","); 167 | eql = eachq.length; 168 | for (var j = 0; j < eql; j++) { 169 | thisq = eachq[j]; 170 | mediastyles.push({ 171 | media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", 172 | rules: rules.length - 1, 173 | hasquery: thisq.indexOf("(") > -1, 174 | minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 175 | maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") 176 | }); 177 | } 178 | } 179 | applyMedia(); 180 | }, makeRequests = function() { 181 | if (requestQueue.length) { 182 | var thisRequest = requestQueue.shift(); 183 | ajax(thisRequest.href, function(styles) { 184 | translate(styles, thisRequest.href, thisRequest.media); 185 | parsedSheets[thisRequest.href] = true; 186 | w.setTimeout(function() { 187 | makeRequests(); 188 | }, 0); 189 | }); 190 | } 191 | }, ripCSS = function() { 192 | for (var i = 0; i < links.length; i++) { 193 | var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 194 | if (!!href && isCSS && !parsedSheets[href]) { 195 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 196 | translate(sheet.styleSheet.rawCssText, href, media); 197 | parsedSheets[href] = true; 198 | } else { 199 | if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { 200 | if (href.substring(0, 2) === "//") { 201 | href = w.location.protocol + href; 202 | } 203 | requestQueue.push({ 204 | href: href, 205 | media: media 206 | }); 207 | } 208 | } 209 | } 210 | } 211 | makeRequests(); 212 | }; 213 | ripCSS(); 214 | respond.update = ripCSS; 215 | respond.getEmValue = getEmValue; 216 | function callMedia() { 217 | applyMedia(true); 218 | } 219 | if (w.addEventListener) { 220 | w.addEventListener("resize", callMedia, false); 221 | } else if (w.attachEvent) { 222 | w.attachEvent("onresize", callMedia); 223 | } 224 | })(this); -------------------------------------------------------------------------------- /Hexon.MvcTrig/TriggerContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Security.Policy; 6 | using System.Text; 7 | using System.Text.RegularExpressions; 8 | using System.Web; 9 | using System.Web.Mvc; 10 | using Newtonsoft.Json; 11 | using Newtonsoft.Json.Converters; 12 | using Newtonsoft.Json.Linq; 13 | 14 | namespace Hexon.MvcTrig 15 | { 16 | public class TriggerContext 17 | { 18 | #region Static 19 | 20 | internal static string _identifier = "D85DCDD2-2DBE-47DA-A810-73169E9BECFE_TriggerContext"; 21 | 22 | public static bool HasTrigger 23 | { 24 | get 25 | { 26 | var trigger = HttpContext.Current.Items[_identifier] as TriggerContext; 27 | 28 | if (trigger == null) 29 | { 30 | trigger = HttpContext.Current.Session[_identifier] as TriggerContext; 31 | } 32 | 33 | return trigger != null && trigger.Count > 0; 34 | } 35 | } 36 | 37 | public static TriggerContext Current 38 | { 39 | get 40 | { 41 | var trigger = HttpContext.Current.Items[_identifier] as TriggerContext; 42 | 43 | if (trigger == null) 44 | { 45 | trigger = HttpContext.Current.Session[_identifier] as TriggerContext; 46 | 47 | if (trigger != null) 48 | { 49 | // Probely come from previous action (302) 50 | HttpContext.Current.Session.Remove(_identifier); 51 | HttpContext.Current.Items[_identifier] = trigger = new TriggerContext(HttpContext.Current, trigger); 52 | } 53 | else 54 | { 55 | HttpContext.Current.Items[_identifier] = trigger = new TriggerContext(HttpContext.Current); 56 | } 57 | } 58 | 59 | return trigger; 60 | } 61 | } 62 | 63 | #endregion 64 | 65 | #region Private members 66 | 67 | private HttpContext _context; 68 | 69 | private List _commands = new List(); 70 | 71 | private List _lowPiorityCommands = new List(); 72 | 73 | private TriggerScope _currentScope = TriggerScope.Self; 74 | 75 | private bool _forceAjaxTrigger = false; 76 | 77 | #endregion 78 | 79 | #region Constructors 80 | 81 | private TriggerContext(HttpContext context) 82 | { 83 | _context = context; 84 | } 85 | 86 | private TriggerContext(HttpContext context, TriggerContext copyFrom) 87 | { 88 | _context = context; 89 | _commands = copyFrom._commands; 90 | _lowPiorityCommands = copyFrom._lowPiorityCommands; 91 | } 92 | 93 | #endregion 94 | 95 | public string Tag { get; set; } 96 | 97 | public void Add(string name, object data, bool lowPiority = false) 98 | { 99 | var list = lowPiority 100 | ? _lowPiorityCommands 101 | : _commands; 102 | 103 | list.Add(new TriggerCommand(_currentScope, name, data)); 104 | } 105 | 106 | /// 107 | /// 清除目前的所有 trigger 指令 108 | /// 109 | public void Clear() 110 | { 111 | _commands.Clear(); 112 | _lowPiorityCommands.Clear(); 113 | } 114 | 115 | public int Count 116 | { 117 | get { return _commands.Count + _lowPiorityCommands.Count; } 118 | } 119 | 120 | /// 121 | /// 切換 Trigger 的操作範圍到父視窗 122 | /// 123 | /// 124 | /// 125 | public TriggerContext Parent(Action call) 126 | { 127 | _currentScope = TriggerScope.Parent; 128 | call.Invoke(this); 129 | _currentScope = TriggerScope.Self; 130 | 131 | return this; 132 | } 133 | 134 | /// 135 | /// 切換 Trigger 的操作範圍到頂層視窗 136 | /// 137 | /// 138 | /// 139 | public TriggerContext Top(Action call) 140 | { 141 | _currentScope = TriggerScope.Top; 142 | call.Invoke(this); 143 | _currentScope = TriggerScope.Self; 144 | 145 | return this; 146 | } 147 | 148 | /// 149 | /// 重新載入本頁 150 | /// 151 | /// 152 | public TriggerContext Reload() 153 | { 154 | Add("reload", null); 155 | 156 | return this; 157 | } 158 | 159 | /// 160 | /// 強迫採用 AJAX 機制 (HTTP header) 161 | /// 162 | /// 163 | public TriggerContext AsAjaxTrigger() 164 | { 165 | _forceAjaxTrigger = true; 166 | 167 | return this; 168 | } 169 | 170 | /// 171 | /// 將所有 trigger 命令送出 172 | /// 173 | public void Flush() 174 | { 175 | if (Count > 0) 176 | { 177 | var commands = new List(); 178 | commands.AddRange(_commands); 179 | commands.AddRange(_lowPiorityCommands); 180 | 181 | if (_forceAjaxTrigger || _context.Request.Headers["X-Requested-With"] != null) 182 | { 183 | AjaxTrigger(commands); 184 | } 185 | else 186 | { 187 | PageTrigger(commands); 188 | } 189 | 190 | Clear(); 191 | } 192 | } 193 | 194 | /// 195 | /// Ajax Trigger 透過 HTTP header 傳遞,所以就算 ActionResult 是回傳 JSON 也沒問題 196 | /// 197 | /// 198 | private void AjaxTrigger(IEnumerable commands) 199 | { 200 | var response = _context.Response; 201 | 202 | response.AddHeader("X-Triggers", commands.Count().ToString()); 203 | response.AddHeader("X-TrigFrom", Tag); 204 | var i = 0; 205 | 206 | foreach (var command in commands) 207 | { 208 | var pack = new 209 | { 210 | scope = command.Scope, 211 | trigger = command.Trigger, 212 | data = command.Data 213 | }; 214 | 215 | var content = JsonConvert.SerializeObject(pack, new JsonSerializerSettings 216 | { 217 | Formatting = Formatting.None, 218 | Converters = new[] 219 | { 220 | new HttpHeaderStringEncodeConverter() 221 | } 222 | }); 223 | 224 | response.AddHeader("X-Trigger-" + (i++), content); 225 | } 226 | } 227 | 228 | /// 229 | /// 非 Ajax Trigger 透過 JavaScript 發動 230 | /// 231 | /// 232 | private void PageTrigger(IEnumerable commands) 233 | { 234 | var response = _context.Response; 235 | 236 | var sb = new StringBuilder(); 237 | sb.AppendLine("(function ($) { var targets = [ window, parent || window, top || parent || window ];"); 238 | 239 | foreach (var command in commands) 240 | { 241 | string target; 242 | 243 | switch (command.Scope) 244 | { 245 | case TriggerScope.Parent: 246 | target = "1"; 247 | break; 248 | case TriggerScope.Top: 249 | target = "2"; 250 | break; 251 | default: 252 | target = "0"; 253 | break; 254 | } 255 | sb.AppendFormat("targets[{0}].getTrigger(\"{1}\").apply(targets[{0}], [null, {2}, null]);\n", target, command.Trigger, JsonConvert.SerializeObject(command.Data, Formatting.None)); 256 | 257 | } 258 | sb.Append("})(jQuery);"); 259 | 260 | var tag = new TagBuilder("script"); 261 | tag.Attributes["type"] = "text/javascript"; 262 | tag.Attributes["data-trig"] = Tag; 263 | tag.InnerHtml = sb.ToString(); 264 | 265 | response.Write(tag); 266 | 267 | //response.Filter = new ContentFilter(response.Filter, x => 268 | //{ 269 | // if (! string.IsNullOrEmpty(x) && Regex.IsMatch(x, "")) 270 | // { 271 | // x = Regex.Replace(x, @"", tag + "$0"); 272 | // } 273 | // else 274 | // { 275 | // x += tag; 276 | // } 277 | 278 | // return x; 279 | //}); 280 | 281 | } 282 | } 283 | 284 | internal class ContentFilter : Stream 285 | { 286 | private Stream _shrink; 287 | private Func _filter; 288 | 289 | public ContentFilter(Stream shrink, Func filter) 290 | { 291 | _shrink = shrink; 292 | _filter = filter; 293 | } 294 | 295 | public override bool CanRead { get { return true; } } 296 | public override bool CanSeek { get { return true; } } 297 | public override bool CanWrite { get { return true; } } 298 | public override void Flush() { _shrink.Flush(); } 299 | public override long Length { get { return 0; } } 300 | public override long Position { get; set; } 301 | public override int Read(byte[] buffer, int offset, int count) 302 | { 303 | return _shrink.Read(buffer, offset, count); 304 | } 305 | public override long Seek(long offset, SeekOrigin origin) 306 | { 307 | return _shrink.Seek(offset, origin); 308 | } 309 | public override void SetLength(long value) 310 | { 311 | _shrink.SetLength(value); 312 | } 313 | public override void Close() 314 | { 315 | _shrink.Close(); 316 | } 317 | 318 | public override void Write(byte[] buffer, int offset, int count) 319 | { 320 | // capture the data and convert to string 321 | byte[] data = new byte[count]; 322 | Buffer.BlockCopy(buffer, offset, data, 0, count); 323 | string s = Encoding.UTF8.GetString(buffer); 324 | 325 | // filter the string 326 | s = _filter(s); 327 | 328 | // write the data to stream 329 | byte[] outdata = Encoding.UTF8.GetBytes(s); 330 | _shrink.Write(outdata, 0, outdata.GetLength(0)); 331 | } 332 | } 333 | } -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Scripts/respond.matchmedia.addListener.js: -------------------------------------------------------------------------------- 1 | /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ 2 | /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ 3 | (function(w) { 4 | "use strict"; 5 | w.matchMedia = w.matchMedia || function(doc, undefined) { 6 | var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); 7 | div.id = "mq-test-1"; 8 | div.style.cssText = "position:absolute;top:-100em"; 9 | fakeBody.style.background = "none"; 10 | fakeBody.appendChild(div); 11 | return function(q) { 12 | div.innerHTML = '­'; 13 | docElem.insertBefore(fakeBody, refNode); 14 | bool = div.offsetWidth === 42; 15 | docElem.removeChild(fakeBody); 16 | return { 17 | matches: bool, 18 | media: q 19 | }; 20 | }; 21 | }(w.document); 22 | })(this); 23 | 24 | /*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */ 25 | (function(w) { 26 | "use strict"; 27 | if (w.matchMedia && w.matchMedia("all").addListener) { 28 | return false; 29 | } 30 | var localMatchMedia = w.matchMedia, hasMediaQueries = localMatchMedia("only all").matches, isListening = false, timeoutID = 0, queries = [], handleChange = function(evt) { 31 | w.clearTimeout(timeoutID); 32 | timeoutID = w.setTimeout(function() { 33 | for (var i = 0, il = queries.length; i < il; i++) { 34 | var mql = queries[i].mql, listeners = queries[i].listeners || [], matches = localMatchMedia(mql.media).matches; 35 | if (matches !== mql.matches) { 36 | mql.matches = matches; 37 | for (var j = 0, jl = listeners.length; j < jl; j++) { 38 | listeners[j].call(w, mql); 39 | } 40 | } 41 | } 42 | }, 30); 43 | }; 44 | w.matchMedia = function(media) { 45 | var mql = localMatchMedia(media), listeners = [], index = 0; 46 | mql.addListener = function(listener) { 47 | if (!hasMediaQueries) { 48 | return; 49 | } 50 | if (!isListening) { 51 | isListening = true; 52 | w.addEventListener("resize", handleChange, true); 53 | } 54 | if (index === 0) { 55 | index = queries.push({ 56 | mql: mql, 57 | listeners: listeners 58 | }); 59 | } 60 | listeners.push(listener); 61 | }; 62 | mql.removeListener = function(listener) { 63 | for (var i = 0, il = listeners.length; i < il; i++) { 64 | if (listeners[i] === listener) { 65 | listeners.splice(i, 1); 66 | } 67 | } 68 | }; 69 | return mql; 70 | }; 71 | })(this); 72 | 73 | /*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ 74 | (function(w) { 75 | "use strict"; 76 | var respond = {}; 77 | w.respond = respond; 78 | respond.update = function() {}; 79 | var requestQueue = [], xmlHttp = function() { 80 | var xmlhttpmethod = false; 81 | try { 82 | xmlhttpmethod = new w.XMLHttpRequest(); 83 | } catch (e) { 84 | xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); 85 | } 86 | return function() { 87 | return xmlhttpmethod; 88 | }; 89 | }(), ajax = function(url, callback) { 90 | var req = xmlHttp(); 91 | if (!req) { 92 | return; 93 | } 94 | req.open("GET", url, true); 95 | req.onreadystatechange = function() { 96 | if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { 97 | return; 98 | } 99 | callback(req.responseText); 100 | }; 101 | if (req.readyState === 4) { 102 | return; 103 | } 104 | req.send(null); 105 | }; 106 | respond.ajax = ajax; 107 | respond.queue = requestQueue; 108 | respond.regex = { 109 | media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, 110 | keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, 111 | urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, 112 | findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, 113 | only: /(only\s+)?([a-zA-Z]+)\s?/, 114 | minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, 115 | maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ 116 | }; 117 | respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; 118 | if (respond.mediaQueriesSupported) { 119 | return; 120 | } 121 | var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() { 122 | var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; 123 | div.style.cssText = "position:absolute;font-size:1em;width:1em"; 124 | if (!body) { 125 | body = fakeUsed = doc.createElement("body"); 126 | body.style.background = "none"; 127 | } 128 | docElem.style.fontSize = "100%"; 129 | body.style.fontSize = "100%"; 130 | body.appendChild(div); 131 | if (fakeUsed) { 132 | docElem.insertBefore(body, docElem.firstChild); 133 | } 134 | ret = div.offsetWidth; 135 | if (fakeUsed) { 136 | docElem.removeChild(body); 137 | } else { 138 | body.removeChild(div); 139 | } 140 | docElem.style.fontSize = originalHTMLFontSize; 141 | if (originalBodyFontSize) { 142 | body.style.fontSize = originalBodyFontSize; 143 | } 144 | ret = eminpx = parseFloat(ret); 145 | return ret; 146 | }, applyMedia = function(fromResize) { 147 | var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime(); 148 | if (fromResize && lastCall && now - lastCall < resizeThrottle) { 149 | w.clearTimeout(resizeDefer); 150 | resizeDefer = w.setTimeout(applyMedia, resizeThrottle); 151 | return; 152 | } else { 153 | lastCall = now; 154 | } 155 | for (var i in mediastyles) { 156 | if (mediastyles.hasOwnProperty(i)) { 157 | var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; 158 | if (!!min) { 159 | min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 160 | } 161 | if (!!max) { 162 | max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); 163 | } 164 | if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { 165 | if (!styleBlocks[thisstyle.media]) { 166 | styleBlocks[thisstyle.media] = []; 167 | } 168 | styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); 169 | } 170 | } 171 | } 172 | for (var j in appendedEls) { 173 | if (appendedEls.hasOwnProperty(j)) { 174 | if (appendedEls[j] && appendedEls[j].parentNode === head) { 175 | head.removeChild(appendedEls[j]); 176 | } 177 | } 178 | } 179 | appendedEls.length = 0; 180 | for (var k in styleBlocks) { 181 | if (styleBlocks.hasOwnProperty(k)) { 182 | var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); 183 | ss.type = "text/css"; 184 | ss.media = k; 185 | head.insertBefore(ss, lastLink.nextSibling); 186 | if (ss.styleSheet) { 187 | ss.styleSheet.cssText = css; 188 | } else { 189 | ss.appendChild(doc.createTextNode(css)); 190 | } 191 | appendedEls.push(ss); 192 | } 193 | } 194 | }, translate = function(styles, href, media) { 195 | var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; 196 | href = href.substring(0, href.lastIndexOf("/")); 197 | var repUrls = function(css) { 198 | return css.replace(respond.regex.urls, "$1" + href + "$2$3"); 199 | }, useMedia = !ql && media; 200 | if (href.length) { 201 | href += "/"; 202 | } 203 | if (useMedia) { 204 | ql = 1; 205 | } 206 | for (var i = 0; i < ql; i++) { 207 | var fullq, thisq, eachq, eql; 208 | if (useMedia) { 209 | fullq = media; 210 | rules.push(repUrls(styles)); 211 | } else { 212 | fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; 213 | rules.push(RegExp.$2 && repUrls(RegExp.$2)); 214 | } 215 | eachq = fullq.split(","); 216 | eql = eachq.length; 217 | for (var j = 0; j < eql; j++) { 218 | thisq = eachq[j]; 219 | mediastyles.push({ 220 | media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", 221 | rules: rules.length - 1, 222 | hasquery: thisq.indexOf("(") > -1, 223 | minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 224 | maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") 225 | }); 226 | } 227 | } 228 | applyMedia(); 229 | }, makeRequests = function() { 230 | if (requestQueue.length) { 231 | var thisRequest = requestQueue.shift(); 232 | ajax(thisRequest.href, function(styles) { 233 | translate(styles, thisRequest.href, thisRequest.media); 234 | parsedSheets[thisRequest.href] = true; 235 | w.setTimeout(function() { 236 | makeRequests(); 237 | }, 0); 238 | }); 239 | } 240 | }, ripCSS = function() { 241 | for (var i = 0; i < links.length; i++) { 242 | var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 243 | if (!!href && isCSS && !parsedSheets[href]) { 244 | if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 245 | translate(sheet.styleSheet.rawCssText, href, media); 246 | parsedSheets[href] = true; 247 | } else { 248 | if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { 249 | if (href.substring(0, 2) === "//") { 250 | href = w.location.protocol + href; 251 | } 252 | requestQueue.push({ 253 | href: href, 254 | media: media 255 | }); 256 | } 257 | } 258 | } 259 | } 260 | makeRequests(); 261 | }; 262 | ripCSS(); 263 | respond.update = ripCSS; 264 | respond.getEmValue = getEmValue; 265 | function callMedia() { 266 | applyMedia(true); 267 | } 268 | if (w.addEventListener) { 269 | w.addEventListener("resize", callMedia, false); 270 | } else if (w.attachEvent) { 271 | w.attachEvent("onresize", callMedia); 272 | } 273 | })(this); -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Hexon.MvcTrig.Sample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {2FF5FDC4-B05D-4E39-B407-EC8750B4EF81} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | Hexon.MvcTrig.Sample 15 | Hexon.MvcTrig.Sample 16 | v4.5.1 17 | false 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | true 27 | full 28 | false 29 | bin\ 30 | DEBUG;TRACE 31 | prompt 32 | 4 33 | 34 | 35 | pdbonly 36 | true 37 | bin\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | 44 | ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll 45 | True 46 | 47 | 48 | 49 | ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll 50 | True 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll 63 | True 64 | 65 | 66 | ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll 67 | True 68 | 69 | 70 | ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll 71 | True 72 | 73 | 74 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll 75 | True 76 | 77 | 78 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll 79 | True 80 | 81 | 82 | ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll 83 | True 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | True 96 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 97 | 98 | 99 | 100 | 101 | 102 | 103 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 104 | 105 | 106 | ..\packages\WebGrease.1.6.0\lib\WebGrease.dll 107 | True 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | Global.asax 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | Web.config 186 | 187 | 188 | Web.config 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | {923b365a-9314-4a74-b620-4d59b24d57fb} 215 | Hexon.MvcTrig.Bootstrap 216 | 217 | 218 | {9a12e6e1-be2c-485a-89d9-cd69ed5927e5} 219 | Hexon.MvcTrig.Fancybox 220 | 221 | 222 | {1a488c44-dca1-49b4-bdc3-100fe7f0a737} 223 | Hexon.MvcTrig 224 | 225 | 226 | 227 | 10.0 228 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | True 241 | True 242 | 6574 243 | / 244 | http://localhost:6574/ 245 | False 246 | False 247 | 248 | 249 | False 250 | 251 | 252 | 253 | 254 | 260 | -------------------------------------------------------------------------------- /Hexon.MvcTrig.Sample/Content/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.4 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary:disabled,.btn-primary[disabled]{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} --------------------------------------------------------------------------------